add load-cart function
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmFme7YACgkQO3+8IhRO Y5gtxw//Yz3EXn0QXCYqMNR6yt6DjO5mhYJv38kBL0QANic98z4TRTPU/hb+TzJ9 H04h7FC1oN3Ys/eV7sAxeQQHhrCnMo4ChNroR68anHAhw0wgXj5CqGulHq6GOwR/ IP6McRFoQLwEW91x24xULieTmYK4JURv05xZU7k3vjbKToexV5UeMIbnBqPxg4xJ 5zut0NPkwAmfYPI5hhLa6fE+Dy2GKduDIMMuRJmKcs3UHwTDeVADWXZfBmYPK6nm 2X5CjvCedvrliPY+ZA1H1KYrDCPVktlBr8kCkwmuWy/E3Rm9EMm+xOMOC1MIw6qR H/mgG8isSIoZ5Eg3kmww2849/DLR54ko2akaGlB0d6IafwtVMP7nvJ1sfwd8urry 5ZEuTZajlDDEXgo5BVG4G1CHgHcmEkaj+BaaTt5MCnO5XQfB3z2MVQdaspQwbFL5 2qmF6yHNexkFQdlJwAJ0Qq+nY+cmqtdRKrKdz3zn9T4oTYHVtuFFUlq1M2tfvqOM JUR+p5JG8KNaHW8pgbrNMI4WIQYutyKwgKs3IdVlBLHj3N15De9LlMqCxgw6v9Hy XckuKXlRva13cmarnrquCoQxUacj0uAfETCPLe2+tkINPbGI8GcbpX8QffuWUb4k Q5o6hZ8Gi2xn9NLjk8Y3SGX6wiZd3q9bqKlKn68CRlQ8uImOVoQ= =UP4p -----END PGP SIGNATURE-----
1 files changed,
55 insertions(+),
4 deletions(-)
jump to
M
uxn-client/xrxs.tal
→
uxn-client/xrxs.tal
@@ -58,7 +58,6 @@ @sb-pos $1
@sb-step $1 @cart $32 -@realm $32 ( program )@@ -223,7 +222,6 @@ ;draw-pointer JSR2
POP BRK &state6 POP - BRK @clear-screen ( -> )@@ -725,7 +723,7 @@ .Controller/button DEI #01 NEQ ,&check-b-button JCN
( A on yes ) .btn-state LDZ #01 NEQ ,&a-on-no JCN ;capture-input JSR2 - #06 .state STZ + ;load-cart JSR2 BRK &a-on-no .btn-state LDZ #00 NEQ ,&no-action JCN@@ -774,7 +772,7 @@ #04 .state STZ
BRK &state-load ;capture-input JSR2 - #06 .state STZ + ;load-cart JSR2 &no-click BRK@@ -836,6 +834,54 @@ #0010 ADD2 ,&while-no JMP &end-no POP2 POP2
RTN +@load-cart ( -> ) + &lines #00 + &chars #00 + + .list-len LDZ2 #0000 &while EQU2k ,&end JCN + ( find the cartridge that matches our select-index ) + DUP ;list-buf ADD2 LDA + #0a NEQ ,&no-newline JCN + ,&lines LDR INC ,&lines STR + &no-newline + ,&lines LDR .select-index LDZ NEQ ,&while JCN + DUP2 + ( store characters for this cartridge ) + #20 #00 &getchar EQU2k ,&end-getchar JCN + STHk SWP2 ;list-buf ADD2 LDA + DUP #00 EQU ,&name-copied JCN + SWP .cart ADD STZ + ,&chars LDR INC ,&chars STR + STHr + INC ,&getchar JMP &end-getchar POP2 + INC ,&while JMP &end POP2 POP2 RTN + + ( append the null byte and clear the stacks ) + &name-copied + #00 .cart ,&chars LDR INC ADD STZ + POPr POP2 POP2 POP2 + + ( append the cartridge name to the load command ) + ;load-cmd #0005 ADD2 + ,&chars LDR #00 &compose-cmd EQUk ,&compose-done JCN + TOS SWP2 ADD2k ROT2 TOB + DUP STH .cart ADD LDZ + TOS SWP2 STA POP + ROT STHr + INC ,&compose-cmd JMP &compose-done POP2 POP2 + + ( send it! ) + #0020 .File/length DEO2 + #0001 .File/offset-ls DEO2 + ;ctl-file .File/name DEO2 + ;load-cmd .File/save DEO2 + + #0000 .File/offset-ls DEO2 + ;slot-file .File/name DEO2 + LIT 0000 .File/load DEO2 + LIT 0100 JMP2 +RTN + @capture-input ( -> ) ;no-instr .Mouse/vector DEO2@@ -849,8 +895,13 @@ ( constants )
@spritesheet "xrxs.chr 00 @fontsheet "zz.chr 00 @carts-file "n/carts 00 +@slot-file "n/slot 00 +@ctl-file "n/ctl 00 + @title-loadCart "Select 20 "A 20 "Cartridge 00 @title-confirmCart "Load 20 "This 20 "Cartridge? 00 + +@load-cmd "load 20 $32 ( sprites ) @blank $16