prog8/examples/test.p8

62 lines
1.6 KiB
Plaintext
Raw Normal View History

%import textio
%import gfx_lores
%import emudbg
%zeropage basicsafe
%option no_sysinit
main {
const uword WIDTH = 320
const ubyte HEIGHT = 240
2024-08-24 12:34:23 +00:00
sub start() {
uword clo, chi
void cx16.set_screen_mode(128)
word x1, y1, x2, y2
ubyte i
ubyte color = 2
sys.set_irqd()
emudbg.reset_cpu_cycles()
for i in 0 to 254 step 4 {
x1 = ((WIDTH-256)/2 as word) + math.sin8u(i) as word
y1 = (HEIGHT-128)/2 + math.cos8u(i)/2
x2 = ((WIDTH-64)/2 as word) + math.sin8u(i)/4 as word
y2 = (HEIGHT-64)/2 + math.cos8u(i)/4
cx16.GRAPH_set_colors(color, 0, 1)
cx16.GRAPH_draw_line(x1 as uword, y1 as uword, x2 as uword, y2 as uword)
}
clo, chi = emudbg.cpu_cycles()
sys.clear_irqd()
txt.print_uwhex(chi, true)
txt.print_uwhex(clo, false)
txt.nl()
sys.wait(50)
cx16.GRAPH_clear()
sys.wait(50)
sys.set_irqd()
emudbg.reset_cpu_cycles()
color = 5
for i in 0 to 254 step 4 {
x1 = ((WIDTH-256)/2 as word) + math.sin8u(i) as word
y1 = (HEIGHT-128)/2 + math.cos8u(i)/2
x2 = ((WIDTH-64)/2 as word) + math.sin8u(i)/4 as word
y2 = (HEIGHT-64)/2 + math.cos8u(i)/4
gfx_lores.line(x1 as uword, y1 as ubyte, x2 as uword, y2 as ubyte, color)
}
clo, chi = emudbg.cpu_cycles()
sys.clear_irqd()
txt.print_uwhex(chi, true)
txt.print_uwhex(clo, false)
txt.nl()
2024-09-12 22:02:26 +00:00
2024-07-21 11:35:28 +00:00
}
}