trying to list cartridges, fixed an errant MAX_USERS where it wasn't welcome

This commit is contained in:
Iris Lightshard 2021-09-02 11:03:18 -06:00
parent 11bfceb327
commit c586296139
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
5 changed files with 93 additions and 14 deletions

View file

@ -4,7 +4,7 @@ typedef struct Atom Atom;
struct Atom {
char name[16];
char value[MAX_USERS];
char value[64];
Atom* next;
};

5
uxn-client/build.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
rm xrxs.rom 2>/dev/null
uxnasm xrxs.tal xrxs.rom
uxnemu xrxs.rom

View file

@ -0,0 +1,18 @@
# how to render lists
1. start at top of list area
2. seek until ;list-offset \n have been read
3. drawstr until \n (if y index is hihglihgt index, draw highlighted)
4. increment y and reset x
5. if y > height/8 - 80, break
# how to highlight list elements
1. if .Mouse/x > 64 && < width - 64 && .Mouse/y > 40 && < height - 40
2. index = ((.Mouse/y - 40)/8) + ;list-offset
# on click
1. take highlight index
2. seek listbuf until as many \n have been read
3. read until next \n into loadcmdbuf + len(load )

6
uxn-client/n/carts Normal file
View file

@ -0,0 +1,6 @@
nasu
dexe
noodle
orca
left

View file

@ -29,7 +29,7 @@
|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2 ]
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
( variables )
@ -45,6 +45,9 @@
&y $2
]
@list-offset $1
@list-elem $32
@cart $32
@realm $32
@ -58,20 +61,23 @@
#02cd .System/g DEO2
#02cb .System/b DEO2
( load uxn and xrxs logos from main spritesheet )
;spritesheet .File/name DEO2
#0100 .File/length DEO2
#0000 .File/offset DEO2
#0000 .File/offset-ls DEO2
;uxnlogo .File/load DEO2
#0200 .File/offset DEO2
#0200 .File/offset-ls DEO2
;xrxslogo .File/load DEO2
( load zz font )
;fontsheet .File/name DEO2
#0000 .File/offset DEO2
#0000 .File/offset-ls DEO2
#0300 .File/length DEO2
;font .File/load DEO2
( initialize state )
#00 .ticker STZ
#00 .state STZ
#20 .anim-speed STZ
@ -126,11 +132,14 @@ BRK
;draw-xrxs-logo-xr JSR2
;draw-xrxs-logo-xs JSR2
.logo-coords/x LDZ2 #0020 GTH2 ,&keep-state JCN
;cartlist .File/name DEO2
#2000 .File/length DEO2
;listbuf .File/load DEO2
#01 ADD .state STZ BRK
&keep-state POP
BRK
( render the logo and window decorations )
( render the cartridge list interface )
&state4 DUP #04 NEQ ,&state5 JCN
;draw-gray-borders JSR2
;draw-bl-scanlines JSR2
@ -144,6 +153,7 @@ BRK
CENTER-X OVR2 ;strlen JSR2 #20 SFT2 SUB2
#0010
#02 ] ;draw-string JSR2
;render-cart-list JSR2
;draw-pointer JSR2
POP
BRK
@ -359,17 +369,27 @@ RTN
.Screen/x DEO2 ( set x )
( now the string address is at the top of the stack )
&loop
LDAk DUP #00 NEQ #20 MUL SUB TOS 8** ;font ADD2 .Screen/addr DEO2
STHkr .Screen/sprite DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
#0001 ADD2
LDAk #00 NEQ ,&loop JCN
POP2
POPr
&loop
LDAk DUP #00 NEQ #20 MUL SUB TOS 8** ;font ADD2 .Screen/addr DEO2
STHkr .Screen/sprite DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
#0001 ADD2
LDAk #00 NEQ ,&loop JCN
POP2
POPr
RTN
@draw-char ( char x y color -- )
STH ( save color )
.Screen/y DEO2 ( set y )
.Screen/x DEO2 ( set x )
#20 MUL SUB TOS 8** ;font ADD2 .Screen/addr DEO2
STHr .Screen/sprite DEO
RTN
@strlen ( addr -- len )
DUP2
@ -379,6 +399,33 @@ RTN
RTN
@render-cart-list ( -> )
#0040 .Screen/x DEO2
#0028 .Screen/y DEO2
&lines $1
,&lines #00 STZ
#2000 #0000 &while EQU2k ,&end JCN
DUP2 ;listbuf ADD2 LDA ( get a character from the list )
DUP #00 NEQ ,&terminate JCN
DUP #0a NEQk ,&no-inc-line JCN
[ ( char )
.Screen/x DEI2
.Screen/y DEI2
#02 ] ;draw-char JSR2
,&lines LDR INC ,&lines STR
INC-Y
#0040 .Screen/x DEO2
&no-inc-line INC-X
OVR EQU ,&no-store-char JCN
OVR2 ;list-elem ADD2k OVR2 NIP2 NIP STZk
&no-store-char
INC2 ,&while JMP &end POP2 POP2 RTN
&terminate POP2 POP2 POP2
RTN
( constants )
@spritesheet "xrxs.chr 00
@fontsheet "zz.chr 00
@ -392,3 +439,6 @@ RTN
@pointer_icn [ 80c0 e0f0 f8e0 1000 ]
@font $768
( big data )
@listbuf $8192