push/pop for unallocated addresses?

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

push/pop for unallocated addresses?

Roku7
I tried running the MemoryAccess/BasicTest.vm on the VM emulator and noticed that push and pop only works sometimes.
E.g:
push constant 10 (works)
push local 0 (does not work)(out of segment space)

and

pop local 0 (does not work)(out of segment space)
pop temp 6 (does work)

From what I understand, this happens when there is no start address(pointer) assigned to the particular segment yet.

However, why does 'pop local 0' not work while 'pop temp 6' works fine?

Also, for translating into assembly code, do you need to check for such out of segment errors and skip such VM commands? I also read that the VM code should be assumed error free. If so, then is the code in BasicTest.vm purposefully wrong?
Reply | Threaded
Open this post in threaded view
|

Re: push/pop for unallocated addresses?

WBahn
Administrator
Did you read the section on Initialization in the Tips section of Chapter 7.5?

It tells you that these .vm won't run normally because the VM initialization is not implemented until the next chapter. That is why you need to use the supplied XxxVME.tst test scripts.

As for why the temp memory segment works without the base address being initialized -- the base address of the temp segment is fixed (it's ALWAYS RAM[5]). Nothing to initialize.
Reply | Threaded
Open this post in threaded view
|

Re: push/pop for unallocated addresses?

Roku7
Sorry. I guess I missed that there was a VM test script in addition to the CPU test script. Although I did read about .vm files not running normally, I hadn't properly understood that it was talking about initialization.
It all makes perfect sense now. Thank you!