summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alu.asm13
-rw-r--r--main.asm2
-rw-r--r--opcodes.asm14
3 files changed, 18 insertions, 11 deletions
diff --git a/alu.asm b/alu.asm
index 8fa4271..5f22b44 100644
--- a/alu.asm
+++ b/alu.asm
@@ -14,6 +14,19 @@ alu_add:
rts
alu_adc:
+ ;; ADC instruction
+ ;; ADC d1,d0
+ ;; d1 + d0 + carry -> d1
+ bsr flags_normalize
+ move.b flag_byte(pc),d2
+ andi.b #1,d2
+ add.b d0,d2
+ move.b d2,(f_tmp_src_b-flag_storage)(a3)
+ move.b d1,(f_tmp_dst_b-flag_storage)(a3)
+ add.b d2,d1
+ move sr,(f_host_ccr-flag_storage)(a3)
+ move.w #$0202,(flag_byte-flag_storage)(a3)
+ rts
alu_sbc:
;; SBC instruction
diff --git a/main.asm b/main.asm
index 0fcb31b..4a82d33 100644
--- a/main.asm
+++ b/main.asm
@@ -21,7 +21,7 @@
;;;
;;; D0 = current instruction, scratch for macros
;;; D1 = scratch for instructions
-;;; D2 = undefined
+;;; D2 = further scratch
;;;
;;;
;;; The following have their shadows in the top half of the register
diff --git a/opcodes.asm b/opcodes.asm
index 9154ec4..2301c71 100644
--- a/opcodes.asm
+++ b/opcodes.asm
@@ -1288,16 +1288,10 @@ emu_op_87:
;; Do an ADC \2,\1
F_ADC_B MACRO ; S34
- ;; XXX TOO BIG
- bsr flags_normalize
- move.b flag_byte(pc),d0
- andi.b #1,d0
- add.b \1,d0
- move.b d0,(f_tmp_src_b-flag_storage)(a3)
- move.b \2,(f_tmp_dst_b-flag_storage)(a3)
- add.b d0,\2
- move sr,(f_host_ccr-flag_storage)(a3)
- move.w #$0202,(flag_byte-flag_storage)(a3)
+ move.b \2,d1
+ move.b \1,d0
+ bsr alu_adc
+ move.b d1,\2
ENDM
START