For LMC, write assembly code to add two numbers and then subtract a third number
ID: 3673562 • Letter: F
Question
For LMC, write assembly code to add two numbers and then subtract a third number (the subtraction answer should be positive)
Mailbox Mnemonic Instruction Description
00
01
02
03
04
05
06
07
08
09
10
11
12
—————————————————————————
98 DAT 00 data
99 DAT 00 data
Explanation / Answer
Hi below i have written a sample LMC for your reference which adds two numbers,
IN
STO A
IN
ADD A
OUT
HLT
A DAT
ADDS THE FIRST NUMBER INPUT TO ITSELF,
THEN SUBTRACTS THE SECOND INPUT FROM THE TOTAL
00 IN;
01 STA 90;
02 IN;
03 STA 91;
04 LDA 90;
05 ADD 90;
06 SUB 91;
07 OUT;
08 HLT;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.