Mail Archives: djgpp/1995/07/10/06:03:12
Neil Drage wrote:
> Anyway. If you are compiling using DJGPP with DPMI is
> it still possible to write directly to the screen, using
> address 0xD0000000 I mean?
>
There is an alternate way to read/write from display memory directly
under DPMI. This requires creating an LDT descriptor first though.
Eg.
Use function 0000h of the DPMI interface API to allocate a
descriptor. In INTEL syntax:
DPMI_INTERFACE equ 31h
mov ax,0000h
mov cx,1 ;allocate one descriptor
int DPMI_INTERFACE
jc error
mov gs,ax ;get segment selector
jmp fill_desc
error:
.
.
.
Once you've created a descriptor you have to initialize it for the
segment that you're trying to access.
mov ax,0007h ;Set segment base address
mov bx,gs ;get segment selector
;Assuming your display segment starts at A000:0000h
mov cx,000Ah ;cx:dx hold the 32-bit linear base addr.
xor dx,dx ;of the segment
int DPMI_INTERFACE
Next, specify the size of the segment. I'm assuming 128Kb for an
super-VGA card.
mov ax,0008h ;Set segment limit
mov cx,0002h ;cx:dx hold the 32-bit segment limit
xor dx,dx
int DPMI_INTERFACE
To read/write directly from display memory all you have to do is to
place the segment selector into a segment register, and specify the
desired offset within the display segment. Eg.
mov gs,display_selector
mov esi,000001F2h
mov al,gs:esi ;read a byte from display memory
Of course what is really handy with this sort of programming is the
DPMI interface programming specification. I'm not sure whether you've
got this, but unfortunately I forgot where I retrieved my copy from.
Regards, Ron.
********************************************************************
| Author.............. Ron Grunwald |
| Internet............ r DOT grunwald AT cowan DOT edu DOT au |
| Phone............... (09)273 8027 or (09)273 8468 |
|------------------------------------------------------------------|
| Department.......... Computer Operations and Systems Management |
| Division/Faculty.... Information Technology |
| Institute........... Edith Cowan University, Churchlands |
| Location............ Perth, Western Australia |
********************************************************************
"I don't have any solution but I certainly admire the problem!"
- Raw text -