SysTest error

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

SysTest error

HighSchoolerWhoAsksHowTooMuch
Hi,

At the end of my testing my Sys.jack with the supplied Main.jack, I get a "nowhere to return to in Sys.init.14" error.

I just want to make sure that this is normal. I am assuming that it is normal as this would be the end of the program.

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: SysTest error

WBahn
Administrator
No, it's not normal.

You want your program to under full control at all time. When your program finishes, you want the CPU to enter an infinite loop so that it sits there looking stupid. What you don't want is for it to wonder off into program ROM to some random place and execute whatever instructions it happens to find there.

Remember, as long as the clock is running (and the CPU isn't in reset), the computer IS executing whatever it finds at whatever address is in the program counter. You want your program to make sure that that is what you want it to be.

The way that this is recommended to be done is for your your Sys.init() to call the Sys.halt() function once it's call to Main.main() returns. Another way to ensure make this happen is for your bootstrap code to include this behavior in the code it adds. Either way works fine, but the easiest way is to do it the recommended way.
Reply | Threaded
Open this post in threaded view
|

Re: SysTest error

HighSchoolerWhoAsksHowTooMuch
That makes sense and thank you for such a speedy reply!

Also, is my OS code expected to run Pong at a reasonable speed? I did optimize the drawRectangle function (which helped), but it is still WAY too slow to play.

Reply | Threaded
Open this post in threaded view
|

Re: SysTest error

WBahn
Administrator
It should run Pong on the VM emulator at something comparable to what the supplied code does.

Neither is likely to be playable on the hardware emulator -- in fact, it's highly likely that neither of them will result in an assembly language program that will even fit in the ROM.
Reply | Threaded
Open this post in threaded view
|

Re: SysTest error

HighSchoolerWhoAsksHowTooMuch
Then I guess I have a lot of work to do!

Thank you again
Reply | Threaded
Open this post in threaded view
|

Re: SysTest error

WBahn
Administrator
One approach you can take is to use only one of your OS library files at a time and use the built-in ones for the rest. Identify which library is causing the greatest slowdown and focus on the functions in there first.
Reply | Threaded
Open this post in threaded view
|

Re: SysTest error

HighSchoolerWhoAsksHowTooMuch
This makes sense. I think that using the (x/16)*16 for Modulo is slowing down my program a LOT. I will try your strategy and see what I can learn.