Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
MEMORY.PAS
◄Example► ◄Contents► ◄Index► ◄Back►
PROGRAM memory;
{ MEMORY.PAS illustrates Intel segmented architecture using the
following functions:
CSeg DSeg Ofs Ptr Seg SPtr SSeg
}
CONST
program_name = 'MEMORY ';
program_desc = 'uses segment and pointer routines.';
VAR
x : Integer;
off, segm : Word;
ds, cs, ss, sp : Word;
p : ^Integer;
BEGIN
Writeln( program_name, program_desc );
Writeln;
x := 30000;
off := Ofs(x );
segm := Seg(x );
Writeln;
Writeln( 'segment: ',segm,' ','offset: ',off );
p := Ptr( segm, off );
Writeln( 'number stored at that address is: ',p^ );
cs := CSeg;
ds := DSeg;
Writeln;
Writeln( 'code segment: ',cs,' ', 'data segment: ',ds );
ss := SSeg;
sp := SPtr;
Writeln( 'stack segment: ',ss,' ','stack pointer offset: ',sp );
Writeln;
END.