1whatleytay / saturn

A modern MIPS interpreter and assembler.
MIT License
32 stars 5 forks source link

Not Recognizing Characters #7

Closed AlekseyPanas closed 1 year ago

AlekseyPanas commented 1 year ago

Defining a newline string like so

image

and the printing it using the string syscall

image

results in this:

image

if you put the ascii values instead

image

then it works fine. It seems like Saturn doesn't automatically recognize characters

1whatleytay commented 1 year ago

Woah! Yep \0 doesn't have a special case and instead gets encoded as an actual 0 for some reason. In the meantime, you can type the literal 0 as you've done or use the .asciiz directive:

.byte '\n' 0 # you can mix and match
1whatleytay commented 1 year ago

Added a null terminator escape sequence in 0.1.6. After the build finishes in around ~20 you should be able to pull https://github.com/1whatleytay/saturn/releases/tag/app-v0.1.6 and this code should work. As for character literals though, I recommend using .asciiz!

Screenshot 2023-03-31 at 12 04 08 PM
AlekseyPanas commented 1 year ago

Oh I didn't even know .asciiz existed, thanks!

1whatleytay commented 1 year ago

Closing for the time being (until this feature rebels and decides to not work again).