diff options
Diffstat (limited to '')
| -rw-r--r-- | src/syscall.asm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/syscall.asm b/src/syscall.asm index bd58cc2..e3f0b1b 100644 --- a/src/syscall.asm +++ b/src/syscall.asm @@ -70,6 +70,7 @@ SyscallTable: dw sys_net ; 33 NET dw sys_sleep ; 34 SLEEP dw sys_pollcon ; 35 POLLCON + dw sys_uptime ; 36 UPTIME ; ----------------------------------------------------------------------------- sys_nosys: @@ -257,6 +258,24 @@ sys_yield: ret ; ----------------------------------------------------------------------------- +; sys_uptime(buf=DE) - copy the monotonic 64 Hz tick counter (4 bytes, LE) +; into the caller's buffer. di/ei so the ISR can't split the 32-bit read. +; ----------------------------------------------------------------------------- +sys_uptime: + di + ld hl, wTicks +REPT 3 + ld a, [hl+] + ld [de], a + inc de +ENDR + ld a, [hl] + ld [de], a + ei + xor a + ret + +; ----------------------------------------------------------------------------- ; sys_sleep(B = 1/64-second units) - cooperative delay driven by the DIV timer. ; DIV (FF04) free-runs at 16384 Hz, so 256 ticks = 1/64 s. We accumulate DIV ; deltas across SchedYields (other procs run) until enough units have elapsed. |
