Based on these Instruction Set Arithmetic 1xx ADD 2xx SUB Data Movement 3xx STORE 5xx LOAD BR 6xx JUMP BRZ 7xx BRANCH ON 0 BRP 8xx BRANCH ON + (Non-Negative) Input/Output 901 INPUT 902 Output Machine Control (coffee break) 000 HALT COB Below is a program to compute the quotient in an integer division: a ÷ b = cRd where a, c, and d are all non-negative integers, b is a positive integer, and c and d are respectively the quotient and the remainder. The program receives a and b as input from the In Basket and produces c as output into the Out Basket. IN STO a IN STO b test LDA a SUB b BRP count LDA c OUT HLT count STO a LDA c ADD one STO c BR test a DAT b DAT c DAT0 one DAT 1 Modify the program so that it produces both c and d as output into the Out Basket.
Based on these Instruction Set
Arithmetic 1xx ADD 2xx SUB
Data Movement 3xx STORE 5xx LOAD BR
6xx JUMP BRZ 7xx BRANCH ON 0 BRP 8xx BRANCH ON + (Non-Negative)
Input/Output 901 INPUT 902 Output
Machine Control (coffee break) 000 HALT COB
Below is a
a ÷ b = cRd
where a, c, and d are all non-negative integers, b is a positive integer, and c and d are respectively the quotient and the remainder. The program receives a and b as input from the In Basket and produces c as output into the Out Basket.
IN
STO a
IN
STO b
test LDA a
SUB b
BRP count
LDA c
OUT
HLT
count STO a
LDA c
ADD one
STO c
BR test
a DAT
b DAT
c DAT0
one DAT 1
Modify the program so that it produces both c and d as output into the Out Basket.
Please refer to the following step for the complete solution to the problem above.
Step by step
Solved in 2 steps