When asking the user for the date, ask for the Date, Month, and Year and read in each as a Dec (ReadDec). The MS-DOS Fil

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

When asking the user for the date, ask for the Date, Month, and Year and read in each as a Dec (ReadDec). The MS-DOS Fil

Post by answerhappygod »

When asking the user for the date, ask for the Date, Month, and Year and read in each as a Dec (ReadDec). The MS-DOS File Date is
Bit index Day 0-4
Month: 5-8
# Num of Bits 5
4
7
Year: 9-15
The year is stored as number of years since 1980
So 31st Dec 1999 would be store as 31, 12, and 19 in binary
day month year 31 12 19
11111 1100 0010011
Your program will have
1. Three procedures
a. main
b. pack
c. unpack
2. The main procedure will:
a. prompt the user for the date (3 numbers day, month, year)
b. read in the three numbers (readdec)
c. save the number in EAX, EBX, and ECX (day, month, year)
d. call procedure pack
e. printout the integer in EAX as a 16 bit binary number (see WriteBinB)
(this is the packup MS-DOS File Date) 1111111000010011
f. call unpack (with the value still in the EAX register)
g. print out the value in EAX, EBX, and ECX as “day: “, “month: “, and “year: “
Day: 31, Month: 12, Year: 1999
h. exit
3. The procedure pack
a. receives the day in EAX
b. receives the month in EBX
c. receives the year in ECX
d. uses shift and AND to pack these three values into a 16 bit binary value
(see notes, lecture, and/or format above)
e. stores is 16 bit value into eax (zero out top)
f. has a USES clause for the registers
4. The procedure unpack
a. receives the 16 bit value from main in EAX
mmccullough
2021 Fall
b. uses shift and AND to pull out the value for day, month, and year c. stores them in EAX, EBX, and ECX (respectively)
Use a good style and format your code well (e.g. indent your code correctly and consistently and space out lines and block only as much as is needed to felicitate readability). Have a comment block at the top of the file that includes the filename, description, course, project number, author, and data of last modification.
Don't change any of the names or registers used, as your code will then likely fail my testing.
; Program MS-DOSFileTime
; Program Description: take user given time and packet up into a 16 bit string and then show value ;
; use the following
; Day 1-31
; Month - 1-12
; Year - 25-31 (+1980) ;
; GET DAY FROM USER AND PACK UP INTO MS-DOX FILE TIME FORMAT ;
; Ask user for day (1-31: 5 bits)
; get value and save this value
; Ask user for month (1-12: 4 bits)
; get value and save this value
; Ask user for year (1980 - 2107) 2^7=128; 1980+19=1999
; get value subtract 1980 from it and save ;
; PACKUP THE DATE INTO 16 bits
; Copy year to DX (mov DX, year)
; Shift DX, to the right by 7 bits (size of bits needed for year) (shl dx, 7)
; Add month to DX (add DX, month)
; Shift dx by 4 bits (size of month) (shl dx, 4)
; add day to DX (add DX, day) ;
; So now the date is packed into DX as YYYY YYYM MMMD DDDD ;
; printout value as bit string (call WriteBinB) ;
; Now Verify what we just did worked (UNPACK AND PRINT)
; pull out year and print; pull out month and print; pull out day and print
in Assembly language
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply