GEOS Programmer's Reference Guide

                                     written by

                               Alexander Donald Boyce


                                     revision by

                                     Bo Zimmerman



                                       Preface


               This document was written after having disassembled the GEOS
          Kernal  and completely commenting and reverse engineering it.  It
          took  a  great deal of time to do this,  but I did it  because  I
          enjoy   computer  programming  and  deciphering  other   people's
          programs.  Because  of the amount of effort involved in  creating
          this document,  I do not really wish to give it away.  However, I
          know  there are other programmers who will benefit from  my  hard
          work.  Therefore I am offering this document as shareware. If you
          get  good use out of this document,  send me whatever you feel it
          is worth to you (or some reasonable amount,  personally I find it
          invaluable).  A  few  dollars would be appreciated.  Here  is  my
          address:
                         Alexander Donald Boyce
                         2269 Grandview Ave., Apt. 1
                         Cleveland Heights, Ohio 44106-3144

               Thank you and happy computing!!

                                   Alex Boyce
                                   October 1986


           1997 Revision notes:

           Wow! This document has been floating around for over 11 years! I
           wonder if Mr. Boyce still uses a Commodore, or has ever thought
           about this document written so long ago?  Anyway, this revision
           contains many changes to reflect BSW's release of geoProgrammer,
           some new information, and a better organization.

           Those of you who know the previous version of this document will
           first notice that the names of all the routines and memory 
           locations have been changed to reflect the official names that BSW
           gave them.  This is to aid those of us using geoProgrammer for our
           coding.  You'll find these names throughout the kernal descriptions,
           as well as many of the BSW logicals where appropriate.

           The prior version of this document was also fairly deficient in 
           the non-kernal chapters dealing with file formats, device
           drivers, etc.  These chapters have all been beefed up a bit.
           Another appendix has also been added for character set reference
           and another for 6502/6510/8502 assembly.

           Lastly, the order of all the kernal routines have been changed.
           This is just to cut down on page flipping and TOC referencing
           by putting all related routines together.

                   Bo Zimmerman
                   October, 1997
                   July, 2000
                   August, 2001


                                  Table of Contents

          Chapter 1      GEOS Kernal Routines
                         Defines  all the GEOS kernal routines  along  with
                         their input and output requirements.

          Chapter 2      Device Drivers
                         Defines the format for Input and Printer Drivers.

          Chapter 3      File Formats
                         Describes  the  format  of all of  GEOS's  various
                         files.

          Chapter 4      Directory Structure
                         Describes   the   structure  of  a   GEOS   disk's
                         directory.

          Chapter 5      Information Sector Format
                         Describes  the structure and the data contained in
                         a file's information sector.

          Chapter 6      Memory Map
                         Defines the memory locations used by GEOS.


          Appendix I     GEOS Errors
                         Defines the error numbers that can be returned  by
                         the GEOS Kernal routines.

          Appendix II    Glossary
                         Defines several terms used in this document.

          Appendix III   Fill Patterns
                         A representation of GEOS's 32 fill patterns.

          Appendix IV    Programming Notes
                         Information necessary for GEOS programming.

          Appendix V     GEOS/ASCII/PETSCII Character sets

          Appendix VI    6502/6510/8502 Assembly language


                                Categorical Listing
          --------------------------------------------------------------------------
          Math routines
          -------------
          DNegate             $C172     Negate a 16 bit integer                1-001
          Ddiv                $C169     Unsigned 16 bit division               1-002
          DMult               $C166     Unsigned 16 bit by 16 bit multiply     1-003
          BMult               $C163     Unsigned 16 bit by 8 bit multiply      1-004
          BBMult              $C160     Unsigned 8 bit by 8 bit multiply       1-005
          DSdiv               $C16C     Signed 16 bit division                 1-006
          Dabs                $C16F     16 bit absolute value                  1-007
          Ddec                $C175     Decrement a 16 bit integer             1-008
          DShiftLeft          $C15D     Multiple 16 bit arithmetic shift
                                             left                              1-009
          DShiftRight         $C262     Multiple 16 bit logical shift right    1-010
          CRC                 $C20E     Compute the checksum of a memory
                                             region                            1-011


          Memory manipulation
          -------------------
          InitRam             $C181     Multiple memory location
                                             initialization                    1-101
          MoveData            $C17E     Intelligent memory block move          1-102
          i_MoveData          $C1B7     Intelligent memory block move with
                                             inline data                       1-103
          FillRam             $C17B     Memory block fill                      1-104
          i_FillRam           $C1B4     Memory block fill with inline data     1-105
          ClearRam            $C178     Fill a memory region with zeroes       1-106
          CmpString           $C26B     String compare                         1-107
          CopyString          $C265     String copy                            1-108
          CmpFString          $C26E     Memory block comparison                1-109
          CopyFString         $C268     Memory block move                      1-110
          StashRAM            $C2C8     Stash memory into an REU               1-111
          FetchRAM            $C2CB     Retrieve memory from an REU            1-112
          SwapRAM             $C2CE     Swap memory with an REU memory block   1-113
          VerifyRAM           $C2D1     Verify (compare) memory with REU       1-114
          DoRAMOp             $C2D4     Perform any of the above REU commands  1-115


          Text and fonts
          --------------
          PutChar             $C145     Display a character                    1-201
          SmallPutChar        $C202     Draw a character on the screen         1-202
          PutDecimal          $C184     Display a 16 bit integer               1-203
          PutString           $C148     Display a text string                  1-204
          i_PutString         $C1AE     Display a text string with inline
                                             data                              1-205
          GetNextChar         $C2A7     Read a character from the keyboard     1-206
          GetString           $C1BA     Read a line of text from the user      1-207
          InitTextPrompt      $C1C0     Create the text cursor sprite          1-208
          PromptOn            $C29B     Turn on the text cursor                1-209
          PromptOff           $C29E     Turn off the text cursor               1-210
          UseSystemFont       $C14B     Select the BSW font                    1-211
          LoadCharSet         $C1CC     Make a memory resident font the
                                             current font                      1-212
          GetRealSize         $C1B1     Get a character's stats                1-213
          GetCharWidth        $C1C9     Get a character's width                1-214


          Low level disk routines
          --------------------------
          SetDevice           $C2B0     Select a drive                         1-301
          ChangeDiskDevice    $C2BC     Change disk drive device number        1-302
          OpenDisk            $C2A1     Open a disk                            1-303
          NewDisk             $C1E1     Initialize a drive                     1-304
          EnterTurbo          $C214     Setup a drive with turbodos            1-305
          ExitTurbo           $C232     Stop turbodos in a drive               1-306
          PurgeTurbo          $C235     Stop and remove turbodos in a drive    1-307
          GetDirHead          $C247     Read track 18 sector 0                 1-308
          PutDirHead          $C24A     Write to track 18 sector 0             1-309
          GetBlock            $C1E4     Read a sector                          1-310
          PutBlock            $C1E7     Write a sector                         1-311
          ReadBlock           $C21A     Read a sector with drive preset        1-312
          WriteBlock          $C220     Write a sector with drive preset       1-313
          VerWriteBlock       $C223     Verify before writing sector           1-314
          GetPtrCurDkNm       $C298     Compute address of disk's name         1-315
          FindBAMBit          $C2AD     Check if a disk sector is in use       1-316
          SetNextFree         $C292     Find and allocate a disk block         1-317
          BlkAlloc            $C1FC     Allocate sectors for a file            1-318
          NxtBlkAlloc         $C24D     Allocate sectors for a file            1-319
          SetGEOSDisk         $C1EA     Convert a disk to GEOS format          1-320
          ChkDkGEOS           $C1DE     Check if a disk is GEOS format         1-321
          CalcBlksFree        $C1DB     Compute number of free blocks on
                                             disk                              1-322
          FreeBlock           $C2B9     Free a BAM bit in memory               1-323


          High level disk routines
          ------------------------
          FindFTypes          $C23B     Create a table of file names           1-401
          FindFile            $C20B     Lookup a file in the directory         1-402
          SaveFile            $C1ED     Save memory to a file                  1-403
          WriteFile           $C1F9     Save memory to preallocated sectors    1-404
          RenameFile          $C259     Rename a file                          1-405
          DeleteFile          $C238     Delete a file                          1-406
          FastDelFile         $C244     Delete a temporary file                1-407
          FreeFile            $C226     Free a file's sectors                  1-408
          RstrAppl            $C23E     Load the SWAPFILE                      1-409
          GetFile             $C208     Load a file, given a file name         1-410
          LdFile              $C211     Load a file, given a directory entry   1-411
          LdApplic            $C21D     Load and run a file, given a
                                             directory entry                   1-412
          LdDeskAcc           $C217     Load a file with memory swapping       1-413
          ReadByte            $C2B6     Get a byte from a file                 1-414
          ReadFile            $C1FF     Load a chain into memory, given the
                                             initial track and sector          1-415
          GetFreeDirBlk       $C1F6     Find a hole in the directory           1-416
          SetGDirEntry        $C1F0     Create a directory entry on disk       1-417
          BldGDirEntry        $C1F3     Create a directory entry in memory     1-418
          GetFHdrInfo         $C229     Get a file's load address              1-419
          FollowChain         $C205     Create a list of sectors used by a
                                             file                              1-420


          VLIR support routines
          ---------------------
          OpenRecordFile      $C274     Open a VLIR file                       1-501
          PointRecord         $C280     Goto a specific VLIR chain             1-502
          PreviousRecord      $C27D     Move to previous VLIR chain            1-503
          NextRecord          $C27A     Move to next VLIR chain                1-504
          InsertRecord        $C286     Insert a VLIR chain                    1-505
          AppendRecord        $C289     Add a VLIR chain                       1-506
          DeleteRecord        $C283     Remove a VLIR chain                    1-507
          ReadRecord          $C28C     Load a VLIR chain                      1-508
          WriteRecord         $C28F     Save memory to a VLIR chain            1-509
          UpdateRecordFile    $C295     Update a VLIR file                     1-510
          CloseRecordFile     $C277     Close a VLIR file                      1-511


          Graphics
          --------
          GraphicsString      $C136     Process a graphic command table        1-601
          i_GraphicsString    $C1A8     Process a graphic command table with
                                             inline data                       1-602
          SetPattern          $C139     Select a fill pattern                  1-603
          FrameRectangle      $C127     Draw an outline in a pattern           1-604
          i_FrameRectangle    $C1A2     Draw a solid outline with inline
                                             data                              1-605
          Rectangle           $C124     Fill a box with a pattern              1-606
          i_Rectangle         $C19F     Fill a box with a pattern with
                                             inline data                       1-607
          RecoverRectangle    $C12D     Copy a box from screen 1 to screen 2   1-608
          i_RecoverRectangle  $C1A5     Copy a box from screen 1 to screen 2
                                             with inline data                  1-609
          ImprintRectangle    $C250     Copy a box from screen 2 to screen 1   1-610
          i_ImprintRectangle  $C253     Copy a box from screen 2 to screen 1
                                             with inline data                  1-611
          InvertRectangle     $C12A     Reverse video a box                    1-612
          RecoverLine         $C11E     Copy a line from screen 2 to screen 1  1-613
          InvertLine          $C11B     Reverse video a horizontal line        1-614
          DrawLine            $C130     Draw/Erase/Copy an arbitrary line      1-615
          HorizontalLine      $C118     Draw a horizontal line in a pattern    1-616
          VerticalLine        $C121     Draw a vertical line in a pattern      1-617
          GetScanLine         $C13C     Compute memory address of a row on
                                             the screen                        1-618
          TestPoint           $C13F     Test the value of a pixel              1-619
          DrawPoint           $C133     Draw/Erase/Copy a point on the
                                             screen                            1-620
          BitmapUp            $C1AB     Draw a click box with inline data      1-621
          i_BitmapUp          $C1AB     Draw a click box with inline data      1-622
          BitmapClip          $C2AA     Draw a coded image                     1-623
          BitOtherClip        $C2C5     Draw a coded image with user patches   1-624
          DrawSprite          $C1C6     Copy a sprite data block               1-625
          PosSprite           $C1CF     Position a sprite                      1-626
          EnablSprite         $C1D2     Turn on a sprite                       1-627
          DisablSprite        $C1D5     Turn off a sprite                      1-628


          Controls
          --------
          DoMenu              $C151     Menu processor                         1-701
          DoPreviousMenu      $C190     Close current menu                     1-702
          GotoFirstMenu       $C1BD     Close all menu levels                  1-703
          ReDoMenu            $C193     Draw the current menu                  1-704
          RecoverMenu         $C154     Erase the current menu                 1-705
          RecoverAllMenus     $C157     Erase all menus                        1-706
          DoIcons             $C15A     Draw a table of click boxes            1-707
          DoDlgBox            $C256     Window processor                       1-708
          RstrFrmDialogue     $C2BF     Close a window                         1-709
          IsMseInRegion       $C2B3     Check if mouse is inside a window      1-710
          Panic               $C2C2     Report system error                    1-711


          Miscellaneous
          -------------
          InitForIO           $C25C     Open serial communication              1-801
          DoneWithIO          $C25F     Close serial communication             1-802
          FirstInit           $C271     Initialize GEOS variables              1-803
          MainLoop            $C1C3     GEOS's main loop                       1-804
          InterruptMain       $C100     IRQ routine                            1-805
          BootGEOS            $C000     Reboot GEOS                            1-806
          StartAppl           $C22F     Run a program that is in memory        1-807
          EnterDesktop        $C22C     Load and run DESKTOP                   1-808
          ToBasic             $C241     Restart BASIC                          1-809
          CallRoutine         $C1D8     Perform an indirect jump               1-810
          DoInlineReturn      $C2A4     Perform a jump through a table         1-811
          StartMouseMode      $C14E     Initialize the mouse                   1-812
          MouseUp             $C18A     Turn on the mouse                      1-813
          MouseOff            $C18D     Turn off the mouse                     1-814
          ClearMouseMode      $C19C     Reset the mouse                        1-815
          Sleep               $C199     Set up a time delay                    1-816
          GetRandom           $C187     Change the random number               1-817
          GetSerialNumber     $C196     Who knows what this routine does???    1-818


          Processes
          ---------
          InitProcesses       $C103     Initialize a table of recurring
                                             timed events                      1-901
          EnableProcess       $C109     Force a recurring timed event to run   1-902
          RestartProcess      $C106     Enable a recurring timed event         1-903
          FreezeProcess       $C112     Stop a recurring timed event's timer   1-904
          BlockProcess        $C10C     Prevent a recurring timed event from
                                             running                           1-905
          UnblockProcess      $C10F     Allow a recurring timed event to
                                             execute                           1-906
          UnfreezeProcess     $C115     Start a recurring timed event's
                                             timer                             1-907





          Chapter 1: 
          GEOS Kernal Routines

 
          Math routines
          ------------------------------------------------------------------


                                                                        1-001
          Function Name: DNegate
          Purpose: Negates a 16 bit value.
          Call address: $C172
          Input requirements:
               X         The address of the 16 bit integer
          Output:
               X         The address of the 16 bit result.
          Description:  This  routine is one of the GEOS math  routines.  X
          points to a 16 bit value which is negated.  The value of X is not
          affected.


                                                                        1-002
          Function Name: Ddiv
          Purpose: Unsigned 16 bit by 16 bit division.
          Call address: $C169
          Input requirements:
               Y          The address of the 16 bit divisor.
               X          The address of the 16 bit dividend.
          Output:
               X          The address of the 16 bit quotient.
               $12-$13 R8 The 16 bit remainder.
          Description: This routine is one of the GEOS math routines. X and
          Y  each have the address of a term in the division.  The quotient
          is  stored in place of the original dividend that X  pointed  to.
          The dividend is left untouched.


                                                                        1-003
          Function Name: DMult
          Purpose: Unsigned 16 bit by 16 bit multiply.
          Call address: $C166
          Input requirements:
               Y         The address of the 16 bit multiplier.
               X         The address of the 16 bit multiplicand.
          Output:
               X         The address of the 16 bit result.
          Description: This routine is one of the GEOS math routines. X and
          Y each have  the  address  of a term in the  multiplication.  The
          result is  stored  in  place of the  original multiplicand that X
          pointed to.  The multiplier pointed to by Y is untouched.


                                                                        1-004
          Function Name: BMult
          Purpose: Unsigned 8 bit by 16 bit multiply.
          Call address: $C163
          Input requirements:
               Y         The address of the 8 bit multiplier.
               X         The address of the 16 bit multiplicand.
          Output:
               X         The address of the 16 bit product.
          Description: This routine is one of the GEOS math routines. X and
          Y  each  have the address of a term in  the  multiplication.  The
          result  is  stored in place of the original multiplicand  that  X
          pointed  to.  The byte following the multiplier is set  to  zero,
          then control passes to DMult.


                                                                        1-005
          Function Name: BBMult
          Purpose: Unsigned 8 bit by 8 bit multiply.
          Call address: $C160
          Input requirements:
               Y         The address of the multiplier.
               X         The address of the multiplicand.
          Output:
               X         The address of the 16 bit product.
          Description: This routine is one of the GEOS math routines. X and
          Y  each  have the address of a term in  the  multiplication.  The
          result  is  stored in place of the original multiplicand  that  X
          pointed to.  The value that Y points to is left untouched.


                                                                        1-006
          Function Name: DSdiv
          Purpose: Signed 16 bit by 16 bit division.
          Call address: $C16C
          Input requirements:
               Y          The address of the 16 bit divisor.
               X          The address of the 16 bit dividend.
          Output:
               X          The address of the 16 bit quotient.
               $12-$13 R8 The 16 bit remainder.
          Description: This routine is one of the GEOS math routines. X and
          Y each have the address of a term in the division. Both terms are
          made positive with Dabs. Ddiv is then called; if the result of
          the division should be negative, DNegate is called. The quotient is
          stored  in place of the original dividend that X pointed to.  The
          dividend  is left untouched.  The remainder is always a  positive
          integer.


                                                                        1-007
          Function Name: Dabs
          Purpose: 16 bit absolute value.
          Call address: $C16F
          Input requirements:
               X         The address of the 16 bit integer.
          Output:
               X         The address a positive 16 bit integer.
          Description:  This  routine is one of the GEOS math  routines.  X
          points to a 16 bit value which if found to be negative,  DNegate is
          called to make it positive.


                                                                        1-008
          Function Name: Ddec
          Purpose: Decrements a 16 bit value.
          Call address: $C175
          Input requirements:
               X         The address of the 16 bit integer.
          Output:
               X         The address of the 16 bit result.
          Description:  This  routine is one of the GEOS math  routines.  X
          points to a 16 bit value which is decremented by 1.


                                                                        1-009
          Function Name: DShiftLeft
          Purpose: 16 bit multiple arithmetic shift lefts.
          Call address: $C15D
          Input requirements:
               Y         The shift count.
               X         The address of the 16 bit value to be shifted.
          Output:
               X         Result of shifts.
          Description: This routine is one of the GEOS math routines. X has
          the  address  of a 16 bit integer in zero page,  which is  to  be
          shifted left by the count in Y.



                                                                        1-010
          Function Name: DShiftRight
          Purpose: 16 bit multiple logical shift rights.
          Call address: $C262
          Input requirements:
               Y         The shift count.
               X         The address of the 16 bit value to be shifted.
          Output:
               X         Result of shifts.
          Description: This routine is one of the GEOS math routines. X has
          the  address  of a 16 bit integer in zero page,  which is  to  be
          shifted right by the count in Y.



                                                                        1-011
          Function Name: CRC
          Purpose: Compute a checksum for a data region.
          Call address: $C20E
          Input requirements:
               $02-$03 R0 Pointer to data region.
               $04-$05 R1 Length of region.
          Output:
               $06-$07 R2 Checksum of region.
          Description:  This  routine is called by the bootup  routines  to
          compute  the  checksum  of GEOS BOOT.  This checksum is  used  to
          create the interrupt vector address.  The reason for this was  to
          prevent  piracy.  This  can be used to check the integrity  of  a
          memory region.  This is actually more of a CRC computation then a
          checksum and the formula is a little too complex to explain here.


          Memory Manipulation Routines
          ------------------------------------------------------------------



                                                                        1-101
          Function Name: InitRam
          Purpose: Uses a table to set various memory locations in a
                   uniform manner.
          Call address: $C181
          Input requirements:
               $02-$03 R0 Address of a data table.
          Description:  This  routine  allows many memory locations  to  be
          specified  and set in an orderly manner.  The format of the  data
          table is as follows:
               #bytes    Description
                  2      Address to store values at.
                  1      # of values that follow.
                  ?      Values to be stored at the designated memory
                         region.
                 ...     More definitions.
                  2      An address of $0000 ends the table.



                                                                        1-102
          Function Name: MoveData
          Purpose: Intelligent block move.
          Call address: $C17E
          Input requirements:
               $02-$03 R0 The source address.
               $04-$05 R1 The destination address.
               $06-$07 R2 The length of the region to be moved.
          Description:  This  routine  will  perform  an  intelligent,  i.e.
          nonconflicting,  block move of memory.  If an attempt is made  to
          move a block of memory to a destination that is within the block,
          the  transfer  is  done from back to front so as to  prevent  the
          conflict, or 'ripple effect'.



                                                                        1-103
          Function Name: i_MoveData
          Purpose: Identical to MoveData, but with inline data.
          Call address: $C1B7
          Description:  This routine uses the inline data to set everything
          up before calling MoveData. For example:
                JSR i_MoveData
               .word Source address
               .word Destination address
               .word Length of transfer
               Control returns here upon completion.



                                                                        1-104
          Function Name: FillRam
          Purpose: Fills a memory region with a specified byte.
          Call address: $C17B
          Input requirements:
               $02-$03 R0 The length of the region.
               $04-$05 R1 The address of the region.
               $06 R2L    The byte to fill the region with.
          Description: A simple loop fills memory with the specified byte.



                                                                        1-105
          Function Name: i_FillRam
          Purpose: Identical to FillRam, but with inline data.
          Call address: $C1B4
          Description:   This  routine  takes  the  inline  data  and  sets
          everything up before calling FillRam. For example:
                JSR i_FillRam
               .word Length of region
               .word Address of region
               .byte Byte to fill memory with
               Control returns here upon completion.



                                                                        1-106
          Function Name: ClearRam
          Purpose: Fills a memory region with zeroes.
          Call address: $C178
          Input requirements:
               $02-$03 R0 The length of the region.
               $04-$05 R1 The address of the region.
          Description:  Memory  is  filled with zeroes by storing a $00  at
          location $06 and calling FillRam.



                                                                        1-107
          Function Name: CmpString
          Purpose: Compare two strings for equality.
          Call address: $C26B
          Input requirements:
               X         Address of a zero page pointer.
               Y         Address of a zero page pointer.
          Output:
               Z flag    Set accordingly.
          Description:  The  X and Y registers point to zero page pointers.
          The two strings are compared up to a zero byte. The Z flag is set
          accordingly.



                                                                        1-108
          Function Name: CopyString
          Purpose: Copy a string.
          Call address: $C265
          Input requirements:
               X         Address of zero page source pointer.
               Y         Address of zero page destination pointer.
          Description:  The  X and Y registers point to zero page pointers.
          Data is copied up to and including a zero byte.  This routine  is
          used to copy strings by setting A to zero and calling CopyFString.



                                                                        1-109
          Function Name: CmpFString
          Purpose: Compares two blocks of memory for a fixed length.
          Call address: $C26E
          Input requirements:
               A         Byte count.
               X         Address of zero page source pointer.
               Y         Address of zero page destination pointer.
          Output:
               Z flag    Set accordingly.
          Description: The X and Y registers point to zero page pointers. A
          has  the  number of bytes to be compared (1-255).  If A is  zero,
          this routine will compare up to and including a zero byte.  The Z
          flag is set accordingly. See CmpString.



                                                                        1-110
          Function Name: CopyFString
          Purpose: Copy a block of memory.
          Call address: $C268
          Input requirements:
               A         Byte count.
               X         Address of zero page source pointer.
               Y         Address of zero page destination pointer.
          Description:  The  X and Y registers point to zero page pointers.
          A  has  the number of bytes to be transferred (1-255).  If  A  is
          zero, this routine will copy up to and including a zero byte. See
          CopyString.



                                                                        1-111
          Function Name: StashRAM
          Purpose: Copy a block of memory into an REU from main memory
          Call address: $C2C8
          Input requirements:
               $02-$03 R0 Pointer to an address in main memory
               $04-$05 R1 Address within the 64k REU bank addressed
               $06-$07 R2 Number of bytes to swap, fetch, verify, etc.
               $08 R3L    REU 64k bank to work with
          Output:
               X          Error code
               A          REU status
          Description:  The Y register is loaded with $90, and DoRamOp (see blow)
          is called.



                                                                       1-112
          Function Name: FetchRAM
          Purpose: Copies a block of memory from an REU into main memory
          Call address: $C2CB
          Input requirements:
               $02-$03 R0 Pointer to an address in main memory
               $04-$05 R1 Address within the 64k REU bank addressed
               $06-$07 R2 Number of bytes to fetch
               $08 R3L    REU 64k bank to work with
          Output:
               X          Error code
               A          REU status
          Description:  The Y register is loaded with $91, and DoRamOp (see blow)
          is called.



                                                                       1-113
          Function Name: SwapRAM
          Purpose: Swaps a block of main memory with an REU block
          Call address: $C2CE
          Input requirements:
               $02-$03 R0 Pointer to an address in main memory
               $04-$05 R1 Address within the 64k REU bank addressed
               $06-$07 R2 Number of bytes to swap
               $08 R3L    REU 64k bank to work with
          Output:
               X          Error code
               A          REU status
          Description:  The Y register is loaded with $92, and DoRamOp (see blow)
          is called.



                                                                       1-114
          Function Name: VerifyRAM
          Purpose: Verifies (compares) a block of memory to one in an REU
          Call address: $C2D1
          Input requirements:
               $02-$03 R0 Pointer to an address in main memory
               $04-$05 R1 Address within the 64k REU bank addressed
               $06-$07 R2 Number of bytes verify
               $08 R3L    REU 64k bank to work with
          Output:
               X          Error code
               A          REU status
          Description:  The Y register is loaded with $93, and DoRamOp (see blow)
          is called.



                                                                        1-115
          Function Name: DoRamOp
          Purpose: Move memory to and from an REU
          Call address: $C2D4
          Input requirements:
               $02-$03 R0 Pointer to an address in main memory
               $04-$05 R1 Address within the 64k REU bank addressed
               $06-$07 R2 Number of bytes to swap, fetch, verify, etc.
               $08 R3L    REU 64k bank to work with
               Y          REU command to execute (see below)
          Output:
               X          Error code
               A          REU status
          Description:  The Y register contains $90 to store, $91 for a fetch,
          $92 for a memory swap, and $11 to verify (compare).  R0 and R2 tell
          this routine the block of main memory to store, swap, fetch, or 
          verify.   R3L and R1 combine to form a 3-byte address within the REU
          to work with.



          Text and fonts
          ------------------------------------------------------------------



                                                                        1-201
          Function Name: PutChar
          Purpose: Displays a character on the screen.
          Call address: $C145
          Input requirements:
               A           The character to be printed.
               $02-$03 R0  Pointer to extra data (Used by a few control
                           characters, not needed otherwise).
               $05 R1H     The row for printing (1 above the underline).
               $18-$19 R11 The column to start printing.
               $33         windowTop: The top margin (Usually 0).
               $34         windowBottom: The bottom margin (Usually 199).
               $35-$36     leftMargin: The left margin.
               $37-$38     rightMargin: The right margin.
          Preparatory routines: UseSystemFont or LoadCharSet
          Errors: Branches through $84AB-$84AC (StringFaultVec) if right 
          margin is exceeded.
          Description:  This  routine  displays  a  character  in  a  given
          location  in  the  current font and  style.  The  style  byte  in
          location $2E (currentMode) is coded as follows:
                 Bit      Description
                  7       Underline
                  6       Boldface
                  5       Reversed
                  4       Italics
                  3       Outlined
          Either UseSystemFont or LoadCharSet must be called prior to using 
          this   routine,  in   order   to   set  up   the  font  pointers.  
          UseSystemFont  is  called  during  GEOS's  bootup  procedure,  as  
          well as by  the  menu  processor. Several control characters have 
          special  properties.  Those  which  require  a  data  pointer are 
          marked with an asterisk.

                              Control Character Table

               Ctrl-H  Delete previous character.
		       STA char width in realSize ($8807) first
               Ctrl-I  Tab.
               Ctrl-J  Move straight down a line.
               Ctrl-K  Set text cursor to 0,0.
               Ctrl-L  Move straight up a line.
               Ctrl-M  Move to the beginning of the next line.
               Ctrl-N  Turn on underlining.
               Ctrl-O  Turn off underlining.
             * Ctrl-P  Followed by a table suitable for GraphicsString.
               Ctrl-R  Turn on reverse video.
               Ctrl-S  Turn off reverse video.
             * Ctrl-T  Followed by 2 bytes which specify the new column.
             * Ctrl-U  Followed by a byte which specifies the new row.
             * Ctrl-V  Followed by 3 bytes which specify the new print 
                       position.
             * Ctrl-W  Skips the next 3 bytes.
               Ctrl-X  Turn on Boldface.
               Ctrl-Y  Turn on Italics.
               Ctrl-Z  Turn on Outline.
               Ctrl-  Turn off all effects, return to plain text.

          Those  entries  marked with an asterisk (*) should only  be  used
          from PutString because they require $02-$03 R0 to be a pointer to 
          get extra data.  As with GraphicsString,  Ctrl-P must be the last 
          command  because  the  zero  byte that terminates  GraphicsString  
          will  terminate PutString.



                                                                        1-202
          Function Name: SmallPutChar
          Purpose: Draws a character.
          Call address: $C202
          Input requirements:
               A           The ASCII value of the character.
               $05 R1H     Row to print on (1 above the underline).
               $18-$19 R11 Column to print in.
               $33         windowTop: The top margin (Usually 0).
               $34         windowBottom: The bottom margin (Usually 199).
          Description: This routine is not exactly the same as PutChar. This
          routine  does not process control characters at all.  It also does
          not  check  left and right margins at all.  It only checks top and
          bottom margins so that it stays on screen.



                                                                        1-203
          Function Name: PutDecimal
          Purpose: Display an unsigned 16 bit integer.
          Call address: $C184
          Input requirements:
               A          Control value (See description).
               $02-$03 R0 The value to be displayed.
          Description:  This  routine  converts  the value at  $02-$03 R0 to
          decimal ASCII and displays it using PutChar.  The control value in
          A is defined as follows:
               bit 7     0 - right justify the number.
                         1 - left justify the number, i.e. no justify.
               bit 6     0 - print leading zeroes.
                         1 - skip leading zeroes.
               bits 0-5  The field width in pixels for right justification.



                                                                        1-204
          Function Name: PutString
          Purpose: Displays an entire string of text.
          Call address: $C148
          Input requirements:
               $02-$03 R0  Pointer to text string.
               $05 R1H     The row for printing (1 above the underline).
               $18-$19 R11 The column in which to start printing.
               $33         windowTop: The top margin (Usually 0).
               $34         windowBottom: The bottom margin (Usually 199).
               $35-$36     leftMargin: The left margin.
               $37-$38     rightMargin: The right margin.
          Preparatory routines: UseSystemFont or LoadCharSet
          Errors: Branches through $84AB-$84AC (StringFaultVec) if right 
          margin is exceeded.
          Description:  This routine calls PutChar to display each character
          in a string. The string is terminated by a zero byte.  Be sure to
          subtract 6 from R1H for a GetString in the same place.  Add 2 to
          underline for proper positioning.



                                                                        1-205
          Function Name: i_PutString
          Purpose: Identical to PutString, but with inline code.
          Call address: $C1AE
          Input requirements:
               $35-$36   leftMargin: The left margin.
               $37-$38   rightMargin: The right margin.
          Preparatory routines: UseSystemFont or LoadCharSet
          Errors: Branches through $84AB-$84AC (StringFaultVec) if right 
          margin is exceeded.
          Description:  This routine creates a pointer to the  text,  calls
          PutString, then returns to the code immediately following the text.
                JSR i_PutString
               .word The column to start printing in
               .byte Row for line of print (1 above the underline)
               .byte Text to be displayed
               .byte 0
               Control returns here after text is printed.



                                                                        1-206
          Function Name: GetNextChar
          Purpose: Get a key from the keyboard.
          Call address: $C2A7
          Output:
               A         Character or $00 if there are none.
          Description: This routine takes a key from  the  keyboard buffer,
          if there is one. If there are no characters in the buffer, then a
          zero is returned.



                                                                        1-207
          Function Name: GetString
          Purpose: Input a line of text from the user.
          Call address: $C1BA
          Input requirements:
               $02-$03 R0  Address of text and buffer.
               $04 R1L     Flag byte ($87D3).
               $05 R1H     Row to print text on (1 above the underline).
               $06 R2L     Maximum length of input.
               $0A-$0B R4  Vector for user routine for right margin exceeded
                           (optional).
               $18-$19 R11 Column to start printing text at.
               $84A3-$84A4 keyVector: Address for CR entered.
          Output:
               $24-$25     string: Pointer to text buffer (from $02-$03 R0).
               Buffer will be modified according to the user's input.
               $84A3-$84A4 keyVector: Cleared to $0000.
          Description:  This routine is rather powerful. It displays a line
          of text,  if there was any text to display.  Then the text cursor
          is turned on. Several of the jump vectors are used: $84AB - $84AC  
          (StringFaultVec) is the vector for the right margin being exceeded.
          $84A9-$84AA (otherPressVec)  is  the vector  for a character being 
          typed.  $84A3- $84A4 (keyVector)  is the  vector for CR  entered.  
          After everything  is set  up, control  returns  to  the  caller;  
          however,  the input is handled by the interrupt drivers. When a CR 
          is entered, control goes through the  vector  at $84A3-$84A4.  The 
          flag byte at  location  $04 R1L is copied to $87D3 and has the 
          following property:  If bit 7 is set, then  use the user's routine 
          whose address is stored at locations $0A-$0B R4 for the right margin 
          is exceeded routine.  Add 6 to R1H for a PutString in the same
          place.



                                                                        1-208
          Function Name: InitTextPrompt
          Purpose: Makes a vertical bar cursor sprite.
          Call address: $C1C0
          Input requirements:
               A         The height of the cursor minus 1 (0-41)
          Output:
               Sprite block #41 ($8A40-$8A7E) is made into a vertical bar
               of a given height.
          Description:  Given the desired height, a vertical bar is created
          in the sprite block.  If the height is greater than 21,  then the
          height  is  halved  and the sprite is  Y-expanded.  No  check  is
          performed on the height. If a height greater than 41 is used then
          the memory for next few sprites will be affected.



                                                                        1-209
          Function Name: PromptOn
          Purpose: Turn on text cursor.
          Call address: $C29B
          Input requirements:
               $84BE-$84BF stringX: Column to place cursor in.
               $84C0       stringY: Row to place cursor on.
          Output:
               $84B4       alphaFlag: Bit 6 is set.
          Description: Turns on sprite 1 and positions it. It also sets bit
          6  of  location  $84B4.  The blink rate is set to  60,  once  per
          second. Sprite 1 is the text cursor for GEOS.



                                                                        1-210
          Function Name: PromptOff
          Purpose: Turn off text cursor.
          Call address: $C29E
          Output:
               $84B4     alphaFlag: Bit 6 is cleared.
          Preparatory routines: PromptOn
          Description:  Sprite 1 (GEOS's text cursor) is turned off,  bit 6
          of location $84B4 is reset. The blink rate is set to 60 (once per
          second).



                                                                        1-211
          Function Name: UseSystemFont
          Purpose: Selects the Berkeley Softworks font.
          Call address: $C14B
          Output:
               $26       baselineOffSet: # pixels above line of print.
               $27-$28   curSetWidth: The number of bytes in the bit stream.
               $29       curHeight: The point size.
               $2A-$2B   curIndexTable: The pointer to the table of indices 
                         into the bit stream.
               $2C-$2D   curDataPntr: The pointer to the bit stream.
          Description:  This routine simply copies the font header data for
          the BSW font to zero page for use by PutChar and PutString.



                                                                        1-212
          Function Name: LoadCharSet
          Purpose: Change the current font.
          Call address: $C1CC
          Input requirements:
               $02-$03 R0 Pointer to font header in memory.
          Output:
               $26       baselineOffset: # pixels above line of print.
               $27-$28   curSetWidth: The number of bytes in the bit stream.
               $29       curHeight: The point size.
               $2A-$2B   curIndexTable: Pointer to table of bit stream indices.
               $2C-$2D   curDataPtr: Pointer to the bit stream.
          Description: This routine simply copies the header block from the
          font to zero page.  This makes the font the current font for  all
          character output. (See PutChar, PutString and i_PutString).



                                                                        1-213
          Function Name: GetRealSize
          Purpose: Get statistics for a character.
          Call address: $C1B1
          Input requirements:
               A         The character.
          Output:
               A         The position of the underline.
               Y         The character's width.
               X         The character's height.
          Description:  Given the ASCII value of a character,  this routine
          computes and returns the height and width, taking the style  into
          account. The # pixels above the underline for the present font is
          also returned.



                                                                        1-214
          Function Name: GetCharWidth
          Purpose: Returns the width of a character.
          Call address: $C1C9
          Input requirements:
               A         The ASCII value of the character.
          Output:
               A         The width of the character.
          Description:  This routine simply takes the difference of the bit
          stream indices to get the characters width.  The delete character
          has  its  width  loaded from $8807.  This routine  is  called  by
          GetRealSize.


          Low level disk routines
          ------------------------------------------------------------------



                                                                        1-301
          Function Name: SetDevice
          Purpose: Set current drive.
          Call address: $C2B0
          Input requirements:
               A         Device number of drive (8-11).
          Output:
               $BA       curDevice: Set to new device number.
               $8489     curDrive: Set to new drive number.
          Description:  If  the  drive being specified is not  the  current
          drive then ExitTurbo is called to clear the current  drive.  Then
          locations $BA and $8489 are set to the new drive number. No other
          locations  are affected,  nor is anything actually done with  the
          drive.



                                                                        1-302
          Function Name: ChangeDiskDevice
          Purpose: Change the device number of a drive.
          Call address: $C2BC
          Input requirements:
               A           New device number for drive.
               $8489       curDrive: Current drive number.
          Output:
               $BA         curDevice: New device number.
               $8489       curDrive: New device number.
               $8492-$8495 turboFlags: Appropriate bytes are reset and set.
          Errors: See appendix I.
          Description: The current drive is made ready, then the new device
          number is sent to turbodos which will change it.  This results in
          the  drive being set as the current drive but with a  new  device
          number,  and  with turbodos up and running.  The status bytes  at
          $8492-$8495 are changed, the old one is reset and the new one has
          bits 6 and 7 set.



                                                                        1-303
          Function Name: OpenDisk
          Purpose: Opens a disk to GEOS.
          Call address: $C2A1
          Input requirements:
               $8489       curDrive: Current drive number.
          Output:
               $848B       isGEOS: $00/$FF Geos format or not.
               $841E-$8465 Appropriate buffer will have disk's name.
          Errors: See Appendix I.
          Description:  The current drive is initialized by calling NewDisk.
          GEOS  format is checked for,  and the disk's name is copied  into
          the appropriate buffer at $841E-$8465.



                                                                        1-304
          Function Name: NewDisk
          Purpose: Initializes a drive.
          Call address: $C1E1
          Input requirements:
               $04 R1L    Track to position the disk drive head at.
               $05 R1H    Sector to position the disk drive head at.
          Errors: See Appendix
          Description:  Makes sure that current drive has turbodos running.
          It also positions the head over a particular sector.



                                                                        1-305
          Function Name: EnterTurbo
          Purpose: Sets up a drive with turbodos.
          Call address: $C214
          Input requirements:
               $8489     curDrive: Current drive number.
          Errors: See Appendix I.
          Description:  This routine initializes the current drive, sending
          turbodos if necessary.  It then causes the drive to run turbodos.
          This routine is called by several of the disk I/O routines,  most
          notably are  GetBlock and PutBlock.  Upon initializing the drive, 
          the  drive's status  byte is set  to the  appropriate value.  The  
          status bytes are stored  at  $8492-$8495 and  have the  following  
          bit definitions:
                         Bit 7     Turbodos is loaded.
                         Bit 6     Turbodos is running.



                                                                        1-306
          Function Name: ExitTurbo
          Purpose: Turn off turbodos.
          Call address: $C232
          Input requirements:
               $8489     curDrive: Current drive number.
          Description: Turbodos is terminated in the current drive.



                                                                        1-307
          Function Name: PurgeTurbo
          Purpose: Clear the drive ready status.
          Call address: $C235
          Input requirements:
               $8489     curDrive: Current drive number.
          Output:
               Appropriate status byte is reset.
          Description:  This  routine  terminates turbodos in  the  current
          drive, and resets the drive status byte at $8492-$8495.



                                                                        1-308
          Function Name: GetDirHead
          Purpose: Read track 18, sector 0 from the disk.
          Call address: $C247
          Output:
               $04 R1L     Track number.
               $05 R1H     Sector number.
               $0A-$0B R4  $8200 (curDirHead), address of buffer area.
               $8200-$82FF curDirHead: Data from track 18 sector 0.
          Errors: See Appendix I.
          Description: This routine sets up the pointers for GetBlock, then
          calls  it to read the sector.  This is generally used to get  the
          BAM into memory.



                                                                        1-309
          Function Name: PutDirHead
          Purpose: Write track 18 sector 0 back to disk.
          Call address: $C24A
          Input requirements:
               $8200-$82FF curDirHead: Data for track 18 sector 0.
          Output:
               $04 R1L     $12, track number.
               $05 R1H     $00, sector number.
               $0A-$0B R4  $8200, address of buffer area.
          Errors: See Appendix I.
          Description:  This  routine sets up the pointers for PutBlock,  then
          calls  it to write the sector.  This is generally used to  update
          the BAM on the disk.



                                                                        1-310
          Function Name: GetBlock
          Purpose: Read a given track and sector.
          Call address: $C1E4
          Input requirements:
               $04 R1L    Track of sector to be read.
               $05 R1H    Sector number to be read.
               $0A-$0B R4 Pointer to buffer.
          Errors: See Appendix
          Description:  Loads and runs turbodos if it is not already there.
          Then reads the desired block from the disk into the buffer.



                                                                        1-311
          Function Name: PutBlock
          Purpose: Write a given track and sector.
          Call address: $C1E7
          Input requirements:
               $04 R1L    Track of sector to be written.
               $05 R1H    Sector number to be written.
               $0A-$0B R4 Pointer to buffer.
          Errors: See Appendix
          Description: Loads turbodos if it is not already there by calling
          EnterTurbo.  The desired block is then written to the disk by calling
          WriteBlock.  Finally VerWriteBlock is called to verify the sector.



                                                                        1-312
          Function Name: ReadBlock
          Purpose: Read a sector from the disk.
          Call address: $C21A
          Input requirements:
               $04 R1L    Track to be read.
               $05 R1H    Sector to be read.
               $0A-$0B R4 Pointer to buffer for data.
          Output:
               Data is read into the desired buffer.
          Preparatory routines: EnterTurbo, InitForIO
          Errors: See Appendix I.
          Description: This routine is called by GetBlock to read a sector. The
          difference  between  this  routine and GetBlock is  that  GetBlock  calls
          EnterTurbo  before  trying to read the sector.  This routine  assumes
          that the drive is ready with turbodos running.



                                                                        1-313
          Function Name: WriteBlock
          Purpose: Write a sector to the disk.
          Call address: $C220
          Input requirements:
               $04 R1L    Track number.
               $05 R1H    Sector number.
               $0A-$0B R4 Pointer to data buffer.
          Preparatory routines: EnterTurbo, InitForIO
          Errors: See Appendix I.
          Description:  This  routine  is to PutBlock,  as ReadBlock is  to  
          GetBlock. EnterTurbo must have been called prior to using this routine.



                                                                        1-314
          Function Name: VerWriteBlock
          Purpose: Conditionally write a sector to disk.
          Call address: $C223
          Input requirements:
               $04 R1L    Track number.
               $05 R1H    Sector number.
               $0A-$0B R4 Pointer to data buffer.
          Preparatory routines: EnterTurbo, InitForIO
          Errors: See appendix I.
          Description: The first thing this routine does is try to read the
          desired  sector.  If the read succeeds,  nothing  happens.  Three
          attempts are made at the read.   After these  read  attempts, the
          sector is written to the disk, by  calling WriteBlock.   If the write
          succeeded  without any errors,  then the routine restarts itself.
          It will make five attempts at this loop.  If after five attempts,
          the sector can not be read reliably,  an error 39  results.  This
          routine  is usually called after the sector has been written  out
          with  a  call to WriteBlock.  PutBlock calls this routine to verify  the
          sector.



                                                                        1-315
          Function Name: GetPtrCurDkNm
          Purpose: Compute the address of the disk's name.
          Call address: $C298
          Input requirements:
               X         Address to place pointer in.
               $8489     curDrive: Current drive number.
          Output:
               Location in zero page pointed to by X has the address of the
               current drive's name.
          Preparatory routines: OpenDisk
          Description:  This  routine  computes the address of the  current
          drive's  name  by multiplying the drive number (minus 8)  by  18,
          then  the  offset of $841E  (DrACurDkNm) is  added to  that.  The 
          result of the computation is stored at the zero page address in X.



                                                                        1-316
          Function Name: FindBAMBit
          Purpose: Check if a disk sector is in use.
          Call address: $C2AD
          Input requirements:
               $0E R6L     Track to be checked.
               $0F R6H     Sector to be checked.
               $8200-$82FF curDirHead: Track 18 sector 0, BAM buffer.
          Output:
               X          Index into BAM of the appropriate byte.
               Z flag     Set if the sector is in use.
               $11 R7H    Index to track's data in BAM.
               $13 R8H    Bit mask for the desired sector.
          Preparatory routines: GetDirHead
          Description: This routine is used by SetNextFree to test if a sector is
          already in use.



                                                                        1-317
          Function Name: SetNextFree
          Purpose: Allocate a block on the disk.
          Call address: $C292
          Input requirements:
               $08 R3L     Track to start scanning from.
               $09 R3H     Sector to start scanning from.
               $8200-$82FF curDirHead: Track 18 sector 0, BAM.
               $848C       interleave: Skew factor (default is 8).
          Output:
               $08 R3L    New track number.
               $09 R3H    New sector number.
          Errors: See appendix I.
          Description:  This  routine  expects that the BAM is  already  in
          memory.  It  scans  the  BAM starting at  a  specified  location,
          looking  for  a  free sector.  If one is found  it  is  returned,
          otherwise an error results.   The sector is allocated in the BAM,
          and the BAM must be updated to disk  afterwards in  order for the
          sector to remain allocated.



                                                                        1-318
          Function Name: BlkAlloc
          Purpose: Allocate enough sectors for a file.
          Call address: $C1FC
          Input requirements:
               $06-$07 R2 Number of bytes to be saved.
               $0E-$0F R6 Address of buffer for track and sector list.
               $8200      curDirHead: Directory header information
          Output:
               Buffer is filled with a set of tracks and sectors.
          Errors: See Appendix
          Description:  Given a byte count and a pointer to a buffer,  this
          routine  attempts  to allocate enough sectors.  This  routine  is
          called prior to saving a file.  The track and sector list is  not
          limited  in length,  available disk space not  withstanding.  The
          list   is  terminated  with  a  track  number  of  zero  and  the
          appropriate byte count in the sector location.  Note if an  error
          occurs  during the allocation,  the sectors already allocated are
          not  freed  up.  Either  this must be done or the  disk  must  be
          validated.



                                                                        1-319
          Function Name: NxtBlkAlloc
          Purpose: Allocate enough sectors for a file.
          Call address: $C24D
          Input requirements:
               $06-$07 R2 Number of bytes to be saved.
               $08 R3L    Track to start looking from.
               $09 R3H    Sector to start looking from.
               $0E-$0F R6 Address of buffer for track and sector list.
          Output:
               Buffer is filled with a set of tracks and sectors.
          Errors: See Appendix
          Description:  This  routine is almost identical to BlkAlloc.  As  a
          matter of fact, BlkAlloc falls into this routine after setting $08-
          $09 to point to track 1 sector 0. This routine allows the user to
          specify  where  on the disk to start looking  for  free  sectors,
          possibly speeding things up.



                                                                        1-320
          Function Name: SetGEOSDisk
          Purpose: Converts a disk to GEOS format.
          Call address: $C1EA
          Errors: See appendix
          Description:  This  routine  modifies  the  directory  header  to
          include the GEOS format message. It also allocates a sector to be
          used for the border from DESKTOP.



                                                                        1-321
          Function Name: ChkDkGEOS
          Purpose: Checks if a disk is GEOS format or not.
          Call address: $C1DE
          Input requirements:
               $0C-$0D R5 Pointer to buffer with track 18 sector 0.
          Output:
               Z          Set if non-GEOS, reset if GEOS format.
               A,$848B    isGEOS: $00 if non-GEOS, $FF if GEOS format.
          Description:  This  routine  expects that track 18 sector  0  has
          already  been  read.  It  compares 11 bytes,  starting  with  the
          173rd,  against 'GEOS format'.  It sets $848B so that the current
          drive is kept track of.



                                                                        1-322
          Function Name: CalcBlksFree
          Purpose: Counts the number of free blocks in the BAM that is in
                   RAM.
          Call address: $C1DB
          Input requirements:
               $0C-$0D R5 Pointer to buffer with track 18 sector 0.
          Output:
               $0A-$0B R4 The number of free blocks.
          Preparatory routines: GetDirHead
          Description:  This  routine expects that the BAM has already been
          read into memory.  All that it does is add up the number of  free
          blocks in each track.



                                                                        1-323
          Function Name: FreeBlock
          Purpose: Clear the BAM bit for a given track and sector
          Call address: $C2B9
          Input requirements:
               $0C-$0D R6 Track and Sector to free
               $8200      curDirHead: directory header
          Output:
               $8200      curDirHead: BAM bit is cleared
          Errors: See appendix
          Preparatory routines: GetDirHead
          Description:  This  routine expects that the BAM has already been
          read into memory.  The given BAM bit is cleared.


          High level file routines
          ------------------------------------------------------------------



                                                                        1-401
          Function Name: FindFTypes
          Purpose: Create a list of filenames.
          Call address: $C23B
          Input requirements:
               $0E-$0F R6  Pointer to buffer area for file names.
               $10 R7L     GEOS file type.
               $11 R7H     Maximum number of file names.
               $16-$17 R10 Pointer to class.
          Output:
               $11 R7H     Number of files not found.
               The table is filled with filenames.
          Errors: See Appendix I.
          Description:  This  is a very useful routine.  Given a GEOS  file
          type,  a  list of files with that type is created.  If the  class
          pointer  is non-zero then each file's info sector is checked  for
          proper  class.  This is how GEOpaint and GEOwrite can both create
          Application  Data  files  and not  see  each  others  files.  The
          filenames are text strings with zero byte terminators. Each entry
          is indexed with a multiple of 17 (16 byte filename max. plus zero
          byte). Location $11 R7H has the number of table entries unfilled.
          To  get the number of files actually found,  this value  must  be
          subtracted from the original maximum buffer length.



                                                                        1-402
          Function Name: FindFile
          Procedure: Lookup a filename in the directory.
          Call address: $C20B
          Input requirements:
               $0E-$0F R6 Pointer to filename.
               $886E      Flag byte.
          Output:
               $04 R1L     Track for directory sector.
               $05 R1H     Sector for directory sector.
               $0C-$0D R5  Pointer to file name entry.
               $8000-$80FF diskBlkBuf: Directory sector.
               $8400-$841D dirEntryBuf: Copy of directory entry.
          Errors: See Appendix
          Description:  This is a very useful routine.  Given a text string
          of a filename, this routine will find it in the directory. If the
          flag  byte  at $886E is $FF,  then both drives 8 and  9  will  be
          scanned if necessary. If the flag is $00, then the lookup is only
          to the current drive.  If there is only one drive, then this flag
          has  no effect.  The directory sector is loaded into a buffer  at
          $8000, and the track and sector are in locations $04 and $05. The
          particular  directory entry is copied to $8400 and the pointer to
          the entry in the buffer is stored at $0C-$0D R5.



                                                                        1-403
          Function Name: SaveFile
          Purpose: Save memory to a file.
          Call address: $C1ED
          Input requirements:
               $14-$15 R9 Pointer to information sector data.
               $16 R10L   # directory sectors to skip first.
          Errors: See Appendix
          Description: This routine will save memory to a file; each sector
          is verified after the write is finished.  The info sector has all
          the necessary information.  i.e.  start and stop  addresses,  file
          type  and  structure.  It  must also contain the address  of  the
          filename  string somewhere in memory, in the first two bytes.  If
          the file is a VLIR file, the memory is saved to chain 0. Location
          $16 R10L specifies  the number  of directory  sectors to skip for 
          SetGDirEntry and GetFreeDirBlk.



                                                                        1-404
          Function Name: WriteFile
          Purpose: Save memory to specified sectors on the disk.
          Call address: $C1F9
          Input requirements:
               $0E-$0F R6  Pointer to list of tracks and sectors to use.
               $10-$11 R7  Start address of memory to be saved.
          Preparatory routines: BlkAlloc
          Errors: See Appendix
          Description:  This routine is called by SaveFile to actually save the
          memory.  All  of the sectors should have already been  allocated.
          This  routine  stops saving memory when track 0 is found  in  the
          list of tracks and sectors.



                                                                        1-405
          Function Name: RenameFile
          Purpose: Rename a file.
          Call address: $C259
          Input requirements:
               $02-$03 R0  Pointer to new file name.
               $0E-$0F R6  Pointer to old file name.
          Output:
               $04 R1L     Track of directory sector.
               $05 R1H     Sector of directory sector.
               $0C-$0D R5  Pointer to file name in directory entry.
               $8400-$841D dirEntryBuf: Copy of old directory entry.
          Errors: See Appendix I.
          Description: This routine renames a file by calling  FindFile, then
          copying  the  new name into the entry.  Finally,  the  sector  is
          rewritten to the disk.



                                                                        1-406
          Function Name: DeleteFile
          Purpose: Delete a file from the disk.
          Call address: $C238
          Input requirements:
               $02-$03 R0 Pointer to file name.
          Errors: See appendix I.
          Description:  The  specified  file is deleted  from  the  current
          drive.



                                                                        1-407
          Function Name: FastDelFile
          Purpose: Delete a temporary file.
          Call address: $C244
          Input requirements:
               $08-$09 R3 Pointer to table of tracks and sectors.
               $0E-$0F R6 Pointer to file name.
          Errors: See appendix I.
          Description: This routine removes the file from the directory. It
          uses  the table of tracks and sectors to free up the sectors used
          by  the file.  This routine is used to clean up a temporary  file
          that was not completed.



                                                                        1-408
          Function Name: FreeFile
          Purpose: Deallocates all of a file's sectors.
          Call address: $C226
          Input requirements:
               $8400      dirEntryBuf: Current directory entry.
               $14-$15 R9 Pointer to directory entry.
          Preparatory routines: FindFile (Pointer must be copied).
          Errors: See Appendix I.
          Description:  Given  the  directory entry of a file,  all of  its
          sectors are  returned to the free  pool.  The  directory  pointer
          should  be  pointing to the directory entry at $8400 and not  the
          pointer returned by FindFile.  This is due to memory conflicts that
          will arise. This routine uses $8000-$82FF for its buffer areas.



                                                                        1-409
          Function Name: RstrAppl
          Purpose: Reload the SWAPFILE.
          Call address: $C23E
          Preparatory routines: LdDeskAcc
          Errors: See Appendix I.
          Description:  This routine reloads the SWAPFILE, then deletes it.
          The  last window description is reprocessed to restore the screen
          and  control  is  returned to the original  program  that  called
          LdDeskAcc.



                                                                        1-410
          Function Name: GetFile
          Purpose: Load and run a file.
          Call address: $C208
          Input requirements:
               $02 R0L     Flag byte (See description).
               $06-$07 R2  Optional data pointer.
               $08-$09 R3  Optional data pointer.
               $0E-$0F R6  Pointer to filename.
               $10-$11 R7  Load address (optional).
          Output:
               $8100-$81FF fileHeader: Info sector for file.
               $8300-$83FF fileTrScTab: Table of tracks and sectors loaded.
          Errors: See Appendix
          Description:  This routine loads and runs a given file.  The file
          must be one of the following GEOS types:
                         System File         Desk Accessory
                         Application         Application Data
                         Printer Driver      Input Driver
          The execution address is taken from the information sector. If it
          is zero,  the file is not executed, only loaded.  VLIR files have
          only  their  first chain loaded.  Desk Accessories swap  out  the
          memory  that  they use to  the  SWAPFILE.  Upon  completion,  the
          SWAPFILE  is  reloaded.  The  flag byte at location $02  has  two
          purposes.  This  first  is if bit 0 is set and the  file  was  an
          application, then it is not executed.  Also if bit 0 is set, then
          locations  $10-$11 R7 have the load address;  otherwise, the load
          address is taken from the information sector.  This bit does  not
          apply  to Desk Accessories.  If either bit 6 or 7 are  set,  then
          $06-$07  R2  points  to  16  bytes  which  are  copied  to  $8453 
          (dataDiskName), and $07-$08 point to 16 bytes which are copied to
          $8442 (dataFileName). 



                                                                        1-411
          Function Name: LdFile
          Purpose: Load a file.
          Call address: $C211
          Input requirements:
               $8400       dirEntryBuf - File directory entry.
               $14-$15 R9  Pointer to directory entry ($8400).
               $886B       Flag byte.
               $886C-$886D Load address.
          Output:
               $8100-$81FF fileHeader: Info sector for file.
               $8300-$83FF fileTrScTab: Table of tracks and sectors loaded.
          Preparatory routines: FindFile (Pointer must be copied)
          Errors: See Appendix
          Description:  This routine is called by GetFile to perform the load.
          This  routine does not try to execute the file loaded,  nor is it
          limited to the file types that GetFile is. However, this routine can
          not  be used to load Non-GEOS files because the info sector  must
          be  present.  If bit 0 of location $886B is set,  then  the  load
          address  is taken from locations $886C-$886D instead of the  info
          sector.  The  directory entry  pointer should point to $8400  and
          not  the  pointer  returned  by FindFile.  This is  due  to  memory
          conflicts that will arise.



                                                                        1-412
          Function Name: LdApplic
          Purpose: Load and possibly run a file.
          Call address: $C21D
               $02 R0L     Flag byte (See description).
               $06-$07 R2  Optional data pointer.
               $08-$09 R3  Optional data pointer.
               $0E-$0F R6  Pointer to filename.
               $10-$11 R7  Load address (optional).
          Output:
               $8100-$81FF fileHeader: Info sector for file.
               $8300-$83FF fileTrScTab: Table of tracks and sectors loaded.
          Errors: See Appendix
          Description:  This routine is called by GetFile to load  Application
          files.  Like LdFile, this routine is not limited to any particular
          file type, except that it also can not load a Non-GEOS file.  See
          GetFile  for a description of the flag byte,  data pointers and load
          address.



                                                                        1-413
          Function Name: LdDeskAcc
          Purpose: Load and run a file using the SWAPFILE.
          Call address: $C217
          Input requirements:
               $14-$15 R9  Pointer to directory entry.
          Output:
               $8100-$81FF fileHeader: Info sector for file (Modified).
               $8300-$83FF fileTrScTab: List of tracks and sectors loaded.
          Preparatory routines: FindFile (Pointer must be copied).
          Errors: See Appendix I.
          Description:  This routine is used to load Desk Accessories.  The
          info  sector is loaded to determine the necessary memory  region.
          This  region  is saved to a file called  'SWAPFILE',  whose  info
          sector  is the same as the file to be loaded.  The difference  is
          that the text field is cleared,  and the file type is System file
          (Type 4). RstrAppl must be eventually called to reload the SWAPFILE
          and  return  to normal operation.  The  directory  entry  pointer
          should  point to $8400, and the pointer returned by FindFile.  This
          is due to memory conflicts that will arise.



                                                                        1-414
          Function Name: ReadByte
          Purpose: Read a byte from a file.
          Call address: $C2B6
          Input requirements:
               $0C R5L    Index of last byte in buffer.
               $0D R5H    Index to next character in buffer.
               $0A-$0B R4 Pointer to disk buffer.
          Output:
               A         Character that was read.
          Errors: See Appendix I.
          Description:  The initial sector must have been read because  the
          first two bytes in the buffer are used to find the next track and
          sector.  Bytes  are read from the buffer until there are no more,
          then  the next sector is read from the disk.  This  can  continue
          until  the last character of the last sector is read.  After this
          an error 11 (End of file) will be returned.



                                                                        1-415
          Function Name: ReadFile
          Purpose: Load memory from disk.
          Call address: $C1FF
          Input requirements:
               $04 R1L    Initial track number.
               $05 R1H    Initial sector number.
               $06-$07 R2 Byte count of load.
               $10-$11 R7 Load address.
          Output:
               $0C R5L    Index to last sector loaded.
               $8300-     fileTrScTab: List of tracks and sectors  loaded.
          Preparatory routines: GetFHdrInfo
          Errors: See Appendix I.
          Description:  This routine assumes that the file has been located
          in the directory and that the initial track and sector are known.



                                                                        1-416
          Function Name: GetFreeDirBlk
          Purpose: Find a hole in the directory, or make one.
          Call address: $C1F6
          Output:
               Y            Index of hole in buffer.
               $04 R1L      Directory track number (Should be 18).
               $05 R1H      Directory sector number.
               $16 R10L     # directory sectors to skip first.
               $8000-$80FF  diskBlkBuf: Buffer for directory sector.
          Description:  This routine scans the disk's directory looking for
          a  deleted file, by first skipping a certain number  of  sectors.
          This  allows the  user to find a hole in a given  directory page.
          If one is not found in any  of the  available  directory sectors,
          then a new sector is added to the directory.



                                                                        1-417
          Function Name: SetGDirEntry
          Purpose: Creates a directory entry on the disk.
          Call address: $C1F0
          Input requirements:
               $14-$15 R9  fileHeader ($8100), required.
               $16 R10L    # of directory sectors to skip first.
               $8100-$81FF fileHeader: Information sector for file.
               $8300-      fileTrScTab: Track and sector list for file.
          Outputs:
               $8400-$841D dirEntryBuf: Directory entry.
               Directory entry is written to the disk.
          Preparatory routines: BlkAlloc
          Errors: See appendix
          Description: This routine is used by SaveFile and calls BldGDirEntry.
          Because  of this, assumptions are made.  The first  is  that  the
          information  sector  is  at $8100-$81FF and  that  $14-$15 R9 point
          there.  The  first  two bytes of the information sector  are  the
          address of the filename.  These are reset by this routine to $00,
          $FF.  Another  assumption made by this routine is that $8300 is a
          list of useable tracks and sectors; specifically, $8300-$8301 are
          the  track and sector for the information sector and  $8302-$8303
          are the track and sector of the first sector of the file.



                                                                        1-418
          Function Name: BldGDirEntry
          Purpose: Create a directory entry in memory.
          Call address: $C1F3
          Input requirements:
               $14-$15 R9  fileHeader ($8100), required.
               $8100-$81FF fileHeader: Information sector for file.
               $8300-      fileTrScTab: Track and sector list for file.
          Outputs:
               $8400-$841D dirEntryBuf: Directory entry.
          Preparatory routines: BlkAlloc
          Errors: See appendix
          Description:   See  SetGDirEntry  for  a  complete  list  of  all   the
          assumptions made by this routine.



                                                                        1-419
          Function Name: GetFHdrInfo
          Purpose: Get the load address of a file.
          Call address: $C229
          Input requirements:
               $14-$15 R9  Pointer to directory entry.
          Output:
               $04 R1L     Track of file's first sector.
               $05 R1H     Sector of file's first sector.
               $10-$11 R7  Load address for file.
               $8100-$81FF fileHeader: Info sector for file.
               $8300-$8301 fileTrScTab: Track and sector of info sector.
          Errors: See Appendix I.
          Description:  This  routine loads the info sector for a file into
          the  buffer at $8100 (fileHeader).  The load address is set from  
          $8147-$8148. This routine is called by all the load routines.



                                                                        1-420
          Function Name: FollowChain
          Purpose: Create a table of tracks and sectors.
          Call address: $C205
          Input requirements:
               $04 R1L    Initial track number.
               $05 R1H    Initial sector number.
               $08-$09 R3 Address of table to be created.
          Output:
               Table  pointed  to by $08-$09 is filled with all the  tracks
               and sectors linked to the initial sector.
          Errors: See Appendix
          Description:  Given  an initial track and  sector,  this  routine
          traces  a chain and returns a list of all the tracks and  sectors
          encountered.  This routine uses diskBlkBuf at $8000-$80FF to read
          the sectors.


          VLIR file support
          ------------------------------------------------------------------



                                                                        1-501
          Function Name: OpenRecordFile
          Purpose: Opens a VLIR file.
          Call address: $C274
          Input requirements:
               $02-$03 R0  Pointer to file name.
          Output:
               $04 R1L     Track of VLIR sector.
               $05 R1H     Sector of VLIR sector.
               $0C-$0D R5  Pointer to file's directory entry.
               $8100-$81FF fileHeader: File's VLIR sector.
               $8496       curRecord: Initial chain # (Should be 0).
               $8497       usedRecords: Number of chains.
               $8498       fileWritten: Set to $00. (VLIR file modified).
               $8499-$849A fileSize: File size.
               $886F       Track of file's directory entry.
               $8870       Sector of file's directory entry.
               $8871-$8872 Pointer to directory entry.
               $8873       Track for VLIR sector.
               $8874       Sector for VLIR sector.
          Errors: See Appendix I.
          Description:  This routine opens a VLIR file, and sets up all the
          variables associated with it. Only one VLIR file can be open at a
          time due to the fact that these variables are global.



                                                                        1-502
          Function Name: PointRecord
          Purpose: Get a specific VLIR chain.
          Call address: $C280
          Input requirements:
               A          VLIR chain number.
          Output:
               Y          Track of VLIR chain.
               $04 R1L    Track of VLIR chain.
               $05 R1H    Sector of VLIR chain.
               $8496      curRecord: Set to A.
          Preparatory routines: OpenRecordFile
          Errors: See Appendix I.
          Description: This routine gets the track and sector of a specific
          chain  in  the open VLIR file.  It does not check to see  if  the
          chain exists (i.e.  track is zero). It does check if this chain is
          greater  than  zero  and  less than the  number  of  VLIR  chains
          at $8497 (usedRecords). VLIR chains are numbered from 0 to N-1, 
          where N is the number of chains.



                                                                        1-503
          Function Name: PreviousRecord
          Purpose: Move to previous VLIR chain.
          Call address: $C27D
          Output:
               Y          Track of VLIR chain.
               $04 R1L    Track of VLIR chain.
               $05 R1H    Sector of VLIR chain.
               $8496      curRecord: Decremented by 1.
          Preparatory routines: OpenRecordFile
          Errors: See Appendix I.
          Description:  This  routine  gets  the track and  sector  of  the
          previous chain in the open VLIR file. It does not check to see if
          the chain exists (i.e. track is zero). It does check if this chain
          is greater than zero.



                                                                        1-504
          Function Name: NextRecord
          Purpose: Move to next VLIR chain.
          Call address: $C27A
          Output:
               Y          Track of VLIR chain.
               $04 R1L    Track of VLIR chain.
               $05 R1H    Sector of VLIR chain.
               $8496      curRecord: Incremented by 1.
          Preparatory routines: OpenRecordFile
          Errors: See Appendix I.
          Description:  This routine gets the track and sector of the  next
          chain  in  the open VLIR file.  It does not check to see  if  the
          chain exists (i.e. track is zero).  It does check if this chain is
          in range against $8497 (usedRecords).



                                                                        1-505
          Function Name: InsertRecord
          Purpose: Insert a new chain in a VLIR file.
          Call address: $C286
          Input requirements:
               $8496     curRecord: Current chain number.
          Output:
               $8497     usedRecords: Incremented by 1.
          Preparatory routines: OpenRecordFile
          Errors: See Appendix I.
          Description: A hole is opened up in the VLIR sector starting with
          the  current  chain.  The  hole  is  filled  with  $00,$FF.  This
          represents a null chain.



                                                                        1-506
          Function Name: AppendRecord
          Purpose: Append a new chain in a VLIR file.
          Call address: $C289
          Input requirements:
               $8496     curRecord: Current chain number.
          Output:
               $8496     curRecord: Incremented by 1.
               $8497     usedRecords: Incremented by 1.
          Preparatory routines: OpenRecordFile
          Errors: See appendix I.
          Description:  A  hole is opened up in the VLIR sector immediately
          following  the current chain.  The hole is filled  with  $00,$FF.
          This  represents  a  null chain.  This hole becomes  the  current
          chain.



                                                                        1-507
          Function Name: DeleteRecord
          Purpose: Remove a VLIR chain.
          Call address: $C283
          Input requirements:
               $8496     curRecord: VLIR chain number.
          Output:
               $8496     curRecord: Decremented if greater than or 
                         equal to $8497.
               $8497     usedRecords: Decremented by 1.
          Preparatory routines: OpenRecordFile
          Errors: See Appendix I.
          Description:  The  current  VLIR chain is removed from  the  VLIR
          sector,  and  all the following chains are moved  down  one.  The
          sectors associated with that chain are freed up.



                                                                        1-508
          Function Name: ReadRecord
          Purpose: Load a VLIR chain.
          Call address: $C28C
          Input requirements:
               $06-$07 R2  Maximum byte count of load.
               $10-$11 R7  Load address.
               $8496       curRecord: Current chain number.
          Output:
               $8302-$83FF fileTrScTab: Table of tracks and sectors loaded.
          Preparatory routines: OpenRecordFile
          Errors: See Appendix I.
          Description:  This  routine  loads the current chain  by  calling
          ReadFile.



                                                                        1-509
          Function Name: WriteRecord
          Purpose: Save memory to a VLIR chain.
          Call address: $C28F
          Input requirements:
               $06-$07 R2  Length of save.
               $10-$11 R7  Address of memory to be saved.
               $8496       curRecord: VLIR chain number.
          Output:
               $8300-$83FF fileTrScTab: Table of tracks and sectors saved to.
          Preparatory routines: OpenRecordFile
          Errors: See Appendix I.
          Description:  This  routine  saves a block of memory  to  a  VLIR
          chain. If the chain already existed, then it is deleted first. If
          the  length  of the save is 0,  then no save is  performed.  This
          would allow this routine to be used as a delete chain function.



                                                                        1-510
          Function Name: UpdateRecordFile
          Purpose: Update a VLIR file.
          Call address: $C295
          Output:
               $8498     fileWritten: Cleared to $00.
          Preparatory routines: OpenRecordFile
          Errors: See Appendix I.
          Description: This routine writes the open VLIR file's VLIR sector
          to  disk  and updates the file's directory entry on  disk  (Time,
          date and file size).  This operation is not performed if location
          $8498  is zero to start with.  That location is a flag that tells
          whether the file has been altered or not.  This routine is called
          by CloseRecordFile.



                                                                        1-511
          Function Name: CloseRecordFile
          Purpose: Close a VLIR file.
          Call address: $C277
          Output:
               $8873     Cleared to $00.
          Preparatory routines: OpenRecordFile
          Errors: See Appendix I.
          Description:  The  VLIR  sector is rewritten to the disk and  the
          directory  is  updated with a new time,  date and  file  size  by
          calling  UpdateRecordFile.  Location $8873 is the track number of
          the  VLIR sector.  By clearing it,  GEOS says that the file is no 
          longer in memory.


          Graphics
          ------------------------------------------------------------------



                                                                        1-601
          Function Name: GraphicsString
          Purpose: Process several graphics commands designated by a table.
          Call address: $C136
          Input requirements:
               $02-$03 R0 Pointer to the table of commands.
          Description: This routine executes  the graphic  commands present
          in a table. This routine is used by PutChar (Control-P),PutString (By
          calling  PutChar), and DoDlgBox (Command 15).  The  following  table
          describes the available commands.

                                Graphic Command Table

                Command   #Bytes  Description
                  $00       1     Stop, end of table.
                  $01       4     MOVEPENTO: Set column and row variables.
                                  .word COLUMN
                                  .byte ROW
                  $02       4     LINETO: Draw a line.
                                  .word DESTCOLUMN
                                  .byte DESTROW
                  $03       4     RECTAGLETO: Pattern fill a region.
                                  .word BOTRIGHTCOLUMN
                                  .byte BOTRIGHTROW
                  $04       1     No operation.
                  $05       2     NEWPATTERN: Set fill pattern.
                  $06       4+    ESC_PUTSTRING: Set position and display text. 
                                  MUST BE last command because the zero 
                                  byte that ends the text also ends this 
                                  command table.
                                  .word COLUMN
                                  .byte ROW
                                  .byte "Hello World!",0
                  $07       4     FRAME_RECTO: Draw a solid lined box.
                                  .word BOTRIGHTCOLUMN
                                  .byte BOTRIGHTROW
                  $08       3     PEN_X_DELTA: Add an offset to column variable.
                                  .word COLUMNOFFSET
                  $09       2     PEN_Y_DELTA: Add an offset to row variable.
                                  .byte ROWOFFSET
                  $0A       4     Add offsets to both column and row
                                  variables.
                                  .word COLUMNOFFSET
                                  .byte ROWOFFSET

          Command 1 is used to set the column and row variables used by all
          of the other commands which require two points. The format of the
          commands  is  that all of the necessary data follows the  command
          byte.  For example, the commands to erase the entire screen would
          look like this:
               .byte $05,$00
               .byte $01
               .word 0
               .byte 0
               .byte $03
               .word 320
               .byte 199
               .byte $00
          In the case of command 6,  after the column and row bytes in  the
          command comes the text that is to be displayed.  For example:
               .byte $06
               .word 50
               .byte 50
               .byte 'Hello world!'
               .byte $00



                                                                        1-602
          Function Name: i_GraphicsString
          Purpose: Identical to GraphicsString, but with inline data.
          Call address: $C1A8
          Description:  This routine takes an inline data table, creates  a
          pointer to it, then calls GraphicsString to process it. See 
          i_Rectangle for an example of inline data tables.



                                                                        1-603
          Function Name: SetPattern
          Purpose: Sets the current fill pattern.
          Call address: $C139
          Input requirements:
               A         The pattern number (0-31).
          Description:  This  routine sets the fill pattern used by  Rectangle,
          i_Rectangle.



                                                                        1-604
          Function Name: FrameRectangle
          Purpose: Draws the outline of a rectangular box in a given
                   pattern.
          Call address: $C127
          Input requirements:
               A          The actual bit pattern for the box.
               $06 R2L    The top margin.
               $07 R2H    The bottom margin.
               $08-$09 R3 The left margin.
               $0A-$0B R4 The right margin.
          Description:  This routine draws the outline of a rectangular box
          in  a given pattern.  This routine calls HorizontalLine and 
          VerticalLine to  draw the outline. See also GetScanLine.



                                                                        1-605
          Function Name: i_FrameRectangle
          Purpose: Identical to FrameRectangle, but with inline data.
          Call address: $C1A2
          Description:  This routine draws a solid outline of a box,  which
          is described by inline code. See i_Rectangle for an example.



                                                                        1-606
          Function Name: Rectangle
          Purpose: Fills a rectangular box with a selected design.
          Call address: $C124
          Input requirements:
               $06 R2L    The top margin.
               $07 R2H    The bottom margin.
               $08-$09 R3 The left margin.
               $0A-$0B R4 The right margin.
          Preparatory routines: SetPattern
          Description:  This  routine  fills a rectangular box in  a  given
          design.  This routine calls HorizontalLine repeatedly. See also 
          GetScanLine.



                                                                        1-607
          Function Name: i_Rectangle
          Purpose: Identical to Rectangle, but with inline data.
          Call address: $C19F
          Preparatory routines: SetPattern
          Description:  This routine is identical to Rectangle except that data
          that describes the box is part of the inline code.  For example:
                JSR i_Rectangle
               .byte Top margin
               .byte Bottom margin
               .word Left margin
               .word Right margin
               Control returns here after box is filled.



                                                                        1-608
          Function Name: RecoverRectangle
          Purpose: Copies a box from screen 2 to screen 1.
          Call address: $C12D
          Input requirements:
               $06 R2L    The top margin.
               $07 R2H    The bottom margin.
               $08-$09 R3 The left margin.
               $0A-$0B R4 The right margin.
          Description:  This  routine copies a box from screen 2 ($6000) to
          screen 1 ($A000).  Location $2F is unaffected. This routine calls
          RecoverLine repeatedly to copy each line of the box.



                                                                        1-609
          Function Name: i_RecoverRectangle
          Purpose: Identical to RecoverRectangle, but with inline data.
          Call address: $C1A5
          Description:  This  routine copies a box from screen 2 ($6000) to
          screen 1 ($A000).  The box descriptor is inline with the  calling
          code.  See i_Rectangle for an example.



                                                                        1-610
          Function Name: ImprintRectangle
          Purpose: Copies a box from screen 2 to screen 1.
          Call address: $C250
          Input requirements:
               $06 R2L    The top margin.
               $07 R2H    The bottom margin.
               $08-$09 R3 The left margin.
               $0A-$0B R4 The right margin.
          Description:  This  routine copies a box from screen 1 ($A000) to
          screen 2 ($6000).  Location $2F is unaffected. This routine calls
          RecoverLine repeatedly to copy each line of the box.



                                                                        1-611
          Function Name: i_ImprintRectangle
          Purpose: Identical to ImprintRectangle, but with inline data.
          Call address: $C253
          Description:  This  routine copies a box from screen 1 ($A000) to
          screen 2 ($6000).  The box descriptor is inline with the  calling
          code.  See i_Rectangle for an example.



                                                                        1-612
          Function Name: InvertRectangle
          Purpose: Inverts the pixels in a box.
          Call address: $C12A
          Input requirements:
               $06 R2L    The top margin.
               $07 R2H    The bottom margin.
               $08-$09 R3 The left margin.
               $0A-$0B R4 The right margin.
          Description:  This routine reverses the pixels in a given box  by
          repeatedly calling InvertLine. See also GetScanLine.



                                                                        1-613
          Function Name: RecoverLine
          Purpose: Copies a horizontal line from screen 2 to screen 1.
          Call address: $C11E
          Input requirements:
               $08-$09 R3 The left margin.
               $0A-$0B R4 The right margin.
               $18 R11L   The row number.
          Description:  This routine copies a horizontal line from screen 2
          ($6000) to screen 1 ($A000). Location $2F is unaffected.



                                                                        1-614
          Function Name: InvertLine
          Purpose: Inverts a horizontal line on the screen.
          Call address: $C11B
          Input requirements:
               $08-$09 R3 The left margin.
               $0A-$0B R4 The right margin.
               $18 R11L   The row number.
          Description:  This  routine reverses the pixels on  a  horizontal
          line on the hires screen. If the pixel was on it will now be off;
          if it was off it will now be turned on. See also GetScanLine.



                                                                        1-615
          Function Name: DrawLine
          Purpose: Draws, erases or copies a line on the hires screen.
          Call address: $C130
          Input requirements:
               N flag  C Flag   Operation
                  1       X     Copy
                  0       1     Draw
                  0       0     Erase
               $08-$09 R3 The column for the first endpoint.
               $0A-$0B R4 The column for the second endpoint.
               $18 R11L  The row for the first endpoint.
               $19 R11H  The row for the second endpoint.
          Description:  This  is a very versatile routine.  It can copy  an
          arbitrary  line  from one screen to another,  as well as draw  or
          erase lines.  This routine places no restrictions on the relative
          positions of the endpoints.  This routine calls DrawPoint to plot
          the points. See also GetScanLine.



                                                                        1-616
          Function Name: HorizontalLine
          Purpose: Draws a horizontal line on the screen.
          Call address: $C118
          Input requirements:
               A         The actual bit pattern for the line.
               $08-$09 R3 The left margin.
               $0A-$0B R4 The right margin.
               $18 R11L  The row number.
          Description:  This  routine draws a horizontal line on the  hires
          screen in a given pattern.  See also GetScanLine.



                                                                        1-617
          Function Name: VerticalLine
          Purpose: Draws a vertical line on the screen.
          Call address: $C121
          Input requirements:
               A          The actual bit pattern for the line.
               $08 R3L    The top margin.
               $09 R3H    The bottom margin.
               $0A-$0B R4 The right margin.
          Description:  This  routine  draws a vertical line on  the  hires
          screen in a given pattern. See also GetScanLine.



                                                                        1-618
          Function Name: GetScanLine
          Purpose: Computes the address of a given row on the hires
                   screens.
          Call address: $C13C
          Input requirements:
               X         The row number.
               $2F       dispBufferOn: See description.
          Output:
               $0C-$0D R5 Pointer to the row on the destination screen.
               $0E-$0F R6 Pointer to the row on the source screen.
          Description:  This routine computes the address of column 0 on  a
          given row of the hires screens. All of the graphics routines rely
          on this routine to get the address of the hires screens. They all
          take  the data pointed to by $0E-$0F and store their data to both
          $0C-$0D R5 and  $0E-$0F R6.  Location $2F determines which screen
          is pointed to by which pointer. This is as follows:
               Bit 7  Bit 6   $0C-$0D  $0E-$0F
                 0      0      $AF00    $AF00    Approximately the
                                                 middle of screen 1
                 0      1     Screen 2  Screen 2 ST_WR_BACK
                 1      0     Screen 1  Screen 1 ST_WR_FORE
                 1      1     Screen 1  Screen 2 (Default at reset)



                                                                        1-619
          Function Name: TestPoint
          Purpose: Tests the value of a point on the hires screen.
          Call address: $C13F
          Input requirements:
               $08-$09 R3 The column number.
               $18 R11L   The row number.
          Output:
               C flag is set to the value of the pixel.
          Description: Tests whether or not a given pixel is on or not. The
          carry flag is set to the value of the pixel.



                                                                        1-620
          Function Name: DrawPoint
          Purpose: Draws, erases or copies a pixel on the hires screen.
          Call address: $C133
          Input requirements:
               N flag  C Flag   Operation
                  1       X     Copy
                  0       1     Draw
                  0       0     Erase
               $08-$09 R3 The column number.
               $18 R11L   The row number.
          Description:  This  is a very versatile routine.  It can  copy  a
          point  from one screen to another,  as well as draw or erase  it.
          This routine is called by DrawLine to draw lines. See also GetScanLine.



                                                                        1-621
          Function Name: BitmapUp
          Purpose: Draws a click box on the screen.
          Call address: $C142
          Input requirements:
               $02-$03 R0 Pointer to the graphic data.
               $04 R1L    Column in characters.
               $05 R1H    The row in pixels.
               $06 R2L    The width in bytes.
               $07 R2H    The height in pixels.
          Description:  This  routine  draws a click box on the  screen.  A
          click box is a box like Ok,  Open, etc. These boxes are generally
          part  of  a window description.  The graphic data is in  a  coded
          format. This format consists of a code byte followed by 1 or more
          data bytes.
               1) Code bytes less than 128 mean  that the following byte is
                  to be repeated that many times.
               2) Code  bytes  ranging from 128 to 219 mean that if 128  is
                  subtracted  from  the code byte, then the  result is  the
                  number of data bytes that follow.
               3) Code bytes ranging from 220 to 225 are special. First 219
                  is  subtracted  from  the code byte,  the result  is  the
                  number of bytes in the pattern.  Following this code byte
                  is a repetition count for the pattern. Following this are
                  the  bytes  that  constitute  the  pattern.  These  could
                  include either of the previous two code types.



                                                                        1-622
          Function Name: i_BitmapUp
          Purpose: Identical to BitmapUp, but with inline data.
          Call address: $C1AB
          Description:  This  routine  takes  a click box  descriptor  from
          inline  data and draws it.  The inline data does NOT include  the
          processing vector, i.e.
                JSR DRWCB2
               .word address of graphic image
               .byte start column in bytes
               .byte start margin in pixels
               .byte width of box in bytes
               .byte height of box in pixels
               Control returns here after the box is drawn.



                                                                        1-623
          Function Name: BitmapClip
          Purpose: Draw a section of a coded graphic image.
          Call address: $C2AA
          Input requirements:
               $02-$03 R0  Pointer to graphic image data.
               $04 R1L     Column to start on, in bytes.
               $05 R1H     Row to start drawing the image on.
               $06 R2L     Image width in bytes (<= actual width).
               $07 R2H     Image height in pixels (<= actual height).
               $18 R11L    # bytes to skip on the left side.
               $19 R11H    # bytes on the right side.
               $1A-$1B R12 # rows to skip from the bottom.
          Description:  The  coding of the image is the same as that of the
          click boxes, see BitmapUp for more information. This routine seems to
          be  for drawing pieces of Photo Scraps.  Photo Scraps  have  this
          coded format.  The parameters for this routine allow a section of
          the image to be drawn by specifying how many rows to skip down, as
          well  as how many bytes to skip on the left and the right of  the
          desired  section.  This is not used by GEOpaint  unless  GEOpaint
          converts  its  files  because  they are in  a  different  format;
          however, Photo Scraps are in this format.



                                                                        1-624
          Function Name: BitOtherClip
          Purpose: Draw a section of a coded graphic image.
          Call address: $C2C5
          Input requirements:
               $02-$03 R0  Pointer to graphic image buffer (134 bytes).
               $04 R1L     Column to start on, in bytes.
               $05 R1H     Row to start drawing the image on.
               $06 R2L     Image width in bytes. (<= actual width)
               $07 R2H     Image height in pixels (<= actual height)
               $18 R11L    # bytes to skip on the left side.
               $19 R11H    # bytes on the right side.
               $1A-$1B R12 # rows to skip from the bottom.
               $1C-$1D R13 Byte read and save routine vector.
               $1E-$1F R14 Sync routine vector.
          Description: This routine is identical to BitmapClip, except that
          before each byte is read,  the first user routine is called.  It
          should return its byte in A and save that byte to the address
          currently pointed to by R0 before returning.  The second routine
          need only reload R0 with the address of the image buffer.



                                                                        1-625
          Function Name: DrawSprite
          Purpose: Copies a sprite into GEOS's storage area.
          Call address: $C1C6
          Input requirements:
               $08 R3L    The sprite number (0-7).
               $0A-$0B R4 Pointer to the sprite data.
          Description:  This routine simply copies 63 bytes of data pointed
          to by $0A-$0B (R4) to the specified sprite block. GEOS uses sprite
          blocks 40 to 47.



                                                                        1-626
          Function Name: PosSprite
          Purpose: Sets the position of a sprite.
          Call address: $C1CF
          Input requirements:
               $08 R3L    Sprite number (0-7).
               $0A-$0B R4 Sprite X position.
               $0C R5L    Sprite Y position.
          Preparatory routines: DrawSprite
          Description: This routine copies the sprite's position to the VIC
          chip,  relieving the user of the burden of handling the crossover
          in the screen from column 255 to column 256.



                                                                        1-627
          Function Name: EnablSprite
          Purpose: Turns on a sprite.
          Call address: $C1D2
          Input requirements:
               $08 R3L    Sprite number (0-7).
          Preparatory routines: DrawSprite, PosSprite
          Description:  This  routine  turns the sprite on,  so that it  is
          visible.



                                                                        1-628
          Function Name: DisablSprite
          Purpose: Turns off a sprite.
          Call address: $C1D5
          Input requirements:
               $08 R3L    Sprite number (0-7).
          Preparatory routines: DrawSprite, PosSprite, EnablSprite
          Description:  This routine turns the sprite off, so that it is no
          longer visible.


          Controls
          ------------------------------------------------------------------



                                                                        1-701
          Function Name: DoMenu
          Purpose: Draws and sets everything up for pull down menus and
                   submenus.
          Call address: $C151
          Input requirements:
               A          Menu option to position mouse on (0 to #options-1)
               $02-$03 R0 Pointer to the menu descriptor.
          Description:  This  is  an EXTREMELY powerful  routine.  It  does
          EVERYTHING  for  menu  processing.  Once control returns  to  the
          program that created the menu, the program can return to the GEOS
          main  line,  or do anything else.  It is important to  note  that
          menus only appear on screen 1. Location $2F is saved and restored
          during  the  drawing phase.  The left and right margins are  also
          left  unaltered.  The  following  is  a  description  of  a  menu
          descriptor:
               #bytes    Description
                  1      Top margin of entire menu.
                  1      Bottom margin of entire menu.
                  2      Left margin of entire menu.
                  2      Right margin of entire menu.
                  1      Code byte:
                          bit 7 - HORIZONTAL/VERTICAL: vertical menu.
                          bit 6 - CONSTRAINED/UNCONSTRAINED: set secondary 
                                  box  descriptor  to  full screen;  this 
                                  allows the mouse to be moved outside of 
                                  a menu without causing it to be closed.
                          bits 0-4 - # entries in menu.
          This  is  followed  by sets of 5 bytes;  as  many  as  there  are
          entries.
                  2      Address of the text for this option.
                  1      Code byte which describes what to do with the
                         address that follows:
                          $80   - SUB_MENU: operand is the address of a 
                                  submenu descriptor.
                          $40   - DYN_SUB_MENU: call subroutine, it must 
                                  return a result in $02-$03 R0 which is 
                                  either 0 or the address of the next 
                                  submenu.
                          $00   - MENU_ACTION: This option is selected it
                                  will flash  before  the routine  is
                                  executed.  Control does not return to the
                                  menu processor.
                  2       Address of either a submenu descriptor or a
                          routine to be executed.



                                                                        1-702
          Function Name: DoPreviousMenu
          Purpose: Backs up a menu level.
          Call address: $C190
          Description:  This routine erases the present menu, and pops back
          one level.



                                                                        1-703
          Function Name: GotoFirstMenu
          Purpose: Closes all menu levels.
          Call address: $C1BD
          Preparatory routines: DoMenu
          Description:  This routine is not the same RecoverAllMenus.  The menus are
          cleared  one at a time and the previous levels are reprocessed in
          reverse order until all menus are closed.



                                                                        1-704
          Function Name: ReDoMenu
          Purpose: Redraws the present menu.
          Call address: $C193
          Description: This routine redraws the current menu.



                                                                        1-705
          Function Name: RecoverMenu
          Purpose: Erases the current menu from the screen.
          Call address: $C154
          Preparatory routines: DoMenu
          Description:  This  routine will erase the current menu.  It does
          NOT pop up a level.  It simply erases it from the screen.  If the
          vector at $84B1 (RecoverVector) was set, then that is the routine 
          called to erase the menu;  otherwise, a blank pattern is selected 
          with SetPattern and Rectangle is called. The default setting for 
          $84B1 (RecoverVector) is RecoverRectangle.



                                                                        1-706
          Function Name: RecoverAllMenus
          Purpose: Erases all open menus.
          Call address: $C157
          Preparatory routines: DoMenu
          Description:  This  routine  erases all of the  menus.  It  calls
          RecoverMenu repeatedly to accomplish this. It then sets the menu level
          counter at $84B7 (menuNumber) to $00.



                                                                        1-707
          Function Name: DoIcons
          Purpose: Draws all of the click boxes in a table.
          Call address: $C15A
          Input requirements:
               $02-$03 R0 Pointer to a click box table (Usually $880C).
          Preparatory routines: DoDlgBox (optional).
          Description: This routine draws all of the click boxes by calling
          BitmapUp repeatedly until the table is exhausted.  StartMouseMode
          is called  to  set  the mouse's position.  Click table format:
               #bytes     Description
                  1       # click boxes in table.
                  2       Column to place mouse in (0 will prevent
                          placement).
                  1       Row to place mouse in.
          This is followed by sets of 8 bytes, one for each click box.
                  2       Address of graphic data.
                  1       Column position of box in characters.
                  1       Row position of box in pixels.
                  1       Width of box in bytes.
                  1       Height of box in pixels.
                  2       Address of routine to process this box.



                                                                        1-708
          Function Name: DoDlgBox
          Purpose: Process a window descriptor.
          Call address: $C256
          Input requirements:
               $02-$03 R0 Pointer to window descriptor.
          Output:
               $02 R0L    Window command that closed the window.
               $851D      sysDBData: Window command that closed the window.
          Description:  Like  DoMenu,  this is another very powerful routine.
          Given  a  description of the window's  commands, everything  gets
          handled.  The format of the window descriptor is as follows:
               .byte Window type.
                         Bit 7     Window  size  follows;   otherwise,  use
                                   standard  window  size rows 40  to  135,
                                   columns 72 to 263.
                         Bits 0-4  Fill pattern for shadow.  If zero,  then
                                   no shadow is drawn.
               The  following  six bytes are only present if bit 7  of  the
               window type is set.
               .byte Top margin.
               .byte Bottom margin.
               .word Left margin.
               .word Right margin.
               .byte Command bytes followed by whatever data is needed.
          All the click box descriptors are stored in a table at $880C, for
          GEOS to process them.  This limits the number of click boxes in a
          window  to  8.  Several  memory  locations  are  saved  prior  to
          processing the window;  also the stack pointer and return address
          are  saved.  After the window is drawn,  control passes  back  to
          MainLoop. RstrFrmDialogue must be called to return to the caller. 
          Therefore it is  essential  that  some  means  of  closing  a  
          window  exists, otherwise  a  situation  like Panic will occur 
          (See  the  Panic routine for more info).
               The command that closes the window is the value returned  to
          the user.  i.e.  if a click box closes the window then the command
          number  that  drew the click box is returned.  However it is  the
          user's  routine's  responsibility  to set the value  of  location
          $851D if a user click box is to close the window.  Command #13 is
          another one that can close the window.  User routines do not have
          to close the window but they may if they so desire.
               The  following  is a list of the memory addresses stored  by
          the window processor:
               $22-$38   $849B-$84C0    $86C0-$87D3    $8FF8-$8FFF
               $3F-$40   $D000-$D010    $D01B-$D01D    $D025-$D026
               $D015     $D028-$D02E

                             Window Processor Commands

          0    No data. This command ends the window descriptor.
          1    The data for this command is the column offset in bytes  and
               the row offset in pixels.  Draw an 'OK' click box.
               .byte COLUMNBYTE
               .byte ROWOFFSET
          2    The  data for this command is the column offset in bytes and
               the row offset in pixels.  Draw a 'Cancel' click box.
               .byte COLUMNBYTE
               .byte ROWOFFSET
          3    The data for this command is the column offset in bytes  and
               the row offset in pixels.  Draw a 'Yes' click box.
               .byte COLUMNBYTE
               .byte ROWOFFSET
          4    The data for this command is the column offset in bytes  and
               the row offset in pixels.  Draw a 'No' click box.
               .byte COLUMNBYTE
               .byte ROWOFFSET
          5    The  data for this command is the column offset in bytes and
               the row offset in pixels.  Draw an 'Open' click box.
               .byte COLUMNBYTE
               .byte ROWOFFSET
          6    The data for this command is the column offset in bytes  and
               the row offset in pixels.  Draw a 'Disk' click box.
               .byte COLUMNBYTE
               .byte ROWOFFSET
          7-10 Are undefined commands.
          11   The  data  for this command is the column offset in  pixels,
               the row offset in pixels,  and the address of a text string.
               This  command  displays  the text string  at  the  specified
               offset in the window.
               .byte COLUMNOFFSET
               .byte ROWOFFSET
               .word POINTERTOTEXTSTRING
          12   The  data for this command is the column offset  in  pixels,
               the  row  offset  in  pixels and zero page  address  of  the
               address of a text string. This command is similar to command
               11, except for its method of addressing the string.
               .byte COLUMNOFFSET
               .byte ROWOFFSET
               .byte R0
          13   The  data for this command is the column offset  in  pixels,
               the  row offset in pixels,  zero page address of the address
               of  the  text  buffer to be used by GetString  and  the  maximum
               length of the input buffer.  See GetString for more information.
               .byte COLUMNOFFSET
               .byte ROWOFFSET
               .byte R0
               .byte NUMBEROFBYTES
          14   Set the vector at $84A9-$84AA (otherPressVec) to close the window. 
               Generally used with command 13. I think this makes the window
               close on mouse click. 
          15   The data for this command is the address of a GraphicsString command
               table.  See GraphicsString for further information.
               .word TABLEADDR
          16   The data for this command is the column offset in pixels and
               the  row  offset in pixels.  This command opens a  scrolling
               window of filenames.  Locations $10 R7L and $16-$17 R10 must 
               be  set prior  to  calling DoDlgBox (See FindFTypes for more  
               information).  The filenames are stored at $8300-$83FF,  
               (fileTrScTab) to a maximum of 15 filenames.  Location  $885C  
               will return the  index  of  the selected  file  name.  If 
               more than 6 files are  found,  the subwindow will have a 
               click box for scrolling the list.
               .byte COLUMNOFFSET
               .byte ROWOFFSET
          17   The data for this command is the address of the routine  for
               button pressed.  This command sets the vector at $84A9-$84AA
               (otherPressVec) to a user specified routine.
               .word VECTORADDR
          18   The data for this command is the column offset in bytes, the
               row  offset  in  pixels and the address of a user's  8  byte
               click box description, in the following format:
                         #bytes    Description
                            2      Address of graphic data.
                            2      Not used.
                            1      Width of box in bytes.
                            1      Height of box in pixels.
                            2      Address of routine to process this box.
               .word COLUMNOFFSET
               .byte ROWOFFSET
               .word CLICKBOXDATAADDR
          19   The  data  for  this  command  is  the  address  of  a  user
               subroutine.  This command calls the user's subroutine.
               .WORD USERROUTINE



                                                                        1-709
          Function Name: RstrFrmDialogue
          Purpose: Close a window.
          Call address: $C2BF
          Output:
               $02 R0L    Command byte from window processor.
               $851D      sysDBData: Command byte from window processor.
          Description:  The  window is erased and the memory addresses that
          the window processor saved are restored.  Control returns to  the
          caller of DoDlgBox.



                                                                        1-710
          Function Name: IsMseInRegion
          Purpose: Check if the mouse is in a box.
          Call address: $C2B3
          Input requirements:
               $06 R2L    Top margin.
               $07 R2H    Bottom margin.
               $08-$09 R3 Left margin.
               $0A-$0B R4 Right margin.
          Output:
               A         $00 - outside box, $FF - inside box.
          Description:  This  routine  simply  compares the  present  mouse
          location   stored   at  locations  $3A-$3C  against   the   box's
          boundaries. A is set to $00 if the mouse is outside, $FF if it is
          inside.



                                                                        1-711
          Function Name: Panic
          Purpose: Draw a system error window, and halt system.
          Call address: $C2C2
          Description:  A  window  is drawn with the message 'System  error
          near  $xxxx',  where  xxxx is the hex address of the  JSR  Panic
          instruction.  Since  the system error window has no way of  being
          closed, GEOS simply sits in its main loop forever. The BRK vector
          at $84AF-$84B0 (BRKVector) is initially set to this routine.


          Miscellaneous
          ------------------------------------------------------------------



                                                                        1-801
          Function Name: InitForIO
          Purpose: Open serial communication.
          Call address: $C25C
          Errors: See Appendix I.
          Description:  This  routine sets up the I/O ports for high  speed
          serial communication with the disk drives. This routine is called
          prior to calling ReadBlock, WriteBlock or VerWriteBlock.



                                                                        1-802
          Function Name: DoneWithIO
          Purpose: Close off serial communication.
          Call address: $C25F
          Errors: See appendix I.
          Description:  This  routine  resets the I/O  ports  after  serial
          communication is complete. This routine is called after calls  to
          ReadBlock, WriteBlock or VerWriteBlock.



                                                                        1-803
          Function Name: FirstInit
          Purpose: Part of GEOS's bootup process.
          Call address: $C271
          Description:  Initializes  the VIC chip and the I/O  chips.  Some
          global   memory   is  also  initialized.   It  also  resets   the
          preferences and all the drives.  The default drive is reset by  a
          call to EnterTurbo.



                                                                        1-804
          Function Name: MainLoop
          Purpose: Enters GEOS's main loop.
          Call address: $C1C3
          Input requirements:
               $849B-$849C appMain: Address of user's addition to GEOS's main
                           loop (optional).
          Description: This loop does whatever polling is needed. First the
          button  is  checked,  as well as  the  keyboard and  the  mouse's
          position. The command table at $8719 (See InitProcesses) is scanned 
          for executable  routines.  Then the counters at $877F (See Sleep) 
          are checked; those that have reached zero have  their  associated
          routines executed. The memory image of the clock is updated. Then
          the alarm clock is checked.  Finally,  the user's addition to the
          main  loop,  if there is one,  is executed.  This loop  continues
          forever.



                                                                        1-805
          Function Name: InterruptMain
          Purpose: Handles  several  items  that  occur  at  regular  timed
                   intervals.
          Call address: $C100
          Outputs: See description
          Description: GEOS sets up the raster interrupt on the VIC chip to
          cause  an interrupt every sixtieth of a second.  This routine  is
          called  by  GEOS after each interrupt.  First it reads the  input
          device  and  updates  the mouse's  position,  turning  it  on  if
          necessary. It then scans the command table at $8719 to see if any
          of the command bytes have both bits 4 and 5 reset. If so, it then
          decrements  the  associated  counter at  $86F1.  If  the  counter
          reaches  zero,  its  value is reset and bit 7 of  the  associated
          command  byte is set.  This will cause the appropriate subroutine
          to be executed the next time the table is polled.  The next  part
          of this routine is to decrement all nonzero counters in the stack
          at  $877F.  The routine to blink the text cursor is called  next.
          Finally, the random number generator at $850A is updated.



                                                                        1-806
          Function Name: BootGEOS
          Purpose: Reboot GEOS.
          Call address: $C000
          Errors: If load fails, system resets to BASIC.
          Description:  This  routine is not part of the normal GEOS KERNAL
          jump  table.  This  is  the routine that is set  up  as  the  NMI
          interrupt  (RESTORE key) by GEOS when GEOS returns to  BASIC.  It
          loads 'GEOS BOOT', and executes it.



                                                                        1-807
          Function Name: StartAppl
          Purpose: Execute a program already in memory.
          Call address: $C22F
          Input requirements:
               $02 R0L    Flag byte.
               $06-$07 R2 Data pointer (optional).
               $08-$09 R3 Data pointer (optional).
               $10-$11 R7 Start address.
          Output:
               $06-$07 R2 Pointer to drive name 2.
               $08-$09 R3 Pointer to drive name 3.
          Description:  This  routine performs some initializations  before
          executing a loaded program.  If either bit 6 or bit 7 of the flag
          byte at location $02 is set,  then the data pointed to by $06-$07
          and $08-$09 are copied into the buffers for the 3rd and 4th drive
          names.  These  data  blocks  are limited to 16  bytes  each.  The
          initialization  process selects the BSW font and initializes  all
          of GEOS's global variables.



                                                                        1-808
          Function Name: EnterDesktop
          Purpose: Restart DESKTOP.
          Call address: $C22C
          Description: This routine loads DESKTOP and runs it. It is called
          as the last part of the bootup procedure. This is where a program
          should terminate.



                                                                        1-809
          Function Name: ToBasic
          Purpose: Restart BASIC with optional program load.
          Call address: $C241
          Input requirements:
               $02-$03 R0 Pointer to 40 characters of text.
               $0C-$0D R5 Pointer to file's directory entry.
               $10-$11 R7 Load address.
          Preparatory routines: FindFile
          Description: The 40 characters pointed to by $02-$03 are saved in
          a buffer.  If $0C-$0D is non-zero, the file is loaded into memory
          at  the address specified by $10-$11.  BASIC is restarted with an
          interrupt vector. This interrupt is set up to give BASIC a chance
          to start up. After the time has elapsed, the 40 characters in the
          buffer  are  copied  to  the screen and a CR  is  placed  in  the
          keyboard buffer.  The interrupt vector is then removed,  but  the
          NMI vector is set up to reboot GEOS. The reboot code is at $C000-
          $C037.



                                                                        1-810
          Function Name: CallRoutine
          Purpose: Conditional jump.
          Call address: $C1D8
          Input requirements:
               A         The low (least significant) byte of the jump vector.
               X         The high (most significant) byte of the jump vector.
          Description: If A and X are zero, the jump is not performed. If A
          and X are nonzero, the jump is performed.



                                                                        1-811
          Function Name: DoInlineReturn
          Purpose: Jump through a table.
          Call address: $C2A4
          Input requirements:
               A         Offset into table.
               $3D-$3E   Table address.
          Description:  This routine is called by all of the routines  that
          have  inline data.  They all set $3D-$3E to the return address of
          the  caller,  index off of this pointer to get their  data,  then
          call  the appropriate routine.  When the routine finishes,  A  is
          loaded with the data table's length and this routine is called to
          return control to the caller after the data table.



                                                                        1-812
          Function Name: StartMouseMode
          Purpose: Initializes the mouse.
          Call address: $C14E
          Input requirements:
               C flag      Clear if the mouse position should not be set.
               C flag      Set if the mouse position should be set.
               Y           The row position for the mouse (optional).
               $18-$19 R11 The column position for the mouse (optional).
          Description: This routine turns on the mouse and  positions it if
          desired.  If the column is set to 0,  the mouse is not positioned
          even  is  the C flag is set.  It also sets up the button  pressed
          vector $84A1-$84A2 (mouseVector) and the close menu vector $84A7-
          $84A8 (mouseFaultVec). It also clears the flag at $84B6.  This 
          routine does not actually turn on the mouse.  It calls MouseUp to 
          reset bit 7 of location $30 (mouseOn); this will cause GEOS's 
          interrupt routines to turn on the mouse.



                                                                        1-813
          Function Name: MouseUp
          Purpose: Turns on the mouse.
          Call address: $C18A
          Description:  This  routine  sets  bit 7  of  location  $30.  The
          interrupt routines will turn on the mouse when it tries to update
          its position.



                                                                        1-814
          Function Name: MouseOff
          Purpose: Turns off the mouse.
          Call address: $C18D
          Description:  This  routine  resets bit 7 of  location  $30,  and
          actually turns off the mouse sprite.



                                                                        1-815
          Function Name: ClearMouseMode
          Purpose: Reset the mouse.
          Call address: $C19C
          Description:  The  flag at location $30 is set to  $00,  and  the
          mouse sprite is turned off.  However, since bit 7 of location $30
          is not set, the next interrupt will turn it back on.



                                                                        1-816
          Function Name: Sleep
          Purpose: Sets up a time delay.
          Call address: $C199
          Input requirements:
               $02-$03 R0 Amount of time delay value in 60ths of a second.
          Description:  The  counter is  saved on a stack, as well  as  the
          return  address  of the caller.  Control is passed back  a  level
          higher  than the caller.  When the timer runs out,  control  will
          return  where  it left off.  This allows programs to  incorporate
          delays  without halting GEOS's many independent  processes.  This
          and InitProcesses appear to be the beginnings of multitasking for
          GEOS.



                                                                        1-817
          Function Name: GetRandom
          Purpose: Modifies the random number generator at $850A-$850B.
          Call address: $C187
          Output:
               $850A-$850B    random: New seed value.
          Description:  This  routine changes the 16 bit random  number  at
          $850A-$850B (random), using a simple yet elaborate formula.



                                                                        1-818
          Function Name: GetSerialNumber
          Purpose: Who knows?
          Call address: $C196
          Output:
               $02-$03 R0  Value from $9F27-$9F28 ($3E66).
          Description: This routine seems to have absolutely no purpose. It
          copies  a vector from $9F27-$9F28 ($3E66) to  $02-$03.  Locations
          $9F27  and $9F28 are checked by another routine at bootup.  If it
          is zero then the first VLIR chain of the kernal ($9000-$9FFF)  is
          rewritten  to  the  disk.  This  may be a  remnant  of  the  GEOS
          development  environment or it may be some kind of kernal version
          number. The code looks like this:
                LDA $9F28
                STA $03
                LDA $9F27
                STA $02
                RTS


          Processes
          ------------------------------------------------------------------



                                                                        1-901
          Function Name: InitProcesses
          Purpose: Sets up a table of recurring timed events.
          Call address: $C103
          Input requirements:
               A          The number of entries in the table.
               $02-$03 R0 A pointer to the table of counters and routine
                          addresses.
          Description:  This routine copies a table of subroutine addresses
          and  counter  values into GEOS's tables at $872D and  $8755.  The
          counters will be decremented on each call to InterruptMain.  When
          they reach zero,  they  are reset  and the  associated routine is
          called by the GEOS main loop. The command bytes are initially set
          to  disable the  counters.  Several calls  to RestartProcess  are
          needed to start the counters running,  one for  each entry in the
          table. The table consists  of  pairs of words.  The first is  the
          address  of  the subroutine  to be executed each time the counter
          reaches zero and the  second is the  counter value.  This appears
          to be the rudiments  of  multitasking GEOS.  The table of command
          bytes  at $8719  are  bit  oriented and operate according to  the
          following table:
               Bit 7 - Timer reached zero, call the subroutine.
               Bit 6 - Disable the execution of the routine.  This does NOT
                       affect the counter.
               Bit 5 - Initially set by InitProcesses,  causes the  counter
                       to stop running.
               Bit 4 - Though  not referenced anywhere in the GEOS  Kernal,
                       this  bit also stops the counter.  This bit  is  NOT
                       touched  by  any  of the  GEOS  routines,  including
                       RestartProcess.



                                                                        1-902
          Function Name: EnableProcess
          Purpose: Forces a timed event to execute, regardless of its timer.
          Call address: $C109
          Input requirements:
               X         The index into the command byte table at $8719.
          Preparatory routines: InitProcesses
          Description:  This  routine sets bit 7 of a specific command byte
          in the table at $8719. This simulates the timer having run out.



                                                                        1-903
          Function Name: RestartProcess
          Purpose: Enables a recurring timed event.
          Call address: $C106
          Input requirements:
               X         The index into the command table at $8719.
          Preparatory routines: InitProcesses
          Description:  This routine enables a specific timer in the  table
          at $8719 by resetting bits 5 and 6 in the command table.  It also
          copies  the  initial  value into the timer table  at  $87F1.  The
          command  table  must  have been previously set up by  a  call  to
          InitProcesses.



                                                                        1-904
          Function Name: FreezeProcess
          Purpose: Stops the timer on a timed event.
          Call address: $C112
          Input requirements:
               X         The index into the command table at $8719.
          Preparatory routines: InitProcesses
          Description:  This routine sets bit 5 of a specific command  byte
          in  the table at $8719.  This prevents the associated timer  from
          running. This routine is the complement to UnfreezeProcess.



                                                                        1-905
          Function Name: BlockProcess
          Purpose: Disables the execution of a timed event.
          Call address: $C10C
          Input requirements:
               X         The index into the command table at $8719.
          Preparatory routines: InitProcesses
          Description:  This routine sets bit 6 of a specific command  byte
          in the table at $8719.  This prevents the associated routine from
          executing, regardless of its timer.  This does NOT stop the timer
          from  running.  If  the  timer  runs out  while  the  routine  is
          disabled,  when  the timer is reenabled,  the associated  routine
          will be executed. This routine is the complement to UnblockProcess.



                                                                        1-906
          Function Name: UnblockProcess
          Purpose: Enables the execution of a timed event.
          Call address: $C10F
          Input requirements:
               X         The index into the command table at $8719.
          Preparatory routines: InitProcesses
          Description: This routine resets bit 6 of a specific command byte
          in  the table at $8719.  This allows the associated routine to be
          executed when its timer runs out.  If the timer had run out while
          the routine was disabled,  GEOS will execute the routine when  it
          gets to it. This is the complement to BlockProcess.



                                                                        1-907
          Function Name: UnfreezeProcess
          Purpose: Restarts the timer on a timed event.
          Call address: $C115
          Input requirements:
               X         The index into the command table at $8719.
          Preparatory routines: InitProcesses
          Description: This routine resets bit 5 of a specific command byte
          in the table at $8719.  This enables the associated counter. This
          routine is the complement to FreezeProcess. This routine  is  NOT
          a replacement for RestartProcess.  This routine does not copy the  
          timer's initial value as does RestartProcess.






          Chapter 2:
          Device Drivers 

                                    Input Drivers

               Input  drivers exist in memory from $FE80 to $FFF9.  They do
          not have a start address since they are not executable  programs.
          The  default  input  driver  (JOYSTICK) is  built into  the  GEOS
          KERNAL;  GEOS  will always boot up with the joystick as the input
          device.  The  user must select another one if it is  so  desired.
          They  have three entry points in the very beginning.  These entry
          points are a jump table from $FE80-$FE88.

          $FE80: InitMouse
               The  first entry point at $FE80 is the master reset  vector.
          This  routine must set the mouse speed (Location $8507) to  zero,
          as well as reset the mouse's position to 0,0 (Locations $3A-$3C
          mouseXPosition,  mouseYPosition).  It  must  also  clear  the 
          direction byte (Location $8506 inputData).
          
          $FE83: SlowMouse
               The  second  vector must reset the speed to  zero  (Location
          $8507).

          $FE86: UpdateMouse
               The  third vector actually performs the input.  It must also
          modify  the  appropriate  flags,  adjust the  mouse's  speed  and
          position. These include mouseXPosition, mouseYPosition, mouseData,
          pressFlag, and inputData.

               The following is a small memory map of locations of interest
          to input drivers:
          $30       mouseOn: Mouse control flag
                    Bit 7 - Mouse  is visible,  do not modify  the  mouse's
                            position if it is not visible.
          $39       pressFlag: Input status flag
                    Bit 7 - There  is data in the keyboard queue,  this  is
                            not used by the input driver.
                    Bit 6 - Mouse has changed direction.
                    Bit 5 - Button  status has changed,  either the  button
                            has been released or pushed since last checked.
          $3A-$3B   mouseXPosition: Mouse's  X  position  (0-319),  range 
                    checking  is  not necessary.
          $3C       mouseYPosition: Mouse's  Y  position (0-199),  range  
                    checking  is  not necessary.
          $8501     maxMouseSpeed: Mouse's maximum speed.
          $8502     minMouseSpeed: Mouse's minimum speed.
          $8503     mouseAccel: Acceleration factor;  added or subtracted 
                    each time the input drive is scanned and the direction
                    has  not  changed.
          $8505     mouseData: Button status: $00-pressed, $80-not pressed.
          $8506     inputData: Direction; $FF if no direction is specified;
                    otherwise a number from 0 to 7:
                                           3    2    1
                                            *  +  *
                                          4  -- * --  0
                                             *  +  *
                                           5    6    7
                    This  location  is  needed by the  scroll  feature  for
                    GEOpaint.  If not used, for example by a Koalapad, this
                    feature  of GEOpaint will not work,  but  nothing  else
                    will be affected.
          $8507     Mouse's current speed.




                                  Printer Drivers

               Printer  drivers  exist in  memory  from  $7900-$7FFF.  This
          overlaps  part  of  screen 2.  Printer drivers  are  only  memory
          resident  when  they  are in use.  GEOS loads the  first  printer
          driver that it can find on the disk,  whenever it needs to  print
          something.  To make a particular printer driver always be the one
          found,  all  that  must be done is to place it ahead of  all  the
          other  printer  drivers in the directory.  There are  five  entry
          points  to a printer driver.  These form a jump table from $7900-
          $790E.

          $7900: InitForPrint
               The first entry point,  at $7900,  is the master reset. This
          routine must initialize any global variables that need to be set.
          This routine is called once when the driver is loaded.  Usually
          only the baud rate it set with this routine.

          $7903: StartPrint
               The   second  entry  point,   at  $7903,   is  the   printer
          initialization.  It is used to initialize the serial bus and open
          a logical file for the CBM KERNAL to address.  This  routine   is
          called just prior to printing an image. The X register must be set
          to an error code if the printer is not available.  This error code 
          is the C64's KERNAL status byte at location $90. This routine must
          initialize  any  temporary variables used by the driver.
 
          $7906: PrintBuffer
               The  third  entry point,  at $7906,  actually  performs  the
          printing of a line.  Locations $02-$03 R0  point to the bit image
          graphic data for the line (640 pixels,  8 bits high,  640 bytes).
          Locations $04-$05 R1 point to a similar buffer area free for use
          by  the driver if it needs it. This is mainly  to give  printers
          which only print  7 pixels at a time a  place to  accumulate  the
          extra  bits.  Locations $06-$07 R2 point to  the color   data for
          the  line.  This  is  only  for  the benefit  of  color printers.
          The printer driver must not modify any of these pointers.
               This routine works by calling SetDevice on device 4 and then
          calling InitForIO to access the CBM KERNAL.  DoneWithIO should be
          called before returning to the application.

          $7909: StopPrint
               The fourth entry point,  at $7909,  closes the printer. This
          routine  is called when the image is finished.  This allows 7 bit
          printers to print the contents of their buffers.  This is also to
          give  the  printer  driver  a  chance to  print  a  top  of  form
          character.  Like PrintBuffer, this routine requires $02-$03 R0 to
          point to any extra data to print, and $04-$05 to point to  a  640
          byte buffer for the driver's use.  It should send a form-feed for
          the end of page.  

          $790C: GetDimensions
               The  fifth  entry point,  at $790C,  returns the  number  of
          character  columns that the printer can print in the X  register.
          The  maximum  number  of  lines per page is  returned  in  the  Y
          register.  The  accumulator  is loaded with a  zero.  This  gives
          applications  the  ability  to compute  necessary  buffer  sizes.
          Typical  values  are 80 columns by 90 lines or 60 columns  by  90
          lines.

          $790F: PrintASCII
               The sixth entry point, at $790F, is used for printing lines
          of ASCII text in draft or nlq modes.  $02-$03 R0 should point to
          a  null-terminated  line  of ASCII  text for  printing.  $04-$05
          should point to a 640 byte buffer for print driver use.

          $7912: StartASCII
               The seventh entry point, at $7912, is the same as StartPrint
          except that it prepares the printer for draft or nlq printing. It
          should set up device 4 for the printer.

          $7915: SetNLQ
               This routine  should send whatever initialization string  to
          the printer which is necessary for it to print in its NLQ mode.






          Chapter 3:
          File Formats 

                                VLIR File Structure

               A VLIR file is a tree structured file.  The directory points
          to a single sector called the VLIR sector.  This sector is a list
          of  the  initial tracks and sectors of each of its  branches  (or
          chains). If the branch address is track $00 sector $FF, then that
          branch  does not exist and is not used.  It is a place holder.  A
          branch  address of track $00 sector $00 specifies the end of  the
          sector. This is used by the OpenRecordFile to count the number of
          branches. It is possible not to have this end marker. That is the
          case  when  there are 127 branches.  This limit of  127  branches
          explains many  of GEOS's limits,  i.e.  127 note  pad  pages,  127
          pictures in a photo album, 64 pages and 63 pictures in a GEOwrite
          file,  etc.  Each branch is the equivalent of a normal file,  i.e.
          each sector points to the next with the first two bytes.

         
          VLIR Sector

          -------------         --------------     --------------
          | Record 1  |-------> | Data Block | --> | Data Block | -> ...
          | Track/Sec |         --------------     -------------- 
          |-----------|         --------------
          | Record 2  |-------> | Data Block | 
          | Track/Sec |         --------------
          |-----------|         --------------     --------------
          | Record 3  |-------> | Data Block | --> | Data Block | -> ...
          | Track/Sec |         --------------     --------------
          |-----------|
          |    .      |
          |    .      |
          |-----------|         --------------     --------------
          | Record 127|-------> | Data Block | --> | Data Block | -> ...
          | Track/Sec |         --------------     --------------
          -------------
          



                                  Font File Format

               Font files are VLIR files;  the chain number (0-126) is  the
          point  size.  GEOS limits a font to a point size of 48.  This  is
          probably   due  to  memory  limitations  for  storing  the  font.
          Nonexistent point sizes have VLIR chain addresses of $00,$FF.

               The header in each font file contains Font ID and point size
          information for the fonts in the file.  This includes the FONT ID
          at  offset  $80 (128)  within the header block, the 32 byte point
          size table at $82 (130) ordered from smallest to largest  (padded 
          with 0's), and the 32 byte font sizes at $61 (97) ordered from
          smallest to largest (padded with 0's).  This leaves room for 16 
          fonts per font file.

               Font  files  are identified by a unique ID number  which  is
          stored in the file's info sector at offset 130.  The info  sector
          contains a word identifier for each point size in the font. These
          identifiers have the form:  ID# * 8 + point size.  In other words,
          bits 15-6 represent the font number while bits 0-5 hold the point
          size.  These ID words are used by GEOwrite and GEOpaint.  

                         0    BSW            13   Tilden
                         1    University     14   Evans
                         2    California     15   Durant
                         3    Roma           16   Telegraph
                         4    Dwinelle       17   Superb
                         5    Cory           18   Bowditch
                         6    Tolman         19   Ormond
                         7    Bubble         20   Elmwood
                         8    Fontknox       21   Hearst
                         9    Harmon         21   Brennens (BUG)
                         10   Mykonos        23   Channing
                         11   Boalt          24   Putnam
                         12   Stadium        25   LeConte

                    Each VLIR in a font file is organized as follows:

          OffSet    Description
          -------   -------------------------------------------------------
          $00       Number  of pixels minus 1 above the underline.  This is
                    the line of print.
          $01-$02   Number of bytes in the bit stream.
          $03       Point size, character height in pixels.
          $04-$05   Index  from  beginning of font to table of  bit  stream
                    indices. Usually $0008.
          $06-$07   Index from beginning of font to first bit stream.
          $08-???   Table  of words which are indices into the bit streams;
                    one  for  each character from space (32) to  the  tilde
                    (126).  There is also an extra index on the  end.  This
                    extra  index is needed because the difference between a
                    character's index and the next character's index is the
                    width of the character in pixels.
          ???-???   Pointed  to by $06-$07.  The font is stored as  several
                    bit  streams,  one for each line of pixels.  The  point
                    size  is the number of bit streams.  All the  character
                    images  are stored in the bit stream.  The GEOS  KERNAL
                    has  some very sophisticated bit manipulation  routines
                    for accessing any given character.




                                 Notes File Format

               The  Notes file created by the Notepad desk accessory has  a
          VLIR  file  structure.  Each  branch  is a  single  sector  which
          comprises a page of the notepad.  This sets the notepad's  limits
          to 127 pages of 253 characters. 127 pages because of the limit to
          the  number of VLIR chains,   and 253 characters because a sector
          holds 254 data bytes (2 bytes for the next track and sector link)
          and the last character must be a zero to terminate to text.

          Notes File

          -------------         --------------
          | Page 1    |-------> | Page Text  |
          | Track/Sec |         --------------
          |-----------|         --------------
          | Page 2    |-------> | Page Text  | 
          | Track/Sec |         --------------
          |-----------|         --------------
          | Page 3    |-------> | Page Text  |
          | Track/Sec |         --------------
          |-----------|
          |    .      |
          |    .      |
          |-----------|         --------------
          | Page 127  |-------> | Page Text  | 
          | Track/Sec |         --------------
          -------------



                                  Photo Scrap File

               The  Photo  Scrap  file  is a  coded  graphics  image  in  a
          sequentially  structured  file.  The first byte is the number  of
          bytes  wide  the  image is (one eighth of the  width  in  pixels).
          This  means that photo scraps are always even multiples of  eight
          pixels wide.  The second and third byte form a word which is  the
          number  of pixels high the image is.  Following these three bytes
          is  the graphics image,  coded in the same format as a click  box
          (suitable fir BitmapClip or  BitOtherClip).  This format consists 
          of a code bye followed  by 1 or more data bytes.  The code bytes
          are classified into the following three basic types.

               1) Code bytes less than 128 mean that the following byte  is
                  to be repeated that many times.
               2) Code  bytes  ranging from 128 to 219 mean that if 128  is
                  subtracted  from  the code byte then the  result  is  the
                  number of data bytes that follow.
               3) Code bytes ranging from 220 to 255 are special. First 219
                  is  subtracted  from  the code byte,  the result  is  the
                  number   of  bytes  in  the  pattern  that  will  follow.
                  Following  this code byte is a repetition count  for  the
                  pattern. Following this are the bytes that constitute the
                  pattern. These could include either of the first two code
                  types.

          Since graphic images can be in color,  the color data follows the
          graphic  image data.  The color data is coded in the same way  as
          the graphic data;  however,  each byte of color data is the color
          for a block of 8 by 8 pixels (a normal character space).  This is
          the  reason  that  GEOpaint makes photo scraps a  multiple  of  8
          pixels high and wide.




                                   Text Scrap File

               Text scraps are sequentially structured files. They are coded
          as follows:
               
          OffSet      Description
          --------    ------------------------------------------------------
          $00-$01     Length of the text scrap in bytes (65535 byte limit)
          $02         NEWCARDSET code ($17)
          $03-$04     Font ID to use
          $05         Style Byte (see below)
          $06 -       Text (could include tabs, ruler esc, newcardsets)  
 
               The style byte is organized as follows:

          Bit         Description      (all 0's gives plain text)
          --------    ------------------------------------------------------
            7         Underline      
            6         Bold
            5         Reverse
            4         Italic
            3         Outline
            2         Superscript
            1         Subscript




                            Photo and Text Album Files

               Album  files  are  VLIR  structured  files, with each  chain
          containing an individual photo scrap or text scrap.  See above for
          these respective formats.
          Notes File

          -------------         --------------
          | Page 1    |-------> | Scrap block|
          | Track/Sec |         --------------
          |-----------|         --------------      --------------
          | Page 2    |-------> | Scrap block| -->  | Scrap block| --> ...
          | Track/Sec |         --------------      --------------
          |-----------|         --------------
          | Page 3    |-------> | Scrap block|
          | Track/Sec |         --------------
          |-----------|
          |    .      |
          |    .      |
          |-----------|         --------------      --------------
          | Page 127  |-------> | Scrap block| -->  | Scrap block| --> ...
          | Track/Sec |         --------------      --------------
          -------------




                                  Preferences File

               These files are one block sequential files in the  following
          format:
                $00-$01   Disk block-link ($47, $00)
                $02       Max velocity
                $03       Min velocity
                $04       Acceleration
                $05       Foreground Color
                $06       Background Color
                $07       Mouse Color
                $08-$46   Mouse pic data
                $47       Border Color




                            GEOwrite v2.0/v2.1 File Format

               GEOwrite  files  are VLIR structured  files.  The  first  61
          branches (0 - 60) are the 61 pages allowed in the  file, the 61st
          record is the header (or empty for none), the  62nd record is the
          footer, the 63rd is reserved.  The  last  63 branches (64-127) are
          photo  scraps, if  there are  any present in the document. See the
          section on Photo Scrap Files and Photo Albums for more information
          concerning the photos.

               Some geoWrite file information is stored in the header block.
          This includes the following:

          OffSet      Description
          --------    ------------------------------------------------------
          $89-$8A     Page number to print on the first page
          $8B         bit 7 set = first page is a title page
                      bit 6 set = NLQ fixed width spacing on
          $8C-$8D     Height of each pages header
          $8E-$8F     Height of each pages footer
          $90-$91     Page height         

          Each page begins with 28 bytes (0-27) for a ruler escape
          string (see below), followed  by a  four byte  (28-31)  NEWCARDSET
          string (see below), followed by the text of the document.  An  EOF
          from  ReadFile  or  an  EOP (12) ends each page.  The page include
          carriage returns to end paragraphs, the ruler escape strings,  the
          newcardset strings, and  graphics  escapes.  These  are  described
          below:

                      NewCardSet
          OffSet      Description
          --------    ------------------------------------------------------
          $00         NEWCARDSET code 23 ($17)
          $01-$02     Font ID to use
          $03         Style Byte (see below)
 
               The style byte is organized as follows:

          Bit         Description      (all 0's gives plain text)
          --------    ------------------------------------------------------
            7         Underline      
            6         Bold
            5         Reverse
            4         Italic
            3         Outline
            2         Superscript
            1         Subscript

                      Ruler Escape
          OffSet      Description
          --------    ------------------------------------------------------
          $00         Ruler Escape 17 ($11)
          $01-$02     Left Margin
          $03-$04     Right margin > LeftMargin
          $06-$21     Tabs of 2 bytes each (bit 15 = dec align., 0-14 tab pos.)
          $22-$23     Paragraph margin
          $24         Justification byte (bit 0-1: 00 = left justified
                                                   01 = centered text
                                                   10 = right justified text
                                                   11 = full justification)
                                         (bit 2-3: 00 = single spaced
                                                   01 = 1 1/2 spaced
                                                   10 = double spaced)
          $25         Text color
          $26-$27     Reserved 

                      Graphics Escape
          OffSet      Description
          --------    ------------------------------------------------------
          $00         Graphics Escape 16 ($10)
          $01         Width in cards (byte * 8 = actual width)
          $02-$03     Picture height in pixels
          $05         VLIR record number containing the picture




                              GEOpaint File Format

               GEOpaint  files  are  VLIR  structured  files.  Each  branch
          represents  2 lines of the picture.  The data in the branches  is
          stored  in a coded form that is different from photo  scraps  and
          click  boxes.  First  of  all,  consecutive bytes do not  form  a
          horizontal  line.  The  bytes  are in the same  sequence  as  the
          Commodore  stores  them on the hires  screen.  Eight  consecutive
          bytes fill a character position. Every eighth byte is on the same
          horizontal line.  

          640 bytes bitmapped for row #(RECORD# * 2) + 1 (80 cards * 8 bytes)          
          640 bytes bitmapped for row #(RECORD# * 2) + 2 (80 cards * 8 bytes)
          81st card byte = 8 zero bytes?!?!
          80 bytes color info for row #(RECORD# * 2) + 1 (80 cards * 1 byte)
          80 bytes color info for row #(RECORD# * 2) + 2 (80 cards * 1 byte)

          The bitmap data is stored in a coded form to conserve disk storage.
          The coding is simply a code byte followed by some data. Code bytes 
          fall into one of the following three categories:

               1) Code   bytes  less  than  64  determine  the  number   of
                  individual bytes that follow.
               2) Code  bytes  ranging  from 64 to 127 are  used  for  fill
                  patterns. The least significant 6 bits determine how many
                  character  positions are to be filled.  This code byte is
                  followed by eight bytes which determine the fill pattern.
               3) Code  bytes greater than 127 are 128 more than the number
                  of times to repeat the byte that follows the code byte.

          This  coding scheme is used to first specify the 1280 bytes  that
          form  the two lines of the picture. This is followed by  the  160
          bytes which form the color data for the two lines.  Each of these
          bytes is split into two four-bit nybbles.  The higher-order nybble
          (bits 7-4) specify the color of the foreground in that card while
          the lower order nybble (bits 3-0) specify the background color for
          that card.






          Chapter 4:
          Directory Structures
 
                            Directory Header (Track 18 sector 0)

          $00       Track of first directory sector.
          $01       Sector of first directory sector.
          $02       $41, ASCII 'A' indicating 4040 format.
          $03       $2A, DOS version.
          $04-$8F   Block Availability Map,  BAM, 35 tracks, 4  bytes each.
                    First  byte  has  number of sectors free on that track.
                    The other three bytes are a bit stream. Bit zero of the
                    first  of the three bytes is sector 0.  If the  bit  is
                    set, then the block is free.
          $90-$9F   Disk name padded with shifted spaces ($A0).
          $A0-$A1   Two extra characters for disk name.
          $A2-$A3   Disk ID.
          $A4       Shifted space ($A0).
          $A5-$A6   ASCII '2A' for DOS version.
          $A7-$AA   Shifted spaces ($A0).
          $AB       Track for DESKTOP's buffer.
          $AC       Sector for DESKTOP's buffer.
          $AD-$BC   ASCII  'GEOS format VX.X',  only the first 11 bytes are
                    used to check for GEOS format.
          $BD-$FF   Filled with zeroes.




                          GEOS File Directory Entry Format

          Byte#     Description
          $00       DOS file type
                         Bit 7     File closed properly.
                         Bit 6     File is write protected.
                         Bits 0-2  File type
                                        0    DEL
                                        1    SEQ
                                        2    PRG
                                        3    USR
                                        4    REL (Not permitted under GEOS)
          $01       Track number of first sector.
          $02       Sector number of first sector.
          $03-$12   File name.
          $13       Track number for info sector.
          $14       Sector number for info sector.
          $15       File structure.
                         0    Sequential structure.
                         1    VLIR format
          $16       GEOS file type.
                         0    Non-GEOS file.
                         1    BASIC Program.
                         2    Assembly program.
                         3    Data file.
                         4    System file.
                         5    Desk Accessory.
                         6    Application.
                         7    Application Data.
                         8    Font file.
                         9    Printer driver.
                         10   Input driver.
                         11   Disk Device
                         12   System Boot file
                         13   Temporary
                         14   Auto Executing
                         15   Input 128
          The  next  few  bytes  define the time and  date  of  the  file's
          creation.
          $17       Year.
          $18       Month.
          $19       Day.
          $1A       Hour.
          $1B       Minute.
          $1C-$1D   File size in blocks (including info sector).






          Chapter 5:
          Information Sector format

                                GEOS File Information Sector

          OffSet    Description
          ------    --------------------------------------------------------
          $00       $00,  track  link  is zero because there  is  only  one
                    sector.
          $01       $FF, number of bytes in this sector.
          $02       $03, Width of icon in bytes
          $03       $15, Height of the icon
          $04       $BF, Bit map data type
          $05-$43   Icon image in sprite format.
          $44       DOS file type ($81=SEQ, $82=PRG, $83=USR, $84=REL, 
                                   bit 6=Write Protection)
          $45       GEOS file type
                         0    Non-GEOS file.
                         1    BASIC Program.
                         2    Assembly program.
                         3    Data file.
                         4    System file.
                         5    Desk Accessory.
                         6    Application.
                         7    Application Data.
                         8    Font file.
                         9    Printer driver.
                         10   Input driver.
                         11   Disk Device
                         12   System Boot file
                         13   Temporary
                         14   Auto Executing
                         15   Input 128
          $46       File structure, 0 for sequential, 1 for VLIR.
          $47-$48   Load address.
          $49-$4A   End of load address.
          $4B-$4C   Start   of  execution  address  for   program;   unused
                    otherwise.
          $4D-$59   Class of file; bytes 0-11 are the name, 12-15 is the 
                    version, 16-19 are zeroes.
          $60       Commodore 128 80-column support flag.  Codes are:
                         0    GEOS 64 or 128, 40 columns only
                         64   GEOS 64 or 128, 40 or 80 columns
                         128  GEOS 64, 40 columns only
                         192  GEOS 128, 80 columns only
          $61-$74   Author  of file;  zero byte terminated.  The  following
                    GEOS file types have authors:
                         1    BASIC Program       6    Application
                         2    Assembly Program    9    Printer driver
                         5    Desk Accessory      10   Input Driver
          $75-$88   For  Application Data files, and other Data files, this
                    is the class of the file that created this file.
          $89-$9F   Data, for Application use
          $A0-$FF   Info field for the file; zero byte terminated.


      

          
          
          
          Chapter 6:
          Memory Map
          
          
          $00         CPU_DDR         Address of 6510 data direction register
          $01         CPU_DATA        Built-in 6510 I/O port, bit oriented
                                      Bit 0 - 0=RAM, 1=BASIC ROM
                                      Bit 1 - 0=RAM, 1=Kernal ROM
                                      Bit 2 - 0=Character set ROM,
                                      1=I/O ports
                                      Bits 3-5 - Cassette control lines
                                      Bits 6-7 - Unconnected
          $02-$03     R0              General pointer,  usually used to pass a
                                      parameter to a Kernal routine.
          $04-$05     R1              General pointer
          $04         R1L             Track number for disk operations
          $05         R1H             Sector number for disk operations
          $05         R1H             Row to print text on
          $06-$0B     R2L-R4H         Box size descriptor
          $06         R2L             Top row of a box
          $07         R2H             Bottom row of a box
          $08-$09     R3              Left margin of a box
          $0A-$0B     R4              Right margin of a box
          $0C-$0D     R5              Directory  entry  pointer,  returned  by
                                      lookup.  Also  used as  the  destination
                                      indirect   pointer  for  hires   graphic
                                      operations.
          $0E-$0F     R6              Filename  pointer,  used to point  to  a
                                      file name for file operations. Also used
                                      as the source indirect pointer for hires
                                      graphic operations.
          $10         R7L             Selected GEOS file type; used by FindFTypes
          $11         R7H             Maximum number of files to find; used by
                                      table
          $12-$13     R8              Temporary storage areas
          $14-$15     R9              Alternate   directory   entry   pointer,
                                      usually  points to $8400.  Also used  to
                                      point to a file's info sector when it is
                                      in memory.
          $16         R10L            Number of directory sectors to skip before
                                      finding a hole in  the  directory;  used
                                      by file save routines and GetFreeDirBlk.
                                      Also  used  as a parameter value  to  be
                                      passed to programs.  Could be  DESKTOP's
                                      page number.
          $16-$17     R10             Pointer to class string; used by FindFTypes
          $18-$19     R11             Column to print text in
          $1A-$1B     R12
          $1C-$1D     R13
          $1E-$1F     R14
          $20-$21     R15             Unused
          $22-$23     curPattern      Pointer to fill pattern data
          $24-$25     string          Pointer to input buffer
          $26-$2E     (font data)     Current font data table.  See Font  File
                                      Format  for  a complete  description  of
                                      this header information.
          $26         baselineOffset  Number  of  pixels above line of  print.
                                      Underlining  appears 1 pixel  below  the
                                      line of print.
          $27-$28     curSetWidth     Number   of  bytes  in  the  font's  bit
                                      streams
          $29         curHeight       Point size of the font
          $2A-$2B     curIndexTable   Address of bit stream indices table
          $2C-$2D     curDataPntr     Address of the first bit stream
          $2E         currentMode     Defines the current print style
                                      Bit 7 - Underline
                                      Bit 6 - Boldface
                                      Bit 5 - Reversed video
                                      Bit 4 - Italics
                                      Bit 3 - Outline
          $2F         dispBufferOn    Controls  the  source  and   destination
                                      screens,  used by GetScanLine. Bits 6 & 7 are
                                      used   to   determine  the  source   and
                                      destination screens as follows:
                                      7 6  $0C-$0D  $0E-$0F
                                      0 0    AF00     AF00  (MIDSCREEN)
                                      0 1     2        1
                                      1 0     1        1
                                      1 1     1        2
                                      If bit 5 is set,  then only screen 1  is
                                      used for text (Mode 10).
          $30         mouseOn         Mouse control flag
                                      Bit 7 - Mouse is not visible
                                      Bit 6 - Enable   checking   mouse's
                                      position   against  current
                                      menu limits.
                                      Bit 5 - Enable   checking   mouse's
                                      position against click  box
                                      table.
          $31-$32     msePicPtr       Pointer  to  the  sprite  data  for  the
                                      default mouse, usually $84C1
          $33         windowTop       Top margin, usually 0 (Top of screen)
          $34         windowBottom    Bottom  margin,  usually 199 (Bottom  of
                                      screen)
          $35-$36     leftMargin      Left margin
          $37-$38     rightMargin     Right margin,  if an attempt is made  to
                                      print  text  past  this column,  control
                                      passes through $84AB.
          $39         pressFlag       Input control flags
                                      Bit 7 - There   is  data   in   the
                                      keyboard buffer
                                      Bit 6 - Input  device  has  changed
                                      direction
                                      Bit 5 - Button status has changed
          $3A-$3B     mouseXPos       Mouse's X position
          $3C         mouseYPos       Mouse's Y position
          $3D-$3E                     Address for inline return
          $3F-$40     returnAddress   Pointer to click box data table
          $41-$42                     Jump vector used by CallRoutine
          $43-$44                     Pointer  used by DoDlgBox to point to  the
                                      window descriptor block.
          $45-$6F                     Unused in GEOS?  For main Kernal, are BASIC vars
          $70         A2L             General application pointer
          $71         A2H             General application pointer
          $72         A3L             General application pointer
          $73         A3H             General application pointer
          $74         A4L             General application pointer
          $75         A4H             General application pointer
          $76         A5L             General application pointer
          $77         A5H             General application pointer
          $78         A6L             General application pointer
          $79         A6H             General application pointer
          $7A         A7L             General application pointer
          $7B         A7H             General application pointer
          $7C         A8L             General application pointer
          $7D         A8H             General application pointer
          $7E         A9L             General application pointer
          $7F         A9H             General application pointer
          $80-$8D                     Unknown - seem to be more BASIC vars for KERNAL
          $8E                         The least significant 3 bits of location
                                      $DD00,  used  by  serial  communications
                                      routines. These three bits represent the
                                      VIC  memory  bank number and the  RS-232
                                      output line.
          $8F                         A  copy  of location $8E with the  clock
                                      and data lines set.
          $90         STATUS          C64 status register
          $91-$B9                     KERNAL I/O registers and variables
          $BA         curDevice       Current serial device number
          $BB-$FA                     KERNAL I/O registers and variables
          $FB         A0L             General application pointer
          $FC         A0H             General application pointer
          $FD         A1L             General application pointer
          $FE         A1H             General application pointer
          $FF                         Unknown - in KERNAL, is a BASIC work area
          $0100-$013E                 Tape Input Error log.
          $0100-$01FF                 6510 Hardware Stack Area.
          $013F-$01FF                 BASIC Stack Area.
          $0200-$0258                 BASIC Input Buffer (Input Line from Screen).
          $0259-$0262                 Kernal Table: Active logical File numbers.
          $0263-$026C                 Kernal Table: Active File First Addresses
                                      (Device numbers).
          $026D-$0276                 Kernal Table: Active File Secondary
                                      Addresses.
          $0277-$0280                 Keyboard Buffer Queue (FIFO).
          $0281-$0282                 Pointer: Bottom of Memory for Operating
                                      System ($0800).
          $0283-$0284                 Pointer: Top of Memory for Operating
                                      System ($A000).
          $0285                       Serial IEEE Bus timeout defeat Flag.
          $0286                       Current Character Color code.
          $0287                       Background Color under Cursor.
          $0288                       High Byte of Screen Memory Address ($04).
          $0289                       Maximum number of Bytes in Keyboard
                                      Buffer ($0A).
          $028A                       Flag: Repeat keys; $00 = Cursors, INST/DEL &
                                      Space repeat, $40 no Keys repeat, $80 all
                                      Keys repeat ($00).
          $028B                       Repeat Key: Speed Counter ($04).
          $028C                       Repeat Key: First repeat delay Counter ($10).
          $028D                       Flag: Shift Keys: Bit 1 = Shift, Bit 2 = CBM,
                                      Bit 3 = CTRL; ($00 = None, $01 = Shift, etc.).
          $028E                       Last Shift Key used for debouncing.
          $028F-$0290                 Vector: Routine to determine Keyboard table
                                      to use based on Shift Key Pattern ($EB48).
          $0291                       Flag: Upper/Lower Case change: $00 = Disabled,
                                      $80 = Enabled ($00).
          $0292                       Flag: Auto scroll down: $00 = Disabled ($00).
          $0293                       RS232 Pseudo 6551 control Register Image.
          $0294                       RS232 Pseudo 6551 command Register Image.
          $0295-$0296                 RS232 Non-standard Bits/Second.
          $0297                       RS232 Pseudo 6551 Status Register Image.
          $0298                       RS232 Number of Bits left to send.
          $0299-$029A                 RS232 Baud Rate; Full Bit time microseconds.
          $029B                       RS232 Index to End of Input Buffer.
          $029C                       RS232 Pointer: High Byte of Address of Input
                                      Buffer.
          $029D                       RS232 Pointer: High Byte of Address of Output
                                      Buffer.
          $029E                       RS232 Index to End of Output Buffer.
          $029F-$02A0                 Temporary store for IRQ Vector during Tape
                                      operations.
          $02A1                       RS232 Enables.
          $02A2                       TOD sense during Tape I/O.
          $02A3                       Temporary storage during Tape READ.
          $02A4                       Temporary D1IRQ Indicator during Tape READ.
          $02A5                       Temporary for Line Index.
          $02A6                       Flag: TV Standard: $00 = NTSC, $01 = PAL.
          $02A7-$02FF                 Unused.
          $02C0-$02FE                 Sprite #11 Data Area.
                                      (SCREEN + $03F8 + SPR number)
                                      POKE 1024+1016+0,11  to use Sprite#0 DATA
                                      from ($02C0-$02FE).
          $0300-$0301                 Vector: Indirect entry to BASIC Error
                                      Message, (X) points to Message ($E38B).
          $0302-$0303                 Vector: Indirect entry to BASIC Input Line
                                      and Decode ($A483).
          $0304-$0305                 Vector: Indirect entry to BASIC Tokenise
                                      Routine ($A57C).
          $0306-$0307                 Vector: Indirect entry to BASIC LIST
                                      Routine ($A71A).
          $0308-$0309                 Vector: Indirect entry to BASIC Character
                                      dispatch Routine ($A7E4).
          $030A-$030B                 Vector: Indirect entry to BASIC Token
                                      evaluation ($AE86).
          $030C                       Storage for 6510 Accumulator during SYS.
          $030D                       Storage for 6510 X-Register during SYS.
          $030E                       Storage for 6510 Y-Register during SYS.
          $030F                       Storage for 6510 Status Register during SYS.
          $0310                       USR Function JMP Instruction ($4C).
          $0311-0312                  USR Address ($LB,$MB).
          $0313                       Unused.
          $0314-$0315 irqvec          IRQ vector
          $0316-$0317 bkvec           Break ins vector
          $0318-$0319 nmivec          Non-masked interrupt vector
          $031A-      kernalVectors   Location of kernal vectors
          
          $0400-$5FFF APP_RAM         Start of application space
          $6000-$7F3F BACK_SCR_BASE   Secondary hires screen, used as a backup
                                      for erasing menus and windows.
          $7900-$7F3F PRINT_BASE      Printer  driver  address;   see  printer
                                      driver definitions
          $7F40-$7FFF APP_VAR         Application variable space
          $8000-$80FF diskBlkBuf      Disk buffer #0
          $8100-$81FF fileHeader      Disk buffer #1, Info sector
          $8200-$82FF curDirHead      Disk buffer #2, Directory work area
          $8300-$83FF fileTrScTab     Disk  buffer  #3,  Table of  tracks  and
                                      sectors
          $8400-$841D dirEntryBuf     Current  directory  entry,   set  up  by
                                      FindFile
          $841E-$842F DrACurDkNm      Name of disk in drive 0 (device 8)
          $8430-$8441 DrBCurDkNm      Name of disk in drive 1 (device 9)
          $8442-$8452 dataFileName    Name of data file (passed to application)
          $8453-$8464 dataDiskName    Name of disk in drive 3 (device 11)
          $8465-$8475 PrntFilename    Name of current printer driver
          $8476-$8484 PrntDiskName    Name of disk containing printer driver
          $8485                       Unknown
          $8486                       Point to index from to reach $848E
          $8489       curDrive        Current drive's device number
          $848A       diskOpenFlg     Point to index from to reach $8492
          $848B       isGEOS          Format flag of current disk,
                                      $00 - GEOS format
                                      $FF - Non-GEOS diskette
          $848C       interleave      Skew factor for diskette operations
          $848D       numDrives       Number of drive in the system
          $848E-$8491 driveType       GEOS  uses  this table to designate  the
                                      boot  drive,  by  placing a $01  in  the
                                      location   corresponding  to  the   boot
                                      drive. This table is reached by indexing
                                      off of $8486 with the device number.
          $8492-$8495 turboFlags      Drive status bytes,  indexed from  $848A
                                      with the device number.
                                      Bit 7 - Turbodos is loaded
                                      Bit 6 - Turbodos is running
          $8496       curRecord       Current VLIR chain number
          $8497       usedRecords     Number of VLIR chains in the open file
          $8498       fileWritten     Modified  flag,  set to $FF if the  open
                                      VLIR   file   has  been   changed;   $00
                                      otherwise
          $8499-$849A fileSize        VLIR file size
          $849B-$849C appMain         Vector  for user additions to  the  GEOS
                                      main loop
          $849D-$849E intTopVector    Vector for GEOS's IRQ routine
          $849F-$84A0 intBotVector    Vector for a user's additions to the IRQ
                                      routine
          $84A1-$84A2 mouseVector     Vector for button status changes
          $84A3-$84A4 keyVector       Vector  for any  key  entered  from  the 
                                      keyboard
          $84A5-$84A6 inputVector     Vector for mouse direction change
          $84A7-$84A8 mouseFaultVec   Vector to close a menu
          $84A9-$84AA otherPressVec   This vector is used for a lot of  things
                                      that  require an action to be performed.
                                      These  items include:  the  button  was  
                                      released,  the button was  pressed  and 
                                      either the  mouse was visible or  Bit  5 
                                      of MSFLAG (location $30) was set.
          $84AB-$84AC StringFaultVec  Vector for margins exceeded
          $84AD-$84AE alarmTmrVector  Vector for the alarm clock routine
          $84AF-$84B0 BRKVector       Vector    for   the   BRK   instruction,
                                      initially this is set to Panic
          $84B1-$84B2 RecoverVector   Vector  for a routine to clear a  region
                                      of the screen, initially set to ImprintRectangle
          $84B3       selectionFlash  Default delay value for flashing boxes
          $84B4       alphaFlag       Text cursor flag - ** BSW = alphanum input flag
                                      Bit 7 - Blink the cursor
                                      Bit 6 - Cursor is turned on
                                      Bits 0-5 - Blink rate
          $84B5       iconSelFlag     Control flag for click box
                                      Bit 7 - Flash the box
                                      Bit 6 - Only invert the box
          $84B6       faultData       Mouse position flag, set by InterruptMain
                                      Bit 7 - Mouse  is below the  bottom
                                      of the window, windowBottom, $84B9
                                      Bit 6 - Mouse  is above the top  of
                                      the window, windowTop, $84B8
                                      Bit 5 - Mouse is to the left of the
                                      window, leftMargin, $84BA-$84BB
                                      Bit 4 - Mouse  is to the  right  of
                                      the window,  rightMargin, $84BC-
                                      $84BD
                                      Bit 3 - Mouse  is outside the menu,
                                      windowTop,windowBottom,leftMargin,
                                      rightMargin, $86C1-$86C6
          $84B7       menuNumber      Number of menu levels
          $84B8-$84BD                 Window size description
          $84B8       mouseTop        Top row of window
          $84B9       mouseBottom     Bottom row of window
          $84BA-$84BB mouseLeft       Left margin of window
          $84BC-$84BD mouseRight      Right margin of window
          $84BE-$84BF stringX         Text cursor's X position
          $84C0       stringY         Text cursor's Y position
          $84C1-$84FF mousePicData    Sprite data for default mouse
          $8500                       Unused
          $8501       maxMouseSpeed   Maximum mouse speed
          $8502       minMouseSpeed   Minimum mouse speed
          $8503       mouseAccel      Mouse's acceleration rate
          $8504       keyData         Next  key from keyboard buffer,  set  by
                                      GetNextChar
          $8505       mouseData       Current button status
                                      $00 - Pressed
                                      $FF - Released
          $8506       inputData       Mouse's current direction, 0-7,$FF
                                      3 2 1
                                      4 * 0
                                      5 6 7
          $8507                       Current mouse speed
          $8508-$8509                 Unused
          $850A-$850B random          Random number generator value
          $850C-$8514 saveFontTab     Temporary  storage for font data  during
                                      menu   processing,   copy   of   font data,
                                      locations $26-$2E
          $8515       dblClickCount   A counter used by the click box routine,
                                      which  is decremented by the IRQ service
                                      routine if it is nonzero.  See  Appendix
                                      IV.
          $8516       year            Current year (0-99)
          $8517       month           Current month
          $8518       day             Current day of the month
          $8519       hour            Current hour
          $851A       minutes         Current minute of the hour
          $851B       seconds         Current second of the minute
          $851C       alarmSetFlag    **BSW says TRUE if alarm is set for geos to mon
          $851D       sysDBData       Command  byte  returned  by  the  window
                                      processor
          $851E       screencolors    Preferred  colors;  high nibble for  the
                                      foreground color and low nibble for  the
                                      background color
          $851F-$8697 dlgBoxRamBuf    Temporary  storage buffer for the window
                                      processor;    see   DoDlgBox   for    more
                                      information
          $8698-$86BB                 Unused
          $86BC-$86BF                 Unknown
          $86C0                       Number of options in the current menu
          $86C1-$86C6                 Current menu size description
          $86C1                       Top row of menu
          $86C2                       Bottom row of menu
          $86C3-$86C4                 Left margin of menu
          $86C5-$86C6                 Right margin of menu
          $86C7-$86CE                 Stack for menu descriptors
          $86CF-$86D2                 Menu option that was clicked on, indexed
                                      by menu level (0-3)
          $86D3-$86E1                 Menu  option  box  limits,   either  row
                                      values or column high bytes
          $86E2-$86F0                 Menu option box limits, column low bytes
          $86F1-$8718                 Table of running timers, see $8755
          $8719-$872C                 Timer command bytes
                                      Bit 7 - Execute   routine,    timer
                                      reached zero
                                      Bit 6 - Disable routine  execution,
                                      leave timer running
                                      Bit 5 - Stop timer
                                      Bit 4 - Stop timer
          $872D-$8754                 Subroutine   addresses  associated  with
                                      each timer
          $8755-$877C                 Initial  values for  timers,  copied  to
                                      $86F1 when the timer reaches zero
          $877D                       Number of timers in table
          $877E                       Stack pointer for delay stack
          $877F-$87A6                 Time delay values
          $87A7-$87CE                 Return addresses for when the delay time
                                      has expired
          $87CF                       Length of user entry
          $87D0                       Maximum length of user entry
          $87D1-$87D2                 Copy of IMARGN, locations $84A3-$84A4
          $87D3                       Margin control flag,
                                      Bit 7 - User  supplies  the  margin
                                      exceeded  routine  for  the
                                      window with a line of text,
                                      GetString or window command 13
          $87D4-$87D6                 Column  and  row  variables  for  GraphicsString
                                      processor
          $87D7                       Head of keyboard queue
          $87D8                       Tail of keyboard queue
          $87D9                       If this flag is zero,  then the value of
                                      NXTKEY, location $87EA, is placed in the
                                      keyboard queue
          $87DA-$87E9                 Keyboard queue
          $87EA                       Next  key to be placed in  the  keyboard
                                      buffer
          $87EB-$87F2                 Used   by  keyboard  scan  routine   for
                                      debouncing the keyboard
          $87F3-$87FA                 Used by keyboard scan routine to prevent
                                      multiple key hits
          $87FB-$8806                 Used  by SmallPutChar to manipulate  the  font
                                      bit streams
          $8807       realSize        Width  of previous character for  delete
                                      character
          $8808                       Temporary  storage used by the click box
                                      routine
          $8809                       Temporary  storage used by the click box
                                      routine
          $880A                       A non-zero value disables alarm chimes
          $880B                       Temporary   storage  used  by  the   IRQ
                                      routine
          $880C-$884F                 Default  click  box  table used  by  the
                                      window processor; see also DoIcons
          $880C                       Number of click boxes (8 maximum)
          $880D-$880E                 X  position of mouse after  click  boxes
                                      have been drawn
          $880F                       Y  position  of mouse after click  boxes
                                      have been drawn
          $8810-$884F                 Click box definitions; see DoIcons
          $8850-$8851                 Return address of caller to LdDeskAcc
          $8852                       Copy of the SP register from LdDeskAcc
          $8853-$8854                 Return address of caller to DoDlgBox
          $8855                       Copy of the SP register from DoDlgBox
          $8856-$885C                 Used by command 16 in DoDlgBox
          $8856                       Number of files found
          $8857                       Left indent of file subwindow
          $8858                       Down indent of file subwindow
          $8859-$885A                 Pointer to filename table
          $885B                       Index of first file in the subwindow
          $885C                       Index on selected file
          $885D                       Parameter  passed to a program,  copy of
                                      DPAGE, location $16
          $885E                       Copy  of  the  status  register   during
                                      serial communications
          $885F                       Copy  of  location $D01A  during  serial
                                      communications
          $8860                       Copy  of  R6510,  location  $01,  during
                                      serial communications
          $8861                       Copy  of  location $D015  during  serial
                                      communication
          $8862                       Copy  of  location $DD00 before  sending
                                      Turbodos
          $8863-$8866                 Command buffer for Turbodos
          $8867                       Copy of location $DD00 with serial lines
                                      cleared
          $8868                       Copy  of location $DD00 with clock  line
                                      set
          $8869                       Try   counter   for   disk    read/write
                                      operations
          $886A                       Disk status byte read by Turbodos
          $886B                       Load flag
                                      Bit 0 - Do  not run the application
                                      being  loaded;  use  LDADRS
                                      locations  $886C-$886D   as
                                      load address
          $886C-$886D                 Alternate file load address
          $886E                       Reports which drive is being searched
                                      $00 - logged disk
                                      $FF - checking other drive
          $886F-$8874                 Used by VLIR file routines
          $886F                       Track  number  of  VLIR  file  directory
                                      entry
          $8870                       Sector  number  of VLIR  file  directory
                                      entry
          $8871-$8872                 Index into directory sector to VLIR file
                                      directory entry
          $8873                       Track number of VLIR sector
          $8874                       Sector number of VLIR sector
          $8875                       Try counter used by VerWriteBlock
          $8876                       Verify flag; $00=NO, $FF=YES
          $8877-$88BA                 Unused
          $88BB       savedmoby2      Saved value of moby2 for context saving done
                                      in dlg boxes & desk accessories.  Left out of
                                      original GEOS save code, put here so we don't
                                      screw up desk accessories, etc. that know the
                                      size of TOT_SRAM_SAVED above.
          $88BC       scr80polar      Copy of reg 24 in VDC for C128
          $88BD       scr80colors     Screen colors for 80 column
          $88BE       vdcClrMode      Holds current color mode for C128 color rtns.
          $88BF-$88C2 driveData       1 byte each drive reserved for disk drivers
          $88C3       ramExpSize      Size of ram expansion unit
          $88C4       sysRAMFlg       Tells how ram expansion is being used
                                      Bank 0 - reserved for kernal use
                                      Bit 7 - whether $000-$78FF used by MoveData
                                      Bit 6 - $8300-$B8FF holds disk drivers for A-C
                                      Bit 5 - $7900-$7DFF is loaded with $8400-$88FF
                                      Bit 4 - $7E00-$82FF has reboot code
                                              $B900-$FCFF is saved with kernal rboot
          $88C5       firstBoot       $00 if deskTop not yet loaded, $FF otherwise
          $88C6       curType         Current disk type (copied from diskType)
          $88C7-$88CA ramBase         RAM bank for each drive to use if RAM/shadowed
          $88CB-$88DB inputDevName    Holds name of current input device
          $88DC-$88ED DrCCurDkNm      Name of disk in drive C, padded with $A0
          $88EE-$88FF DrDCurDkNm      Name of disk in drive D, padded with $A0
          $8900-$89FF dir2Head        2nd directory header block for larger drives
          $8A00-$8A3E                 Sprite data block #40, GEOS sprite 0
          $8A40-$8A7E                 Sprite data block #41, GEOS sprite 1
          $8A80-$8ABE                 Sprite data block #42, GEOS sprite 2
          $8AC0-$8AFE                 Sprite data block #43, GEOS sprite 3
          $8B00-$8B3E                 Sprite data block #44, GEOS sprite 4
          $8B40-$8B7E                 Sprite data block #45, GEOS sprite 5
          $8B80-$8BBE                 Sprite data block #46, GEOS sprite 6
          $8BC0-$8BFE                 Sprite data block #47, GEOS sprite 7
          $8C00-$8FE7 COLOR_MATRIX    Color ram for hires screen
          $8FE8-$8FFF                 Sprite pointers; usually set to 40 to 47
          $9000-$9FFF DISK_BASE       Disk driver base address
          $9C78-$9D78                 3rd BAM sector?
          $A000-$BF3F SCREEN_BASE     Primary hires screen
          $BF40-$FE7F                 GEOS Kernal
          $FE80-$FFF9                 Input driver
          $FFFA-$FFFB NMI_VECTOR      NMI vector
          $FFFC-$FFFD RESET_VECTOR    Power up reset vector
          $FFFE-$FFFF IRQ_VECTOR      IRQ vector
          

 

                                  GEOS EQUATES and LOGICALS

          For $2F - dispBufferOn
          ST_WR_FORE           - $80
          ST_WR_BACK           - $40
          ST_WRGS_FORE         - $20

          For GraphicsString
          MOVEPENTO            - 1                  Move Pen to X,Y
          LINETO               - 2                  Draw line to X,Y
          RECTANGLETO          - 3                  Draw a rectangle to x,y
                               - 4 
          NEWPATTERN           - 5                  Set a new pattern
          ESC_PUTSTRING        - 6                  Start PutString interpretation
          FRAME_RECTO          - 7                  Draw frame or rectangle
          PEN_X_DELTA          - 8                  Move pen by signed word delta in x
          PEN_Y_DELTA          - 9                  PEN_XY_DELTA

          For PutDecimal
          SET_LEFTJUST         - %10000000          Left justified
          SET_RIGHTJUST        - %00000000          Right justified
          SET_SUPRESS          - %01000000          Supress leading 0's
          SET_NOSUPRESS        - %00000000          Leading 0's

          For $01 - CPU_DATA
          IO_IN                - $35                60K RAM, 4K IO space in
          RAM_64K              - $30                64K RAM
          KRNL_BAS_IO_IN       - $37                Both Kernal and BASIC ROMS mapped in
          KRNL_IO_IN           - $36                Kernal and IO space mapped in

          For DoMenu
          HORIZONTAL           - %00000000
          VERTICAL             - %10000000
          CONSTRAINED          - %01000000
          UN_CONSTRAINED       - %00000000
          .
          SUB_MENU             - $80                Defining action of a menu item click
          DYN_SUB_MENU         - $40
          MENU_ACTION          - $00

          For $2E - currentMode
          SET_UNDERLINE        - %10000000
          SET_BOLD             - %01000000
          SET_REVERSE          - %00100000
          SET_ITALIC           - %00010000
          SET_OUTLINE          - %00001000
          SET_SUPERSCRIPT      - %00000100
          SET_SUBSCRIPT        - %00000010
          SET_PLAINTEXT        - %00000000
          .
          UNDERLINE_BIT        - 7
          BOLD_BIT             - 6
          REVERSE_BIT          - 5
          ITALIC_BIT           - 4
          OUTLINE_BIT          - 3
          SUPERSCRIPT_BIT      - 2
          SUBSCRIPT_BIT        - 1

          For PutChar, PutString, etc.
          BOLDON               - 24
          ITALICON             - 25
          OUTLINEON            - 26
          PLAINTEXT            - 27
          USELAST              - 127                Erase characters
          SHORTCUT             - 128                Shortcut characters

          For directory entries "GEOS file type" byte
          NOT_GEOS             - 0
          BASIC                - 1
          ASSEMBLY             - 2
          DATA                 - 3
          SYSTEM               - 4
          DESC_ACC             - 5
          APPLICATION          - 6
          APPL_DATA            - 7
          FONT                 - 8
          PRINTER              - 9
          INPUT_DEVICE         - 10
          DISK_DEVICE          - 11
          SYSTEM_BOOT          - 12
          TEMPORARY            - 13
          AUTO_EXEC            - 14
          INPUT_128            - 15
          NUM_FILE_TYPES       - 15

          For "GEOS File Structure"
          SEQUENTIAL           - 0
          VLIR                 - 1

          GEOS Error Messages
          NO_BLOCKS            - 1
          INSUFF_SPACE         - 3
          FULL_DIRECTORY       - 4
          FILE_NOT_FOUND       - 5
          OUT_OF_RECORDS       - 9
          DEV_NOT_FOUND        - 13
          WR_VERR_ERR          - $25
          WR_PR_ON             - $26

          File Types
          DEL                  - 0
          SEQ                  - 1
          PRG                  - 2
          USR                  - 3
          REL                  - 4




                                  BO'S GEOS MACROS

          ldb DEST, VALUE      Load DEST address byte with VALUE byte
          ldw DEST, VALUE      Load DEST address word with VALUE word
          mvb SOURCE, DEST     Move SOURCE address byte into DEST address byte
          mvw SOURCE, DEST     Move SOURCE address word into DEST address word
          add SOURCE           Clear carry and add SOURCE address byte to accumulator
          adb SOURCE, DEST     Add SOURCE address byte in to DEST address byte
          adw SOURCE, DEST     Add SOURCE address word in to DEST address word
          avb VALUE, DEST      Add VALUE byte in to DEST address byte
          avw VALUE, DEST      Add VALUE word in to DEST address word
          sub SOURCE           Set carry and subtract SOURCE address byte from accumulator
          sbb SOURCE, DEST     Subtract SOURCE address byte from to DEST address byte
          sbw SOURCE, DEST     Subtract SOURCE address word from to DEST address word
          svb VALUE,  DEST     Subtract VALUE byte from to DEST address byte
          svw VALUE,  DEST     Subtract VALUE word from to DEST address word
          cpb SOURCE, DEST     Compare SOURCE address byte with DEST address byte
          cbi SOURCE, IMMED    Compare SOURCE address byte with IMMED byte
          cpw SOURCE, DEST     Compare SOURCE address word with DEST address word
          cwi SOURCE, IMMED    Compare SOURCE address word with IMMED word
          blt ADDRESS          Branch on less-than to ADDRESS (1 cmd)
          ble ADDRESS          Branch on less-than or equal-to to ADDRESS (2 cmds)
          bge ADDRESS          Branch on greater-than or equal-to to ADDRESS (1 cmd)
          bgt ADDRESS          Branch on greater-than to ADDRESS (2 cmds)
          phb SOURCE           Push SOURCE address byte on to stack
          phw SOURCE           Push SOURCE address word on to stack
          plb DEST             Pull stack byte in to DEST address byte
          plw DEST             Pull stack word in to DEST address word
          bra ADDRESS          Branch unconditionally to ADDRESS
          ylp ADDRESS          Decrement Y, and if non-zero, branch to ADDRESS


 
 
          Appendix I : GEOS Errors

          GEOS  subroutines that are able to return errors,  return one  of
          the following error numbers in the X register.          
          1    Not enough blocks on the disk
          2    Illegal track or sector.
          3    Disk full, insufficient space.
          4    Directory full
          5    File not found.
          6    Attempt to deallocate an unallocated block.
          7    Illegal VLIR chain number.
          8    VLIR file error; illegal track or sector specified.
          9    Too many VLIR chains, out of records.
          10   File is not a VLIR file.
          11   End of file, file too long.
          13   Device not present.
          31   Write protect is on.
          32   Read error, no sync character.
          35   Disk drive FDC errors:
                    2    Header block not found.
                    7    Verify error after write.
                    9    Header block checksum error.
                    10   Data block too long.
                    11   ID mismatch error.
          37   Write verify error
          38   Disk is write protected.
          38   Disk drive FDC errors?
                    4    Data block not found.
                    5    Data block checksum error.
          39   Write error.  See VerWriteBlock.
 



          Appendix II : Glossary

               This is a simple glossary for some of the terms used in this
          manual.

          BOX : A rectangular region on the hires graphic screen.

          CLICK  :  To press the button.  Usually used to select the option
          being pointed to by the mouse.

          CLICK BOX :  A special control structure that appears as a box on
          the  screen.  This  box is capable of being clicked on  with  the
          mouse. When the box is clicked on, some operation occurs.

          CURSOR :  The text cursor that appears when the user is asked  to
          type something in on the keyboard.  It appears as a thin vertical
          bar.

          DOUBLE  CLICK :  To click twice on an option.  This is used as  a
          verification method,  making sure that the user wishes to perform
          that operation.

          FONT  :  Data that represents the graphical image of a  character
          set.

          INFO  SECTOR  (INFORMATION  SECTOR)  :   A  sector  on  the  disk
          associated with a file.  This contains some information about the
          associated file,  i.e. icon image, load address, class, author and
          text field.  See chapter 5.

          INLINE  DATA :  This relates to data that is in the middle  of  a
          region  of  machine  code.   The  data  immediately  follows  the
          subroutine  call and control returns to the instruction following
          the data.  This relieves the user of the burden of setting up the
          input parameters to a subroutine that is seldomly called or whose
          data does not change.  See i_Rectangle for an example of inline data.

          INVERT : To change the pixels on the hires screen from background
          to foreground, or from foreground to background.

          MEMORY  SWAPPING :  Used by desk accessories to save  the  memory
          that  they would normally reside in.  This allows them to be used
          from  within  applications because the  application's  memory  is
          restored when the desk accessory is finished.

          MENU :  A list of options for the user to select from. A menu can
          be  either horizontal or vertical.  Generally,  the main menu  is
          horizontal and the submenus are vertical.

          MOUSE  :  The little arrow that is controlled by the joystick  or
          other input device.

          RECURRING  TIMED  EVENT  :  This is a subroutine that  is  to  be
          executed every so often. The amount of time between executions is
          stored.   The  interrupt  routines  decrement  the  timers  every
          sixtieth of a second.  When the timer reaches zero, the GEOS main
          loop calls the appropriate routine. This allows several things to
          seem   to  happen  simultaneously.   It  is  the  beginnings   of
          multitasking.

          SKEW  FACTOR  :  This is the number of sector to skip  over  when
          looking for consecutive sectors for a file.  It is 8 for Turbodos
          and 10 for DOS. The reason for using a skew factor is efficiency.
          If physically consecutive sectors were used, the disk drive would
          have  to wait for a complete revolution of the disk between  each
          sector  read.  The  skew  factor  is  set so  that  this  is  not
          necessary.  A skew factor is set to a value such that by the time
          the  computer  has  processed a sector,  the next  sector  is  on
          position to be read.

          STRING :  A sequence of bytes terminated by a zero byte.  Usually
          used for representing text.

          TURBODOS  :  The special disk routines used by Berkeley Softworks
          to speed up disk access.

          VLIR  :  Variable  Length Index Record,  a tree  structured  file
          structure.  Presently GEOS limits files to 127 of these records.

          DIALOG :  A special control structure that appears as a large box
          on the screen,  usually with a shadow.  This control structure is
          used to elicit some form of user input or selection.

          ZERO BYTE : A single byte with the value of zero.






          Appendix III : Fill Patterns


                    0              1              2              3
               ----------     ----------     ----------     ----------
               I        I     I********I     I* * * * I     I*  **  *I
               I        I     I********I     I * * * *I     I *    * I
               I        I     I********I     I* * * * I     I  *  *  I
               I        I     I********I     I * * * *I     I*  **  *I
               I        I     I********I     I* * * * I     I*  **  *I
               I        I     I********I     I * * * *I     I  *  *  I
               I        I     I********I     I* * * * I     I *    * I
               I        I     I********I     I * * * *I     I*  **  *I
               ----------     ----------     ----------     ----------

                    4              5              6              7
               ----------     ----------     ----------     ----------
               I***** **I     I*   *   I     I *** ***I     I*   *   I
               I**** * *I     I  *   * I     I** *** *I     I        I
               I***** **I     I*   *   I     I *** ***I     I  *   * I
               I**** * *I     I  *   * I     I** *** *I     I        I
               I***** **I     I*   *   I     I *** ***I     I*   *   I
               I**** * *I     I  *   * I     I** *** *I     I        I
               I***** **I     I*   *   I     I *** ***I     I  *   * I
               I**** * *I     I  *   * I     I** *** *I     I        I
               ----------     ----------     ----------     ----------

                    8              9             10             11
               ----------     ----------     ----------     ----------
               I *** ***I     I********I     I * * * *I     I       *I
               I********I     I        I     I * * * *I     I      * I
               I** *** *I     I********I     I * * * *I     I     *  I
               I********I     I        I     I * * * *I     I    *   I
               I *** ***I     I********I     I * * * *I     I   *    I
               I********I     I        I     I * * * *I     I  *     I
               I** *** *I     I********I     I * * * *I     I *      I
               I********I     I        I     I * * * *I     I*       I
               ----------     ----------     ----------     ----------

                   12             13             14             15
               ----------     ----------     ----------     ----------
               I*       I     I******* I     I *******I     I********I
               I *      I     I****** *I     I* ******I     I*   *   I
               I  *     I     I***** **I     I** *****I     I*   *   I
               I   *    I     I**** ***I     I*** ****I     I*   *   I
               I    *   I     I*** ****I     I**** ***I     I********I
               I     *  I     I** *****I     I***** **I     I*   *   I
               I      * I     I* ******I     I****** *I     I*   *   I
               I       *I     I *******I     I******* I     I*   *   I
               ----------     ----------     ----------     ----------

                   16             17             18             19
               ----------     ----------     ----------     ----------
               I********I     I********I     I    *   I     I*   *   I
               I*       I     I*       I     I   ***  I     I   * *  I
               I*       I     I*       I     I  *   * I     I  *   * I
               I*       I     I*       I     I**     *I     I *     *I
               I*       I     I********I     I*       I     I*   *   I
               I*       I     I       *I     I       *I     I        I
               I*       I     I       *I     I      * I     I* * * * I
               I*       I     I       *I     I     *  I     I        I
               ----------     ----------     ----------     ----------

                   20             21             22             23
               ----------     ----------     ----------     ----------
               I*       I     I *      I     I*     * I     I      **I
               I *      I     I* *     I     I *   *  I     I*    *  I
               I  *     I     I        I     I  ***  *I     I *  *   I
               I        I     I        I     I *   *  I     I  **    I
               I      * I     I     *  I     I*     * I     I    **  I
               I     *  I     I    * * I     I       *I     I      * I
               I    *   I     I        I     I       *I     I       *I
               I        I     I        I     I       *I     I       *I
               ----------     ----------     ----------     ----------

                   24             25             26             27
               ----------     ----------     ----------     ----------
               I*****   I     I*       I     I * * * *I     I   *    I
               I *** *  I     I*       I     I* * * * I     I  *     I
               I  *   * I     I *     *I     I *      I     I * * *  I
               I *   ***I     I  ***** I     I *      I     I* * * * I
               I*   ****I     I    *   I     I * * * *I     I********I
               I   * ***I     I    *   I     I    * * I     I      * I
               I  *   * I     I   * *  I     I     *  I     I     *  I
               I ***   *I     I***   **I     I     *  I     I    *   I
               ----------     ----------     ----------     ----------

                   28             29             30             31
               ----------     ----------     ----------     ----------
               I  *     I     I *** ***I     I* ******I     I        I
               I * *    I     I*   *  *I     I        I     I    *   I
               I*   *   I     I*   ****I     I* ******I     I   * *  I
               I*   *   I     I*   ****I     I* ******I     I  * * * I
               I*   *   I     I *** ***I     I* **    I     I * * * *I
               I*   *   I     I*  **   I     I* **    I     I  * * * I
               I     * *I     I*****   I     I* **    I     I   * *  I
               I      * I     I*****   I     I* **    I     I    *   I
               ----------     ----------     ----------     ----------






          Appendix IV : Programming Notes

          Bo's Prebabble: Some of this is Mr. Boyce's comments on creating 
          GEOS files, and as you may have read, pre-dated GEOS 2.0. For this
          reason, much has been cut out and revised.

          This  section contains some information on writing programs under 
          the GEOS operating system.

          Creating GEOS Files:
               It  is important that all GEOS programs have an  information
          sector. Therefore, to create GEOS programs, it  is suggested that
          a small BASIC-Assembly language shell  be added to the  beginning 
          of a user's program.  This  shell  will  consist  of a  BASIC SYS 
          statement and some assembly code to delete the file (Use DeleteFile)
          and resave the  file as  a GEOS file (Use SaveFile). After having 
          done this, for  completeness,  the info sector  that is in memory 
          should be rewritten because  SaveFile will clear  the text field.  
          Also the directory should be modified  to include the proper time 
          and date of file creation  (Use FindFile and PutBlock). After all 
          this  has been  done, a call to FirstInit  and EnterDesktop  will  
          restart GEOS. The CONVERT program by BSW does not convert  itself 
          in  this way.  It is designed  so  that the information sector is 
          exactly in the last disk sector of the file. It then modifies the 
          sector links of the last two sectors  and changes  the  directory  
          entry  for  convert.  This leaves  the conversion code as part of 
          the final  program; the method  outlined above  does not. Another 
          possibility is to use the same method as BSW, but to make the info 
          sector the first sector after the initial shell. Then only 1 sector 
          and  the directory  need be modified,  and sectors for the  shell 
          program can be freed up. This is all up to a  user's discretion.

          Creating CBM-style GEOS programs:
               If a program with a BASIC start (10 SYS2061), is to use GEOS
          it must first disable interrupts (SEI) and then set the system to
          all  RAM  by loading location $01 with a value of  $30.  This  is
          important because GEOS resides  beneath the Commodore's ROMs  and
          I/O  section.  When GEOS needs to do I/O,  it switches in the I/O
          ports, relieving the user of this burden. Also a call to FirstInit
          will set things up so that the GEOS graphic screen is displayed.
          
          Simple Applications:
               Application programs have everything set up for them  before
          they are run.  To terminate an application properly, a EnterDesktop
          is  made at some point.  If the program is simply  a  menu,  like
          Convert,  then  a call to DoMenu and an RTS is sufficient to be the
          main body of code.  One of the menu options should make the  jump
          to EnterDesktop.  More on that RTS later.

          Desk Accessories:
               Desk  Accessories  are similar to applications  except  that
          they  have  the memory that they reside in saved to  disk  first.
          This  means  that they should be relatively  short  programs.  To
          decide  whether  something  should  be a  desk  accessory  or  an
          application,  one  need only determine whether it is necessary to
          be  able to run the program from within another application  (i.e.
          like running Photo Manager from GEOpaint).  Desk accessories also
          have  some  restrictions that do not apply  to  applications.  In
          order for a desk accessory to open a window,  the window  storage
          area   must  be  saved  and  later  restored.   This  is  because
          GEOS  saved  everything before executing the desk  accessory.  To
          terminate a desk accessory, the vector IMainLoop should  be loaded
          with  RstrAppl and  an RTS should be made.  More on the RTS in  a
          moment.  Another  means of terminating a desk accessory is simply
          to jump to RstrAppl. It is the desk accessory's responsibility to
          clean up after itself and to take itself out of memory.
               Since the DoDlgBox command causes some system-wide variables
          to be saved before presenting itself, and desk accessories do the
          same thing in the SAME PLACE, it is not wise to use dialog boxes
          in desk accessories.  It is possible, however.  All your need to
          do is copy the 417 bytes at location $8F15 to a buffer of the same
          size which you maintain. Then, after the dialog box has returned,
          restore the same.

          GEOS MainLoop:
               The  RTS mentioned in the previous paragraphs causes GEOS to
          return to its main routine (MainLoop).  This is a simple polling loop
          that looks for things to do. Half of GEOS is interrupt driven and
          half  of  it  is polled.  It first checks if the  user  has  done
          anything, in the following order:
               1)   Mouse direction change
               2)   Button status change
               3)   Key entered from keyboard
               4)   Mouse outside menu
          Then  the  main  loop looks for something to do by  checking  the
          recurring timed events and the delayed routines,  executing those
          that are ready.  The main loop then maintains the memory image of
          the time and date and handles the alarm clock.  Finally, if there
          is something at IMainLoop, it is called and the loop starts over.
               The IRQ interrupt routine does mainly I/O operations.  First
          it decrements location $8515 if it is non-zero (counter for click
          box handler). Then it scans the keyboard and enters any depressed
          keys into the keyboard buffer. Location $880A is then decremented
          if  it  is  non-zero  (chime counter).  Next,  a  jump is made to 
          InterruptMain. After which, a jump is made through to process any
          user additions  to  the IRQ  service  routine.  These  additions 
          should be fairly short so as not to make the interrupt take too 
          long.  Finally the status quo is restored and things  go on their 
          merry way.





          Appendix V: GEOS/ASCII/PETSCII Character sets


          Dec  Hex  GEOS Char       ASCII  Char  PETSCII Char
          ----------------------------------------------------
          0    $00                  {NUL}
          1    $01  {PGBREAK}       {SOH}
          2    $02                  {STX}
          3    $03                  {ETX}
          4    $04                  {EOT}
          5    $05                  {ENQ}        {WHITE}
          6    $06                  {ACK}
          7    $07                  {BEL}
          8    $08  {BACKSPACE}     {BACKSPACE}  {DIS-SHFT-C=}
          9    $09  {TAB}           {TAB}        {ENA-SHFT-C=}
          10   $0A  {LINEFEED}      {LINEFEED}
          11   $0B  {HOME}          {VT}
          12   $0C  {UP1LINE}       {FF}
          13   $0D  {CR}            {CR}         {CR}
          14   $0E  {UNDERLINE}     {SO}         {LOWERCASE}
          15   $0F  {UNDERLINE OFF} {SI}
          16   $10  {GRAPHICS ESC}  {SLE}
          17   $11  {RULER ESC}     {CS1}        {CRSR-DOWN}
          18   $12  {RVS}           {DC2}        {RVS}
          19   $13  {RVS OFF}       {DC3}        {HOME}
          20   $14  {NEW COL: 2}    {DC4}        {DEL}
          21   $15  {NEW ROW: 1}    {NAK}
          22   $16  {NEW POS: 3}    {SYN}
          23   $17  {NEWCARDSET}    {ETB}
          24   $18  {BOLD}          {CAN}
          25   $19  {ITALICS}       {EM}
          26   $1A  {OUTLINE}       {SIB}
          27   $1B  {PLAIN TEXT}    {ESC}
          28   $1C                  {FS}         {RED}
          29   $1D                  {GS}         {CRSR-RIGHT}
          30   $1E                  {RS}         {GREEN}
          31   $1F                  {US}         {BLUE}
          32   $20  {space}         {space}      {space}
          33   $21  !               !            !
          34   $22  "               "            "
          35   $23  #               #            #
          36   $24  $               $            $
          37   $25  %               %            %
          38   $26  &               &            &
          39   $27  '               '            '
          40   $28  (               (            (
          41   $29  )               )            )
          42   $2A  *               *            *
          43   $2B  +               +            +
          44   $2C  ,               ,            ,
          45   $2D  -               -            -
          46   $2E  .               .            .
          47   $2F  /               /            /
          48   $30  0               0            0
          49   $31  1               1            1
          50   $32  2               2            2
          51   $33  3               3            3
          52   $34  4               4            4
          53   $35  5               5            5
          54   $36  6               6            6
          55   $37  7               7            7
          56   $38  8               8            8
          57   $39  9               9            9
          58   $3A  :               :            :
          59   $3B  ;               ;            ;
          60   $3C  <               <            <
          61   $3D  =               =            =
          62   $3E  >               >            >
          63   $3F  ?               ?            ?
          64   $40  @               @            @
          65   $41  A               A            a
          66   $42  B               B            b
          67   $43  C               C            c
          68   $44  D               D            d
          69   $45  E               E            e
          70   $46  F               F            f
          71   $47  G               G            g
          72   $48  H               H            h
          73   $49  I               I            i
          74   $4A  J               J            j
          75   $4B  K               K            k
          76   $4C  L               L            l
          77   $4D  M               M            m
          78   $4E  N               N            n
          79   $4F  O               O            o
          80   $50  P               P            p
          81   $51  Q               Q            q
          82   $52  R               R            r
          83   $53  S               S            s
          84   $54  T               T            t
          85   $55  U               U            u
          86   $56  V               V            v
          87   $57  W               W            w
          88   $58  X               X            x
          89   $59  Y               Y            y
          90   $5A  Z               Z            z
          91   $5B  [               [            [
          92   $5C  \               \            {POUND}
          93   $5D  ]               ]            ]
          94   $5E  ^               ^            ^
          95   $5F  _               _            _
          96   $60  `               `            {GRAPHIC}
          97   $61  a               a            {GRAPHIC}
          98   $62  b               b            {GRAPHIC}
          99   $63  c               c            {GRAPHIC}
          100  $64  d               d            {GRAPHIC}
          101  $65  e               e            {GRAPHIC}
          102  $66  f               f            {GRAPHIC}
          103  $67  g               g            {GRAPHIC}
          104  $68  h               h            {GRAPHIC}
          105  $69  i               i            {GRAPHIC}
          106  $6A  j               j            {GRAPHIC}
          107  $6B  k               k            {GRAPHIC}
          108  $6C  l               l            {GRAPHIC}
          109  $6D  m               m            {GRAPHIC}
          110  $6E  n               n            {GRAPHIC}
          111  $6F  o               o            {GRAPHIC}
          112  $70  p               p            {GRAPHIC}
          113  $71  q               q            {GRAPHIC}
          114  $72  r               r            {GRAPHIC}
          115  $73  s               s            {GRAPHIC}
          116  $74  t               t            {GRAPHIC}
          117  $75  u               u            {GRAPHIC}
          118  $76  v               v            {GRAPHIC}
          119  $77  w               w            {GRAPHIC}
          120  $78  x               x            {GRAPHIC}
          121  $79  y               y            {GRAPHIC}
          122  $7A  z               z            {GRAPHIC}
          123  $7B  {               {            {GRAPHIC}
          124  $7C  |               |            {GRAPHIC}
          125  $7D  }               }            |
          126  $7E  ~               ~            {PI}
          127  $7F  {USE LAST/BS}                {GRAPHIC}
          128  $80
          129  $81                               {ORANGE}
          130  $82                   
          131  $83                   
          132  $84                   
          133  $85                               {F1}
          134  $86                               {F2}
          135  $87                               {F3}
          136  $88                               {F4}
          137  $89                               {F5}
          138  $8A                               {F6}
          139  $8B                               {F7}
          140  $8C                               {F8}
          141  $8D                               {SHFT-RTN}
          142  $8E                               {UPPERCASE}
          143  $8F
          144  $90                               {BLACK}
          145  $91                               {CRSR-UP}
          146  $92                               {RVS-OFF}
          147  $93                               {CLEAR}
          148  $94                               {INSERT}
          149  $95                               {BROWN}
          150  $96                               {LT RED}
          151  $97                               {DK GREY}
          152  $98                               {MED GREY}
          153  $99                               {LT GREEN}
          154  $9A                               {LT BLUE}
          155  $9B                               {LT GREY}
          156  $9C                               {PURPLE}
          157  $9D                               {CRSR-LEFT}
          158  $9E                               {YELLOW}
          159  $9F                               {CYAN}
          160  $A0                               {SHFT-SPACE}
          161  $A1                               {GRAPHIC}
          162  $A2                               {GRAPHIC}
          163  $A3                               {GRAPHIC}
          164  $A4                               {GRAPHIC}
          165  $A5                               {GRAPHIC}
          166  $A6                               {GRAPHIC}
          167  $A7                               {GRAPHIC}
          168  $A8                               {GRAPHIC}
          169  $A9                               {GRAPHIC}
          170  $AA                               {GRAPHIC}
          171  $AB                               {GRAPHIC}
          172  $AC                               {GRAPHIC}
          173  $AD                               {GRAPHIC}
          174  $AE                               {GRAPHIC}
          175  $AF                               {GRAPHIC}
          176  $B0                               {GRAPHIC}
          177  $$B1                              {GRAPHIC}
          178  $$B2                              {GRAPHIC}
          179  $B3                               {GRAPHIC}
          180  $B4                               {GRAPHIC}
          181  $B5                               {GRAPHIC}
          182  $B6                               {GRAPHIC}
          183  $B7                               {GRAPHIC}
          184  $B8                               {GRAPHIC}
          185  $B9                               {GRAPHIC}
          186  $BA                               {GRAPHIC}
          187  $BB                               {GRAPHIC}
          188  $BC                               {GRAPHIC}
          189  $BD                               {GRAPHIC}
          190  $BE                               {GRAPHIC}
          191  $BF                               {GRAPHIC}
          192  $C0                               A
          193  $C1                               B
          194  $C2                               C
          195  $C3                               D
          196  $C4                               E
          197  $C5                               F
          198  $C6                               G
          199  $C7                               H
          200  $C8                               I
          201  $C9                               J
          202  $CA                               K
          203  $CB                               L
          204  $CC                               M
          205  $CD                               N
          206  $CE                               O
          207  $CF                               P
          208  $D0                               Q
          209  $D1                               R
          210  $D2                               S
          211  $D3                               T
          212  $D4                               U
          213  $D5                               V
          214  $D6                               W
          215  $D7                               X
          216  $D8                               Y
          217  $D9                               Z
          218  $DA                               {GRAPHIC}
          219  $DB                               {GRAPHIC}
          220  $DC                               {GRAPHIC}
          221  $DD                               |
          222  $DE                               {PI}
          223  $DF                               {GRAPHIC}
          224  $E0                               {SHFT-SPACE}
          225  $E1                               {GRAPHIC}
          226  $E2                               {GRAPHIC}
          227  $E3                               {GRAPHIC}
          228  $E4                               {GRAPHIC}
          229  $E5                               {GRAPHIC}
          230  $E6                               {GRAPHIC}
          231  $E7                               {GRAPHIC}
          232  $E8                               {GRAPHIC}
          233  $E9                               {GRAPHIC}
          234  $EA                               {GRAPHIC}
          235  $EB                               {GRAPHIC}
          236  $EC                               {GRAPHIC}
          237  $ED                               {GRAPHIC}
          238  $EE                               {GRAPHIC}
          239  $EF                               {GRAPHIC}
          240  $F0                               {GRAPHIC}
          241  $F1                               {GRAPHIC}
          242  $F2                               {GRAPHIC}
          243  $F3                               {GRAPHIC}
          244  $F4                               {GRAPHIC}
          245  $F5                               {GRAPHIC}
          246  $F6                               {GRAPHIC}
          247  $F7                               {GRAPHIC}
          248  $F8                               {GRAPHIC}
          249  $F9                               {GRAPHIC}
          250  $FA                               {GRAPHIC}
          251  $FB                               {GRAPHIC}
          252  $FC                               {GRAPHIC}
          253  $FD                               {GRAPHIC}
          254  $FE                               {GRAPHIC}
          255  $FF                               {PI}
          




        Appendix VI:    6502/6510/8502 Assembly language


          6502 Opcodes and Quasi-Opcodes.
 
          The following table lists all of the available opcodes on the 65xx line of 
          micro-processors (such as the 6510 on the C=64 and the 8502 on the C=128)
 
        Mnemonic   Hex Value Description                Addressing Mode  Bytes/Time   Std
        ---------------------------------------------------------------------------------
        ADC        $71       A <- (A) + M + C           ((Ind),Y)        2/5'1        *
        ADC        $6D       A <- (A) + M + C           (Absolute)       3/4          *
        ADC        $7D       A <- (A) + M + C           (Absolute,X)     3/4'1        *
        ADC        $79       A <- (A) + M + C           (Absolute,Y)     3/4'1        *
        ADC        $69       A <- (A) + M + C           (Immediate)      2/2          *
        ADC        $61       A <- (A) + M + C           (Ind,X)          2/6          *
        ADC        $65       A <- (A) + M + C           (Z-Page)         2/3          *
        ADC        $75       A <- (A) + M + C           (Z-Page,X)       2/4          *
        ANC        $0B       A <- A /\ M, C=~A7         (Immediate)      1/2
        ANC        $2B       A <- A /\ M, C <- ~A7      (Immediate)      1/2
        AND        $31       A <- (A) /\ M              ((Ind),Y)        2/5'1        *
        AND        $2D       A <- (A) /\ M              (Absolute)       3/4          *
        AND        $3D       A <- (A) /\ M              (Absolute,X)     3/4'1        *
        AND        $39       A <- (A) /\ M              (Absolute,Y)     3/4'1        *
        AND        $29       A <- (A) /\ M              (Immediate)      2/2          *
        AND        $21       A <- (A) /\ M              (Ind,X)          2/6          *
        AND        $25       A <- (A) /\ M              (Z-Page)         2/3          *
        AND        $35       A <- (A) /\ M              (Z-Page,X)       2/4          *
        ANE        $8B       M <-[(A)\/$EE] /\ (X)/\(   (Immediate)      2/2^4
        ARR        $6B       A <- [(A /\ M) >> 1]       (Immediate)      1/2'5
        ASL        $0E       C <- A7, A <- (A) << 1     (Absolute)       3/6          *
        ASL        $1E       C <- A7, A <- (A) << 1     (Absolute,X)     3/7          *
        ASL        $0A       C <- A7, A <- (A) << 1     (Accumalator)    1/2          *
        ASL        $06       C <- A7, A <- (A) << 1     (Z-Page)         2/5          *
        ASL        $16       C <- A7, A <- (A) << 1     (Z-Page,X)       2/6          *
        ASR        $4B       A <- [(A /\ M) >> 1]       (Immediate)      1/2
        BCC        $90       if C=0, PC = PC + offset   (Relative)       2/2'2        *
        BCS        $B0       if C=1, PC = PC + offset   (Relative)       2/2'2        *
        BEQ        $F0       if Z=1, PC = PC + offset   (Relative)       2/2'2        *
        BIT        $2C       Z <- ~(A /\ M) N<-M7 V<-   (Absolute)       3/4          *
        BIT        $24       Z <- ~(A /\ M) N<-M7 V<-   (Z-Page)         2/3          *
        BMI        $30       if N=1, PC = PC + offset   (Relative)       2/2'2        *
        BNE        $D0       if Z=0, PC = PC + offset   (Relative)       2/2'2        *
        BPL        $10       if N=0, PC = PC + offset   (Relative)       2/2'2        *
        BRK        $00       Stack <- PC, PC <- ($fff   (Immediate)      1/7          *
        BVC        $50       if V=0, PC = PC + offset   (Relative)       2/2'2        *
        BVS        $70       if V=1, PC = PC + offset   (Relative)       2/2'2        *
        CLC        $18       C <- 0                     (Implied)        1/2          *
        CLD        $D8       D <- 0                     (Implied)        1/2          *
        CLI        $58       I <- 0                     (Implied)        1/2          *
        CLV        $B8       V <- 0                     (Implied)        1/2          *
        CMP        $D1       (A - M) -> NZC             ((Ind),Y)        2/5'1        *
        CMP        $CD       (A - M) -> NZC             (Absolute)       3/4          *
        CMP        $DD       (A - M) -> NZC             (Absolute,X)     3/4'1        *
        CMP        $D9       (A - M) -> NZC             (Absolute,Y)     3/4'1        *
        CMP        $C9       (A - M) -> NZC             (Immediate)      2/2          *
        CMP        $C1       (A - M) -> NZC             (Ind,X)          2/6          *
        CMP        $C5       (A - M) -> NZC             (Z-Page)         2/3          *
        CMP        $D5       (A - M) -> NZC             (Z-Page,X)       2/4          *
        CPX        $EC       (X - M) -> NZC             (Absolute)       3/4          *
        CPX        $E0       (X - M) -> NZC             (Immediate)      2/2          *
        CPX        $E4       (X - M) -> NZC             (Z-Page)         2/3          *
        CPY        $CC       (Y - M) -> NZC             (Absolute)       3/4          *
        CPY        $C0       (Y - M) -> NZC             (Immediate)      2/2          *
        CPY        $C4       (Y - M) -> NZC             (Z-Page)         2/3          *
        DCP        $D3       M <- (M)-1, (A-M) -> NZC   ((Ind),Y)        2/8
        DCP        $CF       M <- (M)-1, (A-M) -> NZC   (Absolute)       3/6
        DCP        $DF       M <- (M)-1, (A-M) -> NZC   (Absolute,X)     3/7
        DCP        $DB       M <- (M)-1, (A-M) -> NZC   (Absolute,Y)     3/7
        DCP        $C3       M <- (M)-1, (A-M) -> NZC   (Ind,X)          2/8
        DCP        $C7       M <- (M)-1, (A-M) -> NZC   (Z-Page)         2/5
        DCP        $D7       M <- (M)-1, (A-M) -> NZC   (Z-Page,X)       2/6
        DEC        $CE       M <- (M) - 1               (Absolute)       3/6          *
        DEC        $DE       M <- (M) - 1               (Absolute,X)     3/7          *
        DEC        $C6       M <- (M) - 1               (Z-Page)         2/5          *
        DEC        $D6       M <- (M) - 1               (Z-Page,X)       2/6          *
        DEX        $CA       X <- (X) - 1               (Implied)        1/2          *
        DEY        $88       Y <- (Y) - 1               (Implied)        1/2          *
        EOR        $51       A <- (A) \-/ M             ((Ind),Y)        2/5'1        *
        EOR        $4D       A <- (A) \-/ M             (Absolute)       3/4          *
        EOR        $5D       A <- (A) \-/ M             (Absolute,X)     3/4'1        *
        EOR        $59       A <- (A) \-/ M             (Absolute,Y)     3/4'1        *
        EOR        $49       A <- (A) \-/ M             (Immediate)      2/2          *
        EOR        $41       A <- (A) \-/ M             (Ind,X)          2/6          *
        EOR        $45       A <- (A) \-/ M             (Z-Page)         2/3          *
        EOR        $55       A <- (A) \-/ M             (Z-Page,X)       2/4          *
        INC        $EE       M <- (M) + 1               (Absolute)       3/6          *
        INC        $FE       M <- (M) + 1               (Absolute,X)     3/7          *
        INC        $E6       M <- (M) + 1               (Z-Page)         2/5          *
        INC        $F6       M <- (M) + 1               (Z-Page,X)       2/6          *
        INX        $E8       X <- (X) +1                (Implied)        1/2          *
        INY        $C8       Y <- (Y) + 1               (Implied)        1/2          *
        ISB        $F3       M <- (M) - 1,A <- (A)-M-   ((Ind),Y)        2/8
        ISB        $EF       M <- (M) - 1,A <- (A)-M-   (Absolute)       3/6
        ISB        $FF       M <- (M) - 1,A <- (A)-M-   (Absolute,X)     3/7
        ISB        $FB       M <- (M) - 1,A <- (A)-M-   (Absolute,Y)     3/7
        ISB        $E3       M <- (M) - 1,A <- (A)-M-   (Ind,X)          3/8'1
        ISB        $E7       M <- (M) - 1,A <- (A)-M-   (Z-Page)         2/5
        ISB        $F7       M <- (M) - 1,A <- (A)-M-   (Z-Page,X)       2/6
        JAM        $02       [locks up machine]         (Implied)        1/-
        JAM        $12       [locks up machine]         (Implied)        1/-
        JAM        $22       [locks up machine]         (Implied)        1/-
        JAM        $32       [locks up machine]         (Implied)        1/-
        JAM        $42       [locks up machine]         (Implied)        1/-
        JAM        $52       [locks up machine]         (Implied)        1/-
        JAM        $62       [locks up machine]         (Implied)        1/-
        JAM        $72       [locks up machine]         (Implied)        1/-
        JAM        $92       [locks up machine]         (Implied)        1/-
        JAM        $B2       [locks up machine]         (Implied)        1/-
        JAM        $D2       [locks up machine]         (Implied)        1/-
        JAM        $F2       [locks up machine]         (Implied)        1/-
        JMP        $4C       PC <- Address              (Absolute)       3/3          *
        JMP        $6C       PC <- Address              (Indirect)       3/5          *
        JSR        $20       Stack <- PC, PC <- Addre   (Absolute)       3/6          *
        LAE        $BB       X,S,A <- (S /\ M)          (Absolute,Y)     3/4'1
        LAX        $B3       A <- M, X <- M             ((Ind),Y)        2/5'1
        LAX        $AF       A <- M, X <- M             (Absolute)       3/4
        LAX        $BF       A <- M, X <- M             (Absolute,Y)     3/4'1
        LAX        $A3       A <- M, X <- M             (Ind,X)          2/6
        LAX        $A7       A <- M, X <- M             (Z-Page)         2/3
        LAX        $B7       A <- M, X <- M             (Z-Page,Y)       2/4
        LDA        $B1       A <- M                     ((Ind),Y)        2/5'1        *
        LDA        $AD       A <- M                     (Absolute)       3/4          *
        LDA        $BD       A <- M                     (Absolute,X)     3/4'1        *
        LDA        $B9       A <- M                     (Absolute,Y)     3/4'1        *
        LDA        $A9       A <- M                     (Immediate)      2/2          *
        LDA        $A1       A <- M                     (Ind,X)          2/6          *
        LDA        $A5       A <- M                     (Z-Page)         2/3          *
        LDA        $B5       A <- M                     (Z-Page,X)       2/4          *
        LDX        $AE       X <- M                     (Absolute)       3/4          *
        LDX        $BE       X <- M                     (Absolute,Y)     3/4'1        *
        LDX        $A2       X <- M                     (Immediate)      2/2          *
        LDX        $A6       X <- M                     (Z-Page)         2/3          *
        LDX        $B6       X <- M                     (Z-Page,Y)       2/4          *
        LDY        $AC       Y <- M                     (Absolute)       3/4          *
        LDY        $BC       Y <- M                     (Absolute,X)     3/4'1        *
        LDY        $A0       Y <- M                     (Immediate)      2/2          *
        LDY        $A4       Y <- M                     (Z-Page)         2/3          *
        LDY        $B4       Y <- M                     (Z-Page,X)       2/4          *
        LSR        $4E       C <- A0, A <- (A) >> 1     (Absolute)       3/6          *
        LSR        $46       C <- A0, A <- (A) >> 1     (Absolute,X)     3/7          *
        LSR        $4A       C <- A0, A <- (A) >> 1     (Accumalator)    1/2          *
        LSR        $56       C <- A0, A <- (A) >> 1     (Z-Page,X)       2/6          *
        LXA        $AB       X04 <- (X04) /\ M04        (Immediate)      1/2
        NOP        $0C       [no operation]             (Absolute)       3/4
        NOP        $1C       [no operation]             (Absolute,X)     2/4'1
        NOP        $3C       [no operation]             (Absolute,X)     3/4'1
        NOP        $5C       [no operation]             (Absolute,X)     3/4'1
        NOP        $7C       [no operation]             (Absolute,X)     3/4'1
        NOP        $DC       [no operation]             (Absolute,X)     3/4'1
        NOP        $FC       [no operation]             (Absolute,X)     3/4'1
        NOP        $80       [no operation]             (Immediate)      2/2
        NOP        $82       [no operation]             (Immediate)      2/2
        NOP        $89       [no operation]             (Immediate)      2/2
        NOP        $C2       [no operation]             (Immediate)      2/2
        NOP        $E2       [no operation]             (Immediate)      2/2
        NOP        $EA       [no operation]             (Implied)        1/2          *
        NOP        $1A       [no operation]             (Implied)        1/2
        NOP        $3A       [no operation]             (Implied)        1/2
        NOP        $5A       [no operation]             (Implied)        1/2
        NOP        $7A       [no operation]             (Implied)        1/2
        NOP        $DA       [no operation]             (Implied)        1/2
        NOP        $FA       [no operation]             (Implied)        1/2
        NOP        $04       [no operation]             (Z-Page)         2/3
        NOP        $44       [no operation]             (Z-Page)         2/3
        NOP        $64       [no operation]             (Z-Page)         2/3
        NOP        $14       [no operation]             (Z-Page,X)       2/4
        NOP        $34       [no operation]             (Z-Page,X)       2/4
        NOP        $54       [no operation]             (Z-Page,X)       2/4
        NOP        $74       [no operation]             (Z-Page,X)       2/4
        NOP        $D4       [no operation]             (Z-Page,X)       2/4
        NOP        $F4       [no operation]             (Z-Page,X)       2/4
        ORA        $11       A <- (A) V M               ((Ind),Y)        2/5'1        *
        ORA        $0D       A <- (A) V M               (Absolute)       3/4          *
        ORA        $1D       A <- (A) V M               (Absolute,X)     3/4'1        *
        ORA        $19       A <- (A) V M               (Absolute,Y)     3/4'1        *
        ORA        $09       A <- (A) V M               (Immediate)      2/2          *
        ORA        $01       A <- (A) V M               (Ind,X)          6/2          *
        ORA        $05       A <- (A) V M               (Z-Page)         2/3          *
        ORA        $15       A <- (A) V M               (Z-Page,X)       2/4          *
        PHA        $48       Stack <- (A)               (Implied)        1/3          *
        PHP        $08       Stack <- (P)               (Implied)        1/3          *
        PLA        $68       A <- (Stack)               (Implied)        1/4          *
        PLP        $28       A <- (Stack)               (Implied)        1/4          *
        RLA        $33       M <- (M << 1) /\ (A)       ((Ind),Y)        2/8'5
        RLA        $2F       M <- (M << 1) /\ (A)       (Absolute)       3/6'5
        RLA        $3F       M <- (M << 1) /\ (A)       (Absolute,X)     3/7'5
        RLA        $3B       M <- (M << 1) /\ (A)       (Absolute,Y)     3/7'5
        RLA        $23       M <- (M << 1) /\ (A)       (Ind,X)          2/8
        RLA        $27       M <- (M << 1) /\ (A)       (Z-Page)         2/5'5
        RLA        $37       M <- (M << 1) /\ (A)       (Z-Page,X)       2/6'5
        ROL        $2E       C <- A7 & A <- A << 1 +    (Absolute)       3/6          *
        ROL        $3E       C <- A7 & A <- A << 1 +    (Absolute,X)     3/7          *
        ROL        $2A       C <- A7 & A <- A << 1 +    (Accumalator)    1/2          *
        ROL        $26       C <- A7 & A <- A << 1 +    (Z-Page)         2/5          *
        ROL        $36       C <- A7 & A <- A << 1 +    (Z-Page,X)       2/6          *
        ROR        $6E       C<-A0 & A<- (A7=C + A>>1   (Absolute)       3/6          *
        ROR        $7E       C<-A0 & A<- (A7=C + A>>1   (Absolute,X)     3/7          *
        ROR        $6A       C<-A0 & A<- (A7=C + A>>1   (Accumalator)    1/2          *
        ROR        $66       C<-A0 & A<- (A7=C + A>>1   (Z-Page)         2/5          *
        ROR        $76       C<-A0 & A<- (A7=C + A>>1   (Z-Page,X)       2/6          *
        RRA        $73       M <- (M >> 1) + (A) + C    ((Ind),Y)        2/8'5
        RRA        $6F       M <- (M >> 1) + (A) + C    (Absolute)       3/6'5
        RRA        $7F       M <- (M >> 1) + (A) + C    (Absolute,X)     3/7'5
        RRA        $7B       M <- (M >> 1) + (A) + C    (Absolute,Y)     3/7'5
        RRA        $63       M <- (M >> 1) + (A) + C    (Ind,X)          2/8'5
        RRA        $67       M <- (M >> 1) + (A) + C    (Z-Page)         2/5'5
        RRA        $77       M <- (M >> 1) + (A) + C    (Z-Page,X)       2/6'5
        RTI        $40       P <- (Stack), PC <-(Stac   (Implied)        1/6          *
        RTS        $60       PC <- (Stack)              (Implied)        1/6          *
        SAX        $8F       M <- (A) /\ (X)            (Absolute)       3/4
        SAX        $83       M <- (A) /\ (X)            (Ind,X)          2/6
        SAX        $87       M <- (A) /\ (X)            (Z-Page)         2/3
        SAX        $97       M <- (A) /\ (X)            (Z-Page,Y)       2/4
        SBC        $F1       A <- (A) - M - ~C          ((Ind),Y)        2/5'1        *
        SBC        $ED       A <- (A) - M - ~C          (Absolute)       3/4          *
        SBC        $FD       A <- (A) - M - ~C          (Absolute,X)     3/4'1        *
        SBC        $F9       A <- (A) - M - ~C          (Absolute,Y)     3/4'1        *
        SBC        $E9       A <- (A) - M - ~C          (Immediate)      2/2          *
        SBC        $EB       A <- (A) - M - ~C          (Immediate)      1/2
        SBC        $E1       A <- (A) - M - ~C          (Ind,X)          2/6          *
        SBC        $E5       A <- (A) - M - ~C          (Z-Page)         2/3          *
        SBC        $F5       A <- (A) - M - ~C          (Z-Page,X)       2/4          *
        SBX        $CB       X <- (X)/\(A) - M          (Immediate)      2/2
        SEC        $38       C <- 1                     (Implied)        1/2          *
        SED        $F8       D <- 1                     (Implied)        1/2          *
        SEI        $78       I <- 1                     (Implied)        1/2          *
        SHA        $93       M <- (A) /\ (X) /\ (PCH+   (Absolute,X)     3/6'3
        SHA        $9F       M <- (A) /\ (X) /\ (PCH+   (Absolute,Y)     3/5'3
        SHS        $9B       X <- (A) /\ (X), S <- (X   (Absolute,Y)     3/5
        SHX        $9E       M <- (X) /\ (PCH+1)        (Absolute,X)     3/5'3
        SHY        $9C       M <- (Y) /\ (PCH+1)        (Absolute,Y)     3/5'3
        SLO        $13       M <- (M >. 1) + A + C      ((Ind),Y)        2/8'5
        SLO        $0F       M <- (M >> 1) + A + C      (Absolute)       3/6
        SLO        $1F       M <- (M >> 1) + A + C      (Absolute,X)     3/7
        SLO        $1B       M <- (M >> 1) + A + C      (Absolute,Y)     3/7
        SLO        $03       M <- (M >> 1) + A + C      (Ind,X)          2/8
        SLO        $07       M <- (M >> 1) + A + C      (Z-Page)         2/5
        SLO        $17       M <- (M >> 1) + A + C      (Z-Page,X)       2/6
        SRE        $53       M <- (M >> 1) \-/ A        ((Ind),Y)        2/8
        SRE        $4F       M <- (M >> 1) \-/ A        (Absolute)       3/6
        SRE        $5F       M <- (M >> 1) \-/ A        (Absolute,X)     3/7
        SRE        $5B       M <- (M >> 1) \-/ A        (Absolute,Y)     3/7
        SRE        $43       M <- (M >> 1) \-/ A        (Ind,X)          2/8
        SRE        $47       M <- (M >> 1) \-/ A        (Z-Page)         2/5
        SRE        $57       M <- (M >> 1) \-/ A        (Z-Page,X)       2/6
        STA        $91       M <- (A)                   ((Ind),Y)        2/6          *
        STA        $8D       M <- (A)                   (Absolute)       3/4          *
        STA        $9D       M <- (A)                   (Absolute,X)     3/5          *
        STA        $99       M <- (A)                   (Absolute,Y)     3/5          *
        STA        $81       M <- (A)                   (Ind,X)          2/6          *
        STA        $85       M <- (A)                   (Z-Page)         2/3          *
        STA        $95       M <- (A)                   (Z-Page,X)       2/4          *
        STX        $8E       M <- (X)                   (Absolute)       3/4          *
        STX        $86       M <- (X)                   (Z-Page)         2/3          *
        STX        $96       M <- (X)                   (Z-Page,Y)       2/4          *
        STY        $8C       M <- (Y)                   (Absolute)       3/4          *
        STY        $84       M <- (Y)                   (Z-Page)         2/3          *
        STY        $94       M <- (Y)                   (Z-Page,X)       2/4          *
        TAX        $AA       X <- (A)                   (Implied)        1/2          *
        TAY        $A8       Y <- (A)                   (Implied)        1/2          *
        TSX        $BA       X <- (S)                   (Implied)        1/2          *
        TXA        $8A       A <- (X)                   (Implied)        1/2          *
        TXS        $9A       S <- (X)                   (Implied)        1/2          *
        TYA        $98       A <- (Y)                   (Implied)        1/2          *

        '1 - Add one if address crosses a page boundry.
        '2 - Add 1 if branch succeeds, or 2 if into another page.
        '3 - If page boundry crossed then PCH+1 is just PCH
        '4 - Sources disputed on exact operation, or sometimes does not work.
        '5 - Full eight bit rotation (with carry)
 
        Sources:
          Programming the 6502, Rodney Zaks, (c) 1983 Sybex
          Paul Ojala, Post to Comp.Sys.Cbm (po87553@cs.tut.fi / albert@cc.tut.fi)
          D John Mckenna, Post to Comp.Sys.Cbm (gudjm@uniwa.uwa.oz.au)
 
          Compiled by Craig Taylor (duck@pembvax1.pembroke.edu)



      This special PETSCII ARCed version of this Manual was edited and created
      by Earl Goldberg of the Commodore Users Group of Kansas City.  03-Dec-86