2021-11-27 22:52:47 +00:00
|
|
|
%import textio
|
2021-11-28 01:49:18 +00:00
|
|
|
%import string
|
2021-11-27 17:09:15 +00:00
|
|
|
%import test_stack
|
2021-10-27 21:48:02 +00:00
|
|
|
|
2021-10-30 13:15:11 +00:00
|
|
|
main {
|
2021-11-06 18:09:33 +00:00
|
|
|
|
2021-11-28 01:34:53 +00:00
|
|
|
ubyte[23] savedata
|
|
|
|
ubyte[17] cargohold = 0
|
2021-11-28 01:49:18 +00:00
|
|
|
uword filenameptr = $c000
|
2021-11-28 01:34:53 +00:00
|
|
|
|
2021-11-09 23:17:56 +00:00
|
|
|
sub start() {
|
2021-11-27 17:09:15 +00:00
|
|
|
test_stack.test()
|
|
|
|
|
2021-11-28 01:49:18 +00:00
|
|
|
c64.SETNAM(string.length(filenameptr), filenameptr)
|
|
|
|
|
2021-11-28 01:34:53 +00:00
|
|
|
sys.memcopy(&savedata + 2, cargohold, len(cargohold))
|
|
|
|
sys.memcopy(cargohold, &savedata + 2, len(cargohold))
|
|
|
|
|
|
|
|
; 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)
|
2021-11-27 17:09:15 +00:00
|
|
|
|
|
|
|
test_stack.test()
|
2021-11-20 23:07:17 +00:00
|
|
|
|
|
|
|
repeat {
|
|
|
|
}
|
2021-11-27 13:08:34 +00:00
|
|
|
|
2021-11-16 22:52:30 +00:00
|
|
|
}
|
2021-11-21 11:34:57 +00:00
|
|
|
|
2021-11-27 22:52:47 +00:00
|
|
|
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()
|
2021-11-27 20:22:34 +00:00
|
|
|
}
|
|
|
|
|
2021-11-28 00:22:40 +00:00
|
|
|
sub routines(ubyte bb, uword num) {
|
|
|
|
txt.print_ub(bb)
|
|
|
|
txt.spc()
|
|
|
|
txt.print_uw(num)
|
|
|
|
txt.nl()
|
|
|
|
}
|
|
|
|
|
2021-11-27 22:52:47 +00:00
|
|
|
; 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) {
|
2021-11-21 22:21:39 +00:00
|
|
|
%asm {{
|
2021-11-27 22:52:47 +00:00
|
|
|
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
|
2021-11-21 22:21:39 +00:00
|
|
|
}}
|
2021-11-21 15:23:48 +00:00
|
|
|
}
|
2021-11-21 22:21:39 +00:00
|
|
|
|
2021-11-28 00:22:40 +00:00
|
|
|
asmsub routines2(ubyte bb @X, uword num @AY) {
|
|
|
|
%asm {{
|
|
|
|
sta routines.num
|
|
|
|
sty routines.num+1
|
|
|
|
stx routines.bb
|
|
|
|
jmp routines
|
|
|
|
}}
|
|
|
|
}
|
|
|
|
|
2021-05-12 22:35:22 +00:00
|
|
|
}
|