trying to list cartridges, fixed an errant MAX_USERS where it wasn't welcome
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmExA9YACgkQO3+8IhRO Y5jX1hAAlgqCiYWq6froAv4qzCaQKUaOyrAk2tMgJ2KYBHk20poCx/UvGcZ0UtS+ 5BMmc8S14k6GR7rL689CS9A9iunYMP1ywR+bf5/rtbyvGhqCf7/grX5P/T3tGAUB 3ZP2wKayjrxSHck7XL6lN7S9LUAlY/HHkD26PdqdCin18HQULXb2+pv5O80kTfyH uQssmzZrHezZJgxTAqMywnqszGndrIlb1viK6c7KPnQITfFmwa1htsmh9+pc/4SD YriNsmIl6P/X1xGPZ6vVt1pu7LppeSrAX8xaubcA1uie4NVj9adHt2RN0BJFf6K/ mP5DmqX500Wb/jSwTb9WJHUWIPzivyJTWs7UtXrjCoCzPFhnYAeUkoDTusHz+fXh NQyTwpso+xRC/MQxLF8tBKUjL8sRmOIg1RnGcmf6vx7vVDp1/ZV0lHYiFXn69uDQ 99HhQqQ/+el/hnrj9UW0TGw7xn/fG7PCZBTcbIuv3myhVe+sRb7VnHSZUIb93Gz8 J/V9lgpB7nNU0kCBJzbHasjAsnxerEKhud7DHPxUl0cTlhmXgNaHwncqOISQSM6O KSR/4RmWp3BWikwT6+DXYdyHUixD42jGqtKZ44xPnUmV6AhwZvDhXakeSpDb6DzE Wc71DYOJDMw9foRlHgsRu1Cu5u0m/sGFspvK7QBMqLJzz2aQjck= =0uze -----END PGP SIGNATURE-----
5 files changed,
93 insertions(+),
14 deletions(-)
M
server/universe.h
→
server/universe.h
@@ -4,7 +4,7 @@ typedef struct Atom Atom;
struct Atom { char name[16]; - char value[MAX_USERS]; + char value[64]; Atom* next; };
A
uxn-client/build.sh
@@ -0,0 +1,5 @@
+#!/bin/sh + +rm xrxs.rom 2>/dev/null +uxnasm xrxs.tal xrxs.rom +uxnemu xrxs.rom
A
uxn-client/cart_select_notes.md
@@ -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 )
M
uxn-client/xrxs.tal
→
uxn-client/xrxs.tal
@@ -29,7 +29,7 @@ |50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|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 )@@ -44,6 +44,9 @@ @logo-coords [
&x $2 &y $2 ] + +@list-offset $1 +@list-elem $32 @cart $32 @realm $32@@ -58,20 +61,23 @@ #02c1 .System/r DEO2
#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 @@ ;draw-uxn-logo JSR2
;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 @@ [ ;title-loadCart
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 @@ .Screen/y DEO2 ( set y )
.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 @@ SWP2 SUB2
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 @@ @xrxslogo $128
@pointer_icn [ 80c0 e0f0 f8e0 1000 ] @font $768 +( big data ) +@listbuf $8192 +