mirror of
https://github.com/irmen/prog8.git
synced 2024-10-16 18:23:59 +00:00
89 lines
1.7 KiB
Lua
89 lines
1.7 KiB
Lua
%import textio
|
|
%import string
|
|
%import test_stack
|
|
|
|
main {
|
|
|
|
ubyte[23] savedata
|
|
ubyte[17] cargohold = 0
|
|
uword filenameptr = $c000
|
|
|
|
sub start() {
|
|
test_stack.test()
|
|
|
|
uword @shared uw
|
|
ubyte @shared ub
|
|
word @shared ww
|
|
|
|
; push(127)
|
|
; pop(ub)
|
|
; txt.print_ub(ub)
|
|
; txt.nl()
|
|
; pushw(32767)
|
|
; popw(uw)
|
|
; txt.print_uw(uw)
|
|
; txt.nl()
|
|
|
|
uw=10000
|
|
routines(44,uw+123)
|
|
routines2(44,uw+123)
|
|
|
|
routine(uw+123, 22,33, true, 44)
|
|
routine2(uw+123, 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()
|
|
}
|
|
|
|
sub routines(ubyte bb, uword num) {
|
|
txt.print_ub(bb)
|
|
txt.spc()
|
|
txt.print_uw(num)
|
|
txt.nl()
|
|
}
|
|
|
|
asmsub routine2(uword num @AY, ubyte a1 @R1, ubyte a2 @R2, ubyte switch @Pc, ubyte a3 @X) {
|
|
%asm {{
|
|
pha
|
|
lda #0
|
|
adc #0
|
|
sta routine.switch
|
|
pla
|
|
sta routine.num
|
|
sty routine.num+1
|
|
lda cx16.r1
|
|
sta routine.a1
|
|
lda cx16.r2
|
|
sta routine.a2
|
|
stx routine.a3
|
|
jmp routine
|
|
}}
|
|
}
|
|
|
|
asmsub routines2(ubyte bb @X, uword num @AY) {
|
|
%asm {{
|
|
sta routines.num
|
|
sty routines.num+1
|
|
stx routines.bb
|
|
jmp routines
|
|
}}
|
|
}
|
|
|
|
}
|