Board index » delphi » VGA mode12h-putpixel?

VGA mode12h-putpixel?

Is there any better putpixel than this for mode12h?

Procedure Putpixelt(X,Y:Word; C:Byte);
Var  B:Byte;w:word;
Begin
 PortW[$3CE]:=(C and 15) shl 8;
 PortW[$3CE]:=$0F01;
 Port[$3CE]:=8;
 Port[$3CF]:=128 Shr (X And 7);
 w:=(x shr 3)+80*y;
 B:=Mem[$A000:w];   {Could anyone explain this line? I cant, but i
found it like that!}
    Mem[$A000:w]:= c;
End;

fran...@net-art.de

 

Re:VGA mode12h-putpixel?


Quote
francis wrote:

> Is there any better putpixel than this for mode12h?

> Procedure Putpixelt(X,Y:Word; C:Byte);
> Var  B:Byte;w:word;
> Begin
>  PortW[$3CE]:=(C and 15) shl 8;
>  PortW[$3CE]:=$0F01;
>  Port[$3CE]:=8;
>  Port[$3CF]:=128 Shr (X And 7);
>  w:=(x shr 3)+80*y;
>  B:=Mem[$A000:w];   {Could anyone explain this line? I cant, but i
> found it like that!}
>     Mem[$A000:w]:= c;
> End;

> fran...@net-art.de

Yes (probably).
I have asked this question some time ago and got several answers. I used
the best thing I found in a simple unit which will also handle
GRAPH-stuff, but has a fast putpixelprocedure (PlotPixel). You can
download it at http://www.xs4all.nl/~remcodek/download.html. Look for
the SMGRAF-unit. Code is included.

Good luck,

Remco de Korte
Soft Machine

Re:VGA mode12h-putpixel?


On Wed, 25 Feb 1998 19:15:56 +0100, francis <fran...@net-art.de>
wrote:

Quote
>Is there any better putpixel than this for mode12h?
>Procedure Putpixelt(X,Y:Word; C:Byte);
>Var  B:Byte;w:word;
>Begin
> PortW[$3CE]:=(C and 15) shl 8;
> PortW[$3CE]:=$0F01;
> Port[$3CE]:=8;
> Port[$3CF]:=128 Shr (X And 7);
> w:=(x shr 3)+80*y;
> B:=Mem[$A000:w];   {Could anyone explain this line? I cant, but i
>found it like that!}
>    Mem[$A000:w]:= c;
>End;

For a single putpixel there is probably no better Pascal code. For
filling blocks with the same color there are faster alternatives.
Generally speaking mode 12h programming is hell. You better forget it
or just use Borland's BGI which does it for you.

The statement  B:=Mem[$A000:w]; is a dummy read which will read the
contents of the 4 bitplanes into a latch register.

If you want to know what all this means you should get a book or a
documentation about EGA/VGA programming.

Regards
Horst

   *** Las orillas del Nahuel Huapi ***

Re:VGA mode12h-putpixel?


Quote
Remco de Korte wrote:

> francis wrote:

> > Is there any better putpixel than this for mode12h?

> > Procedure Putpixelt(X,Y:Word; C:Byte);
> > Var  B:Byte;w:word;
> > Begin
> >  PortW[$3CE]:=(C and 15) shl 8;
> >  PortW[$3CE]:=$0F01;
> >  Port[$3CE]:=8;
> >  Port[$3CF]:=128 Shr (X And 7);
> >  w:=(x shr 3)+80*y;
> >  B:=Mem[$A000:w];   {Could anyone explain this line? I cant, but i
> > found it like that!}
> >     Mem[$A000:w]:= c;
> > End;

> > fran...@net-art.de

> Yes (probably).
> I have asked this question some time ago and got several answers. I
> used
> the best thing I found in a simple unit which will also handle
> GRAPH-stuff, but has a fast putpixelprocedure (PlotPixel). You can
> download it at http://www.xs4all.nl/~remcodek/download.html. Look for
> the SMGRAF-unit. Code is included.

> Good luck,

> Remco de Korte
> Soft Machine

Just in case you were still interested: I looked up the code:

procedure plotpixel(x,y:integer;color:byte); assembler;
asm
  mov ax,80
  mul y
  mov bx,ax
  mov ax,x
  mov cl,8
  div cl
  mov cl,ah
  and ah,0
  add bx,ax
  or ah,128
  shr ah,cl
  mov dx,3ceh
  mov al,8
  out dx,ax
  mov ax,205h
  out dx,ax
  mov ax,SegA000
  mov es,ax
  mov al, es:[bx]
  mov al,color
  mov es:[bx],al
end;

Good luck,

Remco de Korte
Soft Machine
http://www.xs4all.nl/~remcodek/

Re:VGA mode12h-putpixel?


In article: <34F45FDC.E91B0...@net-art.de>  francis <fran...@net-art.de> writes:

Quote

>Is there any better putpixel than this for mode12h?

>Procedure Putpixelt(X,Y:Word; C:Byte);
>Var  B:Byte;w:word;
>Begin
> PortW[$3CE]:=(C and 15) shl 8;
> PortW[$3CE]:=$0F01;
> Port[$3CE]:=8;
> Port[$3CF]:=128 Shr (X And 7);
> w:=(x shr 3)+80*y;
> B:=Mem[$A000:w];   {Could anyone explain this line? I can?t, but i
>found it like that!}

This is a dummy read of the EGA/VGA address, used to load the internal 32-bit
VGA register prior to modifiying ~some~ (just 4 in this case) of the 32 bits
read from the video RAM. You always need to perform a dummy read in all planar
graphics modes unless the following write instruction is overwritting all 8
pixels at that address.

This is a complex subject, so if you need to know more then get hold of Richard
F Ferraro's very large book, "Programmers Guide to the EGA, VGA and Super VGA
Cards" published by Addison-Wesley. ISBN 0-201-62490-7

Quote
>    Mem[$A000:w]:= c;
>End;

>fran...@net-art.de

-- Jay

 -----------------------------------------
| Jason Burgon - author of Graphic Vision |
| g...@jayman.demon.co.uk                   |
| http://www.jayman.demon.co.uk           |
 -----------------------------------------

Other Threads