汇编语言学习:实验十二

    编写0号中断的处理程序,是的在除法溢出发生时,在屏幕中间显示字符串“divide error!”,然后返回到DOS

    要求,仔细跟踪调试,在理解整个过程之前,不要进行后面课程的学习。

上代码:
 


assume cs:code

code segment
start:
        mov ax,cs
        mov ds,ax
        mov si,offset do
        mov ax,0
        mov es,ax
        mov di,200h
        mov cx,offset doend-offset do
        cld
        rep movsb
        mov word ptr es:[0],200h
        mov word ptr es:[2],0
        mov ax,0ffffh
        mov bx,1
        div bx
        mov ax,4c00h
        int 21h

do:
        jmp short dostart
        db "divide error!",0

dostart:
        mov ax,cs
        mov ds,ax
        mov si,202h
        mov ax,0b800h
        mov es,ax
        mov di,12*160+36*2

        s:
                mov al,[si]
                mov ch,0
                mov cl,al
                jcxz exit
                mov es:[di],ax
                inc si
                add di,2
                loop s
        exit:
                nop

        mov ax,4c00h
        int 21h

 doend:
        nop

code ends
end start

 

你可能感兴趣的:(汇编语言学习)