- 2.1.1 -
TMT Pascal Language Description
Implementation IssuesMemory Organization
The TMT Pascal compiler uses the TMTSTUB (based on WDOSX) and PMWSTUB
(based on PMODE/W) extenders for a protected-mode program.
The segment registers are not used in protected mode.
Instead all address space is separated into 4Kb pages.
You do not need to add a special _zero variable to get access to the
physical addresses.
For example:
procedure clr_video(filler: char);
var
i: Integer;
begin
for i := 0 to 80 * 25 - 1 do
Mem[$B8000 + i * 2] := filler;
end;
This procedure fills the video memory of the VGA adapter with the filler
symbol. Note that the linear address $B8000 is used as the physical address -
not the segment address $B800.
Some another special variables are described in the SYSTEM unit. The
_psp variable contains the logical 32-bit address of the PSP of the
program, and the _environ variable contains the environment address.
Although you can access the interrupt vectors by using this method,
we do not suggest doing this.
Also keep in mind that MS-DOS interrupt handlers use memory addresses in
the 1st Mb of physical memory while your program and its data are loaded
beyond the 1st Mb. The TMTSTUB intercepts and correctly handles some, but
not all, calls to MS-DOS. Thus, if you are using Intr or MsDos
calls, or call MS-DOS from the assembler, you will need to modify the code.
Absolute memory addressing Mem, MemW, MemL, and MemD pseudo-arrays may be
used in BP-compatible manner:
var
x: type absolute seg:offs Mem[seg:offs];
Here the effective address is computed as seg*16+offs. The Ptr(seg, offs)
function works similarly. The Seg(v) function still always returns 0.
These new functions should substantially simplify the conversion of the
programs that use absolute addressing.
An example of using these functions can be found in file
TMTPL\SAMPLES\MSDOS\FLAME\FLAME.PAS
See also:
PMODE/W API
|
|
|
Implementation Issues |
Table of Content |
Calling Conventions |
- 2.1.1 -