[fpc-pascal]several questions

Thomas Schatzl tom_at_work at gmx.at
Thu Sep 11 21:58:06 CEST 2003


>    Can you only have 2 files open with FP? As above, I fixed my problem
> with opening the third file by closing another, and only having 2 open at
> once. My config.sys has "FILES=20", so it's not a DOS limitation by the
> look of it (unless my FP program is opening up another 18 related system
> files behind the scenes. e.g. units or something).

Probably another 18 files have already been opened by the OS (device drivers
etc) - try setting FILES higher and test again. FPC programs don't allocate
any new file resources by default afaik.

>    I also wanted to know if there's a colour palette somewhere? Or a list
> of the text-names that can be used with "textcolor"?

Try the constants in crt.pp - you can set the color of a specific cell by
setting textattr to the value of "(background-color shl 4) or

E.g. have a look at the output of the following program:


 i, j : Integer;

 for i := 0 to 15 do begin
  for j := 0 to 15 do begin
   textattr := i shl 4 + j;

Iirc in DOS the character cell blinks if the high bit of textattr is set
(meaning that you're basically stuck with the first 7 background colors).
You can disable blinking by calling int 10h with ax=$1003 and bl=$1 (enable
again with bl=$0)

>    When I run pascal programs (not just FP, but other compilers too), the
> last text-colour I used stays even after the program is finished. The
> original default colour only returns after I call something else. e.g.
> DR-DOS editor.

FPC doesn't use the BIOS functions for drawing text characters in DOS - so
the original text attributes should be preserved after exiting for new text.
It leaves the current contents as they are by default though, this is


More information about the fpc-pascal mailing list