Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an HLA Assembly program that prompts for an int8 value to inspect and then prints it in binary format. For example, here would

image text in transcribed imageimage

Write an HLA Assembly program that prompts for an int8 value to inspect and then prints it in binary format. For example, here would be the program output for various entered values Gimme a decimal value to print: 15 15 is 0000 1111 Gimme a decimal value to print: 7 7 is 0000 0111 (Hint: There is no standard output that prints in binary output, so you need to do this yourself. In order to accomplish this, you need to move a bit at time into the carry flag and print 0 or 1, depending on what you find in the Carry bit. Shift and repeat this procedure 8 times and you are done! Eventually, we will learn how to loop, which wodid make this task much less terrible.) (Second Hint:LAHF pushes the Carry Bit and all the other flags out of the EFLAGS register and into AH. As an Assembly programmer, you have the power to mask out all the bits but the one you are interested in by using either AND or OR.) PROGRAM 4: Double Table Using the ROL instruction to perform multiplication, write a program to produce a double table. This table should be built from a single int8 value provided by the user and print 4 rows from the starting value, each offset by one from the starting value. In that column, the pattern of doubled numbers should be calculated by ROL instructions. For example, the following output should be produced when the user inputs the starting value 4: Gimme a starting value: 4 Double Table 4: 81632 S: 10 20 40 6: 12 24 48 7: 14 28 56 For example, the following output should be produced when the user inputs the starting value 7: Gimme a starting value: 7 Double Table Gimme a decimal value to print: 7 7 is 0000_0111 (Hint: There is no standard output that prints in binary output, so you need to do this yourself. In order to accomplish this, you need to move a bit at time into the carry flag and print 0 or 1, depending on what you find in the Carry bit. Shift and repeat this procedure 8 times and you are done! Eventually, we will learn how to loop, which would make this task much less terrible.) (Second Hint:LAHF pushes the Carry Bit and all the other flags out of the EFLAGS register and into AH. As an Assembly programmer, you have the power to mask out all the bits but the one you are interested in by using either AND or OR.) PROGRAM 4: Double Table Using the ROL instruction to perform multiplication, write a program to produce a double table. This table should be built from a single int8 value provided by the user and print 4 rows from the starting value, each offset by one from the starting value. In that column, the pattern of doubled numbers should be calculated by ROL instructions. For example, the following output should be produced when the user inputs the starting value 4: Gimme a starting value: 4 Double Table 4: 8 16 32 5: 10 20 40 6: 12 24 48 7: 14 28 56 For example, the following output should be produced when the user inputs the starting value 7: Gimme a starting value: 7 Double Table 7: 14 28 56 8: 16 32 64 9: 18 36 72 10: 20 40 80 8:10 Back referenceguideii.htm Programmer's Reference to HLA Assembly Language Typical Program Structure program progID; #include "stdlib.hhf" ); static variable declarations begin progID; statements end progID; Assembly Language Instructions Instruction Syntax Description mov ( dest- MOV source, source; dest); Jadd ( ADD source, dest ); sub ( dest + source; dest- SUB SHL source, source: dest ); shl ( count, deat ); shuffles left a total of count bits Available Datatypes in dest int8 operand; int16 sets carry int32 when count-1 boolean shuffles right a total of count bits SHR shr ( count, in dest dest); operand; sets carry Available 1/0 Routines when count-1 stdout.put shuffles stdout.puti8 right a stdout.puti16 total of stdout.puti32 count bits stdout.putb in dest stdout.putw SAR sar ( count, operand; stdout.putd sets carry dest ); stdout.newIn when count-1; leaves H.O.stdin.get bit unchanged stdin.geti8 stdin.geti16 stdin.qeti32

Step by Step Solution

3.49 Rating (159 Votes )

There are 3 Steps involved in it

Step: 1

Here is a program in x86 assembly language that implements the double table as described in the ques... 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

Step: 3

blur-text-image

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

Operations Management A Supply Chain Process Approach

Authors: Joel D. Wisner

1st edition

978-1506354187, 1506354181, 1483383067, 978-1483383064

More Books

Students also viewed these Programming questions

Question

10. What is meant by a feed rate?

Answered: 1 week ago