January 30, 2002 Problem with function containing inline assembly | |
|---|---|
/*
** 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);
}
| |
January 31, 2002 Re: Problem with function containing inline assembly | |
|---|---|
Posted in reply to tjulian | 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);
> }
>
>
>
|
January 31, 2002 Re: Problem with function containing inline assembly | |
|---|---|
Posted in reply to tjulian | 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);
> }
>
>
>
|
February 19, 2002 Re: Problem with function containing inline assembly | |
|---|---|
Posted in reply to Walter | 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 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); > > } > > > > > > > > |

Reply