Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Address Instruction 00 IN 01 STO 25 02 BRZ 09 03 IN 04 ADD 27 05 STO 27 06 LDA 25 07 SUB 26 08

Address Instruction

00 IN

01 STO 25

02 BRZ 09

03 IN

04 ADD 27

05 STO 27

06 LDA 25

07 SUB 26

08 BR 01

09 LDA 27

10 OUT

11 HLT

Address Contents

25 DAT ? 2 1 0 (decremented by 1 each time the loop is executed)

26 DAT 1

27 DAT 0

Assume now that the above program will only read 3 numbers. That is, the following numbers in this order will be placed, one at a time, in the In-basket: 2, 35, and 15, where 2 is the count of numbers that follow, and 35 and 15 are the numbers that are to be added. The first column in the table shows the order in which the instructions from the program will be executed. Trace the execution of these instructions and determine the contents of the PC before and after each instruction is executed. Also, write down in the table the contents of the In-basket; Accumulator; Memory locations 25, 26, and 27; and Out-basket after each instruction is executed. Memory location 25 controls the loop. It initially contains an unknown value (?), then 2, next 1, and finally 0. Memory location 26 always contains 1. It is used to decrease the loop count by 1. Memory location 27 is initialized with 0, and finally it stores 50, the sum of 35 and 15. The entry 00 > 01 in the PC column means that the PC is 00 when the instruction IN started and is changed to 01 when the instruction IN is finished.

The sequence in which instructions are executed

PC before > after

In-basket

Accumulator

Memory location 25

Memory location 26

Memory location 27

Out-basket

IN

00 > 01

2

2

?

1

0

?

STO 25

1

BRZ 09

1

IN

1

ADD 27

1

STO 27

1

LDA 25

1

SUB 26

1

BR 01

1

STO 25

1

BRZ 09

1

IN

1

ADD 27

1

STO 27

1

LDA 25

1

SUB 26

1

BR 01

1

STO 25

1

BRZ 09

1

LDA 27

1

OUT

1

HLT

1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions