From 40dfc6e25bdbb2fd91f4d2f9755294f908f94931 Mon Sep 17 00:00:00 2001 From: neauoire Date: Mon, 27 Nov 2023 15:08:08 -0800 Subject: [PATCH] Improved renaming --- cli/tgachr/tgachr.tal | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/cli/tgachr/tgachr.tal b/cli/tgachr/tgachr.tal index e65d6eb..4bd5ede 100644 --- a/cli/tgachr/tgachr.tal +++ b/cli/tgachr/tgachr.tal @@ -36,11 +36,25 @@ BRK @on-ready ( -> ) - ;src ;dst scpy ;&chr-ext ;dst scap scpy ;dst .File2/name DEO2 ;src ;dst / #0a18 DEO - BRK &chr-ext ".chr $1 + BRK + +@hexc ( hex -- char ) + #0f AND DUP #09 GTH #27 MUL ADD #30 ADD JMP2r + +@write-size ( str* -- ) + STH2 + ;image/w LDA2 #03 SFT2 NIP + ( ) DUP #04 SFT hexc STH2kr STA + INC2r hexc STH2kr STA + INC2r LIT "x STH2kr STA + INC2r ;image/h LDA2 #03 SFT2 NIP + ( ) DUP #04 SFT hexc STH2kr STA + INC2r hexc STH2kr STA + INC2r #00 STH2r STA + JMP2r ( @|tga ) @@ -53,6 +67,11 @@ ( | flip endianness ) ;image/w STH2k LDA2 SWP STH2r STA2 ;image/h STH2k LDA2 SWP STH2r STA2 + ( | output path ) + ;src ;dst scpy ;dst + ( ) DUP2 scap/ #0004 SUB2 write-size + ( ) { ".chr 00 } + STH2r SWP2 scap/ scpy ;dst .File2/name DEO2 ( | resize ) ;image/w LDA2 #0040 ADD2 .Screen/width DEO2 ;image/h LDA2 #0040 ADD2 .Screen/height DEO2 @@ -147,17 +166,16 @@ POP2 #01 JMP2r @scap ( str* -- end* ) - LDAk #00 NEQ [ JMP JMP2r ] &w ( -- ) - INC2 LDAk ?&w + INC2 & LDAk ?&w JMP2r @sput ( chr str* -- ) - scap STA + scap/ STA JMP2r @slen ( str* -- len* ) - DUP2 scap SWP2 SUB2 JMP2r + DUP2 scap/ SWP2 SUB2 JMP2r @scpy ( src* dst* -- ) STH2