> You can avoid cryptic language constructs in the main source code.
> 
> I did not yet use the preprocessor in Pascal but a standard way to 
> access memory mapped ports in C is something like this (from the top of 
> my head):
> 
> #define _port = 0x87

const _port=$87;
 
> #define ByteIO(p) *(((volatile unsigned char)*)(p))

A bit cryptic, but I guess this is

function ByteIO(var p):puchar; inline;

begin
  result:=puchar(@p);
end;

> #define port=ByteIO(_port)

const port = puchar(_port); // !??!?

>  ByteIO(_port) = 0x55;
> 
> may look queer to some watchers, but
> 
>  port = 0x55;

port^:=$55;


_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to