REU
Specific System Requirements - RAM Expansion Unit
The √sys.ramove Script Program
If you want to have your program overlays run off a RAM expander, then the quickest way to transfer the programs would be to LOAD them into memory and then SAVE them to the REU RAM-disk. This is exactly what the "√sys.ramove" program does, because it is a BASIC "script" program that uses the Script-Merge utility designed by myself. A script is simply a set of instructions that are executed as if you typed them in from the keyboard. Since a script program is stored in a protected area of memory, it can use LOAD and SAVE operations just as you would from BASIC's READY prompt. Script-Merge also has a set of specialized commands that allow it to function like a program. It has its own variables, branching commands, and a merge command built in. I will cover the information which is important to changing your "√sys.ramove" program.
The File Transfers The file transfers in the script are divided into sections. Each section is responsible for copying a specific set of files to the RAM expander.
- The BASIC Boot Files: Lines 2100 to 2999 are dedicated to copying the necessary Boot Files to the REU. Of this range, lines 2100-2499 are for those programs which can be loaded into memory with the BASIC LOAD command. This means that the programs will be loaded from disk and then saved to the RAM-disk, using the BASIC LOAD and SAVE commands. The script commands in this range are in the following format: &(8)="program name":>XXX The "&" character represents one of the built-in variables in Script-Merge and has elements like a BASIC array. Thus, the first part of this command assigns the name of the program to the variable &(8), which will be used as the source file name in the transfer. The ">XXX" command is the equivalent of BASIC's GOSUB command, where XXX is the line number to branch to. The routine starting at line 310 of the script is one version of the copy routine. First, it sets the destination name to the overlay name plus a "." period character. Next, the routine tacks an "*" asterisk onto the end of the source name. The "." and "*" characters are used so that the script will not have to know the actual overlay revision number of a program to copy it. For example, if &(8) was set to "√bbs.ovl" the source name would end up "√bbs.ovl*" and the destination name would end up "√bbs.ovl." Thus, no matter what the version number of √bbs.ovl was, it would still be pied. You will notice that at line 2100, the "copy with version number" routine is used to transfer the √sys.loadml program. Line 300 marks the beginning of another version of the load routine. This routine does not change the source name, and sets the destination name the same as the source name. Thus, this routine is used for programs that do not have a version number suffix. This is used for the +ram.bbs and +ram.reboot programs in script lines 2110 and 2120.
- The Non-BASIC Boot Files: Lines 2500 to 2999 are reserved for copying the boot files which cannot be transferred via the BASIC LOAD and SAVE commands. This range uses another copy routine located at line 510. This routine differs from the previous ones in that it is used for non-BASIC programs and sequential files. Before calling the routine, &(7) must be set with the one character file type. The standard types are "p" for PRG and "s" for SEQ. Relative files cannot be copied by this script program. This routine also works like the one at line 310 in that it copies files with a version number. Line 2500 sets the type to "p" for PRG and then lines 2510 and 2510 copy the appropriate ML file to the REU.
- The BASIC Program Files: Lines 7100 to 7999 are used to transfer the necessary Program Files to the REU. Of this range, lines 7100 to 7499 are to be used for programs that can be transferred via LOADing and SAVEing them from BASIC. The copy routine at line 310 (copy with version number) is used for the √bbs.init, √bbs.msgs, √bbs.xfer, and √bbs.ovl overlays. For the remaining overlays the routine at line 210 is used. This routine works much the same as the one at 310, except it checks to see if the file exists before attempting to copy it. If the file does not exist, then the program will not attempt to copy it. If the file does exist, then the transfer will be completed normally. This is used for the overlays which the SYSOP may or may not have chosen to use on the BBS system.
- The Non-BASIC Program Files: Lines 7500 to 7999 are to be used for copying non-BASIC programs or sequential files. The type is set to "p" PRG at line 7500 and will be used for all following transfers until it is changed again (the stock script does not copy any sequential files). The routine at line 510 (copy file with version number) is used for the remaining files.
The Built-in Copy Routines
Below is a summary of all the copy routines available in the √sys.ramove program:
| Line | Description | Which Variables to Set |
|---|---|---|
| Checks if file exists first: | ||
| 200 | BASIC file, no version number | &(8)=source & dest. name |
| 210 | BASIC file, with version number | &(8)=source & dest. name, w/o suffix |
| 220 | BASIC file, no version number | &(8)=source name, &(9)=dest. name |
| 400 | Non-BASIC, no version number | &(7)=type, &(8)=source & dest. name |
| 410 | Non-BASIC, with version number | &(7)=type, &(8)=src & dst, w/o suffix |
| 4210 | Non-BASIC, no version number | &(7)=type, &(8)=source, &(9)=dest. |
| No check if file exists | ||
| 300 | BASIC file, no version number | &(8)=source & dest. name |
| 310 | BASIC file, with version number | &(8)=source & dest. name, w/o suffix |
| 320 | BASIC file, no version number | &(8)=source name, &(9)=dest. name |
| 500 | Non-BASIC, no version number | &(7)=type, &(8)=source & dest. name |
| 510 | Non-BASIC, with version number | &(7)=type, &(8)=src & dst, w/o suffix |
| 520 | Non-BASIC, no version number | &(7)=type, &(8)=source, &(9)=dest. |
As you can see, almost any possible type of transfer need is taken care of. The script program as-will transfer just the essential files to the REU which are necessary for BBS operation.
Adding to the Script Adding to the script to copy additional files is as easy as using the same methods already used in the script program. Just look at the lines where the regular files are copied and use the same procedures. Here are some general guidelines though:
- Additional Overlays: If you have extra program overlays that are stored with your Program Files, then you should have no problem including them in the script. Just add another line in the range 7100 to 7499 in the following format: 7XXX &(8)="√overlay":>310 This example would copy the file "√overlay*" from the Program Files and store it on the REU as "√overlay.". If you wish to set the exact overlay name, you will use ">300" instead of ">310". Then nothing would be added to the file name in &(8), the source and destination name. If you wish to set different source and destination names, then you would use ">320" after setting &(8) with the source name and &(9) with the destination name.
Overlays Not in Program Files: If your extra games or overlays are not stored with your Program Files, then you will need to add extra sections of code in the range 3000 to 6999. The first thing that would need to do is to set the device and drive number parameters. The current device number is stored in the variable %(1), and the drive number prefix (e.g. "0:") is stored in the variable &(1). Then you would open the error channel and send the appropriate drive initialization command to the disk device with your extra overlays. After that you would use the >300, >310, or >320 copy routines like normal. Here is an example:
- 3000 :set device and drive
- 3010 %(1)=8:&(1)="0:"
- 3020 :
- 3100 :open error channel
- 3110 close15:open15,%(1),15,"i0"
- 3120 :
- 3200 :copy files
- 3210 &(8)="√game.emp1":>310
- 3220 &(8)="√game.emp2":>310
- 3230 &(8)="√game.emp3":>310
Note that you can precede a line with a ":" colon and it will not be executed in the script.- Sequential Files: If you need to copy sequential files, then you would follow the same basic procedure, but you would need to use the >400, >410, or >420 routines to copy the file. Here is an example (continuing the above example):
- 3300 :set file type
- 3310 &(7)="s"
- 3320 :
- 3400 :copy files
- 3410 &(8)="√emp.menu1":>400
- 3420 &(8)="√emp.menu2":>400
Script-Merge Rules
The first rule that you should remember is that once a normal BASIC command is executed in a script line, then the rest of the line will be interpreted without the aid of the additional script commands. For example, if this line were in a script: 1000 &(8)="√file":print"hello":&(8)="√file2", an error would result when the second &(8) were reached. This happens because Script-Merge recognizes that you want to do a regular BASIC command, so it copies the rest of the line to a special location and just jumps into the regular BASIC execution routines. Thus, you can begin a line with script-merge commands and then switch to normal BASIC, but once performed, the remainer of the line will be "blind" to script-merge command content. The next line in the script will be able to use the special commands again. One exception to this is the variables, which are always accessible from anywhere.
Script-Merge Commands
The table below provides the list of the special Script-Merge commands:
| Char | Command | Syntax/Description |
|---|---|---|
| @ | Print Text | Just like the BASIC Print Command |
| * | Wait for Key | Works just like PRINT, but then waits for key |
| . | Input Text | Works just like PRINT, but inputs line afterward |
| , | Delete Lines | ,line# [-line#] |
| / | Merge File | /<file name> |
| # | GOTO | #line# |
| > | GOSUB | >line# |
| _ | RETURN | |
| ] | Enter Line | ]line# <basic text> |
| . | IF | .expression:<commands if true> |
| % | Set %() var | %(0..9)=<numeric expression, -32768 to 32767> |
| & | Set &() var | &(0..9)=<string expression, max 16 characters> |
| ‘ | Set ‘() var | '(0..9)=<string expression, max 16 characters> |
| - | END |
Script-Merge Functions
The table below lists the extra functions added by Script-Merge. They can be used in any expression if Script-Merge is active:
| Chars | Description |
|---|---|
| %(x) | Numeric vars %(0) to %(9). Can store numbers from -32768 to 32767. |
| &(x) | String variables &(0) to &(9). Max string length is 16 characters. |
| '(x) | String variables '(0) to '(9). Max string length is 16 characters. |
| $ | Returns input from last "*" or "." command |
| !(x) | Returns 0 if line x doesn't exist, or non-zero if line x exists |
Script Size Limits
Script-Merge scripts have a size limit. The BASIC program containing the script can be a maximum of 8000 bytes large. A good idea would be to make sure that the size never exceeds 30 disk blocks, which is well within the maximum.