mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-25 04:28:05 +11:00
z80a: add ELSE,
This commit is contained in:
parent
45eceaaf61
commit
74f46c1288
7
blk.fs
7
blk.fs
@ -300,11 +300,10 @@ CREATE lblnext 0 , ( stable ABI until set in B300 )
|
||||
: IFC, JRNC, FJR, ;
|
||||
: IFNC, JRC, FJR, ;
|
||||
: THEN,
|
||||
DUP PC ( l l pc )
|
||||
-^ 1- ( l off )
|
||||
DUP PC ( l l pc ) -^ 1- ( l off )
|
||||
( warning: l is a PC offset, not a mem addr! )
|
||||
SWAP ORG @ + BIN( @ - ( off addr )
|
||||
C! ;
|
||||
SWAP ORG @ + BIN( @ - ( off addr ) C! ;
|
||||
: ELSE, JR, FJR, SWAP THEN, ;
|
||||
( ----- 027 )
|
||||
: FWR BSET 0 C, ;
|
||||
: FSET @ THEN, ;
|
||||
|
@ -87,6 +87,11 @@ the opposite condition is met, a relative jump is made to
|
||||
THEN,'s PC. For example, if you have IFZ, a jump is made when
|
||||
Z is unset.
|
||||
|
||||
There can be an ELSE, in the middle of an IF, and THEN,. When
|
||||
present, IF, jumps to it when the condition is unmet. When the
|
||||
condition is met, upon reaching the ELSE, we unconditionally
|
||||
jump to the THEN,.
|
||||
|
||||
On the BEGIN,..AGAIN, side, it's a bit different. You start
|
||||
with your BEGIN, instruction, and then later you issue a
|
||||
JRxx, instr followed by AGAIN,. Exactly like you would do
|
||||
@ -96,7 +101,7 @@ On top of that, you have the very nice BREAK, instruction,
|
||||
which must also be preceded by a JRxx, and will jump to the
|
||||
PC following the next AGAIN,. Examples:
|
||||
|
||||
IFZ, NOP, THEN,
|
||||
IFZ, NOP, ELSE, NOP, THEN,
|
||||
BEGIN, NOP, JR, AGAIN, ( unconditional )
|
||||
BEGIN, NOP, JRZ, AGAIN, ( conditional )
|
||||
BEGIN, NOP, JRZ, BREAK, JR, AGAIN, ( break off the loop )
|
||||
|
Loading…
Reference in New Issue
Block a user