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.)
This commit is contained in:
Greg King 2014-05-11 10:43:06 -04:00
parent 228b9d1718
commit f82a43b98d
5 changed files with 20 additions and 24 deletions

View file

@ -5,9 +5,7 @@
; ;
.export _cc65_umul8x8r16 .export _cc65_umul8x8r16
.import umul8x8r16, popa .import umul8x8r16, popa, ptr1:zp
.include "zeropage.inc"
;--------------------------------------------------------------------------- ;---------------------------------------------------------------------------

View file

@ -13,9 +13,9 @@
;--------------------------------------------------------------------------- ;---------------------------------------------------------------------------
; 16x16 => 32 signed multiplication routine. ; 16x16 => 32 signed multiplication routine.
; ;
; lhs rhs result result also in ; LHS RHS result result also in
; ------------------------------------------------------------- ; -------------------------------------------------------------
; ptr1 ax ax:sreg ; ax ptr1 ax:sreg
; ;
; There is probably a faster way to do this. ; There is probably a faster way to do this.
; ;

View file

@ -13,14 +13,14 @@
;--------------------------------------------------------------------------- ;---------------------------------------------------------------------------
; 16x16 => 32 unsigned multiplication routine. Because the overhead for a ; 16x16 => 32 unsigned multiplication routine. Because the overhead for a
; 16x16 => 16 unsigned multiplication routine is small, we will tag it with ; 16x16 => 16 unsigned multiplication routine is small, we will tag it with
; the matching labels as well. ; the matching labels, as well.
; ;
; routine lhs rhs result result also in ; routine LHS RHS result result also in
; ----------------------------------------------------------------------- ; -----------------------------------------------------------------------
; umul16x16r32 ptr1 ax ax:sreg ptr1:sreg ; umul16x16r32 ax ptr1 ax:sreg ptr1:sreg
; umul16x16r32m ptr1 ptr3 ax:sreg ptr1:sreg ; umul16x16r32m ptr3 ptr1 ax:sreg ptr1:sreg
; umul16x16r16 ptr1 ax ax ptr1 ; umul16x16r16 ax ptr1 ax ptr1
; umul16x16r16m ptr1 ptr3 ax ptr1 ; umul16x16r16m ptr3 ptr1 ax ptr1
; ;
; ptr3 is left intact by the routine. ; ptr3 is left intact by the routine.
; ;

View file

@ -13,14 +13,14 @@
;--------------------------------------------------------------------------- ;---------------------------------------------------------------------------
; 8x16 => 24 unsigned multiplication routine. Because the overhead for a ; 8x16 => 24 unsigned multiplication routine. Because the overhead for a
; 8x16 => 16 unsigned multiplication routine is small, we will tag it with ; 8x16 => 16 unsigned multiplication routine is small, we will tag it with
; the matching labels as well. ; the matching labels, as well.
; ;
; routine lhs rhs result result also in ; routine LHS RHS result result also in
; ----------------------------------------------------------------------- ; -----------------------------------------------------------------------
; umul8x16r24 ptr1-lo ax ax:sreg-lo ptr1:sreg-lo ; umul8x16r24 ax ptr1-low ax:sreg-low ptr1:sreg-low
; umul8x16r24m ptr1-lo ptr3 ax:sreg-lo ptr1:sreg-lo ; umul8x16r24m ptr3 ptr1-low ax:sreg-low ptr1:sreg-low
; ;
; ptr3 ist left intact by the routine. ; ptr3 is left intact by the routine.
; ;
umul8x16r24: umul8x16r24:

View file

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