commit 912afb678fa5e68ced134cd07bce5256c1f30eb9
parent 6e28039b377311c9f2dae5d7c76fe0bd96e5edf7
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Thu, 11 Nov 2021 09:10:45 -0500
(snake.rom) Minor optimizations
Diffstat:
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/projects/examples/demos/snake.tal b/projects/examples/demos/snake.tal
@@ -7,12 +7,12 @@
%2/ { #01 SFT } %2* { #10 SFT }
%8// { #03 SFT2 } %8** { #30 SFT2 }
%MOD { DIVk MUL SUB }
+%MAX { LTHk JMP SWP POP }
%RTN { JMP2r }
%TOS { #00 SWP }
-%SWP? { #01 JCN SWP }
-%RTN? { #01 JCN RTN }
%BRK? { #01 JCN BRK }
+
%DIFFICULTY { #06 }
( devices )
@@ -117,12 +117,12 @@ RTN
POP2
POP2r
- .snake/dead LDZ #00 = RTN?
+ .snake/dead LDZ #00 = JMP RTN
.snake/direction LDZ
DUP #01 ! ,&no-up JCN
.snake/y LDZ #01 -
- .arena/h LDZ LTHk SWP? POP
+ .arena/h LDZ MAX
.snake/y STZ
&no-up
DUP #02 ! ,&no-down JCN
@@ -132,7 +132,7 @@ RTN
&no-down
DUP #04 ! ,&no-left JCN
.snake/x LDZ #01 -
- .arena/w LDZ LTHk SWP? POP
+ .arena/w LDZ MAX
.snake/x STZ
&no-left
DUP #08 ! ,&no-right JCN
@@ -160,7 +160,6 @@ RTN
INC GTHk ,&loop-body JCN
POP2
-
RTN
@add-apple ( -- )
@@ -220,7 +219,7 @@ RTN
@snake-icns
7eff ffff ffff ff7e
&face
- 7eff ffdb ffe7 ff7e
+ 7eff ffdb ffe7 ff7e
@apple-chr
0000 76ff ffff 7e3c
1008 0000 0000 0000