PROGRAM DOCUMENTATION / Source Code – ONGOING UPDATES

SSBBv1 Link to Source Code

Below is a brief description of each subroutine or data area in the program:

Line # Subroutine Var OR REM Description
1 REM SSBB FOR TS 2068 Main program start and loop.  Calls initialization routines for variables and data.  Main game play loop. Displays end of game message.

Calls : gosub 9700 (initial program splash initialize variables, main menu ) UDOUT – update outs gosub 1000 half inning play GOSUB 2030 –  update all parts of the screen

Updates : HV- batter team indicator (1) home (2) visitor HVP- pitching team indicator (1) home (2) visitor ING – inning counter

100 DICE generates a dice roll from 10-39, based on three dice with the following faces :

Die X: 1, 2, 2, 3, 3, 3 Die Y: 0, 0 ,1 ,2 ,3 ,4 Die Z: 0, 1, 2, 3, 4, 5

Uses: arrays X(6), Y(6) and Z(6)

Updates: ROLL – holds value of dice roll 10-39

110 UDBASE Displays which bases are occupied by changing color of the base, also prints the name of each player on each base.

Uses: R() – bases occupied – player index

Calls: GTNAME – player name returned in N$

130 ADD1 Adds one to the the teams score Called from many places when a runner scores

Uses: HV = (1) home (2) visitor ING=inning #

Updates: S(HV, Ing)

135 GTNAME Looks up from data statements, PLAYER name and player ratings at positions, bunting and running.

Use GTPNAME for pitchers

Uses: PNUM – player index 9000+PNUM is location of player data

Returns: N$ – player name H$(1) – player rating data

140 UDSCORE Updates the line score portion of the screen (top) with inning by inning score and total score.

Uses: S(HV, ING) score array ING – current inning

160 UDHV Called at the end of each half inning to change HV to  update the H and V on the Line score at top of screen. Team at bat is in reverse colors

Uses: HV – (1) home team, (2) visitor

165 UDOUT Displays the number of outs in the line score (top) portion of the screen, and is called each time an out is made from batter or pitcher outcome.

Uses: OUTS – outs counter

170 DSPMSG Displays messages in bottom portion of the screen, screen lines 13-21, message stored in M$, typically this is results of plays or warning messages if a menu option and be completed, i.e. no runner on first and users selects to steal second. Clears message area before printing new message.

Uses: M$ – message text, may incluse F$ (new line) “text” + F$ + “line 2” Z$ – string of 32 spaces

180 GTPNAME Looks up from data statements, player name and player ratings at positions, bunting and running. Use GTPNAME for pitchersUses: PNUM – player index 9000+pnum is location of player data Returns name in N$ H$(1)  – player ratings data
200 STL2 Steal of second base, checks that stealing second is valid based on runners on base, does a dice roll, pulls appropriate data from steal second chart based on speed rating of runner, pulls play result from table data.  Calls subroutine based on play result R$ to handle play.

Calls: GTNAME to get player run rating in H$(1,2) DICE to get dice roll result in ROLL RESTORE 9260+RUN RATING IN H$(1,2) GOSUB 300 – play result “X” OR “P” GOSUB 305 – play result ” ” OR “=” GOSUB BALK – play reslutl “B” DSPMSG – display warning or outcome of steal attemp Updates : BASE – base +1 of base attempting to steal to be passed to play result subroutine listed above in

Updates : BASE – base +1 of base attempting to steal to be passed to play result subroutine listed above in Calls

230 STL3 Steal of third base, operates same as STL2 except with value of BASE – see STL2
250 STLH Steal of third base, operates same as STL2 except with value of BASE see STL2
300 REM STLX Runner out in attempting to steal base

Called by : STL2, STL3, STLH

Calls: UDBASE – update display runners on base UDOUT – update display of outs on scoreboard

Uses : BASE – base +1 of base being stolen

Updates : OUTS – number of outs R() – runners on base M$ – message for result of play

305 REM STEAL SAFE Runner safe in attempting to steal base

Called by : STL2, STL3, STLH

Calls: ADD1 – if stealing home to add one to score UDBASE – update display runners on base UDOUT – update display of outs on scoreboard UDSCORE – update display of score

Updates : R() – moves runners to new base, determined by BASE variable M$ – message set for runner is safe S(HV, ING) – update score for this team, inning

330 BALK Pitcher Balk result of play

Called by : STL2, STL3, STLH

Calls: ADD1 – if stealing home to add one to score UDBASE – update display runners on base UDOUT – update display of outs on scoreboard UDSCORE – update display of score

Updates : R() – moves runners to new base, determined by BASE variable M$ – message set for runner is safe S(HV, ING) – update score for this team, inning

1000 REM play Loop for playing a half inning.

Has menu options for batter/pitcher.

Called by :

Main loop

Calls:

GOSUB 3000 – Lineup changes

GOSUB 2000 – One at bat

GOSUB 3200 – Pitcher changes

GOSUB 6000 – Display menu

GOSUB 4000- BUNT

STL2, STL3, STLH – Stealing bases

DSPMSG – Display message

GOSUB 8060 – Display batter name

GOSUB 8070 – Display pitcher name

Updates :

B(HV) – 1-9 which spot in order is at bat

1100 REM TEMP SWAP HV Temporarily swaps the value of HV to the team that is in the field, so that the roster change subroutine can be run.

Called By:  GO SUB 1000 (Rem Play)

Updates: HV

2000 REM PITCH BAT Executes on batting play, first a roll of the dice and checking the pitching card, if there is an play outcome it is processed, if the result is “ “ then a second roll and then process the outcome from the batter card.

Calls: DICE GO SUB 4500 GO SUB 8100 UDOUT – update display of outs on screen UDBASE – update players on base on the screen UDHV – update the display of home and visitor on screen UDSCORE – update score on screen

3000 REM LINE UP Displays the player roster for the team indicated by HV (1) home, (2) visitor, allows the change of roster and/or positions.  This allows for pinch hitting and pitch running.

CALLS: CKPOS – returns the defensive rating for a player at a given position

3100 REM NO SWAP When a player swap is not confirmed this will restore the screen to the pre selection state.
3200 REM PITCHER SELECTION Provides the ability to change the pitcher
4000 REM BUNT The main processing for when a sacrifice or suicide squeeze bunt is selected in GO SUB 1000
4200 REM S BUNT Process the “S” outcome for a bunt, moves runners, updates outs and score as needed.
4210 REM F bunt Process the “F” outcome for a bunt, updates outs
4225 REM ver sacbunt Checks to see if a sacrifice bunt is a valid option given the runners on base. Returns OK=1 if valide, 0 otherwise.

Updates : OK

4300 REM 2K Process the 2K “2” outcome for a bunt.
4500 DEF OUT Processes the result for an Automatic out based on teams defensive rating and dice ROLL, if an auto out is determined then R$=”G” if not R$=””
6000 REM MENU Displays help for the menu options in the PLAY screen in GO SUB 1000
7000 REM LINE UP PASS PN Displays the player roster on the screen, for players that are inactive (negative pnum) are displayed in dark color.
7060 REM SWAP BASES This updates the runners on base if a lineup change is for a runner who is on base currently
7100 REM SWAP PLRS Handles the processing needed to execute a player swap as selected in GO SUB 3000.  Updates rosters in array L(HV, ), deactivates players if the game has already started.
7150 REM SWAP PITCH Handles the processing needed to execute a pitcher swap as selected in GO SUB 3000.  Updates rosters in array L(HV, ), deactivates players if the game has already started.
7200 REM SWPOS Handles the processing needed to execute a player change in position as selected in GO SUB 3000.  Updates rosters in array L(HV, ), deactivates players if the game has already started. Updates teams defensive rating in D(HV,)
7300 REM PRINT PITCHER Displays one pitcher on the screen as indicated by the value of PNUM when called.
7400 CKPOS Checks to see that no two players are assigned to the same position, called after a player swap or change position.
7450 PLPOS Checks if a player can play a certain position and returns the defensive rating in DFRAT, DFRAT will be -5 is a player is not rated for a position.
8020 REM PRINT ING SCORES Prints the line score at the top of the screen.  Prints each inning score and total score for both teams
8060 REM NOW BATG Displays the name of the player currently batting in the middle section of the screen. Pulls from L(HB, B(HV))
8070 REM NOW PITCH Displays the name of the pitcher currently in the game for the defensive team,  in the middle section of the screen. Pulls from B(PHV)
8100 REM RSLT OF BATR This is the main processing for a play outcome.  The result of the play from either the Pitching data or the Batter Data is stored in R$.  Processing of outs, scoring, bases etc are handled in this routine and calls to various subroutines to handle specific outcomes.
8400 REM K Handles the play outcome for a strike out when R$=”K”
8405 REM F OUT Handles the play outcome for a flyout R$=”F”
8420 REM BB/HBB Handles the play outcome for a walk (R$=”B”) or a batter hit by pitch (R$=”H”)
8440 REM XCHART Handes the play outcome with R$=”X” – x – chart,  This comes when Pitching card outcome is X and the XCHART is consulted.  Outcomes from X chart are Wild Pitch (W) BALK (L) Passed Ball (Q). Runners on base are updated, along with scoring if appropriate
8500 REM 1 Handles the play outcome for a single R$=”1”, moves runners, updates scores.  Runners advance one base
8510 REM + Handles the play outcome for a special single R$=”+”, moves runners, updates scores.  Runners on 2nd and 3rd score, runner on 1st goes to second based
8520 REM A Handles the play outcome for a special single R$=”A”, moves runners, updates scores.  All Runners advance 2 bases
8530 REM 2 Handles the play outcome for a doublee R$=”2”, moves runners, updates scores.  All runners advance 2 bases
8540 REM 3,4 Handles the play outcome for a triple or homerun R$=”3” or r$=”4”, moves runners, updates scores
8600 REM DP Handles the play outcome for a double play  R$=”P”, moves runners, updates scores.  Provides option for defensive manager under special base running scenarios, (runners on first and third)
8610 REM G Handles the play outcome for a ground out.  There are various possible outcomes based on the number of batters on base.  Matches the ground our force chart from the board game.
8620 REM / Handles the play outcome for  R$=”/”, moves runners, updates scores
8625 REM S Handles the play outcome for a sacrifice fly R$=”S”, moves runners, updates scores
8700 REM DP LOADED Called from GO SOB 8600 (double play) to handle the specific case of double play when bases are loaded.  Allows for defensive manager to choose between two options
8800 REM MDC Subroutine to handle all cases where there is a Manager Decision options to advance runners an extra base with certain batting outcomes, 1D (R$=”D”) 2M – (R$=”M) etc.
8900 REM “ “/E Handles the play outcome for results from manager decision chart (see GO SUB 8800) S$=” ” and S$=”E”, moves runners, updates scores
8915 REM +/= Handles the play outcome for results from manager decision chart (see GO SUB 8800) S$=”+ ” and S$=”=”, moves runners, updates scores
8930 REM * Handles the play outcome for results from manager decision chart (see GO SUB 8800) S$=”* ”, moves runners, updates scores
9000 REM NAMEDATA Data statements for player names and defensive positions and ratings
9100 REM HIT DATA Data statements for player batting outcomes, two strings, vs left handed pitchers and vs right handed pitchers
9200 REM data/lineup Default line ups first 9 numbers or starters and the rest are bench players
9224 REM PITCHERS/TEAM Numbers of the pitchers for each team, first 5 are starting pitchers and the last 4 are relief pitchers
9230 REM sac bunt Data statements for sacrifice bunt 9231 for A rated bunters, 9232 for B rated bunters
9235 REM SUI bunt Data statements for suicide squeeze bunt 9236 for A rated bunters, 9237 for B rated bunters
9239 REM MGR DEC E+=”=” Data statements for the manager’s decision chart.  There six lines, one for each runner rating 0-5, starting with 0 in line 9240
9249 REM STL 2 Data statements for the steal of second chart.  There six lines, one for each runner rating 0-5, starting with 0 in line 9250
9259 REM STL 3 Data statements for the steal of third chart.  There six lines, one for each runner rating 0-5, starting with 0 in line 9260
9269 REM STL HOME Data statements for the steal of home chart.  There six lines, one for each runner rating 0-5, starting with 0 in line 9270
9279 REM XCHART Date statement for pitcher x-chart
9300 REM PITCH NAMES Data statement for Pitcher name data, which hand and starter or relief pitcher
9400 REM PITCH DATA Data statements for Pitcher data for pitching outcomes
9500 REM special char HOME, BASE, CF, RF, LF Data statements that are used to create user defined characters for home plate, bases, CF, LF, RF single characters
9600 REM BASES Prints the bases and labels for the middle section of the play screen.
9700 REM splash This is the main screen that shows as the program initializes, also calls GO SUB 9900 to initialize the program.  After Initialization the main menu to change rosters and pitchers or start game is offered to the users.
9800 REM SCREEN SETUP Displays the top scoreboard portion of the screen.
9900 REM SETUP Initializes the program.  Loads initial rosters, creates user defined characters, and initializes arrays, variables for sub routine names. Etc.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s