Board index » delphi » PMODE GPF

PMODE GPF

Quote
ArcSec wrote:
> The referred unit uses inline and some external assembly routines that
> access vga memory directly ($A000:$0000). That's it... a 216 run-time error
> (GPF) occurs and the program is terminated.

This is the answer. $A000 is not a valid segment selector in pmode.
Use SEGA000:0000

Andras

 

Re:PMODE GPF


Quote
ArcSec wrote:

> I'm using BP7 and compiling my programs in protected mode. It was just
> working fine until I tried to compile a TP7 unit (graphical stuff, sprites,
> animation, mode 13h, double-buffering, etc, written by me) in protected
> mode. BP7 just doesn't let me do it...
> The referred unit uses inline and some external assembly routines that
> access vga memory directly ($A000:$0000). That's it... a 216 run-time error
> (GPF) occurs and the program is terminated.
[snip]
> How can I access that memory? I want also to access $B800:$0000.

[code snipped]

No need to try it, I know what is wrong:
under protected mode, you can't just load a pointer values (seg:ofs) in
the registers and hope that it works (that is, you can, but it won't
work ;). The 'segment' part is no longer a physical memory address, but
an index into a translation table, which holds the physical base address
plus access rights and segment size.

What you want to do is still possible, but instead of $A000 as segment
value you will have to use the predefined SegA000 constant (see help
file and books). Similar constants exist for a couple of other real
mode segments, for this express purpose.

Please do read the section(s) on protected mode in the docs that
came with your compiler.
There might be more issues that are important for what you want
to do (interrupts for example).

Good luck.

Remco
--
R.J. Vi?tor                    |  AFE Chemistry
remco @ chem.gla.ac.uk         |  Joseph Black Building
                               |  University of Glasgow
The views expressed in this    |  Glasgow G12 8QQ
message represent only the     |  UK
personal views of the author   |

Re:PMODE GPF


I'm using BP7 and compiling my programs in protected mode. It was just
working fine until I tried to compile a TP7 unit (graphical stuff, sprites,
animation, mode 13h, double-buffering, etc, written by me) in protected
mode. BP7 just doesn't let me do it...

The referred unit uses inline and some external assembly routines that
access vga memory directly ($A000:$0000). That's it... a 216 run-time error
(GPF) occurs and the program is terminated.

I also tryed to access the vga memory via pascal routines, but there is no
way.
BP7 help says the memory I'm trying to access is out of my program's
reserved space.

How can I access that memory? I want also to access $B800:$0000.

Just to figure it out, I'm trying to do something like it:

var
  p: ^byte;

begin
    p := Pointer($A0000000);

    asm
        mov ax,$13
        int $10

        les di,p
        mov ax,$00
        mov cx,32000

        rep stosw
    end;

    ReadLn;

    asm
        mov ax,$03
        int $10
    end;

end.

Try it and see the results.

Thanks for any help...

ArcSec

Re:PMODE GPF


Soon after I posted this message I downloaded pmode tutorials, texts,
general stuff... And I realized I didn't know anything about pmode (before
reading). Now I'm pretty familiar with descriptors, selectors, gdt, ldts,
idts...

  Conclusion, the more you learn, there's more to learn...

  Thanks anyway for your messages...

ArcSec

Other Threads