[net.micro.amiga] Terminal emulator

star@fluke.UUCP (David Whitlock) (10/22/85)

Because of the fact that most Amiga users are frustrated with the fact that
its difficult to use the serial port for modem communications, I decided to
repost the Terminal Emulation Program address.


	Available in one to two weeks from:

	STROM Systems, Inc.
	PMC Center
	42189 Ann Arbor Road
	Plymouth, Michigan  48170

	Phone (313) 455-8022   ask for Dave

	Features

	VT-100, VT-52 Emulation
	Capture Text
	XModem File Transfer and possibly Kermit
	Multiple Modem Ports
	Complete Serial Port Configuration


	I've seen a Demo and it looks pretty complete.  You may want to call
	and leave you phone number, so that they can let you know when it will
	be released. 


	Other tid-bits

	I've heard and not confirmed a rumor that Amiga has been sending all
	Amiga owners a new BASIC and that that basic will support all Mac-Basic
	commands.

Q.	When using workbench and other iconed-menus, I've noted as I switch
	between programs, that when I release a program, that I never seem
	to regain the original amount of free memory.  After a few switches,
	I run out of memory to run a program which ran fine just after boot-up.

Q.	Can someone from Amiga, that is on-line, post all the syntax and option
	parameters used for all of the tools used in directory 'c'.  I am
	sure that this is in the DOS manual, but their not released, and I am
	getting frustrated.

	Anywho... just got my Amiga-Tutor disk in the mail and am impressed
	with the graphics.  The Dos tutor does hang up on a 256K machine
	The Tutor is just the key to get my wife started on the Amiga.

	Good Shooting Amiga


	David Whitlock

	

tom@LOGICON.ARPA (11/27/85)

From: Tom Perrine <tom@LOGICON.ARPA>

HELP! Does anyone have a terminal emulator package for the Amiga?

If I could buy a terminal emulator and/or KERMIT for the Amiga, I would
probably buy an Amiga next week (with the usual caveat of sufficient
dealer stock, etc.) Without it, I may wait for the 68020 version from
Commodore-Amiga :-).  Can anyone admit to me (privately or otherwise)
that they are developing one?  (Send me a non-disclosure, if needed!!)

I am not joking.  I have a deep spiritual need (and job requirement)
for a home system that can talk to UNIX at work, in the next 6 weeks.
If an Amiga can't do it by then, I may have to buy something else, but
I'd rather have an Amiga.

Also, does anyone have any new info as to when INTUITION 1.1 will be
available?  None of the dealers in San Diego has heard anyting about
it.

Thanks in advance,
Tom Perrine
tom@logicon.arpa

hubbert@ektools.UUCP (Hubbert Smith ) (01/16/86)

does anyone know if the Amiga can be used to emulate a vt100
how about a vt240 ?
 
	Hubbert Smith

UUCP: ..rochester!ektools!hubbert

BM17@CMCCTD@caip.RUTGERS.EDU (02/26/86)

From: Micom Marv <BM17%CMCCTD@TD.CC.CMU.EDU>


I am posting this for a friend...

-----------------------------------------------------------------------
25-Feb-86 00:08:46-EST,22841;000000000001
Return-Path: <mcinerny@A.PSY.CMU.EDU>
Received: from A.PSY.CMU.EDU by TD.CC.CMU.EDU with TCP; Tue 25 Feb 86 00:07:13-EST
Date:     Monday, 24 Feb 86 23:44:41 EST
From:     mcinerny (michael mcinerny) @ a.psy.cmu.edu
Subject:  PDTERM.AR
To:       bm17 @ td.cc.cmu.edu, ew1k @ tf.cc.cmu.edu

-h- console.c	2976:1373:832	console.c
#include "term.h"

/* These functions are taken directly from the console.device chapter
 * in the Amiga V1.1 ROM KERNEL manual.  See manual for documentation. */


/* Open a console device */
      int
OpenConsole(writerequest,readrequest,window)
      struct IOStdReq *writerequest;
      struct IOStdReq *readrequest;
      struct Window *window;
      {
            int error; 
            writerequest->io_Data = (APTR) window;
            writerequest->io_Length = sizeof(*window);
            error = OpenDevice("console.device", 0, writerequest, 0);
            readrequest->io_Device = writerequest->io_Device;
            readrequest->io_Unit   = writerequest->io_Unit;
                  /* clone required parts of the request */
            return(error);
      }

/* Output a single character to a specified console */ 

      int
ConPutChar(request,character)
      struct IOStdReq *request;
      char character;
      {
            request->io_Command = CMD_WRITE;
            request->io_Data = (APTR)&character;
            request->io_Length = 1;
            DoIO(request);
            return(0);
      }
 
/* Output a NULL-terminated string of characters to a console */ 

      int
ConPutStr(request,string)
      struct IOStdReq *request;
      char *string;
      {
            request->io_Command = CMD_WRITE;
            request->io_Data = (APTR)string;
            request->io_Length = -1;
            DoIO(request);
            return(0);
      }
 
      /* queue up a read request to a console */

      int
QueueRead(request,whereto)
      struct IOStdReq *request;
      char *whereto;
      {
            request->io_Command = CMD_READ;
            request->io_Data = (APTR)whereto;
            request->io_Length = 1;
            SendIO(request);
            return(0);
      }

-h- makefile	2976:1373:832	makefile
# MakeFile for Terminal Program

CC      = cc
#CFLAGS = -O -DDBUG
CFLAGS  = -O
#LIBS   = -ldbug
LIBS    =
CDISK   = C-DEVEL:
ALINK   = $(CDISK)c/alink
ALOBJ   = $(CDISK)lib/Astartup.obj
ALIBS   = $(CDISK)lib/amiga.lib+$(CDISK)lib/lc.lib

H       = term.h

FILES   = $H terminal.c serial.c console.c menus.c

OBJS    = terminal.o serial.o console.o menus.o
PDOBJS  = terminal.o+serial.o+console.o+menus.o

terminal : $(OBJS)
   $(CC) -o terminal $(OBJS) $(LIBS)

terminal.o : terminal.c $H
   $(CC) $(CFLAGS) -c terminal.c

serial.o : serial.c $H
   $(CC) $(CFLAGS) -c serial.c

console.o : console.c $H
   $(CC) $(CFLAGS) -c console.c

menus.o : menus.c $H
   $(CC) $(CFLAGS) -c menus.c

pdterm :
   $(ALINK) FROM $(ALOBJ)+$(PDOBJS) TO pdterm LIBRARY $(ALIBS)

print :
   copy EpsonSmall PAR:
   run copy terminal.c PAR:

printall :
   run join EpsonSmall $(FILES) AS PAR:

ar :
   ar -uv pdterm.ar makefile $(FILES)

-h- menus.c	2976:1373:832	menus.c
#include "term.h"

/* Dynamic Intuition Text functions */

struct IntuiText *NewIText(text, left, top)
char *text;
int left, top;
{
   struct IntuiText *newtext = NULL;

   newtext = (struct IntuiText *)AllocMem(sizeof(*newtext),
                                          MEMF_PUBLIC | MEMF_CLEAR);
   newtext->IText = (UBYTE *)text;
   newtext->FrontPen = 0;
   newtext->BackPen = 1;
   newtext->DrawMode = JAM2;
   newtext->LeftEdge = left;
   newtext->TopEdge = top;
   newtext->ITextFont = NULL;
   newtext->NextText = NULL;

   return(newtext);
}

struct IntuiText *AddIText(IText, text)
struct IntuiText *IText;
char *text;
{
   struct IntuiText *newtext = NULL;

   newtext = (struct IntuiText *)AllocMem(sizeof(*newtext),
                                          MEMF_PUBLIC | MEMF_CLEAR);
   newtext->IText = (UBYTE *)text;
   newtext->FrontPen = IText->FrontPen;
   newtext->BackPen  = IText->BackPen;
   newtext->DrawMode = IText->DrawMode;
   newtext->LeftEdge = IText->LeftEdge;
   newtext->TopEdge  = IText->TopEdge + 11;
   newtext->ITextFont = IText->ITextFont;
   newtext->NextText = NULL;
   IText->NextText   = newtext;

   return(newtext);
}

DisposeIText(IText)
struct IntuiText *IText;
{
   struct IntuiText *current, *next;

   current = IText;
   for(next = current->NextText; current != NULL; next = next->NextText){
      FreeMem(current,sizeof(*current));
      current = next;
   }
}


/* Dynamic Menu Constructor Functions */

#define InterMenuWidth 15

struct Menu *NewMenu(menuname, width, height)
char *menuname;
int width, height;
{
   struct Menu *menu = NULL;

   menu = (struct Menu *)AllocMem(sizeof(*menu),
                                  MEMF_PUBLIC | MEMF_CLEAR);

   menu->NextMenu = NULL;
   menu->LeftEdge = 0;
   menu->TopEdge = 0;
   menu->Width = width;
   menu->Height = height;
   menu->Flags = MENUENABLED;
   menu->MenuName = menuname;
   menu->FirstItem = NULL;

   return(menu);
}

struct Menu *AddMenu(menus, MenuName, width, height)
struct Menu *menus;
char *MenuName;
int width, height;
{
   struct Menu *newmenu;

   newmenu = NewMenu(MenuName, width, height);
   newmenu->LeftEdge = menus->LeftEdge + menus->Width + InterMenuWidth;
   menus->NextMenu = newmenu;
   return(newmenu);
}

struct MenuItem *NewMenuItem(name, width, height)
char *name;
int width, height;
{
   struct MenuItem *newitem = NULL;
   struct IntuiText *NewIText(), *newtext = NULL;

   newitem = (struct MenuItem *)AllocMem(sizeof(*newitem),
                                         MEMF_PUBLIC | MEMF_CLEAR);
   newtext = NewIText(name,0,1);

   newitem->NextItem = NULL;
   newitem->ItemFill = (APTR) newtext;
   newitem->LeftEdge = 0;
   newitem->TopEdge = 0;
   newitem->Width = width;
   newitem->Height = height;
   newitem->Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP;
   newitem->MutualExclude = 0;
   newitem->SelectFill = NULL;
   newitem->Command = 0;
   newitem->SubItem = NULL;
   newitem->NextSelect = 0;

   return(newitem);
}

struct MenuItem *AddNewMenuItem(menu, name, width, height)
struct Menu *menu;
char *name;
int width, height;
{
   struct MenuItem *newitem, *NewMenuItem();

   newitem = NewMenuItem(name, width, height);
   menu->FirstItem = newitem;
   return(newitem);
}

struct MenuItem *AddItem(items, name)
struct MenuItem *items;
char *name;
{
   struct MenuItem *newitem, *NewMenuItem();

   newitem = NewMenuItem(name, items->Width, items->Height);
   newitem->TopEdge = items->TopEdge + items->Height;
   newitem->LeftEdge = items->LeftEdge;
   items->NextItem = newitem;
   return(newitem);
}

struct MenuItem *AddNewSubItem(item, name, width, height)
struct MenuItem *item;
char *name;
int width, height;
{
   struct MenuItem *newitem, *NewMenuItem();

   newitem = NewMenuItem(name, width, height);
   item->SubItem = newitem;
   newitem->LeftEdge = item->Width;
   return(newitem);
}

DisposeItem(item)
struct MenuItem *item;
{
   DisposeIText((struct ItuiText *)item->ItemFill);
   FreeMem(item,sizeof(*item));
}

DisposeItems(items)
struct MenuItem *items;
{
   struct MenuItem *current, *next;

   current = items;
   for(next = current->NextItem; current != NULL; next = next->NextItem){
      DisposeItem(current);
      current = next;
   }
}

DisposeMenu(menu)
struct Menu *menu;
{
   DisposeItems(menu->FirstItem);
   FreeMem(menu,sizeof(*menu));
}

DisposeMenus(menus)
struct Menu *menus;
{
   struct Menu *current, *next;

   current = menus;
   for(next = current->NextMenu; current != NULL; next = next->NextMenu){
      DisposeMenu(current);
      current = next;
   }
}

-h- serial.c	2976:1373:832	serial.c
#include "term.h"

/* Open a serial device */
      int
OpenSerial(readrequest,writerequest)
      struct IOExtSer *readrequest;
      struct IOExtSer *writerequest;
      {
            int error;
            readrequest->io_SerFlags = NULL;
            error = OpenDevice(SERIALNAME, NULL, readrequest, NULL);
            writerequest->IOSer.io_Device = readrequest->IOSer.io_Device;
            writerequest->IOSer.io_Unit = readrequest->IOSer.io_Unit;
            writerequest->io_CtlChar = readrequest->io_CtlChar;
            writerequest->io_ReadLen = readrequest->io_ReadLen;
            writerequest->io_BrkTime = readrequest->io_BrkTime;
            writerequest->io_Baud = readrequest->io_Baud;
            writerequest->io_WriteLen = readrequest->io_WriteLen;
            writerequest->io_StopBits = readrequest->io_StopBits;
            writerequest->io_RBufLen = readrequest->io_RBufLen;
            writerequest->io_SerFlags = readrequest->io_SerFlags;
            writerequest->io_TermArray.TermArray0
            = readrequest->io_TermArray.TermArray0;
            writerequest->io_TermArray.TermArray1
            = readrequest->io_TermArray.TermArray1;
            /* clone required parts of the request */
            return(error);
      }

      int
SerPutChar(request,character)
      struct IOExtSer *request;
      char character;
      {
            request->IOSer.io_Command = CMD_WRITE;
            request->IOSer.io_Data = (APTR)&character;
            request->IOSer.io_Length = 1;
            DoIO(request);
            return(0);
      }

      int
QueueSerRead(request, whereto)
      struct IOExtSer *request;
      char *whereto;
      {
            request->IOSer.io_Command = CMD_READ;
            request->IOSer.io_Data = (APTR)whereto;
            request->IOSer.io_Length = 1;
            SendIO(request);
            return(0);
      }

   int
SetParams(io,rbuf_len,rlen,wlen,brk,baud,sf,ta0,ta1)
   struct IOExtSer *io;
   unsigned long rbuf_len;
   unsigned char rlen;
   unsigned char wlen;
   unsigned long brk;
   unsigned long baud;
   unsigned char sf;
   unsigned long ta0;
   unsigned long ta1;
   {
      io->io_ReadLen = rlen;
      io->io_WriteLen = wlen;
      io->io_Baud = baud;
      io->io_BrkTime = brk;
      io->io_StopBits = 0x01;
      io->io_RBufLen = rbuf_len;
      io->io_SerFlags = sf;
      io->io_TermArray.TermArray0 = ta0;
      io->io_TermArray.TermArray1 = ta1;
      io->IOSer.io_Command = SDCMD_SETPARAMS;
   
      return(DoIO(io));
}
-h- term.h	2976:1373:832	term.h
/* INCLUDES ********************************************************** */

#include "exec/types.h"
#include "exec/ports.h"
#include "exec/devices.h"
#include "exec/io.h"
#include "exec/memory.h"

#include "devices/console.h"
#include "devices/serial.h"
#include "devices/keymap.h"

#include "libraries/dos.h"
#include "graphics/text.h"
#include "libraries/diskfont.h"
#include "intuition/intuition.h"
 
/* EXTERNALS ***************************************************** */

extern struct Window *OpenWindow();
extern struct Screen *OpenScreen();
extern struct MsgPort *CreatePort();
extern struct IOStdReq *CreateStdIO();
extern struct IORequest *CreateExtIO();
-h- terminal.c	2976:1373:832	terminal.c

/*  A simple terminal emulator.  Does ANSI/DEC VT-100 emulation in
    80 cols by 25 lines.

    by  Michael J. McInerny   21-Feb-86 version 1.21

*/

#define INTUITION_MESSAGE (1<<intuitionMsgBit)
#define TYPED_CHARACTER (1<<consoleReadBit)
#define INPUT_CHARACTER (1<<serReadBit)

#define CloseConsole(x) CloseDevice(x)

#include "term.h"

/* GLOBALS ****************************************************** */
long IntuitionBase=0;
long GfxBase=0;

struct Window *TerminalWindow;           /* "Public" window handle     */
struct Menu *MenuHead;
struct NewWindow nw = {
   0, 0,             /* start position                  */
   640, 200,         /* width, height                   */
   -1, -1,           /* detail pen, block pen           */
   MENUPICK,
                     /* IDCMP flags                     */
   ACTIVATE | BORDERLESS,
                     /* window flags                    */
   NULL,             /* pointer to first user gadget    */
   NULL,             /* pointer to user checkmark       */
   NULL,             /* window title                    */
   NULL,             /* pointer to screen    (later)    */
   NULL,             /* pointer to superbitmap          */
   50,40,640,200,    /* sizing limits min and max       */
   WBENCHSCREEN      /* type of screen in which to open */
   };

struct MsgPort *consoleWritePort;
struct MsgPort *consoleReadPort;
struct MsgPort *serReadPort;
struct MsgPort *serWritePort;
struct IOStdReq *ConWriteReq;
struct IOStdReq *ConReadReq;
struct IOExtSer *SerReadReq;
struct IOExtSer *SerWriteReq;

char letter;            /* one letter at a time from console */
char serin;            /* one letter at a time from serial */

InitWindow()
{
   GfxBase = OpenLibrary("graphics.library", 0);
   if (GfxBase == NULL) Cleanup(1);
   IntuitionBase = OpenLibrary("intuition.library", 0);
   if (IntuitionBase == NULL) Cleanup(2);
   TerminalWindow = OpenWindow(&nw);
   if ( TerminalWindow == NULL ) Cleanup(3);
}

InitMenus()
{
   struct Menu *CurrentMenu, *NewMenu(), *AddMenu();
   struct MenuItem *CurrentItem, *SubItem,
                   *AddNewMenuItem(), *AddItem(), *AddNewSubItem();

   CurrentMenu    = NewMenu("Project", 60, 10);
   MenuHead       = CurrentMenu;
      CurrentItem = AddNewMenuItem(CurrentMenu, "About PDTerm",100,11);
      CurrentItem = AddItem(CurrentItem, "Window");
         SubItem  = AddNewSubItem(CurrentItem, "to Back",68,11);
         SubItem  = AddItem(SubItem,"to Front");
      CurrentItem = AddItem(CurrentItem, "Quit");
   CurrentMenu    = AddMenu(CurrentMenu, "Settings",68,10);
      CurrentItem = AddNewMenuItem(CurrentMenu,"Baud",52,11);
         SubItem  = AddNewSubItem(CurrentItem, "   300   ",76,11);
         SubItem->MutualExclude = (~(1 << 0));
         SubItem->Flags |= CHECKIT;
         SubItem  = AddItem(SubItem,"  1200   ");
         SubItem->MutualExclude = (~(1 << 1));
         SubItem->Flags |= CHECKIT | CHECKED;
         SubItem  = AddItem(SubItem,"  2400   ");
         SubItem->MutualExclude = (~(1 << 2));
         SubItem->Flags |= CHECKIT;
         SubItem  = AddItem(SubItem,"  4800   ");
         SubItem->MutualExclude = (~(1 << 3));
         SubItem->Flags |= CHECKIT;
         SubItem  = AddItem(SubItem,"  9600   ");
         SubItem->MutualExclude = (~(1 << 4));
         SubItem->Flags |= CHECKIT;
      CurrentItem = AddItem(CurrentItem,"Length");
         SubItem  = AddNewSubItem(CurrentItem,"   7 bits   ",100,11);
         SubItem->MutualExclude = (~(1 << 0));
         SubItem->Flags |= CHECKIT | CHECKED;
         SubItem  = AddItem(SubItem,"   8 bits   ");
         SubItem->MutualExclude = (~(1 << 1));
         SubItem->Flags |= CHECKIT;

   SetMenuStrip( TerminalWindow, MenuHead);
}

InitReqs()
{
   consoleWritePort = CreatePort("my.con.write",0);
   if(consoleWritePort == 0) Cleanup(4);
   ConWriteReq = CreateStdIO(consoleWritePort);
   if(ConWriteReq == 0) Cleanup(5);
   consoleReadPort = CreatePort("my.con.read",0);
   if(consoleReadPort == 0) Cleanup(6);
   ConReadReq =  CreateStdIO(consoleReadPort);
   if(ConReadReq == 0) Cleanup(7);
   if((OpenConsole(ConWriteReq,ConReadReq,TerminalWindow)) != 0)
      Cleanup(8);

   serReadPort = CreatePort("my.ser.read",0);
   if (serReadPort == NULL) Cleanup(9);
   SerReadReq = (struct IOExtSer *)CreateExtIO(serReadPort,
                                               sizeof(struct IOExtSer));
   if (SerReadReq == NULL) Cleanup(10);
   serWritePort = CreatePort("my.ser.write",0);
   if (serWritePort == NULL) Cleanup(11);
   SerWriteReq = (struct IOExtSer *)CreateExtIO(serWritePort,
                                               sizeof(struct IOExtSer));
   if (SerWriteReq == NULL) Cleanup(12);
   if ((OpenSerial(SerReadReq, SerWriteReq)) != 0) Cleanup(13);
   if ((SetParams( SerReadReq, 4096, 0x07, 0x07, 750000,
                           1200, NULL, 0x51040303, 0x03030303)) != 0)
      Cleanup(14);
}

main()
{
   USHORT class, code, qualifier;
   int problem, wakeupmask, consoleReadBit, intuitionMsgBit, serReadBit;
   struct IntuiMessage *message; /* the message the IDCMP sends us */

   InitWindow();
   InitMenus();
   InitReqs();

   QueueRead(ConReadReq,&letter);
   QueueSerRead(SerReadReq, &serin);

   consoleReadBit = ConReadReq->io_Message.mn_ReplyPort->mp_SigBit;
   intuitionMsgBit = TerminalWindow->UserPort->mp_SigBit;
   serReadBit = SerReadReq->IOSer.io_Message.mn_ReplyPort->mp_SigBit;

   do
   {
      wakeupmask = Wait( INTUITION_MESSAGE |
                         TYPED_CHARACTER |
                         INPUT_CHARACTER);

      while(CheckIO(ConReadReq))
         {
            WaitIO(ConReadReq);
            SerPutChar(SerWriteReq,letter);
            QueueRead(ConReadReq, &letter);
         }
      while(CheckIO(SerReadReq))
         {
            WaitIO(SerReadReq);
            ConPutChar(ConWriteReq,serin);
            QueueSerRead(SerReadReq, &serin);
         }
      if(wakeupmask & INTUITION_MESSAGE)
         {
            while((message = (struct IntuiMessage *)
                  GetMsg(TerminalWindow->UserPort) ) != NULL)
               {
                  class     = message->Class;
                  code      = message->Code;
                  qualifier = message->Qualifier;
                  ReplyMsg(message);
                  problem = HandleEvent(class,code,qualifier);
                  if(problem == FALSE) break;
               }
         }
   } while (problem); /* keep going as long as HandleEvent returns nonzero */
   AbortIO(ConReadReq);      /* cancel the last queued read */
   AbortIO(SerReadReq);
   Cleanup(0);
}

Cleanup(problem)
int problem;
{
   if ((problem >= 14) || (problem == 0)) CloseDevice(SerReadReq);
   if ((problem >= 13) || (problem == 0))
      DeleteExtIO(SerWriteReq,sizeof(struct IOExtSer));
   if ((problem >= 12) || (problem == 0)) DeletePort(serWritePort);
   if ((problem >= 11) || (problem == 0))
      DeleteExtIO(SerReadReq,sizeof(struct IOExtSer));
   if ((problem >= 10) || (problem == 0)) DeletePort(serReadPort);
   if ((problem >= 9) || (problem == 0)) CloseConsole(ConWriteReq);
   if ((problem >= 8) || (problem == 0)) DeleteStdIO(ConReadReq);
   if ((problem >= 7) || (problem == 0)) DeletePort(consoleReadPort);
   if ((problem >= 6) || (problem == 0)) DeleteStdIO(ConWriteReq);
   if ((problem >= 5) || (problem == 0)) DeletePort(consoleWritePort);
   if ((problem >= 4) || (problem == 0)) {
      ClearMenuStrip(TerminalWindow);
      DisposeMenus(MenuHead);
      CloseWindow(TerminalWindow);
      }
   if ((problem >= 3) || (problem == 0)) CloseLibrary(IntuitionBase);
   if ((problem >= 2) || (problem == 0)) CloseLibrary(GfxBase);
   if(problem > 0)
         exit(problem+1000);
   else
         return(0);
}

HandleEvent(class,code,qualifier)
USHORT class;
USHORT code;
USHORT qualifier;
{
      switch(class) {
         case MENUPICK:
            return(MenuSwitch(code));
            break;
      } /* end of switch( class ) */
      return(TRUE);
} /* end of HandleEvent */

MenuSwitch(code)
USHORT code;
{
   USHORT menunum;
   struct MenuItem *item;
   int error;

   error = TRUE;
   while(code != MENUNULL ) {
      item = (struct MenuItem *)ItemAddress(MenuHead, code);
      menunum = MENUNUM( code );
      switch( menunum ) {
         case 0:
            error &= ProjectMenu(code);
            break;
         case 1:
            error &= SettingsMenu(code);
            break;
      } /* end of switch ( menunum ) */
      code = item->NextSelect;
   } /* end of while (code != MENUNULL) */
   return(error);
} /* end of MenuSwitch */


ProjectMenu(code)
USHORT code;
{
   USHORT itemnum;
   struct IntuiText *InfoText, *OKText, *NewIText(), *AddIText();
   itemnum = ITEMNUM( code );
   switch( itemnum ) {
      case 0:  /* About PDTerm */
         InfoText = NewIText("Public Domain Terminal Emulator",12,5);
         AddIText(InfoText, "    by Michael McInerny  ");
         OKText = NewIText("Okay",6,3);
         AutoRequest(TerminalWindow,
                     InfoText,
                     NULL, OKText,
                     NULL, NULL,
                     296, 65);
         DisposeIText(InfoText);
         DisposeIText(OKText);
         return(TRUE);
      case 1:  /* Window */
         return(ArrangeMenu(code));
         break;
      case 2: /* Quit */
         return( FALSE );
         break;
   } /* end of switch ( itemnum ) */
   return( TRUE );
} /* end of ProjectMenu */

ArrangeMenu(code)
USHORT code;
{
   USHORT subitem;
   subitem = SUBNUM( code );
   switch( subitem ) {
      case 0:
         WindowToBack( TerminalWindow );
         break;
      case 1:
         WindowToFront( TerminalWindow );
         break;
   } /* end of switch ( subitem ) */
   return( TRUE );
} /* end of ArrangeMenu */

SettingsMenu(code)
USHORT code;
{
   USHORT itemnum;
   itemnum = ITEMNUM( code );
   AbortIO(SerReadReq);
   switch ( itemnum ) {
      case 0:
         BaudMenu(code);
         break;
      case 1:
         LengthMenu(code);
         break;
   } /* end of switch ( itemnum ) */
   SerReadReq->IOSer.io_Command = SDCMD_SETPARAMS;
   DoIO(SerReadReq);
   QueueSerRead(SerReadReq, &serin);
   return( TRUE );
} /* end of SettingsMenu */

BaudMenu(code)
USHORT code;
{
   USHORT subitem;
   subitem = SUBNUM( code );
   switch( subitem ) {
      case 0:
         SerReadReq->io_Baud = 300;
         break;
      case 1:
         SerReadReq->io_Baud = 1200;
         break;
      case 2:
         SerReadReq->io_Baud = 2400;
         break;
      case 3:
         SerReadReq->io_Baud = 4800;
         break;
      case 4:
         SerReadReq->io_Baud = 9600;
         break;
   } /* end of switch ( subitem ) */
} /* end of BaudMenu */

LengthMenu(code)
USHORT code;
{
   USHORT subitem;
   subitem = SUBNUM( code );
   switch( subitem ) {
      case 0:
         SerReadReq->io_ReadLen = 0x07;
         SerReadReq->io_WriteLen = 0x07;
         break;
      case 1:
         SerReadReq->io_ReadLen = 0x08;
         SerReadReq->io_WriteLen = 0x08;
         break;
   } /* end of switch ( subitem ) */
} /* end of LengthMenu */

-----------------------------------------------------------------------

Replies to BM17@TD.CC.CMU.EDU
	or BM17@CMUCCVMA   (Bitnet)

-------