Thread: nop - revisited

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    1

    nop...???

    hi i've some assembler code using "nop" code. but i couldn't understand what nop for. this the code:
    -a100
    1384:0100 mov ah,02
    1384:0102 mov cx,000a
    1384:0105 mov dl,41
    1384:0107 mov bx,cx
    1384:0109 int 21
    1384:010B dec bx
    1384:010C inc dl
    1384:010E mov cx,0003
    1384:0111 int 21
    1384:0113 loop 111
    1384:0115 mov cx,bx
    1384:0117 nop
    1384:0118 mov bl,dl
    1384:011A mov dl,2d
    1384:011C int 21
    1384:011E mov dl,bl
    1384:0120 inc dl
    1384:0122 loop 107
    1384:0124 int 20
    1384:0126
    -g
    ABBB-CDDD-EFFF-GHHH-IJJJ-
    Program terminated normally

    n then i wanna modification that output become :
    A-BBB-C-DDD-E-FFF-G-HHH-I-JJJ-

    but i couldn't find the solve, could u help me. actulally what is nop for?


    thx ion

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Split from http://cboard.cprogramming.com/showthread.php?t=23653
    Which was a couple of years old.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    it does nothing really...basically it stops the processor and waits for an intereupt before resuming.

    edit: ha ha - nevermind....i read that on ti-82 reference
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well if you take out the nops (and nothing else), does it still do the same thing?

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    n then i wanna modification that output become :
    Sorry, but what on earth are you talking about?

    Assuming you want a decent answer: invest in a sensibly constructed question!

    Does that mean you are editing the code to remove the NOP? If so then your code is bound to choke as your code uses absolute values for offsets.

    loop 107 - This means jump to offset 107 if cx is not 0. Therefore if you lose the NOP, then offset 107 may no longer be the code that you expected it to be, and you no longer get the output expected.

    NOPs are handy when you are editing code outside an assembler (less use when you are still to assemble) as relational offsets are now changed with absolutes. Therefore, when you see a NOP in place, realise that it wont do anything, but realise that it may be there for a reason, and dont assume that it can be easilly removed without causing problems

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. NOP in 'C'?
    By danlee58 in forum C Programming
    Replies: 18
    Last Post: 01-26-2009, 12:56 PM
  2. dll to encrypt packet sends
    By splintter in forum C++ Programming
    Replies: 22
    Last Post: 04-20-2008, 09:00 PM
  3. Which one is "quicker" ?
    By AloneInTheDark in forum C# Programming
    Replies: 2
    Last Post: 02-08-2008, 09:23 PM
  4. nop
    By Eibro in forum Tech Board
    Replies: 3
    Last Post: 09-02-2002, 08:07 PM