2021-03-03 00:09:18 +00:00
|
|
|
%import palette
|
2022-04-12 21:58:19 +00:00
|
|
|
%import math
|
2022-11-06 15:38:31 +00:00
|
|
|
%import gfx2
|
2021-03-03 00:09:18 +00:00
|
|
|
%option no_sysinit
|
|
|
|
|
|
|
|
; Vertical rasterbars a.k.a. "Kefren bars"
|
|
|
|
; also see: rasterbars.p8
|
|
|
|
|
|
|
|
main {
|
|
|
|
|
|
|
|
sub start() {
|
|
|
|
uword[32] colors = [
|
|
|
|
$000,
|
|
|
|
$011, $112, $213, $214,
|
|
|
|
$315, $316, $417, $418,
|
|
|
|
$519, $51a, $62b, $62c,
|
|
|
|
$73d, $73e, $84f, $94f,
|
|
|
|
$93e, $83d, $82c, $72b,
|
|
|
|
$71a, $619, $618, $517,
|
|
|
|
$516, $415, $414, $313,
|
|
|
|
$312, $211, $100
|
|
|
|
]
|
|
|
|
|
|
|
|
palette.set_rgb(&colors, len(colors))
|
2023-10-04 21:01:00 +00:00
|
|
|
gfx2.screen_mode(1) ; lores 256 colors
|
2022-11-06 15:38:31 +00:00
|
|
|
cx16.VERA_DC_VSCALE = 0 ; display trick spoiler.......: stretch 1 line of display all the way to the bottom
|
2023-11-22 22:23:10 +00:00
|
|
|
cx16.enable_irq_handlers(true)
|
|
|
|
cx16.set_line_irq_handler(0, &irq.irqhandler)
|
2021-03-03 00:09:18 +00:00
|
|
|
|
|
|
|
repeat {
|
|
|
|
; don't exit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
irq {
|
2024-09-16 19:49:20 +00:00
|
|
|
const ubyte BAR_Y_OFFSET = 5
|
2021-03-03 00:09:18 +00:00
|
|
|
uword next_irq_line = 0
|
|
|
|
ubyte anim1 = 0
|
|
|
|
ubyte av1 = 0
|
|
|
|
ubyte anim2 = 0
|
|
|
|
ubyte av2 = 0
|
|
|
|
ubyte[32] pixels = 0 to 31
|
|
|
|
|
2023-11-22 22:23:10 +00:00
|
|
|
sub irqhandler() -> bool {
|
2022-11-06 15:38:31 +00:00
|
|
|
next_irq_line += BAR_Y_OFFSET
|
|
|
|
anim1 += 7
|
|
|
|
anim2 += 4
|
2024-09-16 19:49:20 +00:00
|
|
|
if next_irq_line > 480 {
|
2021-03-03 00:09:18 +00:00
|
|
|
av1++
|
|
|
|
av2 += 2
|
|
|
|
anim1 = av1
|
|
|
|
anim2 = av2
|
|
|
|
next_irq_line = 0
|
|
|
|
; erase the bars
|
2022-11-06 15:38:31 +00:00
|
|
|
gfx2.horizontal_line(0, 0, 320, 3)
|
2024-09-16 19:49:20 +00:00
|
|
|
; gfx2.position(0, 0)
|
|
|
|
; repeat 10 {
|
|
|
|
; gfx2.next_pixels(pixels, len(pixels))
|
|
|
|
; }
|
2021-03-03 00:09:18 +00:00
|
|
|
} else {
|
2022-11-06 15:38:31 +00:00
|
|
|
; add new bar on top
|
|
|
|
gfx2.position(math.sin8u(anim1)/2 + math.cos8u(anim2)/2 + $0010, 0)
|
|
|
|
gfx2.next_pixels(pixels, len(pixels))
|
2021-03-03 00:09:18 +00:00
|
|
|
}
|
|
|
|
|
2023-04-28 21:13:03 +00:00
|
|
|
sys.set_rasterline(next_irq_line)
|
2023-11-22 22:23:10 +00:00
|
|
|
return false
|
2021-03-03 00:09:18 +00:00
|
|
|
}
|
|
|
|
}
|