prog8/examples/test.p8

55 lines
1.1 KiB
Plaintext
Raw Normal View History

%import textio
%import floats
%option no_sysinit
%zeropage basicsafe
2024-10-18 22:22:34 +02:00
main {
sub start() {
2024-10-18 22:22:34 +02:00
uword res1 = allocate(111)
defer deallocate(res1)
2024-10-18 22:22:34 +02:00
uword res2 = allocate(222)
if res2==0
return
defer deallocate(res2)
2024-10-18 22:22:34 +02:00
if not process1(res1, res2)
return
2024-10-18 22:22:34 +02:00
if not process2(res1, res2)
return
2024-10-18 22:22:34 +02:00
}
sub allocate(uword arg) -> uword {
; if arg==222
; return 0
txt.print("allocate ")
txt.print_uw(4000+arg)
txt.nl()
2024-10-18 22:22:34 +02:00
return 4000+arg
}
sub deallocate(uword arg) {
txt.print("dealloc ")
txt.print_uw(arg)
txt.nl()
}
2024-10-18 22:22:34 +02:00
sub process1(uword arg1, uword arg2) -> bool {
txt.print("process1 ")
txt.print_uw(arg1)
txt.spc()
txt.print_uw(arg2)
txt.nl()
return true
}
2024-10-18 22:22:34 +02:00
sub process2(uword arg1, uword arg2) -> bool {
txt.print("process2 ")
txt.print_uw(arg1)
txt.spc()
txt.print_uw(arg2)
txt.nl()
return true
}
}