Looking for terminal screen control codes

Asked by baasha

Hi,

I am running Gforth programming language in the Gnome terminal. I am trying to modify a screen editor which was originally written for a Lear-Seigler ADM-31 terminal. The code to clear the screen and move the cursor to the upper left for that particular terminal was 27 emit 42 emit ( Esc * ). That code sequence does not work with the Gnome terminal. Is there a list of control codes somewhere which tells me what codes will move the cursor, blank the screen etc.?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gnome-terminal Edit question
Assignee:
No assignee Edit question
Solved by:
Steve Romanow
Solved:
Last query:
Last reply:
Revision history for this message
Mathias Uebelacker (muebelacker) said :
#1

Hello,

clear or clear-screen it works within a script but i do not know the Lear-Seigler ADM-31 terminal. For further information try man gnome-terminal or take a look into the bash manual.

br
Mathias

Revision history for this message
baasha (baasha) said :
#2

Hi Mathias,

Thank you for your response. I guess I wasn't clear enough in my description. What I am looking for are the ASCII control codes that are applicable to the Gnome terminal. The codes I have now work on the Lear-Seigler terminal, but that is an old and probably long obsolete terminal that was common in the 1980's.

The Gnome manual has nothing about controlling the screen, cursor position, etc., at least not that I can find. I am not sure the bash manual would be any help either, as I am not working with scripts but with the Forth programming language. I need to send ASCII codes from Forth to the screen controls by emitting codes like Escape ( some other ASCII number).

Revision history for this message
Cesare Tirabassi (norsetto) said :
#3

Just working from memory, so take things with a grain of salt.
gnome-terminal is largely based on xterm (you can easily see that $TERM=xterm), and it is supposed to simulate a dec vt (some kind of a mix of vt100 and vt220).
I remember checking some escape sequences and most of them worked (not all though).
Most of the sequences were those of the VT220, so you can start with those.
Have you given any thought about using libraries, like curses or ncurses?

Revision history for this message
Cesare Tirabassi (norsetto) said :
#4

Just googling around I found this:

http://www.xfree86.org/current/ctlseqs.html

I do remember few months ago I needed some of these and by googling I stumbled on a pdf of the original VT220 programmers manual. I almost cried ......

Revision history for this message
Best Steve Romanow (slestak989) said :
#5

vt100.net has tons of good scans of the original docs as well.

Revision history for this message
baasha (baasha) said :
#6

Thanks Steve. The VT100 site did provide a lot of information that was useful. Unfortunately some of the codes do not work in the terminal when running Gforth. I don't think it is the terminals fault that this is happening but probably the way Gforth is set up to run in the terminal. Why Gforth uses the terminal window to run, rather than creating its own window is a mystery to me, but I guess I have to accept that. I was trying to set up a table of control key vectors in a Forth editor program. (Gforth does not come with an editor.) It works, except certain keys, like Ctrl-C shut down the program, instead of doing what I tell them to do. My guess is that somewhere deep in the Forth code my keys are being over-ridden.

I was hoping to use Gforth as it is the only open-source Forth program that I am aware of that will run on Linux. I have resigned myself to having to run a Windows version of Forth using Wine.

One strange thing I did notice about control codes: Maybe I am just ignorant about this but in Gforth, at least, Ctrl-A is interpreted as a number 1, Ctrl-B = 2, etc. I have never run across that before, but perhaps that is just my lack of knowledge about machine language programming for modern chip sets. The last time I did any machine language programming was for the 6502 chip. Now I have revealed how old I am :-))

Revision history for this message
Nicolo (nicolodavis) said :
#7

Is there any way to disable the scrollbar on the gnome-terminal from a program?

Revision history for this message
gilf (skiprock) said :
#8

"I was hoping to use Gforth as it is the only open-source Forth program that I am aware of that will run on Linux. I have resigned myself to having to run a Windows version of Forth using Wine."

Hi Baasha,

What about BigForth -- seems to have a ton of stuff, including an editor

http://www.jwdt.com/~paysan/bigforth.html