base:short_8bit_multiplication_16bit_product
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
base:short_8bit_multiplication_16bit_product [2020-08-30 01:45] – djmips | base:short_8bit_multiplication_16bit_product [2020-08-30 01:52] (current) – old revision restored (2015-10-20 07:02) djmips | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Short 8bit * 8bit = 16bit multiply ====== | ====== 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. FAC2 is modified to FAC2-1. No tables required. Mod by djmips to increase performance but increased by one byte in size. There is an unwound version of this posted separately. The original version of this routine is published in CALL APPLE, JUNE 1983, P45-48. | + | 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. |
< | < | ||
Line 11: | Line 11: | ||
lda #$00 | lda #$00 | ||
ldx #$08 | ldx #$08 | ||
- | dec FAC2 ; FAC2-1 | ||
clc | clc | ||
m0 bcc m1 | m0 bcc m1 | ||
- | adc FAC2 ; this is just + FAC2 because FAC2-1 plus the set carry = FAC2 | + | |
+ | | ||
m1 ror | m1 ror | ||
ror FAC1 | ror FAC1 |
base/short_8bit_multiplication_16bit_product.1598744721.txt.gz · Last modified: 2020-08-30 01:45 by djmips