PAGE 100,110
TITLE 'SAAT.ASM' to show time on monitor
;-----------------------------------------------
STACKSG SEGMENT STACK 'STACK'
DW 32 DUP(0)
STACKSG ENDS
;-----------------------------------------------
CODESG SEGMENT 'CODE'
ASSUME SS:STACKSG,CS:CODESG
MAIN PROC FAR
CALL CLEAR ;1-Clear monitor
BACK1:
CALL CURSOR ;2-Set cursor
CALL TIME ;3-Determine times
MOV AL,CH ;4-Move hour to AL
CALL DISPLA1 ;5-Display hour
CALL COLON ;6-Display ':' on montor
MOV AL,CL ;7-Move minute to AL
CALL DISPLA1 ;8-Display minutes
CALL COLON ;9-Display ':' on monitor
MOV AL,DH ;10-Move seconds to AL
CALL DISPLA1 ;11-Display seconds
JMP BACK1 ;12- else go to BACK1
MOV AX,4C00H ;13-End of
INT 21H ;14- processing
MAIN ENDP ; End of MAIN procedure
; Clear monitor
; -------------
CLEAR PROC NEAR
PUSH BX ;15-PUSH BX
MOV AX,0600H ;16-Request interrupt
MOV CX,0000H ;17-Left up corner
MOV DX,184FH ;18-Right down corner
MOV BH,0EH ;19-Color yellow on balck
INT 10H ;20-Active interrupt
POP BX ;21-Restore BX
RET ;22-Return to MAIN
CLEAR ENDP ; End of procedure
; Set cursor on 12,40
; -------------------
CURSOR PROC NEAR
PUSH DX ;23-PUSH DX
MOV AH,02H ;24-Request interrupt
MOV BH,00H ;25-Use page 0
MOV DH,12 ;26-Row 12
MOV DL,40 ;27-Coloumn 40
INT 10H ;28-Active interrupt
POP DX ;29-Restore BX
RET ;30-Return to MAIN
CURSOR ENDP ; End of procedure
; Get time
; --------
TIME PROC NEAR
MOV AH,2CH ;31-Request interrupt
INT 21H ;32-Active interrupt
RET ;33-Return to MAIN
TIME ENDP ; End of procedure
; Display ': ' on monitor
; -----------------------
COLON PROC NEAR
PUSH DX ;34-Push DX
MOV DL,':' ;35-Move ASCII of : to DL
MOV AH,02H ;36-Request interrupt
INT 21H ;37-Active interrupt
POP DX ;38-Restore its value
RET ;39-Return to MAIN
COLON ENDP ; End of procedure
; Display numbers on monitor
; --------------------------
DISPLA1 PROC NEAR
PUSH DX ;40-Push DX
; Changing binary to ASCII
; ------------------------
MOV BL,10 ;41-Move 10 for division
MOV AH,00H ;42-Clear AH
DIV BL ;43-Divide AX to 10
MOV BX,AX ;44-Store on BX
ADD BL,30H ;45-Change BL to ASCII
ADD BH,30H ;46-Change BH to ASCII
; Showing ASCII numbers on monitor
; --------------------------------
MOV AH,02H ;47-Display higher
MOV DL,BL ;48- number
INT 21H ;49-Active interrupt
MOV DL,BH ;50-Display lower number
INT 21H ;51-Active interrupt
POP DX ;52-Restore its value
RET ;53-Return to MAIN
DISPLA1 ENDP ; End of procedure
CODESG ENDS ; End of segment
END MAIN ; End of program