1CH大約每秒中斷182次一個中斷駐留程序?
這個完全是按照題目要求寫的cursor equ 45h
attrib equ 2fh
code segment
assume cs:code,ds:code
start:
jmp go
oldcur dw ?
old1c dw 2 dup(?)
newint1c:
pushf
call dword ptr cs:old1c
push ax
push bx
push cx
push dx
xor bh,bh
mov ah,3
int 10h
mov cs:oldcur,dx
mov ah,2
xor bh,bh
mov dx,cursor
int 10h
mov ah,2ch
int 21h ;讀取系統時鐘
;-------------------------
;ch = hour
;cl = minute
;dh = second
;dl = 1/100 seconds
;------------------------
push dx
push cx;show hour
pop bx
push bx
call showhour
call showcolon;show minute
pop bx
call showother
call showcolon;show second
pop bx
call showother
mov dx,cs:oldcur
mov ah,2
xor bh,bh
int 10h
pop dx
pop cx
pop bx
pop ax
iretshowhour proc near
push bx
pop ax
shr ax,8
mov bl,10
div bl
;-------------------------
;ax = shang
;dx = yushu
;------------------------
add al,30h
call show
call curmove
mov ax,dx
add al,30h
call show
call curmove
ret
showhour endpshowother proc near
push bx
pop ax
shl ax,8
shr ax,8
mov bl,10
div bl
;-------------------------
;ax = shang
;dx = yushu
;------------------------
add al,30h
call show
call curmove
mov ax,dx
add al,30h
call show
call curmove
ret
showother endp
showcolon proc near
mov al,':'
call show
call curmove
ret
showcolon endpcurmove proc near
push ax
push bx
push cx
push dx
mov ah,3
mov bh,0
int 10h
inc dl
mov ah,2
int 10h
pop dx
pop cx
pop bx
pop ax
ret
curmove endpshow proc near
push ax
push bx
push cx
mov ah,09h
mov bx,attrib
mov cx,1
int 10h
pop cx
pop bx
pop ax
ret
show endpgo:
push cs
pop ds
mov ax,351ch ;取中斷向量
int 21h
mov old1c,bx ;保存原中斷向量
mov bx,es
mov old1c+2,bx
mov dx,offset newint1c ;置新的中斷向量
mov ax,251ch
int 21h
mov dx,offset go
sub dx,offset start
mov cl,4
shr dx,cl
add dx,11h
mov ax,3100h ;結束并駐留
int 21h
code ends
end start