Write a machine-language program to input two one-digit numbers, add them, and o
ID: 644064 • Letter: W
Question
Write a machine-language program to input two one-digit numbers, add them, and output the one-digit sum (use the listing in the first problem). Write it in a format suitable for the loader and execute it on the Pep/8 simulator.
use listing
0000 4900FE ;Get input from the user and store it @ 00FE
0003 4900FF ;Get input from the user and store it @ 00FF
0006 910022 ;Convert second input to decimal
0009 F100FA ;Store second decimal
000C D100FE ;Load first input into memory
000F 910022 ;Convert first input to decimal
0012 7100FA ;Add two numbers
0015 A10020 ;convert sum to character
0018 F1001F ;store the character
001B 51001F ;output the character
001E 00 ; stop
001F 00 ; character to output
0020 0030 ; convert mask to ASCII from decimal
0022 000F ; convert mask to decimal from ASCII
Explanation / Answer
Hex Version for the Loader in Pep/8 simulator
When I input 2 and 5, my output is 2.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.