Thread overview
Problem with function containing inline assembly
Jan 30, 2002
tjulian
Jan 31, 2002
Walter
Jan 31, 2002
Walter
Feb 19, 2002
tjulian
January 30, 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);
}



January 31, 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);
> }
>
>
>


January 31, 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);
> }
>
>
>


February 19, 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
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);
> > }
> >
> >
> >
>
>