[fpc-pascal]Direct writes to console buffer

Michalis Kamburelis michalis at camelot.homedns.org
Sun Aug 3 14:22:29 CEST 2003


Rich Pasco wrote:
> I'm trying to port some old Turbo Pascal programs to Windows 32-bit
> console utilities.  They write directly to the screen buffer, which in
> the DOS world an array of Word starting at ptr(SegB800,0) (for a color
> display) or ptr(SegB000,0) for a monochrome one.  Now, as Windows
> console utilities, I don't suppose it's so easy to get a pointer to
> the upper left corner of the console window, or is it?
> 
> Anu suggestions would be appreciated.
> 
>      - Rich

Unit Video is exactly what you are looking for - it lets you write/read 
characters and their attributes (text color + background + blink 
attribute) directly to/from a buffer in memory and then use simple 
UpdateScreen procedure to "flush" contents of this memory buffer to the 
console. This way you can write console programs using the same approach 
as under DOS (with these ptr(SegB800,0) / ptr(SegB000,0)) BUT it works 
under many platforms - in particular, it works under Win32.

For more information, look at the FPC documentation for this unit.

Regards,
-- 
Michalis Kamburelis
michalis at camelot.homedns.org
http://www.camelot.homedns.org/~michalis/





More information about the fpc-pascal mailing list