Write a machine language program to input two one-digit numbers, add them, and output the one-digit sum. There can be no space between the two one-digit numbers on input. Write the program in a format suitable for the loader and execute it on the Pep/9 simulator. It needs to be in hexadecimal, I am just confused on how to input numbers on the PEP/9 machine.
Greetings!!
Code:
BR MAIN ;Branch to main program
PROMPT: .ASCII "PLEASE ENTER THE NUMBERS\X00" ;prompt message
N1: .BLOCK 1 ;variable for number 1
N2: .BLOCK 1 ;variable for number 2
SUM: .BLOCK 1 ;variable for storing sum
MAIN: STRO PROMPT,D ;prompt the message on to the screen
DECI N1,d ;read first number from the user
LDA N1,D ;load first number to accumulator
DECI N2,D ;read second number from the user
ADDA N2,D ;addd accumulator content with second number ie add both the numbers
STA SUM,D ;store the answer to the variable SUM
DECO SUM,D ;display sum
STOP ;stop
.END
Output screenshot:
Hope this helps
Get Answers For Free
Most questions answered within 1 hours.