(lz) Added usage

This commit is contained in:
neauoire 2023-11-19 10:47:41 -08:00
parent 08e3d61701
commit a9b1a62ed6
2 changed files with 34 additions and 14 deletions

View File

@ -20,7 +20,6 @@ cc ulzdec.c $DEBUG_flags -o ulzdec
cc ulzenc.c $DEBUG_flags -o ulzenc cc ulzenc.c $DEBUG_flags -o ulzenc
$ASM ulzdec.tal ulzdec.rom $ASM ulzdec.tal ulzdec.rom
$ASM ulzenc.tal ulzenc.rom $ASM ulzenc.tal ulzenc.rom
$ASM ulzdis.tal ulzdis.rom
if [[ "$*" == *"--install"* ]] if [[ "$*" == *"--install"* ]]
then then

View File

@ -1,17 +1,21 @@
( ulz decoder ) ( ulz decoder )
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &err $1 |10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|00 @src $30
@dst $30 |0000
@ptr $1
@src $30
@dst $30
@ptr $1
|0100 |0100
@ready-src ( -> ) @on-reset ( -> )
;meta #06 DEO2
.Console/type DEI #03 AND ?{
;dict/usage <perr>/
#010f DEO }
;&await .Console/vector DEO2 ;&await .Console/vector DEO2
BRK BRK
&await ( -> ) &await ( -> )
@ -25,24 +29,33 @@
.Console/read DEI .dst skey ?on-ready .Console/read DEI .dst skey ?on-ready
BRK BRK
@meta $1
( name ) "Ulzdec 0a
( desc ) "ULZ 20 "Decoder 0a
( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
( date ) "19 20 "Nov 20 "2023 $1
( exts ) 00
@on-ready ( -> ) @on-ready ( -> )
;src decode_ulz ;src <decode_ulz>
( export ) ;dst .File/name DEO2 ( | export )
;dst .File/name DEO2
;mem DUP2 .ptr LDZ2 SUB2 .File/length DEO2 ;mem DUP2 .ptr LDZ2 SUB2 .File/length DEO2
.File/write DEO2 .File/write DEO2
( halt ) #800f DEO ( halt ) #800f DEO
BRK BRK
@decode_ulz ( str* -- ) @<decode_ulz> ( str* -- )
;mem .ptr STZ2 ;mem .ptr STZ2
.File/name DEO2 .File/name DEO2
&stream ( -- ) &stream ( -- )
#0001 .File/length DEO2 #0001 .File/length DEO2
;&b DUP2 .File/read DEO2 ;&b DUP2 .File/read DEO2
.File/success DEI2 ORA ?{ POP2 JMP2r } .File/success DEI2 ORA ?{ POP2 JMP2r }
[ LIT &b $1 ] decode_ulz_byte !&stream [ LIT &b $1 ] <decode_ulz_byte>
!&stream
@decode_ulz_byte ( byte -- ) @<decode_ulz_byte> ( byte -- )
DUP #80 AND ?op-cpy DUP #80 AND ?op-cpy
@op-lit ( byte -- ) @op-lit ( byte -- )
@ -55,8 +68,9 @@
#7f AND DUP #40 AND ?{ #00 SWP !&copy } #7f AND DUP #40 AND ?{ #00 SWP !&copy }
#3f AND getc #3f AND getc
&copy ( length* -- ) &copy ( length* -- )
.ptr LDZ2 #00 getc INC2 SUB2 ,&offset STR2 #0004 ADD2 #0000 .ptr LDZ2 #00 getc INC2 SUB2 ,&offset STR2
&l ( -- ) #0004 ADD2 #0000
&l ( length* i* -- )
( get ) DUP2 [ LIT2 &offset $2 ] ADD2 LDA ( get ) DUP2 [ LIT2 &offset $2 ] ADD2 LDA
( put ) .ptr LDZ2 STAk INC2 .ptr STZ2 ( put ) .ptr LDZ2 STAk INC2 .ptr STZ2
POP INC2 GTH2k ?&l POP INC2 GTH2k ?&l
@ -84,6 +98,13 @@
;&b .File/read DEO2 ;&b .File/read DEO2
[ LIT &b $1 ] JMP2r [ LIT &b $1 ] JMP2r
@<perr> ( str* -- )
&w LDAk #19 DEO
INC2 & LDAk ?&w
POP2 JMP2r
@dict &usage "usage: 20 "ulzdec.rom 20 "a.bin 20 "b.ulz 0a $1
@mem @mem