prog8/examples/structs.p8
Irmen de Jong c38508c262 introduced repeat loop. repeat-until changed to do-util.
forever loop is gone (use repeat without iteration count).
struct literal is now same as array literal [...] to avoid parsing ambiguity with scope blocks.
2020-07-25 16:56:34 +02:00

35 lines
583 B
Lua

%import c64utils
%zeropage basicsafe
; TODO fix compiler errors when compiling without optimization ( /= )
main {
struct Color {
ubyte red
ubyte green
ubyte blue
}
sub start() {
Color purple = [255, 0, 255]
Color other
other = purple
other.red /= 2
other.green = 10 + other.green / 2
other.blue = 99
c64scr.print_ub(other.red)
c64.CHROUT(',')
c64scr.print_ub(other.green)
c64.CHROUT(',')
c64scr.print_ub(other.blue)
c64.CHROUT('\n')
}
}