troubleshooting Question

write stopwatch(count down) with Assembler

Avatar of anelka_tm
anelka_tm asked on
Assembly
6 Comments1 Solution4240 ViewsLast Modified:
Hii, my project is "stopwatch(count down) with Assembler" i writed but it not working as well as i want, its'n give me error but not working properly. i writed it with TASM. thank you for your help...
CLRSCR MACRO
 
	  MOV AX,0600H
 
	  MOV BH,07
 
	  MOV CX,0
 
	  MOV DX,184FH
 
	  INT 10H
 
	  ENDM
 
;-----------------------
 
CURSOR MACRO ROW,COLUMN
 
	  MOV BH,0
 
	  MOV AH,02				    
 
	  MOV DH,ROW
 
	  MOV DL,COLUMN
 
	  INT 10H
 
	  ENDM
 
;-------------- ;--------------------
 
.MODEL SMALL
.STACK 64
 
.DATA
 
DATA_1  DB '---------     --------         --------     --------         --------     -------- $'
DATA_2  DB '|        |   |        |       |        |   |        |       |        |   |        |$'        
DATA_3  DB '|        |   |        |       |        |   |        |       |        |   |        |$'
DATA_4  DB '|        |   |        |       |        |   |        |       |        |   |        |$'
DATA_5  DB '|        |   |        |   :   |        |   |        |   :   |        |   |        |$'
DATA_6  DB '|        |   |        |       |        |   |        |       |        |   |        |$'
DATA_7  DB '|        |   |        |       |        |   |        |       |        |   |        |$'
DATA_8  DB '|        |   |        |       |        |   |        |       |        |   |        |$'
DATA_9  DB '---------     --------         --------     --------         --------     -------- $'
 
DATA_10 DB  'FOR STOP  PRESS S'
DATA_11 DB  'FOR START PRESS M'
DATA_12 DB  'FOR RESET PRESS R'  
    
HOUR DW 0, 
       
MINU DW 0, 
 
SECO DW 0, 
 
TIME  DW 0, '/'
 
BITIRDOLAR  DB  24H               ;$ ascii   
 
DB 64 DUP(?)        
                    
.CODE
 
MAIN :
 
      MOV AX,@DATA
	  
      MOV DS,AX
	  
      CLRSCR
 
MOV AH,09
MOV DX,OFFSET DATA_1
INT 21H
 
MOV AH,09
MOV DX,OFFSET DATA_2
INT 21H
 
MOV AH,09
MOV DX,OFFSET DATA_3
INT 21H
 
MOV AH,09
MOV DX,OFFSET DATA_4
INT 21H
 
MOV AH,09
MOV DX,OFFSET DATA_5
INT 21H
 
MOV AH,09
MOV DX,OFFSET DATA_6
INT 21H
 
MOV AH,09
MOV DX,OFFSET DATA_7
INT 21H
 
MOV AH,09
MOV DX,OFFSET DATA_8
INT 21H
 
MOV AH,09
MOV DX,OFFSET DATA_9
INT 21H
 
MOV AH,09
MOV DX,OFFSET DATA_10
INT 21H
 
MOV AH,09
MOV DX,OFFSET DATA_11
INT 21H
 
MOV AH,09
MOV DX,OFFSET DATA_12
INT 21H
;      CURSOR 12,26
 
         
MOV AH,2CH                             ; take watch
         INT 21H 
 
         MOV AL,CH                     ; hour
         CALL CONVERT
         MOV HOUR,AX
 
         MOV AL,CL                     ; minute
         CALL CONVERT
         MOV MINU,AX
 
         MOV AL,DH                     ; second
         CALL CONVERT
         MOV SECO,AX                  
         
         MOV AH,09H                    
         MOV DX,OFFSET TIME             
	 INT 21H  	               ; wait for any key press
	
          MOV AH,0
          INT 16H                     ;exit
	  
	CALL CONVERT
          
          MOV AL,00
          MOV BL,00
          MOV DL,00  
      
 STOP: MOV AH,07
       INT 21H          
       CMP AL,77        
       JE START         
      
      MOV AH,07         
      INT 21H
      CMP AL,82            
 
    JE RESET0
    RESET0: JMP FAR PTR RESET
    JMP FAR PTR RESET
    JMP NEAR PTR BX
    JMP BX
    CALL RESET
 
LOOP STOP   
 
START:CMP AL,00              
      JE  OVER              
      DEC AL                 
 
      MOV AH,00 
             
      MOV AL,AL
      MOV CL,1
      SHL AX,CL
      SHR AL,CL
 
      CURSOR 12,27     
     
      MOV CH,AH
 
      MOV AH,02
      MOV DL,AL
      INT 21H
 
      MOV AH,02
      MOV DL,CH
      INT 21H 
     
      MOV CH,AH
 
      MOV AH,02
      MOV DL,CH
      INT 21H
 
      MOV AH,02
      MOV DL,AL
      INT 21H 
 
      MOV AL,DH
  
OVER: MOV AL,99
      DEC BL
 
      MOV BH,00
      MOV AL,BL
      MOV CL,1
      SHL AX,CL
      SHL AL,CL
 
 
      MOV DH,AL
      MOV AL,AL
      MOV CL,1
      SHR AL,CL
      CURSOR 12,27
      MOV AH,02
      MOV DL,BL
      INT 21H 
      MOV AH,02
      MOV DL,BH
      INT 21H
      
      MOV AH,02
      MOV DL,BH
      INT 21H 
      MOV DL,BL
      INT 21H
 
      MOV AL,DH
       
      CMP BL,00
      JE BAHO
      DEC BL  
 
      MOV BH,00
      MOV AL,BL
      MOV CL,1
      SHL AX,CL
      SHL AL,CL
 
      MOV DH,AL
      MOV AL,AL
      MOV CL,1
      SHR AL,CL
      CURSOR 12,27
      MOV AH,02
      MOV DL,BL
      INT 21H 
      MOV AH,02
      MOV DL,BH
      INT 21H
     
      MOV AH,02
      MOV DL,BH
      INT 21H
 
      MOV AH,02 
      MOV DL,BL
      INT 21H
 
      MOV AL,DH
  BAHO:MOV BL,59
      DEC DL
 
      MOV DH,00
      MOV AL,DL
      MOV CL,1
      SHL AX,CL
      SHR AL,CL
 
      MOV DH,AL
      MOV AL,AL
      MOV CL,1
      SHR AL,CL
      CURSOR 12,27
      MOV AH,02
      MOV DL,DL
      INT 21H 
      MOV AH,02
      MOV DL,DH
      INT 21H
     
      MOV AH,02
      MOV DL,DH
      INT 21H 
      MOV AH,02
      MOV DL,DL
      INT 21H
 
      MOV AL,DH
 
      CMP DL,00
      JE IZO
      DEC DL
 
      MOV DH,00
      MOV AL,DL
      MOV CL,1
      SHL AX,CL
      SHR AL,CL
         
      MOV DH,AL
      MOV AL,AL
      MOV CL,1
      SHR AL,CL
      CURSOR 12,27
      MOV AH,02
      MOV DL,DL
      INT 21H 
      MOV AH,02
      MOV DL,DH
      INT 21H
     
      MOV AH,02
      MOV DL,DH
      INT 21H 
      MOV AH,02
      MOV DL,DL
      INT 21H
      MOV AL,DH
 
IZO: MOV DL,59H
 
      MOV DH,00
      MOV AL,DL
      MOV CL,1
      SHL AX,CL
      SHR AL,CL
 
      MOV DH,AL
      MOV AL,AL
      MOV CL,1
      SHR AL,CL
      CURSOR 12,27
      MOV AH,02
      MOV DL,DL
      INT 21H 
      MOV AH,02
      MOV DL,DH
      INT 21H
 
      MOV AL,00
 
      MOV AH,00
      MOV AL,AL
      MOV CL,1
      SHL AX,CL
      SHR AL,CL
 
      MOV DH,AL
      MOV AL,AL
      MOV CL,1
      SHR AL,CL
      CURSOR 12,27
      MOV CH,AH
      MOV AH,02
      MOV DL,AL
      INT 21H 
      MOV AH,02
      MOV DL,CH
      INT 21H
     
      MOV CH,AH
      MOV AH,02
 
      MOV DL,CH
      INT 21H 
      MOV AH,02
      MOV DL,AL
      INT 21H
      MOV AL,DH 
 
     MOV AH,00H
     INT 16H
     MOV CH,AL
     CMP AL,83
     MOV AL,CH 
 
    JE STOP0
    STOP0: JMP FAR PTR STOP
    JMP FAR PTR STOP
    JMP NEAR PTR BX
    JMP BX
    CALL STOP
     
     JMP START
 
RESET: MOV BL,00
       MOV CH,00
       MOV DL,00
 
      JMP  STOP 
	  
CONVERT :                       ;convert decimal
 
	  PUSH CX 	                ;year
	  XOR AH,AH 
	  MOV CL,10 
	  DIV CL
	  ADD AX,3030H 
 	  POP CX
	  RET
          END MAIN
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros