diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-04-09 06:19:28 -0400 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-04-09 06:19:49 -0400 |
| commit | f3af088deabc1c3f90d22c43dcda9c5b8344bc86 (patch) | |
| tree | 6fda6c8161aac8828a69dc1df1ff8bd9b701ed6e /src/jifsec.s | |
| parent | 9d460b1c0cb573fc56799de236a1a8dd4cc6cdc0 (diff) | |
| download | fujinet-chat-f3af088deabc1c3f90d22c43dcda9c5b8344bc86.tar.gz | |
Rewrite the guts of print_ping_time() yet again. 7593 bytes free.
Diffstat (limited to 'src/jifsec.s')
| -rw-r--r-- | src/jifsec.s | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/jifsec.s b/src/jifsec.s index 4f3d3c8..15ae972 100644 --- a/src/jifsec.s +++ b/src/jifsec.s @@ -15,10 +15,32 @@ _hz = $f0 ; must agree with timers.h! .import _scr_act_printnum, _scr_putc_active + .import _read_rtclok, _a2uint .import mulax10 ; extern void print_jif_sec(unsigned int jiffies); - .export _print_jif_sec + .export _print_jif_sec, _calc_ping_time + +_calc_ping_time: + jsr _a2uint + sta acc16 + stx acc16+1 ; acc16 = timestamp in ping response + jsr _read_rtclok ; A/X = low 15 bits of RTCLOK + cpx acc16+1 ; has RTCLOK rolled over? + bcs @clok_ok + pha + txa + ora #$80 + tax + pla +@clok_ok: + sec + sbc acc16 + pha + txa + sbc acc16+1 + tax + pla ; A/X now holds "now" minus timestamp _print_jif_sec: jsr divbyhz |
