SSeg

From Delphi Pascal wiki
Jump to navigation Jump to search

Returns the current value of the SS register.

Declaration
function SSeg: Word;
Target
Windows, Real, Protected
Remarks
The result, of type Word, is the segment address of the stack segment.
See Also
CSeg
DSeg
SPtr


Sample Code

{CSeg.PAS}
{Sample code for the CSeg, DSeg, SSeg, SPtr, Ofs, and Seg functions.}

{ For Windows: }
{ uses WinCrt; }

procedure WriteHexWord(w: Word);
const
 hexChars: array [0..$F] of Char = '0123456789ABCDEF';
begin
 Write(hexChars[Hi(w) shr 4],
       hexChars[Hi(w) and $F],
       hexChars[Lo(w) shr 4],
       hexChars[Lo(w) and $F]);
end;
var
 i: Integer;
begin
 Write('The current code segment is $');
 WriteHexWord(CSeg); Writeln;
 Write('The global data segment is $');
 WriteHexWord(DSeg); Writeln;
 Write('The stack segment is $');
 WriteHexWord(SSeg); Writeln;
 Write('The stack pointer is at $');
 WriteHexWord(SPtr); Writeln;
 Write('i is at offset $');
 WriteHexWord(Ofs(i));
 Write(' in segment $');
 WriteHexWord(Seg(i));
end.