all repos — xrxs @ 8788fbef7966786c378f6720dae08784dcf1b313

experimental networked application/game server with 9p

add buttons to confirm whether to load cartrige, with kb and mouse control
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmFjABgACgkQO3+8IhRO
Y5iTXQ//cY0Ha7+J3pj+8MJT+QkKDiJ4BqU1DhKAgXDdewYVsDiur7n72p+U68Fh
LdLmMSaWCudwHJ76UKFXFp3mBs8cLW1fvuvrWOAXBhpGApeSFiy8TjV0upDVHwFE
UH0t0Lf7T5zRFIl6G73UXXNC4YFPQw2DIToh69QlY6tbka8PkBLl579/FKbp5lb/
TR6AQ2gj8cXssGVBZ2ZmOQ6NVcX0/HovgFpgT4obW0z2UdxNWkOci9GqfzvYYf2T
0rskhz02ikPxYNaiTJ1zsqsCWiJESsfsyTqhRg85t4hJa5G1Jid7xKmvF4iy7bZG
xZ29ACL8xC5B3fIaA3Nfx1O8rQdMrOhyQWx433lLryuXryWqKIRTtm1DnXIwACbu
UZLRki0IL8Nhm4ykEhjOZumlYs+WU8l8Z8cfzb2Jo9AZzJ6n/zdfVrKkdlL3T/vR
Qp1HJadpf4kFCRU7Ek7t4rwbodDkXBOMjl4qHqzZxlj13mLFtZVhJiKAFZjW5tEM
DIf8QB3oxc238VS5iQ7rGoif/9ND8Tvqp6h7B7kgQCyiO8NkkI8EMtskGQO/LCsQ
zvcPuLEEgSiKzFXJxA7iHSQyV9vJ4UUi4sYrqztz7Y0yYgWnzWXZHyzORy9P97HI
gqlAeVrCzuBsXH+KCWmRobP21uvYMLldTeq+lg9z+3UJGiiXfzY=
=nbeV
-----END PGP SIGNATURE-----
commit

8788fbef7966786c378f6720dae08784dcf1b313

parent

507980f61f79311eddd76b599c331a7d22eca889

2 files changed, 221 insertions(+), 17 deletions(-)

jump to
M uxn-client/xrxs.taluxn-client/xrxs.tal

@@ -52,6 +52,7 @@ @list-top $1

@list-height $1 @select-index $1 @ncarts $1 +@btn-state $1 @cart $32 @realm $32

@@ -66,15 +67,28 @@ #02c1 .System/r DEO2

#02cd .System/g DEO2 #02cb .System/b DEO2 - ( load uxn and xrxs logos from main spritesheet ) + ( load individual sprites from the main sheet ) ;spritesheet .File/name DEO2 #0100 .File/length DEO2 #0000 .File/offset-ls DEO2 - ;uxnlogo .File/load DEO2 + ;uxn-logo .File/load DEO2 #0200 .File/offset-ls DEO2 - ;xrxslogo .File/load DEO2 + ;xrxs-logo .File/load DEO2 + + #00c0 .File/length DEO2 + #0400 .File/offset-ls DEO2 + ;yes-btn .File/load DEO2 + + #04c0 .File/offset-ls DEO2 + ;yes-btn-active .File/load DEO2 + + #0600 .File/offset-ls DEO2 + ;no-btn .File/load DEO2 + + #06c0 .File/offset-ls DEO2 + ;no-btn-active .File/load DEO2 ( load zz font ) ;fontsheet .File/name DEO2

@@ -85,7 +99,9 @@

( initialize state ) #00 .ticker STZ #00 .state STZ + #00 .select-index STZ #20 .anim-speed STZ + #ff .btn-state STZ GET-USABLE-HEIGHT .list-height STZ CENTER-X .logo-coords/x STZ2

@@ -138,9 +154,9 @@ ;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 + ;carts-file .File/name DEO2 #2000 .File/length DEO2 - ;listbuf .File/load DEO2 + ;list-buf .File/load DEO2 .File/success DEI2 .list-len STZ2 INC .state STZ ;get-select-idx-by-mouse .Mouse/vector DEO2

@@ -166,7 +182,27 @@ ;render-cart-list JSR2

;draw-pointer JSR2 POP BRK - &state5 POP + + ( confirm the selected cartridge ) + &state5 DUP #05 NEQ ,&state6 JCN + ;draw-gray-borders JSR2 + ;draw-bl-scanlines JSR2 + ;draw-tl-scanlines JSR2 + ;draw-tr-scanlines JSR2 + ;draw-br-scanlines JSR2 + ;draw-uxn-logo JSR2 + ;draw-xrxs-logo-xr JSR2 + ;draw-xrxs-logo-xs JSR2 + [ ;title-confirmCart + CENTER-X OVR2 ;strlen JSR2 #20 SFT2 SUB2 + #0010 + #02 ] ;draw-string JSR2 + ;render-cart-list JSR2 + ;draw-confirm-buttons JSR2 + ;draw-pointer JSR2 + POP + BRK + &state6 POP BRK @clear-screen ( -> )

@@ -205,7 +241,7 @@ .logo-coords/x LDZ2 #0020 SUB2 .Screen/x DEO2

.logo-coords/y LDZ2 #0010 SUB2 .Screen/y DEO2 #0100 #0000 &while EQU2k ,&end JCN - DUP2 ;uxnlogo ADD2 .Screen/addr DEO2 + DUP2 ;uxn-logo ADD2 .Screen/addr DEO2 #c1 .Screen/sprite DEO INC-X NEXT-TILE #0030 AND2 #0000 NEQ2 ,&no-inc-y JCN

@@ -222,7 +258,7 @@ .logo-coords/x LDZ2 .Screen/x DEO2

.logo-coords/y LDZ2 #0010 SUB2 .Screen/y DEO2 #0080 #0000 &while EQU2k ,&end JCN - DUP2 ;xrxslogo ADD2 .Screen/addr DEO2 + DUP2 ;xrxs-logo ADD2 .Screen/addr DEO2 #c1 .Screen/sprite DEO INC-X NEXT-TILE #0030 AND2 #0000 NEQ2 ,&no-inc-y JCN

@@ -239,7 +275,7 @@ .logo-coords/x LDZ2 .Screen/x DEO2

.logo-coords/y LDZ2 .Screen/y DEO2 #0100 #0080 &while EQU2k ,&end JCN - DUP2 ;xrxslogo ADD2 .Screen/addr DEO2 + DUP2 ;xrxs-logo ADD2 .Screen/addr DEO2 #c1 .Screen/sprite DEO INC-X NEXT-TILE #0030 AND2 #0000 NEQ2 ,&no-inc-y JCN

@@ -362,7 +398,7 @@

@draw-pointer ( -> ) - ;pointer_icn .Screen/addr DEO2 + ;cursor .Screen/addr DEO2 .Mouse/x DEI2 .Screen/x DEO2 .Mouse/y DEI2 .Screen/y DEO2

@@ -439,7 +475,7 @@

#00 .list-offset STZ .list-len LDZ2 #0000 &while EQU2k ,&end JCN ( get a character from the list ) - DUP2 ;listbuf ADD2 LDA + DUP2 ;list-buf ADD2 LDA ( if null byte, terminate loop ) DUP #00 EQU ,&end JCN

@@ -495,6 +531,13 @@ .Mouse/y DEI2 #0028 LTH2 ,&done JCN

.Mouse/y DEI2 .Screen/height DEI2 #0028 SUB2 GTH2 ,&done JCN .Mouse/y DEI2 #0028 SUB2 8// TOB .list-top LDZ ADD .select-index STZ + + .Mouse/state DEI #00 EQU ,&no-click JCN + .select-index LDZ .ncarts GTH ,&no-click JCN + .state LDZ INC .state STZ + ;set-button-state-by-key .Controller/vector DEO2 + ;set-button-state-by-mouse .Mouse/vector DEO2 + &no-click BRK &done

@@ -528,21 +571,182 @@ ,&no-down JMP

&no-inc POP &no-down - + + DUP #01 NEQ ,&no-a-btn JCN + .state LDZ INC .state STZ + ;set-button-state-by-key .Controller/vector DEO2 + ;set-button-state-by-mouse .Mouse/vector DEO2 + &no-a-btn POP BRK +@set-button-state-by-key ( -> ) + + .btn-state LDZ #ff EQU ,&from-null JCN + .btn-state LDZ #00 EQU ,&from-no JCN + + ( from yes ) + .Controller/button DEI #80 NEQ ,&check-action JCN + #00 .btn-state STZ + BRK + + &from-no + .Controller/button DEI #40 NEQ ,&check-action JCN + #01 .btn-state STZ + BRK + + &from-null + ( in from left ) + .Controller/button DEI #80 NEQ ,&in-from-right JCN + #01 .btn-state STZ + BRK + &in-from-right + .Controller/button DEI #40 NEQ ,&check-action JCN + #00 .btn-state STZ + BRK + + &check-action + .Controller/button DEI #00 EQU ,&no-action JCN + ( check A button ) + .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 + BRK + &a-on-no + .btn-state LDZ #00 NEQ ,&no-action JCN + ;get-select-idx-by-mouse .Mouse/vector DEO2 + ;get-select-idx-by-key .Controller/vector DEO2 + #04 .state STZ + BRK + + &check-b-button + .Controller/button DEI #02 NEQ ,&no-action + ;get-select-idx-by-mouse .Mouse/vector DEO2 + ;get-select-idx-by-key .Controller/vector DEO2 + #04 .state STZ + &no-action +BRK + +@set-button-state-by-mouse ( -> ) + + ( if not in the vertical range of the buttons, quit early ) + .Mouse/y DEI2 .Screen/height DEI2 #001c SUB2 LTH2 ,&not-no JCN + .Mouse/y DEI2 .Screen/height DEI2 #000c SUB2 GTH2 ,&not-no JCN + + + .Mouse/x DEI2 CENTER-X #0030 SUB2 LTH2 ,&not-yes JCN + .Mouse/x DEI2 CENTER-X GTH2 ,&not-yes JCN + #01 .btn-state STZ + ,&check-click JMP + + &not-yes + + .Mouse/x DEI2 CENTER-X LTH2 ,&not-no JCN + .Mouse/x DEI2 CENTER-X #0030 ADD2 GTH2 ,&not-no JCN + #00 .btn-state STZ + ,&check-click JMP + + &not-no + #ff .btn-state STZ BRK + + &check-click + .Mouse/state DEI #00 EQU ,&no-click JCN + .btn-state LDZ #00 NEQ ,&state-load JCN + ;get-select-idx-by-mouse .Mouse/vector DEO2 + ;get-select-idx-by-key .Controller/vector DEO2 + #04 .state STZ + BRK + &state-load + ;capture-input JSR2 + #06 .state STZ + &no-click + +BRK + +@button-color ( bit -- sprite ) + + ,&get-color-yes JCN + + ( get color no ) + .btn-state LDZ #ff EQU ,&no-inactive JCN + .btn-state LDZ #01 EQU ,&no-inactive JCN + ( active ) + ;no-btn-active RTN + + &no-inactive + ;no-btn RTN + + + &get-color-yes + .btn-state LDZ #ff EQU ,&yes-inactive JCN + .btn-state LDZ #00 EQU ,&yes-inactive JCN + ( active ) + ;yes-btn-active RTN + + &yes-inactive + ;yes-btn + +RTN + +@draw-confirm-buttons ( -> ) + + ( yes ) + .Screen/height DEI2 #001c SUB2 .Screen/y DEO2 + CENTER-X #0030 SUB2 .Screen/x DEO2 + + #00c0 #0000 &while-yes EQU2k ,&end-yes JCN + DUP2 [ #01 ;button-color JSR2 ] ADD2 .Screen/addr DEO2 + #81 .Screen/sprite DEO INC-X + + NEXT-TILE #0060 NEQ2 ,&no-inc-y JCN + CENTER-X #0030 SUB2 .Screen/x DEO2 + INC-Y + &no-inc-y + #0010 ADD2 ,&while-yes JMP &end-yes POP2 POP2 + + ( no ) + .Screen/height DEI2 #001c SUB2 .Screen/y DEO2 + CENTER-X .Screen/x DEO2 + + #00c0 #0000 &while-no EQU2k ,&end-no JCN + DUP2 [ #00 ;button-color JSR2 ] ADD2 .Screen/addr DEO2 + #81 .Screen/sprite DEO INC-X + + NEXT-TILE #0060 NEQ2 ,&no-inc-y-no JCN + CENTER-X .Screen/x DEO2 + INC-Y + &no-inc-y-no + #0010 ADD2 ,&while-no JMP &end-no POP2 POP2 + +RTN + +@capture-input ( -> ) + + ;no-instr .Mouse/vector DEO2 + ;no-instr .Controller/vector DEO2 + +RTN + +@no-instr BRK + ( constants ) @spritesheet "xrxs.chr 00 @fontsheet "zz.chr 00 -@cartlist "n/carts 00 +@carts-file "n/carts 00 @title-loadCart "Select 20 "A 20 "Cartridge 00 +@title-confirmCart "Load 20 "This 20 "Cartridge? 00 ( sprites ) @blank $16 -@uxnlogo $256 -@xrxslogo $256 -@pointer_icn [ 80c0 e0f0 f8e0 1000 ] +@uxn-logo $256 +@xrxs-logo $256 +@yes-btn $192 +@no-btn $192 +@yes-btn-active $192 +@no-btn-active $192 +@cursor [ 80c0 e0f0 f8e0 1000 ] @font $768 ( big data )

@@ -550,5 +754,5 @@ @word [ #0000 #0000 #0000 #0000

#0000 #0000 #0000 #0000 #0000 #0000 #0000 #0000 #0000 #0000 #0000 #0000 ] -@listbuf $8192 +@list-buf $8192