diff --git a/cli/tgachr/build.sh b/cli/tgachr/build.sh index d301971..c672eff 100755 --- a/cli/tgachr/build.sh +++ b/cli/tgachr/build.sh @@ -2,12 +2,12 @@ ID="tgachr" ASM="uxncli $HOME/roms/drifblim.rom" -EMU="uxncli" +EMU="uxnemu" LIN="uxncli $HOME/roms/uxnlin.rom" SRC="${ID}.tal" DST="${ID}.rom" CPY="$HOME/roms" -ARG="pict.tga" +ARG="pict3.tga" if [[ "$*" == *"--lint"* ]] then diff --git a/cli/tgachr/tgachr.tal b/cli/tgachr/tgachr.tal index 4bd5ede..154bd43 100644 --- a/cli/tgachr/tgachr.tal +++ b/cli/tgachr/tgachr.tal @@ -17,6 +17,7 @@ |0100 @on-reset ( -> ) + ;meta #06 DEO2 ( | theme ) #26ae .System/r DEO2 #26ae .System/g DEO2 @@ -28,6 +29,13 @@ ;await-src .Console/vector DEO2 BRK +@meta $1 + ( name ) "Tgachr 0a + ( desc ) "TGA 20 "to 20 "CHR 20 "Converter 0a + ( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a + ( date ) "27 20 "Nov 20 "2023 $1 + ( exts ) $1 + ( @|vectors ) @@ -41,10 +49,7 @@ #0a18 DEO BRK -@hexc ( hex -- char ) - #0f AND DUP #09 GTH #27 MUL ADD #30 ADD JMP2r - -@write-size ( str* -- ) +@ ( str* -- ) STH2 ;image/w LDA2 #03 SFT2 NIP ( ) DUP #04 SFT hexc STH2kr STA @@ -69,7 +74,7 @@ ;image/h STH2k LDA2 SWP STH2r STA2 ( | output path ) ;src ;dst scpy ;dst - ( ) DUP2 scap/ #0004 SUB2 write-size + ( ) DUP2 scap/ #0004 SUB2 ( ) { ".chr 00 } STH2r SWP2 scap/ scpy ;dst .File2/name DEO2 ( | resize ) @@ -85,19 +90,32 @@ #0a18 DEO ( | get parser ) ;image/image-type LDA #02 NEQk NIP ?{ - ;pixel-raw-true #0004 parse-tga POP JMP2r } + ;pixel-raw-true #0004 + POP JMP2r } #03 NEQk NIP ?{ - ;pixel-raw-bw #0001 parse-tga POP JMP2r } + ;pixel-raw-bw #0001 + POP JMP2r } ( | error ) ;&err #0a18 DEO JMP2r &err "Unsupported 20 "tga-type: 20 $1 -@parse-tga ( filter* length* -- ) +@ ( -- ) + #2000 + &l ( -- ) + #81 .Screen/sprite DEO + INC GTHk ?&l + POP2 + ( | move down ) + #0020 .Screen/x DEO2 + .Screen/y DEI2k #0008 ADD2 ROT DEO2 + JMP2r + +@ ( filter* length* -- ) #0020 .Screen/x DEO2 #0020 .Screen/y DEO2 - ;image/w LDA2 NIP #10 SFT #10 SUB #f0 AND #06 ORA .Screen/auto DEO + #05 .Screen/auto DEO .File1/length DEO2 ,&filter STR2 #0000 ,&x STR2 @@ -110,11 +128,11 @@ ;image/w LDA2 NEQ2 ?&no-line #0000 ,&x STR2 ,&y LDR2 INC2 ,&y STR2 - ( on row ) ,&y LDR2 #0007 AND2 ORA ?&no-row + ( on row ) ,&y LDR2 #0007 AND2 ORA ?&no-line ;buffer DUP2 .Screen/addr DEO2 .File2/write DEO2 - #81 .Screen/sprite DEO - &no-row &no-line .File1/success DEI2 ORA ?&stream + + &no-line .File1/success DEI2 ORA ?&stream JMP2r &pixel $4 @@ -127,7 +145,8 @@ ( | get addr ) DUP2 #0007 AND2 SWP2 #83 SFT2 ADD2 SWP2 #43 SFT2 ADD2 ;buffer ADD2 ( ch1 ) OVR2 OVR2 STHkr #00 toggle-pixel - ( ch2 ) #0008 ADD2 STHr #01 toggle-pixel JMP2r + ( ch2 ) #0008 ADD2 STHr #01 + ( >> ) @toggle-pixel ( x* addr* color -- ) STH2 @@ -185,6 +204,9 @@ POP2 #00 STH2r STA JMP2r +@hexc ( hex -- char ) + #0f AND DUP #09 GTH #27 MUL ADD #30 ADD JMP2r + ( @|assets )