IanSeyler / i808

8-bit virtual computer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example code data section

ncdulo opened this issue · comments

While browsing through this project, I gave the example Hello World program a shot. Initially when I compiled it using the command as specified in the readme, I got an unspecified error.
There was an error during compile. Output may not be as expected.

There was still an output binary so I went ahead and ran it. The output above the memory dump was garbage data, like it accessed uninitialized memory or the wrong location.

Doing some testing around, I was able to track the issue down to line 7 in helloworld.asm:
mov A, Message

I tried the command with square brackets surrounding Message to no avail and eventually tried moving the data section to the top of the program. Compiling with that last change still gave the same unspecified error however the output was correct when I ran the program.

Seeing the last commit was 5 years ago, I realize this project is likely no longer maintained. Just wanted to post this up for anyone else who should stumble across this project and run in to the same issue. Great work in all though, this is very interesting to dive into and learn how it works.

No worries. I'll take a look!

ian@elementary:~/Code/i808$ ./compiler examples/helloworld.asm -v
i808 Compiler v1.0b
Compiled on 2007.11.15, based on i808 spec 2006.08.30

Initial setup...
Checking for destination arch... i808

Compiler Stage 1 of 3 (Jumps)...
The following suboptions were detected...
- Start 
- Next 
- End 
- Message 

Compiler Stage 2 of 3 (Encoding)...
Suboption 'Start' at 0x00
Second argument error and MOV A, A
MOV D, val
Suboption 'Next' at 0x03
MOV B, [A]
CMP B, val
JE End (jump 1 at byte 0x06)
OUT D, B
INC A
JMP Next (jump 2 at byte 0x0A)
Suboption 'End' at 0x0C
JMP End (jump 3 at byte 0x0C)
Suboption 'Message' at 0x30

Compiler Stage 3 of 3 (Transribing)...
0x82 to 0x0C
0x85 to 0x03
0x85 to 0x0C

There was an error during compile. Output may not be as expected.

For some reason the Message address is not being parsed correctly by the compiler. Honestly though the compiler code is a mess..

Fixed this by just hardcoding the message address to register A. Terrible hack but the compiler is pretty terrible now that I've looked back on it.