Thread: Please help me!

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    39

    Please help me!

    Hi,
    i hv a problem in intel 80x86 assembly language programming
    my Question is:
    Add these two number

    22
    +88
    ----
    100
    this program is in REAL MODE (16 bit programming)

    i known This Board Is Not For Assembly Language , BUT Please Help Me .
    Admin PLease tell Me Where I Wrote My Question please please .
    ThankYou.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Actually, the tech board is fine for assembly questions. Just don't expect too much expertise.

    So ... what have you tried, and why doesn't it work? We don't do your homework.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Whoops, I moved this thread from the C++ programming board to here and forgot to leave a note.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I don't know assembly, but (from http://en.wikipedia.org/wiki/X86_assembly_language):
    Integer ALU instructions
    x86 assembly has the standard mathematical operations, add, sub, mul, with idiv; the logical operators and, or, xor, neg; bitshift arithmetic and logical, sal/sar, shl/shr; rotate with and without carry, rcl/rcr, rol/ror, a complement of BCD arithmetic instructions, aaa, aad, daa and others.
    Wouldn't one use the add instruction? . . .
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Code:
       mov ax, 22
       add ax, 88
    Except that will make 110, but never mind. [Probably breaking the rules about Homework here]

    --
    Mats

  6. #6
    Registered User
    Join Date
    Nov 2006
    Posts
    39

    Question This For All Repies :(

    First Of All , My Question Is Not HOMEWORK.
    my friend ask me this Question , and i don't hv ans it.
    please if any body known the answer of this then, i wiil be very thank for him/her.
    ThankYou Again.

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I think my answer is correct - it's very low on context, but so is your question.

    The fact that 22 + 88 gives the answer 110 is not a fault of the code I wrote, but rather that 22 + 88 makes 110 whatever method you add them - try it with a calculator, or by hand, or soemthing.

    THere are of course multiple other ways to add two numbers together in assembler, because there are several instructions that result in the same thing:

    A less obvious variety:
    Code:
       mov ax, 22
       mov bx, 88
       neg  bx
       sub  ax, bx
    This is equivalent to 22 - (-88), which of course is the same as 22 + 88.

    Result is still 110 of course.
    --
    Mats

Popular pages Recent additions subscribe to a feed