1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-26 08:32:00 +00:00

Added C callable entry point for the 16x16=32 multiplication.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4435 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2009-11-03 17:43:57 +00:00
parent 0c1703f8fd
commit 100c470727
2 changed files with 15 additions and 5 deletions

View File

@ -44,12 +44,15 @@
extern int __fastcall__ cc65_sin (unsigned x); unsigned long __fastcall__ cc65_umul16x16r32 (unsigned rhs, unsigned lhs);
/* Multiplicate two unsigned 16 bit to yield an unsigned 32 bit result */
int __fastcall__ cc65_sin (unsigned x);
/* Return the sine of the argument, which must be in range 0..360. The result /* Return the sine of the argument, which must be in range 0..360. The result
* is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00. * is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00.
*/ */
extern int __fastcall__ cc65_cos (unsigned x); int __fastcall__ cc65_cos (unsigned x);
/* Return the cosine of the argument, which must be in range 0..360. The result /* Return the cosine of the argument, which must be in range 0..360. The result
* is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00. * is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00.
*/ */

View File

@ -4,8 +4,9 @@
; CC65 runtime: 16x16 => 32 multiplication ; CC65 runtime: 16x16 => 32 multiplication
; ;
.export umul16x16r32 .export umul16x16r32, _cc65_umul16x16r32
.export mul16x16r32 := umul16x16r32 .export mul16x16r32 := umul16x16r32
.import popax
.importzp ptr1, ptr2, ptr3, ptr4, sreg .importzp ptr1, ptr2, ptr3, ptr4, sreg
@ -14,12 +15,18 @@
; ;
; lhs rhs result result also in ; lhs rhs result result also in
; ------------------------------------------------------------- ; -------------------------------------------------------------
; ptr1 ptr3 ax:sreg ptr1:sreg ; ptr1 ax ax:sreg ptr1:sreg
; ;
_cc65_umul16x16r32:
sta ptr1
stx ptr1+1
jsr popax
umul16x16r32: umul16x16r32:
sta ptr3
stx ptr3+1
lda #0 lda #0
ldx ptr3+1 ; Get high byte into register for speed
sta sreg+1 sta sreg+1
ldy #16 ; Number of bits ldy #16 ; Number of bits