File: ztime.asm

package info (click to toggle)
zsnes 1.510%2Bbz2-8
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 9,068 kB
  • ctags: 12,735
  • sloc: asm: 97,550; pascal: 44,227; ansic: 25,523; cpp: 7,803; sh: 2,803; makefile: 159
file content (80 lines) | stat: -rw-r--r-- 1,996 bytes parent folder | download | duplicates (5)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
;
;http://www.zsnes.com
;http://sourceforge.net/projects/zsnes
;https://zsnes.bountysource.com
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;version 2 as published by the Free Software Foundation.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

%include "macros.mac"

EXTSYM GetTime,GetDate,GetLocalTime
EXTSYM SystemTimewHour,SystemTimewMinute,SystemTimewSecond

SECTION .text

NEWSYM Get_Time
    pushad
    call GetTime
    mov [TempVarSeek],eax
    popad
    mov eax,[TempVarSeek]
    ret

NEWSYM Get_TimeDate
    pushad
    call GetDate
    mov [TempVarSeek],eax
    popad
    mov eax,[TempVarSeek]
    ret

NEWSYM Get_Date
    ; dl = day, dh = month, cx = year
    pushad
    call GetDate
    mov [TempVarSeek],eax
    popad
    mov eax,[TempVarSeek]
    movzx edx,al ;Move day into edx, day is in BCD
    shr edx,4    ;Chop off the second digit
    imul edx,10  ;Multiply first digit by 10, since we want decimal
    and al,0xF   ;Remove first BCD digit
    add dl,al    ;Add second digit to first*10
    mov dh,ah    ;Copy month
    ;Year Calculation
    shr eax,16
    movzx ecx,al
    shr ecx,4
    imul ecx,10
    and al,0xF
    add cl,al
    add cx,1900
    ret

NEWSYM GetTimeInSeconds
    call GetLocalTime
    movzx eax,word[SystemTimewHour]
    mov ebx,60
    mul ebx
    movzx ebx,word[SystemTimewMinute]
    add eax,ebx
    mov ebx,60
    mul ebx
    movzx ebx,word[SystemTimewSecond]
    add eax,ebx
    ret

SECTION .data
TempVarSeek dd 0