1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-26 12:29:26 +00:00
millfork/examples/c64/rasterbar.mfk

46 lines
1.0 KiB
Plaintext
Raw Normal View History

2018-01-21 20:55:01 +00:00
void main() {
byte colour
byte colour_index
byte wait_for
byte bar_start
byte direction
colour = 0
disable_irq()
vic_cr1 = 0
vic_border = black
bar_start = $50
direction = 1
while true {
wait_for = bar_start
for colour_index, 0, until, colours.length {
colour = colours[colour_index]
while wait_for != vic_raster { }
2019-06-28 19:45:28 +00:00
stabilize(10)
2018-01-21 20:55:01 +00:00
vic_border = colour
wait_for += 2
}
bar_start += direction
if bar_start == $50 { direction = 1 }
if bar_start == $A0 { direction = $ff }
}
}
2019-06-28 19:45:28 +00:00
inline asm void stabilize(byte x){
2018-01-21 20:55:01 +00:00
burn:
DEX
BNE burn
2019-06-28 19:45:28 +00:00
? RTS
2018-01-21 20:55:01 +00:00
}
2019-04-29 20:57:40 +00:00
const array colours = [
2018-01-21 20:55:01 +00:00
$06, $06, $06, $0e, $06, $0e,
$0e, $06, $0e, $0e, $0e, $03,
$0e, $03, $03, $0e, $03, $03,
$03, $01, $03, $01, $01, $03,
$01, $01, $01, $03, $01, $01,
$03, $01, $03, $03, $03, $0e,
$03, $03, $0e, $03, $0e, $0e,
$0e, $06, $0e, $0e, $06, $0e,
$06, $06, $06, $00, $00, $00
]