ƒ* GB+             *_ k PRG formatted GEOS file V1.0  ¾~ š€‚ Epson LX-80 rap       _  æ ?’  '’ą$ $’ü$€$€$µ4$„$$µ4$„$$„“$€$‚$‚<„‚‚ € ’üƒ ’’ Write Image V2.1 Red Storm geoWrite V1.1  š This file was created with Wrong is Write. Written by Joe Buckley. ÜĆ-0B W” '-ŽR ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ @  ą 0   HGEOBASIC BUGS WORK-AROUNDS  @  ą 0  SUBJ: Work around (R) FROM: GH Wells 04/28/91 S#: 809400 Here are the bugs and work-arounds that I am aware of: 1) The most important bug concerns the use of the UPDATE command. NEVER USE IT! If you ever UPDATE a geoBASIC program, it gets corrupted in such a way that later on, the end of your program will disappear. "The Smee" has discovered that RUNning a program will effectively (and correctly) do the same thing that UPDATE should have done. His advice is to always RUN a program before QUITing or CLOSEing and never use UPDATE. 2) The BITMAP command does not work after using a disk command but you can overcome this problem by re-opening your geoBASIC program before using BITMAP. The following geoBASIC sample illustrates how: 10 CREATE "junk" 20 SYSINFO 14, name$ 30 OPEN name$ 40 BITMAP "pic",10,10 Assuming that "pic" is a disk-loadable bitmap, take out lines 20 and 30 to see the problem. 3) Don't close and re-open a VLIR file you are working on. This problem was just recently discovered and a fix has not been found. It may be similar to the BITMAP problem. 4) GeoBASIC is incompatible with some auto-exec files such as Blackout which will make the screen go black in edit mode whenever you move the mouse. 5) If you are running geoBASIC on the 40 column screen of GEOS 128, do not have any desk accessories on your disk when you make your program into an application or when you are running it after making it an application. Desk accessories work fine under GEOS 64 but they screw up the loading of stand-alone applications under GEOS 128. 6) Always RUN your program just before you make it into an application. 7) Never POKE or LOAD anything into the background screen memory. The only safe place to store machine code is in the foreground screen memory which extends from 40960 to 48959. It is usually easy to design your screens with a little blank area in them in which you can set both colors to white so the machine code will not show up. If you are not a machine code programmer then you will not have to worry about this. Page 13) The sample application  @  ą 0 !  HGEOBASIC MANUAL CORRECTIONS  @  ą 0 Page 13) The sample application has been corrupted by the UPDATE command (strike the last sentence on page 13) and you cannot edit it although you can RUN and LIST it. Page 17) Don't ever UPDATE. Always RUN a program (even if it doesn't work) before QUITing or CLOSEing. Page 18, 3 lines from top) Change F7 to F5. Page 19, RESIZE) The heap is how much memory is left over for variables after the size is set for the code of your program. If you get an"out of memory" error, resize the code to 2 or 3. You will have to do this every time you load your program to edit and run it but don't worry, if you forget, you'll just get the "out of memory" error to remind you. GeoBASIC only allows up to 7K for variables, so you have to be very frugal. There is an advantage to resizing the code to the largest possible value just before you finally make your program into a stand-alone application since it will run much faster on a real disk (as opposed to a RAM disk or shadowed disk). Page 21, three lines from bottom) The most negative integer value allowed is -32767 which is really a bug because it makes the double-byte logic functions almost useless. Page 23, end of last full paragraph) Don't leave the trailing quotes off of string constants, even if it sometimes works. Page 26, four lines up from bottom) Integer arrays take four (not two) bytes per element although only two are used. (This is no doubt a bug although it causes no more problem than just wasting precious variable memory space.) Page 29, near top) NOT 0 evaluates to -1 (instead of +1) and NOT 1 evaluates to -2 (instead of 0). The logic functions work on all 16 bits individually unless an input or intermediate value is -32768. You can get -32768 as a result (NOT 32767 correctly returns -32768) and it should be legal to PRINT NOT NOT A for any value for which you can PRINT NOT A but it won't work for A=32767. This means you must be very careful when testing programs where you really do want to do logic functions on all 16 bits. Either break your values into two 8-bit values or guarantee that the 16th bit can never be set all by itself. Page 32, last sentence) Pay special attention to the statement that geoBASIC is the opposite of CBM BASIC when comparing strings. In your mind, always interchange "<" and ">" when used with strings or you will waste a lot of time debugging any program that uses them. (At least his "bug" was "documented".) Page 39 and 104, APPEND) In the example of APPEND 2, the pointer will be at the new record which is 3. (The old 3 and above have all been moved up one.) The admission of a bug that prevents APPENDing to record 126 is in error. GEOS VLIR files can have only 127 records which are number 0 through 126. (Isn't it a shame that the one time a bug is admitted to, it isn't a bug at all but a documentation error? Actually this "bug" is mentioned many times in the manual but I'll just mention it just once here.) Page 41, CALL) You can also PEEK the returned values of the A,X,Y, and status registers at locations 650 through 653 respectively. Unfortunately you cannot directly CALL any GEOS routines that pass parameters in the zero-page pseudo registers. Page 41, near bottom) CHKPT has been left out but it is correctly described on page 97 as TESTPT. Change its name on page 97 to CHKPT and make a note on page 41 where it belongs. Page 42, list of CHR$) CHR$(26) turns on outline printing and CHR$(27) turns off all effects. Page 48, DELETE) This command can also be used in the editor to delete program lines following the same syntax as for LIST on page 66. Typing DELETE all by itself erases your entire program. Page 53, FIND) I don't think this editor command is documented anywhere in the manual but it is extremely useful. It searches for every occurrence of a text string in your program or just within a range of lines. I especially like it to detect re-used variable names by having it find the first three characters of a new variable name. If it finds another variable starting with the same three characters, then I need a different name. The syntax is FIND "string",10,20 where the start and stop line numbers are optional. Page 66, bottom) Hitting the F5 key toggles the listing, don't hold it down. Page 70, MOUSE) This command requires two more parameters and has the same syntax as PROMPT on page 81. Both commands do not take effect until the mainloop is entered. Page 76, PATTERN) The patterns are the same as those displayed in geoPaint. To erase an area use 0. For a solid fill use 1. Page 77, POINT) This command can turn off as well as turn on individual screen pixels as determined by the previous setting of SETCOL. Use 0 to turn pixels off and 1 to turn them on. Page 82, PRSCREEN) If the expression is 1, the screen is printed double size, not rotated. Use MAINLOOP instead of RETURN when done with this command. Page 87, RND) This function is hardly random, use with ca @  ą 0  Page 87, RND) This function is hardly random, use with caution. Try this simple program which should place dots randomly on the screen: 10 CLS 20 SETCOL 1 30 POINT RND(319), RND(199) 40 GOTO 30 Page 88 & 89, SETCOL) Add a 4th use for the POINT command as described earlier. Page 90, last paragraph) The first expression for voice must evaluate from 1 to 3 (not 0 to 3). For the second and third expressions, interchange the words "high" and "low". Page 95, near bottom) Parameter # 13 determines how the geoBASIC program was "RUN" or called. If it was double-clicked on as a stand-alone application, the value is 0. If it was double-clicked on prior to being converted to an application, the value is 1. If geoBASIC itself was run and then the program was selected from the dialog box, the value is 2. Page 96, TAB) The expression must be between 0 and 319. There is a tab at every pixel location, not every 40. Page 97, TESTPT) Change to CHKPT.SUBJ: Hiding WRITE's CHR$(0) ------------------------------------------------------------------------- FROM: Greg K 06/03/91 S#: 394950 WRITE puts a CHR$(0) at the end of every item which it puts into a file, plus an @  ą 0 0  FROM: Greg K 06/03/91 S#: 394950 WRITE puts a CHR$(0) at the end of every item which it puts into a file, plus another CHR$(0) at the end of each record. This listing shows how to "bury" those zeroes in a geoWrite file, so that they won't interfere with the text. They're made a part of four-character font, style "escape sequences;" they say, "plain text." Note: Line 60 "works around" a bug in the HEADER statement. And, line 70 adds a field which isn't even touched by HEADER! Those lines show you where to go when you want to customize CREATE/SAVE's fileHeader. 10 rem subject: hiding write's chr$(0) 20 rem this shows how to bury write's chr$(0) terminator in an escape sequence. 30 rem demo code makes a geowrite 1.1 file. 40 z$=chr$(0): nc$=chr$(23)+chr$(9): ns$=nc$+z$: rem sets plain bsw9 font 50 rl$=chr$(223)+chr$(1):rl$=z$+z$+rl$+rl$+rl$+rl$+rl$+rl$+rl$+rl$+rl$+ns$ 60 header 7,"Write Image v1.1",1: poke 28452,49: poke 28453,46: poke 28454,49 70 for p=1 to 9: poke 28478+p,asc(mid$("geoWrite ",p)): next 80 create "list": for p=0 to 125: append p: next 90 for p=0 to 2: ptrec p: restore: write rl$ 100 for w=1 to 16: read d$: write " " +d$+ns$," "+d$+ns$:next: write nc$: next 110 write "": ptrec 0: close 120 data "name-1","name-2","name-3","name-4","name-5","name-6","name-7" 130 data "name-8","name-9","name-10","name-11","name-12","name-13","name-14" 140 data "name-15","name-16" It's important that there aren't any typographical errors in your program file! Be sure to correct the two string literal constants (in lines 60 & 70)! They must be in lower case, with only certain letters in capitals. ------------------------------------------------------------------------- Stuff from: THE SMEE 6/17/91 Undocumented Commands nds ands ands line 70 adds a field which isn't even touched touched n to @  ą 0 !  HUndocumented Commands  @  ą 0 Stuff from: THE SMEE 6/17/91 The FIND command is not documented in GeoBasic but is very useful. Its syntax is as follows: FIND This must be entered from direct mode, and will result in a Syntax error if done within execution mode. The ' can also be used in place of REM. This will save you a few keystrokes. The ' will be replaced by REM after you hit return. ' This is my rem statement. The POP command is not documented within the GeoBasic Manual because it contained a bug which was later fixed with a patch made by William Coleman. Pop now Removes the last two current pointers for UNTIL, LOOP, & RETURN. This can be useful if you plan it right. me-8","name-9","name-10","name-1----------- Reported BUGS yet unverified DELETE may cause the same Effects as UPDATE does. Do not use DELETE from Direct mode unless you need to delete a lot of multiple lines. To delet @  ą 0 !  HReported BUGS yet unverified  @  ą 0 DELETE may cause the same Effects as UPDATE does. Do not use DELETE from Direct mode unless you need to delete a lot of multiple lines. To delete a line it is best to type the line number the line is on and hit return. TIPS When using the FONT command, you may have noticed that by Typing in FONT"BSW",9 doesn't automatically select the BSW font which is resident. This is not only annoying @  ą 0 1  HTIPS  @  ą 0 0 When using the FONT command, you may have noticed that by Typing in FONT"BSW",9 doesn't automatically select the BSW font which is resident. This is not only annoying but wastes time. Use CALL 49483 which will call up the BSW resident font instantly. To detect whether sprites have collided or not, it is best to use the Commodore Kernal Sprite collision detect. But we need a way to swap the GEOS Kernal in and out to Peek the Commodore Kernal. Use the following. POKE 1,53 :REM This Swaps GEOS Kernal out and Commodore Kernal in. POKE 1,48 :REM This Swaps GEOS Kernal back in. Be sure to swap GEOS back in when you are about to use a Dialog Box, display a menu, or exit Execution mode. If you don't you will get a spectacular crash. Use common sense. When you call up a DBSTRN dialog box, and it has TEXT which you have programmed into it, you may have noticed that the Text prints in bold. To Defeat that, type in as follows: DBSTRN CHR$(27)+"Enter Input",IN$ If you have use the variable function within DIALOG (using the Editor to design the DB) You should have noticed that the last character gets chopped off into limbo. To avoid this create a permanent variable such as SP$=" " . There should be a space between the quotes. When creating your dialog box, and you want the variable, such as B$ to print out in the dialog box, enter it as follows: B$+SP$ The space that gets to go to limbo now is SP$. If you want to create temporary datafiles, but do not want to clutter up your disk and do not want to do Disk cleanning later, use a header that creates a TEMPORARY data file as follows: HEADER 13,"Temporay",1 When you re-enter the Desktop, it will automaticaly be erased from your disk, regardless. This is good if your about to run out of variable space, or any other data which you do not need at the moment. This will conserve some space. On Some printers PRNTER will allow you to select between your printers DRAFT or NLQ modes. The Manual is Correct in Stating that a 0 will route output to screen while 1 will route it to printer. Any number greater than one will also route text to the printer, but in NLQ mode. If you are running a program which does not require MOUSE input, shut off the mouse pointer. It will increase the speed of your program. To shut it off type MOUSE0,0,0. You can use MOUSEX and MOUSEY to store that mouse pointer position for later. The UPDATE option isn't totally useless. If you make a program you do not want anyone to alter or modify, Use the update command after you have made your program source into an application. Remember you can still view the source code of a program by double clicking on GeoBasic, not the Application. Then select the GeoBasic Application and punch OPEN. Then select UPDATE a bunch of times. Your program will still work normally, but lines added to the Program will disappear once you exit. GeoBasic Application Chaining Although I don't see the need for it, I have found a way to chain one GeoBasic Self Running Application to Another GeoBasic Self running application. I worked out the code at a users request @  ą 0 1  HGeoBasic Application Chaining  @  ą 0 0 Although I don't see the need for it, I have found a way to chain one GeoBasic Self Running Application to Another GeoBasic Self running application. I worked out the code at a users request. So instead of keeping it a secret here is the code: 10 CLS 20 HEADER 6,"",1 : REM LOOK FOR APPLICATIONS 30 DBFILE L$ 35 IF L$=""THEN END 40 S=LEN(L$) 50 FOR I=1 TO S 60 X=ASC(MID$(L$,I,1)) 70 POKE45055+I,X : REM Stores Application name in Screen Memory. 80 NEXT I 82 SYSINFO3,CD : REM CD is Current Drive. 84 CALL 49840,0,0,CD : REM This is SetDevice. 85 CALL 49825 : REM This is OpenDisk. 90 DPOKE14,45056 : REM Flag r6. Name Pointer. 91 POKE 2,0 : REM Flag r0L. 100 CALL 49672 : REM This is GetFile. There are Side effects though! If you use this, you can only load another GB Self Running Applications!! Anything else will cause a lock up! Also you must Exit to Basic! To do so your Exiting program must not end with END. Use this instead: 10 DPOKE 12,0 : REM flag r5. 20 DPOKE 16,2051 : REM flag r7. 30 POKE 2048,0 40 DPOKE 2049,0 50 CALL 49729,S 60 REM CALL ToBasic Now look at line 50. The variable S must not have any set value! Leave it Undefined! When you exit to basic all you have to do is hit RESTORE and you will be deposited back to DESKTOP. geoBasic Module Definitions: VLIR # Constant Loads @ Description ------ -------- ------- ----------- 0 R_MAIN $0400 Resident @  ą 0  geoBasic Module Definitions: VLIR # Constant Loads @ Description ------ -------- ------- ----------- 0 R_MAIN $0400 Resident code. Two JMP's @ $0400 then skip to $07fc to leave room for screen memory. This module contains all the code that must always be available. All the other modules use the subroutines contained here. 1 R_FILE $4ec7 High level disk file stuff (Rename, Open, etc). 2 R_DA *$75d8 Run's DA's. *Loads inside FG_BUFFER on 64 or SCREEN_BASE on the 128. This keeps it from overwriting Basic's code. 3 R_INIT $4ec7 geobasic Initialization code. Loaded from Resident code. 4 R_LOAD $7501 Basic Program loader. Loads into FG_BUFFER (see R_DA). 5 R_BINT $4f96 Interpreter (BasRes). This is the module that actually runs the user's program. 6 R_BINT2 $0400 7 R_FONT $6f8b Font Manager (cFont, cSysInfo, and GetDiskBitmap). 8 R_DISK $6f8b Lower level disk stuff (reading bytes, etc). 9 R_PRINT $6f8b Printer Routines. 10 R_MENU $4ec7 Menu Utility. 11 R_DBOX $4ec7 Dialog Box Utility. 12 R_ICON $4ec7 Icon Utility. 13 R_BMAP $4ec7 Bitmap Utility. 14 R_SPRT $4ec7 Sprite Utility. 15 R_EDIT $4503 Editor. 16 R_APPL $4b00 Make Application (run-time). 17 R_DEBUG $47cc Debugger. GB Program, Disk Layout Records 0 to 9 - left empty to leave room for GB code when making run-time. Rec @  ą 0 1  HGB Program, Disk Layout  @  ą 0 0 Records 0 to 9 - left empty to leave room for GB code when making run-time. Record #10 - VLIR table. Keeps track of what modules hold what line #'s. Used for doing the VLIR splitting. The table is a single sector and there is one eight byte entry for each program module. The entries have the following format: .word ? ; Highest line number in module. .word ? ; Length_of_module (in bytes) .byte ? ; nesting_level .byte ? ; write_status .byte ? ; modified_status .byte NULL ; terminator The very first entry is a bit different. It looks like this: .word ??? ; (NULLS) .byte x ; number of entries in the VLIR table (not counting this one which is entry #0). .byte x ; number of labels in the label table (minus 1, labels are numbered from zero!). If there ; are no labels then it equals $ff. .byte $f0? .byte $f6? .word ??? Record #11 - Object table. All of the geos objects are store in this record, one right after the other. Record #12 - Label Table. Here is where the labels (@xxxx and object names) are stored. Each label entry is 8 bytes long and has the following format: For @ labels: .block 6 ; label name padded with NULLs .word line_number For object labels (i.e. bitmaps, menus, icons, etc.): .byte type ; $80 = Menu ; $81 = DB ; $82 = Icon ; $83 = Sprites ; $84 = Bitmap .block 5 ; object name padded with NULLs .word address ; where in memory the object is located. Record #13 onward - Holds the basic program lines. Each line has the following format: .byte ; length_of_line .word ; line_number .block ??? ; now comes the tokenized text .byte NULL ; terminator Record #126 backward - Disk loadable bitmaps are stored beginning at record #126. Additional bitmaps are added backwards until they meet up with the program records. Note that only disk loadable bitmaps are stored here. Regular bitmaps are stored in the Object Table (record #11). Getting Registers after a CALL: After using the CALL command use can get the return values of the registers by PEEKing the following memory locations: A = $28a (650) X = $28b (651) Y = $28c (652)  @  ą 0 1  HGetting Registers after a CALL:  @  ą 0 0 After using the CALL command use can get the return values of the registers by PEEKing the following memory locations: A = $28a (650) X = $28b (651) Y = $28c (652) SR = $28d (653) POP Command: The old (V1.0) Pop command had several serious bugs that caused a system crash. The new version works like this: executing a POP will remove the current GOSUB/WHILE/REPEAT stack frame. In other  @  ą 0 1  HPOP Command:  @  ą 0 0 The old (V1.0) Pop command had several serious bugs that caused a system crash. The new version works like this: executing a POP will remove the current GOSUB/WHILE/REPEAT stack frame. In other words it will allow you to 'forget' that you are in a subroutine or loop (this does not apply to a FOR...NEXT loop). One thing to keep in mind is that after executing a POP you must not allow the program to reach the RETURN/LOOP/UNTIL commands. The best way of doing this is with a construct like this: 10 GOSUB DoSomething 20 END 30 50 @DoSomething 60 70 IF something = error THEN POP : GOTO @DoError 80 RETURN 90 100 @DoError 110 .... etc Of course if you are two levels deep in a subroutine and execute a POP, then you execute a RETURN the program will return TWO levels back rather then just one. Could come in handy at times. GB Variables - zero page Name  @  ą 0 !  HGB Variables - zero page  @  ą 0 Name Address Size Description ---- ------- ---- ----------- basCur $81/129 word current character in basic memory basBegin $83/131 word pointer to beginning of basic basicEnd $85/133 word pointer to beginning of labels (minus 1 for end of basic) varBegin $87/135 word pointer to the beginning of variables arrayBegin $89/137 word pointer to the beginning of arrays arrayEnd $8b/139 word pointer to the end of arrays arrayLength $8d/141 word length of array/temporary register strnBegin $8f/143 word pointer to the beginning of strings zeroShift $91/145 byte used by floating point routines dec_pt $92/146 byte used by floating point routines varPtr $93/147 word pointer to value of variable machine_type $95/149 byte 0 if c64, $80 if 128 strnStack $96/150 9 bytes stack for three temp string descriptors strnStkIndx $9f/159 byte index into strnStack prevStrnStkIndx $a0/160 byte previous strnStack index rdIndex $a1/161 byte index to reading in strings gax2 $a2/162 word (not commented in source code) curStrn $a4/164 word pointer to most current string that was added or moved. strnDes $a6/166 word pointer to string descriptor descPtr $a8/168 word pointer to string descriptor for string operations. geosBegin $aa/170 word pointer to the beginning of object (menus, icons, etc.) data. memAmnt $ac/172 word amount of memory to insert or delete curKeyBrdPos $ae/174 word (not commented in source) SetForIOTemp $b0/176 word (not commented in source) curLineNum $b2/178 word current line number being executed or $ff in direct mode VLIRtabl $b4/180 word pointer to beginning of VLIR table xPos $b6/182 word X position for PRINT yPos $b8/184 byte Y position for PRINT opMask $b9/185 byte current comparison being performed >/1, =/2, /1, =/2,