Closed apage43 closed 12 years ago
Did he really mean for push to decrement first? That would mean address 0xffff is never used.
SP is supposed to start at 0, so the first time it's used, it decrements and wraps around to 0xFFFF.
EDIT: And now I can't find where I read that for some reason...
The spec says stack starts at 0xffff but 0x10.cc linka to a tweet where he says it starts at 0. Confysing. :)
SP is supposed to start at 0, so the first time it's used, it decrements and wraps around to 0xFFFF.
Even on a PEEK?
That's what gave me pause, yeah. Still trying to find my source on that, sorry...
Here it is, thanks @deps for the tip-off: https://twitter.com/#!/notch/status/187636538870468608
Cool, pulled and your code works now. It's long, make sure to turn off debug to run it! (Setting the text in a textarea is slow).
The spec specifies that POP is [SP++] and PUSH is [--SP].
Program that breaks without this fix is detailed here: http://0x10cforum.com/forum/m/4932880/viewthread/2713790-program-that-breaks-in-some-emulators