Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!amdcad!ames!ll-xn!mit-eddie!husc6!cca!mirror!prism!jvc From: jvc@prism.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: NOP Message-ID: <206900082@prism> Date: Wed, 30-Sep-87 08:54:00 EDT Article-I.D.: prism.206900082 Posted: Wed Sep 30 08:54:00 1987 Date-Received: Sun, 4-Oct-87 21:37:46 EDT References: <2306@sphinx.uchicago.edu> Lines: 36 Nf-ID: #R:sphinx.uchicago.edu:-230600:prism:206900082:000:1762 Nf-From: prism.UUCP!jvc Sep 30 08:54:00 1987 >>(Charles Blair) writes: >> The NOPs are never executed and don't slow down the >>processor. >Bill Douglass writes: >Actually, I thought that NOPs did an OR of the AX register on itself (or some >similar ... ) As such, they DO affect the execution time involved. Could >someone knowledgeable confirm or refute this? Yes, NOPs are executed when encountered. They are actually XCHG AX,AX which requires 3 clock cycles to execute. HOWEVER, when the NOP is used as a pad when the assembler decides that it only needs a 2-byte JMP opcode (it decides this on the second pass after already reserving 3 bytes for a forward jump) , the NOP will never (under normal circumstances) be executed. This should be obvious since the JMP isn't going to be a JMP to that NOP (the very next byte). The only way THAT NOP will ever be executed is if you jump or branch to its address (which you'd probably never do). Think about it. FYI -- Use of SHORT operator: "The SHORT operator is used to tighten up code. Two different JMP instructions will perform identically in many cases. The 3-byte JMP opcode can force execution to any place within the current code segment. A 2-byte JMP opocode can be used to transfer control to within +127 to -128 bytes of the jump instuction." "The assembler will use the shorter form whenever it knows that the short jump is valid, that is, when the jump is backward to a label it has already processed. But the assembler has no way of knowing if a forward jump can use the 2-byte opcode. The purpose of the SHORT operator is to tell the assembler that the short form of the JMP opcode is possible" The above two paragraphs taken from Dan Rollins' "IBM PC 8088 Macro Assembler Programming", C1985. jvc@mirror.tmc.com