王爽的作业题改写0类型中断并驻留,好心人帮忙看看为什么运行后死机啊!
我用DEBUG看了看,发现这个代码确实改写了CS:IP=0:0,并且指向了自定义的地址0:200H处,0:200处也有驻留的代码,但一运行就死机....,好心人帮忙看看...;改写0号中断并驻刘,MASMPLUS编释
ASSUME CS:CODE
CODE SEGMENT
START: nop
nop
nop
nop
MOV AX,CS ;这些是复制代码到指定空间
MOV DS,AX
MOV SI,OFFSET INT0CODE
XOR AX,AX
MOV ES,AX
MOV DI,200H
MOV CX,OFFSET INT0CODEEND-INT0CODE+1
CLD
REP MOVSB
XOR AX,AX ;改写中断向量表
MOV ES,AX
MOV WORD PTR ES:[0*4],200H
MOV WORD PTR ES:[0*4+2],0H
MOV AX,CS ;这些是为了测试字符显示正常于否
MOV DS,AX
MOV SI,OFFSET OVERCHAR
MOV AX,0B800H
MOV ES,AX
MOV DI,12*160+36*2
MOV CX,OEND-OVERCHAR+1
MOV AX,0CA00H
S2: MOV AL,[SI]
MOV ES:[DI],Ax
INC SI
ADD DI,2
LOOP S2
mov ah,10
int 21h
MOV AX,4C00H
INT 21H
INT0CODE:
cli
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH SI
PUSH ES
PUSH DS
MOV AX,CS
MOV DS,AX
MOV si,offset OVERCHAR
;mov si,ax
MOV AX,0B800H
MOV ES,AX
xor di,di
MOV CX,offset OEND-offset OVERCHAR
MOV AX,0CA00H
S: MOV AL,[SI]
MOV ES:[DI],ax
INC SI
ADD DI,2
LOOP S
jmp short SS1
OVERCHAR DB 'Overflow...VA'
OEND DB 'R'
SS1: POP DS
POP ES
POP SI
POP DI
POP DX
POP CX
POP BX
POP AX
sti
; mov ax,1068h
; push ax
; mov ax,0a7h
; push ax
; ret
INT0CODEEND: IRET
nop
nop
CODE ENDS
END START