add load-cart function
This commit is contained in:
parent
07d3de4c49
commit
eb6236b389
1 changed files with 55 additions and 4 deletions
|
@ -58,7 +58,6 @@
|
|||
@sb-step $1
|
||||
|
||||
@cart $32
|
||||
@realm $32
|
||||
|
||||
( program )
|
||||
|
||||
|
@ -223,7 +222,6 @@ BRK
|
|||
POP
|
||||
BRK
|
||||
&state6 POP
|
||||
|
||||
BRK
|
||||
|
||||
@clear-screen ( -> )
|
||||
|
@ -725,7 +723,7 @@ BRK
|
|||
( 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 @@ BRK
|
|||
BRK
|
||||
&state-load
|
||||
;capture-input JSR2
|
||||
#06 .state STZ
|
||||
;load-cart JSR2
|
||||
&no-click
|
||||
|
||||
BRK
|
||||
|
@ -836,6 +834,54 @@ RTN
|
|||
|
||||
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,9 +895,14 @@ RTN
|
|||
@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
|
||||
@uxn-logo $256
|
||||
|
|
Loading…
Reference in a new issue