2021-02-22 00:44:07 +00:00
|
|
|
%import textio
|
2021-02-23 23:01:27 +00:00
|
|
|
%import palette
|
2022-04-12 21:58:19 +00:00
|
|
|
%import math
|
2021-02-22 00:44:07 +00:00
|
|
|
|
2021-03-03 00:09:18 +00:00
|
|
|
; horizontal raster bars
|
|
|
|
; also see: kefrenbars.p8
|
|
|
|
|
|
|
|
|
2021-02-22 00:44:07 +00:00
|
|
|
main {
|
|
|
|
|
|
|
|
sub start() {
|
2022-03-31 16:17:28 +00:00
|
|
|
void cx16.screen_mode(3, false)
|
2022-03-31 22:04:40 +00:00
|
|
|
txt.color2(14,0) ; make sure correct screen colors are (re)set
|
|
|
|
txt.clear_screen()
|
|
|
|
|
2021-02-22 00:44:07 +00:00
|
|
|
txt.plot(14,14)
|
|
|
|
txt.print("raster bars!")
|
2021-02-26 00:16:06 +00:00
|
|
|
|
2023-11-22 22:23:10 +00:00
|
|
|
cx16.enable_irq_handlers(true)
|
|
|
|
cx16.set_line_irq_handler(0, &irq.irqhandler)
|
2021-02-22 00:44:07 +00:00
|
|
|
|
|
|
|
repeat {
|
|
|
|
; don't exit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
irq {
|
|
|
|
uword[32] colors = [
|
2021-02-23 23:01:27 +00:00
|
|
|
$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, $000
|
2021-02-22 00:44:07 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
uword next_irq_line = 0
|
|
|
|
ubyte color_idx = 0
|
|
|
|
ubyte yanim = 0
|
|
|
|
const ubyte barheight = 4
|
|
|
|
|
2023-11-22 22:23:10 +00:00
|
|
|
sub irqhandler() -> bool {
|
2021-02-22 00:44:07 +00:00
|
|
|
uword c = colors[color_idx]
|
|
|
|
color_idx++
|
|
|
|
color_idx &= 31
|
|
|
|
|
|
|
|
if color_idx==0 {
|
|
|
|
yanim++
|
2022-04-12 21:58:19 +00:00
|
|
|
next_irq_line = $0030 + math.sin8u(yanim)
|
2021-02-22 00:44:07 +00:00
|
|
|
} else {
|
|
|
|
next_irq_line += barheight
|
|
|
|
}
|
|
|
|
|
2021-02-23 23:01:27 +00:00
|
|
|
palette.set_color(0, c)
|
2021-02-22 00:44:07 +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-02-22 00:44:07 +00:00
|
|
|
}
|
|
|
|
}
|