Hi there, I'm kinda new to making asm programs and i was wondering if you could make a countdown timer where the user is asked for the input and it is displayed in countdown, lets say a max of 59 secs. I was only able to make one that counts down from 9 to 0, is there a way to input 59secs and display the countdown? Using A86 assembler btw.
Here's my code:
MAIN:
JMP START
MSG: DB 0A,0D,'ENTER NUMBER OF SECONDS(0-9): $'
MSG1: DB 0A,0D,'-END- $'
START: ;USER INPUT
MOV AH,09
MOV DX,MSG
INT 21H
SECIN:
MOV AH,08
INT 21H
PUSH AX
MOV AH,02
MOV DL,AL
INT 21H
MOV AH,02
MOV DL,0AH
INT 21H
POP AX
MOV BL,AL
MOV CL,AL
DCOUNT:
CMP BL,30H
JE COUNTEND
PUSH CX
PUSH BX
MOV AH,02
MOV DL,BL
INT 21H
POP BX
DEC BL
MOV AH,02
MOV DL,0AH
INT 21H
CALL DELAYT
POP CX
LOOP DCOUNT
INT 20H
DELAYT: ;DELAY FUNCTION USING SERVICE 2C OF INT 21H
MOV AH,02CH
INT 21H
MOV BH,DH ; DH has current second
TIMEC: ; Loops until the current second is not equal to the last, in BH
MOV AH,02CH
INT 21H
CMP BH,DH ; Here is the comparison to exit the loop continue
JE TIMEC
RET
COUNTEND:
MOV AH,09
MOV DX,MSG1
INT 21H
INT 20H