add cursor, font drawing, custom font
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmEpvMQACgkQO3+8IhRO Y5hOSxAAiczhxr3oNYHgWmDgDkNW9KjKGvacA86O4YT2lKm2C3wpykUoL319dCwm 1R6kJ5XrfF/3drLh+2vs+2nmAtekCSAw+QX8oYsENSHFgagMuxPAwbTDKSHYygTN ymEswdCQAF7YhB3rIuTzn56ExjpbefMmKPqKWFCjPsVa1m9PHL+cmtF6GM+T+clY G8DLGQ0ULLww7/w9HvN3g9P7K5Wic/pOCsmyik2i8GINAyHolnWWeFpDJF05oBuc xTTSG+EjHpFrde+NHvi91eDTylqd+nfo2xSMHTLhbXU6MLsq/WtmhqQ1LJZlEOHh iOam98EY01grO7lLRpwI0774aw6/+WSwpOZ7UZp5DbtUAv77CtALTdLCUaIKL2dz WJUXLeFXXZn2cyK3yj5pbMzufdwmVWoA2WIviJobtdopyKh6BautDU9A/NHwEo+x if4s1byGwI5wo8hqDZyRhL39FoY85VKSPoiYNV4OwHOGCOF+insCtC8OecTkZzYB 8WJgvqp9eSk8Hx4faum1Vguajq9EL1yuiAvR52vF61610GkZG9vUlcj24ZtFsbjF Afr0FAO1m6HUhFvfOhcLnBubjUNa8uC7RiLl1K1RXIn5UFVyFGPDLDDD2ON2edXx trZxhCkUA7RURzpa1D5sw5S4EtTnmGyWu9rgjEuSUh0/3bcZ8X4= =uQH1 -----END PGP SIGNATURE-----
3 files changed,
79 insertions(+),
4 deletions(-)
A
uxn-client/mkfont.sh
@@ -0,0 +1,15 @@
+#!/bin/sh + +rm $2 + +offset=0; +keep=1; +while [ ${offset} -lt 1536 ]; do + if [ ${keep} -eq 1 ]; then + head -c $((offset + 8)) $1 | tail -c 8 >> $2 + keep=0 + else + keep=1 + fi + offset=$((offset + 8)) +done
M
uxn-client/xrxs.tal
→
uxn-client/xrxs.tal
@@ -9,6 +9,11 @@
%MOD { DIVk MUL SUB } %MOD2 { DIV2k MUL2 SUB2 } +%2** { #10 SFT2 } %2// { #01 SFT2 } +%8** { #30 SFT2 } %8// { #03 SFT2 } +%TOS { #00 SWP } %TOB { SWP POP } + + %NEXT-TILE { DUP2 #0010 ADD2 } %RTN { JMP2r }@@ -62,6 +67,11 @@
#0200 .File/offset DEO2 ;xrxslogo .File/load DEO2 + ;fontsheet .File/name DEO2 + #0000 .File/offset DEO2 + #0300 .File/length DEO2 + ;font .File/load DEO2 + #00 .ticker STZ #00 .state STZ #20 .anim-speed STZ@@ -74,6 +84,7 @@
BRK @on-frame ( -> ) + .ticker LDZ #01 ADD DUP .anim-speed LDZ EQU ,&next-render JCN@@ -129,6 +140,11 @@ ;draw-br-scanlines JSR2
;draw-uxn-logo JSR2 ;draw-xrxs-logo-xr JSR2 ;draw-xrxs-logo-xs JSR2 + [ ;title-loadCart + CENTER-X OVR2 ;strlen JSR2 #20 SFT2 SUB2 + #0010 + #02 ] ;draw-string JSR2 + ;draw-pointer JSR2 POP BRK &state5 POP@@ -259,7 +275,7 @@ CENTER-Y ,&y STR2
#0008 ,&x STR2 &whileld - ,&y LDR2 CENTER-Y SUB2 #0010 DIV2 DUP2 ADD2 #0008 ADD2 ,&x STR2 + ,&y LDR2 CENTER-Y SUB2 #04 SFT2 DUP2 ADD2 #0008 ADD2 ,&x STR2 .Screen/height DEI2 #0028 SUB2 ,&y LDR2 LTH2 ,&endld JCN &dlscan #0040 ,&x LDR2 EQU2 ,&enddlscan JCN ,&x LDR2 .Screen/x DEO2@@ -276,7 +292,7 @@ #0028 ,&y STR2
#0008 ,&x STR2 &whilelu - CENTER-Y ,&y LDR2 SUB2 #0010 DIV2 DUP2 ADD2 #0008 ADD2 ,&x STR2 + CENTER-Y ,&y LDR2 SUB2 #04 SFT2 DUP2 ADD2 #0008 ADD2 ,&x STR2 CENTER-Y ,&y LDR2 LTH2 ,&endlu JCN &ulscan #0040 ,&x LDR2 EQU2 ,&endulscan JCN ,&x LDR2 .Screen/x DEO2@@ -296,7 +312,7 @@
&whilerd .Screen/width DEI2 #0040 SUB2 ,&x STR2 .Screen/height DEI2 #0028 SUB2 ,&y LDR2 LTH2 ,&endrd JCN - &drscan .Screen/width DEI2 #0008 SUB2 ,&y LDR2 CENTER-Y SUB2 #0010 DIV2 DUP2 ADD2 SUB2 ,&x LDR2 EQU2 ,&enddrscan JCN + &drscan .Screen/width DEI2 #0008 SUB2 ,&y LDR2 CENTER-Y SUB2 #04 SFT2 DUP2 ADD2 SUB2 ,&x LDR2 EQU2 ,&enddrscan JCN ,&x LDR2 .Screen/x DEO2 ,&y LDR2 .Screen/y DEO2 #03 .Screen/pixel DEO@@ -313,7 +329,7 @@
&whileru .Screen/width DEI2 #0040 SUB2 ,&x STR2 CENTER-Y ,&y LDR2 LTH2 ,&endru JCN - &urscan .Screen/width DEI2 #0008 SUB2 CENTER-Y ,&y LDR2 SUB2 #0010 DIV2 DUP2 ADD2 SUB2 ,&x LDR2 EQU2 ,&endurscan JCN + &urscan .Screen/width DEI2 #0008 SUB2 CENTER-Y ,&y LDR2 SUB2 #04 SFT2 DUP2 ADD2 SUB2 ,&x LDR2 EQU2 ,&endurscan JCN ,&x LDR2 .Screen/x DEO2 ,&y LDR2 .Screen/y DEO2 #03 .Screen/pixel DEO@@ -325,10 +341,54 @@ &x $2
&y $2 +@draw-pointer ( -> ) + + ;pointer_icn .Screen/addr DEO2 + + .Mouse/x DEI2 .Screen/x DEO2 + .Mouse/y DEI2 .Screen/y DEO2 + + #4a .Screen/sprite DEO + +RTN + +@draw-string ( addr x y color -- ) + + STH ( save color ) + .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 + +RTN + +@strlen ( addr -- len ) + + DUP2 + &loop + #0001 ADD2 LDAk ,&loop JCN + SWP2 SUB2 + +RTN + ( constants ) @spritesheet "xrxs.chr 00 +@fontsheet "zz.chr 00 +@cartlist "n/carts 00 +@title-loadCart "Select 20 "A 20 "Cartridge 00 ( sprites ) @blank $16 @uxnlogo $128 @xrxslogo $128 +@pointer_icn [ 80c0 e0f0 f8e0 1000 ] +@font $768 +