Question: . 3 8 6 include Irvine 3 2 . inc . data ; Date value in AX register ( e . g . , 0
include Irvineinc
data
; Date value in AX register egx for December
dateValue dw
code
FATDate proc
; Extract day, month, and year from dateValue
;YEAR
mov cx dateValue
shr cx ; Shift right to get year
mov dx cx ; Store year in DX register
add dx
; MONTH bits &
mov cx dateValue
and cxb ; Mask to isolate month bits & position
shr cx ; Shift right by to position month bits &
mov bl cl ; Store month in BL register
; DAY bits &
mov cx dateValue
and cxb ; Mask to isolate day bits & position
mov bh cl ; Store day in AL register
ret
FATDate endp
main proc
lea ax dateValue
;mov ds ax
; Call the 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
DisplayNumber proc
; Display a bit number year
push ax
push bx
push cx
push dx
mov bx
xor cx cx
DisplayLoop:
div bx
add dl
push dx
inc cx
test ax ax
jnz DisplayLoop
PrintLoop:
pop dx
mov ah
int h
loop PrintLoop
pop dx
pop cx
pop bx
pop ax
ret
DisplayNumber endp
main endp
end main
The year outputs correctly, but the month and day dont why is this? Please note this is x Windows, using the Irvine library
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
