[fpc-devel]Support for 16-bit assembler ?

Michael Knapp mknapp at gmx.at
Mon Dec 4 02:36:53 CET 2000


Davor Dundovic wrote:
> 
> >>I meant for compatibility reasons. I have a lot of assembly code built in
> >>my TPUs and it is pain in the neck to change that to 32-bit code.
> >
> >There is no way, you've to rewrite it because 32 bit protected mode uses a
> >completly
> >different memory model.
> 
> OK, different question: is it possible to read/write from/to absolute
> address without generating runtime error ?
> 
> var p : ^byte;
> begin
> p := $f0000000;
> writeln(p^);
> end.
> 
> This program generates runtime error 216. This is, I belive, general
> protection fault.

It's ok that the program crashes ... :-)

that should work

uses go32v2;

var p:^byte;

begin
  set_segment_limit(get_ds,$ffffffff);
 
p:=pointer(get_linear_addr($f0000000,1)-get_segment_base_address(get_ds));
  writeln(p^);
end.

IMPORTANT: Write to any addresses ONLY if you know which areas 
in the address space you (over)write, otherwise 
it could result in data loss (happened to me once)

Michael

-- 
+--------------------------------------------------------------------+
|  Michael Knapp - Mauerbach - Niederösterreich - Austria - Europe   |
|  E-Mail: mknapp at gmx.at                             ICQ: 36542787   |
+--------------------------------------------------------------------+
| G r a p h i X            http://programmierer.freepage.de/graphix/ |
| Graphics Library for Freepascal, Virtual Pascal and Borland Pascal | 
| http://graphix4pascal.cjb.net/    http://www.graphix4pascal.de.vu/ |
+--------------------------------------------------------------------+




More information about the fpc-devel mailing list