汇编试验十三:编写、应用中断例程

int 中断相当于一个call指令的一个子程序,同样要将中断例程放到空闲中断位置;安装到指定int 中断,进行调用;

(1)int 7ch中断,平方功能;

效果:

Source Code:

assume cs:code

code segment
start:
    mov ax,cs
    mov ds,ax
    mov si,offset sqr
    mov ax,0
    mov es,ax
    mov di,200h
    mov cx,offset sqrend - offset sqr
    cld
    rep movsb

    mov ax,0
    mov es,ax
    mov word ptr es:[7ch*4],200h
    mov word ptr es:[7ch*4+2],0

    mov ax,4c00h
    int 21h

    sqr:
        mul ax
        iret
    sqrend: nop
code ends
end start
View Code
assume cs:code

code segment
start:
    mov ax,2
    int 7ch
    mov ax,4c00h
    int 21h
code ends
end start
View Code
原文地址:https://www.cnblogs.com/TreeDream/p/7045473.html