Print size
This commit is contained in:
parent
830dfe3e1b
commit
8122716482
|
@ -10,10 +10,10 @@
|
|||
|0100
|
||||
|
||||
@on-reset ( -> )
|
||||
.Console/type DEI ?&>has-arg
|
||||
;Dict/usage <perr>
|
||||
.Console/type DEI ?{
|
||||
;Dict/usage <perr>/
|
||||
#010f DEO
|
||||
BRK &>has-arg
|
||||
BRK }
|
||||
;await-src .Console/vector DEO2
|
||||
BRK
|
||||
|
||||
|
@ -24,44 +24,45 @@
|
|||
@on-ready ( -> )
|
||||
;src .File/name DEO2
|
||||
#0001 .File/length DEO2
|
||||
#00
|
||||
#0a19 DEO
|
||||
#0000
|
||||
&stream ( -- )
|
||||
;&b .File/read DEO2
|
||||
.File/success DEI2 #0000 EQU2 ?&eof
|
||||
[ LIT &b $1 ] <phex>/b
|
||||
INC DUP <print-spacer>
|
||||
INC2 DUP <print-spacer>
|
||||
!&stream
|
||||
&eof ( id -- )
|
||||
POP #0a18 DEO
|
||||
#0a19 DEOk DEO
|
||||
<pdec>
|
||||
;Dict/bytes <perr>
|
||||
;src <perr>
|
||||
#0a19 DEO
|
||||
#800f DEO
|
||||
BRK
|
||||
|
||||
@<print-spacer> ( id -- )
|
||||
DUP #0f AND ?&>no-lb
|
||||
DUP #0f AND ?{
|
||||
POP #0a18 DEO
|
||||
JMP2r &>no-lb
|
||||
#01 AND ?&>end
|
||||
#2018 DEO &>end
|
||||
JMP2r }
|
||||
#01 AND ?{ #2018 DEO }
|
||||
JMP2r
|
||||
|
||||
(
|
||||
@|stdlib )
|
||||
|
||||
@skey ( key buf -- proc )
|
||||
OVR #21 LTH ?&eval
|
||||
#00 SWP sput #00 JMP2r
|
||||
&eval ( -- )
|
||||
POP2 #01 JMP2r
|
||||
OVR #21 LTH ?{
|
||||
#00 SWP sput #00 JMP2r }
|
||||
POP2 #01 JMP2r
|
||||
|
||||
@scap ( str* -- end* )
|
||||
!&a
|
||||
&w ( -- )
|
||||
INC2 &a LDAk ?&w
|
||||
INC2 & LDAk ?&w
|
||||
JMP2r
|
||||
|
||||
@sput ( chr str* -- )
|
||||
scap INC2k #00 ROT ROT STA
|
||||
STA
|
||||
scap/ ROT #00 SWP2 STA2
|
||||
JMP2r
|
||||
|
||||
@<phex> ( short* -- )
|
||||
|
@ -73,14 +74,23 @@
|
|||
JMP2r
|
||||
|
||||
@<perr> ( err* -- )
|
||||
!&a
|
||||
&w ( -- )
|
||||
LDAk #19 DEO
|
||||
INC2 &a LDAk ?&w
|
||||
INC2 & LDAk ?&w
|
||||
POP2 JMP2r
|
||||
|
||||
@<pdec> ( short* -- )
|
||||
#2710 [ LIT2r 00fb ]
|
||||
&w ( -- )
|
||||
DIV2k #000a DIV2k MUL2 SUB2 SWPr EQUk OVR STHkr EQU AND ?{
|
||||
DUP [ LIT "0 ] ADD #19 DEO
|
||||
INCr }
|
||||
POP2 #000a DIV2 SWPr INCr STHkr ?&w
|
||||
POP2r POP2 POP2 JMP2r
|
||||
|
||||
(
|
||||
@|res )
|
||||
|
||||
@Dict &usage "usage: 20 "hx.rom 20 "input.bin 0a $1
|
||||
&bytes 20 "bytes 20 "in 20 $1
|
||||
|
||||
|
|
Loading…
Reference in New Issue