Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Exercise 4 (8 points): (Implementing ReadHexByte) The objective is to write the procedure ReadHexByte to input from the keyboard a byte b (i.e., two

image text in transcribed

Programming Exercise 4 (8 points): (Implementing ReadHexByte) The objective is to write the procedure ReadHexByte to input from the keyboard a byte b (i.e., two digits) and store b in the register AL. In order to achieve this, you must read consecutively two hexadecimal digits from the keyboard (use ReadChar for each digit). We assume that the user will enter only TWO hexadecimal digits (ie. '0' to F'). The first digit entered will be set as the most significant nibble of AL and the second digit entered will be set as the least significant nibble of AL. Process appropriately the two characters and store in AL the value meant by the user. Examples: Suppose the user enters the digit '9' followed by the digit 4'. This means that the user means the byte 94h. The procedure ReadHexByte must ultimately store in AL the value 94h (1001 0100)2. The digit 9 'produced the most significant nibble (100l)2 and the digit '4' 'produced the least significant nibble (0100)2 Suppose the user enters the digit 'B' followed by the digit '8.This means that the user means the byte B8h. The procedure ReadHexByte must ultimately store in AL the value B8h (101I 1000)2. The digit 'B' produced the most significant nibble (10 2 and the digit '8 produced the least significant nibble (1000)2 2) Programming Exercise 4 (8 points): (Implementing ReadHexByte) The objective is to write the procedure ReadHexByte to input from the keyboard a byte b (i.e., two digits) and store b in the register AL. In order to achieve this, you must read consecutively two hexadecimal digits from the keyboard (use ReadChar for each digit). We assume that the user will enter only TWO hexadecimal digits (ie. '0' to F'). The first digit entered will be set as the most significant nibble of AL and the second digit entered will be set as the least significant nibble of AL. Process appropriately the two characters and store in AL the value meant by the user. Examples: Suppose the user enters the digit '9' followed by the digit 4'. This means that the user means the byte 94h. The procedure ReadHexByte must ultimately store in AL the value 94h (1001 0100)2. The digit 9 'produced the most significant nibble (100l)2 and the digit '4' 'produced the least significant nibble (0100)2 Suppose the user enters the digit 'B' followed by the digit '8.This means that the user means the byte B8h. The procedure ReadHexByte must ultimately store in AL the value B8h (101I 1000)2. The digit 'B' produced the most significant nibble (10 2 and the digit '8 produced the least significant nibble (1000)2 2)

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

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

5. Interpret SPSS multiple regression output

Answered: 1 week ago

Question

Were the right people involved in the decision-making process?

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago