V. Little Man Computer (5 points each, answer ONLY TWO QUESTIONS, 10 points tota
ID: 3596386 • Letter: V
Question
V. Little Man Computer (5 points each, answer ONLY TWO QUESTIONS, 10 points total) LMC Instruction Set 1231 xx ADD 2xx SUB xx STORE xx LOAD 6xx JUMP 7xx BRANCH ON O 8xx BRANCH ON 901 INPUT 902 OUTPUT 000 HALT In Basket Data Movenent BR BRZ BRP Input/Output Out Basket Machine Control (coffee break) Reset button location counter COB DUE OCT. 22 NAME: TEC625 MIDTERM Jsing the Little Man Computer and Instruction Set, answer A Write a program that asks for 3 numbers (say, A, B, and C) and then calculate Output the result. -A-B-C I.Explanation / Answer
data segment
a dw 0202h
b dw 0408h
c dw 0100H
ans dw ?
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data ; Initialize data section
mov ds,ax
mov ax,a ; Load number1 in ax
mov bx,b ; Load number2 in bx
add ax,bx
mov bx, c ; Load number3 in bx
add ax, bx ; add numbers. Result in ax
mov ans,ax ; Store the result in another location 'ans'. This is optional
code ends
end start
Output:
C:programs>tlink 16-add
Turbo Link Version 3.0 Copyright (c) 1987, 1990 Borland International
Warning: No stack
C:programs>16-add
0710
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.