参数:(dh)= 行号,(dl)= 列号,(cl)= 颜色,ds:si指向字符串首地址
以上中断例程安装成功后,对下面的程序进行单步跟踪,尤其注意观察int、iret指令执行前后cs、ip和栈中的状态
assume cs:code data segment db "welcome to masm!",0 data ends code segment start: mov dh,10 mov dl,10 mov cl,2 mov ax,data mov ds,ax mov si,0 int 7ch; mov ax,4c00h int 21h code ends end start ;------------int 7ch中断例程安装------------------------------------ assume cs:code code segment start: mov ax,cs mov ds,ax mov si,offset disp ;设置ds:si指向源地址 mov ax,0 mov es,ax mov di,200h ;设置es:di指向目的地址 mov cx,offset dispend - offset disp;设置cx为传输长度 cld rep movsb mov ax,0 ;设置中断向量表 mov es,ax mov es:[7ch*4],200h mov es:[7ch*4+2],0 mov ax,4c00h int 21h disp: push ax push cx push es push si push di mov ax,0b800h mov es,ax mov al,160 dec dh mul dh dec dl add dl,dl mov dh,0 add ax,dx mov di,ax ;设置es:di指向显存空间要求位置 s: mov al,ds:[si] cmp al,0 je ok mov es:[di],al mov es:[di+1],cl inc si add di,2 jmp short s ok: pop di pop si pop es pop cx pop ax iret dispend:nop code ends end start