unify tables for squaring and multiplication
This commit is contained in:
parent
f06aed0c00
commit
0f49760aa5
2 changed files with 6 additions and 15 deletions
10
mandel.s
10
mandel.s
|
@ -131,8 +131,6 @@ KEY_0 = 50
|
|||
|
||||
.import mul_lobyte
|
||||
.import mul_hibyte
|
||||
.import sqr_lobyte
|
||||
.import sqr_hibyte
|
||||
|
||||
.data
|
||||
|
||||
|
@ -444,9 +442,13 @@ viewport_oy:
|
|||
; clobbers a, x
|
||||
.macro sqr8 dest, arg
|
||||
ldx arg
|
||||
lda sqr_lobyte,x
|
||||
txa
|
||||
lsr
|
||||
lda mul_lobyte,x
|
||||
rol
|
||||
sta dest
|
||||
lda sqr_hibyte,x
|
||||
lda mul_hibyte,x
|
||||
rol
|
||||
sta dest + 1
|
||||
.endmacro
|
||||
|
||||
|
|
11
tables.js
11
tables.js
|
@ -16,8 +16,6 @@ console.log(
|
|||
|
||||
.export mul_lobyte
|
||||
.export mul_hibyte
|
||||
.export sqr_lobyte
|
||||
.export sqr_hibyte
|
||||
|
||||
; (i * i) / 2 for the multiplier
|
||||
.align 256
|
||||
|
@ -28,13 +26,4 @@ ${db((i) => ((i * i) >> 1) & 0xff)}
|
|||
mul_hibyte:
|
||||
${db((i) => ((i * i) >> 9) & 0xff)}
|
||||
|
||||
; (i * i) for the plain squares
|
||||
.align 256
|
||||
sqr_lobyte:
|
||||
${db((i) => (i * i) & 0xff)}
|
||||
|
||||
.align 256
|
||||
sqr_hibyte:
|
||||
${db((i) => ((i * i) >> 8) & 0xff)}
|
||||
|
||||
`);
|
||||
|
|
Loading…
Reference in a new issue