1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-11-08 20:06:24 +00:00
millfork/examples/c64/softscroll.mfk
2019-08-06 12:59:05 +02:00

135 lines
7.8 KiB
Plaintext

const pointer screen = $400
const byte row = 15
byte letter_index
void main () {
#if CBM_64_CRT
vic_bg_color0 = blue
vic_border = light_blue
vic_cr1 = $9b
vic_mem = $15
vic_cr2 = $c8
#endif
letter_index = 0
disable_irq()
init_screen()
main_loop()
}
void init_screen() {
byte i
for i,0,paralleluntil,250 {
screen[i+000] = logo[i-000]
screen[i+250] = logo[i+250]
screen[i+500] = logo[i+500]
screen[i+750] = logo[i+750]
c64_color_ram[i+000] = logo_colours[i+000]
c64_color_ram[i+250] = logo_colours[i+250]
c64_color_ram[i+500] = logo_colours[i+500]
c64_color_ram[i+750] = logo_colours[i+750]
}
}
void main_loop() {
static byte scroll
scroll = 7
while true {
while vic_raster != row * 8 - 1 + 50 {}
stabilize(9)
vic_38_columns()
vic_set_scroll(scroll, 3)
while vic_raster != row * 8 + 7 + 50 {}
stabilize(22)
vic_40_columns()
vic_set_scroll(0,3)
if scroll == 0 {
scroll = 7
hardscroll()
} else {
scroll -= 1
}
}
}
asm void stabilize(byte x){
burn:
DEX
BNE burn
RTS
}
void hardscroll() {
byte i
for i,0,until,39 {
screen[40 * row + i] = screen[40 * row + i + 1]
}
screen[40 * row + 39] = scroll_text[letter_index]
letter_index += 1
if letter_index == scroll_text.length {
letter_index = 0
}
}
const array scroll_text = [
"this is a simple scroller demo written in millfork. " scr,
"as you can see, you don't need assembly to do simple effects. " scr,
" " scr
]
const array logo = [
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
82,70,64,68,69,68,64,70,82,70,64,68,69,68,64,70,82,70,64,68,69,68,64,70,82,70,64,68,69,68,64,70,82,70,64,68,69,68,64,70,
32,32,32,32,32,108,123,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,108,224,224,123,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,225,97,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,225,97,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,108,32,32,32,225,97,32,225,252,108,224,32,251,236,32,225,97,32,32,225,97,32,32,225,236,226,126,108,236,251,123,225,236,251,123,225,97,254,126,
108,224,98,98,98,254,97,32,225,236,236,224,32,225,97,32,225,97,32,32,225,97,32,32,225,252,123,32,225,97,225,97,225,252,254,126,225,224,126,32,
124,224,226,226,226,226,126,32,225,97,32,224,32,225,97,32,225,97,32,32,225,97,32,32,225,97,32,32,225,97,225,97,225,236,252,32,225,236,252,32,
32,124,32,32,32,32,32,32,124,126,32,226,32,226,226,32,124,226,226,126,124,226,226,126,124,126,32,32,32,226,226,32,124,126,124,126,124,126,124,126,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
82,70,64,68,69,68,64,70,82,70,64,68,69,68,64,70,82,70,64,68,69,68,64,70,82,70,64,68,69,68,64,70,82,70,64,68,69,68,64,70,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
]
const array logo_colours = [
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
14,14,14,14,14,5,5,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,5,5,5,5,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,5,5,5,14,14,14,0,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,5,5,14,0,14,0,0,14,0,14,0,0,0,14,0,0,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,5,14,14,14,5,5,14,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
5,5,5,5,5,5,5,14,0,0,0,0,14,0,0,14,0,0,14,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,
5,5,5,5,5,5,5,14,0,0,0,0,14,0,0,14,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
14,5,5,14,14,14,14,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,0,14,14,14,0,0,0,14,14,14,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14
]