1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-28 11:31:58 +00:00
millfork/examples/c64/rasterbar.mfk
2019-06-28 21:45:28 +02:00

46 lines
1.0 KiB
Plaintext

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 { }
stabilize(10)
vic_border = colour
wait_for += 2
}
bar_start += direction
if bar_start == $50 { direction = 1 }
if bar_start == $A0 { direction = $ff }
}
}
inline asm void stabilize(byte x){
burn:
DEX
BNE burn
? RTS
}
const array colours = [
$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
]