carts be listed :)

This commit is contained in:
Iris Lightshard 2021-09-10 14:23:20 -06:00
parent c586296139
commit b75de746ed
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

View file

@ -45,9 +45,12 @@
&y $2 &y $2
] ]
@list-len $2
@list-offset $1 @list-offset $1
@list-elem-offset $32
@list-elem $32 @list-elem $32
@cart $32 @cart $32
@realm $32 @realm $32
@ -104,20 +107,20 @@ BRK
( draw uxn logo ) ( draw uxn logo )
DUP #00 NEQ ,&state1 JCN DUP #00 NEQ ,&state1 JCN
;draw-uxn-logo JSR2 ;draw-uxn-logo JSR2
#01 ADD .state STZ INC .state STZ
BRK BRK
( draw first syllable of xrxs logo ) ( draw first syllable of xrxs logo )
&state1 DUP #01 NEQ ,&state2 JCN &state1 DUP #01 NEQ ,&state2 JCN
;draw-xrxs-logo-xr JSR2 ;draw-xrxs-logo-xr JSR2
#01 ADD .state STZ INC .state STZ
BRK BRK
( draw second syllable of xrxs logo ) ( draw second syllable of xrxs logo )
&state2 DUP #02 NEQ ,&state3 JCN &state2 DUP #02 NEQ ,&state3 JCN
;draw-xrxs-logo-xs JSR2 ;draw-xrxs-logo-xs JSR2
#01 ADD .state STZ INC .state STZ
BRK BRK
( clear screen ) ( clear screen )
@ -135,7 +138,8 @@ BRK
;cartlist .File/name DEO2 ;cartlist .File/name DEO2
#2000 .File/length DEO2 #2000 .File/length DEO2
;listbuf .File/load DEO2 ;listbuf .File/load DEO2
#01 ADD .state STZ BRK .File/success DEI2 .list-len STZ2
INC .state STZ BRK
&keep-state POP &keep-state POP
BRK BRK
@ -278,7 +282,7 @@ RTN
RTN RTN
( come up with a more elegant way to draw these that doesn't cause a stack underflow ) ( come up with a more elegant way to draw these )
@draw-bl-scanlines ( -> ) @draw-bl-scanlines ( -> )
CENTER-Y ,&y STR2 CENTER-Y ,&y STR2
@ -372,8 +376,8 @@ RTN
&loop &loop
LDAk DUP #00 NEQ #20 MUL SUB TOS 8** ;font ADD2 .Screen/addr DEO2 LDAk DUP #00 NEQ #20 MUL SUB TOS 8** ;font ADD2 .Screen/addr DEO2
STHkr .Screen/sprite DEO STHkr .Screen/sprite DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 INC-X
#0001 ADD2 INC2
LDAk #00 NEQ ,&loop JCN LDAk #00 NEQ ,&loop JCN
POP2 POP2
POPr POPr
@ -394,7 +398,7 @@ RTN
DUP2 DUP2
&loop &loop
#0001 ADD2 LDAk ,&loop JCN INC2 LDAk ,&loop JCN
SWP2 SUB2 SWP2 SUB2
RTN RTN
@ -404,26 +408,37 @@ RTN
#0040 .Screen/x DEO2 #0040 .Screen/x DEO2
#0028 .Screen/y DEO2 #0028 .Screen/y DEO2
&lines $1 #01 .list-offset STZ
,&lines #00 STZ .list-len LDZ2 #0000 &while EQU2k ,&end JCN
( get a character from the list )
DUP2 ;listbuf ADD2 LDA
#2000 #0000 &while EQU2k ,&end JCN ( if null byte, terminate loop )
DUP2 ;listbuf ADD2 LDA ( get a character from the list ) DUP #00 EQU ,&end JCN
DUP #00 NEQ ,&terminate JCN
DUP #0a NEQk ,&no-inc-line JCN ( if not newline, store the character and increment the offsets )
[ ( char ) DUP #0a EQU ,&inc-line JCN
#00 .list-elem-offset LDZ ;word ADD2 STA
.list-elem-offset LDZ INC .list-elem-offset STZ
,&continue JMP ( continue looping )
( if newline, print the word, increment x, reset y )
( clear the word and word offsets, increment the buffer offset )
&inc-line
#00 .list-elem-offset LDZ ;word ADD2 STA
[ ;word
.Screen/x DEI2 .Screen/x DEI2
.Screen/y DEI2 .Screen/y DEI2
#02 ] ;draw-char JSR2 #02 ] ;draw-string JSR2
,&lines LDR INC ,&lines STR
INC-Y
#0040 .Screen/x DEO2 #0040 .Screen/x DEO2
&no-inc-line INC-X INC-Y
OVR EQU ,&no-store-char JCN
OVR2 ;list-elem ADD2k OVR2 NIP2 NIP STZk #20 #00 &word_clr EQUk ,&end-clr JCN
&no-store-char #00 OVR SWP DUP ROT ;word ADD2 STA
INC2 ,&while JMP &end POP2 POP2 RTN INC ,&word_clr JMP &end-clr POP2
&terminate POP2 POP2 POP2 #00 .list-elem-offset STZ
&continue INC2 ,&while JMP
&end POP2 POP2
RTN RTN
( constants ) ( constants )
@ -434,11 +449,15 @@ RTN
( sprites ) ( sprites )
@blank $16 @blank $16
@uxnlogo $128 @uxnlogo $256
@xrxslogo $128 @xrxslogo $256
@pointer_icn [ 80c0 e0f0 f8e0 1000 ] @pointer_icn [ 80c0 e0f0 f8e0 1000 ]
@font $768 @font $768
( big data ) ( big data )
@word [ #0000 #0000 #0000 #0000
#0000 #0000 #0000 #0000
#0000 #0000 #0000 #0000
#0000 #0000 #0000 #0000 ]
@listbuf $8192 @listbuf $8192