Path: utzoo!attcan!uunet!lll-winken!csd4.milw.wisc.edu!mailrus!wasatch!thomson From: thomson@wasatch.utah.edu (Rich Thomson) Newsgroups: comp.lang.forth Subject: Re: Setting cursor routines for the Forth editor Message-ID: <1888@wasatch.utah.edu> Date: 23 May 89 06:45:09 GMT References: <8905221311.AA00762@lilac.berkeley.edu> Organization: Oasis Technologies Lines: 72 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 >10MAR84HHL >0 NEW >\ CURSOR ROUTINES FOR AN ADM-3A TERMINAL >EDITOR DEFINITIONS >: ADM-AT > 27 EMIT ASCII = EMIT 32 + EMIT 32 + EMIT ; 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 > CONTROL Z EMIT ; 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 > ['] .ALL IS .SCREEN > ['] ADM-AT IS AT > ['] ADM-DARK IS DARK > ['] NOOP IS -LINE > ['] (BLOT) IS BLOT ; 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