Hi,
Post by ChuckYes I would like to have your VGA screen dump to a pcx file.
Ok, here is the procedure. Comments and some variables are in Dutch, but
you'll get it.
--------------------------------------------------------------
PROCEDURE dumppcx(filenaam:STRING);
CONST header:ARRAY[1..128] OF BYTE=
($0A, { PCX flag }
$05, { version 3.0 }
$01, { Run Length encoding }
$01, { 1 bit per pixel }
$00,$00, { x coordinaat linker bovenhoek }
$00,$00, { y coordinaat linker bovenhoek }
$7F,$02, { x coordinaat rechter benedenhoek }
$DF,$01, { y coordinaat rechter benedenhoek }
$80,$02, { horizontale dots per inch }
$DE,$01, { verticale dots per inch }
$FF,$FF,$FF, { palette kleur no 0 }
$00,$00,$BF, { palette kleur no 1 }
$00,$BF,$00, { palette kleur no 2 }
$00,$BF,$BF, { palette kleur no 3 }
$BF,$00,$00, { palette kleur no 4 }
$BF,$00,$BF, { palette kleur no 5 }
$BF,$BF,$00, { palette kleur no 6 }
$00,$00,$00, { palette kleur no 7 }
$FF,$FF,$FF, { palette kleur no 8 }
$00,$00,$FF, { palette kleur no 9 }
$00,$FF,$00, { palette kleur no 10 }
$00,$FF,$FF, { palette kleur no 11 }
$FF,$00,$00, { palette kleur no 12 }
$FF,$00,$FF, { palette kleur no 13 }
$FF,$FF,$00, { palette kleur no 14 }
$00,$00,$00, { palette kleur no 15 }
$00, { reserved (was video mode) }
$04, { aantal color planes }
$50,$00, { bytes per regel }
$01,$00, { palette info = kleur }
$80,$02, { horizontal screen size }
$DE,$01, { vertical screen size }
$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,
$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,
$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00);
VAR teller,scanline:INTEGER;
uitvoer:FILE OF BYTE;
PROCEDURE pcx_encode(data:BYTE;pteller:BYTE);
BEGIN
IF ((data AND $C0)=$C0) OR (pteller>1)
THEN BEGIN
pteller:=pteller OR $C0;
WRITE(uitvoer,pteller);
END;
WRITE(uitvoer,data);
END;
PROCEDURE doline;
VAR plane,data_teller,lijn_teller,nieuwe_byte,vorige_byte:BYTE;
BEGIN
FOR plane:=0 TO 3 DO { lees 4 bitplanes VGA }
BEGIN { = 16 kleuren }
PORTW[$03CE]:=plane*256+$0004; { kies bitplane in VGA }
vorige_byte:=MEM[base_vga:scanline*80]; { init }
data_teller:=1;
lijn_teller:=1;
WHILE lijn_teller<80 DO
BEGIN
nieuwe_byte:=MEM[base_vga:scanline*80+lijn_teller];
lijn_teller:=lijn_teller+1;
IF nieuwe_byte=vorige_byte
THEN BEGIN
data_teller:=data_teller+1;
IF data_teller=63
THEN BEGIN
pcx_encode(vorige_byte,data_teller);
data_teller:=0;
END;
END
ELSE BEGIN
IF data_teller>0 THEN pcx_encode(vorige_byte,data_teller);
vorige_byte:=nieuwe_byte;
data_teller:=1;
END;
END;
IF data_teller>0 THEN pcx_encode(vorige_byte,data_teller);
END;
END;
BEGIN { dumppcx }
ASSIGN(uitvoer,filenaam);
REWRITE(uitvoer);
FOR teller:=1 TO 128 DO WRITE(uitvoer,header[teller]);
PORTW[$03CE]:=$0005; { zet VGA op mode 0 (=default) }
PORTW[$03CE]:=$0002; { zet color compare VGA op 0
(=default) }
PORTW[$03CE]:=$0F07; { zet color don't care VGA op 15
(=default) }
FOR scanline:=0 TO 479 DO doline;
PORTW[$03CE]:=$0004; { zet VGA terug op bitplane 0
(=default) }
CLOSE(uitvoer);
END;
-------------------------------------------------------------------
HTH, regards, Matt