mirror of
https://github.com/irmen/prog8.git
synced 2024-11-04 19:05:57 +00:00
140 lines
2.7 KiB
Plaintext
140 lines
2.7 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 $c000
|
|
goto [$c000.word]
|
|
goto [var1]
|
|
goto [mem1]
|
|
goto var1 ; jumps to the address in var1
|
|
goto mem1 ; jumps to the address in mem1
|
|
goto #var1 ; strange, but jumps to the location in memory where var1 sits
|
|
goto #mem1 ; strange, but jumps to the location in mempory where mem1 sits (points to)
|
|
|
|
; ----
|
|
|
|
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
|
|
}
|
|
|
|
}
|