aboutsummaryrefslogtreecommitdiff
path: root/console.s
diff options
context:
space:
mode:
Diffstat (limited to 'console.s')
-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