Question: 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

 Programming Exercise 4 (8 points): (Implementing ReadHexByte) The objective is to

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!