LMC Questions
+ Please highlight your answers in 'amend' questions
- Amend the following program so that it adds together three numbers:
~ INP ~ STA Num1 ~ INP ~ ADD Num1 + STA Num1 + INP + ADD Num1 ~ OUT ~ Num1 DAT
- Write a program that takes in 2 numbers and subtracts the second from the first:
> INP STA 0 INP SUB 0 OUT
- Write a program that outputs the larger of two numbers:
> INP STA 0 INP SUB 0 BRP 8 LDA 0 OUT HLT ADD 0 OUT
- BRZ branches when 0 is stored in the accumulator.
Write a program that takes in two numbers and outputs 1 if they are the same, and 0 if they are different.> INP STA 0 INP SUB 0 BRZ 9 LDA 7 OUT HLT DAT 1 LDA 8 OUT