课本上的0号中断程序
;substitute int 0
;when div 0 happen,display "divided by 0!program will be terminated!" ,and return to console
data segment
data ends
stack segment
stack ends
code segment
assume cs:code,ds:data,ss:stack
start:
mov ax,code
mov ds,ax
mov ax,0000h
mov es,ax
mov di,0200h ;copy it to area of blank int table
mov si,offset stay ;ISR
mov cx,offset stay_end - offset stay;length of code
rep movsb
;set int 0
mov word ptr es:0000h,0200h
mov word ptr es:0002,0
mov ax,4c00h
int 21h
stay:
jmp isr ;*********************注意这条语句后面多了一条nop指令,请看后面的debug 数据
db "divided by 0!program will be terminated!$"
isr:
mov ax,cs
mov ds,ax
mov si,202h
mov ax,0b800h
mov es,ax
mov di,12*160+36*2
mov cx,offset isr - offset stay +2
;s: mov al,[si]
; mov es:[di],al
; inc si
; add di,2
; loop s
mov dx,0203h
mov ax,0
mov ds,ax
mov ah,09h
int 21h
mov ax,4c00h
int 21h
stay_end:nop
code ends
end start
;************debug -u 0000:0200 结果*************
-u 0000:0200
0000:0200 EB2A JMP 022C
0000:0202 90 NOP ;***********************这句怎么来得?
0000:0203 64 DB 64 ;‘d'
0000:0204 69 DB 69 ;'i'
0000:0205 7669 JBE 0270
0000:0207 64 DB 64
0000:0208 65 DB 65
0000:0209 64 DB 64
0000:020A 206279 AND [BP+SI+79],AH
0000:020D 2030 AND [BX+SI],DH
0000:020F 217072 AND [BX+SI+72],SI
0000:0212 6F DB 6F
0000:0213 67 DB 67
0000:0214 7261 JB 0277
0000:0216 6D DB 6D
0000:0217 207769 AND [BX+69],DH
0000:021A 6C DB 6C
0000:021B 6C DB 6C
0000:021C 206265 AND [BP+SI+65],AH
0000:021F 207465 AND [SI+65],DH
-
后面的数据就省略了。
这个nop指令怎么出来的?哪位来帮忙捉鬼 |