the cutting room mirror

ESPN Baseball Tonight (Genesis)

One of the many, many sports games on the Sega Genesis during the '90's.

Source Code#

The game has a significant proportion of uncompiled source code and compiler output hidden inside. Similar text is also found in Doom Troopers.

At 0x14000 in the ROM:

Sierra Systems LINK68  3.00  X.OUT                        2/11/94 10:20 

entry point: 00000200
no relocation info
executable

 START      END     LENGTH    FILE            SECTION   TYPE

00000000  00000007  000008  X.OUT            >(ORG)     T 
00000000  00000007  000008  MAIN.O            (ORG)     T ORG 

00000060  0000008f  000030  X.OUT            >(ORG)     T 
00000060  0000008f  000030  MAIN.O            (ORG)     T ORG 

00000100  00000100  000000  X.OUT            >(ORG)     T 
00000100  00000100  000000  MAIN.O            (ORG)     T ORG 

00000100  000001ff  000100  X.OUT            >(ORG)     T 
00000100  000001ff  000100  MAIN.O            (ORG)     T ORG 

00000200  00000ac3  0008c4  X.OUT            >(ORG)     T 
00000200  00000ac3  0008c4  MAIN.O            (ORG)     T ORG 

00000ac4  0001272b  011c68  X.OUT            >.text     T 
00000ac4  00000baf  0000ec  MAIN.O            .text     T 
00000bb0  000069a7  005df8  WCS.O             .text     T 
000069a8  0000fe73  0094cc  AI.O              .text     T 
0000fe74  00010f2f  0010bc  LOGOS.O           .text     T 
00010f30  0001101f  0000f0  LZWDECOM.O        .text     T 
00011020  0001157f  000560  PPGE_PM.O         .text     T 
00011580  0001159f  000020  PPGE_PMC.O        .text     T 
000115a0  00012437  000e98  PPGE_GD.O         .text     T 
00012438  00012507  0000d0  PPGE_GDC.O        .text     T 
00012508  00012508  000000  GRAPHICS.O        .text     T 
00012508  00012508  000000  FIELD.O           .text     T 
00012508  00012508  000000  STRIPS.O          .text     T 
00012508  00012508  000000  BATTART.O         .text     T 
00012508  00012508  000000  LBATTART.O        .text     T 
00012508  00012508  000000  FIELDART.O        .text     T 
00012508  00012508  000000  FIELDRUN.O        .text     T 
00012508  00012508  000000  FIELDTHR.O        .text     T 
00012508  00012508  000000  FIELDCAT.O        .text     T 
00012508  00012508  000000  RUNNER.O          .text     T 
00012508  0001258b  000084  SOUND.O           .text     T 
0001258c  0001272b  0001a0  STATS.O           .text     T 

00020000  0005ac4b  03ac4c  X.OUT            >sounds    D 
00020000  0005ac4b  03ac4c  GEMS.O            .text     T 
0005ac4c  0005ac4c  000000  GEMS.O            .data     D 
0005ac4c  0005ac4c  000000  GEMS.O            .bss      B (00) 

0005ac4c  0006b3f7  0107ac  X.OUT            >field     D 
0005ac4c  0006b3f7  0107ac  FIELD.O           field     D 

0006b3f8  001dad87  16f990  X.OUT            >graphics  D 
0006b3f8  0006b477  000080  LOGOS.O           graphics  D 
0006b478  00088963  01d4ec  GRAPHICS.O        graphics  D 
00088964  0008fe1b  0074b8  FIELD.O           graphics  D 
0008fe1c  000951bf  0053a4  STRIPS.O          graphics  D 
000951c0  000bb8df  026720  BATTART.O         graphics  D 
000bb8e0  000c4fbf  0096e0  LBATTART.O        graphics  D 
000c4fc0  000e67a7  0217e8  FIELDART.O        graphics  D 
000e67a8  00101297  01aaf0  FIELDRUN.O        graphics  D 
00101298  0012ac7f  0299e8  FIELDTHR.O        graphics  D 
0012ac80  001a1b67  076ee8  FIELDCAT.O        graphics  D 
001a1b68  001dad87  039220  RUNNER.O          graphics  D 

001dad88  001df02b  0042a4  X.OUT            >tables    D 
001dad88  001dad88  000000  MAIN.O            tables    D 
001dad88  001dbabb  000d34  WCS.O             tables    D 
001dbabc  001dc83b  000d80  AI.O              tables    D 
001dc83c  001dcc4b  000410  LOGOS.O           tables    D 
001dcc4c  001dcf4b  000300  PPGE_PM.O         tables    D 
001dcf4c  001dcf4c  000000  PPGE_PMC.O        tables    D 
001dcf4c  001dcf6b  000020  PPGE_GD.O         tables    D 
001dcf6c  001dcf6c  000000  PPGE_GDC.O        tables    D 
001dcf6c  001dcf6c  000000  GRAPHICS.O        tables    D 
001dcf6c  001dcf8b  000020  FIELD.O           tables    D 
001dcf8c  001df02b  0020a0  STATS.O           tables    D 

001df02c  001df02c  000000  X.OUT            >.batt     

001df02c  001f6323  0172f8  X.OUT            >.graphic  D 
001df02c  001f6323  0172f8  LOGOS.O           .graphic  D 

00ff0000  00fff197  00f198  X.OUT            >.data     D 
00ff0000  00ff0000  000000  MAIN.O            .data     D 
00ff0000  00ffce23  00ce24  WCS.O             .data     D 
00ffce24  00ffce24  000000  AI.O              .data     D 
00ffce24  00ffce24  000000  LOGOS.O           .data     D 
00ffce24  00ffce24  000000  LZWDECOM.O        .data     D 
00ffce24  00ffce33  000010  PPGE_PM.O         .data     D 
00ffce34  00ffce34  000000  PPGE_PMC.O        .data     D 
00ffce34  00fff013  0021e0  PPGE_GD.O         .data     D 
00fff014  00fff014  000000  PPGE_GDC.O        .data     D 
00fff014  00fff014  000000  GRAPHICS.O        .data     D 
00fff014  00fff014  000000  FIELD.O           .data     D 
00fff014  00fff014  000000  STRIPS.O          .data     D 
00fff014  00fff014  000000  BATTART.O         .data     D 
00fff014  00fff014  000000  LBATTART.O        .data     D 
00fff014  00fff014  000000  FIELDART.O        .data     D 
00fff014  00fff014  000000  FIELDRUN.O        .data     D 
00fff014  00fff014  000000  FIELDTHR.O        .data     D 
00fff014  00fff014  000000  FIELDCAT.O        .data     D 
00fff014  00fff014  000000  RUNNER.O          .data     D 
00fff014  00fff014  000000  SOUND.O           .data     D 
00fff014  00fff197  000184  STATS.O           .data     D 

00fff198  00fff1b3  00001c  X.OUT            >.bss      B (00) 
00fff198  00fff198  000000  MAIN.O            .bss      B (00) 
00fff198  00fff1b3  00001c  WCS.O             .bss      B (00) 
00fff1b4  00fff1b4  000000  AI.O              .bss      B (00) 
00fff1b4  00fff1b4  000000  LOGOS.O           .bss      B (00) 
00fff1b4  00fff1b4  000000  LZWDECOM.O        .bss      B (00) 
00fff1b4  00fff1b4  000000  PPGE_PM.O         .bss      B (00) 
00fff1b4  00fff1b4  000000  PPGE_PMC.O        .bss      B (00) 
00fff1b4  00fff1b4  000000  PPGE_GD.O         .bss      B (00) 
00fff1b4  00fff1b4  000000  PPGE_GDC.O        .bss      B (00) 
00fff1b4  00fff1b4  000000  GRAPHICS.O        .bss      B (00) 
00fff1b4  00fff1b4  000000  FIELD.O           .bss      B (00) 
00fff1b4  00fff1b4  000000  STRIPS.O          .bss      B (00) 
00fff1b4  00fff1b4  000000  BATTART.O         .bss      B (00) 
00fff1b4  00fff1b4  000000  LBATTART.O        .bss      B (00) 
00fff1b4  00fff1b4  000000  FIELDART.O        .bss      B (00) 
00fff1b4  00fff1b4  000000  FIELDRUN.O        .bss      B (00) 
00fff1b4  00fff1b4  000000  FIELDTHR.O        .bss      B (00) 
00fff1b4  00fff1b4  000000  FIELDCAT.O        .bss      B (00) 
00fff1b4  00fff1b4  000000  RUNNER.O          .bss      B (00) 
00fff1b4  00fff1b4  000000  SOUND.O           .bss      B (00) 
00fff1b4  00fff1b4  000000  STATS.O           .bss      B (00) 

RESERVED SYMBOLS

00fff1b4      heap_org
00000e4c      heap_len
ff1b4  000000  FIELDART.O        .bss      B (00) 
00fff1b4  00fff1b4  000000  FIELDRUN.O        .bss      B (00) 
00fff1b4  00fff1b4  000000  FIELDTHR.O        .bss      B (00) 
00fff1b4  00fff1b4

At 0x18000 in the ROM:

*****************************************************************************
*                                                                           *
*              Project: Sony ESPN Baseball                                  *
*                                                                           *
*               Module: AI.S                                                *
*                                                                           *
* Module Creation Date: March 1993                                          *
*                                                                           *
*               Author: Russell Shanks                                      *
*                                                                           *
*   Development System: Sierra Systems                                      *
*                                                                           *
*****************************************************************************


    include MACROS.I
    Include EQUATES.I
    include sound.inc

*----------------------------------------------------------------------------


*****************************************************************************
* PPGE
*****************************************************************************
    include ppge_var.inc

*----------------------------------------------------------------------------
*
    section tables

    xdef    radar_ytable
    xdef    radar_xtable

InitialLogicTable         ;entity descending order
    dc.l    HaloLogic
    dc.l    FieldXLogic,LookEntityLogic,LookEntityLogic
    dc.l    LookEntityLogic,LookEntityLogic,InitialThirdLogic
    dc.l    InitialSecondLogic,InitialFirstRunLogic
    dc.l    InitialBatterLogic,InitialFielderLogic
    dc.l    InitialFielderLogic,InitialFielderLogic
    dc.l    InitialFielderLogic,InitialFielderLogic
    dc.l    InitialFielderLogic,InitialFielderLogic
    dc.l    InitialCatcherLogic,InitialPitcherLogic

FielderSelectTable
    dc.w    FBaseman_ptr,Fbaseman_ptr,Sbaseman_ptr,Pitcher_ptr
    dc.w    ShortStop_ptr,Tbaseman_ptr,Tbaseman_ptr
    dc.w    Fbaseman_ptr,Sbaseman_ptr,Sbaseman_ptr,ShortStop_ptr
    dc.w    ShortStop_ptr,Tbaseman_ptr,Tbaseman_ptr
    dc.w    RFielder_ptr,RFielder_ptr,RFielder_ptr,CFielder_ptr
    dc.w    LFielder_ptr,LFielder_ptr,LFielder_ptr


FielderRF_tbl
    dc.w    8,6,7,7,8,8,7,7

FielderThrowIS_tbl
    dc.w    3,3,4,4,3,3,4,4     ;only 3 and 4's good here

    dc.b  13,13,13,13,13,13,13,13
    dc.b  13,13,13,13,13,13,13,13
    dc.b  13,13,13,13,13,13,13,13
    dc.b  13,13,13,13,13,13,13,13
    dc.b  13,13,13,13,13,13,13,13
    dc.b  13,13,13,13,13,13,13,13
    dc.b  13,13,13,13,13,13,13,13
*       dc.b  14,15,16,17,18,19,20,21
    dc.b  13,13,13,13,13,13,13,13
ballvscale_table
*       dc.b  22,23,24,26,27,28,29,31
  dc.b  13,13,14,14,15,16,17,18
*       dc.b  32,33,34,36,37,38,39,41
  dc.b  20,21,22,23,25,26,27,29
*       dc.b  42,43,44,45,47,48,49,50
  dc.b  30,31,32,33,35,36,37,38
*       dc.b  52,53,54,55,57,58,59,60
  dc.b  40,41,42,43,45,46,47,48
*       dc.b  62,63,64,65,67,68,69,70
  dc.b  50,51,52,53,54,55,56,57
*       dc.b  71,73,74,75,76,78,79,80
  dc.b  61,63,65,68,71,74,76,78
    dc.b  81,83,84,85,86,88,89,90
    dc.b  91,93,94,95,96,97,99,100
    dc.b  101,102,104,105,106,107,109,110
    dc.b  111,112,114,115,116,117,119,120
    dc.b  121,122,123,125,126,127,128,130
    dc.b  131,132,133,135,136,137,138,140
    dc.b  141,142,143,145,146,147,148,150
    dc.b  151,152,153,154,156,157,158,159
    dc.b  161,162,163,164,166,167,168,169
    dc.b  171,172,173,174,176,177,178,179
    dc.b  180,182,183,184,185,187,188,189
    dc.b  190,192,193,194,195,197,198,199
    dc.b  200,202,203,204,205,206,208,209
    dc.b  210,211,213,214,215,216,218,219
    dc.b  220,221,223,224,225,226,228,229
    dc.b  230,231,232,234,235,236,237,239
    dc.b  240,241,242,244,245,246,247,249
    dc.b  250,251,252,254,255,255


*       dc.b  67,68,69,70,71,72,73,74
   dc.b  31,33,35,37,39,41,43,47
runnervscale_table
*       dc.b  75,76,77,78,79,80,81,82
   dc.b  49,51,53,57,59,61,63,65
*       dc.b  83,84,85,86,87,88,89,90
   dc.b  67,69,71,73,75,77,79,81
*       dc.b  91,92,93,94,95,96,97,98
   dc.b  83,85,87,89,91,93,95,96
*       dc.b   99,100,100,100,100,100,100,100
   dc.b   97,97,98,98,99,99,100,100
    dc.b  100,100,100,100,100,100,100,100
    dc.b  100,100,100,100,100,100,100,100
    dc.b  100,100,100,100,100,100,100,100
    dc.b  100,100,100,100,100,100,100,100
    dc.b  101,102,104,105,106,107,109,110
    dc.b  111,112,114,115,116,117,119,120
    dc.b  121,122,123,125,126,127,128,130
    dc.b  131,132,133,135,136,137,138,140
    dc.b  141,142,143,145,146,147,148,150
    dc.b  151,152,153,154,156,157,158,159
    dc.b  161,162,163,164,166,167,168,169
    dc.b  171,172,173,174,176,177,178,179
    dc.b  180,182,183,184,185,187,188,189
    dc.b  190,192,193,194,195,197,198,199
    dc.b  200,202,203,204,205,206,208,209
    dc.b  210,211,213,214,215,216,218,219
    dc.b  220,221,223,224,225,226,228,229
    dc.b  230,231,232,234,235,236,237,239
    dc.b  240,241,242,244,245,246,247,249
    dc.b  250,251,252,254,255,255



*       dc.b  100,100,100,100,100,100,100,100
*runnervscale_table
*       dc.b  100,100,100,100,100,100,100,100
*       dc.b  100,100,100,100,100,100,100,100
*       dc.b  100,100,100,100,100,100,100,100
*       dc.b  100,100,100,100,100,100,100,100
*       dc.b  100,100,100,100,100,100,100,100
*       dc.b  100,100,100,100,100,100,100,100
*       dc.b  100,100,100,100,100,100,100,100
*       dc.b  100,100,100,100,100,100,100,100
*       dc.b  101,102,104,105,106,107,109,110
*       dc.b  111,112,114,115,116,117,119,120
*       dc.b  121,122,123,125,126,127,128,130
*       dc.b  131,132,133,135,136,137,138,140
*       dc.b  141,142,143,145,146,147,148,150
*       dc.b  151,152,153,154,156,157,158,159
*       dc.b  161,162,163,164,166,167,168,169
*       dc.b  171,172,173,174,176,177,178,179
*       dc.b  180,182,183,184,185,187,188,189
*       dc.b  190,192,193,194,195,197,198,199
*       dc.b  200,202,203,204,205,206,208,209
*       dc.b  210,211,213,214,215,216,218,219
*       dc.b  220,221,223,224,225,226,228,229
*       dc.b  230,231,232,234,235,236,237,239
*       dc.b  240,241,242,244,245,246,247,249
*       dc.b  250,251,252,254,255,255



*       dc.w    #0,#430,#518,#573,#615,#647
    dc.w    #430,#430,#430,#430,#518,#573,#615,#647
walltable
    dc.w    #686,#717,#742,#766,#792,#816,#838,#862  ;16
    dc.w    #878,#893,#913,#924,#925,#925,#925,#925  ;24
    dc.w    #925,#925,#925,#925,#925,#925,#925,#925  ;32
    dc.w    #926,#927,#928,#929,#930,#930,#930,#926  ;40
    dc.w    #922,#918,#914,#910,#906,#902,#898,#894  ;48
    dc.w    #890,#886,#882,#878,#874,#870,#866,#862  ;56
    dc.w    #858,#854,#850,#846,#842,#838,#834,#830  ;64
    dc.w    #826,#822,#818,#814,#810,#806,#802,#798  ;72
    dc.w    #794,#790,#786,#782,#768,#764,#760,#756  ;80
    dc.w    #752,#748,#744,#738,#734,#730,#726,#722  ;88
    dc.w    #718,#714,#710,#706,#704,#700,#696,#692  ;96
    dc.w    #688,#684,#680,#676,#672,#668,#664,#660  ;104
    dc.w    #656,#652,#648,#644,#640,#634,#630,#626  ;112
*       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;40
*       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;48
*       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;56
*       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;64
*       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;72
*       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;80
*       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;88
*       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;96
*       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;104
*       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;112

    dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;120
    dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;128
    dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;136
    dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;144
    dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;152
    dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;160
    dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;168
    dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;176
    dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;184

    dc.b  8,8,8,8,8,8,8,8
To1AndHome
*       dc.b  8,8,8,8,8,8,8,8       ;0-7
    dc.b  9,9,9,9,9,9,9,8       ;15
    dc.b  8,8,8,8,8,7,7,7       ;23
    dc.b  7,7,7,6,6,6,6,6       ;31
    dc.b  6,5,5,5,5,5,5,4       ;39
    dc.b  4,4,4,4,4,3,3,3       ;47
    dc.b  3,3,3,3,2,2,2,2       ;55
    dc.b  2,2,1,1,1,1,1,1       ;63
    dc.b  1,1,1,1,1,1,1,1       ;71
    dc.b  1,1,1,1,1,1,1,1
    dc.b  1,1,1,1,1,1,1,1
    dc.b  1,1,1,1,1,1,1,1
    dc.b  1,1

    dc.b  1,1,1,1,1,1,1,1
    dc.b  1,1,1,1,1,1,1,1
    dc.b  1,1,1,1,1,1,1,1

    dc.b  4,4,4,4,4,4,4,4,4,4
To2And3
    dc.b  4,4,4,4,4,4,4,4,4,4
    dc.b  3,3,3,3,3,3,3,3,3,3
    dc.b  2,2,2,2,2,2,2,2,2,2
    dc.b  1,1,1,1,1,1,1,1,1,1
    dc.b  0,0,0,0,0,0,0,0,0,0

*       dc.b  0,0,0,0,0,0,0,0
*       dc.b  0,0,0,0,0,0,0,0,0
*       dc.b  0,0,0,0,0,0,0,0,0

FielderScaleTable
    dc.b  0,0,0,0,0,0,0,1         ;8
    dc.b  1,1,1,1,1,1,2,2         ;16
    dc.b  2,2,2,2,2,3,3,3         ;32
*       dc.b  3,3,3,3,4,4,4,4         ;40
*       dc.b  4,4,4,5,5,5,5,5         ;48
    dc.b  3,4,4,4,4,5,5,5         ;40
    dc.b  5,5,5,5,5,5,5,5         ;48
    dc.b  5,6,6,6,6,6,6,6         ;56
    dc.b  6,6,6,6,6,6,6,6         ;64
    dc.b  6,6,6,6,6,6,6,6         ;72
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;
    dc.b  6,6,6,6,6,6,6,6         ;184


Pdirectiontable
    dc.b    #0,#128,#0,#128,#192,#160,#224,#224
    dc.b    #64,#96,#32,#64,#64,#64,#64,#64

    dc.b  0,0,0,0,0,0,0,0
    dc.b  0,0,0,0,0,0,0,0
    dc.b  0,0,0,0,0,0,0,0
    dc.b  0,0,0,0,0,0,0,0
    dc.b  0,0,0,0,0,0,0,0
    dc.b  0,0,0,0,0,0,0,0
    dc.b  0,0,0,0,0,0,0,0
    dc.b  1,2,3,4,5,6,7,8               ; -8 - -1
radar_ytable
    dc.b  9,10,11,12,13,14,15,16             ; 0-7
    dc.b  17,18,19,20,21,21,22,23             ; 8-15
    dc.b  23,24,25,25,26,27,27,28             ; 16-23
    dc.b  29,29,30,30,31,31,32,32             ; 24-31
    dc.b  33,33,34,34,34,35,35,35             ; 32-39
    dc.b  36,36,36,37,37,37,38,38             ; 40-47

    dc.b  38,39,39,40,40,41,41,42             ; 48-55
    dc.b  42,43,43,44,44,45,45,46             ; 56-63   Pitcher's mound y=61

    dc.b  46,46,47,47,47,47,48,48             ; 64-71
    dc.b  48,48,48,49,49,49,49,49
    dc.b  49,50,50,50,50,50,50,51
    dc.b  51,51,51,51,51,52,52,52
    dc.b  52,52,52,53,53,53,53,53
    dc.b  53,54,54,54,54,54,54,55
    dc.b  55,55,55,55,55,56,56,56
    dc.b  56,56,56,57,57,57,57,57
    dc.b  57,58,58,58,58,58,58,59
    dc.b  59,59,59,59,60,60,60,60

    dc.b  60,60,61,61,61,61,61,61
    dc.b  62,62,62,62,62,62,63,63
    dc.b  63,63,63,63,64,64,64,64
    dc.b  64,64,65,65,65,65,65,65
    dc.b  66,66,66,66,66,66,67,67
    dc.b  67,67,67,67,68,68,68,68

Radar_xtable
    dc.b    #0,#0,#0,#0,#0,#0,#0,#0
    dc.b    #0,#0,#0,#0,#0,#0,#0,#0
    dc.b    #0,#0,#0,#0,#0,#0,#0,#0
    dc.b    #0,#0,#0,#0,#0,#0,#0,#0
    dc.b    #0,#0,#0,#0,#0,#0,#0,#0
    dc.b    #1,#1,#1,#1,#1,#1,#1,#1
    dc.b    #1,#1,#1,#1,#1,#1,#1,#1
    dc.b    #1,#1,#1,#1,#1,#1,#1,#1
    dc.b    #1,#1,#1,#1,#1,#1,#1,#1
    dc.b    #1,#1,#1,#1,#1,#1,#1,#1
    dc.b    #2,#2,#2,#2,#2,#2,#2,#2
    dc.b    #2,#2,#2,#2,#2,#2,#2,#2
    dc.b    #2,#2,#2,#2,#2,#2,#2,#2
    dc.b    #2,#2,#2,#2,#2,#2,#2,#2
    dc.b    #2,#2,#2,#2,#2,#2,#2,#2
    dc.b    #3,#3,#3,#3,#3,#3,#3,#3
    dc.b    #3,#3,#3,#3,#3,#3,#3,#3
    dc.b    #3,#3,#3,#3,#3,#3,#3,#3
    dc.b    #3,#3,#3,#3,#3,#3,#3,#3
    dc.b    #3,#3,#3,#3,#3,#3,#3,#3
    dc.b    #4,#4,#4,#4,#4,#4,#4,#4
    dc.b    #4,#4,#4,#4,#4,#4,#4,#4
    dc.b    #4,#4,#4,#4,#4,#4,#4,#4
    dc.b    #4,#4,#4,#4,#4,#4,#4,#4
    dc.b    #4,#4,#4,#4,#4,#4,#4,#4
    dc.b    #5,#5,#5,#5,#5,#5,#5,#5
    dc.b    #5,#5,#5,#5,#5,#5,#5,#5
    dc.b    #5,#5,#5,#5,#5,#5,#5,#5
    dc.b    #5,#5,#5,#5,#5,#5,#5,#5
    dc.b    #5,#5,#5,#5,#5,#5,#5,#5
    dc.b    #6,#6,#6,#6,#6,#6,#6,#6
    dc.b    #6,#6,#6,#6,#6,#6,#6,#6
    dc.b    #6,#6,#6,#6,#6,#6,#6,#6
    dc.b    #6,#6,#6,#6,#6,#6,#6,#6
    dc.b    #6,#6,#6,#6,#6,#6,#6,#6
    dc.b    #7,#7,#7,#7,#7,#7,#7,#7
    dc.b    #7,#7,#7,#7,#7,#7,#7,#7
    dc.b    #7,#7,#7,#7,#7,#7,#7,#7
    dc.b    #7,#7,#7,#7,#7,#7,#7,#7
    dc.b    #7,#7,#7,#7,#7,#7,#7,#7
    dc.b    #8,#8,#8,#8,#8,#8,#8,#8
    dc.b    #8,#8,#8,#8,#8,#8,#8,#8
    dc.b    #8,#8,#8,#8,#8,#8,#8,#8
    dc.b    #8,#8,#8,#8,#8,#8,#8,#8
    dc.b    #8,#8,#8,#8,#8,#8,#8,#8
    dc.b    #9,#9,#9,#9,#9,#9,#9,#9
    dc.b    #9,#9,#9,#9,#9,#9,#9,#9
    dc.b    #9,#9,#9,#9,#9,#9,#9,#9
    dc.b    #9,#9,#9,#9,#9,#9,#9,#9
    dc.b    #9,#9,#9,#9,#9,#9,#9,#9
    dc.b    #10,#10,#10,#10,#10,#10,#10,#10
    dc.b    #10,#10,#10,#10,#10,#10,#10,#10
    dc.b    #10,#10,#10,#10,#10,#10,#10,#10
    dc.b    #10,#10,#10,#10,#10,#10,#10,#10
    dc.b    #10,#10,#10,#10,#10,#10,#10,#10
    dc.b    #11,#11,#11,#11,#11,#11,#11,#11
    dc.b    #11,#11,#11,#11,#11,#11,#11,#11
    dc.b    #11,#11,#11,#11,#11,#11,#11,#11
    dc.b    #11,#11,#11,#11,#11,#11,#11,#11
    dc.b    #11,#11,#11,#11,#11,#11,#11,#11
    dc.b    #12,#12,#12,#12,#12,#12,#12,#12
    dc.b    #12,#12,#12,#12,#12,#12,#12,#12
    dc.b    #12,#12,#12,#12,#12,#12,#12,#12
    dc.b    #12,#12,#12,#12,#12,#12,#12,#12
    dc.b    #12,#12,#12,#12,#12,#12,#12,#12
    dc.b    #13,#13,#13,#13,#13,#13,#13,#13
    dc.b    #13,#13,#13,#13,#13,#13,#13,#13
    dc.b    #13,#13,#13,#13,#13,#13,#13,#13
    dc.b    #13,#13,#13,#13,#13,#13,#13,#13
    dc.b    #13,#13,#13,#13,#13,#13,#13,#13
    dc.b    #14,#14,#14,#14,#14,#14,#14,#14
    dc.b    #14,#14,#14,#14,#14,#14,#14,#14
    dc.b    #14,#14,#14,#14,#14,#14,#14,#14
    dc.b    #14,#14,#14,#14,#14,#14,#14,#14
    dc.b    #14,#14,#14,#14,#14,#14,#14,#14
    dc.b    #15,#15,#15,#15,#15,#15,#15,#15
    dc.b    #15,#15,#15,#15,#15,#15,#15,#15
    dc.b    #15,#15,#15,#15,#15,#15,#15,#15
    dc.b    #15,#15,#15,#15,#15,#15,#15,#15
    dc.b    #15,#15,#15,#15,#15,#15,#15,#15
    dc.b    #16,#16,#16,#16,#16,#16,#16,#16
    dc.b    #16,#16,#16,#16,#16,#16,#16,#17
    dc.b    #17,#17,#17,#17,#17,#17,#17,#17
    dc.b    #17,#17,#17,#17,#17,#18,#18,#18
    dc.b    #18,#18,#18,#18,#18,#18,#18,#18
    dc.b    #18,#18,#18,#19,#19,#19,#19,#19
    dc.b    #19,#19,#19,#19,#19,#19,#19,#19
    dc.b    #19,#20,#20,#20,#20,#20,#20,#20
    dc.b    #20,#20,#20,#20,#20,#20,#20,#20
    dc.b    #21,#21,#21,#21,#21,#21,#21,#21
    dc.b    #21,#21,#21,#21,#21,#21,#22,#22
    dc.b    #22,#22,#22,#22,#22,#22,#22,#22
    dc.b    #22,#22,#22,#22,#23,#23,#23,#23
    dc.b    #23,#23,#23,#23,#23,#23,#23,#23
    dc.b    #23,#23,#24,#24,#24,#24,#24,#24
    dc.b    #24,#24,#24,#24,#24,#24,#24,#24
    dc.b    #24,#25,#25,#25,#25,#25,#25,#25
    dc.b    #25,#25,#25,#25,#25,#25,#25,#26
    dc.b    #26,#26,#26,#26,#26,#26,#26,#26
    dc.b    #26,#26,#26,#26,#26,#27,#27,#27
    dc.b    #27,#27,#27,#27,#27,#27,#27,#27
    dc.b    #27,#27,#27,#28,#28,#28,#28,#28
    dc.b    #28,#28,#28,#28,#28,#28,#28,#28
    dc.b    #28,#29,#29,#29,#29,#29,#29,#29
    dc.b    #29,#29,#29,#29,#29,#29,#29,#29
    dc.b    #30,#30,#30,#30,#30,#30,#30,#30
    dc.b    #30,#30,#30,#30,#30,#30,#31,#31
    dc.b    #31,#31,#31,#31,#31,#31,#31,#31
    dc.b    #31,#31,#31,#31,#32,#32,#32,#32
    dc.b    #32,#32,#32,#32,#32,#32,#32,#32
    dc.b    #32,#32,#33,#33,#33,#33,#33,#33
    dc.b    #33,#33,#33,#33,#33,#33,#33,#33
    dc.b    #33,#34,#34,#34,#34,#34,#34,#34
    dc.b    #34,#34,#34,#34,#34,#34,#34,#35
    dc.b    #35,#35,#35,#35,#35,#35,#35,#35
    dc.b    #35,#35,#35,#35,#35,#36,#36,#36
    dc.b    #36,#36,#36,#36,#36,#36,#36,#36
    dc.b    #36,#36,#36,#37,#37,#37,#37,#37
    dc.b    #37,#37,#37,#37,#37,#37,#37,#37
    dc.b    #37,#38,#38,#38,#38,#38,#38,#38
    dc.b    #38,#38,#38,#38,#38,#38,#38,#38
    dc.b    #39,#39,#39,#39,#39,#39,#39,#39
    dc.b    #39,#39,#39,#39,#39,#39,#40,#40
    dc.b    #40,#40,#40,#40,#40,#40,#40,#40
    dc.b    #40,#40,#40,#40,#41,#41,#41,#41
    dc.b    #41,#41,#41,#41,#41,#41,#41,#41
    dc.b    #41,#41,#42,#42,#42,#42,#42,#42
    dc.b    #42,#42,#42,#42,#42,#42,#42,#42


CPitchType_tbl
    dc.w    0,0,0
    dc.w    #Joy_U,#Joy_U,#Joy_U
    dc.w    #Joy_D,#Joy_D,#Joy_D
    dc.w    #Joy_L,#Joy_L,#Joy_L
    dc.w    #Joy_R,#Joy_R,#Joy_R

; 0 down middle, 1 high, 2 low, 3 left, 4 right

    xdef PlayerPos_EntityNum_tbl

PlayerPos_EntityNum_tbl
    dc.w    #Pitcher_ptr,#Pitcher_ptr   ; s/r pitcher
    dc.w    #FBaseman_ptr
    dc.w    #SBaseman_ptr
    dc.w    #TBaseman_ptr
    dc.w    #ShortStop_ptr
    dc.w    #LFielder_ptr
    dc.w    #RFielder_ptr
    dc.w    #CFielder_ptr
    dc.w    #Catcher_ptr
    dc.w    #Batter_ptr


AFFlipTable
    dc.w    FBaseman_ptr,TBaseman_ptr
    dc.w    SBaseman_ptr,ShortStop_ptr
    dc.w    RFielder_ptr,LFielder_ptr

    section .text

BatRangeTable
    dc.w    BatLowHitRange,BatMidHitRange
    dc.w    BatHighHitRange,BatMidHitRange


    xdef    AI
    xdef    NullLogic
    xdef    BatSwing_000
    xdef    Pitch_000
    xdef    Bounds_RL
    xdef    HaloLogic
    xdef    FieldXLogic
    xdef    LookEntityLogic
    xdef    InitialBallLogic
    xdef    BallShadowLogic
    xdef    InitialCatcherLogic
    xdef    InitialPitcherLogic
    xdef    InitialBatterLogic
    xdef    InitialCameraLogic
    xdef    FractionalMultiply
    xdef    InitialFielderLogic
    xdef    InitialRunnerLogic
    xdef    InitialFirstRunLogic
    xdef    InitialSecondLogic
    xdef    InitialThirdLogic

***********************************************************************
Cosine          MACRO

        movem.l \1/A0,-(sp)
        lea.l   Cosine_Table,A0

        lsl.w   #1,\1
        move.w  (A0,\1.w),\3
        muls.w  \2,\3

        movem.l  (sp)+,\1/A0

        ENDM

Sine            MACRO

        movem.l \1/A0,-(sp)
        lea.l   Sine_Table,A0

        lsl.w   #1,\1
        move.w  (A0,\1.w),\3
        muls.w  \2,\3

        movem.l  (sp)+,\1/A0

        ENDM

Atan            MACRO

        movem.l \1/\2/A0,-(sp)
        lea.l   ArcTAN_Table,A0
        lsr.l   #8,\1
    IFEQ    ArcTan_Bytes-1
        lsr.l   #1,\1
    ELSEC
        lsr.l   #1,\1
    ENDC
        add.l   #$8000,\2
        clr.w   \2
        swap    \2

        tst.l   \2
        bne     .do_div\@

        move.w  #0,\3
        bra     .atx\@
.do_div\@
        divu.w  \2,\1

        cmp.w   #$80,\1
        blt     .adj\@

        move.w  #$20,\3
        jmp     .atx\@
.adj\@
        sub.w   #1,\1
        bpl     .do_shift\@
        clr.w   \1
.do_shift\@
    IFEQ    ArcTan_Bytes-1
        move.w  \1,\2
        and.w   #$7E,\1

        move.w  (A0,\1.w),\3
        btst    #0,\2
        bne     .got_atan\@

        lsr.w   #8,\3
.got_atan\@
        and.w   #$00FF,\3
    ELSEC
        lsl.w   #1,\1
        move.w  (A0,\1.w),\3
    ENDC
.atx\@
        movem.l  (sp)+,\1/\2/A0

        ENDM

AI
        movem.l D0-D7/A0-A6,-(sp)
    move.l  sp,StackDebugPtr
        move.w  Num_Entities,D7
NORL
    cmp.l   StackDebugPtr,sp
    bne     NORL
        lea.l   VTentity,A0
        sub.l   #1,D7
        bmi     _AI_done
        move.l  D7,D0
        asl.l   #Index_Shift,D0

*               cmp.w   #0,VTFon(A0,D0.w)       ;is this entity to be processed?
*                beq     NORL                    ;if not then get the next one

        cmp.w   #2,RunnerExists
        ble     .c1
        cmp.w   #Batter_ptr,d0
        ble     .c1
        tst.w   VTFrend(a0,d0.w)
        bne     .c1
        move.w  d7,d6
        and.w   #1,d6
        move.w  VBlank_cnt,d5
        and.w   #1,d5
        eor.w   d5,d6
        bne     NORL
.c1
        move.l  VTseq_step(A0,D0.w),D1  ;does this entity have AI?
        beq     NORL                    ;if not then get the next one
        move.l  D1,A1
        jmp     (A1)                    ;otherwise do AI
_AI_done
        movem.l (sp)+,D0-D7/A0-A6
        rts

*****************************************************************************

NullLogic       jmp     NORL

InfOutfline     equ     SBase_Y-$50000
BILine1y        equ     #$34    ;20
BILine2y        equ     #$c

Grab_Radius     equ     $20000


BallSpeed       equ     $-200000
Pball_x         equ     406
Pball_y         equ     -21

BatHitFrame     equ     15           ;18
CheckSwingFrame equ     15           ;18

RBatBoxMin      equ     $ffcc
RBatBoxMax      equ     $ffe0  ;$ffe5
LBatBoxMin      equ     $20    ;$1b
LBatBoxMax      equ     $34

PitcherMaxL     equ     $fffc
PitcherMaxR     equ     $4

BatHitToRunStrip equ    $0

SlowPitchSpeed  equ     $08
SlowPitchSpeedz equ     $2
MediumPitchSpeed equ    $09
MediumPitchSpeedz equ   $2
FastPitchSpeed  equ     $0b  ;a
FastPitchSpeedz equ     $1

StraightPitch   equ     $0
RightCurvePitch equ     $1
LeftCurvePitch  equ     $2
UpCurvePitch    equ     $4
DownCurvePitch  equ     $8
GroundFriction  equ     $00000b00      ;500

BatLowHit       equ     $0
BatMidHit       equ     $2
BatHighHit      equ     $4
Bunt            equ     $6


BatYRangeLow    equ     $95   ;$082
BatYRangeMid    equ     $a0   ;$095
BatYRangeHigh   equ     $0ac

*BallRangeHigh  equ     $0b2     ;off bottom of screen
BallRangeHigh   equ     $0c0     ;off bottom of screen

BallMaxX        equ     $0400    ;off right of screen
BallMinX        equ     $fc00    ;off left of screen

HitBoxY         equ     $095
HitBoxTop       equ     $0b0     ;90
HitBoxBottom    equ     $030
HitBoxLeft      equ     $fff3
HitBoxRight     equ     $b

Fielder_Reach   equ     $d0
FielderRunSpeed equ     $5800  ;10000

Strike          equ     $0001
Ball            equ     $ffff
HT_Home_Run     equ     #1
HT_Outf         equ     #2
HT_Ord          equ     #0
HT_Foul         equ     #3
HT_Bunt         equ     #4
HT_IFPop        equ     #5

BatLowHitRange  equ     124  ;#$48
BatMidHitRange  equ     153  ;#$90
BatHighHitRange equ     156  ;#$cb  

MaxZHeight      equ     #$400000



ballvscale_lo   equ     -7
ballvscale_high equ     BallRangeHigh

*****************************************************************************
WaitOnAnimation
    tst.w   VTFrdir(a0,d0.w)    ;if animation not running don't wait
    beq     setnextseq
    tst.w   VTFrend(a0,d0.w)
    beq     .done
setnextseq
    move.l  VTNextSeq(a0,d0.w),VTSeq_step(a0,d0.w)
    clr.w   VTFrdir(a0,d0.w)
.done   jmp     NORL

*****************************************************************************
WaitOnCatchAnimation
    jsr     checktags
    tst.w   VTFrdir(a0,d0.w)    ;if animation not running don't wait
    beq     .setnextseq
    tst.w   VTFrend(a0,d0.w)
    beq     .done
.setnextseq
    move.l  VTNextSeq(a0,d0.w),VTSeq_step(a0,d0.w)
    clr.w   VTFrdir(a0,d0.w)
.done   jmp     NORL


**************************************************************
    xdef HRDerbyLogic

HRDerbyLogic
    tst.w   DerbyDone
    bne     .waitstart

    move.w  Fcontrollers,d1     ;allow S to exit hrderby
    or.w    BControllers,d1
    btst    #Joy_S,d1
    beq     .r1
    lsr.w   #8,d1
    btst    #Joy_S,d1
    beq .waitstart
.r1
    lea.l   DerbyBatterNum,a1
    add.l   BteamAdj,a1
    move.w  (a1),PlayerAtBat
  tst.w PlayerAtBat   ;QUICK PATCH : FIND BUG IN DOSUBS!
  bge   .bp1
  clr.w PlayerAtBat
.bp1
    tst.w   DerbyEvent
    beq     .done
    jsr     DisplayDerbyInfo

    cmp.w   #15,DerbyPitchNum
    blt     .done

    tst.w   NumGamers
    beq .dr
    tst.w   DerbyPlayer
    bne .dr
    jsr Clear_ScrollA
.dr
    jsr DisplayDerbyRanking

    cmp.w   #1,NumGamers    ;derby over if 1 player mode
    blt     .derbydone
    tst.w   DerbyPlayer     ;or if player 2 is done
    beq     .c1
.derbydone
    move.w  #1,DerbyDone
    clr.w   VTFrdir(a0,d0.w)
    clr.w   FComputer
    bra     .done
.c1
    move.w  #1,NeedNewBatter
    eor.l   #2,FTeamAdj
    eor.l   #2,BTeamAdj
    move.w  BTeamNum,d1
    move.w  FTeamNum,BTeamNum
    move.w  d1,FTeamNum
    clr.w   DerbyPitchNum
    clr.w   DerbyScore
    eor.w   #1,DerbyPlayer
    jsr     SwitchPlayerPal
.done
    jmp     NORL
.waitstart
    clr.w   VTfrdir(a0,d0.w)
    move.w  Fcontrollers,d1
    or.w    BControllers,d1
    btst    #Joy_S,d1
    beq     .checkc
    lsr.w   #8,d1
    btst    #Joy_S,d1
    bne     .checkc
    clr.w   FComputer       ;Reset Controllers
    clr.l   FTeamAdj
    move.l  #2,BTeamAdj
    clr.w   killradarentities
    clr.w   runsht
    clr.w   runsvt
    move    #0,FadeDirection        ;Fade Down Field
    move    #2,FadeSpeed
    clr.w   PracticeMode
    StopSound       #S_DIGITALCROWD
   jsr _Initgems
    JSR     StartFadeDown
    jsr     WaitForFadeUp
    move.l  #VCTRL,A4               *; Macros use these registers
    move.w  #$9000+000000,(A4)   ;R16= | 0 | 0 |VS1|VS0| 0 | 0 |HS1|HS0| Scroll Size (00=32,01=64,10=XX,11=128)
    jmp     WarmEntry   ;DoGame
.checkc
    btst    #Joy_C,d1
    beq     .done
    lsr.w   #8,d1
    btst    #Joy_C,d1
    bne     .done
*   jsr Clear_ScrollA
    clr.w   DerbyDone
    clr.w   DerbyPitchNum
  move.w #14,derbypitchnum
    clr.w   DerbyScore
    move.w  #1,DerbyEvent
    move.w  #1,NeedNewBatter
    move.w  #1,FComputer
    tst.w   NumGamers
    bne .c1
    clr.w   DerbyPlayer
    jmp NORL

**************************************************************
    xdef PracticeModeLogic

PracticeModeLogic
    move.w  Fcontrollers,d1
    or.w    BControllers,d1
    btst    #Joy_S,d1
    beq     .c1
    lsr.w   #8,d1
    btst    #Joy_S,d1
    bne     .c1
    bset    #Joy_S,d1
    move.w  d1,BControllers
    move.w  d1,FControllers
    jsr     DisplayPractMsg
    add.w   #1,temp4
    cmp.w   #2,temp4
    blt     .c1
    jmp     DoGame
.c1
    move.w  Fcontrollers,d1
    or.w    BControllers,d1
    btst    #Joy_C,d1
    beq     .done
    lsr.w   #8,d1
    btst    #Joy_C,d1
    bne     .done

    move.w  #1,temp4
    clr.w   d1                ;set debounce next round
    bset    #Joy_C,d1
    move.w  d1,BControllers
    move.w  d1,FControllers

    eor.l   #2,FTeamAdj
    eor.l   #2,BTeamAdj
    move.w  Fcomputer,d1
    move.w  Bcomputer,Fcomputer
    move.w  d1,Bcomputer
    jsr     DisplayPractMsg
.done
    jmp     NORL

HeavyCameraLogic
    movem.l a2,-(sp)

    lea.l   Vtentity+FieldX_ptr,a1
    tst.w   VTfon(a1)
    bne     _YNotReset

*  lea.l        Vtentity+ball_ent_ptr,a2
*  move.l       VTsped(a2),d2
*  asl.l        #4,d2
*  move.w       VTdir(a2),d1
*  jsr  GetEndPoint
*  add.l        VTy(a2),d2
*  move.l       d2,d1           ;leading y coordinate

    move.l  VTy(a0,d0.w),d1
    cmp.w   #BallHit_ps,Playstage
    beq .r0
    move.w  Active_Fielder,d3    ;if ball thrown
    move.l  VTy(a0,d3.w),d1      ;follow active fielder

*   move.l  VTy(a0,d0.w),d1
.r0 sub.l   Oldy,d1
    bge     _DY_Positive
    asr.l   #3,d1
    cmp.l   #-8*$10000,d1
    bge     _NDyok
    move.l  #-8*$10000,d1
_NDyok
    move.l  d1,PCamDy
    bra     _CamDyDone

_DY_Positive
    asr.l   #3,d1
    cmp.l   #8*$10000,d1
    ble     _PDyok
    move.l  #8*$10000,d1
_PDyok
    move.l  d1,PCamDy

_CamDyDone
    move.l  Oldy,d1
    add.l   PCamDy,d1
    move.l  d1,VTy(a0,d0.w)
    bra     _nowx

_YNotReset
    move.l  VTy(a0,d0.w),d1
    cmp.w   #BallHit_ps,Playstage
    beq .r1
    move.w  Active_Fielder,d3
    move.l  VTy(a0,d3.w),d1
.r1
    move.l  d1,d2
    and.l   #$ffff0000,d2
    move.l  Oldy,d3
    and.l   #$ffff0000,d3
    cmp.l   d2,d3
    beq     _nowx
    sub.l   Oldy,d1
    asr.l   #4,d1
    bpl     _YDY_Positive
    cmp.l   NCamDY,d1
    bge     _NsetNCamDy

    move.l  NCamDy,d1
    cmp.l   #-8*$10000,d1
    ble     _YNDyok
    sub.l   #$4000,d1
_NSetNCamDY
    move.l  d1,NCamDy
_YNDyok
    move.l  d1,PCamDy
    bra     _YCamDyDone

_YDY_Positive
    cmp.l   NCamDY,d1
    ble     _PSetNCamDY

    move.l  NCamDy,d1
    cmp.l   #8*$10000,d1
    bge     _YPDyok
    add.l   #$4000,d1

_PSetNCamDY
    move.l  d1,NCamDY

_YPDyok
    move.l  d1,PCamDy

_YCamDyDone
    move.l  Oldy,d1
    add.l   PCamDy,d1
    move.l  d1,VTy(a0,d0.w)
_nowx
    tst.w   VTFon(a1)
    bne     _XNotReset

*  lea.l        Vtentity+ball_ent_ptr,a2
*   move.l      VTsped(a2),d2
*   asl.l       #4,d2
*   move.w      VTdir(a2),d1
*   jsr GetEndPoint
*   add.l       VTx(a2),d1 ;leading x Coordinate

    move.l  Vtx(a0,d0.w),d1
    cmp.w   #BallHit_ps,Playstage
    beq .r2
    move.w  Active_Fielder,d3
    move.l  VTx(a0,d3.w),d1
.r2
*   move.l  Vtx(a0,d0.w),d1
    sub.l   Oldx,d1
    bge     _DX_Positive
    asr.l   #3,d1
    cmp.l   #-16*$10000,d1    ;16
    bge     _NDxok
    move.l  #-16*$10000,d1    ;16
_NDxok
    move.l  d1,PCamDx
    bra     _CamDxDone

_DX_Positive
    asr.l   #3,d1
    cmp.l   #16*$10000,d1    ;16
    ble     _PDxok
    move.l  #16*$10000,d1    ;16
_PDxok
    move.l  d1,PCamDx

_CamDxDone
    move.l  Oldx,d1
    add.l   PCamDx,d1
    move.l  d1,VTx(a0,d0.w)
    bra     .done

_XNotReset

    move.l  VTx(a0,d0.w),d1

    cmp.w   #BallHit_ps,Playstage
    beq .r3
    move.w  Active_Fielder,d3
    move.l  VTx(a0,d3.w),d1
.r3
    move.l  d1,d2
    and.l   #$ffff0000,d2
    move.l  Oldx,d3
    and.l   #$ffff0000,d3
    cmp.l   d2,d3
    beq     .done
    sub.l   Oldx,d1
    asr.l   #4,d1
    bge     _XDX_Positive
    cmp.l   NCamDX,d1
    bge     _NsetNCamDx

    move.l  NCamDx,d1
    cmp.l   #-16*$10000,d1      ;16
    ble     _XNDxok
    sub.l   #$4000,d1
_NSetNCamDX
    move.l  d1,NCamDx
_XNDxok
    move.l  d1,PCamDx
    bra     _XCamDxDone

_XDX_Positive
    cmp.l   NCamDX,d1
    ble     _PSetNCamDX

    move.l  NCamDx,d1
    cmp.l   #16*$10000,d1   ;16
    bge     _XPDxok
    add.l   #$4000,d1

_PSetNCamDX
    move.l  d1,NCamDX

_XPDxok
    move.l  d1,PCamDx

_XCamDxDone
    move.l  Oldx,d1
    add.l   PCamDx,d1
    move.l  d1,VTx(a0,d0.w)

.done
    movem.l (sp)+,a2
    rts


InitialCameraLogic
    tst.w   PanBack
    bne     _ResetCamera

    tst.w   InPitcherIF
    bne     .done
    tst.w   Catcherreturn
    bne     .done

    bra _movewithball
.done
    jmp     NORL

_movewithball
    tst.w   BallLocation
    beq     .chbs
    lea.l   VTentity,a1
    moveq.l #0,d1
    move.w  Balllocation,d1
    asl.w   #8,d1
    add.l   d1,a1
    bra     .smove
.chbs
    lea.l   VTEntity+BallShadow_Ent_ptr,a1
    cmp.w   #HT_Home_Run,Hittype
    bne     .smove

    lea.l   VTentity+Ball_ent_ptr,a1    ;follow ball
    bra     .smove

.smove
*  lea.l VTentity+Batter_ptr,a1
    move.w  #0,d0
    lea.l   VTentity,a0

    move.w  #1,d4
    move.w  VTx(a1),VTx(a0)
    move.w  VTy(a1),VTy(a0)

    lea.l   VTentity+FieldX_ptr,a1
    tst.w   VTfon(a1)
    beq     .hcl
    move.w  VTx(a1),VTx(a0)
    move.w  VTy(A1),VTy(a0)

.hcl    jsr     HeavyCameraLogic
    jsr     ScrollXY
.done
    lea.l   Vtentity,a0
    move.w  #0,d0
    move.l  VTy(a0,d0.w),Oldy
    move.l  VTx(a0,d0.w),Oldx
    jmp     NORL


_ResetCamera
    lea.l   VTentity+ballshadow_ent_ptr,a1
    move.w  #3,VTx(a1)
    move.w  #110,VTy(a1)
    move.w  #CamULC_X,d0
    move.w  #CamULC_Y,d1
    jsr     StepPanCamera1
    cmp.w   #CamULC_X,Map_ULC_X
    bne     .done
    cmp.w   #CamULC_Y,Map_ULC_Y
    bne     .done
    clr.w   PanBack
    lea.l   Vtentity,a0
    move.w  #CamCenterX,Vtx(a0)
    move.w  #CamCentery,Vty(a0)
    move.w  #CamCenterX,oldx
    move.w  #CamCenterY,oldy
.done   jmp NORL

setcamxy
    movem.l d1/a0-a1,-(sp)
    lea.l   Vtentity,a0
    lea.l   VTentity+Ball_ent_ptr,a1
    move.w  VTx(a1),d1
    add.w   Map_Center_X,D1
    sub.w   #128,d1
    move.w  d1,VTx(a0)
    move.l  VTy(a1),d1
    sub.w   #16,d1
    add.w   Map_Center_Y,D1
    sub.w   #110,d1
    move.w  d1,VTy(a0)
    movem.l (sp)+,d1/a0-a1
    rts
*_ResetCamera
*       clr.w   PanBack
*       lea.l   Field_Map,A0

*       move.w  #CamULC_X,D0
*       move.w  #CamULC_Y,D1
*       jsr     load_field
*       jmp     NORL



StepPanCamera1
*       D0 = target x position
*       D1 = target y position
*
*       Note: No bounds checking, scroll routines will not
*       scroll off screen, but camx,camy will get screwed up

    move.w  d1,d6
    sub.w   Map_ULC_Y,d6    ; Targy - MapULCY = distanceY
    beq     .panx
    bgt     .pand           ; if positive pan down
    neg.w   d6              ; distanceY = abs(distanceY)
    move.w      PanSpeed,d5
    sub.w       #8,d5
    cmp.w       d5,d6
*       cmp.w   PanSpeed,d6           ; move max 8 pixels this step
    ble     .sfu1
    move.w  PanSpeed,d6
    sub.w       #8,d6
.sfu1
    jsr     scroll_field_up
    bra     .panx
.pand
    move.w      PanSpeed,d5
    sub.w       #8,d5
    cmp.w       d5,d6
*       cmp.w   PanSpeed,d6
    ble     .sfd1
    move.w  PanSpeed,d6
    sub.w       #8,d6
.sfd1   jsr     scroll_field_down

.panx
    move.w  d0,d6        ;get ball x
    sub.w   Map_ULC_X,d6
    beq     .done
    bge     .panr
    neg.w   d6
    cmp.w   PanSpeed,d6
    ble     .sfl1
    move.w  PanSpeed,d6
.sfl1
    jsr     scroll_field_left
    bra     .done
.panr
    cmp.w   PanSpeed,d6
    ble     .sfr1
    move.w  PanSpeed,d6
.sfr1
    jsr     scroll_field_right

.done   rts



ScrollXY
    movem.l d6/a1,-(sp)
    lea.l   vtentity,a1
    move.w  VTy(a1),d6
    sub.w   #16,d6
    add.w   Map_Center_Y,D6
    sub.w   #110,d6
    sub.w   Map_ULC_Y,d6    ; Targy - MapULCY = distanceY
    beq     .panx
    bgt     .pand           ; if positive pan down
    neg.w   d6              ; distanceY = abs(distanceY)
    move.w  PanSpeed,d5
    sub.w   #8,d5
    cmp.w   d5,d6
    ble     .sfu1
    move.w  PanSpeed,d6
    sub.w   #8,d6
.sfu1
    jsr     scroll_field_up
    bra     .panx
.pand
    move.w  PanSpeed,d5
    sub.w   #8,d5
    cmp.w   d5,d6
    ble     .sfd1
    move.w  PanSpeed,d6
    sub.w   #8,d6
.sfd1   jsr     scroll_field_down

.panx
    tst.w   HScrol

(Source: evilhamwizard)

References#


  1. ESPN Baseball Tonight credits (Genesis, 1994) - MobyGames↩︎
  2. Mean Machines Sega Magazine Issue 18, p. 16. "April is the provisional release date [...]"↩︎
  3. Gamefan Volume 2 Issue 06 May 1994, p. 105. "Now available for Sega Genesis."↩︎