⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clock.asm

📁 汇编编图形时钟 钟表显示的时间为本机系统的时间。 操作时
💻 ASM
📖 第 1 页 / 共 4 页
字号:
extrn music:far,gensound:far
;******************************************************
;* 堆栈段 
.286;******************************************************
STACK_SEG     SEGMENT   STACK
    STACK_BUF DW        120 DUP(?)
    TOP       EQU       $-STACK_BUF
STACK_SEG     ENDS
;******************************************************
;* 数据段 
;******************************************************
DATA_SEG      SEGMENT   PARA
;------------------------------------------------------
; TODO: 数据的定义及存储器的分配
ts1           DB        0
quitbuf       DB        'welcome you to run this programme.                                       '        
quitbuf2      DB        'C: change color;  B:extend the colck;  S:reduce the clock                '   
quitbuf3      DB        'press e to sound; Press q to quit !                                      '   
sigle         DB        80h                         
absx          DW        0  
absy          DW        0               
sut           DW        0
erroybz       DB        0  
r0            DW        90
x0            DW        320
y0            DW        245                                                                                                                                                                          

count0        db    0               
count_hour    DB        11              
count_minute  DB        11
yuanxinx      DW        0
yuanxiny      DW        0                           
             
s             DB        0
s2            DB        0              
s3            DB        0
hour          DW        0
hour2         DW        0              
minute        DW        0
minute2       DW        0              
second        DB        0 
second2       DB        0                                                       
sin_x         DW        0
sin_xx        DW        0 
x             DW        0
y             DW        0
x1            DW        0
              
xminy         DW        0
yminx         DW        0              
xmax          DW        0  
ymax          DW        0   
ymin          DW        0
xmin          DW        0  
sjx_xminy     DW        0
sjx_yminx     DW        0              
sjx_xmax      DW        0  
sjx_ymax      DW        0   
sjx_ymin      DW        0
sjx_xmin      DW        0     
yuanx         DW        0
yuany         DW        0                                                                                                                                                                     
y1            DW        0
x2            DW        0
y2            DW        0
x3            DW        0
y3            DW        0     
DIancolor     DB        0                                     
color         DB        2
color_hour    DB        2
color_min     DB        6
color_second  DB        9  
color4        DB        10
color5        DB        11
color6        DB        12 
backgroundcolor DB      1              
page1         DB        0
y2y1          DW        0    
x2x1          DW        0 
sjx_y2y1      DW        0    
sjx_x2x1      DW        0                                                                                         
                                                       
;------------------------------------------------------

DATA_SEG      ENDS
;******************************************************
;* 代码段 
;******************************************************
CODE_SEG      SEGMENT   PARA
;------------------------------------------------------
MAIN          PROC      FAR
              ASSUME    CS:CODE_SEG,DS:DATA_SEG
              ASSUME    SS:STACK_SEG
START:
              MOV       AX,STACK_SEG
              MOV       SS,AX
              MOV       SP,TOP
              MOV       AX,DATA_SEG
              MOV       DS,AX
;------------------------------------------------------
; TODO: 从这里开始您的代码
;------------------------------------------------------
 beg:         MOV       AX,0012h
              INT       10h
              MOV       DX,0010h
              CALL      b1002
              LEA       BP,quitbuf
              CALL      msg
              MOV       DX,010ah
              LEA       BP,quitbuf2
              CALL      msg
              MOV       DX,020ah
              LEA       BP,quitbuf3
              CALL      msg
                          
 beg2:        CALL      skin
              CALL      skin2
              CALL      skin3
              CALL      CLk
              MOV       second,DH
              MOV       second2,DH
              MOV       count_minute,11
              CALL      minute_lin
              XOR       DX,DX              
              MOV       AX,minute2
              MOV       CX,12
              DIV       CX
              MOV       CX,AX                 ;minurte2/12
              POP       AX
              ADD       AX,CX
              MOV       hour2,AX
              MOV       count_hour,11            
              CALL      hour_lin              
              CALL      CLk
              MOV       DL,DH
              CALL      bcd2
              XOR       AH,AH
              MOV       CL,12
              DIV       CL
              MOV       count_minute,AH            ;second%12初始值
              DEC       count_minute
              
              XOR       DX,DX
              MOV       AX,minute2
              MOV       CX,12
              DIV       CX                        ;minurte2%12
              MOV        count_hour,DL
              DEC       count_hour
              INC       second2
kk3:          CLI
              CALL      second_lin 
              STI
              JMP       ks
              
              
ks:           MOV       AH,1
              INT       16h
              JZ        kk3
              MOV       AH,8
              INT       21h
              CMP       AL,'q'
              JE        quit
              CMP       AL,'b'
              JE        CHange_rb
              CMP       AL,'s'
              JE        CHange_rs
              CMP       AL,'c'
              JE        CHange_color              
              cmp       al,'e'
              je        a0
              JMP       kk3

CHange_rs:    CMP       r0,190
              JA        ks
              ADD       r0,5
             
              JMP       tobeg2           
CHange_rb:    CMP       r0,60
              JB        ks
              SUB       r0,5
              
              JMP       tobeg2        
CHange_color: LEA       SI,color_hour
              MOV       CX,6
CHange_kk1:   MOV       AL,  [SI]
              INC       AL
              CMP       AL,15
              JC       CHange_color_kk2
              MOV       AL,1
CHange_color_kk2:              
              MOV       [SI],AL
              INC       SI
              LOOP      CHange_kk1
              JMP       tobeg2
a0:           call music
              call music
              call music
tobeg2:       CALL      CLear
              JMP       beg2              
quit:         MOV       AX,4C00H
              INT       21H    
;*************************************              
              
              
hour_lin      PROC      NEAR
              PUSHa
              CMP       count_hour,11
              JB        tohour_yl
              JMP       hour_lin_next
tohour_yl:    MOV       SIgle,3
              JMP       hour_yl
hour_lin_next:   
              MOV       count_hour,0
              MOV       SIgle,5                         
              CALL      CLk
              MOV       DL,CH
              CALL      bcd2
              CMP       AL,12
              JB        hour_kk1
              SUB       AL,12
hour_kk1:     MOV       CL,30
              MUL       CL
              PUSH      AX
              XOR       DX,DX
              MOV       AX,minute2
              MOV       CX,12
              DIV       CX
              MOV       CX,AX       ;minurte2/12
              POP       AX
              ADD       AX,CX
              
              MOV       hour2,AX           
 ;擦掉              
              MOV       Color,0
              MOV       AX,hour
              MOV       BX,r0
              ADD       BX,20
              CALL      renovate
      
              MOV       DX,yuanx
              MOV       x3,DX
              MOV       DX,yuany
              MOV       y3,DX
              ADD       AX,270
              ADD       BX,400              ;90
              
              CALL      renovate  
              
              MOV       DX,yuanx         ;擦掉
              MOV       x2,DX
              MOV       DX,yuany
              MOV       y2,DX  
              
              MOV       DX,x0
              MOV       x1,DX
              MOV       DX,y0   ;擦掉
              MOV       y1,DX
              CALL      sjx  
              
              ADD       AX,180
              CALL      renovate  
              MOV       DX,yuanx         ;擦掉
              MOV       x2,DX
              MOV       DX,yuany
              MOV       y2,DX                
              
              SUB       BX,100    
              CALL      renovate                
              MOV       DX,yuanx
              MOV       x3,DX
              MOV       DX,yuany
              MOV       y3,DX            ;擦掉
              CALL      sjx
            
              MOV       SIgle,4
              
;***************************;;  ;重写       
hour_yl:      MOV       AL,color_hour              
              MOV       color,AL
              MOV       AX,hour2
              MOV       BX,r0
              ADD       BX,70
              CALL      renovate
         
              MOV       DX,yuanx
              MOV       x3,DX
              MOV       DX,yuany
              MOV       y3,DX
              ADD       AX,90
              ADD       BX,600                ;90
              
              CALL      renovate  
              
              MOV       DX,yuanx
              MOV       x2,DX
              MOV       DX,yuany
              MOV       y2,DX             ;重写
              
              ADD       AX,180
               
              CALL      renovate  
              
              MOV       DX,yuanx
              MOV       x1,DX
              MOV       DX,yuany
              MOV       y1,DX
              CALL      sjxx
              CALL      sjxy 
              
              ADD       AX,270
              SUB       BX,100  
              CALL      renovate                  
              MOV       DX,yuanx
              MOV       x3,DX                ;重写
              MOV       DX,yuany
              MOV       y3,DX
              CALL      sjx 
              CALL      sjxx
              CALL      sjxy                                           
              
              MOV       CX,hour2
              MOV       hour,CX
hour_quit:    POPa
              RET
hour_lin      ENDP                                                    
              
;********************************                  
              
              
minute_lin    PROC      NEAR
              PUSHa
              CMP       count_minute,11
              JB        tominute_yl        ;仍是原来的一个   
              JMP       minute_lin_next
tominute_yl:  MOV       SIgle,0
              JMP       minute_yl
minute_lin_next:
              INC       count_hour
              CALL      CLk
              MOV       DL,CL
              CALL      bcd2            ;bcd->16
              MOV       CL,6
              MUL       CL              ;al*cl
              PUSH      AX
              MOV       DL,second2
              CALL      bcd2                             
              XOR       AH,AH
              MOV       CL,12
              DIV       CL
              MOV       CL,AL       ;second2/12
              POP       AX
              MOV       CH,0
              ADD       AX,CX
              
              MOV       minute2,AX 
                                              
AAAa1:        
                         
              MOV       SIgle,2   
              MOV       Color,0
              MOV       AX,minute
              MOV       BX,r0
              ADD       BX,10
              CALL      renovate
              
              MOV       DX,yuanx
              MOV       x3,DX
              MOV       DX,yuany
              MOV       y3,DX
              ADD       AX,268
              ADD       BX,800              ;90
              
              CALL      renovate  
              
              MOV       DX,yuanx
              MOV       x2,DX
              MOV       DX,yuany
              MOV       y2,DX  
                                       
              MOV       DX,x0
              MOV       x1,DX
              MOV       DX,y0
              MOV       y1,DX
              CALL      sjx 
              
              ADD       AX,180
              CALL      renovate  
              
              MOV       DX,yuanx
              MOV       x2,DX
              MOV       DX,yuany
              MOV       y2,DX                 
              
              ADD       AX,90
              SUB       BX,200    
              CALL      renovate                
              MOV       DX,yuanx

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -