# VOGONS

## EGA planar plot pixel

### First post, by PlaneVuki

Rank Newbie
Rank
Newbie

Hi,

I am experimenting with the following code in pascal to plot pixels in 640x350 16color mode

******************************
setgmode;

port[\$3C4]:=2; port[\$3C5]:=15; {select all planes, white pixel will be plotted}
port[\$3CE]:=8; port[\$3CF]:=128; { plotting 0-th pixel, upper left corner, mask others}
mem[\$a000:0]:=255;

port[\$3C4]:=2; port[\$3C5]:=15; {again white}
port[\$3CE]:=8; port[\$3CF]:=64; {plot second pixel, mask others}
mem[\$a000:0]:=255;

******************************

But after the readkey it plots the second pixel, but still overwrites first pixel to black (set it to 0).

What am I doing wrong ?

### Reply 1 of 3, by Kalle

Rank Newbie
Rank
Newbie

Hello,

you need to read from that memory location first in order to fill the latch registers.
A zero in the bit mask register means that the associated bit of the latch registers will be written back to that memory location. If you got zero in the latches, then zero is what will be written.

### Reply 2 of 3, by PlaneVuki

Rank Newbie
Rank
Newbie
Kalle wrote on 2022-02-27, 15:40:

Hello,

you need to read from that memory location first in order to fill the latch registers.
A zero in the bit mask register means that the associated bit of the latch registers will be written back to that memory location. If you got zero in the latches, then zero is what will be written.

That worked, thanks !

I did this instead of just writing:

*****************
mem[\$a000:0]:=255; ;then write
*****************

This is correct right?

Do you think that this is the fastest way to write a pixel to ega 640x480 16color ?:
Is there any faster method possible ? Algorithm-wise I mean, because I sure can make current faster with asembly.

### Reply 3 of 3, by mkarcher

Rank Oldbie
Rank
Oldbie
PlaneVuki wrote on 2022-02-27, 15:58:

Do you think that this is the fastest way to write a pixel to ega 640x480 16color ?: