Mail Archives: djgpp/1995/02/23/19:48:48
On Thu, 23 Feb 1995, Michael Phelps wrote:
> long x;
>
> asm(
> "movl $0, _x\n"
> ::);
>
> (provided x is global/static), but how can I do the equivalent of C
>
> typedef struct
> {
> long first;
> long second;
> } vector;
>
> vector data[10];
>
> for (x=0; x < 10; x++)
> {
> data[x].first = 0;
> }
I'm not sure if this works, but give it a try:
asm ("\n\
push %eax \n\
push %ebx \n\
push %ecx \n\
movl _data, %ebx \n\
xorl %eax, %eax \n\
xorl %ecx, %ecx \n\
L_jump_label: \n\
movl $0x0, (%ebx, %eax,)\n\
addl $0x8, %eax \n\
addl $0x1, %ecx \n\
cmp $0xa, %ecx \n\
jnz L_jump_label \n\
pop %ecx \n\
pop %ebx \n\
pop %eax \n\
");
Hope that helps,
Long.
+--------------------------------------------------------+
| Long Doan ldoan1 AT osf1 DOT gmu DOT edu |
| ld AT netrix DOT com |
+--------------------------------------------------------+
- Raw text -