ECE291 Computer Engineering II Lockwood, Spring 1999

3 pt. Shootout
 
 

Team Members:

    Kenneth Jones : Game Design, Networking
    Chris Lieggi : Graphics, Networking
    Dan Tu : Graphics, Sound
    Chom Oh : Sound, Graphics

Introdution:

    A 3rd person view game that follows the format of the NBA 3pt shootout. The player will be shooting five balls from five different spots around the 3pt line. The last ball shot from each spot is worth 2pts while the rest of the balls will be worth one. There is a running clock of 60 secs. The accuracy of each shot is determined by the release of the ball, with the optimal release being at the peak of his jump. A network game is composed of clients signing onto a server. Once everyone is ready, the server will start the clock and all of the players will simultaneously play. A scoreboard on each player`s screen will update the top 4  player`s score so everyone knows how everybody else is doing.  We use 256 color PCX files to do the animation.

Main features:
      Animation in Mode 13h Video
      MIDI and WAV sound
      2-4 Player network game capability
      Difficulty Levels

Problem Description and Implementation:

Our project differs from past projects due to main problem of animation sequencing.  We had to use tons of flags in order to properly determine the correct animation and the correct frame in that animation to draw to the screen.  Using the network to start all games at once also posed some technical difficulties. 

Networking:     Consists of a multicast system, where a series of flags
                determine the server.  A start flag can be set by any
                player by pressing the space bar and this sends out a
                signal to all players to start the game.

Animation:      Writing to video memory should helped this out.  We also
                are going to have a timer that will be updated 30 times
                a second and will redraw the screen based on that timer.
                Another feature of our mainloop is that it will draw
                frames to video memory based on this timer to get the
                correct sequence and to match keyboard release to player
                release.  Also will load all animation into a series
                of arrays to have faster access to images.

Sound:          Sequencing the sound of a swish or a miss will be a
                challenge  met with our timer.  We ended up going with
                only MIDI since using WAV files and MIDI on the network
                drive cause a crash.  Playing from a local drive solves
                this problem.

notes: for networking we used John Lockwood's NetLib libraries
       for sound we used the midpak driver
       we also used Lib291 functions
 
;====== Constants Section ==================================================

VidGrSEG EQU 0A000h
SystemClockFreq EQU 36
ClockScreenOffset EQU 54040
PlayerOneScreenOffset EQU 53777
PlayerOneScoreScreenOffset EQU 56657

;====== Segment Variables=====================================================

fspic db 65535 dup (0)
Scratchpad DB 65535 dup(?)
ScreenBuffer db 53760 dup(?)
DigitArray db 6400 dup(0)
LittleDigitArray db 4320 dup(0)
BigPicArray db 19200 dup (0)
PreJArray db 14000 dup(0)
playerpic db 3500 dup(0)
BallArray db 256 dup(0)  ;cjl
scarray db 1280 dup (0)
RimArray db 3060 dup (0)
ColorBallArray db 256 dup (0)
gameoverpic db 3336 dup (0)
grabanimation db 18600 dup(0)
playernamearray  db 1440 dup (0)
BlankArray db '$$$$$$$$'

;====== Variables ==========================================================

pbuf   db 7 dup(?)
crlf    db CR,LF,'$'
ten db 10
ImageSize dw ?
EndGameFlag db 0

shitmsg db '??????????????', cr, lf,'$'
widthofPCX dw 0
MyScore dw 0
oldKbdV         dd  ?           ;far pointer to default keyboard
                                ;  interrupt function
PlayerHasBall db 0
sixforty dw 640
ftt dw 396
ShootKey db 25                       ;scan code for shoot key
ShootKeyReleased db 153              ;scan code for shoot key released
ShootPressed db 0                    ;flag set if shoot key is pressed
GrabKey db 24                        ;Scan code for grab key
GrabKeyReleased db 152               ;Scan code for grab key release
MyTime db 0                ;variable incremented until=1 sec
clockcount dw 60            ;start time for clock
PlayerGrabbingBall db 0          ;Flag if player is grabbingball
PlayerInAir db 0                 ;flag if player is in air
oldTimerV       dd      ?       ;far pointer to default 08h
                                ;  interrupt function
timerCount      dd      0       ;counter (to be incremented every 1/72 sec)

timervar        db      0       ;used in MyTimerHandler
GrabAnimationCounter dw 0
UpDownGrabFlag db 0
MyFirstTime db 0
ShotReleased db 0
 
JumpAnimationCounter dw 0
PreJCounter          dw 0
BigPicJCounter       dw 0
MinHeight            db 3
JumpUpDownFlag       db 0
MinHeightReached     db 1

Anotherflag db 0
NumBalls db 5 ; I changed Anotherflag to NumBalls just to be funny
              ; actually, it made the BallRack a lot easier
ShotCounter dw 0    ;Count how long shot button was pressed
GameDifficulty db 2
ScoreCounted db 0
BallInFlag db 0
testpic db 'Pics\Intro\test5.pcx' , 0    ; Startup Screen
menu1 db 'Pics\Menus\menu1.pcx' , 0              ;Main Menu
difficultymenu db 'Pics\Menus\diff.pcx' , 0
controlmenu db 'Pics\Menus\control.pcx' , 0
InstructFile db 'Pics\Menus\Inst.pcx',0
 
playernamefile db 'Pics\Misc\player.pcx',0
digitfile db 'Pics\Misc\num.pcx',0             ;Clock digits
littledigits db 'Pics\Misc\lnum3.pcx',0        ;Score digits
scfile db 'Pics\Misc\sc.pcx',0                 ;Shot clock file
;playerfile db 'Pics\Misc\pd.pcx',0         ;cjl
playerfile db 'Pics\Misc\play.pcx',0
ballfile db 'Pics\Misc\bball.pcx',0
ColorBallFile db 'Pics\Misc\bballc.pcx',0  ;cjl
gameoverfile db 'Pics\Misc\GameOver.pcx',0
 

backgroundnumber db 0
bg1 db 'Pics\Backgrd\bg0.pcx',0
bg2 db 'Pics\Backgrd\bg1.pcx',0
bg3 db 'Pics\Backgrd\bg2.pcx',0
bg4 db 'Pics\Backgrd\bg3.pcx',0
bg5 db 'Pics\Backgrd\bg4.pcx',0

BGJtable   dw offset bg1                 ;offsets of different background file name
           dw offset bg2
           dw offset bg3
           dw offset bg4
           dw offset bg5

gba0 db 'Pics\Grab\graba0.pcx',0
gba1 db 'Pics\Grab\graba1.pcx',0
gba2 db 'Pics\Grab\graba2.pcx',0
gba3 db 'Pics\Grab\graba3.pcx',0
gba4 db 'Pics\Grab\graba4.pcx',0
gba5 db 'Pics\Grab\graba5.pcx',0

GrabJTable dw offset gba0
           dw offset gba1
           dw offset gba2
           dw offset gba3
           dw offset gba4
           dw offset gba5

GrabJTable2 dw offset grabanimation + 0
            dw offset grabanimation + 3100
            dw offset grabanimation + 6200
            dw offset grabanimation + 9300
            dw offset grabanimation + 12400
            dw offset grabanimation + 15500
            dw offset grabanimation + 15500

BigPic0 db 'Pics\Jump\SJump0.pcx',0
BigPic1 db 'Pics\Jump\SJump1.pcx',0
BigPic2 db 'Pics\Jump\SJump2.pcx',0
BigPic3 db 'Pics\Jump\SJump3.pcx',0
rimfile db 'Pics\Misc\rim0.pcx',0
rimfile2 db 'Pics\Misc\rim1.pcx',0
rimfile3 db 'Pics\Misc\rim2.pcx',0
rimfile4 db 'Pics\Misc\rim3.pcx',0
rimfile5 db 'Pics\Misc\rim4.pcx',0
rimfile6 db 'Pics\Misc\rim5.pcx',0
rimfile7 db 'Pics\Misc\rim6.pcx',0
rimfile8 db 'Pics\Misc\rim7.pcx',0
rimfile9 db 'Pics\Misc\rim8.pcx',0

BigPicLoadJTable dw offset BigPic0
                 dw offset BigPic1
                 dw offset BigPic2
                 dw offset BigPic3
 
BigPicJTable dw  offset BigPicArray + 0
             dw  offset BigPicArray + 4800
             dw  offset BigPicArray + 9600
             dw  offset BigPicArray + 14400
             dw  offset BigPicArray + 14400
 
PreJPic0 db 'Pics\Jump\be0.pcx',0
PreJPic1 db 'Pics\Jump\be1.pcx',0
PreJPic2 db 'Pics\Jump\be2.pcx',0
PreJPic3 db 'Pics\Jump\be3.pcx',0

PreJLoadJTable dw offset PreJPic0
               dw offset PreJPic1
               dw offset PreJPic2
               dw offset PreJPic3
 
PreJTable dw offset PreJArray
          dw offset PreJArray + 3500
          dw offset PreJArray + 7000
          dw offset PreJArray + 10500

InAirPosTable  dw 31495
               dw 31495
               dw 31495
               dw 5+31495-320*(6+8)
               dw 5+31495-320*(6+8+6)
               dw 5+31495-320*(6+8+6+5)
               dw 5+31495-320*(6+8+6+5+4)
               dw 5+31495-320*(6+8+6+5+4+4)
               dw 5+31495-320*(6+8+6+5+4+4+3)
               dw 5+31495-320*(6+8+6+5+4+4+3+3)
               dw 5+31495-320*(6+8+6+5+4+4+3+3+2)
               dw 5+31495-320*(6+8+6+5+4+4+3+3+2+2)
               dw 5+31495-320*(6+8+6+5+4+4+3+3+2+2+1)
               dw 5+31495-320*(6+8+6+5+4+4+3+3+2+2+1+1)
               dw 5+31495-320*(6+8+6+5+4+4+3+3+2+2+1+1+1)
               dw 5+31495-320*(6+8+6+5+4+4+3+3+2+2+1+1+1)
               dw 5+31495-320*(6+8+6+5+4+4+3+3+2+2+1+1+1)
 
UserInput   db 0
MousePressFlag  db 0
MenuNumber  db 0

MouseMenuLookup dw seg AnimationSeg
                dw 280
                dw 320*16+64
                dw 215
                dw 29
                dw 's'
 
                dw seg AnimationSeg
                dw 280
                dw 320*64+64
                dw 222
                dw 29
                dw 'n'
 
                dw seg AnimationSeg
                dw 280
                dw 320*112+64
                dw 149
                dw 27
                dw 'c'
 
                dw seg AnimationSeg
                dw 280
                dw 320*160+64
                dw 88
                dw 27
                dw 'q'
 
                dw seg AnimationSeg
                dw 280
                dw 320*64+96
                dw 116
                dw 29
                dw '1'
 
                dw seg AnimationSeg
                dw 280
                dw 320*112+96
                dw 99
                dw 27
                dw '2'
 
                dw seg AnimationSeg
                dw 280
                dw 320*160+96
                dw 180
                dw 29
                dw '3'
 
MousePos    db  20 dup(0FFh)
            db  04 dup(0FFh), 14 dup(0), 02 dup(0FFh)
            db  04 dup(0FFh), 14 dup(0), 02 dup(0FFh)
            db  20 dup(0FFh)
            db  04 dup(0FFh), 14 dup(1), 02 dup(0FFh)
            db  04 dup(0FFh), 14 dup(1), 02 dup(0FFh)
            db  20 dup(0FFh)
            db  04 dup(0FFh), 10 dup(2), 06 dup(0FFh)
            db  04 dup(0FFh), 10 dup(2), 06 dup(0FFh)
            db  20 dup(0FFh)
            db  04 dup(0FFh), 06 dup(3), 10 dup(0FFh)
            db  04 dup(0FFh), 06 dup(3), 10 dup(0FFh)
            db  20 dup(0FFh)
 
 
            db  20 dup(0FFh)
            db  20 dup(0FFh)
            db  20 dup(0FFh)
            db  20 dup(0FFh)
            db  06 dup(0FFh), 08 dup(4), 06 dup(0FFh)
            db  06 dup(0FFh), 08 dup(4), 06 dup(0FFh)
            db  20 dup(0FFh)
            db  06 dup(0FFh), 07 dup(5), 07 dup(0FFh)
            db  06 dup(0FFh), 07 dup(5), 07 dup(0FFh)
            db  20 dup(0FFh)
            db  06 dup(0FFh), 12 dup(6), 02 dup(0FFh)
            db  06 dup(0FFh), 12 dup(6), 02 dup(0FFh)
            db  20 dup(0FFh)

; ======================== Network Variables ====================================
DrawPlayerCounter2 db 0
TopScore dw 0
speed dw 10
DrawTime dw 0
ntime dw 0
SpaceBar_Flag db 0
netpic2 db 'Pics\Menus\Network2.pcx' , 0
netpic3 db 'Pics\Menus\Network3.pcx' , 0
netpic4 db 'Pics\Menus\Network4.pcx' , 0
netpic5 db 'Pics\Menus\Network5.pcx' , 0

Message1 db 'You selected player Num 1'

CharArray db '0123456789'
NumArray  db 0,1,2,3,4,5,6,7,8,9
PlayerNumber dw 0
NumberOfPlayers db 4
NumNetPlayers dw 0
sKey_Flag db 0

PUBLIC grp_name, my_name
MyNum     db 0  ; My Player Number

PUBLIC MyNum
ServerNum db 63  ; Who is server
PUBLIC ServerNum

grp_name db      '3PtShootoutnet$$'
 
my_name db       '3PtShtPlayer00$$'
 
HelloTime       dw 0
UpdateTime      dw 0

NetworkGame_Flag    db 0

StartGame_Flag    db 0

GameOn_Flag db 0

ScoresJTable dw offset PlayerOneScoreScreenOffset +0
             dw offset PlayerOneScoreScreenOffset +70
             dw offset PlayerOneScoreScreenOffset +140
             dw offset PlayerOneScoreS

; ---- Network Player Information ---
INACTIVE           EQU 0
ACTIVE               EQU -1
DEPARTING        EQU 2

SizePlayerType dw Sizeof Playertype

playerarray PlayerType 64 dup(< >) ; Player Array
PUBLIC playerarray
namesarray db 64 dup (8 dup (0))   ; array of string names

; ---- Network Message Types & Formats ---
HELLO   EQU 33
UPDATE  EQU 21
GOODBYE EQU 22

PlayerType STRUC
  PlayerNum db 0
  Score     dw 0                ;
  Status    db INACTIVE         ; All Players Initially Inactive
PlayerType ENDS

GenericMsg STRUC                 ; Generic Message Structure
  MsgType         db ?           ; 1-byte packet type identifier (See types below)
  PlayerNum       db 63          ; Player that transmitted the message
GenericMSG ENDS

HelloMsg STRUC                   ; Hello Message
  MsgType         db HELLO
  PlayerNum       db 63
  Start_Flag      db 0
  Server_Num      db 0
  PlayerName      db 8 dup ('z') ;8 byte string
HelloMsg ENDS

UpdateMsg STRUC              ; Update Message
  MsgType         db UPDATE
  PlayerNum       db 63
  NetScore        dw 0       ; 1 if Exit, 0 otherwise
UpdateMsg ENDS

GoodByeMsg STRUC             ; GoodBye Message
  MsgType db GOODBYE
  PlayerNum db 63
GoodByeMsg ENDS
 

;========= Structure for MIDI =============
MIDIFile STRUCT
         FName    db   20 dup (0)  ;String maximum 20 characters
         FSize  dw   ?
         SeqNum   dw   ?
MIDIFile ENDS

MIDISEG SEGMENT
MIDIbuf  db 48000 dup (?)
sndbuf  db  2048 dup (10,20,50,80,90,80,50,20)  ; 16k of sine wave
MIDISEG ENDS

;========= Variables for MIDI =============
MIDIList MIDIFile {'walkway.xmi',30280,0},    ; MIDI files to play
                  {'majesty.xmi',11324,0}
 
MIDINum    dw   0
midiFlag   dw   ?
ErrorMsg   db   'Error playing file','$'
 
 

;====== Procedures ==========================================================

By Ken Jones

DrawNetScalerINV
; Inputs:
;    AX = segment of image
;    SI = offset of image
;    DI = starting location for picture
;    cx = width of image
;    bx = height of image
;    Variable Scale dw (0 = normal)  )
; Output:
;    draws to screen
; Purpose:
;    to scale a PCX file with invisible colors
;    makes image (scale-1)/scale as big

DrawNumber
; Inputs:
;    AX = # to display
;    di = offset to display at
; Output:
;    draws number to video buffer
; Purpose:
;    to draw the number in ax to the video buffer

GetServerInput
; Inputs:
;    none
; Output:
;    updates ServerNumk
; Purpose:
;    uses kbdin to get server number

NewNetPLayerName
; Inputs:
;   Register:  DL = position to write t
;    Variable PlayerNumber
; Output:
;    draws to video buffer
; Purpose:
;    To draw the name on the screen

NetPost
; Inputs:
;    AX = Length
;    BX = Pointer to RXBuffer
; Outputs:
;    Array Variables Modified: playerarray
;           namesarray
;    Variables Modified: GameOn_Flag
;    Registers: None! (processed within an interrupt)
; Description:
;    The NetPost function is called by NetLIB whenever a datagram arrives
;    and processes packets by type.

UpdateNetScores
; Inputs:
;    Variable = MyScore
;         = PlayerNumber
; Outputs:
;    write to screen
; Procedure Calls:
;    UpdateMyScore
; Description:
;    Updates the current scores of active players in game

CountNetPlayers
; Inputs:
;    none
; Outputs:
;    Variables Modified: NumNetPlayers
; Description:
;   counts the number of netowked players

FindTopScore
; Inputs:
;    none
; Outputs:
;    Variables Modified: TopScore
; Description:
;    Finds top socre in playerarray

DrawBallGrap
; Inputs:
;    Variable GrabAnimationCounter
;   Variable UpDownGrabFlag
; Output:
;    draws to video buffer
; Purpose:
;    to draw the ball moving from the rack to his hands

DrawBallRack
; Inputs:
;    Variables ==  BallsNum
;               BallsinRackJTable (jump table of offsets)
; Output:
;    draws to video buffer
; Purpose:
;    to draw the balls on the rack

DrawScaler
; Inputs:
;    AX = segment of image
;    SI = offset of image
;    DI = starting location for picture
;    cx = width of image
;    bx = height of image
;    Variable Scale dw (0 = normal)  )
; Output:
;    draws to screen
; Purpose:
;    to scale a PCX file, makes image (scale-1)/scale as big
 
DrawScalerINV
; Inputs:
;    AX = segment of image
;    SI = offset of image
;    DI = starting location for picture
;    cx = width of image
;    bx = height of image
;    Variable Scale dw (0 = normal)  )
; Output:
;    draws to video buffer
; Purpose:
;    to scale a PCX file with invisible colors
;    makes image (scale-1)/scale as big

By Chom Oh

MIDI
; Inputs:
;      Arrays ==  MIDIList
;      Variables ==  MIDINum
;                            MIDIbuf
; Output:
;    plays midi file
; Purpose:
;   to play a midi file

StopMidi
; Inputs:
;    none
; Output:
;    none
; Purpose:
;    stop the playing of a midi file

By Dan Tu

MouseHandler
; Input:
;   BX = Mouse button status
;   CX = horizontal mouse position in pixels
;   DX = vertical mouse position in pixels
;   DS = data segment of the mouse driver
;  Output:
;   none
; Purpose:
;   to use our own custom mouse handler

By Chris Lieggi
 
 KbdInstall
; Input: None
 ; Output:
 ;    variable oldKbdV ==  pointer to default keyboard handle
 ; Purpose:
 ;    Installs Interrupt 9's (IRQ1's) vector to the address of KbdHandler.
 ;    Saves far pointer to default keyboard handler in oldKbdV

KbdUninstall
 ; Input:  variable oldKbdV ==  pointer to default keyboard handle
 ; Output: None
 ;
;  Purpose: Restore keyboard Interrupt vector to the original value.

KbdHandler
 ; Input: none
 ; Output:
;  Purpose: This routine is the Interrupt Service Routine called when the
;           keyboard hardware reads in the scan code from the keyboard. By
;           reading the scancode from the keyboard's hardware register,
;           the function can determine which key was pressed.
;           The routine will then translate this scan code into a
;           corresponding ASCII code.

;
InstTimer
;Purpose-To install the new Timer Handler
;        and to save the old Timer handler
;Inputs-none
;Outputs-OldKeyV with the old Timer handler
;        in it
;Utilizes interupt 8.Initializes the timer to
;send a pulse 36 times per second

DeInstTimer
;Purpose-To deinstall the new Timer Handler
;        and to install the old Timer handler
;Inputs-none
;Outputs-none

MyTimerHandler
;Purpose-To develop a new timer handler that
;        makes the timer act the way we want in the
;        game
;Inputs-timerCount
;Outputs-timerCount(modified)
;Utilizes interupt 8. Makes a call to
;oldTimerV every fourth time. Sends ACK
;and EOI. Increments timercount each time
;that it gets called

Drawbackg
; Inputs: None
; Outputs:
;   AX=Segment containing segment of picture
;   SI=offset of picture
;   DI=screen position to draw picture
;   CX=width of picture
;   BX=Length of picture
; Purpose:
;   Prepare regs to draw background and calls DrawPCXtoBuffer

DrawGameOver
; Inputs: None
; Outputs:
;   AX=Segment containing segment of picture
;   SI=offset of picture
;   DI=screen position to draw picture
;   CX=width of picture
;   BX=Length of picture
; Purpose:
;   Prepare regs for Game Over pic and call DrawPCXinv

DrawGrabAnimation
;Input:
;  GrabAnimationCounter
;  UpDownGrabFlag
;Output:
;   Draws a frame of animation to screen buffer
;   variables:
;       PlayerGrabbingBall
;       PlayerHasBall
;Uses:
;  Internal Variables:
;        GrabAnimationCounter
;        UpDownGrabFlag
;Purpose:
;   Draw the animation of a player grabbing the ball
;   from the rack.

DrawJumpAnimation
; Inputs:  variable ShotReleased
; Outputs:  Draws Picture to Screen Buffer
;       variables:
;           ShootPressed
;           PlayerInAir
;           PlayerHasBall
;
;
; Uses:
;      Variables:
;           MinHeightReached
;           JumpAnimationCounter
;           PreJCounter
;           BigPicJCounter
;           JumpUpDownFlag
;      Look Up Tables:
;           PreJTable
;           BigPicJTable
;           InAirPosTable
;
;
;Purpose:
;       Draws the animation of the player jumping on
;       the screen.  Draws animation of player before he
;       jumps, frames of player jumping, animation of shot
;       release, and animation of player returning to the
;       ground.  Chooses image based on animation counter
;       and shot released.

DrawMenu
; Inputs: None
; Outputs:
;   AX=Segment containing segment of picture
;   SI=offset of picture
;   DI=screen position to draw picture
;   CX=width of picture
;   BX=Length of picture
; Purpose:
;   Prepare regs for current menu and call DrawPCX

DrawPCX
; Inputs: AX = segment of image
;         SI = offset of image
;         DI = starting location for picture
;         CX = width of image
;         BX = height of image
; Outputs:
;         Draws image on screen at desired position

DrawPCXinv
; Inputs: AX = segment of image
;         SI = offset of image
;         DI = starting location for picture
;         CX = width of image
;         BX = height of image
; Outputs:
;         Draws image on screen at desired position
;         except those with pallette color 255
 

DrawPCXtoBuffer
; Inputs: AX = segment of image
;         SI = offset of image
;         DI = starting location for picture
;         CX = width of image
;         BX = height of image
; Outputs:
;         Draws image on screen buffer at desired position

DrawPCXtoBufferinv
; Inputs: AX = segment of image
;         SI = offset of image
;         DI = starting location for picture
;         CX = width of image
;         BX = height of image
; Outputs:
;         Draws image to buffer at desired position
;         except those with pallette color 255

 Drawplayer
; Inputs: None
; Outputs:
;   AX=Segment containing segment of picture
;   SI=offset of picture
;   DI=screen position to draw picture
;   CX=width of picture
;   BX=Length of picture
; Purpose:
;   Prepare regs for player pic and call DrawPCX

DrawPlayerName
;Inputs: none
; Outputs:
;   AX=Segment containing segment of picture
;   SI=offset of picture
;   DI=screen position to draw picture
;   CX=width of picture
;   BX=Length of picture
; Purpose:
;   Prepare regs to display the player names and call DrawPCX

Drawrim
;Inputs: variable RimNumber
; Outputs:
;   AX=Segment containing segment of picture
;   SI=offset of picture
;   DI=screen position to draw picture
;   CX=width of picture
;   BX=Length of picture
; Purpose:
;   Prepare regs and calls DrawPCX

DrawSC
;Inputs: none
; Outputs:
;   AX=Segment containing segment of picture
;   SI=offset of picture
;   DI=screen position to draw picture
;   CX=width of picture
;   BX=Length of picture
; Purpose:
;   Prepare regs and calls DrawPCX

DrawShotBallAnimation
;Inputs:  variable: JumpAnimationCounter
;Outputs: Image of a ball to the buffer
;Uses:  Lookup Table:  HasBallAnimationTable
;Purpose:  Draw Ball Animation when shot button
;          was pressed, but ball wasn't released.

MoveBufferToScreen
;Input:None
;Output: Draws whats in screen buffer to screen
; Purpose:
;       Moves screen buffer to screen 36 times/sec

CalculateShot
;Inputs: ShotCounter
;Outputs: ShotStatus
;Purpose:
;   Determine if shot goes in and set ShotStatus accordingly

Configure Controls
;Input: keystroke
;Output:
;   Shootkey
;   Grabkey
;   ShootkeyReleased
;Purpose:
;   Set custom grab and shoot keys by modifying
;   variables

DrawBallAnimation
; Input: backgroundnumber
;        ShotStatus
;        Tables:
;           BallAnimationTable
;           ScaleTable
;           MissBGJTable1
;           ScaleTableBck
;           ScaleTableFwd
;           MissBGJTable2
;           MissBGJTable3
;           MissBGJTable4
;           MissBGJTable5
;
;
; Output:
;   lastballin_flag
;   drawdoneflag
;   BallAnimationCounter2
;   SecondBallStartFlag
;   ShotStatus2
;   NumBalls2
;   BallAnimationCounter
;
; Purpose:
;   Draw first half of ball animation

DrawBallAnimation2
; Input: backgroundnumber
;        ShotStatus
;        BallAnimationCounter2
;        SecondBallStartFlag
;        ShotStatus2
;        NumBalls2
;        BallAnimationCounter
;     Tables:
;           BallAnimationTable
;           ScaleTable
;           MissBGJTable1
;           ScaleTableBck
;           ScaleTableFwd
;           MissBGJTable2
;           MissBGJTable3
;           MissBGJTable4
;           MissBGJTable5
;
;
; Output:
;   SecondBallStartFlag
;   drawdoneflag
;
;
; Purpose:
;   Draw second half of ball animation

DrawHeldBall
;Input:none
;Output:none
;Purpose:
;  Draw ball with player standing still
 

EndofRack
;Inputs: drawdoneflag
;Outputs: EndGameFlag
;Purpose:
;     Change background, and set flag if game over

InputName
;Input: player name
;Output: PlayerNameArray
;Purpose:
;   Store players name in PlayerNameArray2

UpdateClock
;Inputs
;      variable-clockcount
;Outputs: Draws shot clock
;Purpose:
;  Draw Shot Clock

UpdateScore
;Inputs:
;    MyScore
;         PlayerNumber
;Outputs:
;    Draws Score on bottom of screen
;Purpose:
;   Updates the score display

Menus
;Input: Keyboard stroke
;Ouput: Draw Menu to screen
;Purpose:
;   Navigate through menus

LoadBackground
; Input:
;     variable-backgroundnumber
;     Lookup Table: BGJtable
; Output:
;   Loads selected background to memory
; Purpose:
;   Load background backgroundnumber into memory

LoadBall
; Input: none
; Output:
;   Loads image in BallArray
; Purpose:
;   Set up registers for ball image and call LoadPCX

LoadBigPics
Input: None
;Output:
;   Picture Loaded in BigPic Array
;Uses:
;   Lookup Table: BigPicLoadJTable
;Purpose:
;   Set up registers for big pics
;   and call LoadPCX

LoadDigits
;Inputs: none
;Outputs: none
;Purpose:
;   Load images of digits into Digitarray by
;   setting up registers and calling LoadPCX

LoadGO
; Input: none
; Output: none
; Purpose:
;  Set up registers for Game Over Pic and call LoadPCX

LoadGrabAnimation
;Inputs:none
;Uses: LookupTable: GrabJTable
;Outputs:none
;Purpose:
;   Set up registers for Grab Animations and call LoadPCX

LoadLittleDigits
;Inputs: none
;Outputs: none
;Purpose:
;   Load images of digits into Digitarray by
;   setting up registers and calling LoadPCX

LoadPCX  (Borrowed, but modified from 291 manual)
;       Loads and decodes a PCX file into memory and sets VGA Palette
;       registers to those used by the image.
;Inputs: ax Segment in memory where image content should be written.
;        dx Offset of a null-terminated string containing the filename.
;        di Offset of destination
;        BX Size of image
;Output: Fills destination with image data.
;        Fills VGA palette registers with image colors.
;        Uses ScratchPad to hold compressed image data.

Loadplayerpic
; Input: none
; Output:
;   Loads image in playerpic
; Purpose:
;   Set up registers for player image and call LoadPCX

LoadPreJPics
Inputs:none
;Uses: LookupTable: PreJLoadJTable
;Outputs:none
;Purpose:
;   Set up registers for Jump Animations and call LoadPCX

LoadSCPCX
; Input: none
; Output:
;   Loads image in scarray
; Purpose:
;   Set up registers for Shot Clock image and call LoadPCX