commit afa918ccdf29e74ffaa7b3354ab0027c56b4920e
parent fdccdc30680f4c5b51590c255ff6edcc14c31767
Author: Eamon Caddigan <eamon.caddigan@gmail.com>
Date: Thu, 7 Dec 2023 20:20:15 -0800
Handling newlines
Diffstat:
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/hello.tal b/hello.tal
@@ -8,6 +8,7 @@
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|0000
+ @string &auto $1 &x $2 &y $2
|0100
#0a6f .System/r DEO2
@@ -22,7 +23,11 @@
BRK
@message
- "Hello 20 "world! 00
+ "West 20 "of 20 "House 0a
+ "You 20 "are 20 "standing 20 "in 20 "an 20 "open 20 "field 20 "west 20
+ "of 20 "a 20 "white 20 "house, 20 "with 0a
+ "a 20 "boarded 20 "front 20 "door. 0a
+ "There 20 "is 20 "a 20 "small 20 "mailbox 20 "here. 00
@draw-character ( char -- )
#20 SUB #00 SWP #30 SFT2
@@ -31,13 +36,26 @@ BRK
JMP2r
@draw-string ( text* -- )
- LDAk #00 EQU ,&done JCN
+ .Screen/auto DEI .string/auto STZ
+ .Screen/x DEI2 .string/x STZ2
+ .Screen/y DEI2 .string/y STZ2
#01 .Screen/auto DEO
&while
- LDAk ;draw-character JSR2
- INC2 LDAk ,&while JCN
+ LDAk
+ #00 NEQk NIP ,¬-00 JCN
+ POP ,&done JMP
+ ¬-00
+ #0a NEQk NIP ,¬-0a JCN
+ POP
+ .string/x LDZ2 .Screen/x DEO2
+ .string/y LDZ2 #0008 ADD2 DUP2 .string/y STZ2 .Screen/y DEO2
+ INC2 ,&while JMP
+ ¬-0a
+ ;draw-character JSR2
+ INC2 ,&while JMP
&done
POP2
+ .string/auto LDZ .Screen/auto DEO
JMP2r
@font