mirror of
https://github.com/irmen/prog8.git
synced 2024-11-26 11:49:22 +00:00
38ef394e15
Note that something similar, such as putting those variables inline in the program initialized with their value and all, cannot be done for the 6502 codegen: the program needs a mechanism to reset ALL variables when it runs a second time.
40 lines
971 B
Lua
40 lines
971 B
Lua
%import textio
|
|
%option no_sysinit
|
|
%zeropage basicsafe
|
|
|
|
main {
|
|
|
|
bool[] barray = [true, false, true, false]
|
|
uword[] warray = [&value1, &barray, &value5, 4242]
|
|
|
|
ubyte @shared integer = 99
|
|
bool @shared value1
|
|
bool @shared value2 = barray[2] ; should be const!
|
|
bool @shared value3 = true
|
|
bool @shared value4 = false
|
|
bool @shared value5 = barray[cx16.r0L] ; cannot be const
|
|
uword @shared value6 = warray[3] ; should be const!
|
|
uword @shared value7 = warray[2] ; cannot be const
|
|
|
|
sub start() {
|
|
txt.print_ub(integer)
|
|
integer++
|
|
txt.spc()
|
|
txt.print_ub(integer)
|
|
txt.nl()
|
|
|
|
txt.print_bool(value1)
|
|
txt.spc()
|
|
txt.print_bool(value2)
|
|
txt.spc()
|
|
txt.print_bool(value3)
|
|
txt.spc()
|
|
txt.print_bool(value4)
|
|
txt.spc()
|
|
txt.print_bool(value5)
|
|
txt.spc()
|
|
txt.print_uw(value6)
|
|
txt.nl()
|
|
}
|
|
}
|