add cursor, font drawing, custom font
This commit is contained in:
parent
50fcc9ec8d
commit
11bfceb327
3 changed files with 79 additions and 4 deletions
15
uxn-client/mkfont.sh
Executable file
15
uxn-client/mkfont.sh
Executable file
|
@ -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
|
|
@ -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 @@ BRK
|
|||
;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 @@ RTN
|
|||
#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 @@ RTN
|
|||
#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 @@ RTN
|
|||
&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 @@ RTN
|
|||
&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 @@ RTN
|
|||
&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
|
||||
|
||||
|
|
BIN
uxn-client/zz.chr
Normal file
BIN
uxn-client/zz.chr
Normal file
Binary file not shown.
Loading…
Reference in a new issue