ソースを参照

z80a: add ELSE,

master
Virgil Dupras 3年前
コミット
74f46c1288
2個のファイルの変更9行の追加5行の削除
  1. +3
    -4
      blk.fs
  2. +6
    -1
      doc/asm.txt

+ 3
- 4
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, ;


+ 6
- 1
doc/asm.txt ファイルの表示

@@ -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 )


読み込み中…
キャンセル
保存