helps you save space when you want to store tables for sine and cosine. For example if you want 128 bytes long tables, you just have to generate a 160 (32+128) bytes long table containing
. The cosine table will start at
(2PI is 128, so 32 is PI/2).
Code: Select all
; sinTable = sin(i*2*PI/128)*128 for i=0..160
sinTable:
.db $00, $06, $0c, $12, $18, $1f, $25, $2b, $30, $36, $3c, $41, $47, $4c, $51, 55,
.db $5a, $5e, $62, $66, $6a, $6d, $70, $73, $76, $78, $7a, $7c, $7d, $7e, $7f, 7f
cosTable:
.db $80, $7f, $7f, $7e, $7d, $7c, $7a, $78, $76, $73, $70, $6d, $6a, $66, $62, 5e,
.db $5a, $55, $51, $4c, $47, $41, $3c, $36, $30, $2b, $25, $1f, $18, $12, $0c, 06,
.db $00, $f9, $f3, $ed, $e7, $e0, $da, $d4, $cf, $c9, $c3, $be, $b8, $b3, $ae, aa,
.db $a5, $a1, $9d, $99, $95, $92, $8f, $8c, $89, $87, $85, $83, $82, $81, $80, 80,
.db $80, $80, $80, $81, $82, $83, $85, $87, $89, $8c, $8f, $92, $95, $99, $9d, a1,
.db $a5, $aa, $ae, $b3, $b8, $be, $c3, $c9, $cf, $d4, $da, $e0, $e7, $ed, $f3, f9,
.db $00, $06, $0c, $12, $18, $1f, $25, $2b, $30, $36, $3c, $41, $47, $4c, $51, 55,
.db $5a, $5e, $62, $66, $6a, $6d, $70, $73, $76, $78, $7a, $7c, $7d, $7e, $7f, 7f