Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a machine-language program to input two one-digit numbers, add them, and o

ID: 3670938 • Letter: W

Question

Write a machine-language program to input two one-digit numbers, add them, and output the one-digit sum. Write it in a format suitable for the loader and execute it on the Pep/8 simulator.

My solution was:
49 00 60 49 00 61 D1 00 60 71 00 61 90 00 0F A0 00 30
F1 00 62 51 00 62 00 zz

Using the example of (23), I would get incorrect output. Searching for help, I found that changing 71 00 61 to 71 00 60, helped. Here's what I can't understand:

49 00 60: Input first character, store at mem[0060]
49 00 61: Input second character, store at mem[0061]
D1 00 60: Load byte mem[0060] to register 0 (Accumulator)
71 00 6*: Here's my problem step. With mem[0060] store in the Accumulator, I think that the next step here is to add the two characters. Therefore, I would add the value from mem[0061]. This is incorrect for some reason. But if I add the value from mem[0060], which is the same value in the accumulator, the output is correct.

What am I missing?

Explanation / Answer

Hi below i have written a sample code for machine-language program to input two one-digit numbers and add them for your reference,

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote