summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Smith2010-06-21 14:54:22 -0700
committerDuncan Smith2010-06-21 14:54:22 -0700
commit3d7682f3af39f449886ef071b7108597d6c74952 (patch)
tree85bbadcfd1e350b32fea0628a0145f109acc68ca
parentf2fc7ea378ce3b5e6d4a4ebc0abe0d103c25ba46 (diff)
Parted out F_SUB_B to alu_sub.
-rw-r--r--alu.asm18
-rw-r--r--opcodes.asm13
2 files changed, 22 insertions, 9 deletions
diff --git a/alu.asm b/alu.asm
index 18f5260..22217bb 100644
--- a/alu.asm
+++ b/alu.asm
@@ -19,3 +19,21 @@ alu_sbc:
move.w #$0202,(flag_byte-flag_storage)(a3)
pop.l d2
rts
+
+alu_sub:
+ ;; SUB instruction
+ ;; SUB d1,d0
+ ;; d1 - d0 -> d1
+ ;; sets flags
+
+ ;; XXX use lea and then d(an) if you have a spare register.
+ ;; preserve operands for flagging
+
+ move.b d0,(f_tmp_src_b-flag_storage)(a3)
+ move.b d1,(f_tmp_dst_b-flag_storage)(a3)
+ move.b #1,(f_tmp_byte-flag_storage)(a3)
+ andi.b #%00000010,(flag_valid-flag_storage)(a3)
+ move.b #%00000010,(flag_byte-flag_storage)(a3)
+ sub d0,d1
+ move sr,(f_host_sr-flag_storage)(a3)
+ rts
diff --git a/opcodes.asm b/opcodes.asm
index 35a7f4f..fca259c 100644
--- a/opcodes.asm
+++ b/opcodes.asm
@@ -1368,15 +1368,10 @@ emu_op_8f:
;; Do a SUB \2,\1
;; XXX CHECK
F_SUB_B MACRO ; 22 bytes?
- ;; XXX use lea and then d(an) if you have a spare register.
- ;; preserve operands for flagging
- move.b \1,(f_tmp_src_b-flag_storage)(a3)
- move.b \2,(f_tmp_dst_b-flag_storage)(a3)
- move.b #1,(f_tmp_byte-flag_storage)(a3)
- andi.b #%00000010,(flag_valid-flag_storage)(a3)
- move.b #%00000010,(flag_byte-flag_storage)(a3)
- sub \1,\2
- move sr,(f_host_sr-flag_storage)(a3)
+ move.b \2,d1
+ move.b \1,d0
+ bsr alu_sub
+ move.b d1,\2
ENDM
START