www.digitalmars.com         C & C++   DMDScript  

c++.dos.32-bits - assembler troubles

reply "Gisle Vanem" <giva bgnett.no> writes:
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.
Jul 01 2002
parent "Gisle Vanem" <giva bgnett.no> writes:
"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.
Jul 01 2002