User Tools

Site Tools


base:short_8bit_multiplication_16bit_product

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

base:short_8bit_multiplication_16bit_product [2015-10-20 07:02] (current)
graham created
Line 1: Line 1:
 +====== Short 8bit * 8bit = 16bit multiply ======
 +
 +A small multiplication routine using the ancient egyptian multiplication algorithm. Factors should be stored in the FAC1 and FAC2 variables, the product can be found in Akku (high byte) and the X-Register (low byte). FAC1 will be destroyed. No tables required.
 +
 +<​code>​
 +FAC1     = $58
 +FAC2     = $59
 +
 +        ; A*256 + X = FAC1 * FAC2
 +MUL8
 +        lda #$00
 +        ldx #$08
 +        clc
 +m0      bcc m1
 +        clc
 +        adc FAC2
 +m1      ror
 +        ror FAC1
 +        dex
 +        bpl m0
 +        ldx FAC1
 +        rts
 +</​code>​
  
base/short_8bit_multiplication_16bit_product.txt ยท Last modified: 2015-10-20 07:02 by graham