Use pop rather than inx;inx to retract the stack; consumes a register but

halves the number of calls. Reduces Star Trek from 39976 to 39771 bytes.
This commit is contained in:
David Given 2019-02-10 18:57:20 +01:00
parent b34ff2bdec
commit 35d1f36ca4

View file

@ -2053,46 +2053,29 @@ gen 1:
/* Group 15: Miscellaneous */ /* Group 15: Miscellaneous */
/******************************************/ /******************************************/
pat asp $1<=0-6 pat asp ($1<=0-12) || ($1>=12)
with STACK with STACK
uses hlreg={const2,$1} uses hlreg={const2,$1}
gen dad sp gen
sphl. dad sp
sphl.
pat asp $1==0-4 pat asp ($1<0) && ($1>0-12)
with STACK with STACK
gen dcx sp gen
dcx sp push hl
dcx sp leaving
dcx sp asp $1+2
pat asp $1==0-2 pat asp $1==0 /* do nothing */
with STACK
gen dcx sp
dcx sp
pat asp $1==0 /* do nothing */ pat asp ($1>0) && ($1<12)
with STACK
pat asp $1==2 uses hlreg
with exact src1or2 gen
with STACK pop hl
gen inx sp leaving
inx sp asp $1-2
pat asp $1==4
with exact src1or2 leaving asp 2
with STACK
gen inx sp
inx sp
inx sp
inx sp
pat asp $1>=6
with exact src1or2 leaving asp $1-2
with STACK
uses hlreg={const2,$1}
gen dad sp
sphl.
pat ass $1==2 pat ass $1==2
with hlreg STACK with hlreg STACK