Path: wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!xanth!cs.odu.edu!Amiga-Request
From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
Newsgroups: comp.sources.amiga
Subject: v90i148: MemMometer 2.1 - memory fragmentation gauge, Part01/02
Message-ID: <12220@xanth.cs.odu.edu>
Date: 15 Apr 90 14:50:17 GMT
Sender: tadguy@cs.odu.edu
Reply-To: hull@hao.ucar.edu (Howard Hull)
Lines: 1226
Approved: tadguy@cs.odu.edu (Tad Guy)
X-Mail-Submissions-To: Amiga@cs.odu.edu
X-Post-Discussions-To: comp.sys.amiga

Submitted-by: hull@hao.ucar.edu (Howard Hull)
Posting-number: Volume 90, Issue 148
Archive-name: util/memmometer-2.1/part01

Mem Mometer - a memory fragmentation and modification detector gauge inspired
by Tom Rokicki's WFrags and Peter DaSilva's Gauge program (Fred Fish #111)
Following is an extract from the ReadMe file which details the history.

V2.1 - Some changes to the 8 color workbench color table to improve the
ability to recognize 0xffffffff checksums and to better conform with CBM
Workbench colors, and some corrections to inaccuracies in the documentation.
Because it was possible to reach the forbidden processor read-toggle type
addresses through selecting severely maligned Fast memory base values, a
call to a requester which asks, Do-you-really-want-to-risk-doing-this???
was inserted for the Fast memory base Warps menu as well as the Slow-Fast
memory Warps menus.  The requester was also fixed to open with a link to
the MemMometer window (titled "F") rather than to an underlying dummy req
window (titled "Mem Mometer").  While it renders the title a trifle obscure,
it limits the resource request to one requester-sized window rather than two.

#!/bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 2)."
# Contents:  ReadMe makefile mm.doc mm.h mminit.c
# Wrapped by tadguy@xanth on Sun Apr 15 10:49:55 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'ReadMe' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ReadMe'\"
else
echo shar: Extracting \"'ReadMe'\" \(2542 characters\)
sed "s/^X//" >'ReadMe' <<'END_OF_FILE'
XThis is MemMometer V2.1
XPrevious versions of MemMometer were
X    V1.0 - Distributed to Peter Da Silva and Tom Rokicki, sent to Fred Fish
X           but was evidently not put on a Fish Disk.  Problems with this
X           version of the program were that it used the Delay(Arrgh) function
X           for timing, and that it had an unrestricted menu selection for
X           Slow-Fast memory and Fast memory base that, with non-existent
X           memory, would result in a crash without prior warning. Also, the
X           codes for one, two, or three columns were separate, so it was
X           issued as three independently compiled programs.
X    V1.1 - Not Distributed.  Delay() function replaced by VBLANK timer code
X           that was earlier submitted to Usenet by Andy Finkel.  (Although
X           Andy is a member of the CBM Amiga programmer team, the use of
X           his codes in MemMometer do not in any way constitute an approval
X           of the program on his part, of course.)
X    V2.0 - Not Distributed.  A Menu item was added for setting MemMometer's
X           running priority.  A Requester was  added to inform the user that
X           Slow-Fast memory selections in Warps mode must be physically
X           correct to avoid a system-fatal Guru 4 illegal instruction
X           exception trap (or worse), see the documentation for details.
X    V2.1 - Some changes to the 8 color workbench color table to improve the
X           ability to recognize 0xffffffff checksums and to better conform
X           with CBM Workbench colors, and some corrections to inaccuracies
X           in the documentation.  Because it was possible to reach the (ahem)
X           forbidden processor read-toggle type addresses through selecting
X           severely maligned Fast memory base values, a call to the requester
X           was additionally inserted for the Fast memory base menu.  The
X           requester was also fixed to open with a link to the MemMometer
X           window (titled "F") rather than to an underlying dummy window
X           (titled "Mem Mometer").  While it renders the title a trifle
X           obscure, it limits the resource request to one requester-sized
X           window rather than two.
X
XFiles included in this package with names like whatever_info are icons;
Xthey can be pressed into service wherever needed by substituting point
Xfor underbar in the file name.
X
X                                                        Howard Hull
X                                                        hull@ncar.ucar.edu
X
END_OF_FILE
if test 2542 -ne `wc -c <'ReadMe'`; then
    echo shar: \"'ReadMe'\" unpacked with wrong size!
fi
# end of 'ReadMe'
fi
if test -f 'makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'makefile'\"
else
echo shar: Extracting \"'makefile'\" \(119 characters\)
sed "s/^X//" >'makefile' <<'END_OF_FILE'
XMM: mm.o mminit.o
X    ln mm.o mminit.o -lc -o MM
X
Xmm.o: mm.h mm.c
X    cc mm.c
X
Xmminit.o: mm.h mminit.c
X    cc mminit.c
END_OF_FILE
if test 119 -ne `wc -c <'makefile'`; then
    echo shar: \"'makefile'\" unpacked with wrong size!
fi
# end of 'makefile'
fi
if test -f 'mm.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mm.doc'\"
else
echo shar: Extracting \"'mm.doc'\" \(20567 characters\)
sed "s/^X//" >'mm.doc' <<'END_OF_FILE'
X/*
X *   Information for MM Version 2.10, 24-Mar-1990
X *
X *   MemMometer - A program hacked from Tom Rokicki's WFrags more or less...
X *   (in fact, a heck of a lot) in the style of Peter Da Silva's "Gauge."
X *   The program opens a narrow window with the same dimensions as the
X *   disk capacity gadget found in the top-level workbench window for
X *   a floppy volume.  The sizing gadget is like the one in Gauge; to
X *   resize the window, just click the left mouse button over the "E".
X *   The "F" is the program title in this rather short manifestation of
X *   an Amiga Intuition window drag bar.
X *
X *   My bin copy of Gauge broke when I put a Michigan Insider in my A1000.
X *   I did not have source for the Gauge program, so I conjured this one.
X *   To my chagrin, MM 1.0 broke when I got a 2000 (more on that shortly),
X *   so I can hardly wait to see what the 3000 does to this version...
X *   Changes with this version include a Priority menu item, automatic
X *   column configuration of from one to three columns, compatibility
X *   with the eight-color workbench, and timing via VBLANK signals from
X *   the timer.device, replacing the notorious Delay(arrrgh) function
X *   suspected to be linked with the treacherous floppy disk track 40
X *   wipeout syndrome.  With the 2.10 version, the colors have been set
X *   to more closely conform with the CBM workbench colors, the warps
X *   recognition algorithm has been modified to detect a bitwise logical
X *   true condition (0xffffffff) in addition to the usual bitwise and
X *   otherwise logical false condition (0x00000000), and the titled crash
X *   warning requester has been simplified at the expense of getting just
X *   the title "F", but with the gain of not having the dummy window under
X *   the requester.
X *   
X *   MemMometer may be started from an icon, a CLI, or the Run command
X *   from a CLI.  MM uses dynamic allocation for its display data, and
X *   does its own resource tracking.  MM will surrender any resources
X *   which it has successfully obtained from allocation requests if,
X *   while MM is running, requested resources are denied.  This type
X *   of fault (exit code 20) proceeds silently, and without prior notice.
X *
X *   Now for a run through MemMometer's menu mechanics.  MemMometer opens
X *   with a non-interlaced-screen-height narrow window at the left side of
X *   the Workbench screen.  The window width is the same as the width of the
X *   capacity gauge which Workbench renders at the left side of the top
X *   level window for a floppy volume.  As with Peter Da Silva's gauge, the
X *   MemMometer has an E at the bottom of the window, and an F at the top.
X *   The E and the F are respectively, the window sizing gadget, and the
X *   window titlebar.  New this version, the sizing gadget color identifies
X *   the program MODE, and the title color reveals the selected memory
X *   configuration.  While MemMometer can and does automatically arrange
X *   the window to suit the memory configuration, it depends on the user to
X *   select appropriate memory size and address values via the menus.  The
X *   menu style is the usual Amiga Intuition menu set; selection is achieved
X *   by clicking the left mouse button while the mouse pointer is anywhere
X *   within the program's window boundary, and then activating the menu bar
X *   by holding down the right mouse button and sliding the mouse pointer
X *   along the Workbench screen title bar at the top of the Workbench screen.
X *
X *   At the left side of the Workbench screen title is the Project Menu.  The
X *   Project Menu has three options.  The first option is "Front", which is a
X *   window-to-front command for the event that the MM window was partially
X *   buried by the opening of new windows after MM was invoked.   If the
X *   right mouse button is released while the mouse pointer is directly over
X *   the Front menu item, the MM window will oblige by popping forward to an
X *   unobstructed view.  The second menu option is the "Back" item, which
X *   will move the MM window back behind any other windows that have been
X *   opened on the Workbench screen (with exception of a backdrop window).
X *   The third Project menu option is the "Quit" option, which directs MM to
X *   close its window and release the AmigaDOS resources MM has allocated.
X *   The normal return code is zero.
X *
X *   The second Intuition menu is the Setup menu.  There are two Setup menu
X *   items.  The first item is the "Mode" item.  MM has two modes, and they
X *   are selected by sliding the mouse pointer straight down from the screen
X *   title bar over the Mode item , and then moving the pointer to the right
X *   as the mode submenu is activated.  The activated submenu provides two
X *   choices, "Frags" and "Warps".  Frags are rather much the same as they
X *   were in Da Silva's gauge program.  "Frags" is the default menu selection
X *   with which MM is first initialized.  The Frags display is described in
X *   the following table:
X *   
X *               2-Color Workbench    4-Color Workbench    8-Color Workbench
X *  Unallocated        Blue                 Black                Black
X *  Allocated          White                Orange               Yellow
X *  Fragmented         Blue                 Blue                 Blue 
X *
X *   Unallocated memory is free memory available to programs.  The programs
X *   may obtain this memory from AmigaDOS through allocation requests.  The
X *   Allocated memory is memory assigned to programs running under AmigaDOS.
X *   Fragmented memory consists of interleaved small memhunks, some of which
X *   are assigned to programs and some of which are in the free memory pool.
X *   The smallest fragments are 8 bytes, and the largest memhunks may be more
X *   than a megabyte.  The fragmented class is assigned when, in making the
X *   MM window display, a single horizontal pixel line was found to represent
X *   both allocated and unallocated memhunks.  For this reason, for a full
X *   window height MemMometer, the resolution of the fragmentation is shown
X *   in more detail on interlaced Amiga Workbench screens.
X *
X *   The second mode item selection is the "Warps" mode.  While the Frags
X *   mode is usually utilized as a low-priority background indicator, the
X *   Warps mode is usually utilized at a somewhat higher priority for the
X *   purpose of tracking bugs and system irregularities.  In this context,
X *   I define warps as a form of discretized sample-to-sample differencing
X *   function for some arbitrary segment of memory.  Warps are determined by
X *   dividing the selected address space evenly among the MemMometer display
X *   pixels, computing an assignment checkfunction for each pixel line of the
X *   display on the associated assigned memory space at some sample time, and
X *   then, while retaining the previous pixel-by-pixel record, repeating the
X *   same evaluation the second sample time and comparing the sequentially
X *   determined checksums. A "checksum" is computed by means of a sequential
X *   bit-wise eXclusive OR assignment.  This type of checksum can readily
X *   detect zeroed or changed values.  In the table below, logical FALSE is
X *   zero, logical TRUE is taken as 0xffffffff and VALUE is anything else.
X *   Colors indicate the type of change.  Colors for the most part follow
X *   the standard CBM workbench color set, shown as follows:
X *   
X *                    Pen #   Color           Pen #   Color
X *                      0     Blue              4     Green
X *                      1     White             5     Red
X *                      2     Black             6     Cyan
X *                      3     Orange            7     Yellow
X *
X *   These colors are used to map the changes in memory content from sample
X *   to sample as programs multitask together:
X *
X *   Condition        2-Color Workbench  4-Color Workbench  8-Color Workbench
X *
X *   VALUE ===> VALUE         Blue               Blue               Blue
X *   VALUE =/=> VALUE         White              Orange             Orange
X *   FALSE ===> FALSE         Blue               Black              Black
X *   FALSE ---> VALUE         White              Orange             Yellow
X *   VALUE ---> FALSE         White              White              Red
X *   TRUE  ---> FALSE         Blue               Black              Cyan 
X *   TRUE  ---> VALUE         Blue               Black              Cyan 
X *   TRUE  ===> TRUE          Blue               Blue               Green
X *   FALSE ---> TRUE          Blue               Blue               Green
X *   VALUE ---> TRUE          Blue               Blue               Green
X *
X *   The second Setup menu item is a Frequency selection submenu.  While the
X *   selected value does set a minimum frequency with which the memory state
X *   will be examined, it's done by introducing a delay between measurements.
X *   The introduced delay will be equal in seconds to the value selected in
X *   the submenu.  The delay is accomplished by the AmigaDOS timer.device
X *   using the VBLANK mode.  It was not thought worth the difficulty to make
X *   the timing as precise as would be possible using the cia.resource, as
X *   that might make the resource less useful to other programs, and as well
X *   would mean extra effort adjusting for memory size-dependent scan times
X *   from the various memory sizes selectable with the MM program.  Delay
X *   intervals of 1, 2, 5, and 10 seconds are available.
X *
X *   The third Intuition menu is a Priority menu.  This menu applies only to
X *   the MemMometer program and its associated CLI process.  Initially it is
X *   at priority 0 with the expectation that the user will set it lower once
X *   the program is running, in order to give more time to the other active
X *   processes the user will be running.  A value of -50 is recommended.  In
X *   the event the Priority of MM is changed via the menu, the CLI inherits
X *   MemMometer's new priority and retains that priority even after MM quits.
X *   Thus, with extreme priority settings, it may be better to "Run MM" to
X *   keep from passing the extreme priority to subsequent processes spawned
X *   from the CLI that was used to invoke MemMometer.  Also, go easy with the
X *   positive priorities; remember that with AmigaDOS version 1.3 the DOS
X *   input.device runs priority 20, FileSystem is priority 10, and the CON:
X *   and trackdisk.device are priority 5 usually.  The first three menu items
X *   are used to increment or decrement a selected priority.  Selection of
X *   the "NORM" menu item removes any increment or decrement setting.
X *
X *   The remaining Intuition menu selections are provided so that the range
X *   and base address of the memory examined may be adjusted for the user's
X *   Amiga memory configuration.  Note that the base address must always be
X *   set to the correct base address for the given memory configuration, but
X *   that the range may be adjusted to give a better resolution for the first
X *   segments above the base address, if desired.  Menus are provided for
X *   Chip memory, Slow-Fast (C00000/Ranger) memory, and Fast memory.  While I
X *   have had no difficulty as a result of selecting a range of memory that
X *   involved a non-existent seqment for Chip or Fast memory, when I selected
X *   non-existent SFMemory on my Fat Agnus Amiga 2000, it resulted in a total
X *   system-wide big red Guru 4 (illegal instruction exception).
X *
X *   After that, I decided to post a requester for the user that issues a
X *   terse a warning that a crash is _possible_ with incorrectly specified
X *   Slow-Fast (non-existent) memory.  Since it is possible to access this
X *   forbidden zone through inappropriate settings of the Fast Mem base, MM
X *   also calls the requester if the Fast Mem base is changed. The requester
X *   displays the message:
X *
X *                        WARNING! CRASH POSSIBLE
X *                      MENU MEMORY SELECTIONS MUST
X *                       REFERENCE EXISTING MEMORY
X *
X *                   Risk It                  Retreat
X *
X *   You don't have to worry about a crash if you really have an amount of
X *   Slow-Fast memory equal or greater than the amount you specified in the
X *   menu selection, and the base address is what you specified (the default
X *   base address is C00000).  I'm sorry to have to do this, but I don't want
X *   to put in code that monkeys with AmigaDOS's handling of the exception
X *   vectors.  I feel justified, though, since my code does not change with
X *   the type of memory segment examined; AmigaDOS evidently does have code
X *   that handles the exceptions properly for the other memory segments.
X *   So, here you see the two options.  The left button says - Risk It - a
X *   comfortable gamble if you know your Slow-Fast memory configuration.
X *   Pre Fat-Agnus Amiga 2000 machines have 512K of Slow-Fast memory.  Newer
X *   Amiga 2000 machines have no Slow Fast memory - so beware of this and try
X *   it when you have nothing else going on.  The - Retreat - option sets
X *   the SFMemory Size internal to the MemMometer program to zero and clears
X *   the display.  (It does leave the menu items checked, though, so you will
X *   have to remember to re-select suitable menu values in order to get the
X *   display to show something in each existing memory type.  For Chip and
X *   Fast memory this will simply entail going back into the menu and again
X *   selecting whatever was previously checked.  The Slow-Fast memory size
X *   should then be set either to appropriate values or to "NONE".)
X *   
X *   Note that in the display there may at any time be anywhere from one
X *   to three MemMometers - for Chip (left-hand column), another for the
X *   Slow Fast mem (center column) and yet another for Fast mem (right-hand
X *   column).  These MemMometers can be turned on or off as desired by
X *   selecting "NONE" or the various items in the Size menus.
X *
X *   Parts of several freely distributable  programs have been used to make
X *   MemMometer.  Menus, for instance, are done in the style VT100 (Wecker,
X *   et al).  As with the VT100 program, MemMometer has preset variables.
X *   However, the program does not yet contain a script file reader or an
X *   AREXX interface with which to automatically set the variables.  Likely
X *   it is that I'll write the code for that some time this century!
X *
X *   MemMometer uses forbid() and permit() when it examines the mem list in
X *   Frags mode.  I suppose it is possible with large amounts of memory to
X *   scan, that some gross treachery can happen while the list is locked.
X *   However, with my 3 meg Amiga 2000 I've not seen it.  It takes a while
X *   after startup to settle out and display the large byte counts associated
X *   with Fast mem, so be patient...  MemMometer is most useful for finding
X *   out why large programs won't load.  It's also useful in development for
X *   seeing the impact your application is having on memory fragmentation.
X *   The Warps mode displays any change it sees in memory from one sample
X *   to the next; BUT this mode only works sensibly when JUST ONE memory size
X *   selection is active (set others to "NONE").  The memory space is scanned
X *   asynchronously, so it can have sample alias difficulties.  However, the
X *   Warps mode does not use forbid(), permit(), enable(), disable(), or any
X *   other constrictive system call.  I just does a lot of read-only memory
X *   cycles and writes the result in its own dynamically allocated memory
X *   space.
X *
X *   To run MemMometer, simply type
X *
X *      run MM
X *
X *      or  click on the icon.
X *
X *   Then open the menu item selections and set them for your configuration.
X *   Frags mode, and 512K of CHIP @0, 0 Meg of Fast mem @ 200000, 0 Meg of
X *   SF mem @ @C00000 are the defaults.  The modes selected are color coded
X *   into the "F" and "E" indicators:
X *
X *   Mode       Indicator       2 color WB      4 Color WB      8 Color WB
X *
X *   Frags          E                Blue            Blue            Blue
X *   Warps          E                White           Orange          Yellow
X *
X *   One column:
X *   Chip           F                Blue            Blue            Blue  
X *   Slow-Fast      F                Blue            Black           Cyan
X *   Fast           F                White           Orange          Yellow
X *
X *   Two columns:
X *   Chip +SF       F                Blue            Blue            Blue
X *   Chip +Fast     F                Blue            Black           Cyan
X *   SF + Fast      F                White           Orange          Yellow
X *
X *   Three columns:
X *   C + SF + Fast  F                Blue            Blue            Blue
X *   None           F                White           Orange          Orange
X *
X *   The source code included with this distribution was compiled with the
X *   Manx Aztec C compiler, version 3.6a in 16-bit integer mode.  Numerous
X *   type casts in the code, as well as other non-alignments with the Lattice
X *   environment would make compilation under versions of Lattice difficult.
X *   Sorry.  Compilation instructions are of course in the makefile included
X *   in the distribution.
X *
X *   About my part of C code - it wasn't done for speed, as I am sure you can
X *   tell.  If I wanted speed I would have used assembly language.  It also
X *   likely isn't elegant code, by a long shot (unless it's the part I got
X *   from Rokicki's WFrags).  But assembly language is time-consuming to
X *   write, so that won't happen any time soon.  Maybe the next thing will be
X *   the AREXX port - so that other programs can specify a low address and a
X *   byte count range for one of the MemMometers to display (say, within the
X *   specified menu selection span).  Gross comments about the code or bug
X *   reports may be e-mailed to me at the site domain specified below.
X *
X *   About everyone else's C code in MM - Let's see, VT100 (Wecker et al) has
X *   been freely distributable since the early days of the Amiga.  When VT100
X *   was first posted, Wecker did not prepend a copyright to the code.  He
X *   later discovered that his employer (DEC) routinely required employees to
X *   sign a contract statement which granted to DEC all rights with respect
X *   to codes written by DEC employees, whether the codes were written on the
X *   company's time/facilities or otherwise.  I do not know how the matter
X *   was resolved, but VT100 still seems to be on the freely distributable
X *   software list; the VT100 codes, now with parts from many contributors,
X *   are currently maintained by Antony C. Sumrall (acs@ahmdahl.com).  The
X *   menus in MM, while styled with the same code forms as were used with
X *   VT100 v2.3, are of course different in content in any case.  The WFrags
X *   program was, I believe, a version by Tom Rokicki (the Amiga Tex guy)
X *   probably evolved from the Frags program originally submitted to the net
X *   by Mike Meyer.  WFrags was submitted to the net without a prepended
X *   copyright notice, evidently intended  as freely distributable software.
X *
X *   The spirit of these contributions is that they are not to be used for
X *   commercial purposes, and the original authors certainly appreciate
X *   being cited for their work.  So I just did that.  The timer codes are
X *   exerpted from a network article by Andy Finkel of CBM, submitted as a
X *   demonstration of the ease of implementing the Amiga timer.device in C.
X *   There are supposedly at least two ways to implement the timer.device,
X *   either as a message port to the Amiga Exec, or as an IDCMP feature in
X *   Amiga Intuition.  It would seem that the latter would be better for a
X *   program (such as this one) which makes resolute use of Intuition IDCMP
X *   features.  However, Andy's code was for the former, and rather than do
X *   whatever would have been required to utilize the IDCMP TIMER flag, I
X *   just went with what Andy originally wrote.  So, for my part, I add no
X *   further restrictions to the codes in MM, though I expect everyone must
X *   regard the MM code as owned by Rokicki - even if he is not in any way
X *   responsible for maintaining the codes or controlling the result of their
X *   use.  Thus, I submit the following Standard Disclaimer:
X *
X *   The authors accept no responsibility for anything either beneficial or
X *   detrimental that may happen as a result of using the codes in MM.  The
X *   codes are intended for non-commercial use only.
X *   
X *
X *   Howard Hull  hull@ncar.ucar.edu
X *
X */
END_OF_FILE
if test 20567 -ne `wc -c <'mm.doc'`; then
    echo shar: \"'mm.doc'\" unpacked with wrong size!
fi
# end of 'mm.doc'
fi
if test -f 'mm.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mm.h'\"
else
echo shar: Extracting \"'mm.h'\" \(757 characters\)
sed "s/^X//" >'mm.h' <<'END_OF_FILE'
X/* : ai=0 bk=0 ts=8 */
X#include <intuition/intuition.h>
X#include <intuition/intuitionbase.h>
X#include <graphics/gfx.h>
X#include <graphics/gfxbase.h>
X#include <exec/exec.h>
X#include <exec/execbase.h>
X#include <functions.h>
X
X/* standard and suggested Workbench pen colors */
X
X#define BLUP 0L        /* CBM Workbench medium (IBM) blue */
X#define WHTP 1L        /* CBM Workbench pure white */
X#define BLKP 2L        /* CBM Workbench black with elevated blue */
X#define ORNP 3L        /* CBM Workbench orange */
X#define GRNP 4L        /* CBM Workbench pure blue */
X#define REDP 5L        /* CBM Workbench magenta */
X#define CYNP 6L        /* CBM Workbench cyan */
X#define YELP 7L        /* CBM Workbench duplicates white here */
X
Xextern struct Window *window ;
X
END_OF_FILE
if test 757 -ne `wc -c <'mm.h'`; then
    echo shar: \"'mm.h'\" unpacked with wrong size!
fi
# end of 'mm.h'
fi
if test -f 'mminit.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mminit.c'\"
else
echo shar: Extracting \"'mminit.c'\" \(23918 characters\)
sed "s/^X//" >'mminit.c' <<'END_OF_FILE'
X/* : ai=0 bk=0 ts=8 */
X#include "mm.h"
X
X#define PROJMAX 3               /* number of project menu items */
X#define SETUPMAX 2              /* number of setup menu items */
X#define MODEMAX 2
X#define FREQMAX 4               /* number of frequency menu items */
X#define PRIOMAX 16              /* number of priority menu items */
X#define CHIPMAX 5               /* number of chip mem size menu items */
X#define CHIPAMAX 4              /* number of chip mem base addr menu items */
X#define SFMAX 4                 /* number of sf mem size menu items */
X#define SFAMAX 4                /* number of sf mem base addr menu items */
X#define FASTMAX 7               /* number of fast mem size menu items */
X#define FASTAMAX 8              /* number of fast mem base addr menu items */
X#define MAXMENU 9               /* total number of top level menus */
X
Xextern BOOL p_mode;             /* preset frags mode = 0, warps mode = 1 */
Xextern long p_rate;             /* preset sample interval, secs see menu */
Xextern long p_priority;         /* preset priority, range -100 to +100   */
Xextern long p_chip;             /* preset chip mem size, kbytes see menu */
Xextern long p_chipa;            /* preset chip mem address, kb  see menu */
Xextern long p_sf;               /* preset slowfast mem size, kb see menu */
Xextern long p_sfa;              /* preset slowfast mem addr, kb see menu */
Xextern long p_fast;             /* preset fast mem size, mbytes see menu */
Xextern long p_fasta;            /* preset fast mem addr, mbytes see menu */
X
X/******************************************************/
X/*    Structure declarations for the menu sections    */
X/******************************************************/
X
Xstruct   MenuItem ProjItem[PROJMAX];
Xstruct   IntuiText ProjText[PROJMAX];
Xstruct   MenuItem SetupItem[SETUPMAX];
Xstruct   IntuiText SetupText[SETUPMAX];
Xstruct   MenuItem ModeItem[MODEMAX];
Xstruct   IntuiText ModeText[MODEMAX];
Xstruct   MenuItem FreqItem[FREQMAX];
Xstruct   IntuiText FreqText[FREQMAX];
Xstruct   MenuItem PrioItem[PRIOMAX];
Xstruct   IntuiText PrioText[PRIOMAX];
Xstruct   MenuItem ChipItem[CHIPMAX];
Xstruct   IntuiText ChipText[CHIPMAX];
Xstruct   MenuItem ChipAItem[CHIPAMAX];
Xstruct   IntuiText ChipAText[CHIPAMAX];
Xstruct   MenuItem SFItem[SFMAX];
Xstruct   IntuiText SFText[SFMAX];
Xstruct   MenuItem SFAItem[SFAMAX];
Xstruct   IntuiText SFAText[SFAMAX];
Xstruct   MenuItem FastItem[FASTMAX];
Xstruct   IntuiText FastText[FASTMAX];
Xstruct   MenuItem FastAItem[FASTAMAX];
Xstruct   IntuiText FastAText[FASTAMAX];
Xstruct   Menu menu[MAXMENU];
X
X/*****************************************************************/
X/*    The following function initializes the structure arrays    */
X/*    needed to provide the Project menu topic.                  */
X/*    this was left retro-compatible with Manx 3.4a (nplus1)     */
X/*****************************************************************/
Xvoid InitProjItems()
X    {
X    int       n,nplus1;
X
X/* initialize each menu item and IntuiText with loop */
Xfor( n=0; n<PROJMAX; n++ )
X    {
X    nplus1 = n + 1;
X    ProjItem[n].NextItem = &ProjItem[nplus1];
X    ProjItem[n].LeftEdge = 0;
X    ProjItem[n].TopEdge = 9 * n;
X    ProjItem[n].Width = 64;
X    ProjItem[n].Height = 9;
X    ProjItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP;
X    ProjItem[n].MutualExclude = 0;
X    ProjItem[n].ItemFill = (APTR)&ProjText[n];
X    ProjItem[n].SelectFill = NULL;
X    ProjItem[n].Command = 0;
X    ProjItem[n].SubItem = NULL;
X    ProjItem[n].NextSelect = 0;
X
X    ProjText[n].FrontPen = BLUP;
X    ProjText[n].BackPen = WHTP;
X    ProjText[n].DrawMode = JAM2;/* render in fore and background */
X    ProjText[n].LeftEdge = 0;
X    ProjText[n].TopEdge = 1;
X    ProjText[n].ITextFont = NULL;
X    ProjText[n].NextText = NULL;
X    }
XProjItem[PROJMAX-1].NextItem = NULL;
X
X/* initialize text for specific menu items */
X
XProjText[0].IText = (UBYTE *)"Front";
XProjText[1].IText = (UBYTE *)"Back";
XProjText[2].IText = (UBYTE *)"Quit";
X}
X
X/*****************************************************************/
X/*    The following initializes the structure arrays             */
X/*   needed to provide the Setup menu topic.                     */
X/*****************************************************************/
X
Xvoid InitSetupItems()
X    {
X    int       n,nplus1;
X
X/* initialize each menu item and IntuiText with loop */
Xfor( n=0; n<SETUPMAX; n++ )
X    {
X    nplus1 = n + 1;
X    SetupItem[n].NextItem = &SetupItem[nplus1];
X    SetupItem[n].LeftEdge = 0;
X    SetupItem[n].TopEdge = 9 * n;
X    SetupItem[n].Width = 44;
X    SetupItem[n].Height = 9;
X    SetupItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP ;
X    SetupItem[n].MutualExclude = 0;
X    SetupItem[n].ItemFill = (APTR)&SetupText[n];
X    SetupItem[n].SelectFill = NULL;
X    SetupItem[n].Command = 0;
X    SetupItem[n].NextSelect = 0;
X
X    SetupText[n].FrontPen = BLUP;
X    SetupText[n].BackPen = WHTP;
X    SetupText[n].DrawMode = JAM2;    
X    SetupText[n].LeftEdge = 0;
X    SetupText[n].TopEdge = 1;
X    SetupText[n].ITextFont = NULL;
X    SetupText[n].NextText = NULL;
X    }
XSetupItem[SETUPMAX-1].NextItem = NULL;
X
XSetupText[0].IText = (UBYTE *)"Mode";
XSetupItem[0].SubItem = ModeItem;
XSetupText[1].IText = (UBYTE *)"Freq";
XSetupItem[1].SubItem = FreqItem;
X
X/*****************************************************************/
X/*    The following initializes the structure arrays             */
X/*   needed to provide the Mode submenu topic.                   */
X/*****************************************************************/
X
Xfor( n=0; n<MODEMAX; n++ )
X    {
X    nplus1 = n + 1;
X    ModeItem[n].NextItem = &ModeItem[nplus1];
X    ModeItem[n].LeftEdge = 38;
X    ModeItem[n].TopEdge = 9 * n;
X    ModeItem[n].Width = 72;
X    ModeItem[n].Height = 9;
X    ModeItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
X    ModeItem[n].MutualExclude = (~(1 << n));
X    ModeItem[n].ItemFill = (APTR)&ModeText[n];
X    ModeItem[n].SelectFill = NULL;
X    ModeItem[n].Command = 0;
X    ModeItem[n].SubItem = NULL;
X    ModeItem[n].NextSelect = 0;
X
X    ModeText[n].FrontPen = BLUP;
X    ModeText[n].BackPen = WHTP;
X    ModeText[n].DrawMode = JAM2;     /* render in fore and background */
X    ModeText[n].LeftEdge = 0;
X    ModeText[n].TopEdge = 1;
X    ModeText[n].ITextFont = NULL;
X    ModeText[n].NextText = NULL;
X    }
XModeItem[MODEMAX-1].NextItem = NULL;
X
X/* select mode subitem checked */
Xswitch (p_mode) {
X    case 0:     n = 0; break;
X    case 1:     n = 1; break;
X    default:    n = 1; p_mode = FALSE;
X    }
XModeItem[n].Flags |= CHECKED;
X
X/* initialize text for specific submenu items */
XModeText[0].IText = (UBYTE *)"   Frags";
XModeText[1].IText = (UBYTE *)"   Warps";
X
X/*****************************************************************/
X/*    The following initializes the structure arrays             */
X/*   needed to provide the Freq submenu topic.                   */
X/*****************************************************************/
X
Xfor( n=0; n<FREQMAX; n++ )
X    {
X    nplus1 = n + 1;
X    FreqItem[n].NextItem = &FreqItem[nplus1];
X    FreqItem[n].LeftEdge = 38;
X    FreqItem[n].TopEdge = 9 * n;
X    FreqItem[n].Width = 88;
X    FreqItem[n].Height = 9;
X    FreqItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
X    FreqItem[n].MutualExclude = (~(1 << n));
X    FreqItem[n].ItemFill = (APTR)&FreqText[n];
X    FreqItem[n].SelectFill = NULL;
X    FreqItem[n].Command = 0;
X    FreqItem[n].SubItem = NULL;
X    FreqItem[n].NextSelect = 0;
X
X    FreqText[n].FrontPen = BLUP;
X    FreqText[n].BackPen = WHTP;
X    FreqText[n].DrawMode = JAM2;     /* render in fore and background */
X    FreqText[n].LeftEdge = 0;
X    FreqText[n].TopEdge = 1;
X    FreqText[n].ITextFont = NULL;
X    FreqText[n].NextText = NULL;
X    }
XFreqItem[FREQMAX-1].NextItem = NULL;
X
X/* select frequency item checked */
Xswitch (p_rate) {
X    case 1:     n = 0; break;
X    case 2:     n = 1; break;
X    case 5:     n = 2; break;
X    case 10:    n = 3; break;
X    default:    n = 1; p_rate = 2;
X    }
XFreqItem[n].Flags |= CHECKED;
X
X/* initialize text for specific menu items */
XFreqText[0].IText = (UBYTE *)"    1 Sec ";
XFreqText[1].IText = (UBYTE *)"    2 Secs";
XFreqText[2].IText = (UBYTE *)"    5 Secs";
XFreqText[3].IText = (UBYTE *)"   10 Secs";
X}
X
X/*****************************************************************/
X/*    The following initializes the structure arrays             */
X/*   needed to provide the Priority menu topic.                  */
X/*****************************************************************/
X
Xvoid InitPrioItems()
X    {
X    int       n,nplus1;
X
X/* initialize each menu item and IntuiText with loop */
Xfor( n=0; n<PRIOMAX; n++ )
X    {
X    nplus1 = n + 1;
X    PrioItem[n].NextItem = &PrioItem[nplus1];
X    PrioItem[n].LeftEdge = 0;
X    PrioItem[n].TopEdge = 9 * n;
X    PrioItem[n].Width = 80;
X    PrioItem[n].Height = 9;
X    PrioItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
X    PrioItem[n].MutualExclude = (~(1 << n));
X    if (n < 3)  PrioItem[n].MutualExclude &= 0x0007;
X    if (n < 1)  PrioItem[n].MutualExclude |= 0x0007;
X    PrioItem[n].ItemFill = (APTR)&PrioText[n];
X    PrioItem[n].SelectFill = NULL;
X    PrioItem[n].Command = 0;
X    PrioItem[n].NextSelect = 0;
X
X    PrioText[n].FrontPen = BLUP;
X    PrioText[n].BackPen = WHTP;
X    if (n > 11)  {
X        PrioText[n].FrontPen = ORNP;
X        PrioText[n].BackPen = REDP;
X        }
X    PrioText[n].DrawMode = JAM2;    
X    PrioText[n].LeftEdge = 0;
X    PrioText[n].TopEdge = 1;
X    PrioText[n].ITextFont = NULL;
X    PrioText[n].NextText = NULL;
X    }
XPrioItem[PRIOMAX-1].NextItem = NULL;
X
X/* select priority item checked */
Xswitch (p_priority) {
X    case  -99:     n =  3; break;
X    case  -75:     n =  4; break;
X    case  -50:     n =  5; break;
X    case  -25:     n =  6; break;
X    case  -20:     n =  7; break;
X    case  -15:     n =  8; break;
X    case  -10:     n =  9; break;
X    case   -5:     n = 10; break;
X    case    0:     n = 11; break;
X    case    5:     n = 12; break;
X    case   10:     n = 13; break;
X    case   15:     n = 14; break;
X    case   20:     n = 15; break;
X    default:       n = 11; p_priority = 0;
X    }
XPrioItem[n].Flags |= CHECKED;
X
XPrioText[ 0].IText = (UBYTE *)"   NORM   ";
XPrioText[ 1].IText = (UBYTE *)"   DECR   ";
XPrioText[ 2].IText = (UBYTE *)"   INCR   ";
XPrioText[ 3].IText = (UBYTE *)"   -99    ";
XPrioText[ 4].IText = (UBYTE *)"   -75    ";
XPrioText[ 5].IText = (UBYTE *)"   -50    ";
XPrioText[ 6].IText = (UBYTE *)"   -25    ";
XPrioText[ 7].IText = (UBYTE *)"   -20    ";
XPrioText[ 8].IText = (UBYTE *)"   -15    ";
XPrioText[ 9].IText = (UBYTE *)"   -10    ";
XPrioText[10].IText = (UBYTE *)"   -5     ";
XPrioText[11].IText = (UBYTE *)"    0     ";
XPrioText[12].IText = (UBYTE *)"    5     ";
XPrioText[13].IText = (UBYTE *)"    10    ";
XPrioText[14].IText = (UBYTE *)"    15    ";
XPrioText[15].IText = (UBYTE *)"    20    ";
X}
X
X/*****************************************************************/
X/*    The following initializes the structure arrays             */
X/*   needed to provide the Chip Mem Size menu topic.             */
X/*****************************************************************/
X
Xvoid InitChipItems()
X    {
X    int       n,nplus1;
X
X/* initialize each menu item and IntuiText with loop */
Xfor( n=0; n<CHIPMAX; n++ )
X    {
X    nplus1 = n + 1;
X    ChipItem[n].NextItem = &ChipItem[nplus1];
X    ChipItem[n].LeftEdge = 0;
X    ChipItem[n].TopEdge = 9 * n;
X    ChipItem[n].Width = 80;
X    ChipItem[n].Height = 9;
X    ChipItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
X    ChipItem[n].MutualExclude = (~(1 << n));
X    ChipItem[n].ItemFill = (APTR)&ChipText[n];
X    ChipItem[n].SelectFill = NULL;
X    ChipItem[n].Command = 0;
X    ChipItem[n].NextSelect = 0;
X
X    ChipText[n].FrontPen = BLUP;
X    ChipText[n].BackPen = WHTP;
X    ChipText[n].DrawMode = JAM2;    
X    ChipText[n].LeftEdge = 0;
X    ChipText[n].TopEdge = 1;
X    ChipText[n].ITextFont = NULL;
X    ChipText[n].NextText = NULL;
X    }
XChipItem[CHIPMAX-1].NextItem = NULL;
X
X/* select chip mem size item checked */
Xswitch (p_chip) {
X    case    0:     n = 0; break;
X    case  256:     n = 1; break;
X    case  512:     n = 2; break;
X    case 1024:     n = 3; break;
X    case 2048:     n = 4; break;
X    default:       n = 2; p_chip = 512;
X    }
XChipItem[n].Flags |= CHECKED;
X
XChipText[0].IText = (UBYTE *)"   NONE";
XChipText[1].IText = (UBYTE *)"   256K";
XChipText[2].IText = (UBYTE *)"   512K";
XChipText[3].IText = (UBYTE *)"   1 MB";
XChipText[4].IText = (UBYTE *)"   2 MB";
X}
X
X/*****************************************************************/
X/*    The following initializes the structure arrays             */
X/*   needed to provide the Chip Base Addr menu topic.            */
X/*****************************************************************/
X
Xvoid InitChipAItems()
X    {
X    int       n,nplus1;
X
X/* initialize each menu item and IntuiText with loop */
Xfor( n=0; n<CHIPAMAX; n++ )
X    {
X    nplus1 = n + 1;
X    ChipAItem[n].NextItem = &ChipAItem[nplus1];
X    ChipAItem[n].LeftEdge = 0;
X    ChipAItem[n].TopEdge = 9 * n;
X    ChipAItem[n].Width = 80;
X    ChipAItem[n].Height = 9;
X    ChipAItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
X    ChipAItem[n].MutualExclude = (~(1 << n));
X    ChipAItem[n].ItemFill = (APTR)&ChipAText[n];
X    ChipAItem[n].SelectFill = NULL;
X    ChipAItem[n].Command = 0;
X    ChipAItem[n].NextSelect = 0;
X
X    ChipAText[n].FrontPen = BLUP;
X    ChipAText[n].BackPen = WHTP;
X    ChipAText[n].DrawMode = JAM2;    
X    ChipAText[n].LeftEdge = 0;
X    ChipAText[n].TopEdge = 1;
X    ChipAText[n].ITextFont = NULL;
X    ChipAText[n].NextText = NULL;
X    }
XChipAItem[CHIPAMAX-1].NextItem = NULL;
X
X/* select chip base address item checked */
Xswitch (p_chipa) {
X    case    0:     n = 0; break;
X    case  256:     n = 1; break;
X    case  512:     n = 2; break;
X    case 1024:     n = 3; break;
X    default:       n = 0; p_chipa = 0;
X    }
XChipAItem[n].Flags |= CHECKED;
X
XChipAText[0].IText = (UBYTE *)"   @   0K";
XChipAText[1].IText = (UBYTE *)"   @ 256K";
XChipAText[2].IText = (UBYTE *)"   @ 512K";
XChipAText[3].IText = (UBYTE *)"   @ 1 MB";
X}
X
X/*****************************************************************/
X/*    The following initializes the structure arrays             */
X/*   needed to provide the Slow Fast Mem Size menu topic.        */
X/*****************************************************************/
X
Xvoid InitSFItems()
X    {
X    int       n,nplus1;
X
X/* initialize each menu item and IntuiText with loop */
Xfor( n=0; n<SFMAX; n++ )
X    {
X    nplus1 = n + 1;
X    SFItem[n].NextItem = &SFItem[nplus1];
X    SFItem[n].LeftEdge = 0;
X    SFItem[n].TopEdge = 9 * n;
X    SFItem[n].Width = 80;
X    SFItem[n].Height = 9;
X    SFItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
X    SFItem[n].MutualExclude = (~(1 << n));
X    SFItem[n].ItemFill = (APTR)&SFText[n];
X    SFItem[n].SelectFill = NULL;
X    SFItem[n].Command = 0;
X    SFItem[n].NextSelect = 0;
X
X    SFText[n].FrontPen = BLUP;
X    SFText[n].BackPen = WHTP;
X    SFText[n].DrawMode = JAM2;    
X    SFText[n].LeftEdge = 0;
X    SFText[n].TopEdge = 1;
X    SFText[n].ITextFont = NULL;
X    SFText[n].NextText = NULL;
X    }
XSFItem[SFMAX-1].NextItem = NULL;
X
X/* select slow fast mem size item checked */
Xswitch (p_sf) {
X    case    0:     n = 0; break;
X    case  512:     n = 1; break;
X    case 1024:     n = 2; break;
X    case 1536:     n = 3; break;
X    default:       n = 0; p_sf = 0;
X    }
XSFItem[n].Flags |= CHECKED;
X
XSFText[0].IText = (UBYTE *)"   NONE  ";
XSFText[1].IText = (UBYTE *)"   0.5 MB";
XSFText[2].IText = (UBYTE *)"   1   MB";
XSFText[3].IText = (UBYTE *)"   1.5 MB";
X}
X
X/*****************************************************************/
X/*    The following initializes the structure arrays             */
X/*   needed to provide the Slow Fast Mem Base Addr menu topic.   */
X/*****************************************************************/
X
Xvoid InitSFAItems()
X    {
X    int       n,nplus1;
X
X/* initialize each menu item and IntuiText with loop */
Xfor( n=0; n<SFAMAX; n++ )
X    {
X    nplus1 = n + 1;
X    SFAItem[n].NextItem = &SFAItem[nplus1];
X    SFAItem[n].LeftEdge = 0;
X    SFAItem[n].TopEdge = 9 * n;
X    SFAItem[n].Width = 104;
X    SFAItem[n].Height = 9;
X    SFAItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
X    SFAItem[n].MutualExclude = (~(1 << n));
X    SFAItem[n].ItemFill = (APTR)&SFAText[n];
X    SFAItem[n].SelectFill = NULL;
X    SFAItem[n].Command = 0;
X    SFAItem[n].NextSelect = 0;
X
X    SFAText[n].FrontPen = BLUP;
X    SFAText[n].BackPen = WHTP;
X    SFAText[n].DrawMode = JAM2;    
X    SFAText[n].LeftEdge = 0;
X    SFAText[n].TopEdge = 1;
X    SFAText[n].ITextFont = NULL;
X    SFAText[n].NextText = NULL;
X    }
XSFAItem[SFAMAX-1].NextItem = NULL;
X
X/* select slow fast mem base address item checked */
Xswitch (p_sfa) {
X    case 12288:     n = 0; break;               /* 0x3000 kb = 12   mb */
X    case 12800:     n = 1; break;               /* 0x3200 kb = 12.5 mb */
X    case 13312:     n = 2; break;               /* 0x3400 kb = 13   mb */
X    case 13824:     n = 3; break;               /* 0x3600 kb = 13.5 mb */
X    default:        n = 0; p_sfa = 12288;
X    }
XSFAItem[n].Flags |= CHECKED;
X
XSFAText[0].IText = (UBYTE *)"   @ C.0 Meg";
XSFAText[1].IText = (UBYTE *)"   @ C.8 Meg";
XSFAText[2].IText = (UBYTE *)"   @ D.0 Meg";
XSFAText[3].IText = (UBYTE *)"   @ D.8 Meg";
X}
X
X/*****************************************************************/
X/*    The following initializes the structure arrays             */
X/*   needed to provide the Fast Mem Size menu topic.             */
X/*****************************************************************/
X
Xvoid InitFastItems()
X    {
X    int       n,nplus1;
X
X/* initialize each menu item and IntuiText with loop */
Xfor( n=0; n<FASTMAX; n++ )
X    {
X    nplus1 = n + 1;
X    FastItem[n].NextItem = &FastItem[nplus1];
X    FastItem[n].LeftEdge = 0;
X    FastItem[n].TopEdge = 9 * n;
X    FastItem[n].Width = 80;
X    FastItem[n].Height = 9;
X    FastItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
X    FastItem[n].MutualExclude = (~(1 << n));
X    FastItem[n].ItemFill = (APTR)&FastText[n];
X    FastItem[n].SelectFill = NULL;
X    FastItem[n].Command = 0;
X    FastItem[n].NextSelect = 0;
X
X    FastText[n].FrontPen = BLUP;
X    FastText[n].BackPen = WHTP;
X    FastText[n].DrawMode = JAM2;    
X    FastText[n].LeftEdge = 0;
X    FastText[n].TopEdge = 1;
X    FastText[n].ITextFont = NULL;
X    FastText[n].NextText = NULL;
X    }
XFastItem[FASTMAX-1].NextItem = NULL;
X
X/* select fast mem size item checked */
Xswitch (p_fast) {
X    case 0:       n = 0; break;
X    case 512:     n = 1; break;
X    case 1:       n = 2; break;
X    case 2:       n = 3; break;
X    case 4:       n = 4; break;
X    case 6:       n = 5; break;
X    case 8:       n = 6; break;
X    default:      n = 0; p_fast = 0;
X    }
XFastItem[n].Flags |= CHECKED;
X
XFastText[0].IText = (UBYTE *)"   NONE";
XFastText[1].IText = (UBYTE *)"   512K";
XFastText[2].IText = (UBYTE *)"   1 MB";
XFastText[3].IText = (UBYTE *)"   2 MB";
XFastText[4].IText = (UBYTE *)"   4 MB";
XFastText[5].IText = (UBYTE *)"   6 MB";
XFastText[6].IText = (UBYTE *)"   8 MB";
X}
X
X/*****************************************************************/
X/*    The following initializes the structure arrays             */
X/*   needed to provide the Fast Mem Base Addr menu topic.        */
X/*****************************************************************/
X
Xvoid InitFastAItems()
X    {
X    int       n,nplus1;
X
X/* initialize each menu item and IntuiText with loop */
Xfor( n=0; n<FASTAMAX; n++ )
X    {
X    nplus1 = n + 1;
X    FastAItem[n].NextItem = &FastAItem[nplus1];
X    FastAItem[n].LeftEdge = 0;
X    FastAItem[n].TopEdge = 9 * n;
X    FastAItem[n].Width = 80;
X    FastAItem[n].Height = 9;
X    FastAItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
X    FastAItem[n].MutualExclude = (~(1 << n));
X    FastAItem[n].ItemFill = (APTR)&FastAText[n];
X    FastAItem[n].SelectFill = NULL;
X    FastAItem[n].Command = 0;
X    FastAItem[n].NextSelect = 0;
X
X    FastAText[n].FrontPen = BLUP;
X    FastAText[n].BackPen = WHTP;
X    FastAText[n].DrawMode = JAM2;    
X    FastAText[n].LeftEdge = 0;
X    FastAText[n].TopEdge = 1;
X    FastAText[n].ITextFont = NULL;
X    FastAText[n].NextText = NULL;
X    }
XFastAItem[FASTAMAX-1].NextItem = NULL;
X
X/* select fast base address item checked */
Xswitch (p_fasta) {
X    case 2:     n = 0; break;
X    case 3:     n = 1; break;
X    case 4:     n = 2; break;
X    case 5:     n = 3; break;
X    case 6:     n = 4; break;
X    case 7:     n = 5; break;
X    case 8:     n = 6; break;
X    case 9:     n = 7; break;
X    default:    n = 0; p_fasta = 2;
X    }
XFastAItem[n].Flags |= CHECKED;
X
XFastAText[0].IText = (UBYTE *)"   @ 2 M";
XFastAText[1].IText = (UBYTE *)"   @ 3 M";
XFastAText[2].IText = (UBYTE *)"   @ 4 M";
XFastAText[3].IText = (UBYTE *)"   @ 5 M";
XFastAText[4].IText = (UBYTE *)"   @ 6 M";
XFastAText[5].IText = (UBYTE *)"   @ 7 M";
XFastAText[6].IText = (UBYTE *)"   @ 8 M";
XFastAText[7].IText = (UBYTE *)"   @ 9 M";
X}
X
X/****************************************************************/
X/*   The following function inits the Menu structure array with */
X/*  appropriate values for our simple menu.  Review the manual  */
X/*  if you need to know what each value means.                  */
X/****************************************************************/
Xvoid InitMenu()
X{
Xmenu[0].NextMenu = &menu[1];
Xmenu[0].LeftEdge = 0;
Xmenu[0].TopEdge = 0;
Xmenu[0].Width = 64;
Xmenu[0].Height = 10;
Xmenu[0].Flags = MENUENABLED;
Xmenu[0].MenuName = "Project";        /* text for menu-bar display */
Xmenu[0].FirstItem = &ProjItem[0];    /* pointer to first item in list */
X
Xmenu[1].NextMenu = &menu[2];
Xmenu[1].LeftEdge = 64;
Xmenu[1].TopEdge = 0;
Xmenu[1].Width = 48;
Xmenu[1].Height = 10;
Xmenu[1].Flags = MENUENABLED;
Xmenu[1].MenuName = "Setup";          /* text for menu-bar display */
Xmenu[1].FirstItem = &SetupItem[0];   /* pointer to first item in list */
X
Xmenu[2].NextMenu = &menu[3];
Xmenu[2].LeftEdge = 112;
Xmenu[2].TopEdge = 0;
Xmenu[2].Width = 72;
Xmenu[2].Height = 10;
Xmenu[2].Flags = MENUENABLED;
Xmenu[2].MenuName = "Priority";       /* text for menu-bar display */
Xmenu[2].FirstItem = &PrioItem[0];    /* pointer to first item in list */
X
Xmenu[3].NextMenu = &menu[4];
Xmenu[3].LeftEdge = 184;
Xmenu[3].TopEdge = 0;
Xmenu[3].Width = 80;
Xmenu[3].Height = 10;
Xmenu[3].Flags = MENUENABLED;
Xmenu[3].MenuName = "Chip Size";      /* text for menu-bar display */
Xmenu[3].FirstItem = &ChipItem[0];    /* pointer to first item in list */
X
Xmenu[4].NextMenu = &menu[5];
Xmenu[4].LeftEdge = 264;
Xmenu[4].TopEdge = 0;
Xmenu[4].Width = 80;
Xmenu[4].Height = 10;
Xmenu[4].Flags = MENUENABLED;
Xmenu[4].MenuName = "Chip Addr";      /* text for menu-bar display */
Xmenu[4].FirstItem = &ChipAItem[0];   /* pointer to first item in list */
X
Xmenu[5].NextMenu = &menu[6];
Xmenu[5].LeftEdge = 344;
Xmenu[5].TopEdge = 0;
Xmenu[5].Width = 64;
Xmenu[5].Height = 10;
Xmenu[5].Flags = MENUENABLED;
Xmenu[5].MenuName = "SF Size";        /* text for menu-bar display */
Xmenu[5].FirstItem = &SFItem[0];      /* pointer to first item in list */
X
Xmenu[6].NextMenu = &menu[7];
Xmenu[6].LeftEdge = 408;
Xmenu[6].TopEdge = 0;
Xmenu[6].Width = 64;
Xmenu[6].Height = 10;
Xmenu[6].Flags = MENUENABLED;
Xmenu[6].MenuName = "SF Addr";        /* text for menu-bar display */
Xmenu[6].FirstItem = &SFAItem[0];     /* pointer to first item in list */
X
Xmenu[7].NextMenu = &menu[8];
Xmenu[7].LeftEdge = 472;
Xmenu[7].TopEdge = 0;
Xmenu[7].Width = 80;
Xmenu[7].Height = 10;
Xmenu[7].Flags = MENUENABLED;
Xmenu[7].MenuName = "Fast Size";      /* text for menu-bar display */
Xmenu[7].FirstItem = &FastItem[0];    /* pointer to first item in list */
X
Xmenu[8].NextMenu = NULL;
Xmenu[8].LeftEdge = 552;
Xmenu[8].TopEdge = 0;
Xmenu[8].Width = 80;
Xmenu[8].Height = 10;
Xmenu[8].Flags = MENUENABLED;
Xmenu[8].MenuName = "Fast Addr";      /* text for menu-bar display */
Xmenu[8].FirstItem = &FastAItem[0];   /* pointer to first item in list */
X
X}
X
Xvoid StartMenus()
X{
XSetMenuStrip(window,&menu[0]);
X}
END_OF_FILE
if test 23918 -ne `wc -c <'mminit.c'`; then
    echo shar: \"'mminit.c'\" unpacked with wrong size!
fi
# end of 'mminit.c'
fi
echo shar: End of archive 1 \(of 2\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked both archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Mail submissions (sources or binaries) to <amiga@cs.odu.edu>.
Mail comments to the moderator at <amiga-request@cs.odu.edu>.
Post requests for sources, and general discussion to comp.sys.amiga.
