mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-06-09 07:29:38 +00:00
Optimize and de-macroize BIT computation on ARM
This commit is contained in:
parent
f608de450e
commit
2615351d46
|
@ -554,26 +554,6 @@
|
||||||
_DoASL(wr0) \
|
_DoASL(wr0) \
|
||||||
PutToEA_B
|
PutToEA_B
|
||||||
|
|
||||||
#define _DoBIT \
|
|
||||||
GetFromEA_B \
|
|
||||||
mov wr1, A_Reg; \
|
|
||||||
and wr1, wr1, wr0;
|
|
||||||
|
|
||||||
#define DoBIT \
|
|
||||||
_DoBIT \
|
|
||||||
bic F_Reg, F_Reg, #NZ_Flags; \
|
|
||||||
bic F_Reg, F_Reg, #V_Flag; \
|
|
||||||
tst wr1, #0xFF; \
|
|
||||||
bnz 1f; \
|
|
||||||
orr F_Reg, F_Reg, #Z_Flag; \
|
|
||||||
1: tst wr0, #0x40; \
|
|
||||||
bz 2f; \
|
|
||||||
orr F_Reg, F_Reg, #V_Flag; \
|
|
||||||
2: tst wr0, #0x80; \
|
|
||||||
bz 3f; \
|
|
||||||
orr F_Reg, F_Reg, #N_Flag; \
|
|
||||||
3:
|
|
||||||
|
|
||||||
#define DoCMP \
|
#define DoCMP \
|
||||||
GetFromEA_B \
|
GetFromEA_B \
|
||||||
/* TODO FIXME : maybe actually use cmp or cmn instruction? */ \
|
/* TODO FIXME : maybe actually use cmp or cmn instruction? */ \
|
||||||
|
@ -1133,27 +1113,41 @@ ENTRY(op_BEQ) // 0xF0
|
||||||
BIt Test
|
BIt Test
|
||||||
---------------------------------- */
|
---------------------------------- */
|
||||||
|
|
||||||
|
#define _DoBIT \
|
||||||
|
GetFromEA_B \
|
||||||
|
and wr1, A_Reg, wr0;
|
||||||
|
|
||||||
|
DoBIT:
|
||||||
|
_DoBIT
|
||||||
|
bic F_Reg, F_Reg, #NZ_Flags
|
||||||
|
bic F_Reg, F_Reg, #V_Flag
|
||||||
|
ands wr1, wr1, #0xFF
|
||||||
|
FlagZ
|
||||||
|
and wr1, wr0, #0x40
|
||||||
|
lsr wr1, wr1, #6 /* V_Flag is bit 1 */
|
||||||
|
orr F_Reg, F_Reg, wr1
|
||||||
|
and wr1, wr0, #0x80
|
||||||
|
lsr wr1, wr1, #4 /* N_Flag is bit 4 */
|
||||||
|
orr F_Reg, F_Reg, wr1
|
||||||
|
Continue
|
||||||
|
|
||||||
ENTRY(op_BIT_zpage) // 0x24
|
ENTRY(op_BIT_zpage) // 0x24
|
||||||
GetZPage
|
GetZPage
|
||||||
DoBIT
|
b DoBIT
|
||||||
Continue
|
|
||||||
|
|
||||||
ENTRY(op_BIT_abs) // 0x2c
|
ENTRY(op_BIT_abs) // 0x2c
|
||||||
GetAbs
|
GetAbs
|
||||||
DoBIT
|
b DoBIT
|
||||||
Continue
|
|
||||||
|
|
||||||
// 65c02 : 0x34
|
// 65c02 : 0x34
|
||||||
ENTRY(op_BIT_zpage_x)
|
ENTRY(op_BIT_zpage_x)
|
||||||
GetZPage_X
|
GetZPage_X
|
||||||
DoBIT
|
b DoBIT
|
||||||
Continue
|
|
||||||
|
|
||||||
// 65c02 : 0x3C
|
// 65c02 : 0x3C
|
||||||
ENTRY(op_BIT_abs_x)
|
ENTRY(op_BIT_abs_x)
|
||||||
GetAbs_X
|
GetAbs_X
|
||||||
DoBIT
|
b DoBIT
|
||||||
Continue
|
|
||||||
|
|
||||||
/* BIT immediate is anomalous in that it does not affect the
|
/* BIT immediate is anomalous in that it does not affect the
|
||||||
* N and V flags, unlike in other addressing modes.
|
* N and V flags, unlike in other addressing modes.
|
||||||
|
@ -1162,12 +1156,9 @@ ENTRY(op_BIT_abs_x)
|
||||||
ENTRY(op_BIT_imm)
|
ENTRY(op_BIT_imm)
|
||||||
GetImm
|
GetImm
|
||||||
_DoBIT
|
_DoBIT
|
||||||
tst wr1, #0xFF
|
ands wr1, wr1, #0xFF
|
||||||
bnz 1f
|
FlagZ
|
||||||
orr F_Reg, F_Reg, #Z_Flag
|
Continue
|
||||||
b 2f
|
|
||||||
1: bic F_Reg, F_Reg, #Z_Flag
|
|
||||||
2: Continue
|
|
||||||
|
|
||||||
.ltorg
|
.ltorg
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user