prog8/testsource/calls.ill
Irmen de Jong 0e785fcfb3 new docs
2018-08-06 03:35:43 +02:00

160 lines
3.0 KiB
Plaintext

; call tests
~ 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 str constt = "derp"
sub sub1 () -> (X?) = $ffdd
sub sub2 (A) -> (Y?) = $eecc
sub sub3 (XY) -> (Y?) = $ddaa
sub sub4 (string: XY, other : A) -> (Y?) = $dd22
bar2:
bar: goto $c000
goto var1 ; jumps to the address in var1
goto mem1 ; jumps to the address in mem1
goto [var1]
goto [$c000.word]
goto [var1]
goto [mem1]
; ----
goto sub1
return sub2 (1 )
return sub3 (3)
return sub3 ("hello")
return sub3 ("hello, there")
return sub4 (string="hello, there", other = 42)
return sub4 ("hello", 42)
return sub4 ("hello", other= 42)
return sub4 (string="hello", other = 42)
return bar ()
goto [AX]
goto [var1]
goto [mem1] ; comment
goto $c000
goto 64738
64738(1,2) ; @todo should be jsr $64738
return 9999() ; @todo should be jmp 9999 ?
return [AX]()
return [var1] () ; comment
return [mem1] ()
goto $c000
return $c000 ( )
goto $c2
return $c2()
goto [$c2.word]
return 33
return [$c2.word]
return [$c2.word] (4)
return [$c2.word] (4)
return [$c2.word] (4)
return [$c2.word] (4)
return [$c2dd.word] ( )
goto [$c2dd.word]
%asm {
nop
nop
nop
nop
}
sub1!()
sub2!(11)
sub3 !(3)
sub3! ("hello")
sub3! ("hello, there")
sub4! ("hello", 42)
sub4! ("hello", other=42)
sub4! (string="hello", other = 42)
sub4! (string="hello, there", other = 42)
sub3 (81)
sub3 !(81)
sub3 !A (81)
sub3 !X (81)
sub3 !Y (81)
sub3 !XY (81)
sub3 !AXY (81)
bar!()
bar !()
[XY]! ()
[XY] ! ()
[var1]!()
[mem1]!()
[$c2.word]!()
[$c2dd.word]!()
$c000!()
$c2!()
%asm {
nop
nop
nop
nop
}
sub1()
sub2(11)
sub3 (3)
sub3 ("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] ()
A= [$c2.word]
A= [$c2dd.word ]
$c000()
$c2()
%asm {
nop
nop
nop
nop
}
constw()
sub1()
main.start()
return
}
~ main {
start:
foo.bar()
return
sub unused_sub ()->() {
A=X
X=Y
Y=A
return
}
}