Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My program crashed the VM #8

Closed
eekee opened this issue Jan 23, 2018 · 4 comments
Closed

My program crashed the VM #8

eekee opened this issue Jan 23, 2018 · 4 comments

Comments

@eekee
Copy link

eekee commented Jan 23, 2018

I broke it with my first program!

Hahahaha oh dear! Github "doesn't support" attaching .tasm or .trom... or seemingly any source code. What is this I don't even! Aaaanyway, pasting the tasm since it's so short:

setreg1|--------+|overloop
# label could go on next statement, but if it loops wrong i want to see it.

setreg2|+--------
dumpreg1|0|leftloop
multiply|3
wait|-
gotodataif|>nextloop
gotodata|>leftloop

setreg2|--------+|nextloop
dumpreg1|0|rightloop
divide|3
wait|-
gotodataif|>overloop
gotodata|>rightloop

It assembled with no errors, reporting 4 gotorefs, 13 instructions, and extra space: 19670.

On running it, the VM window opens, then soon closes. Here is the console output:
image

Since I laughed at Github earlier, I'll say I'm happy to see I can attach a screenshot with print screen and ctrl-V.

They say you don't really find the bugs in your code until someone else uses it. :)

@ThomasTheSpaceFox
Copy link

ah. yea the assembler doesn't exactly tell you when the syntax is wrong. (known bug) you may want to take a look at the assembly section of the users manual. the basic arithmetic operations are add, sub, mul, and div. and they work on the values in Registers 1 and 2. and populate register 1 with the result. second, the wait instruction supports a decimal syntax. like so:
wait|:6.2
The actual operation takes a ternary-encoded fixed point number with a range from 0 to 19.683

The assembler is a bit, well dumb. most instructions will treat whats between the first and second separators as 9-trit wide ternary data... what happens is the trom winds up having lines that are too short and contain invalid characters that the VM simply doesn't know what to do with.

@ThomasTheSpaceFox
Copy link

if what is in the users manual doesn't work or doesn't help, check some of the dozen-or-so test roms and accompanying source code. a good algorithm example would be fib.tasm (in VMSYSTEM/ROMS)

@eekee
Copy link
Author

eekee commented Jan 24, 2018

Ah I see! Thank you.

Not promising anything, but I'll see what I can do to improve SBTCVM-asm.txt.

@eekee
Copy link
Author

eekee commented Jan 28, 2018

All sorted, thanks!

I'm adding little extra bits of info to SBTCVM-asm.txt, as I said. I'll see about getting familiar with git so you can pull it when you want.

@eekee eekee closed this as completed Jan 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants