From 4ae461b9332f5642df85b8c204d88601f6a1adef Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 8 Apr 2026 06:13:43 -0400 Subject: Commentary in jifsec.s --- src/jifsec.s | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') 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: -- cgit v1.2.3