鸿 网 互 联 www.68idc.cn

王爽《汇编语言》实验15:安装新的int 9中断例程 解答

来源:互联网 作者:佚名 时间:2015-10-09 05:51
assume cs:codestack segmentdb 128 dup(0)stack endscode segmentstart:mov ax,stackmov ss,axmov sp,128mov ax,codemov ds,axmov ax,0mov es,axmov si,offset int9mov di,204hmov cx,offset int9end-offset int9cldrep movsbpush es:[9*4]pop es:[200h]pus
assume cs:code

stack segment
	db 128 dup(0)
stack ends

code segment
start:
	mov ax,stack
	mov ss,ax
	mov sp,128

	mov ax,code
	mov ds,ax

	mov ax,0
	mov es,ax

	mov si,offset int9
	mov di,204h
	mov cx,offset int9end-offset int9
	cld
	rep movsb

	push es:[9*4]
	pop es:[200h]
	push es:[9*4+2]
	pop es:[202h]

	cli ;禁止中断,防止赋值时有中断发生,产生错误
	mov word ptr es:[9*4],204h
	mov word ptr es:[9*4+2],0
	sti ;允许中断

	mov ax,4c00h
	int 21h

int9:
	push ax
	push bx
	push cx
	push es

	in al,60h

	pushf
	call dword ptr cs:[200h]

	cmp al,9Eh ;1Eh+80h
	jne int9ret

	mov ax,0b800h
	mov es,ax
	mov bx,0
	mov cx,2000
	s:
	mov byte ptr es:[bx],'A'
	add bx,2
	loop s

	int9ret:
	pop es
	pop cx
	pop bx
	pop ax
	iret
int9end: nop
code ends
end start


网友评论
<