回 帖 发 新 帖 刷新版面

主题:取系统时间问题

我主要是想实现:
首先取出系统的时间,然后每隔一秒再显示出时间,但我对中断还不是很理解!因为主要是要在系统定时器上修改它的中断处理程序!int 1ch,请高手帮我看下我程序中哪里出现了问题!谢谢!!!
main    proc    far
start:
    push    ds
    sub    ax,ax
    push    ax

    mov    ax,data
    mov    ds,ax
    mov    ax,sta
    mov    ss,ax
    mov    sp,offset tos

;save old interrupt vector
    mov    al,1ch
    mov    ah,35h
    int    21h
    push    es
    push    bx
    push    ds
    
;set new interrupt vector
    mov    dx,offset gtime
    mov    ax,seg gtime
    mov    ds,ax
    mov    al,1ch
    mov    ah,25h
    int    21h

    pop    ds
    in    al,21h
    and     al,11111110b
    out    21h,al
    sti

    mov    di,20000
delay:    mov    si,30000
delay1:    dec    si
    jnz    delay1
    dec    di
    jnz    delay

;restore old interrupt vector
    pop    dx
    pop    ds
    mov    al,1ch
    mov    ah,25h
    int    21h

    ret    
main    endp
;******************************************************************************
gtime    proc    near
    push    ds
    push    ax
    push    cx
    push    dx

    mov    ax,data
    mov    ds,ax
    
    dec    count
    jnz    exit
    
    mov    ah,2ch
    int    21h
    mov    count,18
exit:
    cli    
    pop    dx
    pop    cx
    pop    ax
    pop    ds

    iret
gtime    endp

回复列表 (共2个回复)

沙发

可以不改中断用循环加上延时不就可以了

板凳

延时
mov ah,86
mov cx,0
mov dx,1000
int 15h
取时间用1ah,2
显示时间用直接写缓冲区(中断处理程序)或用中断10h(一般程序)

我来回复

您尚未登录,请登录后再回复。点此登录或注册