Housekeeping

This commit is contained in:
Devine Lu Linvega 2023-06-19 21:26:57 -07:00
parent 8d85b690f2
commit e615104426
5 changed files with 247 additions and 243 deletions

View File

@ -1,5 +1,4 @@
(
usage: arvelie.rom )
( usage: arvelie.rom )
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
@ -37,7 +36,10 @@
@parse ( ztr -- )
DUP zlen #05 EQU ?&on-arvgre
DUP zlen #0a EQU ?&on-grearv
( print-error ) ;&err &w LDAk #19 DEO
( | print-error )
;&err
&w ( -- )
LDAk #19 DEO
INC2 LDAk ?&w
POP2
( err ) #010f DEO
@ -55,7 +57,8 @@
( d ) STHr bytedec #0001 SUB2 doty SWP2 <emit-arv>
#0a18 DEO
( end ) #800f DEO
JMP2r &err "usage: 20 "arvelie.rom 20 "YYYY-MM-DD 0a $1
JMP2r
&err "usage: 20 "arvelie.rom 20 "YYYY-MM-DD 0a $1
@<emit-gre> ( doty* year* -- )
DUP2 <emit-dec2>
@ -133,10 +136,9 @@
DUP zcap SWP SUB JMP2r
@zcap ( ztr -- end )
!&>a
!&a
&w ( -- )
INC &>a
LDZk ?&w
INC &a LDZk ?&w
JMP2r
(

View File

@ -3,9 +3,14 @@
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|0000 @src $40 @queue $1
|0000
|0100 ( -> )
@src $40
@queue $1
|0100
@on-reset ( -> )
;await-src .Console/vector DEO2
BRK
@ -17,20 +22,17 @@ BRK
;src .File/name DEO2
#0001 .File/length DEO2
;&buf
&stream
&stream ( -- )
DUP2 .File/read DEO2
.File/success DEI2 #0000 EQU2 ?&eof
LDAk append
!&stream &eof
POP2
( pad )
.queue LDZ #00 EQU ?&no-pad
#00 append
&no-pad
LDAk append !&stream
&eof POP2
( | pad )
.queue LDZ #00 EQU ?&>no-pad
#00 append &>no-pad
#0a18 DEO
#010f DEO
BRK
&buf $1
BRK &buf $1
(
@|core )
@ -38,30 +40,34 @@ BRK
@append ( byte -- )
,&buf STR
#0800
&l
[ LIT &buf $1 ] OVR #07 SWP SUB SFT #01 AND
[ LIT &inc $1 ] INCk #06 DIVk MUL SUB ,&inc STR
( bit id -- )
SWP .queue LDZ ORA DUP ADD .queue STZ
#05 NEQ ?&no-cap
[ LIT2 00 -queue ]
DUP2 LDZ #01 SFT ;MIME ADD2 LDA #18 DEO
STZ
&no-cap
&l ( -- )
( ) [ LIT &buf $1 ] OVR #07 SWP SUB SFT #01 AND
( ) [ LIT &inc $1 ] INCk #06 DIVk MUL SUB ,&inc STR
( bit id -- ) SWP .queue LDZ ORA DUP ADD .queue STZ
#05 NEQ ?&>no-cap
[ LIT2 00 -queue ] DUP2 LDZ #01 SFT ;MIME ADD2 LDA #18 DEO
STZ &>no-cap
INC GTHk ?&l
POP2
JMP2r
POP2 JMP2r
@MIME [
"ABCDEFGHIJKLMNOP
"QRSTUVWXYZabcdef
"ghijklmnopqrstuv
"wxyz0123456789+/ ]
@MIME
[ "ABCDEFGHIJKLMNOP "QRSTUVWXYZabcdef "ghijklmnopqrstuv "wxyz0123456789+/ ]
(
@|stdlib )
@skey ( key buf -- proc ) OVR #21 LTH ?&eval #00 SWP sput #00 JMP2r &eval POP2 #01 JMP2r
@scap ( str* -- end* ) LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w JMP2r
@sput ( chr str* -- ) scap INC2k #00 ROT ROT STA STA JMP2r
@skey ( key buf -- proc )
OVR #21 LTH ?&eval
#00 SWP sput #00 JMP2r
&eval POP2 #01 JMP2r
@scap ( str* -- end* )
!&a
&w ( -- )
INC2 &a LDAk ?&w
JMP2r
@sput ( chr str* -- )
scap ROT #00 SWP2 STA2
JMP2r

View File

@ -1,5 +1,4 @@
(
uxncli hx.rom file.bin )
( uxncli hx.rom file.bin )
|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
@ -11,11 +10,10 @@
|0100
@on-reset ( -> )
.Console/type DEI ?&on-arg
.Console/type DEI ?&>has-arg
;Dict/usage <perr>
#010f DEO
BRK
&on-arg ( -> )
BRK &>has-arg
;await-src .Console/vector DEO2
BRK
@ -39,13 +37,12 @@
BRK
@<print-spacer> ( id -- )
DUP #0f AND ?&no-lb
DUP #0f AND ?&>no-lb
POP #0a18 DEO
JMP2r &>no-lb
#01 AND ?&>end
#2018 DEO &>end
JMP2r
&no-lb ( id -- )
#01 AND ?&end
#2018 DEO
&end JMP2r
(
@|stdlib )

View File

@ -3,9 +3,14 @@
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|0000 @src $40 @queue $1
|0000
|0100 ( -> )
@src $40
@queue $1
|0100
@on-reset ( -> )
;await-src .Console/vector DEO2
BRK
@ -17,40 +22,50 @@ BRK
;src .File/name DEO2
#0002 .File/length DEO2
;&buf
&stream
&stream ( -- )
DUP2 .File/read DEO2
.File/success DEI2 #0000 EQU2 ?&eof
LDA2k proquint
!&stream &eof
POP2
#0a18 DEO
LDA2k proquint !&stream
&eof POP2 #0a18 DEO
#010f DEO
BRK
&buf $2
BRK &buf $2
(
@|core )
@proquint ( short* -- )
( c1 ) DUP2 #0c emit-con
( v1 ) DUP2 #0a emit-vow
( c2 ) DUP2 #06 emit-con
( v2 ) DUP2 #03 emit-vow
( c3 ) #00 emit-con
#20 &emit ( c -- ) #18 DEO
( c3 ) #00 emit-con #20
&emit ( c -- )
#18 DEO
JMP2r
@emit-con SFT2 #000f AND2 ;&con ADD2 LDA !proquint/emit
&con "bdfghjklmnprstvz
@emit-vow SFT2 #0003 AND2 ;&vow ADD2 LDA !proquint/emit
&vow "aiou
@emit-con
SFT2 #000f AND2 ;&con ADD2 LDA !proquint/emit
&con [ "bdfghjklmnprstvz ]
@emit-vow
SFT2 #0003 AND2 ;&vow ADD2 LDA !proquint/emit
&vow [ "aiou ]
(
@|stdlib )
@skey ( key buf -- proc ) OVR #21 LTH ?&eval #00 SWP sput #00 JMP2r &eval POP2 #01 JMP2r
@scap ( str* -- end* ) LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w JMP2r
@sput ( chr str* -- ) scap INC2k #00 ROT ROT STA STA JMP2r
@skey ( key buf -- proc )
OVR #21 LTH ?&eval
#00 SWP sput #00 JMP2r
&eval POP2 #01 JMP2r
@scap ( str* -- end* )
LDAk #00 NEQ [ JMP JMP2r ]
&w ( -- )
INC2 LDAk ?&w
JMP2r
@sput ( chr str* -- )
scap ROT #00 SWP2 STA2
JMP2r

View File

@ -9,184 +9,166 @@
@src $40
|0100 ( -> )
|0100
( meta )
@on-reset ( -> )
;meta #06 DEO2
#960f .System/r DEO2
#a70f .System/g DEO2
#a70f .System/b DEO2
#0150 .Screen/width DEO2
#0050 .Screen/height DEO2
;await-src .Console/vector DEO2
;dict/input pstr
;dict/input <pstr>
BRK
@meta 00
@meta
00
( name ) "Meta 0a
( details ) "A 20 "ROM 20 "metadata 20 "viewer 0a
( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
( date ) "Apr 20 "4, 20 "2023 00
01
( date ) "Apr 20 "4, 20 "2023 00 01
( icon ) 83 =appicon
(
@|vectors )
@await-src ( -> )
.Console/read DEI .src skey
?on-ready
.Console/read DEI .src skey ?on-ready
BRK
@on-ready ( -> )
;src
DUP2 pstr #0a18 DEO
has-metadata
?&on-metadata
;src DUP2 <pstr>
#0a18 DEO
has-metadata ?&>has-metadata
#004c .Screen/x DEO2
#0024 .Screen/y DEO2
;dict/empty draw-txt POP2
BRK
&on-metadata ( -> )
load-metadata
;metadata/body pstr #0a18 DEO
draw-metadata
;dict/empty <draw-txt>
POP2 BRK &>has-metadata
load-metadata ;metadata/body <pstr>
#0a18 DEO
<draw-metadata>
BRK
(
@|core )
@has-metadata ( src* -- bool )
.File/name DEO2
#0006 .File/length DEO2
;metadata/header .File/read DEO2
;metadata/deo LDA2 #0637 EQU2
JMP2r
;metadata/deo LDA2 #0637 EQU2 JMP2r
@load-metadata ( -- )
;metadata/start LDA2 #0100 SUB2 seek
( version )
( | version )
#0001 .File/length DEO2
;metadata/version .File/read DEO2
( body )
( | body )
LIT2r =metadata/body
&s
STH2kr
DUP2 .File/read DEO2
&s ( -- )
STH2kr DUP2 .File/read DEO2
INC2r LDA ?&s
POP2r
( fields )
;metadata/fields
DUP2 .File/read DEO2
( | fields )
;metadata/fields DUP2 .File/read DEO2
LDAk #03 MUL #00 SWP .File/length DEO2
INC2 .File/read DEO2
JMP2r
(
@|drawing )
@draw-metadata ( -- )
@<draw-metadata> ( -- )
#004c .Screen/x DEO2
#0012 .Screen/y DEO2
;metadata/body draw-txt POP2
( find picture )
;metadata/fields LDAk LITr 00 STH
INC2 DUP2 STH2r ADD2 SWP2
&l
LDAk #83 NEQ ?&no-pict
INC2k LDA2 #0100 SUB2 draw-icon
&no-pict
;metadata/body <draw-txt>
POP2
( | find picture )
;metadata/fields LDAk LITr 00 STH INC2 DUP2 STH2r ADD2 SWP2
&l ( -- )
LDAk #83 NEQ ?&>no-pict
INC2k LDA2 #0100 SUB2 <draw-icon> &>no-pict
INC2 GTH2k ?&l
POP2 POP2
POP2 POP2 JMP2r
JMP2r
@draw-icon ( location* -- )
seek
#0090 .File/length DEO2
;metadata/icon
DUP2 .File/read DEO2
@<draw-icon> ( location* -- )
seek #0090 .File/length DEO2
;metadata/icon DUP2 .File/read DEO2
.Screen/addr DEO2
[ LIT2 26 -Screen/auto ] DEO
#001c
DUP2 .Screen/x DEO2
#001c DUP2 .Screen/x DEO2
.Screen/y DEO2
[ LIT2 81 -Screen/sprite ] DEOk DEOk DEO
[ LIT2 81 -Screen/sprite ] DEOk
DEOk
DEO
JMP2r
@draw-txt ( txt* -- end* )
@<draw-txt> ( txt* -- end* )
[ LIT2 01 -Screen/auto ] DEO
.Screen/x DEI2 ,&anchor STR2
&w
&w ( -- )
LDAk #20 SUB #00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2
[ LIT2 02 -Screen/sprite ] DEO
LDAk #0a NEQ ?&no-lb
LDAk #0a NEQ ?&>no-lb
[ LIT2 &anchor $2 ] .Screen/x DEO2
.Screen/y DEI2k #000c ADD2 ROT DEO2
&no-lb
.Screen/y DEI2k #000c ADD2 ROT DEO2 &>no-lb
INC2 LDAk ?&w
JMP2r
(
@|stdlib )
@seek ( length* -- )
.File/name DEI2k ROT DEO2
#0000 INC2k .File/length DEO2
&l
&l ( -- )
;&b .File/read DEO2
INC2 GTH2k ?&l
POP2 POP2
JMP2r
POP2 POP2 JMP2r
&b $1
@scap ( str* -- end* ) LDAk ?&w [ JMP2r ] &w INC2 LDAk ?&w JMP2r
@sput ( chr str* -- ) scap STA JMP2r
@skey ( key buf -- proc ) OVR #21 LTH ?&eval #00 SWP sput #00 JMP2r &eval POP2 #01 JMP2r
@pstr ( str* -- ) &w LDAk #18 DEO INC2 LDAk ?&w POP2 JMP2r
@scap ( str* -- end* )
!&a
&w ( -- )
INC2 &a LDAk ?&w
JMP2r
@sput ( chr str* -- )
scap STA
JMP2r
@skey ( key buf -- proc )
OVR #21 LTH ?&eval
#00 SWP sput #00 JMP2r
&eval POP2 #01 JMP2r
@<pstr> ( str* -- )
&w ( -- )
LDAk #18 DEO
INC2 LDAk ?&w
POP2 JMP2r
(
@|assets )
@dict
&input "Input(.tal): 20 $1
@dict &input "Input(.tal): 20 $1
&empty "Metadata 20 "Missing $1
@appicon ( 3x3 ) [
0000 3f20 2020 2020 ffff ffff ffff ffff 0000 ff18 0000 0000 ffff ffff ffff ffff
0000 fc04 0404 0404 ffff ffff ffff ffff 2020 2030 3020 2020 ffff ffff ffff ffff
0000 0000 0000 0000 ffff ffff ffff ffff 0404 040c 0c04 0404 ffff ffff ffff ffff
2020 2020 203f 0000 ffff ffff ffff ffff 0000 0000 18ff 0000 ffff ffff ffff ffff
@appicon ( 3x3 )
[
0000 3f20 2020 2020 ffff ffff ffff ffff
0000 ff18 0000 0000 ffff ffff ffff ffff
0000 fc04 0404 0404 ffff ffff ffff ffff
2020 2030 3020 2020 ffff ffff ffff ffff
0000 0000 0000 0000 ffff ffff ffff ffff
0404 040c 0c04 0404 ffff ffff ffff ffff
2020 2020 203f 0000 ffff ffff ffff ffff
0000 0000 18ff 0000 ffff ffff ffff ffff
0404 0404 04fc 0000 ffff ffff ffff ffff ]
@font ( atari8 ) [
@font ( atari8 )
[
0000 0000 0000 0000 6060 6060 6000 6000
6666 6600 0000 0000 006c fe6c 6cfe 6c00
183e 603c 067c 1800 0066 6c18 3066 4600
@ -236,8 +218,10 @@ c060 3018 0c06 0300 3c0c 0c0c 0c0c 3c00
1818 1818 1818 1818 380c 0c06 0c0c 3800
0000 60f2 9e0c 0000 3c42 9985 8599 423c ]
@metadata
&header $1 &start $3 &deo $2 &version $1
@metadata &header $1
&start $3
&deo $2
&version $1
&body $100
&fields $100
&icon $90