prog8/examples/test.p8
2021-11-27 23:52:47 +01:00

51 lines
1.0 KiB
Lua

%import textio
%import test_stack
main {
sub start() {
test_stack.test()
uword @shared uw
uw= 0
routine(uw+11, 22,33, true, 44)
routine2(uw+11, 22,33, true, 44)
test_stack.test()
repeat {
}
}
sub routine(uword num, ubyte a1, ubyte a2, ubyte switch, byte a3) {
txt.print_uw(num)
txt.spc()
txt.print_ub(a1)
txt.spc()
txt.print_ub(a2)
txt.spc()
txt.print_ub(switch)
txt.spc()
txt.print_b(a3)
txt.nl()
}
; TODO make switch R3 use Pc instead and make that work !
asmsub routine2(uword num @AY, ubyte a1 @R1, ubyte a2 @R2, ubyte switch @R3, ubyte a3 @X) {
%asm {{
sta routine.num
sty routine.num+1
lda cx16.r1
sta routine.a1
lda cx16.r2
sta routine.a2
lda cx16.r3
sta routine.switch
stx routine.a3
jmp routine
}}
}
}