-
Notifications
You must be signed in to change notification settings - Fork 0
/
2011-5.asm
99 lines (95 loc) · 1.38 KB
/
2011-5.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
assume cs: codeseg, ds: dataseg, es: dataseg
dataseg segment
count db 0
seconds db 0
mods db 0; decides display 0 or 1
dataseg ends
codeseg segment
INT_1CH proc near
push ax
push bx
push cx
push dx
mov ax, dataseg
mov ds, ax
sti
inc count
cmp count, 12h
jne exit
inc_sec:
inc seconds
mov al, 0
mov count, al
cmp seconds, 0ah
jne print
change: ; seconds == 10
cmp mods, 0
jne set0
set1:
mov al, 01h
mov mods, al
jmp print
set0:
mov al, 00h
mov mods, al
print:
cmp mods, 00h
jne case1
case0:
mov dl, '0'
mov ah, 02h
int 21h
jmp exit
case1:
mov dl, '1'
mov ah, 02h
int 21h
exit:
cli
pop dx
pop cx
pop bx
pop ax
iret
INT_1CH endp
main proc far
start:
; save old interrupt vector
sub ax, ax
push ax
mov ax, dataseg
mov ds, ax
mov es, ax
mov al, 1ch
mov ah, 35h
int 21h
push es
push bx
; set new interrupt vector
lea dx, INT_1CH
mov ax, seg INT_1CH
push ds; save dataseg
mov ds, ax
mov ah, 25h
mov al, 1ch
int 21h
pop ds; restore ds
;delay
mov cx, 10000
lp1:
push cx
mov cx, 10000
lp2:loop lp2
pop cx
loop lp1
;restore interrupt vector
pop dx
pop ds
mov ah, 25h
mov al, 1ch
int 21h
mov ah, 4ch
int 21h
main endp
codeseg ends
end start