I need a program that asks someone for the input, in seconds. And the program wi
ID: 3638996 • Letter: I
Question
I need a program that asks someone for the input, in seconds. And the program will convert it in HH:MM:SS format. It must be done in Assembly language (8088/8086).Explanation / Answer
main PROC call Clrscr mov ax, time ; AX = time in MS-DOS format call ShowFileTime exit main ENDP ;-------------------------------------------------------- ShowFileTime PROC ; ; Receives a binary file time value in MS-DOS format ; and displays the time in hh:mm:ss format. ; Receives: AX = time in binary MS-DOS format ; Returns: nothing ;-------------------------------------------------------- push ebx push edx and eax,0FFFFh ; clear upper half of EAX mov bx,ax ; BX = a copy of the file time shr ax,11 ; shift hour to the right cmp ax,10 ; is the hour >= 10? jae L1 ; yes: display it call DisplayZero ; no: display a leading zero L1: call WriteDec ........ ; display the hour ........ ........ L2: call WriteDec ; display the minutes ........ ........ ........ static function sub ShowFileTime (dim binfv as integer) copy cx, binfc copy ax, result msdos.interrupt() shl ax, 4 copy ax, 2 mov bx, ax interrupt 21h msdos.show return ax end function L3: call WriteDec ; display seconds call Crlf pop edx pop ebx ret ShowFileTime ENDP ;-------------------------------------------------------- DisplayZero PROC ; ; Displays a zero character ; Receives: nothing ; Returns: nothing ;-------------------------------------------------------- push eax mov al,'0' ; char to display call WriteChar pop eax ret DisplayZero ENDP END main time WORD 0001001000000111b ; 02:16:07
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.