prog8/testsource/calls.ill
2017-12-25 23:54:10 +01:00

128 lines
2.3 KiB
Plaintext

; call tests
;output
~ foo {
var .word var1 = 99
memory .word mem1 = $cff0
var .byte varb1 = 99
memory .byte memb1 = $cff0
const .word constw = $2355
const .byte constb = $23
const .float constf = 3.4556677
const .text constt = "derp"
sub sub1 () -> (X?) = $ffdd
sub sub2 (A) -> (Y?) = $eecc
sub sub3 (XY) -> (Y?) = $ddaa
sub sub4 (string: XY, other : A) -> (Y?) = $dd22
bar
goto sub1
goto sub2 (1 )
goto sub3 (3)
goto sub3 (XY="hello")
goto sub3 ("hello, there")
goto sub4 (string="hello, there", other = 42)
goto sub4 ("hello", 42)
goto sub4 ("hello", other= 42)
goto sub4 (string="hello", other = 42)
goto bar ()
goto [AX]
goto [AX] ()
goto [var1]
goto [var1] () ; comment
goto [mem1] ; comment
goto [mem1] ()
goto [$c2.word]
goto [$c2.word] ()
goto [$c2dd.word]
goto [$c2dd.word] ( )
goto $c000
goto $c000 ( )
goto $c2
goto $c2()
asm {
nop
nop
nop
nop
}
sub1!()
sub2!(11)
sub3 !(3)
sub3! (XY="hello")
sub3! ("hello, there")
sub4! ("hello", 42)
sub4! ("hello", other=42)
sub4! (string="hello", other = 42)
sub4! (string="hello, there", other = 42)
bar!()
[XY] ! ()
[var1] !()
[mem1]!()
[$c2.word]!()
[$c2dd.word]!()
$c000!()
$c2!()
asm {
nop
nop
nop
nop
}
sub1()
sub2(11)
sub3 (3)
sub3 (XY="hello")
sub3 ("hello, there")
sub4 ("hello", 42)
sub4 ("hello", other= 42)
sub4 (string="hello", other = 42)
sub4 (string="hello, there", other = 42)
bar ()
[AX]()
[var1] ( )
[mem1] ()
[$c2.word]()
[$c2dd.word]()
$c000()
$c2()
asm {
nop
nop
nop
nop
}
constw()
sub1()
main.start()
}
~ main {
start
foo.bar()
return
sub unused_sub ()->() {
A=X
X=Y
Y=A
return
}
}