我希望设置系统时间,并获得显示时间。我用以下代码成功地获得了系统时间
mov ah,2ch ;get time
int 21h ;ch = hr, cl = min, dh = sec
但我无法通过以下两种方法设置系统时间
mov ah,03h
mov ch,hr(in bcd)
mov cl,mm(in bcd)
mov dh,sec(in bcd)
mov dl,am_pm
int 1ah
和
mov ah,2dh
mov ch,hr
mov cl,mm
mov dh,sec
int 21h
答案 0 :(得分:-1)
.MODEL SMALL
.DATA
.CODE
START: MOV AX,@DATA
MOV DS,AX
;Hour Part
HOUR:
MOV AH,2CH ; To get System Time
INT 21H
MOV AL,CH ; Hour is in CH
AAM
MOV BX,AX
CALL DISP
MOV DL,':'
MOV AH,02H ; To Print : in DOS
INT 21H
;Minutes Part
MINUTES:
MOV AH,2CH ; To get System Time
INT 21H
MOV AL,CL ; Minutes is in CL
AAM
MOV BX,AX
CALL DISP
MOV DL,':' ; To Print : in DOS
MOV AH,02H
INT 21H
;Seconds Part
Seconds:
MOV AH,2CH ; To get System Time
INT 21H
MOV AL,DH ; Seconds is in DH
AAM
MOV BX,AX
CALL DISP
;To terminate the Program
MOV AH,4CH ; To Terminate the Program
INT 21H
;Display Part
DISP PROC
MOV DL,BH ; Since the values are in BX, BH Part
ADD DL,30H ; ASCII Adjustment
MOV AH,02H ; To Print in DOS
INT 21H
MOV DL,BL ; BL Part
ADD DL,30H ; ASCII Adjustment
MOV AH,02H ; To Print in DOS
INT 21H
RET
DISP ENDP ; End Disp Procedure
END START ; End of MAIN
试试这个精巧的东西