prog8/examples/wizzine.p8

63 lines
2.2 KiB
Plaintext
Raw Normal View History

%target c64
%import syslib
%zeropage basicsafe
2019-07-29 21:11:13 +00:00
spritedata $0a00 {
; 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 ]
}
2019-07-29 21:11:13 +00:00
main {
sub start() {
ubyte i
for i in 0 to 7 {
c64.SPRPTR[i] = $0a00/64
2019-01-08 23:25:02 +00:00
}
c64.SPENA = 255 ; enable all sprites
c64.set_rasterirq(&irq.irq, 230, true) ; enable animation
}
}
2019-07-29 21:11:13 +00:00
irq {
ubyte angle
2019-01-11 08:26:59 +00:00
sub irq() {
angle++
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 {
c64.EXTCOL++
uword @zp x = sin8u(angle*2-spri*16) as uword + 50
ubyte @zp y = cos8u(angle*3-spri*16) / 2 + 70
c64.SPXYW[spri] = mkword(y, lsb(x))
c64.MSIGX <<= 1
2020-09-27 11:31:46 +00:00
if msb(x) c64.MSIGX++
2019-01-11 08:26:59 +00:00
}
c64.EXTCOL-=8
2019-01-10 22:09:58 +00:00
}
}