base:fastest_multiplication
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
base:fastest_multiplication [2017-04-19 09:47] – repose | base:fastest_multiplication [2017-04-19 10:28] – repose | ||
---|---|---|---|
Line 15: | Line 15: | ||
;and being less elegant and harder to follow. | ;and being less elegant and harder to follow. | ||
;by Repose 2017 | ;by Repose 2017 | ||
+ | ;table generator by Graham | ||
+ | ;addition improvement suggested by JackAsser | ||
+ | |||
+ | ;data: 2044 bytes | ||
+ | ;zero page ram required: minimum 8 bytes, ideally 14 | ||
+ | ;do_add: 30 bytes in zp, if used | ||
+ | ;time: 196 cycles, option for 192 if you use 30 more zp bytes for do_add | ||
+ | ; | ||
+ | |||
+ | ;How to use: | ||
+ | ;put numbers in x/y and result is Y reg, X reg, z1, z0 | ||
;tables of squares | ;tables of squares | ||
Line 35: | Line 46: | ||
y0=$fd; | y0=$fd; | ||
y1=$fe | y1=$fe | ||
- | z0=$80; | + | z0=$80; |
z1=$81 | z1=$81 | ||
- | z2=$82 | + | ;z2=$82 |
- | z3=$83 | + | ;z3=$83 |
;Example showing use | ;Example showing use | ||
Line 154: | Line 165: | ||
sbc (p_invsqr_hi), | sbc (p_invsqr_hi), | ||
tay; | tay; | ||
- | ; | + | ; |
+ | ;jmp do_adds; can put do_adds in zp for a slight speed increase | ||
do_adds: | do_adds: | ||
;-add the first two numbers of column 1 | ;-add the first two numbers of column 1 | ||
Line 188: | Line 200: | ||
Diagram of the additions | Diagram of the additions | ||
- | | + | |
- | | + | |
- | --------- | + | -------- |
x0y0h x0y0l | x0y0h x0y0l | ||
+ x0y1h x0y1l | + x0y1h x0y1l |
base/fastest_multiplication.txt · Last modified: 2024-02-13 08:24 by repose