prog8/examples/test.p8

49 lines
755 B
Plaintext
Raw Normal View History

2024-02-26 23:02:42 +00:00
%import math
%import textio
2024-02-22 16:13:07 +00:00
%zeropage dontuse
%option no_sysinit
main {
2024-02-25 04:02:50 +00:00
sub start() {
2024-02-26 23:02:42 +00:00
uword @shared wptr
str buffer=" "
2024-02-22 16:13:07 +00:00
2024-02-26 23:02:42 +00:00
; TODO: these generate LARGE code
while wptr!=&buffer
2024-02-25 04:02:50 +00:00
cx16.r0L++
2024-02-26 23:02:42 +00:00
while wptr==&buffer
2024-02-25 04:02:50 +00:00
cx16.r0L++
2024-02-26 23:02:42 +00:00
; ... these are fine:
while wptr!=cx16.r0
2024-02-25 04:02:50 +00:00
cx16.r0L++
2024-02-26 23:02:42 +00:00
while wptr==cx16.r0
2024-02-25 04:02:50 +00:00
cx16.r0L++
2024-02-22 22:39:31 +00:00
2024-02-26 23:02:42 +00:00
if ub() > 5
2024-02-25 04:02:50 +00:00
cx16.r0L++
2024-02-26 23:02:42 +00:00
if ub() < 5
2024-02-25 04:02:50 +00:00
cx16.r0L++
2024-02-22 22:39:31 +00:00
2024-02-26 23:02:42 +00:00
if sb() > 5
2024-02-25 04:02:50 +00:00
cx16.r0L++
2024-02-26 23:02:42 +00:00
if sb() < 5
2024-02-25 04:02:50 +00:00
cx16.r0L++
2024-02-26 23:02:42 +00:00
}
2024-02-22 22:39:31 +00:00
2024-02-26 23:02:42 +00:00
sub ub() -> ubyte {
cx16.r0++
return cx16.r0L
}
2024-02-22 22:39:31 +00:00
2024-02-26 23:02:42 +00:00
sub sb() -> byte {
cx16.r0++
return cx16.r0sL
}
2024-02-22 22:39:31 +00:00
}
2024-02-25 04:02:50 +00:00