¯rm67,tm3,bm63,lm2 €°ã€¥MultiBasic V1.0 by Terry Todd ãCopyright (C) 1990 by Sub-Etha Software ãSupport Line: (409) 639-ETHA [3842]€ €0 〥Sub-Etha BBS: (409) 63-REALM [73256]€  ------------------------- €¥Introduction€  -------------------------- In the beginning (1980), the Color Computer debuted as a 4K home computer, expandable to a massive 16K. Through the years prices dropped and memory increased. Soon 32K and 64K were common. In 1986 the CoCo 3 was unveiled with a (once again) massive 128K of memory, expandable to 512K. Since the "brain" of the machine was still able to access only 64K at a time, a new Memory Management Unit (known as the MMU) was created to control which parts of the 64K the brain was looking at. The new MMU allowed the computer and programmers access to all of the new memory. Unfortunately, in order to remain compatible the the earlier CoCos, the Basic was not changed to allow direct access to the added memory. This left Basic programmers without much use for the extra memory...until now. MultiBasic was written due to a need for more programming space. Even though your computer may contain more memory, Basic gives you a mere 22K in which to write your "ultimate" program. The rest is wasted unless you program in machine language or are a clever Basic programmer. MultiBasic allows you to be a clever Basic programmer without knowing clever Basic. In fact, you don't even have to learn any new commands to use the power of MultiBasic. All you have to do is learn a different way to use a few you already know. -------------------------- €¥Background€  --------------------------- Before the power of MultiBasic can be fully understood or appreciated, one needs to have a working knowledge of how the Color Computer 3 manages memory. The MMU (mentioned previously) allows the computer to "switch", or "bank", chunks of the total 128K or 512K memory in and out of the 64K workspace the computer can directly access. In this 64K workspace, 32K is used by Color, Extended, Disk, and Super Basic (the programs that run the computer itself), and 32K is left over for these programs to use. Part of this memory is used for system variables, text screens, graphics, etc. What's left over goes for your Basic programs. Although "bank switching" can be done through Basic, it is difficult. Instead, utility programs such as this one have been created to do this switching for you automatically. ----------------------- €¥Program Operation€  ----------------------- MultiBasic divides your Basic memory into banks with the main variable storage memory shared by all banks. A 128K CoCo 3 gives you six (6) banks, and a 512K machine has fifty-two (52) banks. Each bank can contain a program (or subroutine) up to 8K long. Attempting to load (or program) more than 8K results in an Out of Memory error (?OM). This may seem like a restriction, but it is easily overcome and brings many new abilities to your Basic programs: 〧Modular Programming€  MultiBasic was created so you could have numerous 8K programs in memory, or one massive program divided up into 8K routines. Imagine having one bank holding your main menu routine for a large utility program. Other banks could hold the programs that do the various menu options. Another bank could hold subroutines for text output, disk I/O, etc., that all other banks could call on. This would make it very easy to modify your subroutines at a later time since they would be easily accessable as independent programs. This gives your CoCo one form of "modular programming", which is the ability to create programs out of smaller programs (modules). 〧Variable Passing€  Since the variable space for all programs is the same, moving from one program or subroutine to another does not erase variables. (So if a program in Bank 1 asks a user for his name then stores it in NM$ and jumps to Bank 3, the program there would be able to display NM$ and it would still contain the user's name.) 〧Disk Chaining€  MultiBasic also allows programs to be loaded from disk into any bank without the loss of variables. This lets your machine "disk chain" as many 8K programs as disk space allowed. A 128K CoCo 3 with one disk drive could have an effective 156K of program storage! (Imagine what you could do with multiple drives...) 〧Run-Time Package€  Included on the master diskette is a public domain "run-time" version of MultiBasic which may distribute this with any program(s) you create. 〧And More!€  Programs can be saved in normal "tokenized" Basic form or in Binary form (using a version of the SAVEM command, discussed later). Binary files load slightly faster and are usable only when MultiBasic is loaded. Tokenized program will load normally, whether or not MultiBasic is installed. --------------------- €¥Loading Instructions€  ---------------------- €¥Note:€  Before using MultiBasic, we recommend you make a Backup of your master disk and use that. Refer to your Disk Basic manual if you are unsure on how to do this, or call our support line. To load MultiBasic, insert the program disk into Drive 0 and type: ãLOADM"MULTIBAS" The program will quickly load and the "OK" prompt will return. To install MultiBasic, type: ãEXEC The screen will then clear and the startup screen will be displayed. MultiBasic is now installed and ready for operation. ------------------------- €¥How to Use It€  ------------------------- Once installed, MultiBasic is invisible. The only thing you will notice is that your Basic program area is now limited to 8K and that low-resolution PMODE graphics (PMODE, SCREEN, LINE, DRAW, etc...) have been removed and will no longer function. Also, any program in memory when MultiBasic is EXECuted will be lost IF it is larger than 8K. If smaller, it will be copied over into the new Basic memory. You start out in Bank 1, and have a maximum of six (6) banks in a 128K machine, or fifty-four (54) banks in a 512K machine. You may program, load, and save as normal. €§linenumber€  - Program line number between 0 and 63999. €§bank€  - Bank number from 1 to 6 on a 128K CoCo, 1 to 54 on a 512K CoCo. €§filename€  - Disk filename. (1-8 characters with extension optional.) €§var€  - Numeric (non-string) variable. The power of MultiBasic is controlled by extending the following commands: GOTO €§linenumber/bank€  Ex: GOTO 10/2 Goes to line 10 of the program currently in Bank 2. If no line 10 is present, an Unlisted Line Number error (?UL) is displayed. Ex: GOTO/4 If entered from direct mode (after an OK prompt) this will switch you into Bank 4 and allow you to program, edit, etc., in that bank. GOSUB €§linenumber/bank€  Ex: GOSUB 1000/3 Jumps to a subroutine starting at line 1000 in Bank 3. Upon receiving the RETURN command, the program will return to the original bank and continue execution at the command right after the GOSUB as it does normally. ON €§var€  GOTO €§linenumber/bank€ , [€§linenumber/bank€ ] ,... Ex: ON NM GOTO 10,50/2,50/3,40 If NM=1 program will Goto line 10 of program in current bank. If NM=2 program will Goto line 50 of program in Bank 2. If NM=3 program will Goto line 50 of program in Bank 3. IF NM=4 program will Goto line 40 of program in current bank. ON €§var€  GOSUB €§linenumber/bank€ , [€§linenumber/bank€ ] ,... Ex: ON NM GOSUB 100,1005/5,500/3 If NM=1 program will Gosub line 100 of program in current bank. If NM=2 program will Gosub line 1005 of program in Bank 5. If NM=3 program will Gosub line 500 of program in Bank 3. After Gosub, when the program encounters the RETURN command execution will continue with the next command after the ON var GOSUB statement. LIST €§linenumber(s)/bank€  Ex: LIST 10-50/3 Lists lines 10 through 50 of the program in Bank 3. Ex: LIST/3 Lists the entire program in Bank 3. RUN €§linenumber/bank€  Ex: RUN 10/3 Clears all variables then runs the program in Bank 3 starting with line 10. SAVE €§bank,"filename"€  Ex: SAVE 1,"MAINMENU" Saves the Basic program in Bank 1 to Disk under the name of "MAINMENU". LOAD €§bank,"filename"€  Ex: LOAD 2,"ROUTINES" Loads a Basic program called "ROUTINES" into Bank 2. SAVEM €§bank,"filename"€  Ex: SAVEM 6,"LOGIN" Saves the Basic program in Bank 6 to disk in binary (.BIN extension) format. This type of program loads slightly faster and can only be loaded with MultiBasic installed. Notice that you do not specify any 'start', 'end', or 'execution' addresses since MultiBasic takes care of them. LOADM €§bank,"filename"€  Ex: LOADM 4,"LOGIN" Loads a program that has previously been saved in binary (using the SAVEM command above) into Bank 4. €¥Note:€  Variables will not be lost when you use the LOADM command. This allows you to disk-chain programs. Please note that the above commands also retain their normal non-extended functions. (Ex: GOTO 10, LOAD"FILENAME", SAVE"FILENAME", RUN, etc.) When they are used without any extended parameters they act on the program in the current bank. Also note that the error messages have been slightly altered to be more descriptive within the MultiBasic environment. When an error occurs you will now receive the error code, line number, and bank number in which the error was encountered. Ex: ?SN ERROR IN 150 IN MODULE 5 This means the program in Bank 5 contains a Syntax Error in line 150. As you can see, moving around with MultiBasic is easy since basically (pun intended) you already know how to do it. Some programming examples will follow that should help display some of the uses of this utility. ------------------------ €¥Run-Time Package€  ----------------------- To allow others to run your programs, a public domain run-time version of MultiBasic is included. This program, MBASRTV, allows any program written under MultiBasic to function without the complete package. You may distribute this with any program(s) you create provided that no changes are made to the title screen. We also request that any documentation note the use of MultiBasic. €¥Note€ : The run-time version allows only running the program. Any attempt to edit the program will cause the computer to lock up! ------------------------- €¥Special Notes€  ------------------------- Please be aware of a few things when using MultiBasic: The ON BRK and ON ERR commands do not accept the /bank format. Each module must have the same lines to handle error and break key detection. (IE, if your first module sets ON BRK GOTO 1000, then each module needs to have a line 1000 with the proper code.) Also, the DEFFN code in Basic is not global and if you use any special Functions you must be sure to define them in each module that calls them. The PRINT MEM command shows how much memory is left for variable and string space. To see how much memory is left (in the current bank) for the program, type: ãPRINT 32767-(PEEK(253)*256+PEEK(254)) PEEK(255) gives you the bank the program is in. The current release of MultiBasic is, of course, totally and without a doubt perfect . Sarcasm aside, if and when you do run across a bug in the program please contact us so we may exterminate it. Likewise, if you find any areas of this utility which need improvement or have any other constructive comments, don't hesitate to let us know about it! The Sub-Etha products will constantly evolve until "perfected". --------------------------- €¥Disclaimer€  -------------------------- This program is sold on an "as-is" basis. Sub-Etha Software is not responsible in any way, shape, or form for any loss or damage of any kind as a direct or indirect result of the use of this program. Protect your data and your time. Always make backups! ---------------------- €¥Programming Examples€  --------------------- Included on the master disk are six modules which demonstrate the functions of MultiBasic. Together they make a very simple disk utility program. BANK1 .BAS - Main program. Calls all other routines. BANK2 .BAS - Copy Subroutine. BANK3 .BAS - Directory Subroutine. BANK4 .BAS - Kill Subroutine. BANK5 .BAS - Rename Subroutine. BANK6 .BAS - Global Subroutines for input. To see how this program works, first load MultiBasic as described at the beginning of this manual. Once installed, load in the individual modules. You may do this two ways: From Bank 1, type: LOAD 1,"BANK1" ... Load "BANK1" into Bank 1. LOAD 2,"BANK2" ... Load "BANK2" into Bank 2. LOAD 3,"BANK3" ... And so on for BANK 4, 5, and 6. If you want to do even more typing, you can do the same by going to each bank then loading: GOTO /1 ... Switch to bank 1. LOAD "BANK1" ... Load file into that bank. GOTO /2 ... Switch to bank 2. LOAD "BANK2" ... Load file into that bank. Sub-Etha Software recommends the first method ... After all the modules have been loaded make sure you are in Bank 1 by typing "GOTO /1". Type "RUN" to start the program. You will be able to perform the Copy, Dir, Kill and Rename commands by selecting the appropriate letter. Each time you make a selection the main program jumps to an "input" routine in bank 6 then does an ON GOSUB to the appropriate bank. If you press break at any point the program will stop in the current bank. (Each module contains the same error trapping lines which is necessary for this version of MultiBasic.) Each module is documented with REM statements explaining what each routine does. 〧Special Techniques€  Loading MultiBasic and several modules individually is a bit time consuming. There is an easier way. This section will show you how to make your main program install everything at one time. Using the demonstration program as an example, here are the steps needed to make loading everything up as simple as typing RUN"BANK1"... First, module 1 must contain instructions to load in MultiBasic and the other modules. Before this can be done €¥all€  modules other than the first one €¥must€  be saved in binary format. To do this you would need to have MultiBasic installed then one by one load each module and saving it back using the SAVEM command: LOAD "BANK2" ... Load Bank 2, SAVEM"BANK2" ... then save it in binary format. Do this for all other modules. (Remember you do €¥not€  do this for the first Bank. It must be in normal tokenized format since it will initially be loaded before MultiBasic is in memory.) Next, you must modify the first program to load everything else. Load BANK1 then make the following changes: 6 LOADM"MBASRTV":EXEC:LOADM2,"BANK2":LOADM3,"BANK3": LOADM4,"BANK4":LOADM5,"BANK5":LOADM6,"BANK6" This makes line 6 load in MultiBasic (run-time version) and install it. Then it will load the other modules into their correct banks. After making this change, SAVE"BANK1" back to disk. Now when you want to run this program simply type RUN"BANK1" and the rest will be done for you. €¥NOTE:€  The program will crash if MultiBasic is already installed when this program is run! Also note that this example causes the run-time version of MultiBasic to be loaded so any attempts to edit this program will cause the computer to lock up. In summary, to make one of your MultiBasic programs self-booting, have your main program load and install MultiBasic (or the run-time version if you are going to distribute your program) and then LOADM the other modules into their expected banks. Remember to keep the first bank in normal tokenized basic (use the normal SAVE command) and all other modules must be SAVEMed. If you still have questions on using MultiBasic, contact us (voice) at 409-639-3842 or, if you have a modem, call the Sub-Etha Software support BBS at 409-637-3256. The author of MultiBasic runs this system and is often available to demonstrate the program to you on-line. 〥MultiBasic V1.0 by Terry Todd ãCopyright (C) 1990 by Sub-Etha Software ãSupport Line: (409) 639-ETHA [3842] € ã€¥Sub-Etha BBS: (409) 63-REALM [73256]€