1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-01 23:29:41 +00:00
cc65/libsrc/runtime/umul8x8r16.s
uz 5dc80c2615 Rename the 8x8 multiplication using the same scheme as for the 16x16
multiplication.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4463 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-11-12 15:48:11 +00:00

38 lines
905 B
ArmAsm

;
; Ullrich von Bassewitz, 2010-11-02
;
; CC65 runtime: 8x8 => 16 multiplication
;
.export umul8x8r16, umul8x8r16m
.importzp ptr1, ptr3
;---------------------------------------------------------------------------
; 8x8 => 16 multiplication routine.
;
; lhs rhs result result also in
; -------------------------------------------------------------
; ptr1-lo ptr3-lo ax ptr1
;
umul8x8r16:
sta ptr3
umul8x8r16m:
lda #0 ; Clear byte 1
ldy #8 ; Number of bits
lsr ptr1 ; Get first bit of lhs into carry
@L0: bcc @L1
clc
adc ptr3
@L1: ror
ror ptr1
dey
bne @L0
tax
stx ptr1+1 ; Result in a/x and ptr1
lda ptr1 ; Load the result
rts ; Done