-
Notifications
You must be signed in to change notification settings - Fork 26
/
Time-Program.asm
80 lines (63 loc) · 1.31 KB
/
Time-Program.asm
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
;##################################################
;# 8086 Program to display Time in hh/mm/ss format#
;# Author: kingspp #
;##################################################
;Used INTERRUPTS
;AH=2CH //Gets the system date
;AH=02h // Displays the ascii value in DOS Prompt
;For 2CH
; Hours is in CH
; Minutes is in CL
; Seconds is in DH
;Declaration Part
.MODEL SMALL
.DATA
.CODE
START: MOV AX,@DATA
MOV DS,AX
;Hour Part
HOUR:
MOV AH,2CH ; To get System Time
INT 21H
MOV AL,CH ; Hour is in CH
AAM
MOV BX,AX
CALL DISP
MOV DL,':'
MOV AH,02H ; To Print : in DOS
INT 21H
;Minutes Part
MINUTES:
MOV AH,2CH ; To get System Time
INT 21H
MOV AL,CL ; Minutes is in CL
AAM
MOV BX,AX
CALL DISP
MOV DL,':' ; To Print : in DOS
MOV AH,02H
INT 21H
;Seconds Part
Seconds:
MOV AH,2CH ; To get System Time
INT 21H
MOV AL,DH ; Seconds is in DH
AAM
MOV BX,AX
CALL DISP
;To terminate the Program
MOV AH,4CH ; To Terminate the Program
INT 21H
;Display Part
DISP PROC
MOV DL,BH ; Since the values are in BX, BH Part
ADD DL,30H ; ASCII Adjustment
MOV AH,02H ; To Print in DOS
INT 21H
MOV DL,BL ; BL Part
ADD DL,30H ; ASCII Adjustment
MOV AH,02H ; To Print in DOS
INT 21H
RET
DISP ENDP ; End Disp Procedure
END START ; End of MAIN