Why is GCC using DI register?
Dan Aalberg
danialaa@conagramalt.com
Mon May 14 12:34:00 GMT 2001
I am trying to get some very simple assembly code from the GCC compiler for
some testing I am doing.
For sake of this email, I will over simplify the code.
Here is some simple C code I compile with GCC:
int main(void)
{
int a;
a=5;
return (a);
}
when I compile it, I get this for the machine code (with my comments):
push bp
mov bp,sp ; normal
sub (w) sp,+08 ;normal
mov [di-04],0005 ; what the heck is this?
add [bx+si],al ;where did BX and SI come into play?
;what are we adding?
mov ax,[di-04] ;next 2 lines are stupid.
mov [di-08],ax
mov ax,[di-08]
leave
retn
what is with BX, DI and SI? I am trying to compile to a flat, non specific
system and was looking for more of this:
push bp
mov bp,sp ; normal
mov [bp-4],0005
mov ax, [bp-4]
pop bp
retn
Am I missing a GCC command line switch (there are only 472 to choose from
:-)
Thanks in advance
Dan
More information about the Gcc
mailing list