Adding of 16-bit arithmatic macro variants for X and A as input

This commit is contained in:
hugova 2025-03-07 00:48:13 +01:00
parent 0797e69106
commit 09b8a33e09

View file

@ -7,21 +7,27 @@
;; IF to run it fast
.ifblank fast_unsafe
CLC
.endif
;; If b_low != A
.if .match(.mid (0, 1, {b_low}), A )
.else
LDA b_low
.endif
LDA b_low
ADC a_low
STA a_low
LDA b_hi
LDA b_hi
ADC a_hi
STA a_hi
.endmacro
; Untested!
.macro Add_16_AX low, hi, fast_unsafe; , A, X
;; IF to run it fast
.ifblank fast_unsafe
CLC
.endif
ADC low
STA low
TXA
ADC hi
STA hi
.endmacro
.macro Sub_16 a_low, a_hi, b_low, b_hi, fast_unsafe ; a = a - b
.ifblank fast_unsafe
@ -35,6 +41,19 @@
STA a_hi
.endmacro
;;Untested
.macro Sub_16_AX low, hi, fast_unsafe; , A, X
;; IF to run it fast
.ifblank fast_unsafe
SEC
.endif
SBC low
STA low
TXA
SBC hi
STA hi
.endmacro
.macro mult_16 low_, hi_, fast_unsafe ; [low, hi] = [low, hi]*2
;; IF to run it fast
.ifblank fast_unsafe