assume cs:code,ss:stack stack segment db 128 dup (0) stack ends ;===============install new int7ch code segment start: mov ax,code mov ds,ax mov si,offset newint7ch mov ax,0 mov es,ax mov di,200h mov cx,offset newint7ch_end-offset newint7ch cld rep movsb cli mov word ptr es:[7ch*4],200h mov word ptr es:[7ch*4+2],0 sti ;-------------------------tset newint7ch mov ah,0 int 7ch call delay mov ah,1 mov al,2 int 7ch call delay mov ah,2 mov al,6 int 7ch call delay mov ah,3 int 7ch call delay mov ax,4c00h int 21h delay: push ax push dx mov dx,50h mov ax,0 delays: sub ax,1 sbb dx,0 cmp ax,0 jne delays cmp dx,0 jne delays pop dx pop ax ret ;============================set newint7ch sub table newint7ch: jmp short set table dw offset sub1 - offset newint7ch + 200h dw offset sub2 - offset newint7ch + 200h dw offset sub3 - offset newint7ch + 200h dw offset sub4 - offset newint7ch + 200h set: push bx cmp ah,3 ja sret mov bl,ah mov bh,0 add bx,bx add bx,offset table - offset newint7ch + 200h call word ptr cs:[bx] sret: pop bx iret ;========================Subroutine sub1: push bx push cx push es mov bx,0b800h mov es,bx mov bx,0 mov cx,2000 sub1s: mov byte ptr es:[bx],' ' add bx,2 loop sub1s pop es pop cx pop bx ret ;------------------------ sub2: push bx push cx push es mov bx,0b800h mov es,bx mov bx,1 mov cx,2000 sub2s: and byte ptr es:[bx],11111000b or es:[bx],al add bx,2 loop sub2s pop es pop cx pop bx ret ;---------------------- sub3: push bx push cx push es mov cl,4 shl al,cl mov bx,0b800h mov es,bx mov bx,1 mov cx,2000 sub3s: and byte ptr es:[bx],10001111b or es:[bx],al add bx,2 loop sub3s pop es pop cx pop bx ret ;----------------------- sub4: push cx push es push ds push si push di mov si,0b800h mov es,si mov ds,si mov si,160 mov di,0 cld mov cx,24 sub4s: push cx mov cx,80 rep movsw pop cx loop sub4s mov cx,80 mov si,0 sub4s1: mov byte ptr es:[160*24+si],' ' add si,2 loop sub4s1 pop di pop si pop ds pop es pop cx ret newint7ch_end: nop code ends end start
文章来源: 王爽《汇编语言》实验16