allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (03/21/89)
Posting-number: Volume 6, Issue 63 Submitted-by: tneff@l.UUCP (Tom Neff) Archive-name: ega43.sv32 I prefer working in 43 line mode on my EGA. UNIX System V/386 Release 3.2 lets you do so without cheating. Here is a set of programs to support it. -- Tom Neff tneff@well.UUCP or tneff@dasys1.UUCP -----------cut here------------cut here-------------cut here---------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # Makefile # README # at386-43 # ega25.c # ega43.c # This archive created: Mon Mar 6 17:25:55 1989 export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'Makefile' then echo shar: "will not over-write existing file 'Makefile'" else sed 's/^X//' << \SHAR_EOF > 'Makefile' XCFLAGS = -O XDESTDIR = /usr/local/bin X Xdefault: ega43 ega25 X Xega43: ega43.c X $(CC) $(CFLAGS) ega43.c -o ega43 X cp ega43 $(DESTDIR)/ega43 X strip $(DESTDIR)/ega43 X Xega25: ega25.c X $(CC) $(CFLAGS) ega25.c -o ega25 X cp ega25 $(DESTDIR)/ega25 X strip $(DESTDIR)/ega25 SHAR_EOF fi if test -f 'README' then echo shar: "will not over-write existing file 'README'" else sed 's/^X//' << \SHAR_EOF > 'README' XHere is a simple program to switch your UNIX System V/386 Release 3.2 Xconsole into 43 line mode if you have an EGA. 43 lines are better than X25 for a lot of applications. The 'terminfo' source supplied will create Xan AT386-43 terminal type which automatically runs the switcher program Xat initialization time! So you can log into the console, give your Xterminal type as AT386-43 and everything follows automatically. X XThe ioctl's needed to make 'ega43' work are documented in 'display(7)' Xin the User's/Sysadmin's Reference Manual. This version also enlarges Xthe cursor slightly so it's harder to lose in the middle of a big Xpage full of 'vi' or whatever. X XA companion program 'ega25' is provided. You should also set your Xterminal type back to AT386 when you run it. I have a pair of Korn Xshell aliases '43' and '25' that do the whole thing. X X Tom Neff X Mon Mar 6 1989 SHAR_EOF fi if test -f 'at386-43' then echo shar: "will not over-write existing file 'at386-43'" else sed 's/^X//' << \SHAR_EOF > 'at386-43' XAT386-43|at386-43|386AT-43|386at-43|at/386 tall console, X lines#43, X iprog=/usr/local/bin/ega43, X use=at386, SHAR_EOF fi if test -f 'ega25.c' then echo shar: "will not over-write existing file 'ega25.c'" else sed 's/^X//' << \SHAR_EOF > 'ega25.c' X/* X 25.c Sun Feb 26 18:03:55 EST 1989 X X Standalone C program to switch an AT EGA into 25 X line color text mode under UNIX System V/386 3.2. X */ X X#include <sys/types.h> X X#include <sys/at_ansi.h> X#include <sys/kd.h> X Xmain() X{ X ioctl(0, SW_ENHC80x25); X puts("Setting AT EGA display to 25 line mode.\n"); X exit(0); X} SHAR_EOF fi if test -f 'ega43.c' then echo shar: "will not over-write existing file 'ega43.c'" else sed 's/^X//' << \SHAR_EOF > 'ega43.c' X/* X ega43.c Sun Feb 26 18:03:55 EST 1989 X X Standalone C program to switch an AT EGA into 43 X line color text mode under UNIX System V/386 3.2. X */ X X#include <sys/types.h> X X#include <sys/at_ansi.h> X#include <sys/kd.h> X X#define FIX_CURSOR X Xset_CRTC_reg(regnum, data) Xchar regnum; Xchar data; X{ X static struct port_io_arg pioa; X X pioa.args[0].dir = OUT_ON_PORT; X pioa.args[0].port = 0x3d4; X pioa.args[0].data = regnum; X X pioa.args[1].dir = OUT_ON_PORT; /* Adjust cursor size */ X pioa.args[1].port = 0x03d5; X pioa.args[1].data = data; X X pioa.args[2].port = 0; X pioa.args[3].port = 0; X X ioctl(0, EGAIO, &pioa); X} X Xset_EGA_cursor(top, bottom) Xint top, bottom; X{ X set_CRTC_reg(0x0a, (char) top); X set_CRTC_reg(0x0b, (char) bottom); X} X Xmain() X{ X if (ioctl(0, CONS_CURRENT) != EGA) X { X puts("Not an EGA!\n"); X exit(1); X } X X ioctl(0, SW_ENHC80x43); X X#ifdef FIX_CURSOR X set_EGA_cursor(5, 0); X#endif X X puts("AT EGA display now in 43 line mode.\n"); X exit(0); X} SHAR_EOF fi exit 0 # End of shell archive