1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-24 11:31:31 +00:00
cc65/libsrc/runtime/umul8x8r16.s
Greg King f82a43b98d Fixed the comments to say where the actual Left-Hand Side and Right-Hand Side are put.
A description of positions [left, right] is appropriate more for C code than for Assembly code.  (A description of timing [first argument, second argument] is more appropriate for the way that Assembly code is written.)
2014-05-11 10:43:06 -04:00

36 lines
965 B
ArmAsm

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