Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HLA programming I am trying to modify the code below from 16-bit short packed date format to 32-bit, long packed date format, which i assume

HLA programming

I am trying to modify the code below from 16-bit short packed date format to 32-bit, long packed date format, which i assume I will have to envolve "eax" the register.

The code below intakes an input of a date in the format (MM, DD, YY) and outpiut the hexadecimal format which can be managed by a 16-bit packed data. But we are required to intake an input of a date in the format (YYYY, MM, DD) and pref orm the same function but this requires more than 16 bit so we are supposed to use a 32 bit pakage which will require us to invlove eax for an additional 16 bit of storage. (i.e. Input: March 26, 1948. (input: 1948, 3, 26), Output will be 079C031A)

program dateDemo; #include( "stdlib.hhf" ) static day: uns8; month: uns8; year: uns8;

packedDate: word; begin dateDemo;

stdout.put( "Enter the current month, day, and year: " ); stdin.get( month, day, year ); // Pack the data into the following bits: // // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 // m m m m d d d d d y y y y y y y

mov( 0, ax ); mov( ax, packedDate ); // Just in case there is an error.

if( month > 12 ) then stdout.put( "Month value is too large", nl ); elseif( month = 0 ) then stdout.put( "Month value must be in the range 1..12", nl ); elseif( day > 31 ) then stdout.put( "Day value is too large", nl ); elseif( day = 0 ) then stdout.put( "Day value must be in the range 1..31", nl ); elseif( year > 99 ) then stdout.put( "Year value must be in the range 0..99", nl ); else

mov( month, al ); shl( 5, ax ); or( day, al ); shl( 7, ax ); or( year, al ); mov( ax, packedDate ); endif;

// Okay, display the packed value: stdout.put( "Packed data = $", packedDate, nl ); // Unpack the date: mov( packedDate, ax ); and( $7f, al ); // Retrieve the year value. mov( al, year ); mov( packedDate, ax ); // Retrieve the day value. shr( 7, ax ); and( %1_1111, al ); mov( al, day );

mov( packedDate, ax ); // Retrieve the month value. rol( 4, ax ); and( %1111, al ); mov( al, month );

stdout.put( "The date is ", month, "/", day, "/", year, nl ); end dateDemo;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems Uropean Conference Adbis 2020 Lyon France August 25 27 2020 Proceedings Lncs 12245

Authors: Jerome Darmont ,Boris Novikov ,Robert Wrembel

1st Edition

3030548317, 978-3030548315

More Books

Students also viewed these Databases questions

Question

How to define good business writing

Answered: 1 week ago

Question

How does selection differ from recruitment ?

Answered: 1 week ago