User Tools

Site Tools


base:fastest_multiplication

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
base:fastest_multiplication [2017-04-17 13:55] reposebase:fastest_multiplication [2017-04-19 09:47] repose
Line 7: Line 7:
 Jack Asser's: 233 cycles  ref: [[seriously_fast_multiplication]] \\ Jack Asser's: 233 cycles  ref: [[seriously_fast_multiplication]] \\
 Chris Jam's: 204.5  ref: http://csdb.dk/forums/?roomid=11&topicid=91766 \\ Chris Jam's: 204.5  ref: http://csdb.dk/forums/?roomid=11&topicid=91766 \\
-Mine: 201 zp variation: 198 \\+Mine: 196 zp variation: 192 \\
 Times above need to add 12 for jsr/rts \\ Times above need to add 12 for jsr/rts \\
  
Line 153: Line 153:
 lda (p_sqr_hi),y lda (p_sqr_hi),y
 sbc (p_invsqr_hi),y sbc (p_invsqr_hi),y
-sta z3;x1*y1h;31+tay;x1*y1h;Y=z3, 30 cycles 
 +;17+33+31+17+31+30=159
  
-;4*31+2*17 so far=158 
-;add partials 
-;-add first two numbers in column 1 
-;jmp do_adds;put in zp to save 3 cycles :) 
 do_adds: do_adds:
-clc +;-add the first two numbers of column 1 
-c1a lda #0  + clc 
-c1b adc #0 +c1a: lda #0 
-sta z1;9 +c1b: adc #0 
-;-continue to first two numbers in column 2                    + sta z1;9 
-c2a lda #0 + 
-c2b adc #0  +;-continue to first two numbers of column 2 
-sta z2;7 +c2a: lda #0 
-bcc c1c;3 taken/9 not taken, avg 6  +c2b: adc #0 
-inc z3 + tax;X=z2, 6 cycles 
-clc + bcc c1c;3/avg 4.5 
-;-add last number of column 1 (row c) + iny;z3++ 
-c1c lda #0  + clc 
-adc z1 + 
-sta z1;8+;-add last number of column 1 
 +c1c: lda #0 
 + adc z1 
 + sta z1;8 
 ;-add last number of column 2 ;-add last number of column 2
-c2c lda #0  + txa;A=z2 
-adc z2 +c2c: adc #0 
-sta z2;8 + tax;X=z2, 6 
-bcc fin;3/avg 5 + bcc fin;3/avg 3.
-inc z3 + iny;z3++ 
-;9+7+6+8+8+5=43 + 
-fin rts+;Y=z3, X=z2 
 +;9+6+4.5+8+6+3.5=37 
 +fin: rts
  
 Diagram of the additions Diagram of the additions
base/fastest_multiplication.txt · Last modified: 2024-02-13 08:24 by repose