2021-04-24 16:43:30 +00:00
|
|
|
( dev/console )
|
|
|
|
|
|
|
|
%RTN { JMP2r }
|
2021-07-07 20:20:14 +00:00
|
|
|
%PRINT { ;print JSR2 }
|
|
|
|
%BR { #0a .Console/write DEO }
|
2021-04-24 16:43:30 +00:00
|
|
|
|
|
|
|
( devices )
|
|
|
|
|
2021-07-07 20:20:14 +00:00
|
|
|
|10 @Console [ &pad $8 &write $1 ]
|
2021-04-24 16:43:30 +00:00
|
|
|
|
|
|
|
( variables )
|
|
|
|
|
|
|
|
|0000
|
|
|
|
|
|
|
|
@number [ &started $1 ]
|
|
|
|
|
|
|
|
( init )
|
|
|
|
|
|
|
|
|0100 ( -> )
|
|
|
|
|
2021-07-07 20:20:14 +00:00
|
|
|
;char-txt PRINT #42 .Console/write DEO BR
|
|
|
|
;byte-txt PRINT #ab ;print-byte JSR2 BR
|
|
|
|
;short-txt PRINT #cdef ;print-short JSR2 BR
|
|
|
|
;string-txt PRINT ;hello-word ;print JSR2 BR
|
2021-04-24 16:43:30 +00:00
|
|
|
|
|
|
|
;hello-word ;print JSR2
|
2021-07-07 20:20:14 +00:00
|
|
|
#ffff ;print-short JSR2
|
2021-04-24 16:43:30 +00:00
|
|
|
;is-word ;print JSR2
|
2021-07-07 20:20:14 +00:00
|
|
|
#ffff ;print-short-decimal JSR2
|
2021-04-24 16:43:30 +00:00
|
|
|
|
|
|
|
BRK
|
|
|
|
|
2021-07-07 20:20:14 +00:00
|
|
|
@print ( addr* -- )
|
2021-04-24 16:43:30 +00:00
|
|
|
|
|
|
|
&loop
|
2021-08-18 02:17:47 +00:00
|
|
|
( send ) LDAk .Console/write DEO
|
2021-08-26 22:27:18 +00:00
|
|
|
( incr ) INC2
|
2021-08-18 02:17:47 +00:00
|
|
|
( loop ) LDAk ,&loop JCN
|
2021-04-24 16:43:30 +00:00
|
|
|
POP2
|
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-07-07 20:20:14 +00:00
|
|
|
@print-short ( short* -- )
|
|
|
|
LIT '0 .Console/write DEO
|
|
|
|
LIT 'x .Console/write DEO
|
|
|
|
OVR #04 SFT ,&hex JSR
|
|
|
|
SWP #0f AND ,&hex JSR
|
|
|
|
DUP #04 SFT ,&hex JSR
|
|
|
|
#0f AND ,&hex JMP
|
|
|
|
|
|
|
|
&hex
|
2021-08-17 19:55:10 +00:00
|
|
|
#30 ADD DUP #3a LTH ,¬-alpha JCN
|
|
|
|
#27 ADD
|
|
|
|
¬-alpha
|
|
|
|
.Console/write DEO
|
2021-04-24 16:43:30 +00:00
|
|
|
RTN
|
|
|
|
|
2021-07-07 20:20:14 +00:00
|
|
|
@print-byte ( byte -- )
|
|
|
|
LIT '0 .Console/write DEO
|
|
|
|
LIT 'x .Console/write DEO
|
|
|
|
DUP #04 SFT ,&hex JSR
|
|
|
|
#0f AND ,&hex JMP
|
|
|
|
|
|
|
|
&hex
|
|
|
|
#30 ADD DUP #39 GTH #27 MUL ADD .Console/write DEO
|
2021-04-24 16:43:30 +00:00
|
|
|
RTN
|
|
|
|
|
2021-07-07 20:20:14 +00:00
|
|
|
@print-short-decimal ( short -- )
|
2021-05-11 18:14:52 +00:00
|
|
|
#00 .number/started STZ
|
2021-04-24 16:43:30 +00:00
|
|
|
DUP2 #2710 DIV2 DUP2 ,&digit JSR #2710 MUL2 SUB2
|
|
|
|
DUP2 #03e8 DIV2 DUP2 ,&digit JSR #03e8 MUL2 SUB2
|
|
|
|
DUP2 #0064 DIV2 DUP2 ,&digit JSR #0064 MUL2 SUB2
|
|
|
|
DUP2 #000a DIV2 DUP2 ,&digit JSR #000a MUL2 SUB2
|
|
|
|
,&digit JSR
|
2021-05-11 18:14:52 +00:00
|
|
|
.number/started LDZ ,&end JCN
|
2021-07-07 20:20:14 +00:00
|
|
|
LIT '0 .Console/write DEO
|
2021-04-24 16:43:30 +00:00
|
|
|
&end
|
|
|
|
RTN
|
|
|
|
|
|
|
|
&digit
|
2021-08-15 20:25:58 +00:00
|
|
|
NIP
|
2021-05-11 18:14:52 +00:00
|
|
|
DUP .number/started LDZ ORA #02 JCN
|
2021-04-24 16:43:30 +00:00
|
|
|
POP JMP2r
|
2021-07-07 20:20:14 +00:00
|
|
|
LIT '0 ADD .Console/write DEO
|
2021-05-11 18:14:52 +00:00
|
|
|
#01 .number/started STZ
|
2021-04-24 16:43:30 +00:00
|
|
|
RTN
|
|
|
|
|
|
|
|
@char-txt "char: 20 $1
|
|
|
|
@byte-txt "byte: 20 $1
|
|
|
|
@short-txt "short: 20 $1
|
|
|
|
@string-txt "string: 20 $1
|
|
|
|
|
|
|
|
@hello-word "hello 20 "World! 0a 00
|
|
|
|
@is-word 20 "is 20 00
|