parent
c2ad0ad08c
commit
ed5de3aaa1
@ -0,0 +1,32 @@
|
||||
a = 0
|
||||
b = 0
|
||||
c = 0
|
||||
|
||||
a = 1
|
||||
GOSUB sub1
|
||||
c = c * 2
|
||||
a = 2
|
||||
GOTO end_loop
|
||||
|
||||
sub1:
|
||||
b = 1
|
||||
GOSUB sub2
|
||||
b = b * 2
|
||||
|
||||
RETURN
|
||||
b = 5
|
||||
END
|
||||
|
||||
end_loop:
|
||||
IF a == 2 AND b == 2 AND c == 2 THEN
|
||||
PRINT "success"
|
||||
ELSE
|
||||
PRINT "fail: ", a, ", ", b, ", ", c
|
||||
END IF
|
||||
PRINT_FLUSH(message1)
|
||||
GOTO end_loop
|
||||
|
||||
sub2:
|
||||
c = 1
|
||||
RETURN
|
||||
c = 5
|
@ -0,0 +1,25 @@
|
||||
a = 0
|
||||
b = 0
|
||||
c = 0
|
||||
|
||||
GOSUB sub
|
||||
|
||||
b = 1
|
||||
c = 1
|
||||
|
||||
GOTO trap
|
||||
|
||||
END
|
||||
sub:
|
||||
a = 1
|
||||
RETURN
|
||||
a = 2
|
||||
|
||||
trap:
|
||||
IF a == 1 AND b == 1 AND c == 1 THEN
|
||||
PRINT "success"
|
||||
ELSE
|
||||
PRINT "fail: ", a, ", ", b, ", ", c
|
||||
END IF
|
||||
PRINT_FLUSH(message1)
|
||||
GOTO trap
|
@ -0,0 +1,51 @@
|
||||
set __gosub_retaddr 0
|
||||
set a 0
|
||||
set b 0
|
||||
set c 0
|
||||
op mul __gosub_retaddr __gosub_retaddr 1000
|
||||
op add __gosub_retaddr __gosub_retaddr @counter
|
||||
jump sub always 0 0
|
||||
main__label_0_return__phantom:
|
||||
set b 1
|
||||
set c 1
|
||||
jump trap always 0 0
|
||||
end
|
||||
sub:
|
||||
set a 1
|
||||
op mod __return __gosub_retaddr 1000
|
||||
op idiv __gosub_retaddr __gosub_retaddr 1000
|
||||
op add @counter __return 1
|
||||
set a 2
|
||||
trap:
|
||||
set main__tmp_5 a
|
||||
set main__tmp_6 1
|
||||
op equal main__tmp_3 main__tmp_5 main__tmp_6
|
||||
set main__tmp_7 b
|
||||
set main__tmp_8 1
|
||||
op equal main__tmp_4 main__tmp_7 main__tmp_8
|
||||
op and main__tmp_1 main__tmp_3 main__tmp_4
|
||||
set main__tmp_9 c
|
||||
set main__tmp_10 1
|
||||
op equal main__tmp_2 main__tmp_9 main__tmp_10
|
||||
op and main__tmp_0 main__tmp_1 main__tmp_2
|
||||
jump main__label_1_else notEqual main__tmp_0 true
|
||||
set main__tmp_11 "success"
|
||||
print main__tmp_11
|
||||
jump main__label_2_endif always 0 0
|
||||
main__label_1_else:
|
||||
set main__tmp_12 "fail: "
|
||||
print main__tmp_12
|
||||
set main__tmp_13 a
|
||||
print main__tmp_13
|
||||
set main__tmp_14 ", "
|
||||
print main__tmp_14
|
||||
set main__tmp_15 b
|
||||
print main__tmp_15
|
||||
set main__tmp_16 ", "
|
||||
print main__tmp_16
|
||||
set main__tmp_17 c
|
||||
print main__tmp_17
|
||||
main__label_2_endif:
|
||||
set main__tmp_18 message1
|
||||
printflush main__tmp_18
|
||||
jump trap always 0 0
|
@ -0,0 +1,37 @@
|
||||
set __gosub_retaddr 0
|
||||
set a 0
|
||||
set b 0
|
||||
set c 0
|
||||
op mul __gosub_retaddr __gosub_retaddr 1000
|
||||
op add __gosub_retaddr __gosub_retaddr @counter
|
||||
jump sub always 0 0
|
||||
main__label_0_return__phantom:
|
||||
set b 1
|
||||
set c 1
|
||||
jump trap always 0 0
|
||||
end
|
||||
sub:
|
||||
set a 1
|
||||
op mod __return __gosub_retaddr 1000
|
||||
op idiv __gosub_retaddr __gosub_retaddr 1000
|
||||
op add @counter __return 1
|
||||
set a 2
|
||||
trap:
|
||||
op equal main__tmp_3 a 1
|
||||
op equal main__tmp_4 b 1
|
||||
op and main__tmp_1 main__tmp_3 main__tmp_4
|
||||
op equal main__tmp_2 c 1
|
||||
op and main__tmp_0 main__tmp_1 main__tmp_2
|
||||
jump main__label_1_else notEqual main__tmp_0 true
|
||||
print "success"
|
||||
jump main__label_2_endif always 0 0
|
||||
main__label_1_else:
|
||||
print "fail: "
|
||||
print a
|
||||
print ", "
|
||||
print b
|
||||
print ", "
|
||||
print c
|
||||
main__label_2_endif:
|
||||
printflush message1
|
||||
jump trap always 0 0
|
Loading…
Reference in new issue