jdah / jdh-8

An 8-bit minicomputer with a fully custom architecture
MIT License
1.29k stars 89 forks source link

How do I run programs? #32

Closed hdfsyu closed 2 years ago

hdfsyu commented 2 years ago

So I read through the README.md file and I tried everything I can to run a program I know how to get the screen running now but I have no idea how to run the demo.asm program I used the asm assembly executable and typed ./bin/asm programs/demo.asm demo then I loaded the output then ran the output with the command run 2 and it was blank also I ran the asm output because I thought the asm compiler was for compiling the programs and convert them into roms but it didn't work I also tried a few commands to make it work they didn't work either please help

jdah commented 2 years ago

Please read the README again, and the text of the program you're trying to run. demo.asm runs at ADDR_RAM (0xC000) so you need to load it there and get the PC there somehow. It also depends on the OS which you need to load from ostext.asm at address 0 as well. The run command takes the speed to run at, not the address, as an argument.

Please just use the issue if you have further problems rather than opening a new one.

hdfsyu commented 2 years ago

Please read the README again, and the text of the program you're trying to run. demo.asm runs at ADDR_RAM (0xC000) so you need to load it there and get the PC there somehow. It also depends on the OS which you need to load from ostext.asm at address 0 as well. The run command takes the speed to run at, not the address, as an argument.

Please just use the issue if you have further problems rather than opening a new one.

Ok im very sorry for annoying you with these issues but I am getting another error and I followed your instructions and yes I know run takes the speed I did run 2 for 2hz so now I ran the jdh-8 with /bin/emu -l programs/demo.asm 0xC000 -l os/ostext.asm 0 -m kb -m screen -r 1 and it is now saying Attempt to write to ROM at [0x0000] (pc=[0x0001]) Attempt to write to ROM at [0x534F] (pc=[0x0004]) Attempt to write to ROM at [0x4554] (pc=[0x0007]) Attempt to write to ROM at [0x4854] (pc=[0x000E]) Attempt to write to ROM at [0x414D] (pc=[0x001A]) Attempt to write to ROM at [0x5341] (pc=[0x001F]) Attempt to write to ROM at [0x4F46] (pc=[0x002D]) Attempt to write to ROM at [0x444A] (pc=[0x0035]) Attempt to write to ROM at [0x3B20] (pc=[0x0037]) Attempt to write to ROM at [0x000B] (pc=[0x0038]) Attempt to write to ROM at [0x4F52] (pc=[0x003B]) Attempt to write to ROM at [0x000B] (pc=[0x003F]) Attempt to write to ROM at [0x6F63] (pc=[0x0042]) Unused port for INB: 114 then the SCREEN module just does nothing and emu is frozen

jdah commented 2 years ago

You need to build the assembly files into binaries first. Use asm.

hdfsyu commented 2 years ago

Again I am sorry for wasting your time but now whenever I use ./bin/emu -l demo 0xC000 -l ostext 0 -m kb -m screen -r 1 and I have compiled both of the files using ./bin/asm filename -o filename without extension and now it displays this @jdah

hdfsyu commented 2 years ago

@jdah

jdah commented 2 years ago

This should be fixed now in 2b3b5983ec20b84a8b919c9e7a2cb136534ca2b8 :) Try with a full command like this to make sure that everything is built: ./bin/asm programs/holiday/holiday.asm -o program.bin && ./bin/asm os/ostext.asm -o os.bin && ./bin/emu -l os.bin 0 -l program.bin 0xC000 -m kb -m screen -r realtime

hdfsyu commented 2 years ago

Ok thanks!!