z80 asm: document the 0x8000 limitation better

When I get bitten by it myself, it's because it's clearly
underdocumented!
This commit is contained in:
Virgil Dupras 2020-12-14 14:40:22 -05:00
parent 8c89fc147c
commit 63d2c97386
2 changed files with 7 additions and 3 deletions

7
blk.fs
View File

@ -291,10 +291,11 @@ CREATE lblnext 0 , ( stable ABI until set in B300 )
( ----- 026 )
( Place BEGIN, where you want to jump back and AGAIN after
a relative jump operator. Just like BSET and BWR. )
: BEGIN, PC ;
: BSET PC SWAP ! ;
: BEGIN,
PC DUP 0x8000 AND IF ABORT" PC must be < 0x8000" THEN ;
: BSET BEGIN, SWAP ! ;
( same as BSET, but we need to write a placeholder )
: FJR, PC 0 C, ;
: FJR, BEGIN, 0 C, ;
: IFZ, JRNZ, FJR, ;
: IFNZ, JRZ, FJR, ;
: IFC, JRNC, FJR, ;

View File

@ -60,6 +60,9 @@ labels, write happen before set. The write operation writes a
dummy placeholder, and then the set operation writes the offset
at that placeholder's address.
Important limitation: Flow words are broken when PC reaches
0x8000. The BREAK, word relies on that 15th bit as a flag.
Variable actions are expected to be called with labels in
front of them. Examples: