Assembly Language program

Discussion in 'Programmer's Corner' started by Thinker, Mar 30, 2007.

  1. Thinker

    Thread Starter Active Member

    Jan 9, 2007
    61
    0
    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.
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,142
    1,790
    I've been doing AL for 45 years, but I've never heard of sim88. Can you provide a link for reference?
     
  3. Thinker

    Thread Starter Active Member

    Jan 9, 2007
    61
    0
    Here is the screenprint of the program i was using to do the AL:

    [​IMG]
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,142
    1,790
    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.
     
  5. Thinker

    Thread Starter Active Member

    Jan 9, 2007
    61
    0
    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
     
  6. Papabravo

    Expert

    Feb 24, 2006
    10,142
    1,790
    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:
    Code ( (Unknown Language)):
    1.  
    2. MOV  DX,4
    3. is an instruction that moves the literal constant '4' into the DX register.
    4. The constant '4' is encoded into the instruction and is shorter than the 16 bits
    5. of the DX register.  So '4' is the source operand, and register DX is the
    6. destination operand.
    7.  
    As another example:
    Code ( (Unknown Language)):
    1.  
    2. DEC  DX
    3. is an instruction that takes the value in the DX register, subtracts one,
    4. and puts the result back in the DX register.  Register DX is one operand,
    5. the constant '1' is an implied operand, and register DX is the destination
    6. where the result is stored.
    7.  
    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
     
  7. Thinker

    Thread Starter Active Member

    Jan 9, 2007
    61
    0
    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.
     
  8. Papabravo

    Expert

    Feb 24, 2006
    10,142
    1,790
    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.
     
  9. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
  10. Thinker

    Thread Starter Active Member

    Jan 9, 2007
    61
    0
    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.
     
  11. Thinker

    Thread Starter Active Member

    Jan 9, 2007
    61
    0
    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?
     
  12. Thinker

    Thread Starter Active Member

    Jan 9, 2007
    61
    0
    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:

    subtract 4 from 18 and store result in 00f0:

     
  13. Papabravo

    Expert

    Feb 24, 2006
    10,142
    1,790
    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
     
  14. Thinker

    Thread Starter Active Member

    Jan 9, 2007
    61
    0
    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?
     
  15. Papabravo

    Expert

    Feb 24, 2006
    10,142
    1,790
    Code ( (Unknown Language)):
    1.  
    2. mov  ax,18
    3. mov  bx,4
    4. sub  ax,bx
    5. mov [00f0],ax
    6.  
    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!
     
  16. Thinker

    Thread Starter Active Member

    Jan 9, 2007
    61
    0
    Thanks Papabravo for the help on question 2.

    For question 3...thats what it said on the question paper.
     
  17. Thinker

    Thread Starter Active Member

    Jan 9, 2007
    61
    0
    Any help with the comments on the code Papa?
     
  18. Papabravo

    Expert

    Feb 24, 2006
    10,142
    1,790
    You need to do some of the work yourself.
     
  19. Thinker

    Thread Starter Active Member

    Jan 9, 2007
    61
    0
    Okay i'll try the comments by myself, do you mind checking it for me?
     
Loading...