Input This program will create a date in the Microsoft Disk Operating System File Allocation Table (DOS FAT) date format. You should write a sequence of instructions which receives three variables in registers as input: M - a month between 1 and 12 (in register 1) D - a day between 1 and 31 (in register 2) Y - a four-digit year value between 1980 and 2127 inclusive (in register 3) Processing: You must start by validating that these values are all within the appropriate ranges (1-12, 1-31, 1980-2127). If not, place a value of minus one in register 0 and end the program. Then use shift and bitwise instructions to create a Microsoft DOS FAT file system date. This has the format: Year in bits 15..09 Month in bits 08..05 Day in bits 04..00 This is a 16-bit number. The upper bits (31..16) should be set to zero. Output: Output shall be placed in register zero. If any of the parameters are invalid, place a value of minus one in register 0. Grading: Correct output values for selected test data: 20 points Clean assembly, no error messages: 5 points Validation of input and rejection of incorrect values: 10 points Correct program heading, naming, et cetera: 5 points Sample Output: For input of R1 = 12, R2 = 4, R3 = 2023, the output in register zero should be hexadecimal 0x568C. Here is how that answer was developed: Year: 2023 - 1980 = 43 43 - seven bits: 0101011 Month: 4 - four bits: 0100 Day: 12 - five bits: 01100 Putting it all together: 0101011 0100 01100 0101011010001100 0101 0110 1000 1100 5 6 8 C For input of R1 = 1, R2 = 1, R3 = 1980, the output in register zero should be hexadecimal 0x0021. For input of R1 = 13, R2 = 13, R3 = 2013, the output in register zero should be minus one. 2023 - 1980 = 43 = 29 = 0b0101001; 4 = 0b0100; 12 = 0b01100; 0b0101001010001100; 0101 0010 1000 1100 = 0x528C 1980 - 1980 = 0 = 0b0000000; 1 = 0b0001; 1 = 0b00001; 0000000000100001 = 0000 0000 0010 0001 = 0x0021
Input
This
M - a month between 1 and 12 (in register 1)
D - a day between 1 and 31 (in register 2)
Y - a four-digit year value between 1980 and 2127 inclusive (in register 3)
Processing:
You must start by validating that these values are all within the appropriate ranges (1-12, 1-31, 1980-2127). If not, place a value of minus one in register 0 and end the program.
Then use shift and bitwise instructions to create a Microsoft DOS FAT file system date. This has the format:
Year in bits 15..09
Month in bits 08..05
Day in bits 04..00
This is a 16-bit number. The upper bits (31..16) should be set to zero.
Output:
Output shall be placed in register zero. If any of the parameters are invalid, place a value of minus one in register 0.
Grading:
Correct output values for selected test data: 20 points
Clean assembly, no error messages: 5 points
Validation of input and rejection of incorrect values: 10 points
Correct program heading, naming, et cetera: 5 points
Sample Output:
For input of R1 = 12, R2 = 4, R3 = 2023, the output in register zero should be hexadecimal 0x568C.
Here is how that answer was developed:
Year: 2023 - 1980 = 43 43 - seven bits: 0101011 Month: 4 - four bits: 0100 Day: 12 - five bits: 01100 Putting it all together: 0101011 0100 01100 0101011010001100 0101 0110 1000 1100 5 6 8 C
For input of R1 = 1, R2 = 1, R3 = 1980, the output in register zero should be hexadecimal 0x0021.
For input of R1 = 13, R2 = 13, R3 = 2013, the output in register zero should be minus one.
2023 - 1980 = 43 = 29 = 0b0101001; 4 = 0b0100; 12 = 0b01100; 0b0101001010001100; 0101 0010 1000 1100 = 0x528C
1980 - 1980 = 0 = 0b0000000; 1 = 0b0001; 1 = 0b00001; 0000000000100001 = 0000 0000 0010 0001 = 0x0021
Trending now
This is a popular solution!
Step by step
Solved in 3 steps