commit e5781be5d0679fedf3f01008aaf88501ea4e1a8e
parent 0280c7430e35fe1f10cd5b30eeec3d0331ad3778
Author: Eamon Caddigan <eamon.caddigan@gmail.com>
Date: Fri, 8 Dec 2023 19:38:20 -0800
Cleaning up this afternoon's code
No important changes, just tidying things up so that I feel more
comfortable with everything. I think this is a good idiom for
if/ifelse/else in a while. Maybe. For now!
Diffstat:
M | hello.tal | | | 33 | +++++++++++++++++++-------------- |
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/hello.tal b/hello.tal
@@ -16,18 +16,11 @@
#0008 .Screen/x DEO2
#0008 .Screen/y DEO2
-
- ;message ;draw-string JSR2
+ ;message/part-1 ;draw-string JSR2
+ ;message/part-2 ;draw-string JSR2
BRK
-@message
- "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
;font ADD2 .Screen/addr DEO2
@@ -39,22 +32,34 @@ JMP2r
#01 .Screen/auto DEO
&while
LDAk
- #00 NEQk NIP ,¬-00 JCN
- POP ,&done JMP
+ [ #00 ] NEQk NIP ,¬-00 JCN
+ POP
+ ,&end-while JMP
¬-00
- #0a NEQk NIP ,¬-0a JCN
+ [ #0a ] NEQk NIP ,¬-0a JCN
POP
OVR2 .Screen/x DEO2
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
- INC2 ,&while JMP
+ ,&end-if JMP
¬-0a
+ ( else )
;draw-character JSR2
+ &end-if
INC2 ,&while JMP
- &done
+ &end-while
POP2 POP2
.Screen/auto DEO POP
JMP2r
+@message
+ &part-1
+ "West 20 "of 20 "House 0a 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 0a 00
+ &part-2
+ "There 20 "is 20 "a 20 "small 20 "mailbox 20 "here. 00
+
@font
0000 0000 0000 0000
1818 1818 1800 1800