aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2021-05-06 12:45:19 -0400
committerB. Watson <yalhcru@gmail.com>2021-05-06 12:45:19 -0400
commit2ff01881f4b7f0842a10e3c5ab7991c81f60861d (patch)
tree8d693e5c40b9b9b7b094ea576a9619e7352f0911
parent7f4716a7064cd1ff49d0cab901c84dff20a0a96c (diff)
downloadtaipan-2ff01881f4b7f0842a10e3c5ab7991c81f60861d.tar.gz
Save 3 bytes, now 8672
-rw-r--r--console.s20
1 files changed, 10 insertions, 10 deletions
diff --git a/console.s b/console.s
index 554b03d..0eb4ab1 100644
--- a/console.s
+++ b/console.s
@@ -291,17 +291,17 @@ _pluralize:
; the st[] array has elements 0 to 5. 5 is "Perfect" and only
; used when status == 100.
_print_status_desc:
- lsr
- lsr ; now 0-25
- ldx #$ff
+ lsr ; arg /= 2; // was 0..100, now 0..50
+ ldy #$fe ; y = -2;
sec
-@div5loop:
- inx
- sbc #5
- bcs @div5loop
- txa
- asl
- tay
+@div10loop: ; do {
+ iny
+ iny ; y += 2;
+ sbc #$0a ; arg -= 10;
+ bcs @div10loop ; } while(arg >= 0);
+ ; y is now (arg / 20) * 2, one of: 0 2 4 6 8 10
+ ; which is exactly what we need to index an array of six
+ ; 16-bit pointers.
lda _st,y
ldx _st+1,y
jmp _cputs