home *** CD-ROM | disk | FTP | other *** search
- ;// exact timer routines, nothing special, no copyright! ;)
-
- .386
- .model flat,prolog
- locals
-
- .data
- tmOldTimer df 0
- tmDataSeg dw 0
- tmTicker dd 0
-
- .code
-
- tmTimerHandler proc
- push ds
- mov ds,cs:tmDataSeg
- add ds:tmTicker,65536
- pop ds
- jmp cs:tmOldTimer
- endp
-
- public tmInit_
- tmInit_ proc
- mov tmDataSeg,ds
- mov tmTicker,65536
-
- push es
- mov ax,3508h
- int 21h
- mov dword ptr tmOldTimer+0,ebx
- mov word ptr tmOldTimer+4,es
- pop es
-
- push ds
- mov ax,2508h
- push cs
- pop ds
- mov edx,offset tmTimerHandler
- int 21h
- pop ds
-
- mov al,34h
- out 43h,al
- xor al,al
- out 40h,al
- out 40h,al
- ret
- endp
-
-
- public tmClose_
- tmClose_ proc
- push ds
- mov ax,2508h
- lds edx,tmOldTimer
- int 21h
- pop ds
- ret
- endp
-
- public tmGetTimer_
- tmGetTimer_ proc
- pushf
- cli
- xor eax,eax
- out 43h,al
- in al,40h
- mov ah,al
- in al,40h
- xchg ah,al
- neg eax
- add eax,tmTicker
- popf
- ret
- endp
-
- end
-