;; GETTIME.ASM--Return number of clock ticks since midnight. If ;; a second midnight has passed, up time by 1800b0h so that times ;; around midnight will compare properly. ;; ;; usage: ;; EXTRN GetTime : NEAR ;; call GetTime ;; ;; returns with time in dx:ax ;; ax, dx, and es are destroyed ;; ;; Library source text from "Assembly Language for the IBM PC Family" by ;; William B. Jones, (c) Copyright 1992, 1997, Scott/Jones Inc. ;; .MODEL SMALL BIOSData SEGMENT AT 40h ORG 6ch Clock DD ? ; Clock ticks since midnight (18.2 ticks/second) NextDay DB ? ; if non-zero, indicates midnight has passed and ; Clock reset to 0 Lo24Hours EQU 00B0h Hi24Hours EQU 18h ; 1800B0h ticks/24 hours BIOSData ENDS .CODE PUBLIC GetTime GetTime PROC mov ax, BIOSData mov es, ax ASSUME es:BIOSData cli mov ax, WORD PTR Clock mov dx, WORD PTR Clock+2 cmp NextDay, 0 sti je Done add ax, Lo24Hours adc dx, Hi24Hours Done: ret GetTime ENDP END