home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / compuserve-file-archive / 04 geoProgramming / GEOBASIC.TXT < prev    next >
Encoding:
Text File  |  2019-04-13  |  9.8 KB  |  242 lines

  1.  
  2. Date: Sat, 17 Aug 96 18:07:50 +0600
  3. From: Pulthar@nietzsche.execpc.com
  4. Subject: Re: GeoBasic
  5.  
  6.   Here's the more technical info I have on geoBasic.  I've posted it to
  7. comp.sys.cbm as well.
  8.  
  9. geoBasic Module Definitions:
  10.  
  11. VLIR #     Constant   Loads @     Description
  12. ------     --------   -------     -----------
  13.      0     R_MAIN     $0400       Resident code. Two JMP's @ $0400 then skip
  14.                                   to $07fc to leave room for screen memory.
  15.                                   This module contains all the code that must
  16.                                   always be available.  All the other modules
  17.                                   use the subroutines contained here.
  18.  
  19.  
  20.      1     R_FILE     $4ec7       High level disk file stuff (Rename, Open,
  21.                                   etc).
  22.  
  23.  
  24.      2     R_DA      *$75d8       Run's DA's.  *Loads inside FG_BUFFER on 64
  25.                                   or SCREEN_BASE on the 128.  This keeps it
  26.                                   from overwriting Basic's code.
  27.  
  28.      3     R_INIT     $4ec7       geobasic Initialization code. Loaded from
  29.                                   Resident code.
  30.  
  31.      4     R_LOAD     $7501       Basic Program loader. Loads into FG_BUFFER
  32.                                   (see R_DA).
  33.  
  34.      5     R_BINT     $4f96       Interpreter (BasRes). This is the module
  35. that
  36.                                   actually runs the user's program.
  37.  
  38.      6     R_BINT2    $0400
  39.  
  40.  
  41.      7     R_FONT     $6f8b       Font Manager (cFont, cSysInfo, and
  42.                                   GetDiskBitmap).
  43.  
  44.      8     R_DISK     $6f8b       Lower level disk stuff (reading bytes,
  45. etc).
  46.  
  47.      9     R_PRINT    $6f8b       Printer Routines.
  48.  
  49.      10    R_MENU     $4ec7       Menu Utility.
  50.  
  51.      11    R_DBOX     $4ec7       Dialog Box Utility.
  52.  
  53.      12    R_ICON     $4ec7       Icon Utility.
  54.  
  55.      13    R_BMAP     $4ec7       Bitmap Utility.
  56.  
  57.      14    R_SPRT     $4ec7       Sprite Utility.
  58.  
  59.      15    R_EDIT     $4503       Editor.
  60.  
  61.      16    R_APPL     $4b00       Make Application (run-time).
  62.  
  63.      17    R_DEBUG    $47cc       Debugger.
  64.  
  65. GB Program, Disk Layout
  66.  
  67. Records 0 to 9 - left empty to leave room for GB code when making run-time.
  68.  
  69. Record #10 - VLIR table.  Keeps track of what modules hold what line #'s.
  70.  Used
  71. for doing the VLIR splitting.  The table is a single sector and there is one
  72. eight byte entry for each program module.  The entries have the following
  73. format:
  74.  
  75.      .word ?          ; Highest line number in module.
  76.      .word ?          ; Length_of_module (in bytes)
  77.      .byte ?          ; nesting_level
  78.      .byte ?          ; write_status
  79.      .byte ?          ; modified_status
  80.      .byte NULL       ; terminator
  81.  
  82. The very first entry is a bit different.  It looks like this:
  83.  
  84.      .word ???        ; (NULLS)
  85.      .byte x          ; number of entries in the VLIR table (not
  86.                       ; counting this one which is entry #0).
  87.      .byte x          ; number of labels in the label table (minus 1,
  88.                       ; labels are numbered from zero!).  If there
  89.                       ; are no labels then it equals $ff.
  90.      .byte $f0?
  91.      .byte $f6?
  92.      .word ???
  93.  
  94. Record #11 - Object table.  All of the geos objects are store in this record,
  95. one right after the other.
  96.  
  97. Record #12 - Label Table.  Here is where the labels (@xxxx and object names)
  98. are stored.  Each label entry is 8 bytes long and has the following format:
  99.  
  100.      For @ labels:
  101.      .block 6         ; label name padded with NULLs
  102.      .word line_number
  103.  
  104.      For object labels (i.e. bitmaps, menus, icons, etc.):
  105.      .byte type       ; $80 = Menu
  106.                       ; $81 = DB
  107.                       ; $82 = Icon
  108.                       ; $83 = Sprites
  109.                       ; $84 = Bitmap
  110.      .block 5         ; object name padded with NULLs
  111.      .word address    ; where in memory the object is located.
  112.  
  113. Record #13 onward - Holds the basic program lines.  Each line has the
  114. following
  115. format:
  116.  
  117.      .byte            ; length_of_line
  118.      .word            ; line_number
  119.      .block ???       ; now comes the tokenized text
  120.  
  121.  
  122. Record #126 backward - Disk loadable bitmaps are stored beginning at record
  123. #126.  Additional bitmaps are added backwards until they meet up with the
  124. program records.  Note that only disk loadable bitmaps are stored here.
  125. Regular bitmaps are stored in the Object Table (record #11).
  126.  
  127. Getting Registers after a CALL:
  128.  
  129. After using the CALL command use can get the return values of the registers
  130. by
  131. PEEKing the following memory locations:
  132.  
  133. A      = $28a (650)
  134. X      = $28b (651)
  135. Y      = $28c (652)
  136. SR     = $28d (653)
  137.  
  138.  
  139. POP Command:
  140.  
  141. The old (V1.0) Pop command had several serious bugs that caused a system
  142. crash.
  143.  
  144. POP Command:
  145.  
  146. The old (V1.0) Pop command had several serious bugs that caused a system
  147. crash.
  148. The new version works like this:  executing a POP will remove the current
  149. GOSUB/WHILE/REPEAT stack frame.  In other words it will allow you to 'forget'
  150. that you are in a subroutine or loop (this does not apply to a FOR...NEXT
  151. loop). One thing to keep in mind is that after executing a POP you must not
  152. allow the program to reach the RETURN/LOOP/UNTIL commands.  The best way of
  153. doing this is with a construct like this:
  154.  
  155.      10 GOSUB DoSomething
  156.      20 END
  157.      30
  158.      50 @DoSomething
  159.      60   <various commands>
  160.      70   IF something = error THEN POP : GOTO @DoError
  161.      80 RETURN
  162.      90
  163.      100 @DoError
  164.      110    .... etc
  165.  
  166. Of course if you are two levels deep in a subroutine and execute a POP, then
  167. you execute a RETURN the program will return TWO levels back rather then just
  168. one.  Could come in handy at times.
  169.  
  170. GB Variables - zero page
  171.  
  172. Name              Address     Size     Description
  173. ----              -------     ----     -----------
  174. basCur            $81/129     word     current character in basic memory
  175. basBegin          $83/131     word     pointer to beginning of basic
  176. basicEnd          $85/133     word     pointer to beginning of labels (minus
  177. 1
  178.                                        for end of basic)
  179. varBegin          $87/135     word     pointer to the beginning of variables
  180. arrayBegin        $89/137     word     pointer to the beginning of arrays
  181. arrayEnd          $8b/139     word     pointer to the end of arrays
  182. arrayLength       $8d/141     word     length of array/temporary register
  183. strnBegin         $8f/143     word     pointer to the beginning of strings
  184. arrayLength       $8d/141     word     length of array/temporary register
  185. strnBegin         $8f/143     word     pointer to the beginning of strings
  186. zeroShift         $91/145     byte     used by floating point routines
  187. dec_pt            $92/146     byte     used by floating point routines
  188. varPtr            $93/147     word     pointer to value of variable
  189. machine_type      $95/149     byte     0 if c64, $80 if 128
  190. strnStack         $96/150     9 bytes  stack for three temp string
  191. descriptors
  192. strnStkIndx       $9f/159     byte     index into strnStack
  193. prevStrnStkIndx   $a0/160     byte     previous strnStack index
  194. rdIndex           $a1/161     byte     index to reading in strings
  195. gax2              $a2/162     word     (not commented in source code)
  196. curStrn           $a4/164     word     pointer to most current string that
  197.                                        was added or moved.
  198. strnDes           $a6/166     word     pointer to string descriptor
  199. descPtr           $a8/168     word     pointer to string descriptor
  200.                                        for string operations.
  201. geosBegin         $aa/170     word     pointer to the beginning of object
  202.                                        (menus, icons, etc.) data.
  203. memAmnt           $ac/172     word     amount of memory to insert or delete
  204. curKeyBrdPos      $ae/174     word     (not commented in source)
  205. SetForIOTemp      $b0/176     word     (not commented in source)
  206. curLineNum        $b2/178     word     current line number being executed or
  207.                                        $ff in direct mode
  208. VLIRtabl          $b4/180     word     pointer to beginning of VLIR table
  209. xPos              $b6/182     word     X position for PRINT
  210. yPos              $b8/184     byte     Y position for PRINT
  211. opMask            $b9/185     byte     current comparison being performed
  212.                                        >/1, =/2, </4 or any combo of these
  213. comm_Flag         $ba/186     byte     flag for which command is currently
  214.                                        being executed: 0 = none, 1 = RUN,
  215.                                        -1 = LIST - used by the Editor
  216. dataPtr           $bc/188     word     pointer in basic to DATA statements
  217. FP_sgns           $be/190     byte     temp flag for sign of FP number
  218. exp_found         $bf/191     byte     flag for whether exponent was found
  219. fontBegin         $c0/192     word     pointer to beginning of font
  220. lastFontPtr       $c2/194     word     (not commented in source)
  221. curDBPtr          $c4/196     word     pointer to current dialog box data
  222. sprite stuff      $c6/198     36 bytes internal sprite variables
  223. r16               $ea/234     word     more registers
  224. r17               $ec/236     word
  225. r18               $ee/238     word
  226. r19               $f0/240     word
  227. r20               $f2/242     word
  228. r21               $f4/244     word
  229. numDim            $f6/246     byte     number of dimensions in array
  230. grbackground      $f7/247     byte     FG/BG colors of graphics screen
  231. dig_found         $f8/248     byte     flag for whether a digit was found
  232.                                        when converting strings to FP
  233. operand_mask      $f9/249     byte     >/1, =/2, </4
  234. strnFlag          $fa/250     byte     $ff if string expected, else 0
  235.  
  236.  
  237. ************************************************************************
  238.  Glenn Holmer (ulthar@execpc.com)  Q-Link: ShadowM
  239.  This is a text.  This is only a text.
  240.  If this were a actual emergency you would have recieved a core dump!
  241. ************************************************************************o
  242.