DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   Computer Science and Software Design (http://www.daniweb.com/forums/forum14.html)
-   -   IAS computer (http://www.daniweb.com/forums/thread32326.html)

tenoran Sep 14th, 2005 8:29 pm
IAS computer
 
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.

sassou Oct 21st, 2005 8:16 am
Re: IAS computer
 
i have this prb too

mkohnlein17 Sep 18th, 2007 6:05 pm
Re: IAS computer
 
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)

Tronman Sep 23rd, 2007 5:06 pm
Re: IAS computer
 
Quote:

Originally Posted by mkohnlein17 (Post 436129)
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!

Tronman Sep 23rd, 2007 5:12 pm
Re: IAS computer
 
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


All times are GMT -4. The time now is 2:35 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC