Replace the non-working Z80 style signed comparison sign adjustment with

something which actually works on the 8080. Sadly, Star Trek is up to
40243 bytes again.
This commit is contained in:
David Given 2019-02-12 11:57:37 +01:00
parent ee716754d3
commit 360e1525ae
2 changed files with 35 additions and 33 deletions

View file

@ -17,11 +17,6 @@
shld 0x11 shld 0x11
lxi h, rst3 lxi h, rst3
shld 0x19 shld 0x19
lhld rst4
shld 0x20
lhld rst4+2
shld 0x22
ret ret
! de = [bc+const1] (remember bc is the frame pointer) ! de = [bc+const1] (remember bc is the frame pointer)
@ -75,8 +70,3 @@ rst3:
dad b dad b
ret ret
! Adjust flags for signed comparison
rst4:
rpo
xri 0x80
ret

View file

@ -13,12 +13,6 @@ EM_WSIZE = 2
EM_PSIZE = 2 EM_PSIZE = 2
EM_BSIZE = 4 EM_BSIZE = 4
#ifdef USE_I80_RSTS
#define SIGN_ADJUST rst {const1, 4}
#else
#define SIGN_ADJUST jpo {label, 1f} xri {const1, 0x80} 1:
#endif
SL=4 SL=4
PROPERTIES PROPERTIES
@ -1862,30 +1856,39 @@ pat blt
with const2 hl_or_de STACK with const2 hl_or_de STACK
uses areg uses areg
gen gen
mov a, %2.1
xri {const1, 0x80}
mov %2.1, a
mov a, %2.2 mov a, %2.2
sui {const1, %1.num & 0xff} sui {const1, %1.num & 0xff}
mov a, %2.1 mov a, %2.1
sbi {const1, %1.num >> 8} sbi {const1, (%1.num >> 8) ^ 0x80}
SIGN_ADJUST jc {label, $1}
jm {label, $1}
with hl_or_de const2 STACK with hl_or_de const2 STACK
uses areg uses areg
gen gen
mov a, %1.1
xri {const1, 0x80}
mov %1.1, a
mvi a, {const1, %2.num & 0xff} mvi a, {const1, %2.num & 0xff}
sub %1.2 sub %1.2
mvi a, {const1, %2.num >> 8} mvi a, {const1, (%2.num >> 8) ^ 0x80}
sbb %1.1 sbb %1.1
SIGN_ADJUST jc {label, $1}
jm {label, $1}
with hl_or_de hl_or_de STACK with hl_or_de hl_or_de STACK
uses areg uses areg
gen gen
mov a, %2.1
xri {const1, 0x80}
mov %2.1, a
mov a, %1.1
xri {const1, 0x80}
mov %1.1, a
mov a, %2.2 mov a, %2.2
sub %1.2 sub %1.2
mov a, %2.1 mov a, %2.1
sbb %1.1 sbb %1.1
SIGN_ADJUST jc {label,$1}
jm {label,$1}
pat bgt pat bgt
leaving leaving
@ -1896,30 +1899,39 @@ pat bge
with const2 hl_or_de STACK with const2 hl_or_de STACK
uses areg uses areg
gen gen
mov a, %2.1
xri {const1, 0x80}
mov %2.1, a
mov a, %2.2 mov a, %2.2
sui {const1, %1.num & 0xff} sui {const1, %1.num & 0xff}
mov a, %2.1 mov a, %2.1
sbi {const1, %1.num >> 8} sbi {const1, (%1.num >> 8) ^ 0x80}
SIGN_ADJUST jnc {label, $1}
jp {label, $1}
with hl_or_de const2 STACK with hl_or_de const2 STACK
uses areg uses areg
gen gen
mov a, %1.1
xri {const1, 0x80}
mov %1.1, a
mvi a, {const1, %2.num & 0xff} mvi a, {const1, %2.num & 0xff}
sub %1.2 sub %1.2
mvi a, {const1, %2.num >> 8} mvi a, {const1, (%2.num >> 8) ^ 0x80}
sbb %1.1 sbb %1.1
SIGN_ADJUST jnc {label, $1}
jp {label, $1}
with hl_or_de hl_or_de STACK with hl_or_de hl_or_de STACK
uses areg uses areg
gen gen
mov a, %2.1
xri {const1, 0x80}
mov %2.1, a
mov a, %1.1
xri {const1, 0x80}
mov %1.1, a
mov a,%2.2 mov a,%2.2
sub %1.2 sub %1.2
mov a,%2.1 mov a,%2.1
sbb %1.1 sbb %1.1
SIGN_ADJUST jnc {label,$1}
jp {label,$1}
pat ble pat ble
leaving leaving