Article View: comp.sys.atari.st
Article #26387VT52 Macros
From: Richard Sansom
Date: Fri, 17 Apr 1987 03:59
Date: Fri, 17 Apr 1987 03:59
129 lines
4960 bytes
4960 bytes
I received a few requests for these macro definitions, so I decided to
post them. They're pretty easy to figure out, and not too terribly clever,
but they do work (I _think_ I've used them all at one time or another).
Enjoy.
-Rich
p.s. - I've _never_ used these in combination with GEM stuff, so I can't
tell you what to expect if that's what you intend to do with'em.
--- cut here, extract file vt52.h ---
/*
* vt52.h -- Atari ST VT52 "glass terminal" macros.
*
* Richard E. Sansom April 16, 1987
* sansom@trwrb.UUCP
*
* These macros are fairly easy to understand (in my opinion). Simply
* invoke them in your C source code, and they do what their names imply.
*
* For example, to clear the screen and turn inverse on, you would use:
*
* Clear_Home();
* Inverse_On();
*
* The only "tricky" ones are the ones dealing with color, since the ST
* can operate in 3 different resolution/color combinations. If you have a
* mono system, needless to say, you have no colors to work with (just B & W).
* If you like the low rez color screen, you have 16 colors to work with.
* As for me, I pretty much limit myself to the medium rez when I'm dealing
* with text on my color monitor, hence the 4 #defines you see below.
*
*/
/* define the real workhorse routines */
extern long bios();
extern long gemdos();
/*
* These four macros manipulate the cursor as you might
* expect - they move it 1 character in the indicated direction.
*/
#define Cursor_Up() gemdos(9,"\033A");
#define Cursor_Dn() gemdos(9,"\033B");
#define Cursor_Rt() gemdos(9,"\033C");
#define Cursor_Lf() gemdos(9,"\033D");
/*
* These move the cursor to the "home" position.
* The first one also clears the screen in the process.
*/
#define Clear_Home() gemdos(9,"\033E");
#define Cursor_Home() gemdos(9,"\033H");
/*
* These are pretty much self-explanatory. Scroll_Up()
* scrolls the entire screen up by one line, Clear_Eod()
* clears the screen from the current cursor position
* to the end of the display, and Clear_Eol() clears the
* current line from the cursor position.
*/
#define Scroll_Up() gemdos(9,"\033I");
#define Clear_Eod() gemdos(9,"\033J");
#define Clear_Eol() gemdos(9,"\033K");
/*
* These are pretty obvious.
*/
#define Insert_Line() gemdos(9,"\033L");
#define Delete_Line() gemdos(9,"\033M");
/*
* This is a handy one - it positions the cursor
* to the x, y position you specify.
*/
#define Pos_Cursor(x,y) gemdos(9,"\033Y"); bios(3,2,32+y); bios(3,2,32+x)
/*
* The color stuff - obviously, I do most of my color text in
* medium rez. Fg_Color() sets the foreground color (the color
* of the text), and Bg_Color() sets the background color (the
* color of the screen surrounding the text). You can get some
* pretty spiffy looking displays by playing with these guys.
*/
#define WHITE 0
#define RED 1
#define GREEN 2
#define BLACK 3
#define Fg_Color(x) gemdos(9, "\033b"); bios(3,2,x)
#define Bg_Color(x) gemdos(9, "\033c"); bios(3,2,x)
/*
* Some of these are a bit more obscure, but are also probably
* not used too much. Clear_Bod() clears the screen from the
* current cursor position to the beginning of the display,
* Save_Cursor() saves the current x, y coordinates of the
* cursor, and Restore_Cursor() restores the x, y coordinates
* to their saved values.
*/
#define Clear_Bod() gemdos(9, "\033d")
#define Show_Cursor() gemdos(9, "\033e")
#define Hide_Cursor() gemdos(9, "\033f")
#define Save_Cursor() gemdos(9, "\033j")
#define Restore_Cursor() gemdos(9, "\033k")
#define Clear_Line() gemdos(9, "\033l")
#define Clear_Bol() gemdos(9, "\033o")
/*
* These two begin and end inverse video mode.
*/
#define Inverse_On() gemdos(9, "\033p")
#define Inverse_Off() gemdos(9, "\033q")
/*
* Finally, these two toggle line wrap.
*/
#define Wrap_On() gemdos(9, "\033v")
#define Wrap_Off() gemdos(9, "\033w")
--- cut here ---
--
/////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
/// Richard E. Sansom TRW Electronics & Defense Sector \\\
\\\ {decvax,ucbvax,ihnp4}!trwrb!sansom Redondo Beach, CA ///
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////
Technical Details
Message-ID:
<1777@trwrb.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!husc6!rutgers!cbmvax!bpa!burdvax!sdcrdcf!trwrb!sansomShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!husc6!rutgers!cbmvax!bpa!burdvax!sdcrdcf!trwrb!sansom From: sansom@trwrb.UUCP (Richard Sansom) Newsgroups: comp.sys.atari.st Subject: VT52 Macros Message-ID: <1777@trwrb.UUCP> Date: Thu, 16-Apr-87 22:59:14 EST Article-I.D.: trwrb.1777 Posted: Thu Apr 16 22:59:14 1987 Date-Received: Sun, 19-Apr-87 11:08:10 EST Reply-To: sansom@trwrb.UUCP (Richard Sansom) Organization: TRW EDS, Redondo Beach, CA Lines: 129