TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: TIM HUTZLER
from: DARRYL GREGORASH
date: 1997-11-12 22:43:00
subject: jmp $+2

Replying to a message of Tim Hutzler to Serguei Shtyliov:
 TH>> It is considered poor programming practice with the 86xx family, but
 SS>> What do you mean?
 TH> A constant displacement is risky, since it may cause the
 TH> system to crash if the assembler options is set to use long
 TH> displacements.
Always a possibility, but one easily overcome by always using explicit 
overrides: JMP SHORT $+2 or JMP NEAR $+3, for example.
 SS>> It's been widely used to insert a delay between 2 I/O port
 SS>> accesses on the 80x86 PCs until 486/P5 have appeared.
 TH> NOPs would seem better, IMHO.
Not really; since the prefetch queue must be re-read as soon as the JMP is 
executed, the JMP instruction is virtually guaranteed to force enough time 
until the i/o instruction has completed and the response can be read. Given 
the unpredictability of hardware access time, it would be virtually 
impossible, I think, to predict the exact number of NOPs that would be 
required to produce enough of a wait in all instances.
The JMP has the added advantage, in situations where the memory footprint of 
the code is an issue, of requiring only 2 or 3 bytes, whereas one byte per 
NOP is always required.. a few bytes may not seem like much with the amount 
of memory generally available today, but if everyone thinks that way every 
time, total memory requirements will quickly build.
--- FleetStreet 1.20 NR
---------------
* Origin: BIG BANG Burger Bar: Regina SK Canada (1:140/86)

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™.