An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

and thats the order :

¦ RRRRR GGG ¦ GGG BBBBB ¦

so you write now :

memw[$a000:(640*y+x) shl 1]:=...

memw : because there are 2 bytes for each pixel

$a000 : is the segment of the video-page

640*y : because the screen ist 640px width

+x : for the x-pos of the pixel

shl 1 : because there are 2 bytes for each pixel

.... shl 1]:=

round(r/255*31) shl 11+

round(g/255*63) shl 5+

roung(b/255*31);

that would be ok, but we can speed it up :

memw[$a000:(640*y+x) shl 1]:=

((r shr 3) shl 11)+

((g shr 2) shl 5)+

(b shr 3);

anyway this is slow as a slug. lets speed it up again :

memw[$a000:(y shl 8)+(y shl 10)+(x shl 1)]:=

((r shr 3) shl 11)+

((g shr 2) shl 5)+

(b shr 3);

(y*128)+(y*512)+x is much faster than (y*640)+x.

now you could replace also the ...shr 3) shl 11) with some binary and's, but it gets actually slower.

--------------------------

so finally the code for putting a pixel is :

var oldpage:byte;

procedure setpix(x,y:longint;r,g,b:b

var addr:longint;page,ofs:word

begin

addr:=(y shl 8)+(y shl 10)+(x shl 1);

page:=addr shr 16;

ofs:=addr and 65536;

if page<>oldpage then begin

oldpage:=page;

setpage(page); {this is your problem}

end;

memw[$a000:ofs]:=

((r shr 3) shl 11)+

((g shr 2) shl 5)+

(b shr 3);

{the pixel should be set}

end;

ok ?