source: trunk/BOOTCODE/REGULAR/TIMER.ASM@ 43

Last change on this file since 43 was 30, checked in by Ben Rietbroek, 15 years ago

AiR-BOOT v1.07 -- As released with eCS v2.1. [2011-05-06]
Signature-date: 2006-03-13. (incorrect)
Trunk contains buildable v1.07 version as distributed with eCS v2.1.
Directory 'tags' contains v1.06 & v1.07 reference versions
built for all languages. Note that language ID for 'Dutch' changed
from 'DT' to 'NL' in v1.07 and that the v1.06 reference version also
uses 'NL' for 'Dutch'.
Also note that helper programs like the installer and setaboot are
are only modified for the OS/2 versions in v1.07.
The signature-date for v1.07 incorrectly states the same
date as for v1.06. The signature-version is correct.
Removed other binaries. (cd-rom images, old releases, etc.)
The tags serve as reference versions:

  • v1.06: rebuilt from source. (tags/v1.06r)
  • v1.07: built as released with eCS v2.1. (tags/v1.07r)
File size: 3.3 KB
Line 
1; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
2;
3; This file is part of AiR-BOOT
4;
5; AiR-BOOT is free software: you can redistribute it and/or modify it under
6; the terms of the GNU General Public License as published by the Free
7; Software Foundation, either version 3 of the License, or (at your option)
8; any later version.
9;
10; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
11; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
12; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13; details.
14;
15; You should have received a copy of the GNU General Public License along with
16; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
17;
18;---------------------------------------------------------------------------
19; AiR-BOOT / TIMER
20;---------------------------------------------------------------------------
21
22IFDEF ModuleNames
23DB 'TIMER',0
24ENDIF
25
26; This here is one of the rare cases that I'm using DIV and MUL opcodes. I
27; could have coded around them in here as well, but I was too lazy. Most of
28; the time, I'm not using them. If you want to look at something "leet", look
29; at SPECIAL\FX.asm =)
30
31; In: Nothing
32; Out: DX:AX - Current TimerTicCount
33TIMER_GetTicCount Proc Near Uses ds si
34 push 0040h
35 pop ds
36 mov si, 006Ch
37 mov ax, word ptr ds:[si]
38 mov dx, word ptr ds:[si+2]
39 ret
40TIMER_GetTicCount EndP
41
42; In: AL - Timer-Tics to wait
43; Out: Nothing
44TIMER_WaitTicCount Proc Near Uses ax bx dx
45 ;movzx bx, al
46 mov bl,al
47 mov bh,0
48
49 call TIMER_GetTicCount
50 add bx, ax ; BX - Required lower Tic
51 TWTC_Loop:
52 call TIMER_GetTicCount
53 cmp ax, bx
54 jb TWTC_Loop
55 ret
56TIMER_WaitTicCount EndP
57
58; In: AL - Seconds
59; Out: AX - Tics
60TIMER_TranslateSecToTic Proc Near Uses bx dx
61 or al, al
62 jz TTSTT_Zerod
63 xor ah, ah
64 mov dl, 5
65 div dl ; Seconds : 5
66 mov bh, ah
67 xor ah, ah
68 mov bl, 91
69 mul bl ; Result * 91
70 mov dx, ax
71 ;movzx ax, bh
72 mov al,bh
73 mov ah,0
74
75 mov bl, 18
76 mul bl ; Remainder * 18
77 add ax, dx ; Add both together...
78 TTSTT_Zerod:
79 ret
80TIMER_TranslateSecToTic EndP
81
82; In: AX - Tics
83; Out: AL - Seconds
84TIMER_TranslateTicToSec Proc Near Uses bx dx
85 or ax, ax
86 jz TTTTS_Overflow
87 cmp ax, 23295
88 ja TTTTS_Overflow
89 mov dl, 91
90 div dl ; Tics : 91
91 mov dh, al
92 ;movzx ax, ah
93 mov al,ah
94 mov ah,0
95
96 mov dl, 18
97 div dl ; Remainder : 18
98 xor ah, ah ; We dont need that remainder
99 xchg dh, al
100 mov bl, 5
101 mul bl ; Result * 5
102 ;movzx dx, dh
103 mov dl,dh
104 mov dh,0
105
106 add ax, dx ; Add both together...
107 ret
108 TTTTS_Overflow:
109 xor ax, ax
110 ret
111TIMER_TranslateTicToSec EndP
Note: See TracBrowser for help on using the repository browser.