鸿 网 互 联 www.68idc.cn

王爽汇编语言第二版学习笔记之实验15

来源:互联网 作者:佚名 时间:2015-08-13 07:37
1 assume cs: code, ss: stack, ds: data 2 stack segment 3 db 128 dup ( 0 ) 4 stack ends 5 6 data segment 7 dw 0 , 0 8 data ends 9 10 code segment 11 start: 12 mov ax,stack 13 mov ss,ax 14 mov sp, 128 15 16 mov ax,data 17 mov ds,ax 18 19 mov
 1 assume cs:code,ss:stack,ds:data
 2 stack segment
 3     db 128 dup (0)
 4 stack ends
 5 
 6 data segment
 7     dw 0,0
 8 data ends
 9 
10 code segment
11 start:
12     mov ax,stack
13     mov ss,ax
14     mov sp,128
15     
16     mov ax,data
17     mov ds,ax
18     
19     mov ax,0
20     mov es,ax
21     
22     push es:[9*4]
23     pop ds:[0]
24     push es:[9*4+2]
25     pop ds:[2]
26     cli
27     mov word ptr es:[9*4],offset itt9
28     mov word ptr es:[9*4+2],cs
29     sti
30     
31     call delay
32     
33     mov ax,0
34     mov es,ax
35     
36     push ds:[0]
37     pop es:[9*4]
38     push ds:[2]
39     pop es:[9*4+2]
40     
41     mov ax,4c00h
42     int 21h
43     
44     
45 delay:
46     push ax
47     push dx
48     mov dx,0FFFFH
49     mov ax,0FFFH
50 s1:
51     sub ax,1
52     sbb dx,0
53     cmp ax,0
54     jne s1
55     cmp dx,0
56     jne s1
57     pop dx
58     pop ax
59     ret
60     
61     
62     
63 itt9:
64     push ax
65     push bx
66     push es
67     push cx
68     
69 
70     
71     in al,60h
72     
73     pushf
74     call dword ptr ds:[0]
75     
76     cmp al,9EH
77     jne ok
78 
79     
80     mov ax,0b800h
81     mov es,ax
82     mov bx,0
83     mov cx,2000
84 xh1:
85     mov byte ptr es:[bx],'A'
86     mov byte ptr es:[bx+1],02H
87     add bx,2
88     loop xh1
89 ok:
90     pop cx
91     pop es
92     pop bx
93     pop ax
94     iret
95 code ends
96 end start

 

网友评论
<