c++.dos.16-bits - Problem with function containing inline assembly
- "tjulian" <t t.com> Jan 30 2002
- "Walter" <walter digitalmars.com> Jan 30 2002
- "Walter" <walter digitalmars.com> Jan 31 2002
- "tjulian" <tjulian removethis.oldi.com> Feb 19 2002
/*
** The readx routine below always returns 0.
** compile with:
** sc -mld -3 -o+all readx.c
*/
#include <stdio.h>
unsigned int readx(unsigned int *p)
{
unsigned int x;
if (p)
{
asm
{
les bx,p
mov ax,ES:[bx]
mov x,ax
}
}
else
{
x = 0;
}
return(x);
}
int main(int argc, char *argv[])
{
unsigned int x,y;
x = 55;
y = readx(&x);
printf("y=%d\n",y);
}
Jan 30 2002
Thanks for the bug report! "tjulian" <t t.com> wrote in message news:a39igt$1o1h$1 digitaldaemon.com.../* ** The readx routine below always returns 0. ** compile with: ** sc -mld -3 -o+all readx.c */ #include <stdio.h> unsigned int readx(unsigned int *p) { unsigned int x; if (p) { asm { les bx,p mov ax,ES:[bx] mov x,ax } } else { x = 0; } return(x); } int main(int argc, char *argv[]) { unsigned int x,y; x = 55; y = readx(&x); printf("y=%d\n",y); }
Jan 30 2002
I fixed it, but your email address is invalid so I can't send it to you. -Walter "tjulian" <t t.com> wrote in message news:a39igt$1o1h$1 digitaldaemon.com.../* ** The readx routine below always returns 0. ** compile with: ** sc -mld -3 -o+all readx.c */ #include <stdio.h> unsigned int readx(unsigned int *p) { unsigned int x; if (p) { asm { les bx,p mov ax,ES:[bx] mov x,ax } } else { x = 0; } return(x); } int main(int argc, char *argv[]) { unsigned int x,y; x = 55; y = readx(&x); printf("y=%d\n",y); }
Jan 31 2002
Walter, This problem is fixed in the 8.27.2 beta. Thanks! Tim "Walter" <walter digitalmars.com> wrote in message news:a3cbid$s25$1 digitaldaemon.com...I fixed it, but your email address is invalid so I can't send it to you. -Walter "tjulian" <t t.com> wrote in message
/* ** The readx routine below always returns 0. ** compile with: ** sc -mld -3 -o+all readx.c */ #include <stdio.h> unsigned int readx(unsigned int *p) { unsigned int x; if (p) { asm { les bx,p mov ax,ES:[bx] mov x,ax } } else { x = 0; } return(x); } int main(int argc, char *argv[]) { unsigned int x,y; x = 55; y = readx(&x); printf("y=%d\n",y); }
Feb 19 2002









"Walter" <walter digitalmars.com> 