Formatted checksum
This commit is contained in:
parent
e615104426
commit
3b93657863
|
@ -7,71 +7,84 @@
|
||||||
|
|
||||||
@src $40
|
@src $40
|
||||||
|
|
||||||
|0100 ( -> )
|
|0100
|
||||||
|
|
||||||
.Console/type DEI ?&on-arg
|
@on-reset ( -> )
|
||||||
;dict/usage &w LDAk #19 DEO INC2 LDAk ?&w POP2
|
.Console/type DEI ?&>has-arg
|
||||||
|
;dict/usage <perr>
|
||||||
#010f DEO
|
#010f DEO
|
||||||
|
BRK &>has-arg
|
||||||
BRK
|
|
||||||
|
|
||||||
&on-arg ( -> )
|
|
||||||
|
|
||||||
;await-src .Console/vector DEO2
|
;await-src .Console/vector DEO2
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@await-src ( -> )
|
@await-src ( -> )
|
||||||
|
.Console/read DEI .src skey ?on-ready
|
||||||
.Console/read DEI .src skey
|
|
||||||
?on-ready
|
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@on-ready ( -> )
|
@on-ready ( -> )
|
||||||
|
;src DUP2 hash <emit-long>
|
||||||
;src
|
#2018 DEO
|
||||||
DUP2 hash plong #2018 DEO
|
<pstr>
|
||||||
pstr #0a18 DEO
|
#0a18 DEO
|
||||||
#800f DEO
|
#800f DEO
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
(
|
(
|
||||||
@|core )
|
@|core )
|
||||||
|
|
||||||
@hash ( filename* -- x* y* )
|
@hash ( filename* -- x* y* )
|
||||||
|
|
||||||
.File/name DEO2
|
.File/name DEO2
|
||||||
#0001 .File/length DEO2
|
#0001 .File/length DEO2
|
||||||
#1234 ,&x STR2 #abcd ,&y STR2
|
#1234 ,&x STR2
|
||||||
#2443 ,&a STR2 #118d ,&b STR2
|
#abcd ,&y STR2
|
||||||
&w
|
#2443 ,&a STR2
|
||||||
|
#118d ,&b STR2
|
||||||
|
&w ( -- )
|
||||||
;&c .File/read DEO2
|
;&c .File/read DEO2
|
||||||
[ LIT &c $1 ] DUP DUP2
|
[ LIT &c $1 ] DUP DUP2 [ LIT2 &x $2 ] [ LIT2 &a $2 ] MUL2 ADD2 ,&x STR2
|
||||||
[ LIT2 &x $2 ] [ LIT2 &a $2 ] MUL2 ADD2 ,&x STR2
|
|
||||||
[ LIT2 &y $2 ] [ LIT2 &b $2 ] MUL2 ADD2 ,&y STR2
|
[ LIT2 &y $2 ] [ LIT2 &b $2 ] MUL2 ADD2 ,&y STR2
|
||||||
.File/success DEI2 ORA ?&w
|
.File/success DEI2 ORA ?&w
|
||||||
,&x LDR2 ,&y LDR2
|
,&x LDR2 ,&y LDR2 JMP2r
|
||||||
|
|
||||||
JMP2r
|
|
||||||
|
|
||||||
(
|
(
|
||||||
@|stdlib )
|
@|stdlib )
|
||||||
|
|
||||||
@scap ( str* -- end* )
|
@scap ( str* -- end* )
|
||||||
LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w JMP2r
|
!&a
|
||||||
@sput ( chr str* -- )
|
&w ( -- )
|
||||||
scap STA JMP2r
|
INC2 &a LDAk ?&w
|
||||||
@skey ( key buf -- proc )
|
JMP2r
|
||||||
OVR #21 LTH ?&eval #00 SWP sput #00 JMP2r &eval POP2 #01 JMP2r
|
|
||||||
@pstr ( str* -- )
|
@sput ( chr str* -- )
|
||||||
&w LDAk #18 DEO INC2 LDAk ?&w POP2 JMP2r
|
scap ROT #00 SWP2 STA2
|
||||||
@plong ( a* b* -> )
|
JMP2r
|
||||||
SWP2 plong/s
|
|
||||||
&s SWP plong/b
|
@skey ( key buf -- proc )
|
||||||
&b DUP #04 SFT plong/c
|
OVR #21 LTH ?&eval
|
||||||
&c #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO JMP2r
|
#00 SWP sput #00 JMP2r
|
||||||
@dict
|
&eval POP2 #01 JMP2r
|
||||||
&usage "usage: 20 "checksum.rom 20 "input.bin 0a $1
|
|
||||||
|
@<pstr> ( str* -- )
|
||||||
|
&w ( -- )
|
||||||
|
LDAk #18 DEO
|
||||||
|
INC2 LDAk ?&w
|
||||||
|
POP2 JMP2r
|
||||||
|
|
||||||
|
@<perr> ( str* -- )
|
||||||
|
&w ( -- )
|
||||||
|
LDAk #19 DEO
|
||||||
|
INC2 LDAk ?&w
|
||||||
|
POP2 JMP2r
|
||||||
|
|
||||||
|
@<emit-long> ( a* b* -> )
|
||||||
|
SWP2 <emit-long>/s
|
||||||
|
&s ( -- )
|
||||||
|
SWP <emit-long>/b
|
||||||
|
&b ( -- )
|
||||||
|
DUP #04 SFT <emit-long>/c
|
||||||
|
&c ( -- )
|
||||||
|
#0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO
|
||||||
|
JMP2r
|
||||||
|
|
||||||
|
@dict &usage "usage: 20 "checksum.rom 20 "input.bin 0a $1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue