| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 771 人关注过本帖
标题:一个时间驻留程序 有点小错误 哪位大哥帮忙改下 急!!!
只看楼主 加入收藏
yefeng_laixi
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2008-4-14
收藏
 问题点数:0 回复次数:0 
一个时间驻留程序 有点小错误 哪位大哥帮忙改下 急!!!
程序代码:
; TIMER WITH 2 KINDS OF FONT
; FORMAT:
;     TI [n] [d]
;  n: 0-1
;  d: show date

code    segment
    assume  cs:code
    org     100h
begin:  jmp     start
color   db      0ah
numbase dw      3030h
vidoff  dw      0
vidbase dw      0B800h
optp    db      0

setend  label   byte

datechg db      1
btw     db      ':'
hour    db      0
min     db      0
sec     db      0
lastsec db      0
year    db      0
month   db      0
day     db      0

chgit   proc    near
    div     bx
        mov     cs:[si], al
        inc     si
    ret
chgit   endp

showdigit   proc    near
        mov     al, cs:[si]
        xor     ah, ah
    div     bl
    or      ax, cs:numbase-0d0h
    push    ax
    mov     ah, cs:color-0d0h
    stosw
    pop     ax
    mov     al, ah
    mov     ah, cs:color-0d0h
    stosw
        inc     si
    ret
showdigit   endp

twopo   proc    near
        mov     ah, cs:color-0d0h
        mov     al, cs:btw-0d0h
    stosw
    ret
twopo   endp

int08h:
    cmp     ax, 4c4ch
    jnz     cont0
    cmp     bx, 0c4c4h
    jnz     cont0
    xchg    ax, bx
    push    cs
    pop     es
    iret
cont0:
    push    ax
    push    bx
    push    dx
    push    di
        push    si
    push    ds
    push    es

        cld     ; set video address
        mov     ax, cs:vidbase-0d0h
    mov     es, ax
        mov     di, cs:vidoff-0d0h

        xor     ax, ax  ; get time counter
    mov     ds, ax
    mov     ax, ds:[46ch]
        mov     dx, ds:[46eh]
        cmp     ax, 00
        jnz     notchgdate
        cmp     dx, 00
        jnz     notchgdate
        mov     cs:datechg-0d0h, 1
notchgdate:
        shr     dx, 1   ; get hour, min, sec
    rcr     ax, 1
    mov     bx, 32772
        mov     si, offset hour-0d0h
    call    chgit
    mov     ax, dx
    mov     bx, 10
    mul     bx
    mov     bx, 5460
    call    chgit
    mov     ax, dx
    xor     dx, dx
    mov     bx, 91
    call    chgit

        cmp     al, cs:lastsec-0d0h
        jz      timeend
        mov     cs:lastsec-0d0h, al

        mov     si, offset cs:hour-0d0h
        mov     cs:btw-0d0h, ':'
        mov     bl, 10

        cmp     cs:optp-0d0h, 1
        jnz     showing
        test    al, 2
        jnz     showing

showdate:
        cmp     cs:datechg-0d0h, 0
        jz      skiploaddate

        mov     al, 7
        out     70h, al
        in      al, 71h
        mov     cs:day-0d0h, al
        mov     al, 8
        out     70h, al
        in      al, 71h
        mov     cs:month-0d0h, al
        mov     al, 9
        out     70h, al
        in      al, 71h
        mov     cs:year-0d0h, al
        mov     cs:datechg-0d0h, 0

skiploaddate:
        mov     si, offset year-0d0h
        mov     cs:btw-0d0h, '-'
        mov     bl, 16

showing:
        call    showdigit
        call    twopo
        call    showdigit
        call    twopo
        call    showdigit

timeend:
    pop     es
    pop     ds
        pop     si
    pop     di
    pop     dx
    pop     bx
    pop     ax
    db      0eah
oldip   dw      0
oldcs   dw      0

info    db      0dh,0ah
    db      '谀哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?,0dh,0ah
    db      '?           ON-LINE CLOCK              ?,0dH,0aH
    db      '?   Zhang Jiu Qiang, 2007 in ZunYi     ?,0dh,0ah
    db      '滥哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?,0dh,0ah,'$'

info1   db      'TI [1] [d]'
        db      '$'

lcdnumbit       label   byte
LCD0    DB      0,1EH,21H,21H,21H,21H,21H,21H,0  ,21H,21H,21H,21H,21H,21H,1EH
LCD1    DB      0,  0,1  ,1  ,1  ,1  ,1  ,1  ,0  ,1  ,1  ,1  ,1  ,1  ,1  ,0
LCD2    DB      0,1EH,1  ,1  ,1  ,1  ,1  ,1  ,1EH,20H,20H,20H,20H,20H,20H,1EH
LCD3    DB      0,1EH,1  ,1  ,1  ,1  ,1  ,1  ,1EH,1  ,1  ,1  ,1  ,1  ,1  ,1EH
LCD4    DB      0,  0,21H,21H,21H,21H,21H,21H,1EH,1  ,1  ,1  ,1  ,1  ,1  ,0
LCD5    DB      0,1EH,20H,20H,20H,20H,20H,20H,1EH,1  ,1  ,1  ,1  ,1  ,1  ,1EH
LCD6    DB      0,1EH,20H,20H,20H,20H,20H,20H,1EH,21H,21H,21H,21H,21H,21H,1EH
LCD7    DB      0,1EH,1  ,1  ,1  ,1  ,1  ,1  ,0  ,1  ,1  ,1  ,1  ,1  ,1  ,0
LCD8    DB      0,1EH,21H,21H,21H,21H,21H,21H,1EH,21H,21H,21H,21H,21H,21H,1EH
LCD9    DB      0,1EH,21H,21H,21H,21H,21H,21H,1EH,1  ,1  ,1  ,1  ,1  ,1  ,1EH

        db      'COLOR'
color0  db      0ah
        db      'YPOS'
cordy   db      0
        db      'XPOS'
cordx   dw      72

start:
        mov     al, cs:cordy
    mov     bl, 80
    mul     bl
        add     ax, cs:cordx
    mov     di, ax
    shl     di, 1
        mov     cs:vidoff, di

        mov     al, cs:color0
        mov     cs:color, al

    mov     di, 80h
    cmp     byte ptr [di], 2
        jb      skippp
repskp:
    inc     di
comp1:
    cmp     byte ptr [di], 20h
    jz      repskp

    cmp     byte ptr ds:[di], '1'
        jnz     noskip
        cmp     byte ptr ds:[di+1], 20h
        ja      wrong
    mov     bp, offset lcdnumbit
pointnum:
    mov     ax, cs
    mov     ds, ax
    mov     es, ax
    mov     ax, 1100h
    mov     bx, 1000h
    mov     cx, 10
    mov     dx, 0a0h
    int     10h
    mov     ds:numbase, 0a0a0h
compdj:
    inc     di
    cmp     byte ptr [di], 20h
        jz      compdj
noskip:
        cmp     byte ptr ds:[di], 0dh
        jz      skippp

        or      byte ptr ds:[di], 20h
        cmp     byte ptr ds:[di], 'd'
        jnz     wrong
        cmp     byte ptr ds:[di+1], 20h
        ja      wrong
        mov     cs:optp, 1      ; show date
        jmp     repskp
wrong:
        mov     ah, 9
        mov     dx, offset info1
    int     21h
        mov     ah, 4ch
        int     21h
skippp:
    mov     ah,09
    mov     dx, offset info
    int     21h
    mov     ax, 4c4ch
    mov     bx, 0c4c4h
    int     08h
    cmp     ax, 0c4c4h
    jnz     cont1
    cmp     bx, 4c4ch
    jz      already
cont1:
    xor     ax, ax
    mov     ds, ax
    mov     ax, ds:[08h*4]
    mov     cs:oldip, ax
    mov     ax, ds:[08h*4+2]
    mov     cs:oldcs, ax
    cli
    mov     ds:word ptr [08h*4], offset int08h - 0d0h       ; offset
    mov     ds:word ptr [08h*4+2], cs
    mov     ax, cs
    mov     ds, ax
    mov     di, 30h                         ;dest
    mov     si, 100h                        ;source
    mov     cx, offset info - 100h          ;length
    cld
    rep     movsb
    sti

    mov     ax, cs:[2ch]
    dec     ax
    mov     ds, ax
    mov     word ptr ds:[01], 0000h

    mov     dx, offset info - 0d0h          ;resident length, 计算驻留长度
    add     dx, 0fh                ;info 以后的内容不驻留
    mov     cl, 4                ;右移4位,因为放在DX中的长度是以16字节为单位的。
    shr     dx, cl                ;即驻留长度是 DX * 16
    mov     ah, 31h                ;DOS系统调用,驻留功能
    int     21h
already:
    mov     ax, ds:numbase
    mov     es:numbase-0d0h, ax
        mov     al, ds:optp
        mov     es:optp-0d0h, al
    mov     ah, 4ch
    int     21h
code    ends
    end     begin
搜索更多相关主题的帖子: 驻留 时间 
2008-06-26 09:49
快速回复:一个时间驻留程序 有点小错误 哪位大哥帮忙改下 急!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016871 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved