/*                                 Raddecay 2.0
                                *****************
                     Copyright (c) 1987 Grove Engineering, Inc.
                                All rights reserved
                 15215 Shady Grove Rd., Suite 202, Rockville, MD 20850
                                   (301) 258-272

                                 *****************
                             POST RELEASE REVISION HISTORY

  2.00: Negin/Tocus - Initial release

  Program changes:
        2.01 - 10/24/87
        Bound in text files READINFO.DOC AND FILEINFO.DOC
        Faster box routine
        Halflife print format modified to accomodate double digit exponentials

        2.02 - 11/20/87
        Added full names and atomic weight info
        Textshow calls modified to ensure proper box alignment with coprocessor - True Basic fix

        2.03 - 2/28/87
        Changed to simple setup routine to avoid double backslash */



#include <intuition/intuition.h>
#include <libraries/dos.h>
#include <stdio.h>
#include "raddecay.h"

#define FOREVER for(;;)

extern void *OpenLibrary();
extern void *OpenWindow();
extern void *GetMsg();
extern struct FileHandle *Open();


struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct IntuiMessage *message;
struct RastPort *rp;
struct Window *w;

struct NewWindow nw =
{  0, 0,                  /*  left edge, top edge    */
   640, 256,              /*  width, height,         */
   0, 1,                  /*  detail, block pens     */
   CLOSEWINDOW            /*  IDCMP flags            */
 | RAWKEY
 | MENUPICK,
                          /*  Regular flags for gadgets and such */
   WINDOWDEPTH
 | WINDOWSIZING
 | WINDOWDRAG
 | WINDOWCLOSE
 | SMART_REFRESH
 | ACTIVATE,

   NULL,                                   /* First gadget in list        */
   NULL,                                   /* User checkmark              */
   (UBYTE *)"RadDecay",                    /* Window Title                */
   NULL,                                   /* Pointer to screen           */
   NULL,                                   /* Pointer to superbitmap      */
   50, 25, 640, 256,                       /* Min and max size            */
   WBENCHSCREEN,                           /* Using the Workbench screen  */
};

struct IntuiText tquit =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        1,1,                           /* leftedge, topedge */
        NULL,                          /* TextAttr */
#ifdef ENGLISH
        (UBYTE *)"Quit this session",  /* IText */
#endif
#ifdef GERMAN
        (UBYTE *)"Diese Sitzung beenden",  /* IText */
#endif
        NULL,                          /* NextText */
};

struct MenuItem quitt =
{       (struct MenuItem *) NULL,
        0,50,                               /* LeftEdge, TopEdge */
        200,10,                             /* Width, Height */
        ITEMTEXT | HIGHCOMP | ITEMENABLED,  /* Flags */
        0,                                  /* Mutual Exclude */
        (APTR)&tquit,                       /* ItemFill */
        NULL,                               /* SelectFill */
        0,                                  /* Command    */
        NULL,                               /* Subitem */
        0,                                  /* NextSelect */
};

struct IntuiText tconf =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        1,1,                           /* leftedge, topedge */
        NULL,                          /* TextAttr */
#ifdef ENGLISH
        (UBYTE *)"Computer configuration",   /* IText */
#endif
#ifdef GERMAN
        (UBYTE *)"Computer Konfiguration",   /* IText */
#endif
        NULL,                          /* NextText */
};

struct MenuItem conf =
{       (struct MenuItem *) &quitt,
        0,40,                               /* LeftEdge, TopEdge */
        200,10,                             /* Width, Height */
        ITEMTEXT | HIGHCOMP | ITEMENABLED,  /* Flags */
        0,                                  /* Mutual Exclude */
        (APTR)&tconf,                       /* ItemFill */
        NULL,                               /* SelectFill */
        0,                                  /* Command    */
        NULL,                               /* Subitem */
        0,                                  /* NextSelect */
};


struct IntuiText tinfo =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        1,1,                           /* leftedge, topedge */
        NULL,                          /* TextAttr */
#ifdef ENGLISH
        (UBYTE *)"Information about files",   /* IText */
#endif
#ifdef GERMAN
        (UBYTE *)"Information über Dateien",   /* IText */
#endif
        NULL,                          /* NextText */
};

struct MenuItem info =
{       (struct MenuItem *) &conf,
        0,30,                               /* LeftEdge, TopEdge */
        200,10,                             /* Width, Height */
        ITEMTEXT | HIGHCOMP | ITEMENABLED,  /* Flags */
        0,                                  /* Mutual Exclude */
        (APTR)&tinfo,                       /* ItemFill */
        NULL,                               /* SelectFill */
        0,                                  /* Command    */
        NULL,                               /* Subitem */
        0,                                  /* NextSelect */
};


struct IntuiText tgen =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        1,1,                           /* leftedge, topedge */
        NULL,                          /* TextAttr */
#ifdef ENGLISH
        (UBYTE *)"General information",   /* IText */
#endif
#ifdef GERMAN
        (UBYTE *)"Allgemeine Information",   /* IText */
#endif
        NULL,                          /* NextText */
};

struct MenuItem general =
{       (struct MenuItem *) &info,
        0,20,                               /* LeftEdge, TopEdge */
        200,10,                             /* Width, Height */
        ITEMTEXT | HIGHCOMP | ITEMENABLED,  /* Flags */
        0,                                  /* Mutual Exclude */
        (APTR)&tgen,                        /* ItemFill */
        NULL,                               /* SelectFill */
        0,                                  /* Command    */
        NULL,                               /* Subitem */
        0,                                  /* NextSelect */
};


struct IntuiText texe =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        1,1,                           /* leftedge, topedge */
        NULL,                          /* TextAttr */
#ifdef ENGLISH
        (UBYTE *)"Execute RADDECAY",   /* IText */
#endif
#ifdef GERMAN
        (UBYTE *)"RADDECAY ausführen",   /* IText */
#endif
        NULL,                          /* NextText */
};

struct MenuItem execute =
{       (struct MenuItem *) &general,
        0,10,                               /* LeftEdge, TopEdge */
        200,10,                             /* Width, Height */
        ITEMTEXT | HIGHCOMP | ITEMENABLED,  /* Flags */
        0,                                  /* Mutual Exclude */
        (APTR)&texe,                        /* ItemFill */
        NULL,                               /* SelectFill */
        0,                                  /* Command    */
        NULL,                               /* Subitem */
        0,                                  /* NextSelect */
};

struct IntuiText Noth =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        1,1,                           /* leftedge, topedge */
        NULL,                          /* TextAttr */
        (UBYTE *)"",                   /* IText */
        NULL,                          /* NextText */
};


struct MenuItem nothing =
{       (struct MenuItem *) &execute,
        0,0,                               /* LeftEdge, TopEdge */
        200,10,                             /* Width, Height */
        ITEMTEXT | HIGHCOMP | ITEMENABLED,  /* Flags */
        0,                                  /* Mutual Exclude */
        (APTR)&Noth,                        /* ItemFill */
        NULL,                               /* SelectFill */
        0,                                  /* Command    */
        NULL,                               /* Subitem */
        0,                                  /* NextSelect */
};

struct Menu menu =
{       (struct Menu *) NULL,        /* NEXT menu */
        0, 0, 200, 0,                /* LeftEdge, TopEdge, Width, Height */
        MENUENABLED,                 /* Flags */
#ifdef ENGLISH
        (BYTE *) "RADDECAY main menu", /* MenuName */
#endif
#ifdef GERMAN
        (BYTE *) "RADDECAY Hauptmenü", /* MenuName */
#endif
        (struct MenuItem *)&nothing, /* First item */
        0,0,0,0,                     /* JazzX,JazzY, BeatX, BeatY */
        };

 ULONG MessageClass;
 char *vers = "2.03";                 /* version - ONLY HARD CODE HERE */
 int line;
 char Buf[80];

/* No, no, you're wrong there. That's not BUF, that's BEEF.

   Well, I mean, if they don't know they're eating WATER BUFFALO,
   it doesn't matter, does it?  */

struct ddd def;

MakePath(s)
char *s;
{ if (def.recpath[0])
     { strcpy(Buf,def.recpath);
       strcat(Buf,"/");
     }
  else
     Buf[0]=0;
  strcat(Buf,s);
}

config()
{  char msg[5];
   int i;
   FILE *RADDECAY;

   def.video = 0;
   if (!(RADDECAY=fopen("raddecay.dat","r"))) return 0;
   for (i=0;i<4;i++)
        if (!fscanf(RADDECAY,"%ld\n",&def.colour[i])) return 0;
   if (!fscanf(RADDECAY,"%s",&def.recpath)) return 0;
   fclose(RADDECAY);
   return 1;
}

put_config()
{  FILE *RADDECAY;
   int i;

   if (RADDECAY=fopen("raddecay.dat","w"))
      { for (i=0;i<4;i++)
          fprintf(RADDECAY,"%ld\n",def.colour[i]);
        fprintf(RADDECAY,"%s\n",def.recpath);
        fclose(RADDECAY);
        return 1;
      }
   return 0;
}

Get_config()
{  if (!config()) return put_config();
   return 1;
}

print_centered(s,j)
char *s;
int j;
{ int i;

  i=(80-strlen(s))*4;
  Move(rp,(long)i,(long)j);
  Text(rp,s,(long)strlen(s));
}

cls()
{ long j;

  SetAPen(rp,def.colour[0]);
  j=nw.Height-10;
  RectFill(rp,5L,10L,635L,j);
}

box(a,b,c,d)
int a,b,c,d;
{ long e,f,g,h;

  SetAPen(rp,def.colour[1]);
  Move(rp,(long)a,(long)b);
  Draw(rp,(long)c,(long)b);
  Draw(rp,(long)c,(long)d);
  Draw(rp,(long)a,(long)d);
  Draw(rp,(long)a,(long)b);

  e=a+3;
  f=b+2;
  g=c-3;
  h=d-2;
  Move(rp,e,f);
  Draw(rp,g,f);
  Draw(rp,g,h);
  Draw(rp,e,h);
  Draw(rp,e,f);
}

Welcome()
{   int i;

    box(250,35,400,60);
    SetAPen(rp,def.colour[3]);
    sprintf(Buf," RADDECAY %s ",vers);
    print_centered(Buf,50);
#ifdef ENGLISH
    sprintf(Buf," A program for the public domain");
#endif
#ifdef GERMAN
    sprintf(Buf," Ein Programm für den Public Domain");
#endif
    i=nw.Height/2;
    print_centered(Buf,i);
#ifdef ENGLISH
    sprintf(Buf,"   by Grove Engineering, Inc.");
#endif
#ifdef GERMAN
    sprintf(Buf,"   von Grove Engineering, Inc.");
#endif
    print_centered(Buf,i+10);
#ifdef ENGLISH
    sprintf(Buf,"For the IBM PC with DOS 2.1 or equivalent.");
#endif
#ifdef GERMAN
    sprintf(Buf,"Für den IBM PC mit DOS 2.1 oder äquivalent.");
#endif
    i *= 2;
    SetAPen(rp,def.colour[1]);
    print_centered(Buf,i-25);
#ifdef ENGLISH
    sprintf(Buf,"October/1987 - Grove Engineering,Inc.");
#endif
#ifdef GERMAN
    sprintf(Buf,"Oktober/1987 - Grove Engineering,Inc.");
#endif
    print_centered(Buf,i-15);
}

defcol()
{ def.colour[0]=0;
  def.colour[1]=1;
  def.colour[2]=2;
  def.colour[3]=3;
}

#ifdef ENGLISH
char *gtext[] =
{"                    GENERAL INFORMATION ABOUT RADDECAY",
"               (C.A. Negin - Grove Engineering, Inc. - 10/87)",
" ","1. INTRODUCTION",
"RADDECAY is a program for displaying radioactive decay information for 497",
"radionuclides.   Data provided include the half life, radioactive daughter",
"nuclides, probabilities per decay, and decay product energies for alphas,",
"betas, positrons, electrons, X-rays, and photons.",
" ","2. INSTRUCTIONS FOR THE FIRST-TIME USER",
"All information regarding RADDECAY is on the system diskette.  To get started,",
"use any drive and type 'RADDECAY'.  This will execute the program and make",
"information available via menu selections.  The files may be copied to and",
"executed from a hard disk.  There is no copy protection."," ",
"The second diskette contains seven 'record' (random access) files which",
"contain all the data.  They have an extension of '.REC' with file names that",
"are self explanatory.  These files do not have to be on the same drive or DOS",
"directory as the system diskette files.  However, they must all be in one",
"directory or sub-directory.  More information regarding these files can be",
"read by selecting the file information menu item."," ",
"When RADDECAY executes, it initially reads a file in the same directory with",
"the name RADDECAY.DAT.  This file contains parameters which control the screen",
"colors and the DOS path to the data contained in the *.REC files.  If this",
"file is not found, then one is created with:"," ",
"     a) Default screen colors. If you cannot see the screen because of",
"        a strange color combination, press [Esc] from the menu to re-set them.",
" ",
"     b) The path to the *.REC files as the current directory from which",
"        RADDECAY was executed."," ",
"When you set these parameters from RADDECAY main menu, they are retained in",
"the RADDECAY.DAT file for the next time the program is run.  As received,",
"there is no file on diskette, so it will be created with the defaults the",
"first time it is used."," ",
"If you have a hard disk or an IBM-PC AT with a high capacity drive, we",
"recommend that you create a subdirectory (for example, C:\RADDECAY\) on the",
"high capacity drive and copy files RADDECAY.EXE, and all seven .REC files",
"to it.  Then, when you first run RADDECAY, set the path and colors by",
"pressing [Esc].  If you use the nuclide record files for other programs such",
"as Grove Engineering's Microshield or MicroSkyshine, then you should set the",
"record files path to the same subdirectory as for these programs.  This will",
"avoid replicate copies of the same data on your hard disk."," ",
"3. PERMISSION FOR MAKING COPIES",
"The two diskettes provided are 'plain vanilla'.",
"Permission is granted for",
"making copies of RADDECAY without any restrictions."," ",
"4. PERMISSION FOR USE OF THE SOURCE CODE",
"Source code provided is sufficient for checking the algorithms use in RAD-",
"DECAY.  Programmers may use the source code to any extent they desire.  We",
"heartily encourage microcomputers for engineering and analysis work. Note",
"that you will not be able to compile RADDECAY without licensed True Basic",
"library and Grove Engineering library routines for machine interaction. When",
"you create a program that uses any of the .REC files, you should acknowledge:",
" ","     a) RSIC (see § 5. below) as the original source of the data, and",
"     b) Grove Engineering as the originators of the microcomputer formatted",
"       files."," ",
"5. SOURCE OF DATA AND DECAY ALGORITHM",
"Thanks are due to the Radiation Shielding Information Center (RSIC) at Oak",
"Ridge National Laboratories which provided the nuclides library information",
"on diskette so that we could adapt it; and to Dick Bowers of the Perry Nuclear",
"plant who provided the decay algorithm."," ",
"The data contained in these files from the RSIC were received in mid-1986 and",
"is presumed current to that time.  These data are the same as that in:"," ",
"     RADIOACTIVE DECAY DATA TABLES","     by David C. Kocher",
"     Report DOE/TIC-11026","     Technical Information Center",
"     U.S. Department of Energy,","     Washington, D.C., 1981"," ",
"which is available through NTIS.  We are grateful to RSIC, a government",
"sponsored organization, for providing this public-domain information."," ",
"Grove Engineering added C-15 to this library for purposes of N-16 radiation",
"shielding calculations.  Altogether, there are 497 nuclides."," ",
"6. CONVERSION TO MICROCOMPUTER FORMAT",
"The data were converted to random access record files by:"," ",
"     Grove Engineering","     15215 Shady Grove Road",
"     Rockville, MD 20850","     Phone (301) 258-2727"," ",
"Dave Tocus is the programmer who did much of the neat stuff that makes this",
"program extremely easy to use.  We used the True Basic programming system",
"which proved to be outstanding.  The team of creators of RADDECAY are very",
"pleased with the result.  We trust that you will find this program useful.",
" ",
"Grove Engineering provides energy and electricity-related engineering and",
"management consulting services to utility, industrial, and maritime",
"organizations; and to the U.S.Navy."," ",
"                                             C.A. Negin",
"                                             September/1987"," ",
"            ***** Press [Esc] to return to the main menu *****",""};
#endif

#ifdef GERMAN
char *gtext[] =
{"                    ALLGEMEINE INFORMATION ÜBER RADDECAY",
"               (C.A. Negin - Grove Engineering, Inc. - 10/87)",
" ","1. EINFÜHRUNG",
"RADDECAY ist ein Programm um Informationen über den radioaktiven Zerfall",
"von 497 Radionukliden anzuzeigen. Die angezeigten Daten enthalten die",
"Halbwertszeit, Zerfallsprodukte, Nukliden, Wahrscheinlichkeit pro Zerfall",
"und Zerfallsenergie für Alpha-, Betateilchen, Positronen, Elektronen,",
"Röntgenstrahlen und Photonen.",
" ","2. ANLEITUNG FÜR DEN ERSTMALIGEN BENUTZER",
"Alle Informationen über RADDECAY sind auf der Systemdiskette. Um das",
"Programm zu starten, verwende man irgendein Laufwerk und gebe 'RADDECAY'",
"ein. Dadurch wird das Programm gestartet und die Information wird über",
"Menüwahl verfügbar. Die Dateien können auf eine Festplatte kopiert werden",
"und von dort aus gestartet werden. Es gibt kein Kopierschutz."," ",
"Die zweite Diskette enthält sieben 'archiv' (direktzugriff) Dateien, die",
"alle Daten enthalten. Sie haben alle den Zusatz '.REC' und Dateinamen, die",
"selbsterklärend sind. Diese Dateien müssen nicht auf dem gleichen Laufwerk",
"oder Verzeichnis sein, wie die Systemdateien. Sie müssen jedoch alle im",
"gleichen Verzeichnis sein. Weitere Informationen über diese Dateien sind",
"unter dem Menüpunkt Information über Dateien enthalten."," ",
"Wenn RADDECAY gestartet wird, liest es zuerst eine Datei auf dem gleichen",
"Verzeichnis ein mit dem Namen RADDECAY.DAT. Diese Datei enthält Parameter,",
"die für die Farben und für den Pfad der .REC Dateien verwendet werden.",
"Sollte diese Datei nicht gefunden werden, so wird eine generiert mit:"," ",
"     a) Voreingestellte Farben. Wenn Sie nichts auf dem Bildschirm sehen,",
"        wegen der merkwürdigen Farbkombination, geben Sie [Esc] ein um",
"        die Standardwerte anzunehmen."," ",
"     b) Den Pfad für die .REC Dateien als das Verzeichnis von dem aus",
"        RADDECAY aufgerufen wurde."," ",
"Wenn Sie dies Parameter im Hauptmenü verändern, werden diese Werte",
"beibehalten in der Datei RADDECAY.DAT und beim nächsten Programmstart",
"verwendet. Ausgeliefert wird dieses Programm ohne diese Datei, also wird",
"es beim ersten Programmstart generiert."," ",
"Wenn Sie eine Festplatte oder einen IBM-PC AT mit einem Laufwerk hoher",
"Dichte besitzen, empfehlen wir, daß Sie ein Verzeichnis (z.B. C:\RADDECAY\)",
"auf dem Laufwerk hoher Dichte erzeugen und die Datei RADDECAY.EXE und alle",
"sieben .REC Dateien dorthin kopieren. Danach starten Sie RADDECAY und setzen",
"Sie die Farben durch Eingabe von [Esc]. Falls Sie die Nukliddateien für",
"andere Zwecke verwenden, z.B. die Programme Microshield oder MicroSkyshine",
"von Grove Engineering, sollten Sie den Pfadnamen auf das Verzeichnis dieser",
"Programme setzen. Dadurch vermeiden Sie die Dateien doppelt auf der",
"Festplatte halten zu müssen."," ",
"3. KOPIERERLAUBNIS",
"Diese beiden Disketten sind 'wie erhalten'. Erlaubnis wird erteilt um",
"RADDECAY kopieren zu dürfen ohne jede Bedingung."," ",
"4. ERLAUBNIS FÜR DIE VERWENDUNG DER QUELLDATEIEN",
"Die enthaltenen Quelldateien sind ausreichend, um die in RADDECAY verwendeten",
"Algorithmen zu überprüfen. Programmierer dürfen die Quelldateien in jedem",
"von ihnen gewünschten Ausmaß verwenden. Wir unterstützen die Verwendung",
"von Mikrocomputer in Ingenieur- und Analysearbeit mit vollem Herzen. Man",
"beachte, daß sich RADDECAY nicht kompilieren lassen wird ohne lizenziertem",
"True Basic library und die library Dateien von Grove Engineering für die",
"Benutzerschnittstelle. Wenn Sie ein Programm schreiben, daß irgendeine der",
".REC Dateien verwendet, sollten Sie darauf hinweisen, daß:"," ",
"     a) RSIC (siehe § 5. unten) als Urheber der Daten, und",
"     b) Grove Engineering als Urheber der mikrocomputer lesbaren Dateien",
" ","5. QUELLE DER DATA- UND ZERFALLSALGORITHMEN",
"Dank ist fällig an den Radiation Shielding Information Center (RSIC) bei",
"Oak Ridge National Laboratories die, die nuklidlibrary Informationen auf",
"Diskette zur Verfügung gestellt haben, sodaß wir es adaptieren konnten; an",
"Dick Bowers von der Perry Nuclear plant der den Zerfallsalgorithmus zur",
"Verfügung gestellt hat."," ",
"Die Daten, die in diesen Dateien enthalten ist, wurde Mitte 1986 erhalten",
"und wird als aktuell zum damaligen Zeitpunkt angenommen. Die Daten sind",
"identish mit denen in:"," ",
"     RADIOACTIVE DECAY DATA TABLES","     von David C. Kocher",
"     Report DOE/TIC-11026","     Technical Information Center",
"     U.S. Department of Energy,","     Washington, D.C., 1981"," ",
"erhältlich von NTIS. Wir danken RISC, eine von der Regierung geförderte",
"Organization, dafür, daß sie diese Public-Domain Information zur",
"Verfügung gestellt haben."," ",
"Grove Engineering hat C-15 der library hinzugefügt für den Zweck der N-16",
"Strahlungsberechnung. Insgesamt gibt es 497 Nuklide."," ",
"6. KONVERTIERUNG DES MIKROCOMPUTER FORMATS",
"Diese Daten wurden auf direktzugriff Dateien konvertiert von:"," ",
"     Grove Engineering","     15215 Shady Grove Road",
"     Rockville, MD 20850","     Phone (301) 258-2727"," ",
"Dave Tocus ist der Programmier, der viel von dem netten Zeug gemacht hat,",
"das dieses Programm äußerst benutzerfreundlich macht. Wir verwenden das",
"True Basic system, das sich als hervorragend erwiesen hat. Das Team der",
"erzeuger von RADDECAY sind sehr mit dem Ergebnis zufrieden. Wir erwarten,",
"daß Sie dieses Progamm als nützlich einstufen werden.", " ",
"Grove Engineering stellt Energie und Elektrizitäts-orientierte Ingenieur und",
"managementberatungs Dienste der Utility-, Industrie-, und Maritim-",
"Organizationen zur Verfügung; und auch der U.S.Navy."," ",
"                                             C.A. Negin",
"                                             September/1987"," ",
"            ***** Zurück zum Hauptmenü mit [Esc] *****",""};
#endif

#ifdef ENGLISH
char *files[] =
{"            RADDECAY PROGRAMMING AND FILE STRUCTURE INFORMATION",
"              (C.A. Negin - Grove Engineering, Inc - 10/87)","1. OVERVIEW",
"RADDECAY is a program for displaying radioactive decay information for 497",
"radionuclides.  Data provided include the half life, radioactive daughter",
"nuclides, probabilities per decay, and decay product energies for alphas,",
"betas, positrons, electrons, X-rays, and gammas.  What we (with much work by",
"Jody Fletcher) have done is taken the 80 column card image files provided by",
"RSIC in a sequential order corresponding to atomic weight and atomic number,",
"established an alphabetic sequence, generated individual record(random access)",
"files that can be readily accessed by an IBM-PC compatable microcomputer, and",
"provided a program to retrieve the information with user-oriented interaction.",
" ",
"Programmers with the TrueBasic language can write their own programs to access",
"the data in accordance with the file specifications here.  This may also be",
"possible with other languages, however, we haven't tried to do so.  We have",
"chosen TrueBasic because:"," ",
"     - It automatically supports the math coprocesser.",
"     - All numbers and calculations are double precision; thus avoiding",
"       roundoff anomolies (see below).",
"     - The NUM$ function converts numbers to standard IEEE eight byte",
"       format.  The eight bytes contain a sign bit, an 11 bit exponent,",
"       and a 52 bit mantissa.  This means that numbers can be represented",
"       in a range 1e-307 to 1e+307(roughly), with about 15 digits of",
"       precision.  Refer to the source listing for use of the NUM function",
"       which is for retrieval.",
"     - The structured nature of TrueBasic make it readily understood by",
"       others who may wish to use parts of the program to create their own",
"       applications.",
"     - TrueBasic is automatically compiled. (It does not run in an",
"       interpreted mode.)",
"     - The compiled code is easily bound into one executable program.",
"     - TrueBasic is supposed to be transportable between systems; although",
"       we have yet to try."," "," ",
"2. RADDECAY FILES - SYSTEM DISKETTE"," ",
"RADDECAY.EXE - The compiled and bound executable code.  This was created by",
"using the TrueBasic Bind (i.e., linker) program and runtime library which",
"Grove Engineering has been licensed by TrueBasic, Inc."," ",
"*.TRU - source files may exist in True Basic language and format.",
"These files are not required to execute RADDECAY.  True Basic source",
"code is in ASCII format and can be listed with the DOS PRINT or TYPE commands.",
"If you have the True Basic language, then you can import the code for use with",
"the TrueBasic screen editor.  Any word processer should be able to import the",
"source language."," ",
"3. RADDECAY RECORD FILES DISKETTE",
"The record (random access) files contain all the data.  The program retrieval",
"format, which is listed below, can also be found in the source code listing",
"on the system diskette.  The seven record files and their format are:"," ",
"NUCLIDES.REC - Contains 497 records corresponding to an alphabetized list of",
"radionuclides.  Each record contains single parameter information for the",
"nuclide, pointer information to the location of the products of decay in the",
"remaining record files, and the number of entries in each record file for each",
"product of decay.  Each record contains 41 bytes, packed from left to right",
"into 324 bits; that is, 40 bytes & 2 bits.  This packing was necessary to",
"allow all the record files to fit on one diskette. The parameters in each",
"record from left to right are in fields as follows:"," ",
"Start     Byte    Start   Bit",
"Byte      Length   Bit   Length  Description of parameter(format)"," ",
"  1         8                    nuclide name (ASCII)",
"  9         8                    atomic weight (IEEE)",
" 17         1      129      8    atomic number (binary field,right justified)",
" 18         8                    half life (IEEE)",
" 26         1                    half life unit (ASCII) (S = seconds,",
"                                 M = minutes, H = hours, D = days, Y = years)",
" ",
"The format for all the remaining numbers in the record is a binary field,",
"right justified within the bit field.  All numbers and pointers are for the",
"nuclide named in the first field above. "," ","    Start     No.",
"     Bit     Bits      Description of parameter"," ",
"     209       2       number of daughters in the file PROGENY.REC",
"     211       9       first daughter record number in PROGENY.REC",
"     220       7       number of alphas in the file ALPHA.REC",
"     227      13       first alpha record number in ALPHA.REC",
"     240       8       number of betas in the file BETA.REC",
"     248      13       first beta record number in BETA.REC",
"     261       8       number of positrons in the file POSITRON.REC",
"     269      13       first positron record number in POSITRON.REC",
"     282       8       number of electrons in the file ELECTRON.REC",
"     290      13       first electron record number in ELECTRON.REC",
"     303       8       number of photons in the file PHOTON.REC",
"     311      13       first photon record number in PHOTON.REC"," ",
"To retrieve the individual values, you will need to use the True Basic NUM",
"function, which converts an eight byte string stored in IEEE format to a",
"number, and the function UNPACKB which unpacks a specified bit field into an",
"integer value."," ",
"The number of records in each of the remaining files are:",
"                  number of         record length",
"                   records             (bytes)",
"PROGENY.REC          291                  16",
"ALPHA.REC            360                  16",
"BETA.REC            1700                  24",
"POSITRON.REC         138                  24",
"ELECTRON.REC        3882                  16",
"PHOTON.REC          7480                  16"," ",
"All of the values in these files are stored in IEEE format and can be",
"retrieved by using the True Basic NUM function."," ",
"The four files PROGENY.REC, ALPHA.REC, ELECTRON.REC, and PHOTON.REC have a",
"format that consists of a 16 byte record into which two values are stored.",
" ",
"In each record of the file PROGENY.REC, the first value is the index of this",
"daughter nuclide corresponding to the sequential order in which it appears in",
"the file NUCLIDES.REC, and the second value is the branching ratio (i.e., the",
"fractional yield) per decay of the parent."," ",
"In each record of the three files ALPHA.REC, ELECTRON.REC, and PHOTON.REC, the",
"first value is the energy of the decay product, and the second value is the",
"probability per decay (sometimes called 'abundance').  Photons consist of both",
"gammas and X-rays."," ",
"The two files BETA.REC AND POSITRON.REC have a format that consists of a 24",
"byte record into which three values are stored.  The first value is the",
"maximum energy of the decay product, the second value is the average energy,",
"and the third value is the probability per decay."," ","4. OTHER FILES",
"RADDECAY.DAT - A file containing parameters for color control and the DOS",
"path to the *.REC files.  The purpose of this file is to allow automatic",
"retrieval of parameters you set without having to reset them every time the",
"program is started.  The parameters in this file are the path statement, the",
"foreground color, and the background color.  If it is not present when",
"execution starts, it will be created with default parameters."," ",
"RADDECAY uses other source code library files while compiling and binding",
"(i.e., linking).  These libraries are the property of Grove Engineering, Inc.",
"or True Basic, Inc and may be licensed as appropriate to your use."," ",
"            ***** Press [Esc] to return to the main menu *****",""};
#endif

#ifdef GERMAN
char *files[] =
{"            RADDECAY PROGRAMMIER- UND DATEISTRUKTUR INFORMATIONEN",
"              (C.A. Negin - Grove Engineering, Inc - 10/87)","1. ÜBERBLICK",
"RADDECAY ist ein Programm um Informationen über den radioaktiven Zerfall",
"von 497 Radionukliden anzuzeigen. Die angezeigten Daten enthalten die",
"Halbwertszeit, Zerfallsprodukte, Nukliden, Wahrscheinlichkeit pro Zerfall",
"und Zerfallsenergie für Alpha-, Betateilchen, Positronen, Elektronen,",
"Röntgenstrahlen und Gammastrahlen. Was wir (mit viel Arbeit von Jody",
"Fletcher) getan haben, ist die 80-Zeilen Karten der RSIC in sequenzieller",
"Ordnung nach Atommasse und Ordnungszahl zu nehmen und daraus eine",
"alphabetisch geordnete Sequenz und (direktzugriff) Dateien erzeugt,",
"die unmittelbar vom IBM-PC kompatible Mikrocomputer gelesen werden können,",
"sowie ein Programm um diese Daten unter einer benutzerfreundlichen Umgebung",
"sichtbar zu machen." " ",
"True Basic Programmierer können ihre eigenen Programme schreiben, um auf die",
"Daten zuzugreifen nach den folgenden Spezifikationen. Es könnte auch mit",
"anderen Sprachen funktionieren, jedoch haben wir das nicht versucht. Wir",
"haben True Basic gewählt, weil:"," ",
"     - Es unterstützt automatisch den mathematischen Koprozessor.",
"     - Alle Zahlen und Rechenoperationen sind doppelt genau; dadurch",
"       werden Rundungsfehler vermieden (siehe unten).",
"     - Die NUM$ Funktion konvertiert Zahlen auf das IEEE acht Byte",
"       Format.  Die acht Bytes enthalten ein Vorzeichenbit, ein 11 Bit",
"       Exponent und eine 52 Bit Mantisse. Das bedeutet, daß Zahlen zwischen",
"       1e-307 und 1e+307 (ungefähr) mit 15 signifikanten Ziffern dargestellt",
"       werden können. Vergleichen Sie den Quelltext bezüglich der Benutzung",
"       der NUM Funktion.",
"     - Die strukturierte Natur von True Basic, wodurch das Programm für",
"       andere leicht verständlich ist um Teile davon für eigene Anwendungen",
"       zu benutzen.",
"     - True Basic wird automatisch kompiliert. (Es läuft nicht in einem",
"       interpretierten Modus.)",
"     - Der kompilierte Code kann ohne Schwierigkeiten zu einem ausführbarem",
"       Programm gebunden werden.",
"     - True Basic soll portierbar zwischen verschiedenen Systemen sein;",
"       jedoch haben wir das noch nicht versucht." ," "," ",
"2. RADDECAY DATEIEN - SYSTEM DISKETTE"," ",
"RADDECAY.EXE - Der kompilierte und gebundene ausführbare Code. Es wurde",
"durch das True Basic Bind (d.h. Linker) Programm erzeugt sowie die",
"Runtime-library, die Grove Engineering in Lizenz von True Basic, Inc besitzt.",
" ","*.TRU - True Basic Quelldateien können vorhanden sein. Diese Dateien",
"sind nicht notwendig um RADDECAY auszuführen. True Basic Quelldateien",
"sind im ASCII Format und können mit dem DOS PRINT oder TYPE Befehl",
"angesehen werden. Wenn Sie die True Basic Sprache besitzen, können Sie",
"diese Dateien unter dem True Basic Editor ansehen. Jedes andere",
"Textverarbeitungsprogramm dürfte in der Lage sein die Dateien anzeigen",
"zu können."," ",
"3. RADDECAY DATEN DISKETTE",
"Die Daten- (direktzugriff) Dateien enthalten alle Daten. Das Format der",
"Dateien kann aus den Quelldateien auf der Systemdiskette entnommen werden",
"und ist auch unten aufgeführt. Die sieben Datendateien und ihr Format sind:"," ",
"NUCLIDES.REC - Enthält 497 Datensätze, die den alphabetisch geordneten",
"Radionukliden entsprechen. Jeder Datensatz enthält einparameterige",
"Information über den Nuklid, Pointerinformation über die Zerfallsprodukte",
"in den übrigen Dateien und die Anzahl Einträge für jede Zerfallsart. Jeder",
"Datensatz enthält 41 Byte, die von links nach rechts hintereinander",
"geschrieben sind in 324 Bit; d.h. die Information steht in 40 Byte und",
"2 Bit. Diese Zusammenfügung war notwendig damit alle Dateien auf einer",
"Diskette paßt. Die Parameter, die in jedem Datensatz enthalten sind, lauten",
"von links nach rechts wie folgt:"," ",
"Beginn   Byte   Beginn Bit",
"Byte     Länge  Bit    Länge  Beschreibung des Parameters(Format)"," ",
"  1        8                  Nuklid Name (ASCII)",
"  9        8                  Atommasse (IEEE)",
" 17        1     129      8   Ordnungszahl (Binärfeld, rechtsbündig)",
" 18        8                  Halbwertszeit (IEEE)",
" 26        1                  Einheit der Halbwertszeit (ASCII) (S = Sekunden,",
"                              M = Minuten, H = Stunden, D = Tage, Y = Jahre)",
" ",
"Das Format aller restlichen Zahlen im Datensatz ist ein Binärfeld,",
"rechtsbündig innerhalb des Binärfeldes. Alle Zahlen und Pointer gehören",
"zum Nuklid, das im ersten Feld oben genannt wurde."," ","    Beginn    Nr.",
"     Bit     Bits      Beschreibung des Parameters"," ",
"     209       2       Anzahl der Töchter in der Datei PROGENY.REC",
"     211       9       Nr. des Datensatzes der ersten Tochter in PROGENY.REC",
"     220       7       Anzahl der Alphaeinträge in ALPHA.REC",
"     227      13       Nr. des Datensatzes des ersten alpha in ALPHA.REC",
"     240       8       Anzahl der Betaeinträge in BETA.REC",
"     248      13       Nr. des Datensatzes des ersten beta in BETA.REC",
"     261       8       Anzahl der Positroneneinträge in POSITRON.REC",
"     269      13       Nr. des Datensatzes des ersten positrons in POSITRON.REC",
"     282       8       Anzahl der Elektroneneinträge in ELECTRON.REC",
"     290      13       Nr. des Datensatzes des ersten electrons in ELECTRON.REC",
"     303       8       Anzahl der Photoneneinträge in PHOTON.REC",
"     311      13       Nr. des Datensatzes des ersten photons in PHOTON.REC"," ",
"Um die Werte aus dem Bitfeld zu bekommen, benötigen Sie die True Basic NUM",
"Funktion, die ein acht Byte IEEE Format Wert in eine Zahl umwandelt sowie",
"die UNPACKB Funktion, die ein angegebenes Bitfeld in eine Integerzahl",
"umwandelt."," ",
"Die Anzahl der Datensätze in den übrigen Dateien sind:",
"                  Anzahl der      Länge des Datensatzes",
"                  Datensätze            (Byte)",
"PROGENY.REC          291                  16",
"ALPHA.REC            360                  16",
"BETA.REC            1700                  24",
"POSITRON.REC         138                  24",
"ELECTRON.REC        3882                  16",
"PHOTON.REC          7480                  16"," ",
"Alle Werte sind im IEEE Format und können mit Hilfe der True Basic NUM",
"Funktion umgewandelt werden."," ",
"Die vier Dateien PROGENY.REC, ALPHA.REC, ELECTRON.REC, und PHOTON.REC besitzen",
"Datensätze, die eine Länge von 16 Byte haben und in denen zwei Werte",
"gespeichert sind."," ",
"In jedem Datensatz der Datei PROGENY.REC ist der erste Wert der Index der",
"Tochter dieses Nuklids, d.h. die Nummer des Datensatzes in der Datei",
"NUCLIDES.REC und der zweite Wert ist das Verzweigungsverhältnis (d.h.",
"der Teil der auf diese Weise zerfällt) des Nuklids."," ",
"In jedem Datensatz der drei Dateien ALPHA.REC, ELECTRON.REC und PHOTON.REC",
"ist der erste Wert die Energie des Zerfallsproduktes und der zweite Wert",
"ist die Zerfallswahrscheinlichkeit. Photonen ist ein Sammelbegriff für",
"Gamma- und Röntgenstrahlen."," ",
"Die beiden Dateien BETA.REC und POSITRON.REC haben Datensätze, die aus 24",
"Byte bestehen, in denen 3 Werte enthalten sind. Der erste Wert ist die",
"maximale Energie der Zerfallsprodukte, der zweite Wert ist die mittlere",
"Energie und der dritte Wert ist die Zerfallswahrscheinlichkeit."," ",
"4. ANDERE DATEIEN",
"RADDECAY.DAT - Eine Datei, die Parameter enthält um die Farben einzustellen",
"und für die Angabe des Pfadnamens für die .REC Dateien. Der Zweck dieser",
"Datei ist die automatische Konfigurierung ohne bei jedem Aufruf sie neu",
"einstellen zu müssen. Die Parameter in dieser Datei sind die Pfadangabe,",
"die Vordergrundfarbe und die Hintergrundfarbe. Wenn diese Datei bei",
"Programmstart nicht vorhanden ist, wird sie mit den voreingestellten Werten",
"erzeugt."," ",
"RADDECAY verwendet andere Quelldatei-libraries beim kompilieren und binden",
"(d.h. linken). Diese libraries sind Eigentum von Grove Engineering, Inc.",
"oder True Basic, Inc und können unter Lizenz dort bezogen werden."," ",
"            ***** Zurück zum Hauptmenü mit [Esc] *****",""};
#endif

void *TransBase,*IEEEBase;

struct IntuiText OK =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        5,5,                           /* leftedge, topedge */
        NULL,                          /* TextAttr */
        (UBYTE *)"OK",                 /* IText */
        NULL,                          /* NextText */
};


struct IntuiText noTrans =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        10,10,                         /* leftedge, topedge */
        NULL,                          /* TextAttr */
#ifdef ENGLISH
        (UBYTE *)"Can't find mathtrans.library",   /* IText */
#endif
#ifdef GERMAN
        (UBYTE *)"Finde nicht mathtrans.library",   /* IText */
#endif
        NULL,                          /* NextText */
};

struct IntuiText noIEEE =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        10,10,                         /* leftedge, topedge */
        NULL,                          /* TextAttr */
#ifdef ENGLISH
        (UBYTE *)"Can't find mathieeedoubtrans",   /* IText */
#endif
#ifdef GERMAN
        (UBYTE *)"Finde nicht mathieeedoubtrans",   /* IText */
#endif
        NULL,                          /* NextText */
};

main()
{  USHORT code;

 defcol();
 strcpy(def.recpath,":RadDecay/rec");
 if (!(GfxBase = OpenLibrary("graphics.library",0L))) quit(1);
 if (!(IntuitionBase = OpenLibrary("intuition.library",0L))) quit(1);
 if (!(TransBase = OpenLibrary("mathtrans.library",0L)))
     {  AutoRequest(w,&noTrans,&OK,&OK,0L,0L,319L,72L);
        quit(1);
     }

 if (!(IEEEBase = OpenLibrary("mathieeedoubtrans.library",0L)))
     {  AutoRequest(w,&noIEEE,&OK,&OK,0L,0L,319L,72L);
        quit(1);
     }

 if (!(w = OpenWindow(&nw)))
   {  nw.Height=200;
      if (!(w = OpenWindow(&nw))) quit(1);
   }
 SetMenuStrip(w, &menu);

 rp = w->RPort;

 Get_config();
 SetAPen(rp,def.colour[1]);
 SetBPen(rp,def.colour[0]);
 Welcome();

 FOREVER
    {  if (message = GetMsg(w->UserPort))
          { MessageClass = message->Class;
            code = message->Code;
            ReplyMsg(message);
            switch (MessageClass)
               {   case MENUPICK:     switch (code&0xff)
                                         { case 0x20: decay();
                                                      break;
                                           case 0x40: display(gtext);
                                                      break;
                                           case 0x60: display(files);
                                                      break;
                                           case 0x80: coldefs();
                                                      break;
                                           case 0xa0: quit(0);
                                         }
                                      break;
                   case RAWKEY:       if (code==0x45)  /* Escape */
                                         {  defcol();
                                            coldefs();
                                         }
                                      break;
                   case CLOSEWINDOW : quit(0);
               }
          }
    }
}


quit(i)
int i;
{ if (w) CloseWindow(w);
  if (TransBase) CloseLibrary(TransBase);
  if (IEEEBase) CloseLibrary(IEEEBase);
  if (GfxBase) CloseLibrary(GfxBase);
  if (IntuitionBase) CloseLibrary(IntuitionBase);
  exit(i);
}

page(s)
char *s[];
{ long j;

  cls();
  SetAPen(rp,def.colour[1]);
  j=20;
  do
    { Move(rp,5L,j);
      if (!strlen(s[line])) break;
      Text(rp,s[line],(long)strlen(s[line]));
      line++;
      j += 8;
    }
  while (j+8<nw.Height);
}

struct IntuiText tret =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        1,1,                           /* leftedge, topedge */
        NULL,                          /* TextAttr */
#ifdef ENGLISH
        (UBYTE *)"Return to main menu",   /* IText */
#endif
#ifdef GERMAN
        (UBYTE *)"Zurück zum Hauptmenü",   /* IText */
#endif
        NULL,                          /* NextText */
};

struct MenuItem ret =
{       (struct MenuItem *) NULL,
        0,30,                               /* LeftEdge, TopEdge */
        200,10,                             /* Width, Height */
        ITEMTEXT | HIGHCOMP | ITEMENABLED,  /* Flags */
        0,                                  /* Mutual Exclude */
        (APTR)&tret,                        /* ItemFill */
        NULL,                               /* SelectFill */
        0,                                  /* Command    */
        NULL,                               /* Subitem */
        0,                                  /* NextSelect */
};


struct IntuiText tback =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        1,1,                           /* leftedge, topedge */
        NULL,                          /* TextAttr */
#ifdef ENGLISH
        (UBYTE *)"Page backwards",     /* IText */
#endif
#ifdef GERMAN
        (UBYTE *)"Seite zurück",     /* IText */
#endif
        NULL,                          /* NextText */
};

struct MenuItem backwards =
{       (struct MenuItem *) &ret,
        0,20,                               /* LeftEdge, TopEdge */
        200,10,                             /* Width, Height */
        ITEMTEXT | HIGHCOMP | ITEMENABLED,  /* Flags */
        0,                                  /* Mutual Exclude */
        (APTR)&tback,                       /* ItemFill */
        NULL,                               /* SelectFill */
        0,                                  /* Command    */
        NULL,                               /* Subitem */
        0,                                  /* NextSelect */
};


struct IntuiText tforw =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        1,1,                           /* leftedge, topedge */
        NULL,                          /* TextAttr */
#ifdef ENGLISH
        (UBYTE *)"Page forwards",      /* IText */
#endif
#ifdef GERMAN
        (UBYTE *)"Seite vorwärts",      /* IText */
#endif
        NULL,                          /* NextText */
};

struct MenuItem forward =
{       (struct MenuItem *) &backwards,
        0,10,                               /* LeftEdge, TopEdge */
        200,10,                             /* Width, Height */
        ITEMTEXT | HIGHCOMP | ITEMENABLED,  /* Flags */
        0,                                  /* Mutual Exclude */
        (APTR)&tforw,                       /* ItemFill */
        NULL,                               /* SelectFill */
        0,                                  /* Command    */
        NULL,                               /* Subitem */
        0,                                  /* NextSelect */
};

struct IntuiText tnoth =
{       0,1,                           /* frontpen, backpen */
        JAM1,                          /* drawmode */
        1,1,                           /* leftedge, topedge */
        NULL,                          /* TextAttr */
        (UBYTE *)"",                   /* IText */
        NULL,                          /* NextText */
};


struct MenuItem noth =
{       (struct MenuItem *) &forward,
        0,0,                               /* LeftEdge, TopEdge */
        200,10,                             /* Width, Height */
        ITEMTEXT | HIGHCOMP | ITEMENABLED,  /* Flags */
        0,                                  /* Mutual Exclude */
        (APTR)&tnoth,                        /* ItemFill */
        NULL,                               /* SelectFill */
        0,                                  /* Command    */
        NULL,                               /* Subitem */
        0,                                  /* NextSelect */
};

struct Menu menu1 =
{       (struct Menu *) NULL,        /* NEXT menu */
        0, 0, 200, 0,                /* LeftEdge, TopEdge, Width, Height */
        MENUENABLED,                 /* Flags */
#ifdef ENGLISH
        (BYTE *) "RADDECAY display menu", /* MenuName */
#endif
#ifdef GERMAN
        (BYTE *) "RADDECAY Hauptmenü", /* MenuName */
#endif
        (struct MenuItem *)&noth,    /* First item */
        0,0,0,0,                     /* JazzX,JazzY, BeatX, BeatY */
        };

/* return to main menu */

retmen()
{  cls();
   SetMenuStrip(w, &menu);
   line=0;
   SetAPen(rp,def.colour[3]);
   Move(rp,100L,100L);
#ifdef ENGLISH
   Text(rp,"PLEASE SELECT FROM MENU",23L);
#endif
#ifdef GERMAN
   Text(rp,"BITTE VOM MENÜ WÄHLEN",21L);
#endif
}

/* display a text */

display(s)
char *s[];
{  USHORT code;
   int leave,plen;
   long j;

   ClearMenuStrip(w);
   SetMenuStrip(w, &menu1);
   page(s);
   leave=0;
   plen=(nw.Height-30)/8;
   while (!leave)
    {  if (message = GetMsg(w->UserPort))
          { MessageClass = message->Class;
            code = message->Code;
            ReplyMsg(message);
            switch (MessageClass)
               {   case MENUPICK:     switch (code&0xff)
                                         { case 0x20: if (strlen(s[line])) page(s);
                                                      break;
                                           case 0x40: j=line-2*plen;
                                                      if (j>=0)
                                                         {  line=j;
                                                            page(s);
                                                         }
                                                      else if (line>0)
                                                              { line=0;
                                                                page(s);
                                                              }
                                                      break;
                                           case 0x60: leave=1;
                                                      break;
                                         }
                                      break;
                   case RAWKEY:       switch(code)
                                         { case 0x40:
                                           case 0x1f: if (strlen(s[line])) page(s);
                                                      break;    /* page down */
                                           case 0x41:
                                           case 0x3f: j=line-2*plen;
                                                      if (j>=0)
                                                         {  line=j;
                                                            page(s);
                                                         }
                                                      else if (line>0)
                                                              { line=0;
                                                                page(s);
                                                              }
                                                      break;    /* page up */
                                           case 0x45: leave=1;  /* Escape */
                                                      break;
                                         }
                                      break;
                   case CLOSEWINDOW : leave=1;
                                      break;
               }
          }
    }
   retmen();
   line=0;
}

#asm
SPFieee     equ -$6c
IEEEDPTieee equ -$66
            XREF _GetIeee

_GetIeee   link    a5,#0
           move.l  a6,-(a7)
           lea     _Buf,a0
           move.w  8(a5),d0
           add.w   d0,a0
           move.b  (a0)+,d0
           lsl.l   #8,d0
           move.b  (a0)+,d0
           lsl.l   #8,d0
           move.b  (a0)+,d0
           lsl.l   #8,d0
           move.b  (a0)+,d0
           move.b  (a0)+,d1
           lsl.l   #8,d1
           move.b  (a0)+,d1
           lsl.l   #8,d1
           move.b  (a0)+,d1
           lsl.l   #8,d1
           move.b  (a0)+,d1
           movea.l _IEEEBase,a6
           jsr     IEEEDPTieee(a6)
           movea.l _TransBase,a6
           jsr     SPFieee(a6)
           move.l  (a7)+,a6
           unlk    a5
           rts
#endasm


