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
lxi h, rst3
shld 0x19
lhld rst4
shld 0x20
lhld rst4+2
shld 0x22
ret
! de = [bc+const1] (remember bc is the frame pointer)
@ -74,9 +69,4 @@ rst3:
dad b
ret
! Adjust flags for signed comparison
rst4:
rpo
xri 0x80
ret

View file

@ -13,12 +13,6 @@ EM_WSIZE = 2
EM_PSIZE = 2
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
PROPERTIES
@ -1862,30 +1856,39 @@ pat blt
with const2 hl_or_de STACK
uses areg
gen
mov a, %2.1
xri {const1, 0x80}
mov %2.1, a
mov a, %2.2
sui {const1, %1.num & 0xff}
mov a, %2.1
sbi {const1, %1.num >> 8}
SIGN_ADJUST
jm {label, $1}
sbi {const1, (%1.num >> 8) ^ 0x80}
jc {label, $1}
with hl_or_de const2 STACK
uses areg
gen
mov a, %1.1
xri {const1, 0x80}
mov %1.1, a
mvi a, {const1, %2.num & 0xff}
sub %1.2
mvi a, {const1, %2.num >> 8}
mvi a, {const1, (%2.num >> 8) ^ 0x80}
sbb %1.1
SIGN_ADJUST
jm {label, $1}
jc {label, $1}
with hl_or_de hl_or_de STACK
uses areg
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
sub %1.2
mov a, %2.1
sbb %1.1
SIGN_ADJUST
jm {label,$1}
jc {label,$1}
pat bgt
leaving
@ -1896,30 +1899,39 @@ pat bge
with const2 hl_or_de STACK
uses areg
gen
mov a, %2.1
xri {const1, 0x80}
mov %2.1, a
mov a, %2.2
sui {const1, %1.num & 0xff}
mov a, %2.1
sbi {const1, %1.num >> 8}
SIGN_ADJUST
jp {label, $1}
sbi {const1, (%1.num >> 8) ^ 0x80}
jnc {label, $1}
with hl_or_de const2 STACK
uses areg
gen
mov a, %1.1
xri {const1, 0x80}
mov %1.1, a
mvi a, {const1, %2.num & 0xff}
sub %1.2
mvi a, {const1, %2.num >> 8}
mvi a, {const1, (%2.num >> 8) ^ 0x80}
sbb %1.1
SIGN_ADJUST
jp {label, $1}
jnc {label, $1}
with hl_or_de hl_or_de STACK
uses areg
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
sub %1.2
mov a,%2.1
sbb %1.1
SIGN_ADJUST
jp {label,$1}
jnc {label,$1}
pat ble
leaving