Trevor Merritt e29ac45c84 scroll down works on CHIP-8 and High-Res modes
scroll left and right work in stdef and hidef
adds octo test roms
adds schip fonts to memory
2024-10-27 11:41:25 -04:00

40 lines
671 B
Plaintext

###########################################
#
# Sinusoid
#
# Demonstrate :calc and :macro by computing
# a sinusoidal lookup table at compile time.
#
# John Earnest
#
###########################################
: main
hires
loop
scroll-down 2
i := table
i += v2
load v1
i := thin
sprite v0 v3 2
i := thick
sprite v1 v3 2
v2 += 2
again
: thin 0x0F 0x0F
: thick 0xFF 0xFF
: table
:macro S2 {
:calc rads { ( HERE - table ) * ( 2 * PI ) / 256 }
:byte { 56 + 38 * sin rads }
:byte { 56 + 16 * cos rads }
}
# expand S2 2*8*8 times for a 256-byte table:
:macro S1 { S2 S2 S2 S2 S2 S2 S2 S2 }
:macro S0 { S1 S1 S1 S1 S1 S1 S1 S1 }
S0 S0