1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-06 03:20:56 +11:00
collapseos/blk/243
Virgil Dupras 31a58d00f1 z80: fix tricky memory initialization issue
Among random "better safe than sorry" changes, the real fix is in
changing "4" for "5" above _find declaration. This off-by-one error
had that word, which is the root word in z80, have a 0x01 prev field
instead of a 0x00 one.

When all memory was initialized to zero, it didn't matter, we ended
up hitting 0 prev and considered ourselves properly at the end of
dict.

When memory wasn't initialized, however, we would end up jumping at
all kinds of places, leading to random behavior.
2020-08-15 16:37:58 -04:00

13 lines
377 B
Plaintext

: JPc, SWAP <<3 0xc2 OR A, A,, ;
: BCALL, BIN( @ + CALL, ;
: BJP, BIN( @ + JP, ;
: BJPc, BIN( @ + JPc, ;
CREATE lblchkPS 0 ,
: chkPS, lblchkPS @ CALL, ; ( chkPS, B305 )
CREATE lblnext 0 , ( stable ABI until set in B300 )
: JPNEXT, lblnext @ ?DUP IF JP, ELSE 0x1a BJP, THEN ;
: CODE ( same as CREATE, but with native word )
(entry) 0 C, ( 0 == native ) ;
: ;CODE JPNEXT, ;