2020-09-20 21:49:36 +00:00
|
|
|
%target c64
|
|
|
|
%import floats
|
|
|
|
%import graphics
|
2020-09-21 23:05:07 +00:00
|
|
|
%zeropage floatsafe
|
2020-03-28 13:17:35 +00:00
|
|
|
|
2020-10-17 14:09:14 +00:00
|
|
|
|
2020-03-28 13:17:35 +00:00
|
|
|
main {
|
|
|
|
|
|
|
|
sub start() {
|
|
|
|
graphics.enable_bitmap_mode()
|
|
|
|
turtle.init()
|
2020-07-25 23:32:27 +00:00
|
|
|
; turtle.pu()
|
|
|
|
; turtle.pos(150, 110)
|
|
|
|
; turtle.pd()
|
2020-03-28 13:17:35 +00:00
|
|
|
|
2020-07-25 20:54:50 +00:00
|
|
|
ubyte i
|
2020-03-28 13:17:35 +00:00
|
|
|
for i in 0 to 100 {
|
|
|
|
turtle.fd(i+20)
|
|
|
|
turtle.rt(94)
|
|
|
|
}
|
|
|
|
|
2020-07-25 14:25:02 +00:00
|
|
|
repeat {
|
2020-03-28 13:17:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
turtle {
|
|
|
|
float xpos
|
|
|
|
float ypos
|
|
|
|
float angle
|
|
|
|
ubyte pendown
|
|
|
|
|
|
|
|
sub init() {
|
|
|
|
xpos = 160.0
|
|
|
|
ypos = 100.0
|
|
|
|
angle = 0.0
|
|
|
|
pendown = true
|
|
|
|
|
|
|
|
c64.SPRPTR[0] = $0d00 / 64
|
|
|
|
c64.SPENA = 1
|
|
|
|
c64.SP0COL = 5
|
|
|
|
|
2020-07-03 23:02:36 +00:00
|
|
|
update_turtle_sprite()
|
2020-03-28 13:17:35 +00:00
|
|
|
}
|
|
|
|
|
2020-07-03 23:02:36 +00:00
|
|
|
sub update_turtle_sprite() {
|
2020-03-28 13:17:35 +00:00
|
|
|
uword xx = xpos as uword
|
|
|
|
c64.SPXY[0] = lsb(xx) + 12
|
2020-07-03 23:02:36 +00:00
|
|
|
c64.MSIGX = msb(xx) > 0
|
2020-08-21 16:02:01 +00:00
|
|
|
c64.SPXY[1] = ypos as ubyte + 40
|
2020-03-28 13:17:35 +00:00
|
|
|
}
|
|
|
|
|
2020-07-03 23:02:36 +00:00
|
|
|
sub pos(float x, float y) {
|
|
|
|
if pendown {
|
|
|
|
graphics.line(xpos as uword, ypos as ubyte, x as uword, y as ubyte)
|
|
|
|
}
|
|
|
|
xpos = x
|
|
|
|
ypos = y
|
|
|
|
update_turtle_sprite()
|
|
|
|
}
|
|
|
|
|
2020-03-28 13:17:35 +00:00
|
|
|
sub fd(uword length) {
|
|
|
|
float flen = length as float
|
|
|
|
float sx = xpos
|
|
|
|
float sy = ypos
|
|
|
|
xpos += flen * sin(angle)
|
|
|
|
ypos -= flen * cos(angle)
|
2020-07-03 23:02:36 +00:00
|
|
|
update_turtle_sprite()
|
2020-03-28 13:17:35 +00:00
|
|
|
if pendown {
|
2020-08-21 16:02:01 +00:00
|
|
|
graphics.line(sx as uword, sy as ubyte, xpos as uword, ypos as ubyte)
|
2020-03-28 13:17:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub rt(uword degrees) {
|
|
|
|
angle += rad(degrees as float)
|
|
|
|
}
|
|
|
|
|
|
|
|
sub lt(uword degrees) {
|
|
|
|
angle -= rad(degrees as float)
|
|
|
|
}
|
|
|
|
|
|
|
|
sub pu() {
|
|
|
|
pendown = false
|
|
|
|
}
|
|
|
|
|
|
|
|
sub pd() {
|
|
|
|
pendown = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
spritedata $0d00 {
|
|
|
|
; 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,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%01111110,%00000000,
|
|
|
|
%00000000,%11000011,%00000000,
|
|
|
|
%00000000,%11000011,%00000000,
|
|
|
|
%00000000,%11000011,%00000000,
|
|
|
|
%00000000,%01111110,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000,
|
|
|
|
%00000000,%00000000,%00000000 ]
|
|
|
|
}
|