-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc13-1.asm
87 lines (62 loc) · 1.19 KB
/
c13-1.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
assume cs:code,ds:data,ss:stack
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;initial stack
call cpy_new_int0
call set_new_int0
int 0
mov ax,4c00h
int 21h
;=============change the int 0 cs:ip================
set_new_int0:
mov bx,0
mov es,bx
cli
mov word ptr es:[0*4],7e00h
mov word ptr es:[0*4+2],0
sti
ret
;===================keyboard interupt===============
new_int0:
push bx
push cx
push dx
push es
mov bx,0b800h
mov es,bx
mov bx,0
mov cx,2000
mov dl,'!'
show_asc: mov es:[bx],dl
add bx,2
loop show_asc
pop es
pop dx
pop cx
pop bx
iret
new_int0_end: nop
;===============modified int 0===================
cpy_new_int0:
mov bx,cs
mov ds,bx
mov si,offset new_int0;set source
mov bx,0
mov es,bx
mov di,7e00h;set determination--which can save code securily
mov cx,offset new_int0_end - new_int0
cld
rep movsb;cpy the code
ret
;==================================
show_char:
ret
code ends
end start