Write a Little Man program that accepts an indefinite number

Write a Little Man program that accepts an indefinite number of input values. The output value will be the largest of the input values. You should use the value 0 as a flag to indicate the end of the input. You are required to use symbolic addressing Write the pseudocode first to perform this task and then write the LMC code.

Solution

Try this..........

INP
STA FIRST
INP STA SECOND
INP
STA THIRD
TOP LDA FIRST
SUB SECOND
BRP SWAPFS
LDA SECOND
SUB THIRD
BRP SWAPST
BRA RESULT
SWAPFS LDA FIRST
STA TMP LDA SECOND
STA FIRST
LDA TMP
STA SECOND
BRA TOP
SWAPST LDA SECOND
STA TMP
LDA THIRD
STA SECOND
LDA TMP
STA THIRD
BRA TOP
RESULT LDA FIRST
OUT
LDA SECOND
OUT
LDA THIRD
OUT
HLT
FIRST DAT
SECOND DAT
THIRD DAT
TMP DAT

Write a Little Man program that accepts an indefinite number of input values. The output value will be the largest of the input values. You should use the value

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site