编写80H号中断处理程序。中断发生时,显示0~9十个数字!
发布网友
发布时间:2024-05-06 04:14
我来回答
共1个回答
热心网友
时间:2024-06-02 09:00
.model small
.stack
.code
mess3 db 0ah,0dh,'Conrinue or Quit(c/q)? $'
main proc far
start:
mov ax,@code
mov ds,ax
;取出原中断向量
mov al,80h
mov ah,35h
int 21h
push es
push bx
push ds
;设置新的中断向量
mov dx,offset showerr
mov ax,seg showerr
mov ds,ax
mov ax,0
mov es,ax
mov bx,80h
mov cl,2
shl bx,cl
mov word ptr es:[bx],dx
mov word ptr es:[bx+2],ds
;应用部分
conti:
mov ah,9
int 21h
int 80h
mov dx,offset mess3
mov ah,1
int 21h
cmp al,'c'
je conti
quit:
pop ds
pop bx
pop es
mov al,80h
mov ah,25h
int 21h
mov ax,4c00h
int 21h
main endp
;中断子程序
showerr proc near
showbegin:jmp short show_str
a1 db '0 1 2 3 4 5 6 7 8 9'
a2 db 0
show_str:
mov ax,@code
mov ds,ax
sti
mov dh,22
mov dl,24
mov bl,0f0h
mov si,offset a1
mov ax,0b800h
mov es,ax
mov ax,160
mul dh
mov di,ax
sal dl,1
mov dh,0
add di,dx
mov cx,a2-a1
let1:
mov al,[si]
mov es:[di],al
mov byte ptr es:[di+1],bl
inc si
inc bh
add di,2
loop let1
mov ah,2
iret
showend:nop
showerr endp
end start