]> wirehaze git hosting - BOS.git/blob - kernel/krl_incs/time_date.inc

wirehaze git hosting

initial commit
[BOS.git] / kernel / krl_incs / time_date.inc
1 ;----------------------------------------------------------;
2 ; BOS kernel Christoffer Bubach, 2005. ;
3 ;----------------------------------------------------------;
4 ; ;
5 ; functions to print date and time. ;
6 ; ;
7 ;----------------------------------------------------------;
8
9 ;------------------;
10 ; variables ;
11 ;------------------;
12 msg_time db 13,10,' Time: ',0
13 msg_date db 13,10,' Date: ',0
14
15
16 ;------------------------------------------------------;
17 ; date, prints current date and goes back to the ;
18 ; prompt. swedish i.e. normal :) format ;
19 ;------------------------------------------------------;
20 print_date:
21 push eax
22 push ebx
23 push esi
24
25 mov esi, msg_date
26 mov bl, 0x07
27 call print ; text.inc
28 call get_cmos_data ; cmos.inc
29
30 mov al, [century] ; cmos.inc
31 call BCD2ascii
32 push eax
33 mov bh, 0x07
34 mov bl, al
35 call print_char
36 pop eax
37 mov bl, ah
38 call print_char
39
40 mov al, [year]
41 call BCD2ascii
42 push eax
43 mov bl, al
44 call print_char
45 pop eax
46 mov bl, ah
47 call print_char
48
49 mov bl, ':'
50 call print_char
51
52 mov al, [month]
53 call BCD2ascii
54 push eax
55 mov bl, al
56 call print_char
57 pop eax
58 mov bl, ah
59 call print_char
60
61 mov bl, ':'
62 call print_char
63
64 mov al, [day]
65 call BCD2ascii
66 push eax
67 mov bl, al
68 call print_char
69 pop eax
70 mov bl, ah
71 call print_char
72
73 pop esi
74 pop ebx
75 pop eax
76 ret
77
78
79 ;------------------------------------------------------;
80 ; time, prints current time and goes back to the ;
81 ; prompt. ;
82 ;------------------------------------------------------;
83 print_time:
84 push eax
85 push ebx
86 push esi
87
88 mov esi, msg_time
89 mov bl, 0x07
90 call print ; text.inc
91 call get_cmos_data ; cmos.inc
92 mov al, [hour] ; cmos.inc
93 call BCD2ascii
94 push eax
95 mov bh, 0x07
96 mov bl, al
97 call print_char
98 pop eax
99 mov bl, ah
100 call print_char
101
102 mov bl, ':'
103 call print_char
104
105 mov al, [minute]
106 call BCD2ascii
107 push eax
108 mov bl, al
109 call print_char
110 pop eax
111 mov bl, ah
112 call print_char
113
114 mov bl, ':'
115 call print_char
116
117 mov al, [second]
118 call BCD2ascii
119 push eax
120 mov bl, al
121 call print_char
122 pop eax
123 mov bl, ah
124 call print_char
125
126 pop esi
127 pop ebx
128 pop eax
129 ret