Branch tables

From Color 64 BBS Wiki

Programming Features - Command Branch Tables

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 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.

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.

Command Pre-Assignments
Key Value of "I" Key Value of "I"
@ 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, 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.

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.

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.

Before loading the appropriate overlay, the variable OV is set so that the new overlay will know where to branch to once loaded. Usually 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 it. Once 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:

OV Settings Cross Reference
Key No. Mini Actual Overlay Load OV Function
R 0 13202 3005 MSGS 90 1 Read Public Messages
Q 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
+ 25 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 in all the overlays 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

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 GOTO 90 (one line before 91).


Individual Overlay Branching

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]
This will regenerate Net index (from Net Menu)

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 goto50
Line 5 is always first, where it does an ON OV GOTO
50 gosub12010:gosub12220:ov=6:goto95  
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.


The "OV" Settings for Overlays

The table below depicts the paths for all 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), or
  • (25005), or
  • (25100), AND
  • -
  • IF M3=0 THEN [10/INIT] or
  • 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
OV=1 : 60, (13160), [3/OVL] Command relayed from other overlay

Note: The included √bbs.ov2 overlay jumps directly to the Mod Menu without going through 13160 first

√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. No longer used in version 8.0
OV=5 : 67, (1110), (8010), (40000)
if there was a 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 (start up)
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. No longer used in version 8.0
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 depicts where each of the menu commands branch to, dependent on 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 span several other overlays. The table below depicts these routines:

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 -purges old mail
  • 25005 -validates disks
  • 25100 -updates download access count
7/NW1 : 85, (12010),(12220), [8/NW2] Calls to
  • 12010 -regenerate Network Index
  • 12220 -count public net msgs holding
8/NW2 : 22, (21120), [10/INIT] Call to 21120 create √node x users
10/INIT : 65, (12092) Call to 12092 end of midnight routine; return to WFC

Next section: Absolute Day Numbers (ADN)

Programming Features