[comp.lang.c] Changing Segment Pointers ...

shearer@cis.udel.edu (Robb Shearer) (09/21/90)

I am wanting to have different Stacks depending on circumstances.

I am using Turbo C++ (In regular C mode).  I need to know how 
"real" the psueduovariables _SS _BP etc are...    I am wanting to 
point the stack into Expanded memory (Page Segment EC00) so that
I can swap out that page of memory and install a new stack...
(I plan on storing the _BP and _SP before swapping.. so when I restore
I can restore those too... I guess I need to store _SS just incase
the stack grows into another segment...hmmm..)  

I realize the overhead and the "danger" that is involved (at least I think
I do...!) in changing the stack like I want...  but for what I want to do..
I HAVE to.  

Can I simply do this (or something close... this is semi-psudeocode)

                 save_bp = _BP;
                 save_sp = _SP;
                 save_ss = _SS;
                 _SS = FP_SEG(0xec00);
                 _SP = old_sp;
                 _BP = old_bp;

(BTW:  What is the difference between _SP and _BP??  )

I am not sure if I am explaining myself clearly... if not please let me know!


Thanks in advance for any help!

Robb Shearer
shearer@sol.cis.udel.edu