[fpc-pascal]Reading the color attributes from the screen

AITOR.SM AITOR.SM at teleline.es
Mon Aug 27 00:19:34 CEST 2001


Every character is stored into a word, 2 bytes, one for the attributes 
(hi), and one for the code in the current codepage (lo). So the current 
size is actually double. You can either modify the screen buffer or 
your saved copy. For the attributes byte, there is one nibble for 
background, another for foreground colours (I can't remember which is 
which, so check it out! ;-))

Aitor

----- Mensaje Original -----
De: James_Wilson at i2.com
Fecha: Viernes, Agosto 17, 2001 10:28 pm
Asunto: [fpc-pascal]Reading the color attributes from the screen

> The following bit of code is something I use in my go32v2 (DOS) 
> programs 
> to save/restore the contents of the screen to/from memory. It 
> works great 
> except that it takes the colors as they appear on the screen 
> (which is 
> okay most of the time). But is there a way I can store/reset the 
> color 
> attributes either directly on the screen or in the array after 
> I've saved 
> the screen? Or perhaps there's another mem[] region I can grab and 
> modify 
> the colors their instead?
> 
> TIA...
> 
> Jim
> 
> 
> //  for screens up to 132x60
> const
>  BUF_SIZE = 7920;
> 
> // array to hold screen contents
> var
>  ScreenBuffer : array [1..BUF_SIZE] of byte;
> 
> // save the entire screen to memory
>  move (mem [$B8000],ScreenBuffer,BUF_SIZE);
> 
> // restore the screen from memory
>  move (ScreenBuffer,mem [$B8000],BUF_SIZE);
> 

 ___________________________________________________________________ 
Consigue tu e-mail gratuito TERRA.ES
 Haz clic en http://www.terra.es/correo/





More information about the fpc-pascal mailing list