Branch tables: Difference between revisions

From Color 64 BBS Wiki
Created page with "Programming Features - <strong>Command Branch Tables</strong> This table below represents the overlays and line numbers at which the main commands reside. The default command keys are listed here under the heading KEY. What happens when a user presses a key at the main prompt is that the command is searched for in the array CM%(I,1), which stores the ASCII value of each of the commands. Once found, the user's level is compared to the comman..."
 
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[programming features|Programming Features]] - <strong>Command Branch Tables</strong>
[[programming features|Programming Features]] - <strong>Command Branch Tables</strong>


This table below represents the overlays and line numbers at which the main commands reside.  The default command keys are listed here under the heading KEY. 
== Branch Tables ==


What happens when a user presses a key at the main prompt is that the command is searched for in the array CM%(I,1), which stores the ASCII value of each of the commands.  Once found, the user's level is compared to the command level stored in CM%(I,2).  If all is well, then the command number ends up in the variable I.  The command number is listed under "No." in the table.
=== Command Branches ===
The table below cross-references the main prompt command keys, their internal command numbers, and where they branch.


Next, the variable I is used in a series of ON GOTO commands that start at line 13160.  Since there are far too many commands to do the ON GOTO in one line, the ON GOTO statement at line 13160 jumps to one of the following 4 lines which handle 10 commands each. Line 13170 handles commands 0 to 9, line 13180 handles commands 10 to 19, line 13190 handles commands 20 to 28 (29 is not an actual command), line 13195 handles commands 30 to 39, and line 13197 handles commands 40 to 42.
When a user presses a key at the main prompt, Color 64 does not immediately jump to a routine based on the key itself. Instead, it performs a lookup:


{| class="wikitable
* The pressed key is first converted to its ASCII value.
* The program searches the array <strong>CM%(I,1)</strong>, which stores the ASCII value for each defined command key.
* When a match is found, the corresponding array position becomes the command number in <strong>I</strong>.
* The caller's access level is then checked against <strong>CM%(I,2)</strong>, which stores the required level for that command.
* If the key is valid and the caller has access, the value in <strong>I</strong> is then used by the branch tables beginning at line 13160.
 
In the table below, the value shown under <strong>No.</strong> is the command number ultimately stored in <strong>I</strong>.
 
{| class="wikitable" style="width:300px;"
|-
|-
|+Command Pre-Assignments
|+ style="white-space:nowrap;" | Command Pre-Assignments
! Key
! Key
! Value of "I"
! No.
!
!
! Key
! Key
! Value of "I"
! No.
|-
|-
| @  
| @
| 1  
| 1
|  
|
| N  
| N
| 22  
| 22
|-
|-
| P  
| P
| 2  
| 2
|
|
| X  
| X
| 23  
| 23
|-
|-
| S  
| S
| 3  
| 3
|
|
| T  
| T
| 24  
| 24
|-
|-
| $  
| $
| 4  
| 4
|
|
| L  
| L
| 25  
| 25
|-
|-
| D  
| D
| 5  
| 5
|  
|
| +  
| +
| 26  
| 26
|-
|-
| #  
| #
| 6  
| 6
|
|
| Z  
| Z
| 27  
| 27
|-
|-
| U  
| U
| 7  
| 7
|
|
| <nowiki><blank></nowiki>  
| <nowiki><blank></nowiki>
| 29  
| 29
|-
|-
| !  
| !
| 8  
| 8
|
|
| 1  
| 1
| 30  
| 30
|-
|-
| F  
| F
| 9  
| 9
|
|
| 2  
| 2
| 31  
| 31
|-
|-
| C  
| C
| 10  
| 10
|  
|
| 3  
| 3
| 32  
| 32
|-
|-
| A  
| A
| 11  
| 11
|
|
| *  
| *
| 33  
| 33
|-
|-
| O  
| O
| 12  
| 12
|  
|
| 5  
| 5
| 34  
| 34
|-
|-
| G  
| G
| 13  
| 13
|
|
| 6  
| 6
| 35  
| 35
|-
|-
| H  
| H
| 14  
| 14
|
|
| 7  
| 7
| 36  
| 36
|-
|-
| W  
| W
| 15  
| 15
|
|
| 8  
| 8
| 37  
| 37
|-
|-
| M  
| M
| 16  
| 16
|
|
| 9  
| 9
| 38  
| 38
|-
|-
| I  
| I
| 17  
| 17
|
|
| %  
| %
| 39  
| 39
|-
|-
| E  
| E
| 18
| 18
|  
|
| =  
| =
| 40  
| 40
|-
|-
| ↑  
| ↑
| 19  
| 19
|
|
| &  
| &
| 41  
| 41
|-
|-
| >
| >
| 20  
| 20
|
|
| -  
| -
| 42  
| 42
|-
|-
| <
| <
| 21  
| 21
|
|
|
|
|
|}
|}


For commands that are in the currently loaded overlay, the ON GOTO will be to a special "mini routine", which exists in the line range 13200 to 13480.  This mini-routine usually does another GOSUB to the actual routine, then does a GOTO13100 to return to the main prompt. This is done because some of these main routines are used locally from areas like the SYSOP menu, in which case you don't want to return to the main prompt. The line numbers for these mini routines are listed in Table 29 under the heading MINI.  
For commands that are in the currently loaded overlay, there are ON GOTO statements to load a special "mini routine" specific to that command which exists in the line ranges 13200 to 13480 of the overlaysThat mini-routine normally performs a <strong>GOSUB</strong> to the actual command routine, then does a <strong>GOTO 13100</strong> to return to the main prompt.
 
This extra step exists because some command routines are also called from other places, such as the SYSOP menu. In those cases, the routine must perform its work without always forcing a return to the main prompt. The mini-routine provides a standard entry path for main-prompt commands while still allowing the underlying routine to be reused elsewhere.
 
The line numbers for these mini-routines are listed in the table below under the heading <strong>Mini</strong>.
 
==== How the ON GOTO branch tables work ====
The series of <strong>ON GOTO</strong> statements beginning at line 13160 is easier to understand if you think of it as a two-step dispatcher.
 
First, line 13160 chooses which group of commands is being handled. The commands are grouped into blocks of ten:
 
* 0 to 9
* 10 to 19
* 20 to 28
* 30 to 39
* 40 to 42
 
Line 13160 does not jump directly to the final command routine. Instead, it jumps to the correct <em>branch table</em> for that group.
 
For example:
 
:: <strong>ON I/10+1 GOTO 13170,13180,13190,13195,13197</strong>
 
If <strong>I=7</strong>, then <strong>I/10+1</strong> evaluates to 1, so BASIC branches to line <strong>13170</strong>, which handles commands 0 to 9.
 
If <strong>I=24</strong>, then <strong>I/10+1</strong> evaluates to 3, so BASIC branches to line <strong>13190</strong>, which handles commands 20 to 28.
 
Once inside the proper group, a second <strong>ON GOTO</strong> chooses the exact destination within that group. Example:


The actual command routines are usually located in various places in the overlays.  Sometime the entire command function does not exist totally in one overlay, such as the [A]Alter Password command which must go to √bbs.init to change the password.  In this table the overlays are listed which are first branched to (in the case of the Alter Password command this means the √bbs.ovl overlay).  The line numbers for the actual routines are listed in the table under ACTUAL.
:: <strong>13170 ON I+1 GOTO 13202,13205,13210,13220,92,92,92,92,96,13260</strong>


Commands that are not in the current overlay are sent to one of the overlay loader lines which exist at lines 88 to 103.  These lines will load the appropriate overlay in which the command exists. The loader line is listed in this table under LOAD, and the abbreviation for each overlay is listed in the table under OVRL.  
This line handles command numbers 0 through 9. BASIC uses <strong>I+1</strong> because <strong>ON GOTO</strong> counts from 1, while the command numbers begin at 0.


Before loading the appropriate overlay, the variable OV is set so that the new overlay will know where to branch to once loadedUsually this is set to 1 automatically when the loader lines are used, because most overlays reserve OV number 1 to handle a command that has been relayed to itOnce in the overlay the variable I is used to perform the ON GOTO statements at line 13160.  Sometimes, however, the OV number is not 1 as in the case of the Set Date & Time command. Usually this is in the case of overlays which do not have a menu of their own, such as √bbs.init.  The appropriate settings for OV are listed in the table below:
So, if <strong>I=0</strong>, BASIC takes item 1 in the list and branches to <strong>13202</strong>.   
If <strong>I=1</strong>, it takes item 2 and branches to <strong>13205</strong>.   
If <strong>I=4</strong>, it takes item 5 and branches to <strong>92</strong>.


{| class="wikitable
The same idea is used for the later ranges, except the program subtracts an offset so the numbering again starts at 1 for that range:
 
* <strong>ON I-9 GOTO ...</strong> handles 10 to 19
* <strong>ON I-19 GOTO ...</strong> handles 20 to 28
* <strong>ON I-29 GOTO ...</strong> handles 30 to 39
* <strong>ON I-39 GOTO ...</strong> handles 40 to 42
 
This is why the branch tables can look confusing at first glance. They are not testing the key directly. They are using the command number in <strong>I</strong>, first to select the correct table, then to select the correct destination within that table.
 
==== Example ====
Using the code below:
 
13140 FOR I=. TO 42:IF ASC(A$)<>CM%(I,1) NEXT:GOSUB995:@
13145 @I=29 OR LV<CM%(I,2) OR I>39 AND M3=.
13150 #:GOSUB8004
13160 ON I/10+1 GOTO13170,13180,13190,13195,13197
13170 ON I+1 GOTO13202,13205,13210,13220,92,92,92,92,96,13260
13180 ON I-9 GOTO96,96,13290,96,96,96,13330,96,13360,13370
13190 ON I-19 GOTO92,13375,96,92,96,96,96,92,92
13195 ON I-29 GOTO35651,35652,96,98,100,96,96,96,96,96
13197 ON I-39 GOTO102,88,88
 
If the user presses <strong>P</strong>:
 
* the search finds <strong>P</strong> in the command array
* <strong>I</strong> becomes <strong>2</strong>
* line 13160 branches to <strong>13170</strong> because command 2 is in the 0 to 9 range
* line 13170 evaluates <strong>ON I+1</strong>, which becomes <strong>ON 3</strong>
* BASIC takes the 3rd item in that list, which is <strong>13210</strong>
 
That is the mini-routine for the <strong>[P]ost a Public Message</strong> command.
 
If the user presses <strong>3</strong>:
 
* <strong>I=32</strong>
* line 13160 branches to <strong>13195</strong>
* line 13195 evaluates <strong>ON I-29</strong>, which becomes <strong>ON 3</strong>
* BASIC takes the 3rd item in the list, which is <strong>96</strong>
 
Line 96 is an overlay loader, so command 32 is not handled locally in that overlay and must be relayed elsewhere.
 
=== Overlay Cross-Reference ===
The actual command routines are usually located in various places throughout the overlays. Sometimes an entire command is not fully contained in one overlay. For example, the [A]lter Password command must eventually branch to √bbs.init to change the password. In the table below, the overlay listed is the first overlay branched to. For the Alter Password command, that first destination is √bbs.ovl. The line numbers for the true underlying routines are listed under <strong>Actual</strong>.
 
Commands not present in the current overlay are sent to one of the overlay loader lines, which exist at lines 88 to 103. These lines load the overlay in which the command actually resides. The loader line is shown under <strong>Load</strong>, and the overlay abbreviation is shown under <strong>Overlay</strong>.
 
Before loading the new overlay, the variable <strong>OV</strong> is set so that the newly loaded overlay knows where to branch once loaded. Usually this is set to <strong>1</strong> automatically when the standard loader lines are used, because most overlays reserve <strong>OV=1</strong> for a command relayed from another overlay.
 
Once the new overlay is loaded, the value in <strong>I</strong> is used again by the branch tables beginning at line 13160. In this way, the command number is preserved even though the command has been handed off to another overlay.
 
Sometimes the <strong>OV</strong> setting is not 1. This usually occurs in overlays that do not have a normal main prompt of their own, such as √bbs.init. In those cases, the loader must set a different <strong>OV</strong> value so the receiving overlay enters the correct routine.
 
{| class="wikitable"
|-
|-
|+OV Settings Cross Reference  
|+ OV Settings Cross Reference
! Key
! Key
! No.
! No.
Line 163: Line 253:
! Function
! Function
|-
|-
| R  
| R
| 0  
| 0
| 13202  
| 13202
| 3005  
| 3005
| MSGS  
| MSGS
| 90  
| 90
| 1  
| 1
| Read Public Messages  
| Read Public Messages
|-
|-
| Q
| @
| 1  
| 1
| 13205  
| 13205
| 3710  
| 3710
| MSGS  
| MSGS
| 90  
| 90
| 1  
| 1
| Post Office  
| Post Office
|-
|-
| P  
| P
| 2  
| 2
| 13210  
| 13210
| 1260  
| 1260
| MSGS  
| MSGS
| 90  
| 90
| 1  
| 1
| Post a Public Message  
| Post a Public Message
|-
|-
| S  
| S
| 3  
| 3
| 13220  
| 13220
| 4005  
| 4005
| MSGS  
| MSGS
| 90  
| 90
| 1  
| 1
| Scratch a Public Message  
| Scratch a Public Message
|-
|-
| $  
| $
| 4  
| 4
| 13230  
| 13230
| 405  
| 405
| XFER  
| XFER
| 92  
| 92
| 1  
| 1
| View Download Directory  
| View Download Directory
|-
|-
| D  
| D
| 5  
| 5
| 13240  
| 13240
| 16505  
| 16505
| XFER  
| XFER
| 92  
| 92
| 1  
| 1
| Download File(s)  
| Download File(s)
|-
|-
| #  
| #
| 6  
| 6
| 13245  
| 13245
| 16110  
| 16110
| XFER  
| XFER
| 92  
| 92
| 1  
| 1
| Choose a Download Directory  
| Choose a Download Directory
|-
|-
| U  
| U
| 7  
| 7
| 13250  
| 13250
| 16300  
| 16300
| XFER  
| XFER
| 92  
| 92
| 1  
| 1
| Upload a File  
| Upload a File
|-
|-
| !  
| !
| 8  
| 8
| 13255  
| 13255
| 27005  
| 27005
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| Edit User Stats  
| Edit User Stats
|-
|-
| F  
| F
| 9  
| 9
| 13260  
| 13260
| 7010  
| 7010
| MSGS  
| MSGS
| 90  
| 90
| 1  
| 1
| Feedback to Sysop  
| Feedback to Sysop
|-
|-
| C  
| C
| 10  
| 10
| 13270  
| 13270
| 15002  
| 15002
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| Chat with the Sysop  
| Chat with the Sysop
|-
|-
| A  
| A
| 11  
| 11
| 13280  
| 13280
| 13735  
| 13735
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| Alter Password  
| Alter Password
|-
|-
| O  
| O
| 12  
| 12
| 13290  
| 13290
| 19010  
| 19010
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| Log off System  
| Log off System
|-
|-
| G  
| G
| 13  
| 13
| 13295  
| 13295
| 13910  
| 13910
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| Select Graphics/Ascii/Ansi
| Select Graphics/ASCII/ANSI
|-
| H
| 14
| 13300
| 17015
| OVL
| 96
| 1
| View Help Files
|-
|-
| W
| H
| 15
| 14
| 13310
| 13300
| 13310
| 17015
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| View Welcome Files  
| View Help Files
|-
|-
| M
| W
| 16
| 15
| 13330
| 13310
| 19510
| 13310
| MSGS
| OVL
| 90
| 96
| 1  
| 1
| View Membership List
| View Welcome Files
|-
|-
| I
| M
| 17
| 16
| 13350
| 13330
| 13350
| 19510
| OVL
| MSGS
| 96
| 90
| 1  
| 1
| View Information File
| View Membership List
|-
|-
| E
| I
| 18
| 17
| 13360
| 13350
| 5010
| 13350
| MSGS
| OVL
| 90
| 96
| 1  
| 1
| Edit a Public Message
| View Information File
|-
|-
| .
| E
| 19
| 18
| 13370
| 13360
| 24005
| 5010
| INIT
| MSGS
| 95
| 90
| 2
| 1
| Set Date & Time
| Edit a Public Message
|-
|-
| >
| .
| 20  
| 19
| 13372  
| 13370
| 22010  
| 24005
| XFER  
| INIT
| 92  
| 95
| 1  
| 2
| Dos Wedge  
| Set Date & Time
|-
| >
| 20
| 13372
| 22010
| XFER
| 92
| 1
| DOS Wedge
|-
|-
| <
| <
| 21  
| 21
| 13375  
| 13375
| 20010  
| 20010
| INIT  
| INIT
| 95  
| 95
| 7  
| 7
| Password Maintenance  
| Password Maintenance
|-
|-
| N  
| N
| 22  
| 22
| 13377  
| 13377
| 15505  
| 15505
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| New Downloads  
| New Downloads
|-
|-
| X  
| X
| 23  
| 23
| 13380  
| 13380
| 13810  
| 13810
| XFER  
| XFER
| 92  
| 92
| 1  
| 1
| Scratch a Download  
| Scratch a Download
|-
|-
| T  
| T
| 24  
| 24
| 13385  
| 13385
| 17010  
| 17010
| XFER  
| XFER
| 96  
| 96
| 1  
| 1
| Text Files Area  
| Text Files Area
|-
|-
| L  
| L
| 25  
| 25
| 13380  
| 13380
| 8110  
| 8110
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| View Caller Log  
| View Caller Log
|-
|-
| +  
| +
| 25
| 26
| 13400  
| 13400
| 35020  
| 35020
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| Multi-Upload  
| Multi-Upload
|-
|-
| Z  
| Z
| 27  
| 27
| 13410  
| 13410
| 13710  
| 13710
| XFER  
| XFER
| 92  
| 92
| 1  
| 1
| Edit Download Description  
| Edit Download Description
|-
|-
| Y  
| Y
| 28  
| 28
| 13420  
| 13420
| 14010  
| 14010
| XFER  
| XFER
| 92  
| 92
| 1  
| 1
| Release a Download  
| Release a Download
|-
|-
| 1  
| 1
| 30  
| 30
| 13430  
| 13430
| 14310  
| 14310
| MSGS  
| MSGS
| 90  
| 90
| 1  
| 1
| Spare Command 1  
| Spare Command 1 (8.1a Games)
|-
|-
| 2
| 2
| 31  
| 31
| 13440  
| 13440
| 13440  
| 13440
| XFER  
| XFER
| 92  
| 92
| 1  
| 1
| Spare Command 2  
| Spare Command 2 (8.1a User Profile)
|-
|-
| 3  
| 3
| 32  
| 32
| 13450  
| 13450
| 13450  
| 13450
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| Spare Command 3  
| Spare Command 3
|-
|-
| *  
| *
| 33  
| 33
| 13455  
| 13455
| 2000  
| 2000
| OV2  
| OV2
| 98  
| 98
| 1  
| 1
| Spare Command 4 (Mod Menu)  
| Spare Command 4 (Mod Menu)
|-
|-
| 5  
| 5
| 34  
| 34
|  
|
| 13460  
| 13460
| OV3  
| OV3
| 100  
| 100
| 1  
| 1
| Spare Command 5  
| Spare Command 5
|-
|-
| 6  
| 6
| 35  
| 35
| 13465  
| 13465
| 13465  
| 13465
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| Spare Command 6  
| Spare Command 6
|-
|-
| 7  
| 7
| 36  
| 36
| 13470  
| 13470
| 13470  
| 13470
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| Spare Command 7  
| Spare Command 7
|-
|-
| 8  
| 8
| 37  
| 37
| 13475  
| 13475
| 13475  
| 13475
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| Spare Command 8  
| Spare Command 8
|-
|-
| 9  
| 9
| 38  
| 38
| 13480  
| 13480
| 13480  
| 13480
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| Spare Command 9  
| Spare Command 9
|-
|-
| %  
| %
| 39  
| 39
| 13425  
| 13425
| 16050  
| 16050
| OVL  
| OVL
| 96  
| 96
| 1  
| 1
| Select Transfer Protocol  
| Select Transfer Protocol
|-
|-
| =  
| =
| 40  
| 40
|  
|
| 14005  
| 14005
| NW1  
| NW1
| 102  
| 102
| 1  
| 1
| Network Post  
| Network Post
|-
|-
| &  
| &
| 41  
| 41
|  
|
| 34010  
| 34010
| NW2  
| NW2
| 88  
| 88
| 1  
| 1
| Network Maintenance Menu  
| Network Maintenance Menu
|-
|-
| -  
| -
| 42  
| 42
|  
|
| 9010  
| 9010
| NW2  
| NW2
| 88  
| 88
| 1  
| 1
| Release Network Messages  
| Release Network Messages
|-
|-
| ?  
| ?
| --  
| --
| 13010
| All
|
|
|
| Main BBS Menu  
| 13010
| All
|
|
| Main BBS Menu
|}
|}


=== The Overlay Loader Lines ===
The table below defines the standard main overlay loader lines. Some of these lines are not present in every overlay because they may not be needed.


<strong>The Overlay Loader Lines</strong>
{| class="wikitable"
 
The table below defines the standard main overlay loader lines.  Some of these lines are not in all the overlays because they may not be needed:
 
{| class="wikitable
|-
|-
|+Standard Main Overlay Loader Lines  
|+ Standard Main Overlay Loader Lines
! Line
! Line
! Overlay
! Overlay
Line 565: Line 653:
! Overlay
! Overlay
|-
|-
| 89  
| 89
| √bbs.nw2        
| √bbs.nw2
|  
|
| 97  
| 97
| √bbs.ovl          
| √bbs.ovl
|-
|-
| 91  
| 91
| √bbs.msgs      
| √bbs.msgs
|  
|
| 99  
| 99
| √bbs.ov2  
| √bbs.ov2
|-
|-
| 93  
| 93
| √bbs.xfer      
| √bbs.xfer
|  
|
| 101  
| 101
| √bbs.ov3  
| √bbs.ov3
|-
|-
| 95  
| 95
| √bbs.init        
| √bbs.init
|  
|
| 103  
| 103
| √bbs.nw1  
| √bbs.nw1
|-
| 35651
| √bbs.games
|
| 35652
| √bbs.profile
|}
|}


Also, in the overlays that have a main prompt there is a line before each of the above lines that will set OV=1. For example, to set OV=1 and load the √bbs.msgs overlay, you would <strong>GOTO 90</strong> (one line before 91).  
In overlays that have a main prompt, there is usually a line immediately before each loader line that sets <strong>OV=1</strong>. For example, to set <strong>OV=1</strong> and load the √bbs.msgs overlay, use <strong>GOTO 90</strong>, which is one line before 91.


<strong>Individual Overlay Branching</strong>


<strong>Individual Overlay Branching  </strong>
The following sections describe how each overlay behaves depending on the setting of <strong>OV</strong> when the overlay is loaded. The path of GOTOs, GOSUBs, and overlay jumps is listed in a shorthand format.
 
Example path from √bbs.nw1:


The following sections serve as descriptions of how each overlay behaves depending on the setting of OV when the overlay is loaded.  The path of GOTOs, GOSUBs, and other information is listed in a special format.  Here is an example of the path of OV=3 in √bbs.nw1:
  OV=3 : 50, (12010), (12220), [6/INIT]
  OV=3 : 50, (12010), (12220), [6/INIT]
: This will regenerate Net index (from Net Menu)
: This regenerates the Net index from the Net Menu
 
In this notation:
 
* Plain line numbers, such as <strong>50</strong>, indicate a <strong>GOTO</strong>.
* Line numbers in parentheses indicate a <strong>GOSUB</strong>.
* A jump to another overlay is shown as <strong>[N/XXXX]</strong>, where <strong>N</strong> is the new value of <strong>OV</strong> and <strong>XXXX</strong> is the destination overlay.
 
Using the example above, the actual flow would be:


Plain line numbers (as in the 50) are the equivalent of a GOTO command.  Line numbers in parenthesis are the equivalent of a GOSUB command.  A branch to another overlay is listed in the format [N/XXXX] where N the setting of OV and XXXX is the overlay to be loaded.  Finally, the description of the function follows the path.  In the above example then, the path of the command routine would be as follows:
  5 GOTO 50
  5 goto50
: Line 5 is always first, where it does an ON OV GOTO


50 gosub12010:gosub12220:ov=6:goto95 
: Line 5 is always the first branch point, where the overlay performs its <strong>ON OV GOTO</strong> dispatch.
: Line 95 is standard INIT loader


Sometimes this path is somewhat simplified from the actual code used in the overlays, but it gives a good idea of what functions are performed where.
50 GOSUB 12010:GOSUB 12220:OV=6:GOTO 95


: Line 95 is the standard INIT loader.


<strong>The "OV" Settings for Overlays </strong>
In some cases this shorthand is slightly simplified from the exact code, but it provides a reliable map of the actual control flow.


The table below depicts the paths for all settings of OV in the various overlays:
=== The "OV" Settings for Overlays ===
The table below shows the paths for all defined settings of <strong>OV</strong> in the various overlays.


{| class="wikitable
{| class="wikitable"
|-
|-
|+Path for OV settings in Overlays  
|+ Path for OV Settings in Overlays
! Line Command
! Line Command
! Setting
! Setting
|-
|-
| <strong>√bbs.init</strong>
| colspan="2" | <strong>√bbs.init</strong>
|  
|-
| OV=1 : 40, (19044), 30
| Post-logoff procedures
|-
| OV=2 : 50, (12865), [3/MSGS]
| Set Date & Time (from main BBS prompt)
|-
| OV=3 : 60, (12760), 30
| Back to Answer Feedback prompt (from √bbs.msgs)
|-
|-
| OV=1 : 40, (19044), 30
| OV=4 : 30, (12010), [2/MSGS]
| Post-logoff procedures
| Wait-For-Call screen
|-
|-
| OV=2 : 50, (12865), [3/MSGS]
| OV=5 : 9999
| Set Date & Time (from main BBS prompt)
| Save msg index, variables, end program
|-
|-
| OV=3 : 60, (12760), 30  
| OV=6 : 70, (12800), 30
| Back to Answer Feedback prompt (from √bbs.msgs)
| Network Menu
|-
|-
| OV=4 : 30, (12010), [2/MSGS]  
| OV=7 : 75, (20010), [3/MSGS]
| Wait-For-Call screen
| Password Maint (from main BBS prompt)
|-
|-
| OV=5 : 9999
| OV=8 : 80, (2710), [4/MSGS]
| Save msg index, variables, end program
| Validate by E-mail
|-
|-
| OV=6 : 70, (12800), 30
| OV=9 : 78, (13735), [3/MSGS]
| Network Menu
| Set new password (relayed from √bbs.ovl)
|-
|-
| OV=7 : 75, (20010), [3/MSGS]  
| OV=10 : 65, (12092), [2/MSGS]
| Password Maint (from main BBS prompt)  
| End of midnight routine (back to WFC)
|-
|-
| OV=8 : 80, (2710), [4/MSGS]
| OV=11 : 35, (11905), 30
| Validate by E-mail
| Reset √level x files
|-
|-
| OV=9 : 78, (13735), [3,MSGS]  
| OV=12 : 85, (18240), [2/MSGS]
| Set new password (relayed from √bbs.ovl)  
| Return to application routine (from NW1)
|-
|-
| OV=10 : 65, (12092), [2/MSGS]
| OV=13 : 33, (29010), 30
| End of midnight routine (back to WFC)
| Return to WFC after new node applied
|-
|-
| OV=11 : 35, (11905), 30
| OV=14 : 79, (13735)
| Reset √level x files
| Save User Profile from √bbs.profile
|-
|-
| OV=12 : 85, (18240), [2/MSGS]
| colspan="2" | <strong>√bbs.msgs</strong>
| Return to application routine (from NW1)
|-
|-
| OV=13 : 33, (29010), 30
| OV=1 : 60, (13160), 57
| Return to WFC after new node applied
| Command relayed from other overlay
|-
|-
| <strong>√bbs.msgs </strong>
| OV=2 : 50, <read √welcome2>, (13523), (8510), (9005), 55
|
| Welcome msgs
|-
| OV=3 : 55, (13100), 57
| Main BBS prompt
|-
| OV=4 : 70, (1410), <ON VX GOTO 71,72,55,74>
| General msg editor prompt
|-
| OV=5 : 65, (12822), [3/INIT]
| Answer SYSOP feedback
|-
|-
| OV=1 : 60, (13160), 57
| OV=6 : 80, (7020), 55
| Command relayed from other overlay
| Feedback to SYSOP
|-
|-
| OV=2 : 50, <read √welcome2>, (13523), (8510), (9005), 55  
| OV=7 : 71, (9048), 55
| Welcome msgs
| Continue reading mail (after replying Net mail)
|-
|-
| OV=3 : 55, (13100), 57
| OV=8 : 72, (3675), (3320), 55
| Main BBS prompt
| Continue reading msgs (after Net reply)
|-
|-
| OV=4 : 70, (1410), <ON VX GOTO 71,72,55,74>
| ---- : 57, [3/OVL]
| General msg editor prompt
| Logoff
|-
|-
| OV=5 : 65, (12822), [3/INIT]  
| ---- : 74, [3/INIT]
| Answer SYSOP feedback
| Back to Answer SYSOP Feedback prompt
|-
|-
| OV=6 : 80, (7020), 55
| colspan="2" | <strong>√bbs.xfer</strong>
| Feedback to SYSOP
|-
|-
| OV=7 : 71, (9048), 55
| OV=1 : 60, (13160), [3/OVL]
| Continue reading mail (after replying Net mail)
| Command relayed from other overlay
|-
|-
| OV=8 : 72, (3675), (3320), 55
| OV=2 : 65, (22010), [4/INIT]
| Continue reading msgs (after Net reply)  
| DOS command (from SYSOP Menu)
|-
|-
| ---- : 57, [3/OVL]
| colspan="2" | <strong>√bbs.ovl</strong>
| Logoff
|-
|-
| ---- : 74, [3/INIT]
| OV=1 : 60, (13160), 80
| Back to Answer SYSOP Feedback prompt
| Command relayed from other overlay
|-
|-
| <strong>√bbs.xfer</strong>
| OV=2 : 70, (28005), (25005), (25100)
: IF M3=0 THEN [10/INIT]
: IF M3=1 THEN [7/NW1]
|
|
Purge old mail 
Validate disks 
Update download accesses 
Continue midnight routine in INIT or 
Continue with Network midnight routines
|-
| OV=3 : 80, (19010), [1/INIT]
| Logoff
|-
| colspan="2" | <strong>√bbs.nw1</strong>
|-
|-
| OV=1 : 60, (13160), [3/OVL]  
| OV=1 : 60, (14005), [3/MSGS]
| Command relayed from other overlay
| Post Network Msg (from main BBS prompt)
|-
|-
|OV=2 : 65, (22010), [4/INIT]  
| OV=2 : 40, (14005), [6/INIT]
| DOS command (from SYSOP Menu)  
| Post Net Msg (from Net Menu)
|-
|-
| <strong>√bbs.ovl </strong>
| OV=3 : 50, (12010), (12220), [6/INIT]
| Regen Net index (from Net Menu)
|-
| OV=4 : 35
| Illegal OV number (not used in v8.0+)
|-
| OV=5 : 67, (1110), (8010), (40000)
: if carrier lock then [7/NW2]
: if OK then (8010),(7520), [13/INIT]
|
|
Outgoing Net Send 
Update LOCK status 
Post-outgoing routines
|-
| OV=6 : 13110
| Node login
|-
| OV=7 : 85, (12010), (12220), [8/NW2]
| Regen Net index (midnight routine)
|-
| OV=8 : 35
| See OV=4
|-
| OV=9 : 35
| See OV=4
|-
| OV=10 : 35
| See OV=4
|-
| OV=11 : 30, (14490), [12/INIT]
| New billing entry (during application)
|-
| OV=12 : 35
| See OV=4
|-
| OV=13 : 15, (7010), [7/MSGS]
| Private net reply (during e-mail reading)
|-
| OV=14 : 20, (7010), [8/MSGS]
| Private net reply (during public msgs)
|-
| OV=15 : 66, (12010), (12220), [11/INIT]
| Regen Net index (startup)
|-
| OV=16 : 74, (8010), [13/INIT]
| Continue outgoing after CARRIER LOCK
|-
| OV=17 : 35
| See OV=4
|-
| OV=18 : 77, (40000), 72
| Continue outgoing after Verify Net Mail
|-
| colspan="2" | <strong>√bbs.nw2</strong>
|-
| OV=1 : 70, <ON I-40 GOSUB 3010,4010>, [3/MSGS]
| Relay from other overlay
|-
|-
| OV=1 : 60, (13160), 80
| OV=2 : 25, (3010), [6/INIT]
| Command relayed from other overlay
| Net Maintenance Menu
|-
|-
| <ul style="list-style: none;">
| OV=3 : 30
<li>OV=2 : 70, (28005), <i>or</i> </li>
| Illegal OV number
<li>(25005), <i>or </i></li>
<li>(25100), <i>AND</i></li>
<li>  -  </li>
<li>IF M3=0 THEN [10/INIT] <i>or </i></li>
<li>IF M3=1 THEN [7/NW1]</li></ul>
|<ul style="list-style: none;">
<li>Purge old mail </li>
<li>Validate disks </li>
<li>Update download accesses </li>
<li>  -  </li>
<li>Continue midnight routine in INIT <i>or</i></li>
<li>Continue with Network midnight routines</li> </ul>
|-
|-
| OV=3 : 80, (19010), [1/INIT]  
| OV=4 : 35, (7010), (7500), [6/INIT]
| Logoff
| Set window/speaker (from Net Menu)
|-
|-
| OV=1 : 60, (13160), [3/OVL]  
| OV=5 : 40, (11750), (18520), (18600), [15/NW1]
| Command relayed from other overlay
| System start-up routine
Note: The included √bbs.ov2 overlay jumps directly to the Mod Menu without going through 13160 first
|-
|-
| <strong>√bbs.nw1 </strong>
| OV=6 : 50, (5001), [6/INIT]
|
| Send default net message (from Net Menu)
|-
|-
| OV=1 : 60, (14005), [3/MSGS]  
| OV=7 : 55, (6050), (6220), [16/NW1]
| Post Network Msg (from main BBS prompt)
| Update after CARRIER LOCK
|-
|-
| OV=2 : 40, (14005), [6/INIT]  
| OV=8 : 22, (21120), [10/INIT]
| Post Net Msg (from Net Menu)
| Midnight routine; create √node x users
|-
|-
| OV=3 : 50, (12010), (12220), [6/INIT]  
| OV=9 : 27, (6290), (6600), [13/INIT]
| Regen. Net index (from Net Menu)
| New node application
|-
|-
| OV=4 : 35
| OV=10 : 23, (4010), [6/INIT]
| Illegal OV number.  No longer used in version 8.0
| Release public net msgs (from Net Menu)
|-
|-
| OV=5 : 67, (1110), (8010), (40000)
| OV=11 : 30
:: if there was a carrier lock then [7/NW2]
| See OV=3
:: if OK then (8010),(7520), [13/INIT]
| Outgoing Net Send
:: Update LOCK status
:: Post-outgoing routines
|-
|-
| OV=6 : 13110
| OV=12 : 37, (6300), (6800), [18/NW1]
| Node login
| Post-application to remote node
|-
|-
| OV=7 : 85, (12010), (12220), [8/NW2]  
| OV=13 : 47, (1110), [18/NW1]
| Regen Net index (midnight routine)
| For use by Verify Net Mail mod
|-
|-
| OV=8 : 35
| OV=14 : 65, (35440), (8100), [13/INIT]
| See OV=4
| Distribute incoming Net data
|}
 
=== Sysop Menu Branching ===
The table below shows where each menu command branches, by overlay.
 
{| class="wikitable"
|-
|-
| OV=9 : 35
|+ Menu Branch Destinations
| See OV=4
! Key
! Line (+function, if applicable)
! Destination
|-
|-
| OV=10 : 35
| colspan="3" | <strong>SYSOP MENU - √bbs.init overlay<br>Routines begin at line 12510</strong>
| See OV=4
|-
|-
| OV=11 : 30, (14490), [12/INIT]
| F1
| New billing entry (during application)  
| 12100
| Logon (Local Mode)
|-
|-
| OV=12 : 35
| F2
| See OV=4
| 12615
| Load BBS term; if not found, return to 12010
|-
|-
| OV=13 : 15, (7010), [7/MSGS]
| F3
| Private net reply (during e-mail reading)
| 12635, (8100), 12010
| View Caller Log
|-
|-
| OV=14 : 20, (7010), [8/MSGS]
| F4
| Private net reply (during public msgs)
| 12610
: if M3=0 then (12865)
: if M3=1 then (12800), 12010
| Set Date & Time, or go to Net Menu
|-
|-
| OV=15 : 66, (12010), (12220), [11/INIT]
| F5
| Regen Net index (start up)
| 12630, (12710), 12010
| Read Feedback to Sysop
|-
|-
| OV=16 : 74, (8010), [13/INIT]
| F6
| Continue outgoing after CARRIER LOCK
| 12620, (20010), 12010
| Password Maintenance
|-
|-
| OV=17 : 35
| F7
| See OV=4
| 12625, [3/XFER]
| DOS Wedge
|-
|-
| OV=18 : 77, (40000), 72
| F8
| Continue outgoing after Verify Net Mail
| 12640, 9999
| Shut BBS down
|-
|-
| <strong>√bbs.nw2 </strong>
| colspan="3" | <strong>NETWORK MENU - √bbs.init overlay<br>Routines begin at line 12800</strong>
|
|-
| F1
| 12865, (24005), 11920
| Set Date & Time
|-
| F2
| 12850, [4/NW2]
| Set Net window/speaker
|-
| F3
| 12835, [2/NW2]
| Net Maintenance Menu
|-
|-
| OV=1 : 70, <ON I-40 GOSUB 3010,4010>, [3/MSGS]  
| F4
| Relay from other overlay
| 12855, [6/NW2]
| Default Net message multi-send
|-
|-
| OV=2 : 25, (3010), [6/INIT]  
| F5
| Net Maintenance Menu
| 12840, [10/NW2]
| Release public Net messages holding
|-
|-
| OV=3 : 30
| F6
| Illegal OV number.  No longer used in version 8.0
| 12860, [3/NW1]
| Regenerate Network index
|-
|-
| OV=4 : 35, (7010), (7500), [6/INIT]  
| F7
| Set window/speaker (from Net Menu)
| 12845, [2/NW1]
| Post Network Message
|-
|-
| OV=5 : 40, (11750), (18520), (18600), [15/NW1]
| F8
| System start up routine
|
| Return to WFC
|-
|-
| OV=6 : 50, (5001), [6/INIT]
| colspan="3" | <strong>NETWORK MAINT MENU - √bbs.nw2 overlay<br>Routines begin at line 3010</strong>
| Send default net message (from Net Menu)
|-
|-
| OV=7 : 55, (6050), (6220), [16/NW1]
| 1
| Update after CARRIER LOCK
| 3080
| Billing List/Print
|-
|-
| OV=8 : 22, (21120), [10/INIT]
| 2
| Midnight routine; create .node x users
| 3160
| Billing Edit
|-
|-
| OV=9 : 27, (6290), (6600), [13/INIT]
| 3
| New node application
| 3300
| Billing Report Generator
|-
|-
| OV=10 : 23, (4010), [6/INIT]
| 4
| Release public net msgs (from Net Menu)
| 3450
| Billing Total Accounts
|-
|-
| OV=11 : 30
| 5
| See OV=3
| 6010
| Node Status Report
|-
|-
| OV=12 : 37, (6300), (6800), [18/NW1]
| 6
| Post-application to remote node
| 7110
| Node Account File Edit
|-
|-
| OV=13 : 47, (1110), [18/NW1]
| 7
| For use by Verify Net Mail mod
| 7600
| Attach File
|-
|-
| OV=14 : 65, (35440), (8100), [13/INIT]
| 8
| Distribute incoming Net data
| 3072
| Read Send Log
|-
| 9
| 3073
| Read Receive Log
|}
|}


=== Midnight Routines ===
The midnight maintenance routines begin in the √bbs.init overlay and continue through several other overlays. The table below maps this process.


{| class="wikitable"
|-
|+ Midnight Maintenance Routine Paths (√bbs.init)
! Line Command
! Branch and Functional Area
|-
| INIT : (26210), [2/OVL]
| Call to 26210 resets time limits
|-
| 2/OVL : 70, (28005), (25005), (25100),
: if M3=0 then [10/INIT]
: else if M3=1 then [7/NW1]
| Calls to:
* 28005 - purge old mail
* 25005 - validate disks
* 25100 - update download access count
|-
| 7/NW1 : 85, (12010), (12220), [8/NW2]
| Calls to:
* 12010 - regenerate Network index
* 12220 - count public Net messages holding
|-
| 8/NW2 : 22, (21120), [10/INIT]
| Call to 21120 creates √node x users
|-
| 10/INIT : 65, (12092)
| Call to 12092 ends the midnight routine and returns to WFC
|}


Next section: [[absolute day numbers|Absolute Day Numbers (ADN)]]
Next section: [[absolute day numbers|Absolute Day Numbers (ADN)]]


[[programming features|Programming Features]]
[[programming features|Programming Features]]

Latest revision as of 18:50, 6 March 2026

Programming Features - Command Branch Tables

Branch Tables

Command Branches

The table below cross-references the main prompt command keys, their internal command numbers, and where they branch.

When a user presses a key at the main prompt, Color 64 does not immediately jump to a routine based on the key itself. Instead, it performs a lookup:

  • The pressed key is first converted to its ASCII value.
  • The program searches the array CM%(I,1), which stores the ASCII value for each defined command key.
  • When a match is found, the corresponding array position becomes the command number in I.
  • The caller's access level is then checked against CM%(I,2), which stores the required level for that command.
  • If the key is valid and the caller has access, the value in I is then used by the branch tables beginning at line 13160.

In the table below, the value shown under No. is the command number ultimately stored in I.

Command Pre-Assignments
Key No. Key No.
@ 1 N 22
P 2 X 23
S 3 T 24
$ 4 L 25
D 5 + 26
# 6 Z 27
U 7 <blank> 29
! 8 1 30
F 9 2 31
C 10 3 32
A 11 * 33
O 12 5 34
G 13 6 35
H 14 7 36
W 15 8 37
M 16 9 38
I 17 % 39
E 18 = 40
19 & 41
> 20 - 42
< 21

For commands that are in the currently loaded overlay, there are ON GOTO statements to load a special "mini routine" specific to that command which exists in the line ranges 13200 to 13480 of the overlays. That mini-routine normally performs a GOSUB to the actual command routine, then does a GOTO 13100 to return to the main prompt.

This extra step exists because some command routines are also called from other places, such as the SYSOP menu. In those cases, the routine must perform its work without always forcing a return to the main prompt. The mini-routine provides a standard entry path for main-prompt commands while still allowing the underlying routine to be reused elsewhere.

The line numbers for these mini-routines are listed in the table below under the heading Mini.

How the ON GOTO branch tables work

The series of ON GOTO statements beginning at line 13160 is easier to understand if you think of it as a two-step dispatcher.

First, line 13160 chooses which group of commands is being handled. The commands are grouped into blocks of ten:

  • 0 to 9
  • 10 to 19
  • 20 to 28
  • 30 to 39
  • 40 to 42

Line 13160 does not jump directly to the final command routine. Instead, it jumps to the correct branch table for that group.

For example:

ON I/10+1 GOTO 13170,13180,13190,13195,13197

If I=7, then I/10+1 evaluates to 1, so BASIC branches to line 13170, which handles commands 0 to 9.

If I=24, then I/10+1 evaluates to 3, so BASIC branches to line 13190, which handles commands 20 to 28.

Once inside the proper group, a second ON GOTO chooses the exact destination within that group. Example:

13170 ON I+1 GOTO 13202,13205,13210,13220,92,92,92,92,96,13260

This line handles command numbers 0 through 9. BASIC uses I+1 because ON GOTO counts from 1, while the command numbers begin at 0.

So, if I=0, BASIC takes item 1 in the list and branches to 13202. If I=1, it takes item 2 and branches to 13205. If I=4, it takes item 5 and branches to 92.

The same idea is used for the later ranges, except the program subtracts an offset so the numbering again starts at 1 for that range:

  • ON I-9 GOTO ... handles 10 to 19
  • ON I-19 GOTO ... handles 20 to 28
  • ON I-29 GOTO ... handles 30 to 39
  • ON I-39 GOTO ... handles 40 to 42

This is why the branch tables can look confusing at first glance. They are not testing the key directly. They are using the command number in I, first to select the correct table, then to select the correct destination within that table.

Example

Using the code below:

13140 FOR I=. TO 42:IF ASC(A$)<>CM%(I,1) NEXT:GOSUB995:@
13145 @I=29 OR LV<CM%(I,2) OR I>39 AND M3=.
13150 #:GOSUB8004
13160 ON I/10+1 GOTO13170,13180,13190,13195,13197
13170 ON I+1 GOTO13202,13205,13210,13220,92,92,92,92,96,13260
13180 ON I-9 GOTO96,96,13290,96,96,96,13330,96,13360,13370
13190 ON I-19 GOTO92,13375,96,92,96,96,96,92,92
13195 ON I-29 GOTO35651,35652,96,98,100,96,96,96,96,96
13197 ON I-39 GOTO102,88,88

If the user presses P:

  • the search finds P in the command array
  • I becomes 2
  • line 13160 branches to 13170 because command 2 is in the 0 to 9 range
  • line 13170 evaluates ON I+1, which becomes ON 3
  • BASIC takes the 3rd item in that list, which is 13210

That is the mini-routine for the [P]ost a Public Message command.

If the user presses 3:

  • I=32
  • line 13160 branches to 13195
  • line 13195 evaluates ON I-29, which becomes ON 3
  • BASIC takes the 3rd item in the list, which is 96

Line 96 is an overlay loader, so command 32 is not handled locally in that overlay and must be relayed elsewhere.

Overlay Cross-Reference

The actual command routines are usually located in various places throughout the overlays. Sometimes an entire command is not fully contained in one overlay. For example, the [A]lter Password command must eventually branch to √bbs.init to change the password. In the table below, the overlay listed is the first overlay branched to. For the Alter Password command, that first destination is √bbs.ovl. The line numbers for the true underlying routines are listed under Actual.

Commands not present in the current overlay are sent to one of the overlay loader lines, which exist at lines 88 to 103. These lines load the overlay in which the command actually resides. The loader line is shown under Load, and the overlay abbreviation is shown under Overlay.

Before loading the new overlay, the variable OV is set so that the newly loaded overlay knows where to branch once loaded. Usually this is set to 1 automatically when the standard loader lines are used, because most overlays reserve OV=1 for a command relayed from another overlay.

Once the new overlay is loaded, the value in I is used again by the branch tables beginning at line 13160. In this way, the command number is preserved even though the command has been handed off to another overlay.

Sometimes the OV setting is not 1. This usually occurs in overlays that do not have a normal main prompt of their own, such as √bbs.init. In those cases, the loader must set a different OV value so the receiving overlay enters the correct routine.

OV Settings Cross Reference
Key No. Mini Actual Overlay Load OV Function
R 0 13202 3005 MSGS 90 1 Read Public Messages
@ 1 13205 3710 MSGS 90 1 Post Office
P 2 13210 1260 MSGS 90 1 Post a Public Message
S 3 13220 4005 MSGS 90 1 Scratch a Public Message
$ 4 13230 405 XFER 92 1 View Download Directory
D 5 13240 16505 XFER 92 1 Download File(s)
# 6 13245 16110 XFER 92 1 Choose a Download Directory
U 7 13250 16300 XFER 92 1 Upload a File
! 8 13255 27005 OVL 96 1 Edit User Stats
F 9 13260 7010 MSGS 90 1 Feedback to Sysop
C 10 13270 15002 OVL 96 1 Chat with the Sysop
A 11 13280 13735 OVL 96 1 Alter Password
O 12 13290 19010 OVL 96 1 Log off System
G 13 13295 13910 OVL 96 1 Select Graphics/ASCII/ANSI
H 14 13300 17015 OVL 96 1 View Help Files
W 15 13310 13310 OVL 96 1 View Welcome Files
M 16 13330 19510 MSGS 90 1 View Membership List
I 17 13350 13350 OVL 96 1 View Information File
E 18 13360 5010 MSGS 90 1 Edit a Public Message
. 19 13370 24005 INIT 95 2 Set Date & Time
> 20 13372 22010 XFER 92 1 DOS Wedge
< 21 13375 20010 INIT 95 7 Password Maintenance
N 22 13377 15505 OVL 96 1 New Downloads
X 23 13380 13810 XFER 92 1 Scratch a Download
T 24 13385 17010 XFER 96 1 Text Files Area
L 25 13380 8110 OVL 96 1 View Caller Log
+ 26 13400 35020 OVL 96 1 Multi-Upload
Z 27 13410 13710 XFER 92 1 Edit Download Description
Y 28 13420 14010 XFER 92 1 Release a Download
1 30 13430 14310 MSGS 90 1 Spare Command 1 (8.1a Games)
2 31 13440 13440 XFER 92 1 Spare Command 2 (8.1a User Profile)
3 32 13450 13450 OVL 96 1 Spare Command 3
* 33 13455 2000 OV2 98 1 Spare Command 4 (Mod Menu)
5 34 13460 OV3 100 1 Spare Command 5
6 35 13465 13465 OVL 96 1 Spare Command 6
7 36 13470 13470 OVL 96 1 Spare Command 7
8 37 13475 13475 OVL 96 1 Spare Command 8
9 38 13480 13480 OVL 96 1 Spare Command 9
% 39 13425 16050 OVL 96 1 Select Transfer Protocol
= 40 14005 NW1 102 1 Network Post
& 41 34010 NW2 88 1 Network Maintenance Menu
- 42 9010 NW2 88 1 Release Network Messages
? -- 13010 All Main BBS Menu

The Overlay Loader Lines

The table below defines the standard main overlay loader lines. Some of these lines are not present in every overlay because they may not be needed.

Standard Main Overlay Loader Lines
Line Overlay Line Overlay
89 √bbs.nw2 97 √bbs.ovl
91 √bbs.msgs 99 √bbs.ov2
93 √bbs.xfer 101 √bbs.ov3
95 √bbs.init 103 √bbs.nw1
35651 √bbs.games 35652 √bbs.profile

In overlays that have a main prompt, there is usually a line immediately before each loader line that sets OV=1. For example, to set OV=1 and load the √bbs.msgs overlay, use GOTO 90, which is one line before 91.

Individual Overlay Branching

The following sections describe how each overlay behaves depending on the setting of OV when the overlay is loaded. The path of GOTOs, GOSUBs, and overlay jumps is listed in a shorthand format.

Example path from √bbs.nw1:

OV=3 : 50, (12010), (12220), [6/INIT]
This regenerates the Net index from the Net Menu

In this notation:

  • Plain line numbers, such as 50, indicate a GOTO.
  • Line numbers in parentheses indicate a GOSUB.
  • A jump to another overlay is shown as [N/XXXX], where N is the new value of OV and XXXX is the destination overlay.

Using the example above, the actual flow would be:

5 GOTO 50
Line 5 is always the first branch point, where the overlay performs its ON OV GOTO dispatch.
50 GOSUB 12010:GOSUB 12220:OV=6:GOTO 95
Line 95 is the standard INIT loader.

In some cases this shorthand is slightly simplified from the exact code, but it provides a reliable map of the actual control flow.

The "OV" Settings for Overlays

The table below shows the paths for all defined settings of OV in the various overlays.

Path for OV Settings in Overlays
Line Command Setting
√bbs.init
OV=1 : 40, (19044), 30 Post-logoff procedures
OV=2 : 50, (12865), [3/MSGS] Set Date & Time (from main BBS prompt)
OV=3 : 60, (12760), 30 Back to Answer Feedback prompt (from √bbs.msgs)
OV=4 : 30, (12010), [2/MSGS] Wait-For-Call screen
OV=5 : 9999 Save msg index, variables, end program
OV=6 : 70, (12800), 30 Network Menu
OV=7 : 75, (20010), [3/MSGS] Password Maint (from main BBS prompt)
OV=8 : 80, (2710), [4/MSGS] Validate by E-mail
OV=9 : 78, (13735), [3/MSGS] Set new password (relayed from √bbs.ovl)
OV=10 : 65, (12092), [2/MSGS] End of midnight routine (back to WFC)
OV=11 : 35, (11905), 30 Reset √level x files
OV=12 : 85, (18240), [2/MSGS] Return to application routine (from NW1)
OV=13 : 33, (29010), 30 Return to WFC after new node applied
OV=14 : 79, (13735) Save User Profile from √bbs.profile
√bbs.msgs
OV=1 : 60, (13160), 57 Command relayed from other overlay
OV=2 : 50, <read √welcome2>, (13523), (8510), (9005), 55 Welcome msgs
OV=3 : 55, (13100), 57 Main BBS prompt
OV=4 : 70, (1410), <ON VX GOTO 71,72,55,74> General msg editor prompt
OV=5 : 65, (12822), [3/INIT] Answer SYSOP feedback
OV=6 : 80, (7020), 55 Feedback to SYSOP
OV=7 : 71, (9048), 55 Continue reading mail (after replying Net mail)
OV=8 : 72, (3675), (3320), 55 Continue reading msgs (after Net reply)
---- : 57, [3/OVL] Logoff
---- : 74, [3/INIT] Back to Answer SYSOP Feedback prompt
√bbs.xfer
OV=1 : 60, (13160), [3/OVL] Command relayed from other overlay
OV=2 : 65, (22010), [4/INIT] DOS command (from SYSOP Menu)
√bbs.ovl
OV=1 : 60, (13160), 80 Command relayed from other overlay
OV=2 : 70, (28005), (25005), (25100)
IF M3=0 THEN [10/INIT]
IF M3=1 THEN [7/NW1]

Purge old mail Validate disks Update download accesses

Continue midnight routine in INIT or Continue with Network midnight routines

OV=3 : 80, (19010), [1/INIT] Logoff
√bbs.nw1
OV=1 : 60, (14005), [3/MSGS] Post Network Msg (from main BBS prompt)
OV=2 : 40, (14005), [6/INIT] Post Net Msg (from Net Menu)
OV=3 : 50, (12010), (12220), [6/INIT] Regen Net index (from Net Menu)
OV=4 : 35 Illegal OV number (not used in v8.0+)
OV=5 : 67, (1110), (8010), (40000)
if carrier lock then [7/NW2]
if OK then (8010),(7520), [13/INIT]

Outgoing Net Send Update LOCK status Post-outgoing routines

OV=6 : 13110 Node login
OV=7 : 85, (12010), (12220), [8/NW2] Regen Net index (midnight routine)
OV=8 : 35 See OV=4
OV=9 : 35 See OV=4
OV=10 : 35 See OV=4
OV=11 : 30, (14490), [12/INIT] New billing entry (during application)
OV=12 : 35 See OV=4
OV=13 : 15, (7010), [7/MSGS] Private net reply (during e-mail reading)
OV=14 : 20, (7010), [8/MSGS] Private net reply (during public msgs)
OV=15 : 66, (12010), (12220), [11/INIT] Regen Net index (startup)
OV=16 : 74, (8010), [13/INIT] Continue outgoing after CARRIER LOCK
OV=17 : 35 See OV=4
OV=18 : 77, (40000), 72 Continue outgoing after Verify Net Mail
√bbs.nw2
OV=1 : 70, <ON I-40 GOSUB 3010,4010>, [3/MSGS] Relay from other overlay
OV=2 : 25, (3010), [6/INIT] Net Maintenance Menu
OV=3 : 30 Illegal OV number
OV=4 : 35, (7010), (7500), [6/INIT] Set window/speaker (from Net Menu)
OV=5 : 40, (11750), (18520), (18600), [15/NW1] System start-up routine
OV=6 : 50, (5001), [6/INIT] Send default net message (from Net Menu)
OV=7 : 55, (6050), (6220), [16/NW1] Update after CARRIER LOCK
OV=8 : 22, (21120), [10/INIT] Midnight routine; create √node x users
OV=9 : 27, (6290), (6600), [13/INIT] New node application
OV=10 : 23, (4010), [6/INIT] Release public net msgs (from Net Menu)
OV=11 : 30 See OV=3
OV=12 : 37, (6300), (6800), [18/NW1] Post-application to remote node
OV=13 : 47, (1110), [18/NW1] For use by Verify Net Mail mod
OV=14 : 65, (35440), (8100), [13/INIT] Distribute incoming Net data

Sysop Menu Branching

The table below shows where each menu command branches, by overlay.

Menu Branch Destinations
Key Line (+function, if applicable) Destination
SYSOP MENU - √bbs.init overlay
Routines begin at line 12510
F1 12100 Logon (Local Mode)
F2 12615 Load BBS term; if not found, return to 12010
F3 12635, (8100), 12010 View Caller Log
F4 12610
if M3=0 then (12865)
if M3=1 then (12800), 12010
Set Date & Time, or go to Net Menu
F5 12630, (12710), 12010 Read Feedback to Sysop
F6 12620, (20010), 12010 Password Maintenance
F7 12625, [3/XFER] DOS Wedge
F8 12640, 9999 Shut BBS down
NETWORK MENU - √bbs.init overlay
Routines begin at line 12800
F1 12865, (24005), 11920 Set Date & Time
F2 12850, [4/NW2] Set Net window/speaker
F3 12835, [2/NW2] Net Maintenance Menu
F4 12855, [6/NW2] Default Net message multi-send
F5 12840, [10/NW2] Release public Net messages holding
F6 12860, [3/NW1] Regenerate Network index
F7 12845, [2/NW1] Post Network Message
F8 Return to WFC
NETWORK MAINT MENU - √bbs.nw2 overlay
Routines begin at line 3010
1 3080 Billing List/Print
2 3160 Billing Edit
3 3300 Billing Report Generator
4 3450 Billing Total Accounts
5 6010 Node Status Report
6 7110 Node Account File Edit
7 7600 Attach File
8 3072 Read Send Log
9 3073 Read Receive Log

Midnight Routines

The midnight maintenance routines begin in the √bbs.init overlay and continue through several other overlays. The table below maps this process.

Midnight Maintenance Routine Paths (√bbs.init)
Line Command Branch and Functional Area
INIT : (26210), [2/OVL] Call to 26210 resets time limits
2/OVL : 70, (28005), (25005), (25100),
if M3=0 then [10/INIT]
else if M3=1 then [7/NW1]
Calls to:
  • 28005 - purge old mail
  • 25005 - validate disks
  • 25100 - update download access count
7/NW1 : 85, (12010), (12220), [8/NW2] Calls to:
  • 12010 - regenerate Network index
  • 12220 - count public Net messages holding
8/NW2 : 22, (21120), [10/INIT] Call to 21120 creates √node x users
10/INIT : 65, (12092) Call to 12092 ends the midnight routine and returns to WFC

Next section: Absolute Day Numbers (ADN)

Programming Features