2020-09-20 21:49:36 +00:00
|
|
|
%import syslib
|
2022-04-12 21:58:19 +00:00
|
|
|
%import math
|
2019-02-02 23:14:56 +00:00
|
|
|
%zeropage basicsafe
|
2019-01-05 01:42:58 +00:00
|
|
|
|
2019-07-29 21:11:13 +00:00
|
|
|
main {
|
2019-01-05 01:42:58 +00:00
|
|
|
sub start() {
|
2019-08-18 01:16:23 +00:00
|
|
|
ubyte i
|
|
|
|
for i in 0 to 7 {
|
2024-10-26 19:35:59 +00:00
|
|
|
c64.set_sprite_ptr(i, &spritedata.balloonsprite) ; alternatively, set directly: c64.SPRPTR[i] = $0a00 / 64
|
2019-01-08 23:25:02 +00:00
|
|
|
}
|
2019-01-15 20:35:15 +00:00
|
|
|
c64.SPENA = 255 ; enable all sprites
|
2023-11-21 21:33:37 +00:00
|
|
|
sys.set_rasterirq(&irq.irqhandler, 230) ; enable animation
|
2019-01-05 01:42:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-07-29 21:11:13 +00:00
|
|
|
irq {
|
2021-11-30 02:05:25 +00:00
|
|
|
ubyte angle1=200
|
|
|
|
ubyte angle2=0
|
2020-03-22 21:47:05 +00:00
|
|
|
|
2023-11-21 21:33:37 +00:00
|
|
|
sub irqhandler() -> bool {
|
2021-11-30 02:05:25 +00:00
|
|
|
angle1 += 2
|
|
|
|
angle2 += 3
|
2019-01-11 08:26:59 +00:00
|
|
|
c64.MSIGX=0
|
2020-03-23 23:24:51 +00:00
|
|
|
ubyte @zp spri
|
2020-03-11 19:47:42 +00:00
|
|
|
for spri in 7 downto 0 {
|
2020-08-22 19:08:29 +00:00
|
|
|
c64.EXTCOL++
|
2022-04-12 21:58:19 +00:00
|
|
|
uword @zp x = math.sin8u(angle1-spri*16) as uword + 50
|
|
|
|
ubyte @zp y = math.sin8u(angle2-spri*16) / 2 + 70
|
2020-08-22 19:08:29 +00:00
|
|
|
c64.SPXYW[spri] = mkword(y, lsb(x))
|
2024-09-22 10:20:28 +00:00
|
|
|
if msb(x)!=0
|
|
|
|
sys.set_carry()
|
|
|
|
rol(c64.MSIGX)
|
2019-01-11 08:26:59 +00:00
|
|
|
}
|
2020-08-22 19:08:29 +00:00
|
|
|
c64.EXTCOL-=8
|
2023-11-21 21:33:37 +00:00
|
|
|
return true
|
2019-01-10 22:09:58 +00:00
|
|
|
}
|
2019-01-05 01:42:58 +00:00
|
|
|
}
|
2024-10-26 19:35:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
spritedata {
|
|
|
|
; this memory block contains the sprite data
|
|
|
|
; it must start on an address aligned to 64 bytes.
|
|
|
|
|
|
|
|
ubyte[] @align64 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
|
|
|
|
]
|
|
|
|
}
|