🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #7850

Re: Writing to screen, no cursor movement

#7850
From: Rotbart
Date: Sun, 15 Oct 1995 03:17
47 lines
1951 bytes
 wcw@wolfenet.com (William White) wrote:
 >       I'm programming in text mode, and would like to know how to write characters 
 >to the screen without moving the cursor.  Just backing up the cursor one 
 >column after a character is written is not good enough.
 >	Here is what I need this for:
 >	
 >	I'm trying to write a program that does all screen I/O without the screen 
 >borders scrolling.  I need to be able to write in column 80 on line 25 
 >without the cursor going to the next line, thus making line 1 disappear off 
 >the screen.
 >

Hi,
The best and fastest way to write to the screen without scrolling or beeping 
is by writing directly to the screen's memory.
This allows you to display control characters on the screen such as ^G which
beeps when using terminal writes.
In Turbo Pascal this is very easy:
(This is in Turbo Pascal because I have this snippet already programmed only in
TP, This can be done in any language)

Type 
  Cell = Record
    Ch : Char;   { Character }
    Attr : Byte; { Attribute }
  End;

  ScreenType = Array [1..25, 1..80] of Cell;

Var
  Screen : ScreenType Absolute $B800:$0000;

Procedure WriteFast(x,y : Integer;
                str : String);
Var
  i : Integer;
Begin
  For i := 1 To Length(str) Do Begin
    Screen[y,x+i-1].char := str[i];
    Screen[y,x+i-1].attr := TextAttr;
  End;
End; { WriteFast. }

Begin
  Screen[25, 80].Ch := #14;
  WriteFast(1, 78, '!!');
End.
Technical Details
Message-ID: <DGGzt1.AnE@actcom.co.il>
Path: arc1-ca.pugleaf.net!news.kei.com!wang!news
References: <44rvl0$3pq@news1.wolfe.net> <458hns$mfp@oznet07.ozemail.com.au>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer,comp.lang.c,comp.lang.c++
Path: arc1-ca.pugleaf.net!news.kei.com!wang!news
From: emultek@actcom.co.il (Rotbart)
Subject: Re: Writing to screen, no cursor movement
Organization: ACTCOM - Internet Services in Israel
Date: Sun, 15 Oct 1995 03:17:25 GMT
Message-ID: <DGGzt1.AnE@actcom.co.il>
Followup-To: comp.os.msdos.programmer,comp.lang.c,comp.lang.c++
References: <44rvl0$3pq@news1.wolfe.net> <458hns$mfp@oznet07.ozemail.com.au>
Sender: news@wang.com