编程:用7ch中断例程完成jmp near ptr s指令的功能,用bx向中断例程传送转移位移。
应用举例:在屏幕的第12行显示data段中,以0结尾的字符串。
assume cs:code data segment db 'conversation',0 data ends code segment start: mov ax,cs mov ds,ax mov si,offset nr mov ax,0 mov es,ax mov di,200h mov cx,offset nrend-offset nr cld rep movsb ;以上9句为安装中断例程 mov word ptr es:[7ch*4],200h mov word ptr es:[7ch*4+2],0 ;以上2句为设置中断向量 mov ax,data mov ds,ax mov si,0 mov ax,0b800h mov es,ax mov di,12*160 s: cmp byte ptr [si],0 je ok mov al,[si] mov es:[di],al inc si add di,2 mov bx,offset s-offset ok int 7ch ok: mov ax,4c00h int 21h nr: push bp ;定义中断例程[开始] mov bp,sp add [bp+2],bx nrret: pop bp iret ;中断返回指令 nrend: nop ;定义中断例程[结束] code ends end start