prog8/examples/test.p8

131 lines
2.3 KiB
Plaintext
Raw Normal View History

%import textio
%zeropage basicsafe
2023-11-25 21:09:19 +01:00
; $3d5
main {
ubyte counter
uword wcounter
2023-11-25 21:09:19 +01:00
ubyte end
uword wend
sub start() {
2023-11-25 21:09:19 +01:00
end=10
for cx16.r2L in 0 to end-1 {
txt.print_ub(cx16.r2L)
txt.spc()
}
txt.nl()
cx16.r2L=0
labeltje:
txt.print_ub(cx16.r2L)
txt.spc()
cx16.r2L++
if cx16.r2L!=end
goto labeltje
txt.nl()
cx16.r0=0
forloops()
txt.print_uw(cx16.r0)
txt.nl()
cx16.r0=0
untilloops()
txt.print_uw(cx16.r0)
2023-11-19 17:52:43 +01:00
txt.nl()
}
sub forloops() {
end=10
for counter in 0 to end {
cx16.r0++
}
2023-11-25 21:09:19 +01:00
for counter in 0 to end-1 {
cx16.r0++
}
end=0
for counter in 0 to end {
cx16.r0++
}
2023-11-25 21:09:19 +01:00
for counter in 0 to end-1 {
cx16.r0++
}
end=255
for counter in 0 to end {
cx16.r0++
}
2023-11-25 21:09:19 +01:00
for counter in 0 to end-1 {
cx16.r0++
}
wend=1000
for wcounter in 0 to wend {
cx16.r0++
}
2023-11-25 21:09:19 +01:00
for wcounter in 0 to wend-1 {
cx16.r0++
}
}
sub untilloops() {
end=10
counter = 0
repeat {
cx16.r0++
if counter==end
2023-11-19 17:52:43 +01:00
break
counter++
2023-11-19 17:52:43 +01:00
}
2023-11-25 21:09:19 +01:00
counter = 0
do {
cx16.r0++
counter++
} until counter==end
end=0
counter = 0
repeat {
cx16.r0++
if counter==end
2023-11-19 17:52:43 +01:00
break
counter++
}
2023-11-25 21:09:19 +01:00
counter = 0
do {
cx16.r0++
counter++
} until counter==end
2023-11-19 17:52:43 +01:00
counter = 0
end=255
repeat {
cx16.r0++
if counter==end
2023-11-19 17:52:43 +01:00
break
counter++
}
2023-11-25 21:09:19 +01:00
counter = 0
do {
cx16.r0++
counter++
} until counter==end
2023-11-19 17:52:43 +01:00
wcounter = 0
wend=1000
repeat {
cx16.r0++
if wcounter==wend
break
wcounter++
}
2023-11-25 21:09:19 +01:00
wcounter = 0
do {
cx16.r0++
wcounter++
} until wcounter==wend
2023-11-14 18:23:37 +01:00
}
}