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:
model flat, stdcall
option casemap: none ; casesensitive
ExitProcess proto, dwExitCode: dword
INCLUDE Irvineinc
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
mov ax bx
and axFh ; Mask bits
mov bl al ; Store day in BL register
; Extract month bits
mov ax bx
shr ax ; Shift right to bring month bits to LSB
and axFh ; Mask bits
mov bh al ; Store month in BH register
; Extract year bits
mov ax bx
shr ax ; Shift right to bring year bits to LSB
and axFh ; Mask bits
add ax ; Add 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 axh ; Example date:
; Call FATDate procedure
call FATDate
; Display day
movzx eax, bl ; Day to EAX zeroextended to clear upper bits
call WriteDec
call Crlf
; Display month
movzx eax, bh ; Month to EAX zeroextended to clear upper bits
call WriteDec
call Crlf
; Display year
movzx eax, dx ; Year to EAX zeroextended to clear upper bits
call WriteDec
call Crlf
invoke ExitProcess,
main endp
end main
Now
model flat, stdcall
option casemap: none ; casesensitive
ExitProcess proto, dwExitCode: dword
INCLUDE Irvineinc
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
mov ax bx
and axFh ; Mask bits
mov bl al ; Store day in BL register
; Extract month bits
mov ax bx
shr ax ; Shift right to bring month bits to LSB
and alFh ; Mask bits
mov bh al ; Store month in BH register
; Extract year bits
mov ax bx
shr ax ; Shift right to bring year bits to LSB
and axFh ; Mask bits
add ax ; Add 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 bxh ; Example date:
; Call FATDate procedure
call FATDate
; Display day
movzx eax, bl ; Day to EAX zeroextended to clear upper bits
call WriteDec
call Crlf
; Display month
movzx eax, bh ; Month to EAX zeroextended to clear upper bits
call WriteDec
call Crlf
; Display year
movzx eax, dx ; Year to EAX zeroextended to clear upper bits
call WriteDec
call Crlf
invoke ExitProcess,
main endp
end mainthe output is currently:
Which is suppose to represent the example date:
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 bit field that is basically a date relative to the MSDOS epoch of Here is the format bit is the LSB of the bit word, bit
is the MSB of the bit word:
Bits : Day of month, valid value range inclusive.
Bits : Month of year, January, valid value range inclusive.
Bits : Count of years from valid value range inclusive
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
