delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/16/14:27:14

From: ams AT ludd DOT luth DOT se (Martin Str|mberg)
Newsgroups: comp.os.msdos.djgpp
Subject: Some assembly questions
Date: 16 Mar 1999 18:51:44 GMT
Organization: University of Lulea, Sweden
Lines: 53
Message-ID: <7cm980$f69$1@news.luth.se>
NNTP-Posting-Host: queeg.ludd.luth.se
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

How do I set or clear the carry flag? I _think_ "andl %%eax, %%eax" 
clears it (and "orl %%eax, %%eax" too).

How do I inhibit the gcc generated pre- and postlude to c functions?

Like if I have:

int eax;

void my_interrupt_handler(void)
{
	/* Get eax. */
	asm(""
	    : "=a" (eax)
	    : /* No input. */
	    );

/* Do some c stuff. */

	asm("sti"
	 "\n iret"
	    : /* No output. */
	    : /* No input. */
	    );

}


This generates (-S switch to gcc):

pushl %ebp
movl %esp,%ebp
pushl %esi
pushl %ebx

/* Here comes my code from above.*/

movl %eax,_eax

/* The c stuff in assembly. */

sti
iret



If I am not completely misstaken my iret will probably wreck havoc on
the stack, won't it?


Shostakovich, String Quartet No. 15,

							MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019