docu PCX routines coded by Hermang Mansilla,  hh_mm@yahoo.com

dim  Palette(256,3), h(128)
Width=0
Height=0

Export Sub LoadPCX(pcxfile$ ,rle() )
local fp, i,  flength

 fp=open(pcxfile$,"rb")
seek #fp, 8
rem Width=h(9)+256*h(10)
Width=peek(fp)+256*peek(fp)
Height=peek(fp)+256*peek(fp)
? Width,Height
REM ************ GO TO END TO CHECK FILESIZE AND READ PALETTE *******
	seek #fp, 0, "end"
	flength=tell(#fp)
seek #fp, -768 ,"end"
for i=1 to 256
Palette(i,1)=peek(#fp)
Palette(i,2)=peek(#fp)
Palette(i,3)=peek(#fp)
next i

REM ************ READ Run Length Encoded Pixel Data ********
dim rle(flength-128-768)
rem ? arraysize(rle(),1)
seek #fp, 128
for i=0 to flength-128-768
rle(i)=peek(#fp)
next i

close(fp)
End Sub  : rem LoadPCX()


Export Sub DrawRLE(datapix(), dx, dy )
local  x,y, idx, pix,rle, debug
idx=0
debug=0
for y=0 to Height
x=0
while(x<= Width)
	pix=datapix(idx) : idx=idx+1
if debug=1 ? pix;
	if pix>192 then
            rle=pix-192
	    pix=datapix(idx)+1 : idx=idx+1
	    color Palette(pix,1),Palette(pix,2),Palette(pix,3)
	    if x+rle>Width+1 then
		line dx+x,dy+y to dx+Width, dy+y
		y=y+1
		x=x+rle-Width-1
		line dx,dy+y to dx+x,dy+y
	    else
		line dx+x,dy+y to dx+x+rle,dy+y
		x=x+rle
	    end if
	else
          pix=pix+1
	  color Palette(pix,1),Palette(pix,2),Palette(pix,3)
	  dot dx+x,dy+y
	  x=x+1
    	end if
wend
next y
End Sub : REM DrawRLE


    Source: geocities.com/sunsetstrip/palms/1624/yabasic

               ( geocities.com/sunsetstrip/palms/1624)                   ( geocities.com/sunsetstrip/palms)                   ( geocities.com/sunsetstrip)