[fpc-pascal] variable declarations with 'absolute' syntax

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Wed Oct 14 17:50:54 CEST 2015


Marco van de Voort wrote:
> In our previous episode, Tomas Hajny said:
>>>> There's a lot of use in embedded targets:
>>> Ah, thank you. Finally an answer I can understand. :)
>> The case of MS-DOS using it e.g. to provide direct access to the video
>> adapter memory ($B800:0000), low-level information maintained by BIOS
>> ($40:xxx), etc., as already mentioned by someone else (Marco?) is in
>> principle the same as use cases relevant for embedded targets.
> 
> Yes, but I thought it was square brackets, not parentheses. Address is
> linearized using seg*16+ofs and addressed via %fs (for go32v2, for i8086 it
> probably is used as is)

[Checks] No bracket or parentheses in the case of Turbo Pascal, but I'd 
point out that the syntax was $B800:$0000 i.e. the absolute address was 
two concatenated 16-bit words rather than a colon being acceptable in 
the middle of a 32-bit word. Modula-2 IIRC was about the same.

The C crowd would probably like to use (square) brackets on account of 
their array semantics, and in the general case it's arguable whether 
defining an absolute variable is better or worse than defining a pointer 
with an absolute initial value. I suppose that a compiler/linker could 
potentially interpret an absolute declaration as indicating that that 
location should not be swapped/overlaid/relocated.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list