Question: CSC 2 2 1 Project 0 5 : MS - DOS Date - Time Formatter ( Unpacking ) Objective: Use the provided starter code to:
CSC Project : MSDOS DateTime Formatter Unpacking
Objective: Use the provided starter code to:
Unpack a bit MSDOS DateTime format stored in the EDX register.
Extract and display the year, month, day, hour, minute, and second fields.
Starter Code:
The provided starter code:
Gets the current date and time from the system.
Packs the year, month, day, hour, minute, and second into the bit EDX register, formatted
as follows:
Bit Index Field Bits Range
Second take bits second shift divide by to get bits
Minute
Hour
Empty
Day
Month
Year Offset
The year is stored as an offset from eg is stored as
Your Task:
Unpack the bit value in EDX:
o Extract each field year month, day, hour, minute, second using bitwise operations
AND SHR etc.
o Restore the full year by adding to the unpacked value.
o Restore the seconds by multiplying the bit value by SHL al
Display the unpacked values:
o Print each field in the format:
Year: YYYY Month: MM Day: DD Hour: HH Minute: MM Second: SS
Steps to Complete the Project
Unpacking Logic Procedure: unpack:
Write a procedure called unpack that:
Receives the packed bit value in EDX.
Using the procedure sub given extracts and print the fields for time using:
o Shift right by remove time
o Days bits : mask off month and year with AND
o Months bits : Shift right by and mask with AND b
o Years bits : Shift right by and then add
Using the procedure sub given extracts and print the fields for time using:
o Seconds bits : And b and shift left by multiple
o Minutes bits: Shift right by and mask with AND b
o Hours bits : Shift right by and mask with AND b
Note: these instructions are general guidelines, there could be minor errors
Program Structure
Call the starter code to populate the EDX register with the packed bit datetime value.
Call the two Unpack and Display procedures.
Program
Input: Unpacked fields from registers.
Output: Formatted datetime string to the console.
Requirements:
Submitted program must build, code that does not build will not be graded
Correctly format code, special care given to indentations and spacing, goal is for readability
Comment all code, have comment header with description, project number, authors name
and date of last modification Procedures excluding main must have complete
Descriptions, Receives, Returns, Requires
Use the course convention for naming the submitted file
Example User Interaction
The current date is YYYY:MM:DD: ::
The current time is HH:MM:SS: ::
YYYY YYYM MMMD DDDD HH HHHM MMMM MSSS
edx b
The current date is YYYY:MM:DD: ::
The current time is HH:MM:SS: ::
Deliverables
A welldocumented MASM assembly program including:
o File name, project description, author, and last modified date.
o Comments for each block of code to explain its purpose.
The program must:
o Use the starter code to pack the value into EDX.
o Include your unpack and display procedures.
o Use Irvine library procedures for IO operations.
o Use only the procedures we discussed in class
o Keep the existing structure, dont change anything but the two Unpack and Display
procedures.
Helpful Hints
Use masking AND and shifting SHR to extract specific bits for each field.
Test your unpacking logic thoroughly by comparing output with the original values.
Use the provided WriteBin function or mshow macro to see the packed binary value or even
better use the debugger on visual studio.
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
