165k views
1 vote
GETH4 - Get Hex-Get a 4-digit hex number and return it in RO.

1. Do not print any prompts.
2. Use GETHD to get a single hex digit into RO and print the digit. GETHD should take care of any bad characters. GETH4 should not in any way use GETC or IN. Use JSR GETHD to get each hex number.
3. DON'T MODIFY GETHD IN ANY WAY. It should still print the characters as they are typed.
4. Multiply Ro by the appropriate column value.
5. Add Ro to a sum for this number.
6. Repeat steps 2,3 , and 4 three more times. I would not use a loop, just copy, and paste.
7. The input will ALWAYS be 4 digits. So simply read a digit, process it, and repeat 4 more times.
8. Print a newline after you have processed the last number. You should see four hex digits on the screen on their own line after every call to GETH4.
9. Move the sum to RO. GETHD is efficient and MULT is also done.

1 Answer

4 votes

Final answer:

The student's question is about converting a four-digit hexadecimal number to decimal using a subroutine without loops, and involves reading, processing, and summing the values after multiplication with column values.

Step-by-step explanation:

The question pertains to writing a program to process a four-digit hexadecimal number. The process involves using a subroutine, GETHD, to read each hex digit, which is then printed and processed individually. For each read value in register RO, it must be multiplied by its corresponding column value (4096, 256, 16, 1) to convert it from hexadecimal to decimal.

The products are summed to compute the decimal value of the entire hexadecimal number. This must be done for each of the four digits without using loops, by copying and pasting the code four times. Once the sum is calculated, a newline character is printed, and the sum is stored back in RO.

User Ankit Kumar Gupta
by
8.3k points