2024-10-13 19:37:25 +02:00
|
|
|
%import textio
|
2024-10-18 20:53:30 +02:00
|
|
|
%import floats
|
2024-10-13 19:37:25 +02:00
|
|
|
%option no_sysinit
|
|
|
|
%zeropage basicsafe
|
|
|
|
|
2024-10-18 22:22:34 +02:00
|
|
|
|
2024-10-07 19:17:37 +02:00
|
|
|
main {
|
2024-10-16 18:36:19 +02:00
|
|
|
sub start() {
|
2024-10-18 22:22:34 +02:00
|
|
|
uword res1 = allocate(111)
|
2024-10-19 15:34:04 +02:00
|
|
|
defer deallocate(res1)
|
2024-10-18 22:22:34 +02:00
|
|
|
uword res2 = allocate(222)
|
|
|
|
if res2==0
|
2024-10-19 15:34:04 +02:00
|
|
|
return
|
|
|
|
defer deallocate(res2)
|
2024-10-18 01:29:51 +02:00
|
|
|
|
2024-10-18 22:22:34 +02:00
|
|
|
if not process1(res1, res2)
|
2024-10-19 15:34:04 +02:00
|
|
|
return
|
2024-10-18 22:22:34 +02:00
|
|
|
if not process2(res1, res2)
|
2024-10-19 15:34:04 +02:00
|
|
|
return
|
2024-10-18 22:22:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
sub allocate(uword arg) -> uword {
|
2024-10-21 00:22:42 +02:00
|
|
|
; 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 01:29:51 +02:00
|
|
|
|
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 01:29:51 +02:00
|
|
|
}
|
|
|
|
|
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
|
2024-10-13 04:20:57 +02:00
|
|
|
}
|
2024-09-14 23:17:26 +02:00
|
|
|
}
|