| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 440 人关注过本帖
标题:哪位好心人帮忙给我看我下程序
只看楼主 加入收藏
huoshan0301
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-12-6
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
哪位好心人帮忙给我看我下程序
我编了一个实时显示的时间,然后现在要实现到了某一定时间输出‘ring’,到了某一段时间‘radio’,帮我改改,谢谢

data segment
   
    TAB   DB  12,50,'ring',12,46,'radio','$'
   
data ends
STACK  SEGMENT
       DW 16 DUP(0)
STACK  ENDS  
code segment
 assume  cs:code,ds:data,SS:STACK
start:     
      
        call  clall2              ;调用清全屏
         ag: call clear               ;调用清显示部分屏幕
           call list                ;调用显示
           call second
           ;call action
           jmp ag

 list proc near  
           push ax
           push bx
           push cx
           push dx
           mov ah,2ch      ;系统功能调用,读系统时间
           int 21h
           mov bx,0
           push dx
           mov dl,0
a1:        sub ch,000ah           ;CH存小时
           js  n1
           inc dl
           jmp a1   
n1:        add ch,000ah
            
           add dl,30h
           mov ah,02h
           int 21h  
            
           add ch,30h
           mov dl,ch
                     
           mov ah,02h
           int 21h
           
            
           mov dl,':'
           mov ah,02h
           int 21h                 ;显示“:”
           mov dl,0
a2:       sub cl,000ah             ;CL存分钟
           js  n2
           inc dl
           jmp a2   
n2:       add cl,000ah
         
           add dl,30h
           mov ah,02h
           int 21h
           add cl,30h
           mov dl,cl
           mov ah,02h
           int 21h
           mov dl,':'            ;显示“:”
           mov ah,02h
           int 21h
            
           pop dx
           mov dl,0
            
a3:       sub dh,000ah           ;DH存秒
            js  n3
            inc dl
           jmp a3   
n3:        add dh,000ah
           add dl,30h
           mov ah,02h
           int 21h   
           add dh,30h
           mov dl,dh
           mov ah,02h
           int 21h
   
          pop dx
          pop cx
          pop bx
          pop ax  
          ret
     list endp   
 second   PROC  NEAR            ;1秒子程序
                  PUSH  AX
                  PUSH  BX
                  PUSH  DX
                  push  di
                  push  cx                                   
                  mov       CX,00H
L1:               MOV       AL,00110000B      ;0计数器,工作方式3,先写最底有效字节,再写最高有效字节
                  OUT       43H,AL
                  MOV       AX,11930          ;设初值
                  OUT       40H,AL
                  MOV       AL,AH
                  OUT       40H,AL
L2:               mov       Al,00000000B
                  OUT       43H,AL
                  in        al ,40H
                  cmp       al,0
                  jnz       L2
                  add       CX,  1         
                  CMP       CX,100          ;满1秒?继续累计               
                  JNZ       L1   
            pop    cx  
            pop    di
            POP    DX
            POP    BX
            POP    AX   
            RET
  Second    ENDP
 
clear  proc near
   ;save registers
       push ax
       push bx
       push cx
       push dx
   
     
;clear  screen
 
     ;定窗口显示时钟            
       mov ah,7    ;to scroll downward function
       mov al,0    ;code to blank scree
       mov bh,70h    ;reverse video attribute
       mov ch,0    ;upper left row
       mov cl,0    ;upper left column
       mov dh,0  ;lower right row
       mov dl,20  ;lower left column
       int 10h     ;call video ROM
   ;定位
       mov ch,0
       mov cl,24
       mov ah,01h
       int 10h
       mov dh,0
       mov dl,0
       mov bh,0
       mov ah,02h
       int 10h
   ;locate cursor
       mov dx,0     
       mov ah,2    ;to locate column
       int 10h     ;call video BIOS
  ;restore registers

       pop dx
       pop cx
       pop bx
       pop ax
       ret
clear endp

clall2 proc near
      push ax
      push bx
      push cx
      push dx  
      mov ah,6    ;to scroll up screen
      mov al,0    ;blank screen
      mov bh,7    ;blank line
      mov ch,0    ;upper left row
      mov cl,0    ;upper left column
      mov dh,24   ;lower right row
      mov dl,79  ;lower left column
      int 10h     ;call video BIOS
      pop dx
       pop cx
       pop bx
       pop ax
       ret
clall2 endp
action  proc  near
    all:   push  ax
           push  bx
          mov  ax,data
           mov DS,ax
          mov  bx,offset TAB
   shi:    mov ah,2ch      ;系统功能调用,读系统时间
           int 21h
    cmp  ch,[bx]
           jz  fen
          cmp [bx],'$'
           jz all
           inc bx
           inc bx
           inc bx
          jmp shi
        
fen:      
      cmp  cl,[bx+1]
           jz   action1
           jmp fen
           
action1:
           mov dl, [bx+2]
           mov ah,9
           int 21h
        
           pop ax
           pop bx
           ret
           action  endp
           
code   ends
       end start


再call action 前加“;”我的显示时间就正确,可是目的达不到啊
搜索更多相关主题的帖子: 时间 
2010-12-08 13:01
xiaomarn
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:5
帖 子:348
专家分:2026
注 册:2009-3-18
收藏
得分:20 
程序代码:
data segment
  

    TAB   DB  17,21,'ring$',17,22,'radio','$'
  

data ends
STACK  SEGMENT
       DW 16 DUP(0)
STACK  ENDS 

code segment
assume  cs:code,ds:data,SS:STACK
start:    

     

        call  clall2              ;调用清全屏
         ag: call clear               ;调用清显示部分屏幕
           call list                ;调用显示
           call second
           call action
           jmp ag

list proc near 

           push ax
           push bx
           push cx
           push dx
           mov ah,2ch      ;系统功能调用,读系统时间
           int 21h
           mov bx,0
           push dx
           mov dl,0
a1:        sub ch,000ah           ;CH存小时
           js  n1
           inc dl
           jmp a1  

n1:        add ch,000ah
           

           add dl,30h
           mov ah,02h
           int 21h 

           

           add ch,30h
           mov dl,ch
                    

           mov ah,02h
           int 21h
          

           

           mov dl,':'
           mov ah,02h
           int 21h                 ;显示“:”
           mov dl,0
a2:       sub cl,000ah             ;CL存分钟
           js  n2
           inc dl
           jmp a2  

n2:       add cl,000ah
        

           add dl,30h
           mov ah,02h
           int 21h
           add cl,30h
           mov dl,cl
           mov ah,02h
           int 21h
           mov dl,':'            ;显示“:”
           mov ah,02h
           int 21h
           

           pop dx
           mov dl,0
           

a3:       sub dh,000ah           ;DH存秒
            js  n3
            inc dl
           jmp a3  

n3:        add dh,000ah
           add dl,30h
           mov ah,02h
           int 21h  

           add dh,30h
           mov dl,dh
           mov ah,02h
           int 21h
  

          pop dx
          pop cx
          pop bx
          pop ax 

          ret
     list endp  

second   PROC  NEAR            ;1秒子程序
                  PUSH  AX
                  PUSH  BX
                  PUSH  DX
                  push  di
                  push  cx                                  

                  mov       CX,00H
L1:               MOV       AL,00110000B      ;0计数器,工作方式3,先写最底有效字节,再写最高有效字节
                  OUT       43H,AL
                  MOV       AX,11930          ;设初值
                  OUT       40H,AL
                  MOV       AL,AH
                  OUT       40H,AL
L2:               mov       Al,00000000B
                  OUT       43H,AL
                  in        al ,40H
                  cmp       al,0
                  jnz       L2
                  add       CX,  1        

                  CMP       CX,100          ;满1秒?继续累计              

                  JNZ       L1  

            pop    cx 

            pop    di
            POP    DX
            POP    BX
            POP    AX  

            RET
  Second    ENDP

clear  proc near
   ;save registers
       push ax
       push bx
       push cx
       push dx
  

    

;clear  screen

     ;定窗口显示时钟           

       mov ah,7    ;to scroll downward function
       mov al,0    ;code to blank scree
       mov bh,70h    ;reverse video attribute
       mov ch,0    ;upper left row
       mov cl,0    ;upper left column
       mov dh,0  ;lower right row
       mov dl,20  ;lower left column
       int 10h     ;call video ROM
   ;定位
       ;mov ch,0
       ;mov cl,24
       ;mov ah,01h
       ;int 10h
       mov dh,0
       mov dl,0
       mov bh,0
       mov ah,02h
       int 10h
   ;locate cursor
       ;mov dx,0    

       ;mov ah,2    ;to locate column
       ;int 10h     ;call video BIOS
  ;restore registers

       pop dx
       pop cx
       pop bx
       pop ax
       ret
clear endp

clall2 proc near
      push ax
      push bx
      push cx
      push dx 

      mov ah,6    ;to scroll up screen
      mov al,0    ;blank screen
      mov bh,7    ;blank line
      mov ch,0    ;upper left row
      mov cl,0    ;upper left column
      mov dh,24   ;lower right row
      mov dl,79  ;lower left column
      int 10h     ;call video BIOS
      pop dx
       pop cx
       pop bx
       pop ax
       ret
clall2 endp
action  proc  near
            push  ax
           push  bx
           push cx
           push ds
          mov  ax,data
           mov DS,ax
          

          mov  bx,offset TAB
   shi:    mov ah,2ch      ;系统功能调用,读系统时间
           int 21h
    cmp  ch,[bx]
           jz  fen
    next:
          cmp byte ptr[bx],'$'
           jz exit
           lea bx,[bx+7]
          jmp shi
       

fen:     

      cmp  cl,[bx+1]
           jz   action1
           jmp next
          

action1:
            mov ah,2
            mov dh,10
            mov dl,20
            mov bh,0
            int 10h
           lea dx,[bx+2]
           mov ah,9
           int 21h
       exit:

            pop ds
            pop cx           

           pop ax
           pop bx
           ret
           action  endp
          

code   ends
       end start

2010-12-08 17:22
快速回复:哪位好心人帮忙给我看我下程序
数据加载中...
 
   



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

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