Lazarus

Programming => General => Topic started by: Pontiac on March 15, 2019, 12:43:18 am

Title: High color background on CRT - ARM/Linux/Windows
Post by: Pontiac on March 15, 2019, 12:43:18 am
I remember WAY back in the Turbo Pascal days when writing console apps, I could flip a switch to turn OFF blink mode and then get the extended set of background colors.  Essentially all the colors from 0 to 7 at double-brightness.  I don't seem to be able to find that kind of option in the existing CRT unit for FPC.  How can I switch that bit so that I can have all 16 background colors?  So far my code has only been written in Windows under XP.

I've looked at HighVideo and LowVideo and using either function before or after setting the TextBackground yields no difference.  I've looked online for alternative source (With no plans to use them as I need to compile my code for ARM, Linux and Windows, and I want my code to be as "stock" as possible).
Title: Re: High color background on CRT - ARM/Linux/Windows
Post by: lucamar on March 15, 2019, 04:35:02 am
I remember WAY back in the Turbo Pascal days when writing console apps, I could flip a switch to turn OFF blink mode and then get the extended set of background colors.

Not really. To allow for bright backgrounds in TurboPascal one had to do this (taken from my old CRTEX unit):
Code: Pascal  [Select][+][-]
  1. procedure BrightBackGround(state: boolean); assembler;
  2. var b: byte absolute state;
  3. asm
  4.   mov ax,$1003
  5.   mov bl,b
  6.   not bl
  7.   int $10
  8. end;
  9.  
  10. {DOC COMMENTS ...}
  11. {#M}{BrightBackGround(True)}
  12. {#M}{ will allow you to use [clDarkGray..clWhite] as background color.
  13. }
  14. {#M}{BrightBackGround(False)}
  15. {#M}{ will revert to the "blinking" default state: any character whose
  16. background is been shown "bright" will start to blink and the background will
  17. revert to its corresponding "dark" color.
  18. }
  19. {The best approach is either to renounce to "light" backgrounds or "blink"
  20. manually as shown, p.e., in the #clBright# topic.
  21. }
  22. {NOTE that the CRT unit dosn't allow to specify TextBackground(clLight...).
  23. The workaround is to do:
  24. }
  25. {#M}{     TextColor(Blink + fore_color);
  26. }
  27. {#M}
  28. {or manipulate directly TextAttr as shown in #clBright#.
  29. Note, also, that #clBackBright# = Blink = $80 (Blink is a constant defined in
  30. the CRT unit).}{#X Renamed_Colors}

or mess a little with the video card registers.

Do note that my proc calls the VBIOS: It may or may not work on anything other than plain DOS
TinyPortal © 2005-2018