From: oml1 AT Ra DOT MsState DOT Edu (Owen LaGarde) Newsgroups: comp.os.msdos.djgpp Subject: Funky asm startTimer block -- why the odd 'jmp' statements? Date: 16 May 1997 14:23:26 GMT Organization: Mississippi State University Message-ID: <5lhqku$32e$1@NNTP.MsState.Edu> NNTP-Posting-Host: ra.msstate.edu Lines: 35 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Here's a fragment of code passed to me in response to a request for a start-timer asm example. What is this? Why the funky jump-to-label- immediately-following, and why the doubled-up second call? It goes something like this ... void Timer::start() { if( !running ) { outportb( 0x43, 0x34 ); asm jmp __1; __1: outportb( 0x40, 0 ); asm jmp __2; __2: outportb( 0x40, 0 ); startTime.dosCount = *dosTime; startTime.timerCount = 0; running = 1; } } Is this a funky way to force alignment? When I learned assembler it was for the M6800 family, not ix88/86, but this doesn't make any sense to me. Labels '__1' and '__2' are unique, so the jmp op target is internal to this routine. I don't have access to an ix86 assembler reference, but the only way I can see this code being usefull is if an absolute jmp acted like a jnz instead, and on 0 skipped to the next label as well ... which is just plain ridiculous from a Motorola standpoint, so I'm betting it's something else. -- Owen LaGarde | Performance prediction through Forest Products Research Laboratory | AI-driven process simulation Mississippi State University | oml1 AT ra DOT msstate DOT edu (130.18.80.10) | "... Oh, what a Tangled Web ..."