2017-12-21 13:52:30 +00:00
|
|
|
; call tests
|
|
|
|
|
|
|
|
~ foo {
|
|
|
|
|
2018-01-05 21:52:23 +00:00
|
|
|
|
|
|
|
|
2017-12-21 13:52:30 +00:00
|
|
|
var .word var1 = 99
|
|
|
|
memory .word mem1 = $cff0
|
|
|
|
|
|
|
|
var .byte varb1 = 99
|
|
|
|
memory .byte memb1 = $cff0
|
2017-12-21 21:16:46 +00:00
|
|
|
const .word constw = $2355
|
|
|
|
const .byte constb = $23
|
2017-12-23 00:53:48 +00:00
|
|
|
const .float constf = 3.4556677
|
2018-04-03 14:40:24 +00:00
|
|
|
const .str constt = "derp"
|
2017-12-21 21:16:46 +00:00
|
|
|
|
2017-12-24 23:15:04 +00:00
|
|
|
sub sub1 () -> (X?) = $ffdd
|
|
|
|
sub sub2 (A) -> (Y?) = $eecc
|
2017-12-25 21:22:19 +00:00
|
|
|
sub sub3 (XY) -> (Y?) = $ddaa
|
|
|
|
sub sub4 (string: XY, other : A) -> (Y?) = $dd22
|
2017-12-21 21:16:46 +00:00
|
|
|
|
2018-01-05 21:52:23 +00:00
|
|
|
bar2:
|
2017-12-21 13:52:30 +00:00
|
|
|
|
2018-01-05 21:52:23 +00:00
|
|
|
bar: goto $c000
|
|
|
|
goto var1 ; jumps to the address in var1
|
|
|
|
goto mem1 ; jumps to the address in mem1
|
|
|
|
goto [var1]
|
2017-12-28 18:08:33 +00:00
|
|
|
goto [$c000.word]
|
|
|
|
goto [var1]
|
|
|
|
goto [mem1]
|
|
|
|
|
|
|
|
; ----
|
|
|
|
|
2017-12-23 13:36:23 +00:00
|
|
|
goto sub1
|
2018-01-05 21:52:23 +00:00
|
|
|
return sub2 (1 )
|
|
|
|
return sub3 (3)
|
2018-01-21 17:17:39 +00:00
|
|
|
return sub3 ("hello")
|
2018-01-05 21:52:23 +00:00
|
|
|
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 ()
|
2017-12-23 13:36:23 +00:00
|
|
|
goto [AX]
|
|
|
|
goto [var1]
|
2018-01-05 21:52:23 +00:00
|
|
|
goto [mem1] ; comment
|
2018-01-11 23:55:47 +00:00
|
|
|
goto $c000
|
|
|
|
goto 64738
|
2018-01-13 22:49:57 +00:00
|
|
|
64738(1,2) ; @todo should be jsr $64738
|
|
|
|
return 9999() ; @todo should be jmp 9999 ?
|
2018-01-05 21:52:23 +00:00
|
|
|
return [AX]()
|
|
|
|
return [var1] () ; comment
|
|
|
|
return [mem1] ()
|
2017-12-23 13:36:23 +00:00
|
|
|
goto $c000
|
2018-01-05 21:52:23 +00:00
|
|
|
return $c000 ( )
|
2017-12-23 13:36:23 +00:00
|
|
|
goto $c2
|
2018-01-05 21:52:23 +00:00
|
|
|
return $c2()
|
|
|
|
goto [$c2.word]
|
|
|
|
return 33
|
2018-01-13 22:49:57 +00:00
|
|
|
return [$c2.word]
|
2018-01-05 21:52:23 +00:00
|
|
|
return [$c2.word] (4)
|
|
|
|
return [$c2.word] (4)
|
|
|
|
return [$c2.word] (4)
|
|
|
|
return [$c2.word] (4)
|
2018-01-13 22:49:57 +00:00
|
|
|
return [$c2dd.word] ( )
|
2018-01-05 21:52:23 +00:00
|
|
|
goto [$c2dd.word]
|
2017-12-21 13:52:30 +00:00
|
|
|
|
2018-01-01 22:24:39 +00:00
|
|
|
%asm {
|
2017-12-21 13:52:30 +00:00
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
}
|
|
|
|
|
2017-12-23 13:36:23 +00:00
|
|
|
sub1!()
|
|
|
|
sub2!(11)
|
2017-12-25 21:22:19 +00:00
|
|
|
sub3 !(3)
|
2018-01-21 17:17:39 +00:00
|
|
|
sub3! ("hello")
|
2017-12-25 21:22:19 +00:00
|
|
|
sub3! ("hello, there")
|
|
|
|
sub4! ("hello", 42)
|
|
|
|
sub4! ("hello", other=42)
|
|
|
|
sub4! (string="hello", other = 42)
|
|
|
|
sub4! (string="hello, there", other = 42)
|
2018-01-01 22:24:39 +00:00
|
|
|
|
|
|
|
sub3 (81)
|
|
|
|
sub3 !(81)
|
|
|
|
sub3 !A (81)
|
|
|
|
sub3 !X (81)
|
|
|
|
sub3 !Y (81)
|
|
|
|
sub3 !XY (81)
|
|
|
|
sub3 !AXY (81)
|
|
|
|
|
2017-12-23 13:36:23 +00:00
|
|
|
bar!()
|
2018-01-05 21:52:23 +00:00
|
|
|
bar !()
|
|
|
|
[XY]! ()
|
2017-12-23 13:36:23 +00:00
|
|
|
[XY] ! ()
|
2018-01-05 21:52:23 +00:00
|
|
|
[var1]!()
|
2017-12-23 13:36:23 +00:00
|
|
|
[mem1]!()
|
|
|
|
[$c2.word]!()
|
|
|
|
[$c2dd.word]!()
|
|
|
|
$c000!()
|
|
|
|
$c2!()
|
2017-12-21 13:52:30 +00:00
|
|
|
|
2018-01-01 22:24:39 +00:00
|
|
|
%asm {
|
2017-12-21 13:52:30 +00:00
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
}
|
|
|
|
|
2017-12-23 13:36:23 +00:00
|
|
|
sub1()
|
|
|
|
sub2(11)
|
2017-12-25 21:22:19 +00:00
|
|
|
sub3 (3)
|
2018-01-21 17:17:39 +00:00
|
|
|
sub3 ("hello")
|
2017-12-25 21:22:19 +00:00
|
|
|
sub3 ("hello, there")
|
|
|
|
sub4 ("hello", 42)
|
|
|
|
sub4 ("hello", other= 42)
|
|
|
|
sub4 (string="hello", other = 42)
|
|
|
|
sub4 (string="hello, there", other = 42)
|
2017-12-23 13:36:23 +00:00
|
|
|
bar ()
|
|
|
|
[AX]()
|
|
|
|
[var1] ( )
|
|
|
|
[mem1] ()
|
2018-01-13 22:49:57 +00:00
|
|
|
A= [$c2.word]
|
|
|
|
A= [$c2dd.word ]
|
2017-12-23 13:36:23 +00:00
|
|
|
$c000()
|
|
|
|
$c2()
|
2017-12-21 21:16:46 +00:00
|
|
|
|
|
|
|
|
2018-01-01 22:24:39 +00:00
|
|
|
%asm {
|
2017-12-21 22:05:35 +00:00
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
}
|
|
|
|
|
2017-12-23 13:36:23 +00:00
|
|
|
constw()
|
|
|
|
sub1()
|
|
|
|
main.start()
|
2018-01-14 23:20:36 +00:00
|
|
|
return
|
|
|
|
|
2017-12-21 13:52:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
~ main {
|
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
start:
|
2017-12-23 13:36:23 +00:00
|
|
|
foo.bar()
|
2017-12-21 13:52:30 +00:00
|
|
|
return
|
2017-12-25 18:09:10 +00:00
|
|
|
|
|
|
|
sub unused_sub ()->() {
|
|
|
|
A=X
|
|
|
|
X=Y
|
|
|
|
Y=A
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-01-05 21:52:23 +00:00
|
|
|
|
2017-12-21 13:52:30 +00:00
|
|
|
}
|