www.digitalmars.com         C & C++   DMDScript  

c++.dos.16-bits - TSR and stack

reply "Zbynìk Jaro¹" <jaros swotes.cz> writes:
Hello

How I have to change stack between a TSR and interrupt program?

I try to use this code...

void interrupt newTimer()
{
....
(*oldTimer)();
if (running == 0)
{
  running = 1;
  disable();
  originalSP = _SP;
  originalSS = _SS;
  _SP = myStack;
  _SS = mySS;
  enable();
...
....
  disable();
  _SP = originalSP;
  _SS = originalSS;
  enable();
  running = 0;
}
}

but the sc compiler show the error message

C:\>sc c:\projekty\dos\pokus1.cpp -ms -cpp -d
        intss = _SS;
                   ^
c:\projekty\dos\pokus1.cpp(137) : Error: undefined identifier '_SS'
--- errorlevel 1
C:\>

Thanks Zbynek
Aug 14 2001
parent "Walter" <walter digitalmars.com> writes:
You'll need to resort to inline assembler:

    _asm
    {
        mov AX,originalSS
        mov SS,AX
    }


Zbynìk Jaro¹ wrote in message <9lao6g$1itc$1 digitaldaemon.com>...
Hello

How I have to change stack between a TSR and interrupt program?

I try to use this code...

void interrupt newTimer()
{
....
(*oldTimer)();
if (running == 0)
{
  running = 1;
  disable();
  originalSP = _SP;
  originalSS = _SS;
  _SP = myStack;
  _SS = mySS;
  enable();
...
....
  disable();
  _SP = originalSP;
  _SS = originalSS;
  enable();
  running = 0;
}
}

but the sc compiler show the error message

C:\>sc c:\projekty\dos\pokus1.cpp -ms -cpp -d
        intss = _SS;
                   ^
c:\projekty\dos\pokus1.cpp(137) : Error: undefined identifier '_SS'
--- errorlevel 1
C:\>

Thanks Zbynek
Aug 14 2001