| ... | ... |
@@ -1,12 +1,12 @@ |
| 1 | 1 |
( dev/console ) |
| 2 | 2 |
|
| 3 | 3 |
%RTN { JMP2r }
|
| 4 |
-%PRINT { .Console/string DEO2 }
|
|
| 5 |
-%BR { #0a .Console/char DEO }
|
|
| 4 |
+%PRINT { ;print JSR2 }
|
|
| 5 |
+%BR { #0a .Console/write DEO }
|
|
| 6 | 6 |
|
| 7 | 7 |
( devices ) |
| 8 | 8 |
|
| 9 |
-|10 @Console [ &pad $8 &char $1 &byte $1 &short $2 &string $2 ] |
|
| 9 |
+|10 @Console [ &pad $8 &write $1 ] |
|
| 10 | 10 |
|
| 11 | 11 |
( variables ) |
| 12 | 12 |
|
| ... | ... |
@@ -18,46 +18,51 @@ |
| 18 | 18 |
|
| 19 | 19 |
|0100 ( -> ) |
| 20 | 20 |
|
| 21 |
- ;char-txt PRINT #42 .Console/char DEO BR |
|
| 22 |
- ;byte-txt PRINT #ab .Console/byte DEO BR |
|
| 23 |
- ;short-txt PRINT #cdef .Console/short DEO2 BR |
|
| 24 |
- ;string-txt PRINT ;hello-word .Console/string DEO2 BR |
|
| 21 |
+ ;char-txt PRINT #42 .Console/write DEO BR |
|
| 22 |
+ ;byte-txt PRINT #ab ;print-byte JSR2 BR |
|
| 23 |
+ ;short-txt PRINT #cdef ;print-short JSR2 BR |
|
| 24 |
+ ;string-txt PRINT ;hello-word ;print JSR2 BR |
|
| 25 | 25 |
|
| 26 | 26 |
;hello-word ;print JSR2 |
| 27 |
- #ffff ;print-hexadecimal JSR2 |
|
| 27 |
+ #ffff ;print-short JSR2 |
|
| 28 | 28 |
;is-word ;print JSR2 |
| 29 |
- #ffff ;print-decimal JSR2 |
|
| 29 |
+ #ffff ;print-short-decimal JSR2 |
|
| 30 | 30 |
|
| 31 | 31 |
BRK |
| 32 | 32 |
|
| 33 |
-@print ( addr -- ) |
|
| 33 |
+@print ( addr* -- ) |
|
| 34 | 34 |
|
| 35 | 35 |
&loop |
| 36 |
- ( send ) DUP2 LDA .Console/char DEO |
|
| 36 |
+ ( send ) DUP2 LDA .Console/write DEO |
|
| 37 | 37 |
( incr ) #0001 ADD2 |
| 38 | 38 |
( loop ) DUP2 LDA ,&loop JCN |
| 39 | 39 |
POP2 |
| 40 | 40 |
|
| 41 | 41 |
RTN |
| 42 | 42 |
|
| 43 |
-@print-hexadecimal ( short -- ) |
|
| 44 |
- LIT '0 .Console/char DEO |
|
| 45 |
- LIT 'x .Console/char DEO |
|
| 46 |
- DUP2 #0c SFT2 ,&digit JSR |
|
| 47 |
- DUP2 #08 SFT2 ,&digit JSR |
|
| 48 |
- DUP2 #04 SFT2 ,&digit JSR |
|
| 49 |
- ,&digit JSR |
|
| 43 |
+@print-short ( short* -- ) |
|
| 44 |
+ LIT '0 .Console/write DEO |
|
| 45 |
+ LIT 'x .Console/write DEO |
|
| 46 |
+ OVR #04 SFT ,&hex JSR |
|
| 47 |
+ SWP #0f AND ,&hex JSR |
|
| 48 |
+ DUP #04 SFT ,&hex JSR |
|
| 49 |
+ #0f AND ,&hex JMP |
|
| 50 |
+ |
|
| 51 |
+ &hex |
|
| 52 |
+ #30 ADD DUP #39 GTH #27 MUL ADD .Console/write DEO |
|
| 50 | 53 |
RTN |
| 51 | 54 |
|
| 52 |
- &digit |
|
| 53 |
- #0f AND DUP #0a LTH ,¬-alpha JCN |
|
| 54 |
- #27 ADD |
|
| 55 |
- ¬-alpha |
|
| 56 |
- LIT '0 ADD .Console/char DEO |
|
| 57 |
- POP |
|
| 55 |
+@print-byte ( byte -- ) |
|
| 56 |
+ LIT '0 .Console/write DEO |
|
| 57 |
+ LIT 'x .Console/write DEO |
|
| 58 |
+ DUP #04 SFT ,&hex JSR |
|
| 59 |
+ #0f AND ,&hex JMP |
|
| 60 |
+ |
|
| 61 |
+ &hex |
|
| 62 |
+ #30 ADD DUP #39 GTH #27 MUL ADD .Console/write DEO |
|
| 58 | 63 |
RTN |
| 59 | 64 |
|
| 60 |
-@print-decimal ( short -- ) |
|
| 65 |
+@print-short-decimal ( short -- ) |
|
| 61 | 66 |
#00 .number/started STZ |
| 62 | 67 |
DUP2 #2710 DIV2 DUP2 ,&digit JSR #2710 MUL2 SUB2 |
| 63 | 68 |
DUP2 #03e8 DIV2 DUP2 ,&digit JSR #03e8 MUL2 SUB2 |
| ... | ... |
@@ -65,7 +70,7 @@ RTN |
| 65 | 70 |
DUP2 #000a DIV2 DUP2 ,&digit JSR #000a MUL2 SUB2 |
| 66 | 71 |
,&digit JSR |
| 67 | 72 |
.number/started LDZ ,&end JCN |
| 68 |
- LIT '0 .Console/char DEO |
|
| 73 |
+ LIT '0 .Console/write DEO |
|
| 69 | 74 |
&end |
| 70 | 75 |
RTN |
| 71 | 76 |
|
| ... | ... |
@@ -73,7 +78,7 @@ RTN |
| 73 | 78 |
SWP POP |
| 74 | 79 |
DUP .number/started LDZ ORA #02 JCN |
| 75 | 80 |
POP JMP2r |
| 76 |
- LIT '0 ADD .Console/char DEO |
|
| 81 |
+ LIT '0 ADD .Console/write DEO |
|
| 77 | 82 |
#01 .number/started STZ |
| 78 | 83 |
RTN |
| 79 | 84 |
|
| ... | ... |
@@ -6,7 +6,7 @@ |
| 6 | 6 |
( devices ) |
| 7 | 7 |
|
| 8 | 8 |
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |
| 9 |
-|10 @Console [ &pad $8 &char $1 &byte $1 &short $2 &string $2 ] |
|
| 9 |
+|10 @Console [ &pad $8 &write $1 ] |
|
| 10 | 10 |
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] |
| 11 | 11 |
|a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ] |
| 12 | 12 |
|
| ... | ... |
@@ -30,13 +30,13 @@ |
| 30 | 30 |
|
| 31 | 31 |
.File/success DEI2 ORA ;on-success JCN2 |
| 32 | 32 |
|
| 33 |
- ;failedtxt .Console/string DEO2 |
|
| 33 |
+ ;failedtxt ;print-string JSR2 |
|
| 34 | 34 |
|
| 35 | 35 |
BRK |
| 36 | 36 |
|
| 37 | 37 |
@on-success ( -> ) |
| 38 | 38 |
|
| 39 |
- ;successtxt .Console/string DEO2 |
|
| 39 |
+ ;successtxt ;print-string JSR2 |
|
| 40 | 40 |
|
| 41 | 41 |
( draw image ) |
| 42 | 42 |
MEMORY .Screen/addr DEO2 |
| ... | ... |
@@ -62,6 +62,15 @@ BRK |
| 62 | 62 |
|
| 63 | 63 |
BRK |
| 64 | 64 |
|
| 65 |
+@print-string ( ptr* -- ) |
|
| 66 |
+ LDAk DUP ,&keep-going JCN |
|
| 67 |
+ POP POP2 JMP2r |
|
| 68 |
+ |
|
| 69 |
+ &keep-going |
|
| 70 |
+ .Console/write DEO |
|
| 71 |
+ #0001 ADD2 |
|
| 72 |
+ ,print-string JMP |
|
| 73 |
+ |
|
| 65 | 74 |
@successtxt "Success! 09 $1 |
| 66 | 75 |
@failedtxt "Failed. 09 $1 |
| 67 | 76 |
|