math.multiply_words returns lower 16 bits of the result also in AY (to avoid repeating some load instructions)

This commit is contained in:
Irmen de Jong
2023-07-06 22:54:13 +02:00
parent b4e94ae4dd
commit 1f7180d9a8
6 changed files with 22 additions and 34 deletions

View File

@@ -51,8 +51,7 @@ multiply_bytes_into_word .proc
multiply_words .proc
; -- multiply two 16-bit words into a 32-bit result (signed and unsigned)
; input: A/Y = first 16-bit number, P8ZP_SCRATCH_W1 in ZP = second 16-bit number
; output: multiply_words.result 4-bytes/32-bits product, LSB order (low-to-high)
; clobbers: A
; output: multiply_words.result 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY.
sta P8ZP_SCRATCH_W2
sty P8ZP_SCRATCH_W2+1
@@ -79,6 +78,8 @@ mult16 lda #0
dex
bne -
ldx P8ZP_SCRATCH_REG
lda result
ldy result+1
rts
result .byte 0,0,0,0