2020-09-20 21:49:36 +00:00
|
|
|
%target c64
|
|
|
|
%import syslib
|
|
|
|
%import textio
|
2020-03-28 16:06:17 +00:00
|
|
|
%zeropage basicsafe
|
|
|
|
|
2020-09-27 01:55:59 +00:00
|
|
|
; TODO balloon only goes down now
|
|
|
|
|
|
|
|
|
2020-03-28 16:06:17 +00:00
|
|
|
main {
|
|
|
|
|
|
|
|
ubyte perform_scroll = false
|
|
|
|
|
|
|
|
sub start() {
|
|
|
|
c64.SPRPTR[0] = $0f00 / 64
|
|
|
|
c64.SPENA = 1
|
|
|
|
c64.SP0COL = 14
|
|
|
|
c64.SPXY[0] = 80
|
|
|
|
c64.SPXY[1] = 100
|
|
|
|
|
2020-04-06 16:19:14 +00:00
|
|
|
c64.SCROLX &= %11110111 ; 38 column mode
|
2020-03-28 16:06:17 +00:00
|
|
|
|
2020-08-27 16:10:22 +00:00
|
|
|
c64.set_rasterirq(1) ; enable animation
|
2020-03-28 16:06:17 +00:00
|
|
|
|
|
|
|
ubyte target_height = 10
|
|
|
|
ubyte active_height = 24
|
|
|
|
ubyte upwards = true
|
|
|
|
|
2020-07-25 14:25:02 +00:00
|
|
|
repeat {
|
2020-03-28 16:06:17 +00:00
|
|
|
ubyte mountain = 223 ; slope upwards
|
|
|
|
if active_height < target_height {
|
|
|
|
active_height++
|
|
|
|
upwards = true
|
|
|
|
} else if active_height > target_height {
|
|
|
|
mountain = 233 ; slope downwards
|
|
|
|
active_height--
|
|
|
|
upwards = false
|
|
|
|
} else {
|
|
|
|
target_height = 8 + rnd() % 16
|
|
|
|
if upwards
|
|
|
|
mountain = 233
|
|
|
|
else
|
|
|
|
mountain = 223
|
|
|
|
}
|
|
|
|
|
|
|
|
while not perform_scroll {
|
|
|
|
; let the raster irq do its timing job
|
|
|
|
}
|
|
|
|
|
|
|
|
perform_scroll = false
|
2020-09-21 19:39:36 +00:00
|
|
|
txt.scroll_left(true)
|
2020-03-28 16:06:17 +00:00
|
|
|
if c64.RASTER & 1
|
|
|
|
c64.SPXY[1] ++
|
|
|
|
else
|
|
|
|
c64.SPXY[1] --
|
|
|
|
|
|
|
|
ubyte yy
|
|
|
|
for yy in 0 to active_height-1 {
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.setcc(39, yy, 32, 2) ; clear top of screen
|
2020-03-28 16:06:17 +00:00
|
|
|
}
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.setcc(39, active_height, mountain, 8) ; mountain edge
|
2020-03-28 16:06:17 +00:00
|
|
|
for yy in active_height+1 to 24 {
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.setcc(39, yy, 160, 8) ; draw mountain
|
2020-03-28 16:06:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
yy = rnd()
|
|
|
|
if yy > 100 {
|
|
|
|
; draw a star
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.setcc(39, yy % (active_height-1), '.', rnd())
|
2020-03-28 16:06:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if yy > 200 {
|
|
|
|
; draw a tree
|
|
|
|
ubyte tree = 30
|
|
|
|
ubyte treecolor = 5
|
|
|
|
if yy & %01000000 != 0
|
|
|
|
tree = 88
|
|
|
|
else if yy & %00100000 != 0
|
|
|
|
tree = 65
|
|
|
|
if rnd() > 130
|
|
|
|
treecolor = 13
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.setcc(39, active_height, tree, treecolor)
|
2020-03-28 16:06:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if yy > 235 {
|
|
|
|
; draw a camel
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.setcc(39, active_height, 94, 9)
|
2020-03-28 16:06:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
spritedata $0f00 {
|
|
|
|
; this memory block contains the sprite data
|
|
|
|
; it must start on an address aligned to 64 bytes.
|
|
|
|
%option force_output ; make sure the data in this block appears in the resulting program
|
|
|
|
|
|
|
|
ubyte[] balloonsprite = [ %00000000,%01111111,%00000000,
|
|
|
|
%00000001,%11111111,%11000000,
|
|
|
|
%00000011,%11111111,%11100000,
|
|
|
|
%00000011,%11100011,%11100000,
|
|
|
|
%00000111,%11011100,%11110000,
|
|
|
|
%00000111,%11011101,%11110000,
|
|
|
|
%00000111,%11011100,%11110000,
|
|
|
|
%00000011,%11100011,%11100000,
|
|
|
|
%00000011,%11111111,%11100000,
|
|
|
|
%00000011,%11111111,%11100000,
|
|
|
|
%00000010,%11111111,%10100000,
|
|
|
|
%00000001,%01111111,%01000000,
|
|
|
|
%00000001,%00111110,%01000000,
|
|
|
|
%00000000,%10011100,%10000000,
|
|
|
|
%00000000,%10011100,%10000000,
|
|
|
|
%00000000,%01001001,%00000000,
|
|
|
|
%00000000,%01001001,%00000000,
|
|
|
|
%00000000,%00111110,%00000000,
|
|
|
|
%00000000,%00111110,%00000000,
|
|
|
|
%00000000,%00111110,%00000000,
|
|
|
|
%00000000,%00011100,%00000000 ]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
irq {
|
|
|
|
ubyte smoothx=7
|
|
|
|
sub irq() {
|
|
|
|
smoothx = (smoothx-1) & 7
|
|
|
|
main.perform_scroll = smoothx==0
|
|
|
|
c64.SCROLX = (c64.SCROLX & %11111000) | smoothx
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|