CSeg.PAS

Language:
Русский
English

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

  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.

Тэги:
| G+
Код для вставки: :: :: :: ::
Поделиться: // //