PAWELKDA@UREGINA1.BITNET (Darrel Pawelka) (05/21/89)
I have looked for the first time into my version of Forth called FORTH 83, ver. 2.1 by Henry Laxen & Mike Perry, a version which I am sure some of you are ac- quainted with. Since I am new to Forth, many of the words are unfamiliar to me, though I understand the general methodology of Forth. Presently I need help in setting up the cursor routines necessary for the in-built Forth editor to work with my Zenith Eazy-PC terminal/monitor combination. Moreover, this version of Forth works under an MS-DOS host operating system. The instructions give as an example how to tell Forth about the cursor routines for an ADM-3A terminal. I quote this example without comments below: 1 EDIT<CR> 10MAR84HHL<CR> 0 NEW<CR> \ CURSOR ROUTINES FOR AN ADM-3A TERMINAL<CA> EDITOR DEFINITIONS<CR> : ADM-AT<CR> 27 EMIT ASCII = EMIT 32 + EMIT 32 + EMIT ;<CR> : ADM-DARK<CR> CONTROL Z EMIT ;<CR> : ADM-3A<CR> ['] .ALL IS .SCREEN <CR> ['] ADM-AT IS AT <CR> ['] ADM-DARK IS DARK <CR> ['] NOOP IS -LINE <CR> ['] (BLOT) IS BLOT ; <CR> ADM-3A <CR> <CR> DONE<CR> (Commands after this verify the the cursor routines etc. installed above. If " marks appear on your screen somehere in the above definition, they should be construed as open & closed brackets, which do not always show up in VM or CMS.) I would like someone to post a comparable definition to the one above for in- stalling the editor-screen and cursor routines suitable with a Zenith EaZy-PC & its E.I.A. 343 Model No. 14ZDC3 attached monitor (or compatible configuration) running MS-DOS 2.0 or later. If they are relevant, I would like the definition to provide routines for any of "Home, End, PgUp, PgDn, Ins, Del". I would like to know the Forth theory behind the creation of these screen routines. But if no one can come up with these definitions straight off, please point me to the sources of information that would enable me to understand and define these rou- tines on my own. Once I get past this hurdle, I will be able to start program- ming in FORTH! Thanks in advance; Darrel.
thomson@wasatch.utah.edu (Rich Thomson) (05/23/89)
In article <8905221311.AA00762@lilac.berkeley.edu> PAWELKDA@UREGINA1.BITNET (Darrel Pawelka) writes: > Presently I need help in setting up the cursor routines necessary for the > in-built [sic] Forth editor to work with my Zenith Eazy-PC terminal/monitor > combination. Well, I can't help you out on the exact terminal escape codes for your system, but somewhere in your docs should be a description of the escape codes and how they're interpreted for your system. I can, however, give you some enlightenment on what the ADM-3A example is doing. > The instructions give as an example how to tell Forth about the cursor > routines for an ADM-3A terminal. > >1 EDIT<CR> >10MAR84HHL<CR> >0 NEW<CR> >\ CURSOR ROUTINES FOR AN ADM-3A TERMINAL<CA> >EDITOR DEFINITIONS<CR> >: ADM-AT<CR> > 27 EMIT ASCII = EMIT 32 + EMIT 32 + EMIT ;<CR> AT is the cursor placement routine. Presumably it takes x and y coordinates on the stack. ``27 EMIT'' sends an ESCAPE character to your output device. In general, n EMIT outputs character code n. ASCII reads the next space delimited word in the input string and pushes the ascii code for that word (which should only be a single character). So, from this you can deduce that the escape code sequence for positioning the cursor on an ADM-3A would be in basic (ugh): CHR$(27);"=";CHR$(32+x);CHR$(32+y) >: ADM-DARK<CR> > CONTROL Z EMIT ;<CR> Similarly, CONTROL is a word that turns the next word in the input string to a control character, so ``CONTROL Z'' pushes ascii code 26 onto the stack. I'd say what you need to do is to find the escape sequence table for your monitor and create some new words that emit the proper escape sequences for the actions the editor wants to perform. >: ADM-3A<CR> > ['] .ALL IS .SCREEN <CR> > ['] ADM-AT IS AT <CR> > ['] ADM-DARK IS DARK <CR> > ['] NOOP IS -LINE <CR> > ['] (BLOT) IS BLOT ; <CR> This part replaces the old definitions for ``.SCREEN'', ``AT'', ``DARK'', ``-LINE'' and ``BLOT'' and replaces them by the appropriate things for an ADM-3A. You want to do this because the editor is calling .SCREEN, AT, etc. You are effectively back-patching the hooks into the screen driver that the editor uses. Hope all this helps you somewhat. -- Rich [ Editor of the Amiga FORTH Programmer's Newsletter; Send add requests to: amiga-forth-request@cs.utah.edu Send submissions to: amiga-forth@cs.utah.edu ] Rich Thomson thomson@cs.utah.edu {bellcore,hplabs}!utah-cs!thomson "Tyranny, like hell, is not easily conquered; yet we have this consolation with us, that the harder the conflict, the more glorious the triumph. What we obtain too cheap, we esteem too lightly." Thomas Paine, _The Crisis_, Dec. 23rd, 1776 -- Rich Thomson thomson@cs.utah.edu {bellcore,hplabs}!utah-cs!thomson "Tyranny, like hell, is not easily conquered; yet we have this consolation with us, that the harder the conflict, the more glorious the triumph. What we obtain too cheap, we esteem too lightly." Thomas Paine, _The Crisis_, Dec. 23rd, 1776
wmb@SUN.COM (Mitch Bradley) (05/23/89)
I believe that most PCs have a file called ANSI.SYS that can be configured into your system to make it act like an ANSI standard terminal. This feature apparently first appeared in DOS 2.0, and is enabled by including ANSI.SYS in the CONFIG.SYS file. (Disclaimer: I don't actually own a PC, so I'm getting this from a book). Assuming that this is the case, here is a partial list of escape codes for ANSI-compatible terminals. These I do know for sure: left-character ESC [ D right-character ESC [ C up-line ESC [ A down-line ESC [ B move-cursor (at) ESC [ yyy ; xxx H insert-character ESC [ @ delete-character ESC [ P erase-to-end-of-line ESC [ K erase-to-end-of-screen ESC [ J insert-line ESC [ L delete-line ESC [ M Notes: ESC means output the escape character, decimal 27 [ means output the "[" character yyy is an ASCII decimal number representing the line number (1..#lines) xxx is an ASCII decimal number representing the column number (1..80) Some of these commands can take a numeric argument after the [ , specifying a repeat count, but that isn't needed in many applications. Consequently, in F83, ANSI-AT would look something like this: decimal : ansi-at ( x y -- ) 27 emit ascii [ emit 1+ (.) type ascii ; emit 1+ (.) type ascii H emit ; Note the use of "(.) type" instead of just "." . This is done to prevent a trailing space from being output after the number. The rest is left to the reader as an exercise. Mitch Bradley