2021-03-12 19:12:33 +00:00
|
|
|
%import graphics
|
|
|
|
%zeropage basicsafe
|
2021-02-28 19:40:31 +00:00
|
|
|
|
2021-03-05 21:49:14 +00:00
|
|
|
main {
|
|
|
|
sub start() {
|
2021-03-12 19:12:33 +00:00
|
|
|
|
2021-03-15 18:29:32 +00:00
|
|
|
word xx
|
|
|
|
word yy
|
|
|
|
|
|
|
|
; all comparisons with constant values are already optimized.
|
|
|
|
; but for variables (and memreads) we can optimize further (don't use temporary ZP location)
|
|
|
|
|
|
|
|
word value = 100
|
|
|
|
|
|
|
|
while xx==value {
|
|
|
|
yy++
|
|
|
|
}
|
|
|
|
|
|
|
|
while xx!=value {
|
|
|
|
yy++
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
|
|
|
yy++
|
|
|
|
} until xx==value
|
|
|
|
|
|
|
|
do {
|
|
|
|
yy++
|
|
|
|
} until xx!=value
|
|
|
|
|
|
|
|
if xx==value
|
|
|
|
yy++
|
|
|
|
|
|
|
|
if xx!=value
|
|
|
|
yy++
|
|
|
|
|
|
|
|
; while xx>value {
|
|
|
|
; yy++
|
|
|
|
; }
|
|
|
|
; do {
|
|
|
|
; yy++
|
|
|
|
; } until xx>value
|
|
|
|
;
|
|
|
|
; if xx>value
|
|
|
|
; yy++
|
|
|
|
}
|
|
|
|
|
|
|
|
sub start3() {
|
|
|
|
|
2021-03-12 19:12:33 +00:00
|
|
|
byte xx
|
|
|
|
byte yy
|
|
|
|
|
2021-03-13 23:00:45 +00:00
|
|
|
; all comparisons with constant values are already optimized.
|
|
|
|
; but for variables (and memreads) we can optimize further (don't use temporary ZP location)
|
2021-03-12 19:12:33 +00:00
|
|
|
|
|
|
|
byte value = 100
|
|
|
|
|
|
|
|
while xx==value {
|
|
|
|
yy++
|
|
|
|
}
|
|
|
|
|
2021-03-15 18:29:32 +00:00
|
|
|
while xx==@($2000) {
|
|
|
|
yy++
|
|
|
|
}
|
|
|
|
|
2021-03-12 19:12:33 +00:00
|
|
|
while xx!=value {
|
|
|
|
yy++
|
|
|
|
}
|
|
|
|
|
2021-03-15 18:29:32 +00:00
|
|
|
while xx!=@($2000) {
|
2021-03-12 19:12:33 +00:00
|
|
|
yy++
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
|
|
|
yy++
|
|
|
|
} until xx==value
|
|
|
|
|
|
|
|
do {
|
|
|
|
yy++
|
|
|
|
} until xx!=value
|
|
|
|
|
|
|
|
if xx==value
|
|
|
|
yy++
|
|
|
|
|
|
|
|
if xx!=value
|
|
|
|
yy++
|
|
|
|
|
2021-03-15 18:29:32 +00:00
|
|
|
; while xx>value {
|
|
|
|
; yy++
|
|
|
|
; }
|
|
|
|
; do {
|
|
|
|
; yy++
|
|
|
|
; } until xx>value
|
|
|
|
;
|
|
|
|
; if xx>value
|
|
|
|
; yy++
|
2021-03-12 19:12:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub start2() {
|
|
|
|
|
|
|
|
graphics.enable_bitmap_mode()
|
2021-03-09 19:44:06 +00:00
|
|
|
|
2021-03-08 22:08:47 +00:00
|
|
|
uword xx
|
2021-03-09 19:44:06 +00:00
|
|
|
ubyte yy
|
|
|
|
|
2021-03-12 19:12:33 +00:00
|
|
|
graphics.line(150,50,150,50)
|
2021-03-09 19:44:06 +00:00
|
|
|
|
|
|
|
for yy in 0 to 199-60 step 16 {
|
|
|
|
|
|
|
|
for xx in 0 to 319-50 step 16 {
|
2021-03-12 19:12:33 +00:00
|
|
|
graphics.line(30+xx, 10+yy, 50+xx, 30+yy)
|
|
|
|
graphics.line(49+xx, 30+yy, 10+xx, 30+yy)
|
|
|
|
graphics.line(11+xx, 29+yy, 29+xx, 11+yy)
|
2021-03-09 19:44:06 +00:00
|
|
|
|
|
|
|
; triangle 2, counter-clockwise
|
2021-03-12 19:12:33 +00:00
|
|
|
graphics.line(30+xx, 40+yy, 10+xx, 60+yy)
|
|
|
|
graphics.line(11+xx, 60+yy, 50+xx, 60+yy)
|
|
|
|
graphics.line(49+xx, 59+yy, 31+xx,41+yy)
|
2021-03-09 19:44:06 +00:00
|
|
|
}
|
2021-03-08 22:21:52 +00:00
|
|
|
}
|
2021-03-08 22:08:47 +00:00
|
|
|
|
2021-03-09 19:44:06 +00:00
|
|
|
repeat {
|
|
|
|
}
|
2021-02-21 21:17:28 +00:00
|
|
|
}
|
|
|
|
}
|