0

thank you for reading the thread.
I need the help for my problem.

This is the question I am stuck with.

Memory contents in IAS computer.
Address////////Contents
08A//////////////010FA210FB
08B//////////////010FA0F08D
08C//////////////020FA210FB

the question is Show the assmbly code for the program
explain what this program does.

I really dont know the way to solve.

4
Contributors
4
Replies
6
Views
11 Years
Discussion Span
Last Post by Tronman
0

Address/////////Contents
08A//////////////010FA210FB
08B//////////////010FA0F08D
08C//////////////020FA210FB

Here is a simple way to understand this problem:

Contents are divided up into two 5 bit instructions, LH and RH

LH instruction = 010FA
opcode = 01
address = 0FA

RH instruction = 210FB
opcode = 21
address = 0FB

Since this is in hexadecimal form you have to convert the numbers to binary form: (use the IAS instruction set)
LH instruction:
01 = 00000001 = LOAD M(X)
M(X) refers to the memory address location 0FA
The first 5 bits of 08A should read - LOAD M(0FA)

RH instruction:
21 = 00100001 = STOR M(X)
M(X) refers to the memory address location 0FB
The second 5 bits of 08A should read - STOR M(0FB)

Now, do this for the contents in 08B and 08C and you will have your assembly language code which should look like this:

LOAD M(0FA)
STOR M(0FB)
LOAD M(0FA)
JUMP + M(08D, 0:19)
LOAD - M(0FA)
STOR M(0FB)

0

Address/////////Contents
08A//////////////010FA210FB
08B//////////////010FA0F08D
08C//////////////020FA210FB

Here is a simple way to understand this problem:

Contents are divided up into two 5 bit instructions, LH and RH

LH instruction = 010FA
opcode = 01
address = 0FA

RH instruction = 210FB
opcode = 21
address = 0FB

Since this is in hexadecimal form you have to convert the numbers to binary form: (use the IAS instruction set)
LH instruction:
01 = 00000001 = LOAD M(X)
M(X) refers to the memory address location 0FA
The first 5 bits of 08A should read - LOAD M(0FA)

RH instruction:
21 = 00100001 = STOR M(X)
M(X) refers to the memory address location 0FB
The second 5 bits of 08A should read - STOR M(0FB)

Now, do this for the contents in 08B and 08C and you will have your assembly language code which should look like this:

LOAD M(0FA)
STOR M(0FB)
LOAD M(0FA)
JUMP + M(08D, 0:19)
LOAD - M(0FA)
STOR M(0FB)

I didn't have any trouble figuring out the assembler. I'm stuck on the second part of the question though, explaining what it does. Specifically, the 4th step (JUMP + M(08D, 0:19)). It says "If number in the accumulator is nonnegative, take the next instruction from left half of M(X)" or the left half of 08D. I have two problems here. First, although I know the value in the accumulator came from 0FA, I don't know what the specific value of 0FA is, and thus I have no idea if it is positive or not. Secondly, if it is positive, I don't have 08D to go too (only 08A to 08C).

The only other think I can think of is that it's saying "Check the value of the accumulator. If it's positive, do the jump. If not, go to the next step." The next step being to Load the negative of 0FA into the accumulator, then store it to 0FB.... So it's saying "if it's negative, keep it negative. If it's positive, make it negative." is this right?

Thanks!

0

Err...wait, maybe it's saying "if it's positive, keep it positive. If it's negative, make it positive".

Err....trying again, it loads 0FA into the accumulator. It then stores the accumulator into 0FB. It loads 0FA to the accumulator again. If 0FA is negative, store the negative of 0FA (thus the positive) into 0FB. So in any case, 0FB stores the positive of 0FA

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.