+
/************************************************************/
/************************************************************/
/******* ******/
reg1 = reg + lbreg + mem .
bdhsp = regpair + stackpointer .
bdhpsw = regpair + psword .
-src1 = reg .
-src2 = hlorde + const2 .
+immediate2 = const2 + label .
+src1 = reg + const1 .
+src2 = hlorde + const2 + label .
src1or2 = src1 + src2 .
INSTRUCTIONS
lda label:ro kills a cost(3,13) .
ldax regind:ro kills a cost(1,7) .
lhld label:ro kills hl cost(3,16) .
- lxi bdhsp:wo,const2+label:ro cost(3,10) .
+ lxi bdhsp:wo,immediate2:ro cost(3,10) .
mov reg1:wo,reg1:ro cost(1,5) .
mvi reg1:wo,const1:ro cost(2,7) .
/* nop cost(1,0) . */
gen mov %2.2,%1
mvi %2.1,{const1,0}
-from const2 + label to bdhsp
+from immediate2 to bdhsp
gen lxi %2,%1
from const1 to reg
TESTS
-to test areg
+to test areg /* just a dummy test, never used */
gen cmp %1
STACKINGRULES
move %1,hl
xthl.
-from const2 + label to STACK
+from immediate2 to STACK
uses hlorde
gen lxi %a,%1
push %a
-from const2 + label to STACK
+from immediate2 to STACK
gen push hl
move %1,hl
xthl.
pop psw
inx sp yields a
-from const2 + label
+from immediate2
uses regpair
gen move %1,%a yields %a
uses reg
gen mov %a,m yields %a
with dereg
- uses areg /*** ??? ***/
gen ldax de yields a
with exact label
- uses areg /*** ??? ***/
gen lda %1 yields a
pat loi $1==2
inx hl
mov m,d
+pat sil lil $1==$2
+with dereg
+uses hlreg={const2,$1}, areg
+gen dad lb
+ mov a,m
+ inx hl
+ mov h,m
+ mov l,a
+ mov m,e
+ inx hl
+ mov m,d yields de
+
+pat lil loc adi sil $1==$4 && $3==2
+with STACK
+uses hlreg={const2,$1}, dereg, areg
+gen dad lb
+ mov e,m
+ inx hl
+ mov h,m
+ mov l,e
+ mov e,m
+ inx hl
+ mov d,m
+ push hl
+ lxi hl,{const2,$2}
+ dad de
+ xchg.
+ pop hl
+ mov m,d
+ dcx hl
+ mov m,e
+
+pat lil inc sil $1==$3
+uses hlreg={const2,$1}
+gen dad lb
+ mov e,m
+ inx hl
+ mov h,m
+ mov l,e
+ inr m
+ jnz {label,"1f"}
+ inx hl
+ inr m
+ 1:
+
+pat lil dec sil $1==$3
+uses hlreg={const2,$1}
+gen dad lb
+ mov e,m
+ inx hl
+ mov h,m
+ mov l,e
+ mov e,m
+ inx hl
+ mov d,m
+ dcx de
+ mov m,d
+ dcx hl
+ mov m,e
pat stf
with hlorde STACK
pat cmu $1==2
with hlorde hlorde
-kills hlorde /***** ?????? ******/
uses areg
gen mov a,%2.1
cmp %1.1
uses hlorde={const2,0}
gen cpi {const1,$1}
jnz {label,"1f"}
- inx %a yields %a
+ inx %a
+ 1: yields %a
with yields {const2,$1}
leaving cmi 2 teq
uses hlorde={const2,0}
gen cpi {const1,$1}
jz {label,"1f"}
- inx %a yields %a
+ inx %a
+ 1: yields %a
with yields {const2,$1}
leaving cmi 2 tne
gen pop psw
ral.
jc {label,$1}
+with hlorde
+gen mov a,%1.1
+ ral.
+ jc {label,$1}
pat zle
with hlorde STACK
gen pop psw
ral.
jnc {label,$1}
+with hlorde
+gen mov a,%1.1
+ ral.
+ jnc {label,$1}
pat zgt
with hlorde STACK