Question: I need help with this practrice problem! I am mostly complete, but I am getting stuck on my output. This is Assembly Language and uses

I need help with this practrice problem! I am mostly complete, but I am getting stuck on my output. This is Assembly Language and uses the Irvine tool kit. Here is my code:
.586
.model flat, stdcall
option casemap: none ; case-sensitive
ExitProcess proto, dwExitCode: dword
INCLUDE Irvine32.inc
.data
forwardSlash db '/'
.code
; Procedure to calculate FAT date
FATDate proc stdcall
push bx ; Preserve BX register
push cx ; Preserve CX register
xor bx, bx ; Clear BX register
mov bx, ax ; Copy date value to BX register
; Extract day (bits 04)
mov ax, bx
and ax,1Fh ; Mask bits 04
mov bl, al ; Store day in BL register
; Extract month (bits 58)
mov ax, bx
shr ax,5 ; Shift right to bring month bits to LSB
and ax,0Fh ; Mask bits 58
mov bh, al ; Store month in BH register
; Extract year (bits 915)
mov ax, bx
shr ax,9 ; Shift right to bring year bits to LSB
and ax,7Fh ; Mask bits 915
add ax,1980 ; Add 1980 to get actual year
mov dx, ax ; Store year in DX register
pop cx ; Restore preserved registers
pop bx
ret
FATDate endp
; Main program
main proc
; Load date value into AX register
mov ax,4200h ; Example date: 01/02/1990
; Call FATDate procedure
call FATDate
; Display day
movzx eax, bl ; Day to EAX (zero-extended to clear upper bits)
call WriteDec
call Crlf
; Display month
movzx eax, bh ; Month to EAX (zero-extended to clear upper bits)
call WriteDec
call Crlf
; Display year
movzx eax, dx ; Year to EAX (zero-extended to clear upper bits)
call WriteDec
call Crlf
invoke ExitProcess, 0
main endp
end main
Now 0
48
1980.586
.model flat, stdcall
option casemap: none ; case-sensitive
ExitProcess proto, dwExitCode: dword
INCLUDE Irvine32.inc
.data
forwardSlash db '/'
.code
; Procedure to calculate FAT date
FATDate proc stdcall
push bx ; Preserve BX register
push cx ; Preserve CX register
xor bx, bx ; Clear BX register
mov bx, ax ; Copy date value to BX register
; Extract day (bits 04)
mov ax, bx
and ax,1Fh ; Mask bits 04
mov bl, al ; Store day in BL register
; Extract month (bits 58)
mov ax, bx
shr ax,5 ; Shift right to bring month bits to LSB
and al,0Fh ; Mask bits 58
mov bh, al ; Store month in BH register
; Extract year (bits 915)
mov ax, bx
shr ax,9 ; Shift right to bring year bits to LSB
and ax,7Fh ; Mask bits 915
add ax,1980 ; Add 1980 to get actual year
mov dx, ax ; Store year in DX register
pop cx ; Restore preserved registers
pop bx
ret
FATDate endp
; Main program
main proc
; Load date value into BX register
mov bx,4200h ; Example date: 01/02/1990
; Call FATDate procedure
call FATDate
; Display day
movzx eax, bl ; Day to EAX (zero-extended to clear upper bits)
call WriteDec
call Crlf
; Display month
movzx eax, bh ; Month to EAX (zero-extended to clear upper bits)
call WriteDec
call Crlf
; Display year
movzx eax, dx ; Year to EAX (zero-extended to clear upper bits)
call WriteDec
call Crlf
invoke ExitProcess, 0
main endp
end mainthe output is currently:
0
48
1980
Which is suppose to represent the example date: 01/02/1980.
Here is the practice question:
Create a procedure called FATDate that calculates the FAT date as outlined below. The procedure must accept a date value in the AX register, calculate, and store the day in the BL register, the month in the BH register, and the year in the DX register. All other registers must be preserved. Create a demonstration program that calls the FATDate procedure and displays the month, day, and year to the console window using the Irvine provided procedures. Date Format. A FAT directory entry date stamp is a 16-bit field that is basically a date relative to the MS-DOS epoch of 01/01/1980. Here is the format (bit 0 is the LSB of the 16-bit word, bit
15 is the MSB of the 16-bit word):
Bits 04: Day of month, valid value range 1-31 inclusive.
Bits 58: Month of year, 1= January, valid value range 112 inclusive.
Bits 915: Count of years from 1980, valid value range 0127 inclusive (19802107).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!