commit 5d4020ad31677ee93617af9447ef8712ba681f89
parent 72356912e7d92532fa3b3ef66198e92da4ca6591
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Tue, 17 Aug 2021 20:55:10 +0100
Replaced easy multiplications and modulos
Diffstat:
6 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/projects/examples/demos/drum-rack.tal b/projects/examples/demos/drum-rack.tal
@@ -152,7 +152,7 @@ BRK
@on-message ( -> )
- .Console/read DEI #10 MOD ;play-pad JSR2
+ .Console/read DEI #0f AND ;play-pad JSR2
BRK
@@ -387,7 +387,7 @@ RTN
STHkr
- DUP #04 / SWP #04 MOD TOS PAD-WIDTH ** ( center ) .pad-view/x1 LDZ2 ++
+ DUP #04 / SWP #03 AND TOS PAD-WIDTH ** ( center ) .pad-view/x1 LDZ2 ++
ROT TOS PAD-HEIGHT ** ( center ) .pad-view/y1 LDZ2 ++
( draw outline )
diff --git a/projects/examples/demos/font.tal b/projects/examples/demos/font.tal
@@ -136,7 +136,7 @@ RTN
&sprite ( char color -- )
STH
- ( get addr ) DUP TOS #0048 ** ;font-data #0100 ++ ++ .Screen/addr DEO2
+ ( get addr ) DUP TOS #30 SFT2 #30 SFT2k ROT POP ADD2 ;font-data #0100 ++ ++ .Screen/addr DEO2
( get width ) TOS ;font-data ++ LDA TOS
#00 #03
&ver
diff --git a/projects/examples/devices/audio.channels.tal b/projects/examples/devices/audio.channels.tal
@@ -60,7 +60,7 @@ BRK
( get note )
.counter LDZ #18 MOD #30 ADD
- .Audio0/pitch .counter LDZ #04 MOD #40 SFT ADD DEO
+ .Audio0/pitch .counter LDZ #03 AND #40 SFT ADD DEO
.counter LDZ #01 ADD .counter STZ
#00 .timer STZ
diff --git a/projects/examples/devices/console.lib.tal b/projects/examples/devices/console.lib.tal
@@ -49,7 +49,10 @@ RTN
#0f AND ,&hex JMP
&hex
- #30 ADD DUP #39 GTH #27 MUL ADD .Console/write DEO
+ #30 ADD DUP #3a LTH ,¬-alpha JCN
+ #27 ADD
+ ¬-alpha
+ .Console/write DEO
RTN
@print-byte ( byte -- )
diff --git a/projects/examples/devices/datetime.tal b/projects/examples/devices/datetime.tal
@@ -61,7 +61,7 @@ BRK
#00 .DateTime/minute DEI 2** ;table ADD2 LDA2
#00 SWP 4// DUP2k ADD2 ADD2 #0020 ADD2 SCALEY .needles/my STZ2
#00 SWP 4// DUP2k ADD2 ADD2 #0020 ADD2 SCALEX .needles/mx STZ2
- #00 .DateTime/hour DEI 12HOURS #05 MUL 2** ;table ADD2 LDA2
+ #00 .DateTime/hour DEI 12HOURS #20 SFTk NIP ADD 2** ;table ADD2 LDA2
#00 SWP 2// #0040 ADD2 SCALEY .needles/hy STZ2
#00 SWP 2// #0040 ADD2 SCALEX .needles/hx STZ2
diff --git a/projects/software/asma.tal b/projects/software/asma.tal
@@ -223,7 +223,10 @@
#0f AND ,&hex JMP
&hex
- #30 ADD DUP #39 GTH #27 MUL ADD .Console/write DEO
+ #30 ADD DUP #3a LTH ,¬-alpha JCN
+ #27 ADD
+ ¬-alpha
+ .Console/write DEO
JMP2r
(