I've got a working multiplication routine (I think?), does it need editing to work with both signed and unsigned values? I've only tested it with unsigned values:
arg0 and arg1 are the numbers, res0 is the result. (the _0 is the low (only) byte in 8-bit, the same memory locations are being used for 16-bit calculations as well)
arg0 and arg1 are the numbers, res0 is the result. (the _0 is the low (only) byte in 8-bit, the same memory locations are being used for 16-bit calculations as well)
Code:
mul88:
clc
lda #00
sta res0_0
sta arg1_0
ldx #8
mul88_2:
lsr arg0_1
bcc mul88_3
clc
lda res0_0
adc arg0_1
sta res0_0
mul88_3:
asl arg0_1
ror arg1_0
dex
bne mul88_2
rts
clc
lda #00
sta res0_0
sta arg1_0
ldx #8
mul88_2:
lsr arg0_1
bcc mul88_3
clc
lda res0_0
adc arg0_1
sta res0_0
mul88_3:
asl arg0_1
ror arg1_0
dex
bne mul88_2
rts