Question: Please use this example as a format for the response: # Code to compute a divided by b IN STO a IN STO b #
Please use this example as a format for the response:
# Code to compute a divided by b
IN
STO a
IN
STO b
# Keep subtracting a from b until you go negative
# Keep a count of how many times you do it
start LDA count
ADD one
STO count
LDA a
SUB b
STO a
BRP start
done LDA count
# Subtract one as we went one too far
SUB one
OUT
HLT
a DAT 000
b DAT 000
count DAT 000
one DAT 001
I need to create a small program using the following instruction set:
ADD 1xx Add
SUB 2xx Subtract
STO 3xx Store
LDA 5xx Load
BR 6xx Branch
BRZ 7xx Branch on zero
BRP 8xx Branch on positive
IN 901 Input
OUT 902 Output
HLT 000 Halt or Stop
DAT Data storage location
Summation of 5 decimal numbers
Enter a number 001 to 999. If input is 000, exit program.
Output the sum of the 5 entered digits
Output a 000 if an overflow happens
Sort the 5 numbers
Output the 5 digits sorted High to Low
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
