aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-04-08 06:13:43 -0400
committerB. Watson <urchlay@slackware.uk>2026-04-08 06:13:43 -0400
commit4ae461b9332f5642df85b8c204d88601f6a1adef (patch)
tree37677d967c9736f4b440673ad64187570a1246c2 /src
parentde399537f2e3aa542e716ad50d301062152588f0 (diff)
downloadfujinet-chat-4ae461b9332f5642df85b8c204d88601f6a1adef.tar.gz
Commentary in jifsec.s
Diffstat (limited to 'src')
-rw-r--r--src/jifsec.s15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/jifsec.s b/src/jifsec.s
index 4972cdf..ca5aac7 100644
--- a/src/jifsec.s
+++ b/src/jifsec.s
@@ -28,14 +28,14 @@ _print_jif_sec:
@printfrac:
lda #'.' ; otherwise, we need a decimal point...
jsr _scr_putc_active
- lda remainder
+ lda remainder ; remainder is 0..(_hz-1), scale to 100ths of a sec.
ldx #0
- jsr mulax10
- jsr mulax10
+ jsr mulax10 ; convenient cc65 runtime routine...
+ jsr mulax10 ; AX now remainder * 100
sta acc16
stx acc16+1
- jsr divbyhz ; remainder /= hz
- lda acc16
+ jsr divbyhz ; acc16 = remainder / hz
+ lda acc16 ; acc16 range is 0..99 (ignore hi byte)
cmp #$0a ; does it need a leading zero?
bcs @no_0
lda #'0'
@@ -45,6 +45,11 @@ _print_jif_sec:
ldx acc16+1
jmp _scr_act_printnum ; print it, we're done
+; NOTE: if we wanted to, we could round, by checking the high bit
+; of remainder and adding one to acc16 before printing. not going
+; to bother for now, making it look more accurate won't make it
+; really *be* more accurate.
+
; divide 16-bit a/x by 8-bit _hz.
; result in acc16, remainder in remainder.
divbyhz: