2020-09-20 23:49:36 +02:00
|
|
|
%import textio
|
|
|
|
%import syslib
|
2022-10-22 16:35:57 +02:00
|
|
|
%import math
|
2019-02-03 00:14:56 +01:00
|
|
|
%zeropage basicsafe
|
2018-12-30 21:40:27 +01:00
|
|
|
|
|
|
|
|
2019-07-29 23:11:13 +02:00
|
|
|
spritedata $0a00 {
|
2019-01-02 03:18:32 +01:00
|
|
|
; 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
|
2018-12-31 04:48:26 +01:00
|
|
|
|
2019-04-16 01:19:51 +02:00
|
|
|
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 ]
|
2019-01-01 21:47:19 +01:00
|
|
|
}
|
2018-12-31 01:52:18 +01:00
|
|
|
|
2019-07-29 23:11:13 +02:00
|
|
|
main {
|
2019-01-01 21:47:19 +01:00
|
|
|
|
2018-12-30 21:40:27 +01:00
|
|
|
sub start() {
|
|
|
|
|
2020-08-27 18:10:22 +02:00
|
|
|
txt.print("balloon sprites!\n...we are all floating...\n")
|
2018-12-30 21:40:27 +01:00
|
|
|
|
2019-08-18 03:16:23 +02:00
|
|
|
ubyte @zp i
|
|
|
|
for i in 0 to 7 {
|
2023-09-08 21:27:38 +02:00
|
|
|
c64.set_sprite_ptr(i, $0a00) ; alternatively, set directly: c64.SPRPTR[i] = $0a00 / 64
|
2020-10-18 13:33:11 +02:00
|
|
|
c64.SPXY[i*2] = 50+25*i
|
2022-10-22 16:35:57 +02:00
|
|
|
c64.SPXY[i*2+1] = math.rnd()
|
2018-12-31 04:48:26 +01:00
|
|
|
}
|
2018-12-31 01:52:18 +01:00
|
|
|
|
2019-01-02 03:18:32 +01:00
|
|
|
c64.SPENA = 255 ; enable all sprites
|
2023-11-21 22:33:37 +01:00
|
|
|
sys.set_rasterirq(&irq.irqhandler, 255) ; enable animation
|
2018-12-30 21:40:27 +01:00
|
|
|
}
|
2018-12-31 01:52:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-07-29 23:11:13 +02:00
|
|
|
irq {
|
2019-01-09 00:25:02 +01:00
|
|
|
|
2023-11-21 22:33:37 +01:00
|
|
|
sub irqhandler() -> bool {
|
2019-07-16 21:31:14 +02:00
|
|
|
c64.EXTCOL--
|
2019-01-09 00:25:02 +01:00
|
|
|
|
2019-07-16 21:31:14 +02:00
|
|
|
; float up & wobble horizontally
|
2019-08-18 03:16:23 +02:00
|
|
|
ubyte @zp i
|
|
|
|
for i in 0 to 14 step 2 {
|
2020-10-17 22:43:35 +02:00
|
|
|
c64.SPXY[i+1]--
|
2022-10-22 16:35:57 +02:00
|
|
|
ubyte @zp r = math.rnd()
|
2019-07-16 21:31:14 +02:00
|
|
|
if r>200
|
|
|
|
c64.SPXY[i]++
|
|
|
|
else if r<40
|
|
|
|
c64.SPXY[i]--
|
|
|
|
}
|
|
|
|
|
|
|
|
c64.EXTCOL++
|
2023-11-21 22:33:37 +01:00
|
|
|
return true
|
2019-07-16 21:31:14 +02:00
|
|
|
}
|
2018-12-30 21:40:27 +01:00
|
|
|
|
|
|
|
}
|