-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtimestamp.asm
More file actions
41 lines (32 loc) · 968 Bytes
/
timestamp.asm
File metadata and controls
41 lines (32 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
global _start
%define RTCaddress 0x70
%define RTCdata 0x71
section .text:
_start:
mov al,10 ;Get RTC register A
out RTCaddress, al
in al, RTCdata
test al, 0x80 ; Is update in progress?
jne _start ; yes, wait
mov al, 0 ; Get seconds (00 to 59)
out RTCaddress, al
in al, RTCdata
mov [RTCtimeSecond],al
mov al, 0x02 ; Get minutes (00 to 59)
out RTCaddress, al
in al, RTCdata
mov al, 0x04 ; Get hours (see notes)
out RTCaddress, al
in al, RTCdata
mov al, 0x07 ; Get day of month (01 to 31)
out RTCaddress, al
in al, RTCdata
mov al, 0x08 ; Get month (01 to 12)
out RTCaddress, al
in al, RTCdata
mov al, 0x09 ; Get year (00 to 99)
out RTCaddress, al
in al, RTCdata
mov eax, 1 ; sys_exit system call
mov ebx, 0 ; exit status is 0
int 0x80 ; perform system call