-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex15.asm
108 lines (82 loc) · 1.32 KB
/
ex15.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
100
101
102
103
104
105
106
107
assume cs:code,ss:stack,ds:data
data segment
db 128 dup(0)
data ends
stack segment stack
db 128 dup(0)
stack ends
code segment
start: mov ax,stack
mov ss,ax
mov sp,128
call cpy_new_int9
call sav_old_int9
call set_new_int9
t: mov ax,1000h
jmp t
mov ax,4c00h
int 21h
;=================================
set_new_int9:
mov bx,0
mov es,bx
cli
mov word ptr es:[9*4],7e00h
mov word ptr es:[9*4+2],0
sti
ret
;=================================
sav_old_int9:
mov bx,0
mov es,bx
cli
push es:[9*4]
pop es:[200h]
push es:[9*4+2]
pop es:[202h]
sti
ret
;=================================
new_int9:
push ax
in al,60h
pushf
call dword ptr cs:[200h]
cmp al,9eh
jne int9Ret
call set_srceen_letter
int9Ret: pop ax
iret
set_srceen_letter:
push bx
push cx
push dx
push es
mov bx,0b800h
mov es,bx
mov bx,0
mov dl,'A'
setScreenLetter:
mov es:[bx],al
add bx,2
loop setScreenLetter
pop es
pop dx
pop cx
pop bx
ret
new_int9_end: nop
;==================================
cpy_new_int9:
mov bx,cs
mov ds,bx
mov si,offset new_int9
mov bx,0
mov es,bx
mov di,7e00h
mov cx,offset new_int9_end - offset new_int9
cld
rep movsb
ret
code ends
end start