2023-02-19 02:07:55 +00:00
|
|
|
%import floats
|
|
|
|
%import textio
|
|
|
|
%option no_sysinit
|
2023-02-09 20:53:35 +00:00
|
|
|
%zeropage basicsafe
|
|
|
|
|
2022-10-22 11:33:35 +00:00
|
|
|
main {
|
2022-11-28 22:07:07 +00:00
|
|
|
|
2023-02-19 02:07:55 +00:00
|
|
|
uword b_wordvar
|
2023-02-20 23:26:21 +00:00
|
|
|
uword b_initwordvar = 12345
|
|
|
|
ubyte b_bb =123
|
2023-02-19 02:07:55 +00:00
|
|
|
float b_fl
|
|
|
|
ubyte[10] b_emptyarray
|
|
|
|
ubyte[10] b_filledarray = [1,2,3,4,5,6,7,8,9,10]
|
|
|
|
float[3] b_floatarray
|
|
|
|
uword[3] b_wordarray
|
2023-02-03 23:02:50 +00:00
|
|
|
|
2022-11-29 23:15:13 +00:00
|
|
|
sub start() {
|
2023-02-19 02:07:55 +00:00
|
|
|
uword wordvar
|
2023-02-19 23:17:06 +00:00
|
|
|
uword initwordvar = 12345
|
2023-02-19 02:07:55 +00:00
|
|
|
float fl
|
|
|
|
ubyte bb =123
|
|
|
|
ubyte[10] emptyarray
|
|
|
|
ubyte[10] filledarray = [1,2,3,4,5,6,7,8,9,10]
|
|
|
|
float[3] floatarray
|
|
|
|
uword[3] wordarray
|
2023-02-19 17:12:37 +00:00
|
|
|
uword slab1 = memory("slab1",400, 0)
|
|
|
|
uword slab2 = memory("slab2",200, $1000)
|
2023-02-19 02:07:55 +00:00
|
|
|
|
|
|
|
txt.print("**subroutine scope**\n")
|
2023-02-19 23:17:06 +00:00
|
|
|
txt.print("init wordvar=")
|
|
|
|
txt.print_uw(initwordvar)
|
|
|
|
txt.print("\ninit bb=")
|
|
|
|
txt.print_ub(bb)
|
|
|
|
txt.print("\nuninit wordvar=")
|
2023-02-19 02:07:55 +00:00
|
|
|
txt.print_uw(wordvar)
|
|
|
|
txt.print("\nuninit float=")
|
|
|
|
floats.print_f(fl)
|
|
|
|
txt.print("\nuninit emptyarray[2]=")
|
|
|
|
txt.print_ub(emptyarray[2])
|
|
|
|
txt.print("\nuninit wordarray[2]=")
|
|
|
|
txt.print_uw(wordarray[2])
|
|
|
|
txt.print("\nuninit floatarray[2]=")
|
|
|
|
floats.print_f(floatarray[2])
|
|
|
|
txt.print("\ninit filledarray[2]=")
|
|
|
|
txt.print_ub(filledarray[2])
|
|
|
|
|
|
|
|
txt.print("\n**block scope**\n")
|
2023-02-19 23:17:06 +00:00
|
|
|
txt.print("init wordvar=")
|
|
|
|
txt.print_uw(b_initwordvar)
|
|
|
|
txt.print("\ninit b_bb=")
|
|
|
|
txt.print_ub(b_bb)
|
|
|
|
txt.print("\nuninit b_wordvar=")
|
2023-02-19 02:07:55 +00:00
|
|
|
txt.print_uw(b_wordvar)
|
|
|
|
txt.print("\nuninit b_float=")
|
|
|
|
floats.print_f(b_fl)
|
|
|
|
txt.print("\nuninit b_emptyarray[2]=")
|
|
|
|
txt.print_ub(b_emptyarray[2])
|
|
|
|
txt.print("\nuninit b_wordarray[2]=")
|
|
|
|
txt.print_uw(b_wordarray[2])
|
|
|
|
txt.print("\nuninit b_floatarray[2]=")
|
|
|
|
floats.print_f(b_floatarray[2])
|
|
|
|
txt.print("\ninit b_filledarray[2]=")
|
|
|
|
txt.print_ub(b_filledarray[2])
|
|
|
|
|
|
|
|
txt.print("\n\nadding 42 to all values.\n")
|
|
|
|
wordvar += 42
|
|
|
|
bb += 42
|
|
|
|
fl += 42.42
|
|
|
|
floatarray[2] += 42.42
|
|
|
|
wordarray[2] += 42
|
|
|
|
emptyarray[2] += 42
|
|
|
|
filledarray[2] += 42
|
|
|
|
b_wordvar += 42
|
|
|
|
b_bb += 42
|
|
|
|
b_fl += 42.42
|
|
|
|
b_floatarray[2] += 42.42
|
|
|
|
b_wordarray[2] += 42
|
|
|
|
b_emptyarray[2] += 42
|
|
|
|
b_filledarray[2] += 42
|
|
|
|
|
|
|
|
txt.print("\n**subroutine scope**\n")
|
|
|
|
txt.print("uninit wordvar=")
|
|
|
|
txt.print_uw(wordvar)
|
|
|
|
txt.print("\nuninit float=")
|
|
|
|
floats.print_f(fl)
|
|
|
|
txt.print("\ninit bb=")
|
|
|
|
txt.print_ub(bb)
|
|
|
|
txt.print("\nuninit emptyarray[2]=")
|
|
|
|
txt.print_ub(emptyarray[2])
|
|
|
|
txt.print("\nuninit wordarray[2]=")
|
|
|
|
txt.print_uw(wordarray[2])
|
|
|
|
txt.print("\nuninit floatarray[2]=")
|
|
|
|
floats.print_f(floatarray[2])
|
|
|
|
txt.print("\ninit filledarray[2]=")
|
|
|
|
txt.print_ub(filledarray[2])
|
|
|
|
|
|
|
|
txt.print("\n**block scope**\n")
|
|
|
|
txt.print("uninit b_wordvar=")
|
|
|
|
txt.print_uw(b_wordvar)
|
|
|
|
txt.print("\nuninit b_float=")
|
|
|
|
floats.print_f(b_fl)
|
|
|
|
txt.print("\ninit b_bb=")
|
|
|
|
txt.print_ub(b_bb)
|
|
|
|
txt.print("\nuninit b_emptyarray[2]=")
|
|
|
|
txt.print_ub(b_emptyarray[2])
|
|
|
|
txt.print("\nuninit b_wordarray[2]=")
|
|
|
|
txt.print_uw(b_wordarray[2])
|
|
|
|
txt.print("\nuninit b_floatarray[2]=")
|
|
|
|
floats.print_f(b_floatarray[2])
|
|
|
|
txt.print("\ninit b_filledarray[2]=")
|
|
|
|
txt.print_ub(b_filledarray[2])
|
|
|
|
|
|
|
|
txt.print("\n\nrun again to see effect of re-init.\n")
|
2023-02-19 17:12:37 +00:00
|
|
|
txt.print_uwhex(slab1, true)
|
|
|
|
txt.nl()
|
|
|
|
txt.print_uwhex(slab2, true)
|
|
|
|
txt.nl()
|
2022-12-04 15:02:58 +00:00
|
|
|
}
|
|
|
|
}
|