From fdc7604d8fdb71684848082ae7889372aa3d156e Mon Sep 17 00:00:00 2001 From: uz Date: Mon, 2 Nov 2009 22:28:02 +0000 Subject: [PATCH] Added separate 8x8=>16 multiplication routine as start of the multiplication and division stuff cleanup. git-svn-id: svn://svn.cc65.org/cc65/trunk@4431 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/runtime/Makefile | 1 + libsrc/runtime/mul8x8r16.s | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 libsrc/runtime/mul8x8r16.s diff --git a/libsrc/runtime/Makefile b/libsrc/runtime/Makefile index 19cda62da..34052761c 100644 --- a/libsrc/runtime/Makefile +++ b/libsrc/runtime/Makefile @@ -153,6 +153,7 @@ OBJS = add.o \ mod.o \ mul.o \ mul8.o \ + mul8x8r16.o \ mulax3.o \ mulax5.o \ mulax6.o \ diff --git a/libsrc/runtime/mul8x8r16.s b/libsrc/runtime/mul8x8r16.s new file mode 100644 index 000000000..b1e679f69 --- /dev/null +++ b/libsrc/runtime/mul8x8r16.s @@ -0,0 +1,35 @@ +; +; Ullrich von Bassewitz, 2010-11-02 +; +; CC65 runtime: 8x8 => 16 multiplication +; + + .export mul8x8r16, umul8x8r16 + .importzp ptr1, ptr3 + + +;--------------------------------------------------------------------------- +; 8x8 => 16 multiplication routine. +; +; lhs rhs result result also in +; ------------------------------------------------------------- +; ptr1-lo ptr3-lo a/x ptr1 +; + +mul8x8r16: +umul8x8r16: + 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 + -- 2.39.5