mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-14 17:38:05 +11:00
31a58d00f1
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.
16 lines
429 B
Plaintext
16 lines
429 B
Plaintext
CREATE XCURRENT 0 ,
|
|
: XCON XCURRENT CURRENT* ! ;
|
|
: XCOFF 0x02 RAM+ CURRENT* ! ;
|
|
: (xentry) XCON (entry) XCOFF ;
|
|
: XCREATE (xentry) 2 C, ;
|
|
: XCODE XCON CODE XCOFF ;
|
|
: XIMM XCON IMMEDIATE XCOFF ;
|
|
: _xapply ( a -- a-off )
|
|
DUP ORG @ > IF ORG @ - BIN( @ + THEN ;
|
|
: X' XCON ' XCOFF ;
|
|
: X['] XCON ' _xapply LITN XCOFF ;
|
|
: XCOMPILE
|
|
XCON ' _xapply LITN
|
|
LIT< , FIND DROP _xapply , XCOFF ;
|
|
: X[COMPILE] XCON ' _xapply , XCOFF ;
|