TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: GLENN DELAHOY
from: CRAIG HART
date: 1997-10-31 07:52:00
subject: jmp $+2

Hi..
 GD> can someone tell me what this means please:
 GD> jmp $+2
Yup..
$ represents the IP register. So, since the JMP instruction is 3 bytes long, 
(1 byte opcode and 2 bytes destination) basicly this instruction will jump to 
the next instruction that follows.
Why do you see this strange behaviour in code? If you jump to the next 
instruction, why not just leave it out all together, or perhaps use NOP?
Bascily, JMP is used as a slightly longer delay than NOP. JMP flushes the 
instruction prefetch queue and serialises pentium+ pipelines, so it acts as a 
slightly longer delay than a NOP (which doesnt). JMP modifies no registers so 
it is a more 'useful' delay than one built around LOOP, or dec + jnz 
utines.
Some code does not function correctly (especially port accesses) unless
these very small delays are inserted into code. Some examples include driving 
the parallel port Strobe line, Controlling A20, 8250 serial port chips, 8 bit 
VGA's...  etc etc.
       Craig
--- FMail/386 1.20+
---------------
* Origin: Communications Barrier BBS (03) 9585 1112, 24hrs (3:632/533)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.