2024-10-27 20:50:48 +00:00
|
|
|
%import textio
|
2024-11-05 22:56:58 +00:00
|
|
|
%option no_sysinit
|
2024-11-08 18:43:59 +00:00
|
|
|
%zeropage basicsafe
|
|
|
|
|
|
|
|
; INIT ONCE tests
|
2024-10-18 20:22:34 +00:00
|
|
|
|
2024-11-04 03:28:27 +00:00
|
|
|
main {
|
2024-11-04 23:15:40 +00:00
|
|
|
sub start() {
|
2024-10-21 23:08:21 +00:00
|
|
|
uword w0
|
|
|
|
uword @initonce w1
|
|
|
|
uword @initonce w2
|
|
|
|
uword @initonce w3
|
|
|
|
uword @initonce w4 = 12345
|
|
|
|
uword[4] wa
|
|
|
|
uword[] @shared wb = [1111,2222,3333,4444]
|
|
|
|
|
|
|
|
dump()
|
2024-11-07 21:17:23 +00:00
|
|
|
txt.nl()
|
2024-10-21 23:08:21 +00:00
|
|
|
w0++
|
|
|
|
w1++
|
|
|
|
w2++
|
|
|
|
w3++
|
|
|
|
w4++
|
|
|
|
wa[1]++
|
|
|
|
wa[2]++
|
|
|
|
wa[3]++
|
|
|
|
wb[0]++
|
|
|
|
dump()
|
2024-11-04 23:15:40 +00:00
|
|
|
txt.nl()
|
2024-10-21 23:08:21 +00:00
|
|
|
|
2024-11-08 18:43:59 +00:00
|
|
|
repeat 10 {
|
|
|
|
footgun()
|
|
|
|
}
|
|
|
|
txt.nl()
|
|
|
|
|
2024-10-21 23:08:21 +00:00
|
|
|
sub dump() {
|
|
|
|
txt.print_uw(w0)
|
|
|
|
txt.spc()
|
|
|
|
txt.print_uw(w1)
|
|
|
|
txt.spc()
|
|
|
|
txt.print_uw(w2)
|
|
|
|
txt.spc()
|
|
|
|
txt.print_uw(w3)
|
|
|
|
txt.spc()
|
|
|
|
txt.print_uw(w4)
|
|
|
|
txt.spc()
|
|
|
|
txt.print_uw(wa[1])
|
|
|
|
txt.spc()
|
|
|
|
txt.print_uw(wa[2])
|
|
|
|
txt.spc()
|
|
|
|
txt.print_uw(wa[3])
|
|
|
|
txt.spc()
|
|
|
|
txt.print_uw(wb[0])
|
|
|
|
txt.nl()
|
|
|
|
}
|
2024-11-04 22:26:21 +00:00
|
|
|
}
|
2024-11-08 18:43:59 +00:00
|
|
|
|
|
|
|
sub footgun() {
|
|
|
|
; TODO should just be a nonlocal variable outside of the subroutine...?
|
|
|
|
ubyte @shared @initonce @requirezp variable = 42 ; BUG: is never initialized now
|
|
|
|
txt.print_ub(variable)
|
|
|
|
txt.spc()
|
|
|
|
variable++
|
|
|
|
}
|
2024-11-05 22:56:58 +00:00
|
|
|
}
|