July 01, 2002
What's wrong with these defines:

#define stackset(stk)  asm { mov  ax, ss    \
                             mov  ebx, esp  \
                             mov  cx, ds    \
                             mov  ss, cx    \
                             lea  esp, stk  \
                             push eax       \
                             push ebx }

#define stackrestore() asm lss esp, [esp]

When I say:
    static UINT stack [256];
    stackset (stack[255]);

The compiler issues this error:
      stackset (stack[255]);
                         ^
pcpkt.c(892) : Error: end of line expected

What's wrong?

Gisle V.

July 01, 2002
"Gisle Vanem" <giva@bgnett.no> wrote in message news:afpm7v$2db1$1@digitaldaemon.com...
> What's wrong with these defines:
> 
> #define stackset(stk)  asm { mov  ax, ss    \
>                              mov  ebx, esp  \
>                              mov  cx, ds    \
>                              mov  ss, cx    \
>                              lea  esp, stk  \
>                              push eax       \
>                              push ebx }

I figured it out. This works:
#define stackset(stk)  asm { mov  ax, ss;   \
                             mov  ebx, esp; \
                             mov  cx, ds;   \
                             mov  ss, cx;   \
                             lea  esp, stk; \
                             push eax;      \
                             push ebx      }

Gisle V.