Assembly Language program

Thread Starter

Thinker

Joined Jan 9, 2007
62
There is another thread on assembly langauge program here, but i didn't want to bump into thread and ask a question.

So i was wondering is anyone here good at assembly langauge (like sim88)?

Here are three codes i need:

subtract 4 from 18 and store result in 00f0
subtract 8 and 7 and store result in 00f2


and there is a last one using using a loop which multiplies 4 by 4 and stores the result in 00f8.
 

Papabravo

Joined Feb 24, 2006
21,159
Well the screenprint was just about as useless as the original name.

Here's what I know:
The program's name is "Sim88"
It probably allows you to write AL for an 8086/8088 processor.
I've never heard of it or used it.

Here's what I don't know:
Does it use the same set of opcodes as some the other 8086/8088 assemblers, Borland's TASM or MIcrosoft's ASM86 for example?
Are 00f0 and 00f2 locations in memory?
What segment are they located in?

I don't think it is asking to much to encourage you to provide just a bit more information.
 

Thread Starter

Thinker

Joined Jan 9, 2007
62
Okay i get what you mean, but i can't answer your above question because my college is closed and can't get the nesscessary information but.....

Here is a sample of the code i use on it:

100 MOV DX, 04
103 STC
104 CLC
105 DEC DX
106 JNZ 103
108 BRK
 

Papabravo

Joined Feb 24, 2006
21,159
OK, so you have a few lines of code and it looks like 8086 Assembly language.

DX is the name for one of the processor registers. Many of the instructions have operands which are to be interpreted as a source and a destination. For example:
Rich (BB code):
MOV  DX,4
is an instruction that moves the literal constant '4' into the DX register.
The constant '4' is encoded into the instruction and is shorter than the 16 bits
of the DX register.  So '4' is the source operand, and register DX is the
destination operand.
As another example:
Rich (BB code):
DEC  DX
is an instruction that takes the value in the DX register, subtracts one,
and puts the result back in the DX register.  Register DX is one operand,
the constant '1' is an implied operand, and register DX is the destination
where the result is stored.
With an instruction set reference, available from the the AMD website, you should be able to answer your own questions. Subtraction can be done from register to register, or register to memory.

With a bit of effort I found an Instruction set reference
http://www.amd.com/files/connectivitysolutions/e86embedded/am186cc/21267.pdf
 

Thread Starter

Thinker

Joined Jan 9, 2007
62
Okay thanks mate.

Was wondering where can i get the assembly langauage program to use on my Windows XP?

I'm of college for 2 weeks (which means i can't do any ALP) and the day I come back is when i have to hand it in.
 

Papabravo

Joined Feb 24, 2006
21,159
If you need a freeware package I would google for it. Sourceforge.net would be my first choice for a good place to look. If you're up for a commercial package I'm sure google will come up with one of those.

The security guy at Gibson Research goes on about writing assembbly language programs on his site. You might find a useful link there.
 

Thread Starter

Thinker

Joined Jan 9, 2007
62
Thanks Papabravo & thingmaker3 for the help, i'll take a look at both of your suggestion and try do this damn AL program.

p.s. - sorry for the late reply.
 

Thread Starter

Thinker

Joined Jan 9, 2007
62
Hey Papabravo sorry for this late reply...but i've managed to do the two of the three AL.

I'll post them down here later today.

Do you mind if you can check them for me to see if it's right?
 

Thread Starter

Thinker

Joined Jan 9, 2007
62
Okay, can someone check these two answers for me to see that i'm on the right track.

subtract 8 and 7 and store result in 00f2:

0100-mov ax, 8
0103-mov bx, 7
0106-add ax, bx
0108-mov[00f2], ax
010B-brk
010C-^c
sim
sim
sim
sim
subtract 4 from 18 and store result in 00f0:

0103-mov bx, 4
0106-sub ax, bx
0108-brk
0109-^C
sim
sim
sim
sim
 

Papabravo

Joined Feb 24, 2006
21,159
In example 1 you used an add instruction instead of subtract

In example 2 you for got to load ax with 18, and you forgot to store the result
 

Thread Starter

Thinker

Joined Jan 9, 2007
62
Thanks Papabravo,

Can you tell me where i should edit example 2?...this is where you said "for got to load ax with 18, and you forgot to store the result". Like how should i write the code with the corrections because i ain't in the lab at the moment.

p.s. - can you help me with 3, if possible?
 

Papabravo

Joined Feb 24, 2006
21,159
Rich (BB code):
mov  ax,18
mov  bx,4
sub  ax,bx
mov [00f0],ax
In 3, I don't understand why you need a loop to multiply 4 b y 4 and store the result. Just do it FCS!
 

Thread Starter

Thinker

Joined Jan 9, 2007
62
Thanks Papabravo for the help on question 2.

For question 3...thats what it said on the question paper.
 
Top