Merge pull request #1 from larsbrinkhoff/master
[hattrick-7800.git] / HOCKEY.SCR
1 ( HOCKEY HI-LEVEL MAF JDS KAL PMA JJT          16:09 08/27/87 ) ( Last change:   Screen  027               MAF 10:09 04/09/87 )                                                                 .NOLIST                                                         -HEADERS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ( SQUARE TABLE  1/2                            12:41 02/12/87 ) DECIMAL L: SQUARE-TABLE                                         00000 , 00001 , 00004 , 00009 , 00016 , 00025 , 00036 ,         00049 , 00064 , 00081 , 00100 , 00121 , 00144 , 00169 ,         00196 , 00225 , 00256 , 00289 , 00324 , 00361 , 00400 ,         00441 , 00484 , 00529 , 00576 , 00625 , 00676 , 00729 ,         00784 , 00841 , 00900 , 00961 , 01024 , 01089 , 01156 ,         01225 , 01296 , 01369 , 01444 , 01521 , 01600 , 01681 ,         01764 , 01849 , 01936 , 02025 , 02116 , 02209 , 02304 ,         02401 , 02500 , 02601 , 02704 , 02809 , 02916 , 03025 ,         03136 , 03249 , 03364 , 03481 , 03600 , 03721 , 03844 ,         03969 , 04096 , 04225 , 04356 , 04489 , 04624 , 04761 ,         04900 , 05041 , 05184 , 05329 , 05476 , 05625 , 05776 ,         05929 , 06084 , 06241 , 06400 , 06561 , 06724 , 06889 ,         07056 , 07225 , 07396 , 07569 , 07744 , 07921 , 08100 ,         08281 , 08464 , 08649 , 08836 , 09025 , 09216 , 09409 ,         ( SQUARE TABLE  2/2                            12:41 02/12/87 ) 09604 , 09801 , 10000 , 10201 , 10404 , 10609 , 10816 ,         11025 , 11236 , 11449 , 11664 , 11881 , 12100 , 12321 ,         12544 , 12769 , 12996 , 13225 , 13456 , 13689 , 13924 ,         14161 , 14400 , 14641 , 14884 , 15129 , 15376 , 15625 ,         15876 , 16129 , 16384 , 16641 , 16900 , 17161 , 17424 ,         17689 , 17956 , 18225 , 18496 , 18769 , 19044 , 19321 ,         19600 , 19881 , 20164 , 20449 , 20736 , 21025 , 21316 ,         21609 , 21904 , 22201 , 22500 , 22801 , 23104 , 23409 ,         23716 , 24025 , 24336 , 24649 , 24964 , 25281 , 25600 ,         25921 , 26244 , 26569 , 26896 , 27225 , 27556 , 27889 ,         28224 , 28561 , 28900 , 29241 , 29584 , 29929 , 30276 ,         30625 , 30976 , 31329 , 31684 , 32041 , 32400 , 32761 ,         33124 , 33489 , 33856 , 34225 , 34596 , 34969 , 35344 ,         35721 , 36100 , 36481 , 36864 , 37249 , 37636 , 38025 ,         38416 , 38809 , 39204 , 39601 , 40000 ,                         ( RAM LOCATIONS FOR GAME PLAY                  11:18 02/05/87 ) : SQUARE 2* SQUARE-TABLE + @ ;                                                                                                  END-TABLE-PLUG 3 + EQU PLAYER1                                  PLAYER1 15 + EQU PLAYER2                                        PLAYER2 15 + EQU puck                                           puck    15 + EQU SCORE1                                         SCORE1   2 + EQU SCORE2                                         SCORE2   2 + EQU SAVES1                                         SAVES1   2 + EQU SAVES2                                         SAVES2   2+  EQU WHIZ-DONE                                      WHIZ-DONE 2 + EQU WHIZ-COUNT                                                                                                                                                                                                                                                                                                    (                                              12:00 02/19/87 ) WHIZ-COUNT 2+  EQU DX                                           DX 2+          EQU DY                                           DY 2+          EQU SHOOTFLAG1                                   SHOOTFLAG1 2+  EQU SHOOTFLAG2                                   SHOOTFLAG2 2+  EQU OLDJOY1                                      OLDJOY1 1+     EQU OLDJOY2                                      OLDJOY2 1+     EQU SKILL                                        SKILL   1+     EQU GOALIE1-Y                                    GOALIE1-Y 2+   EQU GOALIE2-Y                                    GOALIE2-Y 2+   EQU CYCLE#                                       CYCLE# 2+      EQU OLD-XY                                       OLD-XY 4 +     EQU END-OF-RAM                                                                                                                                                                                                                                   ( ANIMATION TABLES                             13:03 02/12/87 ) ( ADDRESSED BY ORIENTATION * 4 + ANIMATION 3 AND + )            L: PLAYER2-IMAGES                                               RPFE  C, RPFER  C, RPFE  C, RPFEL  C,                           RPFNE C, RPFNER C, RPFNE C, RPFNEL C,                           RPFN  C, RPFNR  C, RPFN  C, RPFNL  C,                           RPFNW C, RPFNWR C, RPFNW C, RPFNWL C,                           RPFW  C, RPFWR  C, RPFW  C, RPFWL  C,                           RPFSW C, RPFSWR C, RPFSW C, RPFSWL C,                           RPFS  C, RPFSR  C, RPFS  C, RPFSL  C,                           RPFSE C, RPFSER C, RPFSE C, RPFSEL C,                                                                                                                                                                                                                                                                                                                                                           ( ANIMATION TABLES                             13:03 02/12/87 ) ( ADDRESSED BY ORIENTATION * 4 + ANIMATION 3 AND + )            L: PLAYER1-IMAGES                                               BPFE  C, BPFER  C, BPFE  C, BPFEL  C,                           BPFNE C, BPFNER C, BPFNE C, BPFNEL C,                           BPFN  C, BPFNR  C, BPFN  C, BPFNL  C,                           BPFNW C, BPFNWR C, BPFNW C, BPFNWL C,                           BPFW  C, BPFWR  C, BPFW  C, BPFWL  C,                           BPFSW C, BPFSWR C, BPFSW C, BPFSWL C,                           BPFS  C, BPFSR  C, BPFS  C, BPFSL  C,                           BPFSE C, BPFSER C, BPFSE C, BPFSEL C,                                                                                                                                                                                                                                                                                                                                                           ( 256/ 256*                                    13:46 08/27/87 ) CODE 256/        ( note: ROUNDS & UNSIGNED! jjt)                     TOS 1+ LDY                                                      TOS LDA 0< IF INY THEN                                          TOS STY                                                         0 # LDA TOS 1+ STA                                              NEXT JMP END-CODE                                                                                                          CODE 256*                                                            TOS    LDA                                                      TOS 1+ STA                                                      TOS    STY                                                      NEXT JMP END-CODE                                                                                                                                                                                                                                          ( HOCKEY LIMIT PARAMETERS/EQUATES              13:50 02/19/87 ) DECIMAL                                                          4          EQU DIAM       ( PUCK DIAMETER )                    33          EQU LOG(FAT)   ( GIRTH OF PLAYER )                  30 ( 30 )   EQU PUCK-STICK-THRESHOLD                            120         EQU PLAYER-PLAYER-THRESHOLD                         08  256 *   EQU LEFT-LINE    151 256 *   EQU RIGHT-LINE         40  256 *   EQU TOP-LINE     184 256 *   EQU BOTTOM-LINE        TOP-LINE 50 256 *  +     EQU GOAL-TOP                           BOTTOM-LINE  52 256 *  - EQU GOAL-BOTTOM                        LEFT-LINE 5 256 *  -     EQU GOAL-LEFT                          RIGHT-LINE 5 256 *  +    EQU GOAL-RIGHT                         12 256 *                 EQU GOAL-HEIGHT ( 24)                   6                       EQU GOAL-WIDTH                         LEFT-LINE   GOAL-WIDTH 256 * +  EQU      GOAL1-X                RIGHT-LINE  GOAL-WIDTH 1 + 256 * -  EQU      GOAL2-X            (                                              18:20 05/11/87 ) 08  EQU LEFT-LINEH    151 EQU RIGHT-LINEH                       40  EQU TOP-LINEH     184 EQU BOTTOM-LINEH                      TOP-LINEH 50 + EQU GOAL-TOPH                                    BOTTOM-LINEH  52 - EQU GOAL-BOTTOMH                             LEFT-LINEH 5 - EQU GOAL-LEFTH                                   RIGHT-LINEH 5 + EQU GOAL-RIGHTH                                 12 EQU GOAL-HEIGHTH ( 24)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ( ANIMATOR    1/2       rev. jjt               09:03 08/27/87 )                                                                 : ANIMATOR                                                        PLAYER2 @XY V256/ REDD-Y C! REDD-X C!                           PLAYER2 @ORIENTATION 2* 2*  PLAYER2-IMAGES +                    DX1 C@ DY1 C@ OR PLAYER2 @FLAG 2 AND OR IF                          PLAYER2-FEET C@ DUP 1+ PLAYER2-FEET C! 3 AND +                 DUP    3 AND 0= WHIZ-COUNT C@ 0= AND IF SKRITCH-SND THEN        THEN     ( no skritching while whizzing...)                  PLAYER1 @XY V256/ BLUE-Y C! BLUE-X C!                           PLAYER1 @ORIENTATION 2* 2*  PLAYER1-IMAGES +                    DX0 C@ DY0 C@ OR PLAYER1 @FLAG 2 AND OR IF                         PLAYER1-FEET C@ DUP 1+ PLAYER1-FEET C! 3 AND +                  DUP 2+ 3 AND 0= WHIZ-COUNT C@ 0= AND IF SKRITCH-SND THEN        THEN     ( and less often at that! )                         puck @XY V256/ PUCK-Y C! PUCK-X C!                            ( ANIMATOR   2/2                               13:10 02/12/87 )    BEGIN ?VBLANK UNTIL                                               BLUE-ERASE BLUE-GOALY-ERASE BLUE-PLAYER-FRAME                 BEGIN ?VBLANK 0= UNTIL                                          BEGIN ?VBLANK UNTIL                                             PUCK-ERASE PUCK-FRAME                                           REDD-ERASE REDD-GOALY-ERASE REDD-PLAYER-FRAME ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ( GENERATE SQUARE TABLE                        13:30 02/05/87 ) 0 .IF                                                           VARIABLE LINE# VARIABLE BLOCK#                                  : MAKE-SQUARES  179 BLOCK# ! 2 LINE# !                            0 BEGIN                                                               DUP 7 MOD 0= IF 1 LINE# +!                                         LINE# @ 15 > IF 1 LINE# ! 1 BLOCK# +! THEN  THEN             DUP DUP * 0 <# # # # # # #>  ( N ADDR COUNT )                   BLOCK# @ BLOCK UPDATE                                           LINE# @ 64 * +   ( N ADDR COUNT ADDR )                          3 PICK 7 MOD  8 * + DUP >R SWAP CMOVE                           ASCII , R> 6 + C!                                          1+ DUP 200 > UNTIL DROP FLUSH ;                                                                                              .THEN                                                                                                                           ( ANGLE                                        11:08 02/05/87 ) L:     ANGLE-TAB 0 C, 6 C, 0 C, 2 C, 4 C, 6 C, 4 C, 2 C,                         7 C, 7 C, 1 C, 1 C, 5 C, 5 C, 3 C, 3 C,          0 .IF                                                         : ANGLE ( X1 Y1 X2 Y2 ---- a ) ( algorithm courtesy Lee Actor)                                 ( Bally Sente  )                   ROT - DY !   SWAP - DX !  ( Calculate deltax, deltay )          0 DX @ DUP 0< IF NEGATE DX ! 4 OR ELSE DROP THEN                  DY @ DUP 0< IF NEGATE DY ! 2 OR ELSE DROP THEN                DY @ DX @ > IF 1 OR                                               DY @ DX @ 2* < IF 8 OR THEN                                   ELSE                                                              DX @ DY @ 2* < IF 8 OR THEN                                   THEN                                                            ANGLE-TAB + C@ ;                                                     .THEN                                                    ( ANGLE JDS                                    11:10 03/23/87 ) CODE (ANGLE) ( X1 Y1 X2 Y2 ---- a )                             SEC TOS LDA TOS 4 + SBC DY STA                                  TOS 1+  LDA TOS 5 + SBC DY 1+ STA ( DELTA Y FOUND )             SEC TOS 2+ LDA TOS 6 + SBC DX STA                               TOS 3 +    LDA TOS 7 + SBC DX 1+ STA ( DELTA X FOUND )          TXA CLC 6 # ADC TAX TYA PHA  ( PTR BYTE & XTRA STK)             DX 1+ LDA 0< IF SEC TYA DX SBC DX STA TYA DX 1+ SBC DX 1+ STA     PLA 4 # ORA PHA THEN ( IF LESS THAN 0 , TURN POSITIVE )       DY 1+ LDA 0< IF SEC TYA DY SBC DY STA TYA DY 1+ SBC DY 1+ STA     PLA 2 # ORA PHA THEN ( IF LESS THAN 0 , TURN POSITIVE )       SEC DX LDA DY SBC DX 1+ LDA DY 1+ SBC ( CS: X >= Y ELSE Y > X )   CS NOT                   IF PLA 1 # ORA PHA                   DX 1+ LDA TOS 1+ STA DX LDA TOS STA TOS ASL TOS 1+ ROL ( DX 2*)   SEC DY LDA TOS SBC DY 1+ LDA TOS 1+ SBC CS NOT IF ( DY<DX2*)    PLA 8 # ORA PHA THEN     ELSE                                 ( ANGLE JDS 2/2                                11:10 03/23/87 ) DY 1+ LDA TOS 1+ STA DY LDA TOS STA TOS ASL TOS 1+ ROL ( DY 2*)   SEC DX LDA TOS SBC DX 1+ LDA TOS 1+ SBC CS NOT IF ( DX<DY2*)    PLA 8 # ORA PHA  THEN     THEN                                                                                                  ANGLE-TAB >HI # LDA TOS 1+ STA                                  ANGLE-TAB >LO # LDA TOS    STA                                  PLA CLC TOS ADC TOS STA CS IF TOS 1+ INC THEN                   TOS X) LDA TOS STA TOS 1+ STY RTS END-CODE                                                                                    CODE ANGLE ' (ANGLE) >BODY JSR NEXT JMP END-CODE                                                                                                                                                                                                                                                                                                                                                ( structures for players and puck              11:13 02/05/87 ) (      2 = COMPUTER CONTROL )                                   : @TIMER      10 + C@ ;                                         : !TIMER      10 + C! ;                                         : @SHOOT-COUNT 12 + C@ ;                                        : !SHOOT-COUNT 12 + C! ;                                        : @POSSESSION  13 + C@ ;                                        : !POSSESSION  13 + C! ;                                        : @ANIMATION   14 + C@ ;                                        : !ANIMATION   14 + C! ;                                                                                                                                                                                                                                                                                                                                                                                                                                        (                                              13:28 02/20/87 ) PROC X2@  ( ADDR -- D )                                            TOS LDA N STA TOS 1+ LDA N 1+ STA 0 # LDY                       DEX DEX  N )Y LDA  TOS     STA                                      INY  N )Y LDA  TOS 1+  STA                                      INY  N )Y LDA  TOS 2+  STA                                      INY  N )Y LDA  TOS 3 + STA                                  NEXT JMP END-PROC                                                                                                            PROC X2!  ( D ADDR -- )                                            TOS LDA N STA TOS 1+ LDA N 1+ STA 0 # LDY                       INX INX TOS LDA N )Y STA                                        INX INY TOS LDA N )Y STA                                        INX INY TOS LDA N )Y STA                                        INX INY TOS LDA N )Y STA INX                                    NEXT JMP END-PROC                                            ( @XY !XY @VELOCITY !VELOCITY                  13:51 02/20/87 ) CODE @XY ( : @XY 4 + 2@    ; ( PLAYER --- X Y )                          CLC 4 # LDA TOS ADC TOS STA                                         TYA TOS 1+ ADC TOS 1+ STA                                       X2@ JMP                                                         END-CODE                                           CODE !XY ( : !XY 4 + 2!    ; ( X Y PLAYER ---- )                         CLC 4 # LDA TOS ADC TOS STA                                         TYA TOS 1+ ADC TOS 1+ STA                                       X2! JMP                                                         END-CODE                                           CODE  @VELOCITY  X2@ JMP END-CODE                               CODE  !VELOCITY  X2! JMP END-CODE                                                                                                                                                                                                                               ( XC@ XC! @OREINTATION !ORIENTATION            14:00 02/20/87 ) PROC XC@        TOS X) LDA   TOS STA                                            TOS 1+ STY  NEXT JMP                                            END-PROC                                        PROC XC!        NOS LDA   TOS X) STA                                            POP2 JMP                                                        END-PROC                                        CODE @ORIENTATION                                                     CLC 8 # LDA TOS ADC TOS STA                                     CS IF TOS 1+ INC THEN                                           XC@ JMP END-CODE                                          CODE !ORIENTATION                                                     CLC 8 # LDA TOS ADC TOS STA                                     CS IF TOS 1+ INC THEN                                           XC! JMP END-CODE                                                                                                          ( @FLAG  !FLAG  THUMP DECIMAL-INC              12:24 04/06/87 ) CODE @FLAG                                                            CLC 9 # LDA TOS ADC TOS STA                                     CS IF TOS 1+ INC THEN                                           XC@ JMP END-CODE                                                                                                          CODE !FLAG                                                            CLC 9 # LDA TOS ADC TOS STA                                     CS IF TOS 1+ INC THEN                                           XC! JMP END-CODE                                                                                                          CODE DECIMAL-INC TOS X) LDA SED CLC 1 # ADC CLD TOS X) STA                 INX INX NEXT JMP END-CODE                                                                                                                                                                                                                            ( RIGHT-LINE-CHECK                         MAF 10:05 04/09/87 ) 0  .IF                                                          : RIGHT-LINE-CHECK  ( X Y --- RX TRUE/ FALSE   )                  OVER RIGHT-LINE U< IF 2DROP 0 EXIT THEN                         puck @VELOCITY SWAP NEGATE SWAP puck !VELOCITY                  DUP GOAL-TOP U< IF 2DROP                                           [ RIGHT-LINE DIAM 256 * - ] LITERAL -1 EXIT THEN             DUP GOAL-BOTTOM U> IF 2DROP                                        [ RIGHT-LINE DIAM 256 * - ] LITERAL -1 EXIT THEN             DROP ( X ) GOAL-RIGHT > IF  0. puck !VELOCITY                      [ GOAL-RIGHT DIAM 256 * - ] LITERAL -1 ELSE 0 THEN ;                                                                                                                                                                                                                                                                                                                                       ( LEFT-LINE-CHECK                              22:13 02/09/87 ) : LEFT-LINE-CHECK  ( X Y --- LX TRUE/ FALSE   )                   OVER LEFT-LINE U> IF 2DROP 0 EXIT THEN                          puck @VELOCITY SWAP NEGATE SWAP puck !VELOCITY                  DUP GOAL-TOP U< IF 2DROP LEFT-LINE  -1 EXIT THEN                DUP GOAL-BOTTOM U> IF 2DROP LEFT-LINE  -1 EXIT THEN             DROP ( X ) GOAL-LEFT > IF 0. puck !VELOCITY                          GOAL-LEFT  -1 ELSE 0 THEN ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ( CHECK-PUCK-COLLISION                     MAF 10:05 04/09/87 ) : CHECK-PUCK-COLLISION                                            puck @XY DUP                                                    TOP-LINE U<                                                          IF DROP TOP-LINE 512 + puck !XY                                 puck @VELOCITY NEGATE puck !VELOCITY BOUNCE-SND ELSE DUP   BOTTOM-LINE DIAM 256* - U>                                           IF DROP BOTTOM-LINE DIAM 256* - puck !XY                        puck @VELOCITY NEGATE puck !VELOCITY BOUNCE-SND ELSE 2DUP  RIGHT-LINE-CHECK                                                     IF ROT DROP SWAP puck !XY            BOUNCE-SND ELSE 2DUP  LEFT-LINE-CHECK                                                      IF ROT DROP SWAP puck !XY           BOUNCE-SND ELSE 2DROP  THEN THEN THEN THEN ;                                                                                                         .THEN                                                           ( SOUNDS ENTRANT FROM ASSEMBLY                 14:48 05/13/87 ) PROC (PL/EDGE-SND)                                                 L-PL/EDGE  # LDA ' START-SOUND >BODY JSR RTS END-PROC        PROC (BOUNCE-SND)                                                  L-BOUNCE   # LDA ' START-SOUND >BODY JSR RTS END-PROC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ( PUCK COLLISION                           MAF 10:05 04/09/87 )                                                                 PROC NEGATE-YVELOCITY 0 # LDY                                        0 # LDA SEC OBJECT )Y     SBC OBJECT )Y    STA  INY             0 # LDA     OBJECT )Y     SBC OBJECT )Y    STA                  RTS END-PROC                                                                                                               PROC NEGATE-XVELOCITY  2 # LDY                                       0 # LDA SEC OBJECT )Y     SBC OBJECT )Y      STA     INY        0 # LDA     OBJECT )Y     SBC OBJECT )Y      STA                RTS END-PROC                                                                                                               CODE (NEGATE-YVELOCITY) NEGATE-YVELOCITY JSR NEXT JMP END-CODE  CODE (NEGATE-XVELOCITY) NEGATE-XVELOCITY JSR NEXT JMP END-CODE                                                                                                                                  ( PUCK COLLISIONS CONTINUED                    11:32 04/08/87 ) -1 .IF                                                          CODE CHECK-PUCK-COLLISION                                            puck >HI # LDA OBJECT 1+ STA                                    puck >LO # LDA OBJECT    STA                                    puck 5 + LDA ( Y ) TOP-LINEH # CMP                              CS NOT IF TOP-LINEH # LDA puck 5 + STA                      (BOUNCE-SND) JSR   NEGATE-YVELOCITY JSR                        0 # LDY  OBJECT )Y LDA SEC 1 # SBC OBJECT )Y STA NEXT JMP THEN       BOTTOM-LINEH DIAM - # CMP                                       CS IF BOTTOM-LINEH DIAM - # LDA puck 5 + STA                (BOUNCE-SND) JSR   NEGATE-YVELOCITY JSR                            0 # LDY  OBJECT )Y LDA CLC 1 # ADC OBJECT )Y STA                                                            NEXT JMP THEN                                                                                                                                   ( PUCK COLLISION RIGHT SIDE                    11:35 04/08/87 )                                                                      puck 7 + LDA ( X ) RIGHT-LINEH # CMP                            CS     IF puck 5 + LDA GOAL-TOPH # CMP ( IN THE GOAL?)                 ( NO ) CS NOT IF NEGATE-XVELOCITY JSR                    (BOUNCE-SND) JSR        RIGHT-LINEH DIAM - DIAM -  # LDA                     puck 7 + STA NEXT JMP THEN                                GOAL-BOTTOMH # CMP                                              CS IF NEGATE-XVELOCITY JSR (BOUNCE-SND) JSR              RIGHT-LINEH DIAM - DIAM - # LDA puck 7 + STA NEXT JMP THEN         (   puck 7 + LDA ( X ) ( GOAL-RIGHTH # CMP     )               ( 0< NOT IF ) 0 # LDA puck STA puck 1+ STA puck 2+ STA                      puck 3 + STA ( 0 VELOCITY)                                      RIGHT-LINEH DIAM + # LDA                                        puck 7 + STA ( THEN ) THEN                                                                                   ( PUCK COLLISION LEFT  SIDE                MAF 10:09 04/09/87 )      puck 7 + LDA ( X ) LEFT-LINEH # CMP                             CS NOT IF puck 5 + LDA GOAL-TOPH # CMP ( IN THE GOAL?)                 ( NO ) CS NOT IF NEGATE-XVELOCITY JSR                    (BOUNCE-SND) JSR        LEFT-LINEH #  LDA  puck 7 + STA                      NEXT JMP THEN                                             GOAL-BOTTOMH # CMP                                              CS IF  NEGATE-XVELOCITY JSR (BOUNCE-SND) JSR                                                LEFT-LINEH  # LDA                         puck 7 + STA NEXT JMP THEN ( GOAL!)                (  puck 7 + LDA ( X ) ( GOAL-LEFTH # CMP )                   (   CS IF ) 0 # LDA puck STA puck 1+ STA puck 2+ STA                                puck 3 + STA ( 0 VELOCITY)                                      GOAL-LEFTH # LDA                                           puck 7 + STA ( THEN ) THEN NEXT JMP END-CODE   .THEN                                                           ( CHECK-PUCK-GOALIE                            21:36 02/22/87 ) : CHECK-PUCK-GOALIE   puck @XY                                    DUP GOALIE1-Y @ 1+ U> OVER GOALIE1-Y @ GOAL-HEIGHT + U< AND     2 PICK GOAL1-X U< AND IF                                        2DROP puck @VELOCITY SWAP NEGATE SWAP                             puck !VELOCITY SAVES1 DECIMAL-INC UPDATE-SCORE SAVE-SND         puck @XY SWAP DROP GOAL1-X                                           SWAP puck !XY  ELSE                                      DUP GOALIE2-Y @ 1+ U> SWAP GOALIE2-Y @ GOAL-HEIGHT + U< AND     SWAP GOAL2-X U> AND IF                                            puck @VELOCITY SWAP NEGATE SWAP                                 puck !VELOCITY SAVES2 DECIMAL-INC UPDATE-SCORE SAVE-SND         puck @XY SWAP DROP  GOAL2-X                                          SWAP puck !XY                                            THEN  THEN  ;                                                                                                                 (                                              11:06 04/09/87 ) ( : V- ROT SWAP - >R - R> ;  )                                  ( : V+ ROT + >R + R> ;  )                                       CODE V+  ( V1 V2 ---- V1+V2 )                                        CLC TOS LDA NOS 2+ ADC NOS 2+ STA                                   TOS 1+ LDA NOS 3 + ADC NOS 3 + STA                          CLC NOS LDA NOS 4 + ADC NOS 4 + STA                                 NOS 1+ LDA NOS 5 + ADC NOS 5 + STA                          POP2 JMP END-CODE                                                                                                          CODE V- ( V1 V2 ---- V1-V2 )                                         SEC NOS 2+ LDA TOS SBC NOS 2+ STA                                   NOS 3 + LDA TOS 1+ SBC NOS 3 + STA                          SEC NOS 4 + LDA NOS SBC NOS 4 + STA                                 NOS 5 + LDA NOS 1+ SBC NOS 5 + STA                          POP2 JMP END-CODE                                          ( NORM-SQ as PROC                              11:59 04/09/87 ) ( : NORM-SQ  ABS SQUISH SQUARE SWAP ABS SQUISH SQUARE +  ;  )                                                                   PROC (NORM-SQ)                                                       TOS 1+ LDA  0< IF  ( ABS )                                         SEC TYA TOS SBC TOS STA TYA TOS 1+ SBC TOS 1+ STA THEN       6 # LDY  ( SQUISH- 7 0 DO 2/ LOOP 2* SQUARE + )            1$:  TOS 1+ LSR TOS ROR DEY  1$ BNE                                  TOS LDA 254 # AND TOS STA                                       CLC SQUARE-TABLE >LO # LDA TOS ADC N STA                            SQUARE-TABLE >HI # LDA TOS 1+ ADC N 1+ STA                  N )Y LDA TOS STA INY N )Y LDA TOS 1+ STA                                                                                                                                                                                                                                                                                   (                                              14:32 04/09/87 )      NOS 1+ LDA  0< IF SEC 0 # LDY                                          TYA NOS SBC NOS STA TYA NOS 1+ SBC                              NOS 1+ STA THEN                                          6 # LDY  ( SQUISH-1 TO GO TO SQUARE )                      2$:  NOS 1+ LSR NOS ROR DEY  2$ BNE                                  NOS LDA 254 # AND NOS STA                                       CLC SQUARE-TABLE >LO # LDA NOS    ADC N    STA                      SQUARE-TABLE >HI # LDA NOS 1+ ADC N 1+ STA                  CLC N )Y LDA  TOS ADC NOS STA                                   INY N )Y LDA  TOS 1+ ADC NOS 1+ STA                             INX INX RTS  ( POP JMP )  END-PROC                                                                                         CODE NORM-SQ (NORM-SQ) JSR NEXT JMP END-CODE                                                                                                                                                    ( NORM-SQ2                                     14:33 04/09/87 ) ( : NORM-SQ2 ABS 256/   SQUARE SWAP ABS 256/   SQUARE +  ; )                                                                    CODE NORM-SQ2                                                        TOS 1+ LDA  0< IF  ( ABS )                                         SEC TYA TOS SBC TOS STA TYA TOS 1+ SBC TOS 1+ STA THEN       7 # LDY  ( SQUISH- 7 0 DO 2/ LOOP 2* SQUARE + )            1$:  TOS 1+ LSR TOS ROR DEY  1$ BNE                                  TOS LDA 254 # AND TOS STA                                       CLC SQUARE-TABLE >LO # LDA TOS    ADC N    STA                      SQUARE-TABLE >HI # LDA TOS 1+ ADC N 1+ STA                  N )Y LDA TOS STA INY N )Y LDA TOS 1+ STA                                                                                                                                                                                                                                                                                   (                                              14:32 04/09/87 )      NOS 1+ LDA  0< IF SEC 0 # LDY                                          TYA NOS SBC NOS STA TYA NOS 1+ SBC                              NOS 1+ STA THEN                                          7 # LDY  ( SQUISH-1 TO GO TO SQUARE )                      2$:  NOS 1+ LSR NOS ROR DEY  2$ BNE                                  NOS LDA 254 # AND NOS STA                                       CLC SQUARE-TABLE >LO # LDA NOS    ADC N    STA                      SQUARE-TABLE >HI # LDA NOS 1+ ADC N 1+ STA                  CLC N )Y LDA  TOS ADC NOS STA                                   INY N )Y LDA  TOS 1+ ADC NOS 1+ STA                             POP JMP END-CODE                                                                                                                                                                                                                                                                                                           ( DECAY1   puck decelleration                  15:03 04/09/87 ) ( : DECAY1 DUP 0< SWAP ABS DUP -4 SHIFT - SWAP IF NEGATE THEN ;)CODE DECAY1                                                          TOS 1+ LDA  0< IF  ( ABS ) 255 # LDA N 3 + STA                     SEC TYA TOS SBC TOS STA TYA TOS 1+ SBC TOS 1+ STA            ELSE 00 # LDA N 3 + STA THEN                                    TOS LDA N STA TOS 1+ LDA N 1+ STA                               5 # LDY 1$: N 1+ LSR N ROR DEY 1$ BNE                           SEC TOS LDA N SBC TOS STA                                           TOS 1+ LDA N 1+ SBC TOS 1+ STA                              N 3 + LDA 0< IF  ( FIX SIGN UP )                                    SEC TYA TOS SBC TOS STA                                         TYA TOS 1+ SBC                                                  TOS 1+ STA THEN                                             NEXT JMP END-CODE                                                                                                          ( DECAY2   player decelleration  as CODE       15:14 04/09/87 ) ( : XDECAY2 DUP 0< SWAP ABS DUP 5  SHIFT SWAP 2* - -5 SHIFT             SWAP IF NEGATE THEN ; )                                 CODE DECAY2                                                          (DECAY2) JSR NEXT JMP END-CODE                                                                                             ( SLOW-DOWN-PUCK DECAY2                        11:10 02/09/87 ) : SLOW-DOWN-PUCK puck @VELOCITY  2DUP NORM-SQ 25 >                                                            IF DECAY1 SWAP      DECAY1 SWAP puck !VELOCITY ELSE 2DROP THEN ;                                                                                                                                                                                                                                                                                                                                                                                                                  ( DECAY2   player decelleration  as PROC       15:14 04/09/87 ) ( : DECAY2 DUP 0< SWAP ABS DUP 5  SHIFT SWAP 2* - -5 SHIFT              SWAP IF NEGATE THEN ; )                                 PROC (DECAY2)                                                        TOS 1+ LDA  0< IF  ( ABS ) 255 # LDA N 3 + STA                     SEC TYA TOS SBC TOS STA TYA TOS 1+ SBC TOS 1+ STA            ELSE 00 # LDA N 3 + STA THEN                                    TOS LDA N STA TOS 1+ LDA N 1+ STA                               4 # LDY 1$: N ASL N 1+ ROL  DEY 1$ BNE                          TOS ASL TOS 1+ ROL  ( 2* )                                      SEC  N LDA TOS SBC TOS STA                                           N 1+ LDA TOS 1+ SBC TOS 1+ STA                             4 # LDY 2$: TOS 1+ LSR TOS ROR DEY 2$ BNE ( -5 SHIFT )          N 3 + LDA 0< IF  ( FIX SIGN UP )                                    SEC TYA TOS SBC TOS STA                                         TYA TOS 1+ SBC TOS 1+ STA THEN RTS END-PROC            ( THUMP V256/ rounds it!  JJT                  09:27 08/27/87 ) ( : SQUISH 7 0 DO 2/ LOOP ; : UNSQUISH 7 SHIFT ; )              : RANDOM-SOUNDS                                                     CYCLE# C@ 63 AND 0= IF  (RANDOM-SOUND) THEN ;               : (RANDOM-SOUND)    SYSTIMER C@ 3 AND  CASE                     0  OF  BUGLE-SND   ENDOF                                        1  OF  HIWOLF-SND  ENDOF                                        2  OF  LOWOLF-SND  ENDOF                                        3  OF  UPWHIS-SND  ENDOF                                               UPWHIS-SND ENDCASE  ;                                    CODE V256/    ( N1 N2 --- N1/256 N2/256 modified--rounded)           TOS 1+ LDY TOS LDA 0< IF INY THEN TOS STY                       NOS 1+ LDY NOS LDA 0< IF INY THEN NOS STY                       0 # LDA TOS 1+ STA NOS 1+ STA                                   NEXT JMP END-CODE                                                                                                          (  SCALE VSCALE V* RESOLVE forget this!!       09:27 08/27/87 ) 0 .IF                                                           : <IP> ROT * >R * R> + ;                                        : SCALE ( A B-- A ) 0 DO 2/ LOOP ;                              : VSCALE ( A B C-- A B )                                          ROT  ( B C A )        OVER ( B C A C )      SCALE ( B C A )     ROT  ( C A B )        ROT  ( A B C )        SCALE ; ( A B )   : V*                                                              ROT OVER * ROT ROT * ;                                        : RESOLVE ( EXPANDED IN LINE...SEE NEXT SCREEN )                  2OVER ROT * >R * R> +                                           LOG(FAT) 0 DO 2/ LOOP                                           ROT OVER * ROT ROT * LOG(FAT)                                   ROT OVER 0 DO 2/ LOOP                                           ROT ROT 0 DO 2/ LOOP ;                                          .THEN                                                         ( resolve                                      17:15 08/24/87 ) 0 .IF                                                                 /|                                                          v  / |                                                            /  |                                                           /   |                                                          /    |                                                         /----->----------------------->                                 <a,v>a                  a                                      : RESOLVE ( a v--<a,v>a) 2OVER <IP> LOG(FAT) SCALE                                               V* LOG(FAT) VSCALE ;           ( This calculation assumes that the norm or length of )         (   a = ball diameter.  Accuracy of the calculation varies )    (   to the degree that this assumption is true.  )                   .THEN                                                                                                                      ( COLLIDE                                      17:16 08/24/87 ) ( calculate and store new velocities for PLAYER1 AND PLAYER2      when they collide. Assumed they are currently touching )      0 .IF  : COLLIDE (  -- )                                          PLAYER1 @VELOCITY PLAYER2 @VELOCITY PLAYER2 @XY  PLAYER1 @XY    V-  ( vx1 vy1 vx2 vy2 Dx Dy--)                                  2DUP NEGATE 2SWAP  ( 90-ROT )                                   >R >R 2SWAP RESOLVE  2SWAP           ( v1 v2 b1 )               R> R> 2SWAP RESOLVE  V+              ( <v2,b1>b1 b2 v1 )        PLAYER1 @VELOCITY PLAYER2 @VELOCITY V+                          2OVER V-                                                        PLAYER1 !VELOCITY PLAYER2 !VELOCITY ;                         .THEN                                                           0 .IF      : COLLIDE PLAYER1 @VELOCITY PLAYER2 @VELOCITY          2OVER 2/ SWAP 2/ SWAP 2OVER V+ PLAYER2 !VELOCITY                2/ SWAP 2/ SWAP V+ PLAYER1 !VELOCITY ; .THEN                  ( COLLIDE new improved and simplified--jjt     09:11 08/27/87 ) -1 .IF                                                          : COLLIDE                                                         PLAYER1 @VELOCITY 2*                                            PLAYER2 @VELOCITY 2*                                            PLAYER1 !VELOCITY                                               PLAYER2 !VELOCITY                                               ; .THEN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ( ORIENTATION TABLES RECTANGLES1               18:48 02/08/87 ) L:     RECTANGLES1 ( collision detection tables NO puck )       ( ulx  uly  lrx   lry   puckx pucky )                             2 C, 0 C, 15 C, 19 C, 15 ,  16 ,      ( ORIENTATION 0 )         3 C, 2 C, 19 C, 15 C, 19 ,   4 ,      (             1 )         3 C, 0 C, 13 C, 18 C, 13 ,  -2 ,      (             2 )         1 C, 0 C,  9 C, 24 C,  2 ,   0 ,      (             3 )         0 C, 0 C, 13 C, 19 C, -2 ,   2 ,      (             4 )         0 C, 2 C, 16 C, 15 C, -2 ,  11 ,      (             5 )         0 C, 2 C, 12 C, 20 C,  1 ,  21 ,      (             6 )         0 C, 2 C, 10 C, 24 C,  8 ,  23 ,      (             7 )                                                                                                                                                                                                                                                                                                                                       ( ORIENTATION TABLES RECTANGLES2               18:48 02/08/87 ) L:     RECTANGLES2 ( collision detection tables WITH puck )     ( ulx `E10  lrx   lry   puckx pucky )                             2 C, 0 C, 15 DIAM + C, 19 C, 15 ,  16 ,  ( ORIENTATION 0 )      3 C, 2 C, 19 C, 15 C, 19 ,   4 ,         (             1 )      3 C, 0 DIAM - C, 13 C, 18 C, 13 ,  -2 ,  (             2 )      1 C, 0 C,  9 C, 24 C,  2 ,   0 ,         (             3 )      0 DIAM - C, 0 C, 13 C, 19 C, -2 ,   2 ,  (             4 )     -2 C, 2 C, 16 C, 15 C, -2 ,  11 ,         (             5 )      0 C, 2 C, 12 C, 20 DIAM + C,  1 ,  21 ,  (             6 )      0 C, 2 C, 10 C, 24 C,  8 ,  23 ,         (             7 )                                                                                                                                                                                                                                                                                                                                    ( CALC-RTAB as CODE                            17:06 04/09/87 ) CODE CALC-RTAB   ( PLAYER ---- )                                      CLC 8 # LDA TOS ADC  N  STA TYA TOS 1+ ADC N 1+ STA             N   )Y LDA  N   STA                                             N   1+ STY  N   ASL N   1+ ROL N   ASL N   1+ ROL                           N   ASL N   1+ ROL                                  CLC 13 # LDA TOS ADC TOS STA                                    CS IF TOS 1+ INC THEN                                           TOS X) LDA  0= IF  RECTANGLES1 >LO # LDA RTAB    STA                               RECTANGLES1 >HI # LDA RTAB 1+ STA                           ELSE                                                                RECTANGLES2 >LO # LDA RTAB    STA                               RECTANGLES2 >HI # LDA RTAB 1+ STA                           THEN                                            CLC RTAB LDA N ADC RTAB STA RTAB 1+ LDA N 1+ ADC RTAB 1+        STA POP JMP END-CODE                                       ( CALC-RTAB px py                              19:41 02/08/87 ) 0 .IF                                                           : CALC-RTAB ( PLAYER ---- ) DUP >R                                @ORIENTATION 2* 2* 2*                                           R> @POSSESSION                                                  IF RECTANGLES2 ELSE RECTANGLES1 THEN + RTAB ! ;               : px  ( --- px  ) RTAB @ 4 +  @ 256* ;                          : py  ( --- py  ) RTAB @ 6 +  @ 256* ;                                                                                          .THEN                                                                                                                                                                                                                                                                                                                                                                                                                                                           ( lrx lry                                      12:21 03/31/87 ) CODE lrx  DEX DEX  TOS STY                                                2 # LDY                                                         RTAB )Y LDA                                                     TOS 1+ STA  NEXT JMP END-CODE                         CODE lry  DEX DEX  TOS STY                                                3 # LDY                                                         RTAB )Y LDA                                                     TOS 1+ STA NEXT JMP END-CODE                          CODE px   DEX DEX  TOS STY                                                4 # LDY                                                         RTAB )Y LDA                                                     TOS 1+ STA  NEXT JMP END-CODE                         CODE py   DEX DEX TOS STY                                                 6 # LDY                                                         RTAB )Y LDA TOS 1+ STA NEXT JMP END-CODE              ( ulx uly                                      14:48 02/20/87 ) CODE ulx  DEX DEX  TOS STY                                                RTAB )Y LDA                                                     TOS 1+ STA NEXT JMP END-CODE                                                                                          CODE uly  DEX DEX  TOS STY                                                INY RTAB )Y LDA                                                 TOS 1+ STA NEXT JMP END-CODE                                                                                          CODE !OBJECT puck >HI # LDA OBJECT 1+ STA                                    puck >LO # LDA OBJECT    STA NEXT JMP END-CODE                                                                                                                                                                                                                                                                                                                                     ( CHECK-PUCK-PLAYER orig                       21:37 02/08/87 ) 0  .IF                                                          : CHECK-PUCK-PLAYER  DUP >R @POSSESSION ?DUP                      IF   1- ?DUP  IF R> !POSSESSION ELSE R> DROP THEN               ELSE PLAYER1 @POSSESSION PLAYER2 @POSSESSION + 2 <                   IF R@ @SHOOT-COUNT 0=                                              IF R@ CALC-RTAB puck @XY R@                                        @XY px py V+  V- NORM-SQ2                                       PUCK-STICK-THRESHOLD U<                                         IF R@ @XY px py V+ puck !XY                                        0 PLAYER1 !POSSESSION 0 PLAYER2 !POSSESSION                     20  R@    !POSSESSION 0.   puck !VELOCITY                       puck @FLAG 1 OR puck !FLAG PICKUP-SND             THEN THEN THEN R> DROP THEN ;     .THEN                                                                                                                                                       : CHECK-PUCK-PLAYER  DUP >R @POSSESSION ?DUP                      IF   1- ?DUP  IF R> !POSSESSION ELSE R> DROP THEN               ELSE PLAYER1 @POSSESSION PLAYER2 @POSSESSION + 2 <                IF R@ @SHOOT-COUNT 0=                                              IF R@ CALC-RTAB puck @XY R@                                        @XY px py V+ V- NORM-SQ2 PUCK-STICK-THRESHOLD U<         IF   R@ @XY px py V+ puck !XY  (RANDOM-SOUND)                               0 PLAYER1 !POSSESSION   0 PLAYER2 !POSSESSION                   10  R@    !POSSESSION   0.   puck !VELOCITY                     puck @FLAG 1 OR puck !FLAG PICKUP-SND                      ELSE !OBJECT ( PUCK-PLAYER-THRESHOLD= )                              ulx lrx + 2/  uly lry + 2/  R@ @XY                              V+ puck @XY V- NORM-SQ2  050 U<                                 IF BOUNCE-SND (NEGATE-YVELOCITY)                                   (NEGATE-XVELOCITY) THEN                          THEN THEN THEN R> DROP THEN ;                                ( MOVE-PUCK                                    13:31 02/05/87 ) : MOVE-PUCK                                                       WHIZ-COUNT C@  0= IF                                            puck @FLAG 1 AND IF                                               PLAYER1 @POSSESSION IF PLAYER1 DUP CALC-RTAB                      @XY px py V+ puck !XY                                        ELSE PLAYER2 DUP CALC-RTAB                                         @XY px py V+ puck !XY THEN                                  ELSE                                                             puck @VELOCITY puck @XY ( DX DY X Y )                           V+ OVER [ 200 256 * ] LITERAL U> IF                                SWAP DROP 3 SWAP THEN             puck !XY                   CHECK-PUCK-GOALIE CHECK-PUCK-COLLISION                          SLOW-DOWN-PUCK THEN                                             PLAYER1 CHECK-PUCK-PLAYER  PLAYER2 CHECK-PUCK-PLAYER           THEN ;                                                        ( CHECK-PLAYER-PLAYER                          10:49 02/11/87 ) -1 .IF                                                          : CHECK-PLAYER-PLAYER                                             PLAYER1 @XY PLAYER2 @XY V- ( DX DY ) NORM-SQ2                   PLAYER-PLAYER-THRESHOLD U< IF PL/PLYR-SND COLLIDE THEN  ;     .THEN                                                                                                                           0  .IF         ( DO NOT USE YET )                               : CHECK-PLAYER-PLAYER                                             PLAYER1 @XY PLAYER2 @XY V- ( DX DY ) NORM-SQ2                   PLAYER-PLAYER-THRESHOLD U< IF PL/PLYR-SND                       PLAYER1 @VELOCITY                                               PLAYER2 @VELOCITY                                               PLAYER1 @XY  PLAYER2 @XY         ( v1 v2 c1 c2 )                8 0 DO 7 PICK LOOP                                              COLLIDE1 COLLIDE2  THEN ;   .THEN                             ( PLAYER-COLLISION WITH WALLS                  00:29 02/05/87 ) 0  .IF                                                          : CHECK-PLAYER-COLLISION  >R       R@ @XY                 DUP       uly + TOP-LINE    U< IF DROP  TOP-LINE    uly -      2DUP        R@ !XY PL/EDGE-SND R@ SLOW-DOWN-PLAYER R@ SLOW-DOWN-PLAYER      R@ @VELOCITY      NEGATE      R@ !VELOCITY THEN      DUP       lry + BOTTOM-LINE U> IF DROP  BOTTOM-LINE lry -      2DUP        R@ !XY PL/EDGE-SND R@ SLOW-DOWN-PLAYER R@ SLOW-DOWN-PLAYER      R@ @VELOCITY      NEGATE      R@ !VELOCITY THEN SWAP DUP       lrx + RIGHT-LINE  U> IF DROP  RIGHT-LINE  lrx - SWAP 2DUP        R@ !XY PL/EDGE-SND R@ SLOW-DOWN-PLAYER R@ SLOW-DOWN-PLAYER      R@ @VELOCITY SWAP NEGATE SWAP R@ !VELOCITY THEN      DUP       ulx + LEFT-LINE   U< IF DROP  LEFT-LINE   ulx - SWAP 2DUP        R@ !XY PL/EDGE-SND R@ SLOW-DOWN-PLAYER R@ SLOW-DOWN-PLAYER      R@ @VELOCITY SWAP NEGATE SWAP R@ !VELOCITY THEN                R> DROP 2DROP ;                                     .THEN   ( CHECK-PLAYER-COLLISION 6502 REMAKE MAF/JDS 1/2     04/13/87 ) CODE CHECK-PLAYER-COLLISION ( PLAYER --- )                        TOS LDA OBJECT STA   TOS 1+ LDA OBJECT 1+ STA                   5 # LDY OBJECT )Y LDA CLC 1 # LDY RTAB )Y ADC                   TOP-LINEH # CMP CS NOT                                          IF SEC TOP-LINEH  # LDA RTAB )Y SBC 5 # LDY OBJECT )Y STA          NEGATE-YVELOCITY JSR                                                                 (PL/EDGE-SND) JSR                       THEN                                                            5 # LDY OBJECT )Y LDA CLC 3 # LDY RTAB )Y ADC                   BOTTOM-LINEH # CMP CS                                           IF SEC BOTTOM-LINEH  # LDA RTAB )Y SBC 5 # LDY OBJECT )Y STA       NEGATE-YVELOCITY JSR (PL/EDGE-SND) JSR                       THEN                                                                                                                                                                                          ( CHECK-PLAYER-COLLISION 6502 CONT. 2/2        10:22 04/13/87 )                                                                   7 # LDY OBJECT )Y LDA CLC 2 # LDY RTAB )Y ADC                   RIGHT-LINEH # CMP CS                                            IF SEC RIGHT-LINEH # LDA RTAB )Y SBC 7 # LDY OBJECT )Y STA         NEGATE-XVELOCITY JSR (PL/EDGE-SND) JSR                       THEN                                                            7 # LDY OBJECT )Y LDA CLC 0 # LDY RTAB )Y ADC                   LEFT-LINEH # CMP CS NOT                                         IF SEC LEFT-LINEH # LDA RTAB )Y SBC 7 # LDY OBJECT )Y STA          NEGATE-XVELOCITY JSR (PL/EDGE-SND) JSR                       THEN                                                            POP JMP END-CODE                                                                                                                                                                                                                                              ( CHECK-PLAYER-GOALIE  CODE ...     MAF        11:57 04/13/87 ) 0  .IF                                                          CODE (CHECK-PLAYER-GOALIE)  ( PLAYER---)    ( misng CALC-RTAB )   TOS LDA OBJECT STA TOS 1+ LDA OBJECT 1+ STA                                                                                     7 # LDY CLC OBJECT )Y LDA 0 # LDY RTAB )Y ADC                   LEFT-LINEH GOAL-WIDTH + # CMP ( X:LEFTLINE) CS                  IF                                                                 5 # LDY OBJECT )Y LDA CLC  3 # LDY RTAB )Y ADC  ( LY )          GOALIE1-Y 1+ CMP CS NOT                                         IF 5 # LDY OBJECT )Y LDA CLC  1 # LDY RTAB )Y ADC ( UY )           N STA CLC GOALIE1-Y 1+ LDA  GOAL-HEIGHTH # ADC                  N CMP CS NOT                                                    IF (PL-GO-BOUNCE) JSR THEN                                   THEN POP JMP                                                 THEN                                                          ( CHECK-PLAYER-GOALIE  called by hi-level      11:57 04/13/87 )   7 # LDY CLC OBJECT )Y LDA 2 # LDY RTAB )Y ADC                   RIGHT-LINEH GOAL-WIDTH 1+ - # CMP CS NOT                        IF                                                                 5 # LDY OBJECT )Y LDA CLC  3 # LDY  RTAB )Y ADC                 GOALIE2-Y 1+ CMP CS NOT                                         IF 5 # LDY OBJECT )Y LDA CLC  1 # LDY RTAB )Y ADC                  N STA CLC GOALIE2-Y 1+ LDA  GOAL-HEIGHTH # ADC                  N CMP CS NOT                                                    IF (PL-GO-BOUNCE) JSR THEN                                   THEN POP JMP                                                 THEN                                                            POP JMP END-CODE                                                                                                              : CHECK-PLAYER-GOALIE  ( PLAYER -- )                              DUP >R CALC-RTAB  (CHECK-PLAYER-GOALIE)  R> DROP ;   .THEN                                                                    : CHECK-PLAYER-GOALIE ( PLAYER )                                  DUP >R CALC-RTAB  R@ @XY DROP                                   ulx + [ LEFT-LINE GOAL-WIDTH 256 * + ] LITERAL U<               IF   GOALIE1-Y @ GOAL-HEIGHT + uly R@ @XY SWAP DROP + U>             GOALIE1-Y @ lry R@ @XY SWAP DROP +                                              U<   AND IF OLD-XY 2@ R@ !XY                 R@ @VELOCITY SWAP NEGATE SWAP NEGATE R@ !VELOCITY  THEN       ELSE                                                             R@ @XY DROP lrx +                                               [ RIGHT-LINE GOAL-WIDTH 256 * - ] LITERAL U>                    IF uly R@ @XY SWAP DROP + GOALIE2-Y @ GOAL-HEIGHT + U<             lry R@ @XY SWAP DROP +                                              GOALIE2-Y @ U> AND IF OLD-XY 2@ R@ !XY                      R@ @VELOCITY SWAP NEGATE SWAP NEGATE R@ !VELOCITY THEN      THEN THEN  R> DROP ;                                          ( CHECK-PLAYER-GOALIE in hi_level    MAF       11:57 04/13/87 ) 0  .IF                                                          PROC (PL-GO-BOUNCE)                                                     OLD-XY 1+  LDA 5 # LDY OBJECT )Y STA                            OLD-XY 3 + LDA 7 # LDY OBJECT )Y STA                            NEGATE-XVELOCITY JSR RTS END-PROC                       CODE PL-GO-BOUNCE  (PL-GO-BOUNCE) JSR NEXT JMP END-CODE                                                                         : CHECK-PLAYER-GOALIE ( PLAYER )                                  DUP >R CALC-RTAB                                                                                                                R@ @XY DROP ulx +                                               [ LEFT-LINE  GOAL-WIDTH 256 * + ] LITERAL  U<                   IF GOALIE1-Y @ GOAL-HEIGHT + uly R@ @XY SWAP DROP + U>             GOALIE1-Y @               lry R@ @XY SWAP DROP + U<             AND IF PL-GO-BOUNCE THEN                                   ( CHECK-PLAYER-GOALIE in 4TH      MAF          11:57 04/13/87 )                                                                   ELSE                                                               R@ @XY DROP lrx +                                               [ RIGHT-LINE GOAL-WIDTH 256 * - ] LITERAL  U>                   IF uly R@ @XY SWAP DROP + GOALIE2-Y @ GOAL-HEIGHT + U<             lry R@ @XY SWAP DROP + GOALIE2-Y @               U>             AND IF PL-GO-BOUNCE THEN                                     THEN                                                         THEN R> DROP ;                                                                                                                      .THEN                                                                                                                                                                                                                                                                                                                     ( SLOW-DOWN-PLAYER as PROC              MAF    14:01 07/14/87 ) 0  .IF                                                          CODE (SLOW-DOWN-PLAYER)  ( PLAYER -- )                                 TOS    LDA OBJECT    STA            ( PLAYER to OBJECT )        TOS 1+ LDA OBJECT 1+ STA                                        DEX DEX OBJECT )Y LDA TOS     STA   ( @VELOCITY )                   INY OBJECT )Y LDA TOS 1+  STA                                   INY OBJECT )Y LDA TOS 2+  STA                                   INY OBJECT )Y LDA TOS 3 + STA                               (DECAY2) JSR  INX INX                                           (DECAY2) JSR  DEX DEX               ( decayed velocity )        0 # LDY TOS     LDA OBJECT )Y STA   ( !VELOCITY )                   INY TOS 1+  LDA OBJECT )Y STA                                   INY TOS 2+  LDA OBJECT )Y STA                                   INY TOS 3 + LDA OBJECT )Y STA                               (NORM-SQ) JSR                                            ( SLOW-DOWN-PLAYER as COLON                    00:27 02/05/87 )                                                                        TOS    LDA                                                      TOS 1+ ORA                                                      0= IF  0 # LDY OBJECT )Y STA                                               INY OBJECT )Y STA                                               INY OBJECT )Y STA                                               INY OBJECT )Y STA  THEN                              INX INX NEXT JMP END-CODE               .THEN                                                                            : SLOW-DOWN-PLAYER ( PLAYER --- )                                 DUP  @VELOCITY                                                  DECAY2    SWAP    DECAY2    SWAP                              ( 2DUP NORM-SQ   0= IF 2DROP 0. THEN    )                         ROT !VELOCITY ;                                                                                                               ( NEAREST VELOCITY-TABLE                       15:45 02/06/87 ) : NEAREST  ( START POS GOAL POS ---- NEXT ANGLE )                 ( Calculates the nearest way to get to a position )             2DUP = IF DROP ELSE                                             2DUP - 5 >   ( COUNTERCLOCKWISE ) IF DROP 2+ ELSE    ( 1 )      2DUP - 3 >   ( COUNTERCLOCKWISE ) IF DROP 1+ ELSE               2DUP - -5 <  ( CLOCKWISE )        IF DROP 2- ELSE    ( 1 )      2DUP - -3 <  ( CLOCKWISE )        IF DROP 1- ELSE               2DUP >       ( TOO FAR )          IF DROP 1- ELSE               DROP 1+ THEN THEN THEN THEN THEN THEN 7 AND ;                                                                                 L: VELOCITY-TABLE  ( Y X PER DIRECTION )                             0 ,  330 ,   -290 ,  290 ,   -420 ,    0 ,     ( 0 1 2 )     -290 , -290 ,      0 , -330 ,    290 , -290 ,     ( 3 4 5 )      420 ,    0 ,    290 ,  290 ,      0 ,    0 ,     ( 6 7 8 )   ( was 320 400 640 )                                             (                                              09:42 08/27/87 ) L: SHOOT-TABLE                                                  ( shoot orientation, idx'd by count) -1 ,  1 , 1 , -1 ,         ( : ZOOM  2* DUP 2* + ;  ( velocity multiplier for shooting )                                                                   : ZOOM 2* 2* 2* ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ( SHOOT SEQUENCE                               09:36 02/09/87 ) : SHOOT-SEQUENCE ( PLAYER --- )                                   ( DUP ) >R ( @SHOOT-COUNT 1 AND 0= IF )                            R@ @SHOOT-COUNT 1- 2* SHOOT-TABLE + @                           R@  @ORIENTATION + 7 AND R@  !ORIENTATION                       R@ @SHOOT-COUNT 3 = R@ @POSSESSION AND                          IF ( KICK puck IN ASS ) ( player shoot-count --- )                  WHACK-SND                                                     0 R@ !POSSESSION  ( CLEAR PLAYER FLAG )                         R@ @ORIENTATION 2* 2* VELOCITY-TABLE + 2@                       ZOOM SWAP ZOOM SWAP ( R@ @VELOCITY V+ ) puck !VELOCITY          puck @FLAG 254 AND puck !FLAG THEN ( THEN )                 R@  @SHOOT-COUNT 1- R> !SHOOT-COUNT  ;                                                                                                                                                                                                                       ( APPLY-JOYSTICK MOVE-PLAYER                   00:46 02/05/87 ) ( 32) 2700 EQU PLAYER-SPEED-LIMIT-Y                             ( 16) 2000 EQU PLAYER-SPEED-LIMIT-X                                  -2700 EQU -PLAYER-SPEED-LIMIT-Y                                 -2000 EQU -PLAYER-SPEED-LIMIT-X                             : APPLY-JOYSTICK  ( DIRECTION PLAYER ---- )                       >R 2* 2* VELOCITY-TABLE + 2@ R@ @VELOCITY D+                    DUP 0< IF -PLAYER-SPEED-LIMIT-Y MAX                                    ELSE PLAYER-SPEED-LIMIT-Y MIN  THEN                      SWAP DUP 0< IF -PLAYER-SPEED-LIMIT-X MAX                                ELSE PLAYER-SPEED-LIMIT-X MIN THEN                      SWAP   R> !VELOCITY  ;                                                                                                                                                                                                                                                                                                       (                                              12:47 08/29/87 )  : MOVE-PLAYER ( PLAYER ---- )                                     DUP >R  @VELOCITY R@   @XY ( DX DY X Y ) 2DUP OLD-XY 2!         V+  OVER [ 200 256 * ] LITERAL U> IF SWAP DROP 3 SWAP THEN          R@ !XY                                                      R@ CALC-RTAB R@ CHECK-PLAYER-COLLISION                          R@ CHECK-PLAYER-GOALIE                                          R>  SLOW-DOWN-PLAYER  ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ( READ-JOY1 JDS OPTIMIZED INLINE FORTH         17:04 03/24/87 ) : READ-JOY1 ( --- ORIENTATION ) PLAYER1 @FLAG  2 AND             IF [ PLAYER1 10 + ] LITERAL ( TIMER ) C@ 0=                        IF   SKILL C@ SCORE2 @ SCORE1  @ - - 0 MAX  2 ( 32) MIN              [ PLAYER1 10 + ] LITERAL C! [ PLAYER1 13 + ] LITERAL C@         IF   [ PLAYER1 4 + ] LITERAL 2@ ( XY) OVER 256/ 120 >                IF   2DROP SHOOTFLAG1 ON 8                                      ELSE 156 111 2SWAP V256/  ANGLE 4 - 7 AND THEN             ELSE [ PLAYER1 4 + ] LITERAL 2@ V256/                                [ puck 4 + ] LITERAL 2@ V256/ ANGLE THEN              ELSE [ PLAYER1 10 + ] LITERAL C@ 1-                                  [ PLAYER1 10 + ] LITERAL C! OLDJOY1 C@ THEN             ELSE FB0 C@                                                          IF SHOOTFLAG1 ON THEN                                           ?BLUE-ACTION THEN                                          DUP OLDJOY1 C! ;                                               ( READ-JOY2 JDS OPTIMIZED INLINE FORTH         17:04 03/24/87 ) : READ-JOY2 ( --- ORIENTATION ) PLAYER2 @FLAG 2 AND              IF [ PLAYER2 10 + ] LITERAL ( TIMER ) C@ 0=                        IF   SKILL C@ SCORE1 @ SCORE2  @ - - 0 MAX  2 ( 32) MIN              [ PLAYER2 10 + ] LITERAL C! [ PLAYER2 13 + ] LITERAL C@         IF   [ PLAYER2 4 + ] LITERAL 2@ ( XY) OVER 256/  35 <                IF   2DROP SHOOTFLAG2 ON 8   ( SHOOT PUCK )                     ELSE  05 111 2SWAP V256/  ANGLE 4 - 7 AND THEN             ELSE [ PLAYER2 4 + ] LITERAL 2@ V256/                                [ puck 4 + ] LITERAL 2@ V256/ ANGLE THEN              ELSE [ PLAYER2 10 + ] LITERAL C@ 1-                                  [ PLAYER2 10 + ] LITERAL C! OLDJOY2 C@ THEN             ELSE FB1 C@                                                          IF SHOOTFLAG2 ON THEN                                           ?REDD-ACTION THEN                                          DUP OLDJOY2 C! ;                                               ( UPDATE SCORE  JDS  1/2                       11:37 03/24/87 ) HEX                                                             CODE (UPDATE-SCORE)                                              SCORE1 LDA PHA 0F # AND CLC 48 # ADC                            NUM1-N STA 83 # LDA NUM1-A STA                                  PLA A LSR A LSR A LSR A LSR CLC 48 # ADC                        NUM0-N STA 82 # LDA NUM0-A STA                                  SCORE2 LDA PHA 0F # AND CLC 48 # ADC                            NUM3-N STA 85 # LDA NUM3-A STA                                  PLA A LSR A LSR A LSR A LSR CLC 48 # ADC                        NUM2-N STA 84 # LDA NUM2-A STA                                  SAVES1 LDA PHA 0F # AND CLC 3E # ADC                            NUM8-N STA 8A # LDA NUM8-A STA                                  PLA A LSR A LSR A LSR A LSR CLC 3E # ADC                        NUM7-N STA 89 # LDA NUM7-A STA                                                                                                 ( UPDATE SCORE  JDS   2/2                      11:37 03/24/87 )  SAVES2 LDA PHA 0F # AND CLC 3E # ADC                            NUMA-N STA 8C # LDA NUMA-A STA                                  PLA A LSR A LSR A LSR A LSR CLC 3E # ADC                        NUM9-N STA 8B # LDA NUM9-A STA                                   DEX DL-TABLE-START >HI #     LDA TOS STA                        DEX DL-TABLE-START >LO #     LDA TOS STA                        DEX PLAYERS-ITAB   >HI #     LDA TOS STA                        DEX PLAYERS-ITAB   >LO #     LDA TOS STA                        DEX NUMBERS-ETAB   >HI #     LDA TOS STA                        DEX NUMBERS-ETAB   >LO #     LDA TOS STA                        BEGIN MSTAT BIT 0< UNTIL ( THEN WAIT FOR VBLANK )              ' (NEW-GRAPHICS) >BODY JMP   ( N N N--) END-CODE               CODE UPDATE-SCORE ' (UPDATE-SCORE) >BODY JSR NEXT JMP END-CODE  DECIMAL                                                                                                                         ( WHIZZING LIGHTS 1/3                          11:15 03/25/87 ) HEX                                                             CODE (WHIZ)    WHIZ-COUNT LDA 0= IF RTS THEN 0<                 IF WHIZ-COUNT INC WHIZ-COUNT 1+ LDA                                       0= IF R-TWIRLB # LDA RUT-I STA RLT-I STA                              WHIZ-COUNT 1+ INC                  ELSE           1 # CMP 0= IF R-TWIRLD # LDA RUT-I STA RLT-I STA                              WHIZ-COUNT 1+ INC                  ELSE           2 # CMP 0= IF R-TWIRLC # LDA RUT-I STA RLT-I STA                              WHIZ-COUNT 1+ INC                  ELSE           WHIZ-COUNT 1+ STY R-TWIRLA # LDA RUT-I STA RLT-I STA                         THEN THEN THEN 89 # LDA RUT-A STA RLT-A STA                                                                                                                                                                                                                                                                      ( WHIZZING LIGHTS 2/3                          12:04 03/25/87 ) ELSE WHIZ-COUNT DEC WHIZ-COUNT 1+ LDA                                     0= IF B-TWIRLB # LDA BUT-I STA BLT-I STA                              WHIZ-COUNT 1+ INC                  ELSE           1 # CMP 0= IF B-TWIRLD # LDA BUT-I STA BLT-I STA                              WHIZ-COUNT 1+ INC                  ELSE           2 # CMP 0= IF B-TWIRLC # LDA BUT-I STA BLT-I STA                              WHIZ-COUNT 1+ INC                  ELSE           WHIZ-COUNT 1+ STY B-TWIRLA # LDA BUT-I STA BLT-I STA                         THEN THEN THEN 88 # LDA BUT-A STA BLT-A STA      THEN             FF # LDA NETPLUG STA                                                                                                                                                                                                                                                                                                                                                           ( WHIZZING LIGHTS 3/3                          11:15 03/25/87 )   WHIZ-COUNT LDA 0= IF WHIZ-COUNT 1+ STY                                           WHIZ-DONE DEC THEN                             DEX DL-TABLE-START >HI #     LDA TOS STA                        DEX DL-TABLE-START >LO #     LDA TOS STA                        DEX PLAYERS-ITAB   >HI #     LDA TOS STA                        DEX PLAYERS-ITAB   >LO #     LDA TOS STA                        DEX NETGOAL-ETAB   >HI #     LDA TOS STA                        DEX NETGOAL-ETAB   >LO #     LDA TOS STA                        BEGIN MSTAT BIT 0< UNTIL ( THEN WAIT FOR VBLANK )              ' (NEW-GRAPHICS) >BODY JMP   ( N N N--) END-CODE                                                                               CODE WHIZ ' (WHIZ) >BODY JSR NEXT JMP END-CODE                  DECIMAL                                                                                                                                                                                         ( TWIRLS - WHIZZING DURING ZAMBONI   1/2       11:24 04/14/87 ) HEX                                                             CODE (TWIRL)         WHIZ-COUNT 1+ LDA                                    0= IF B-TWIRLB # LDA BUT-I STA BLT-I STA                              R-TWIRLB # LDA RUT-I STA RLT-I STA                              WHIZ-COUNT 1+ INC                  ELSE           1 # CMP 0= IF B-TWIRLD # LDA BUT-I STA BLT-I STA                              R-TWIRLD # LDA RUT-I STA RLT-I STA                              WHIZ-COUNT 1+ INC                  ELSE           2 # CMP 0= IF B-TWIRLC # LDA BUT-I STA BLT-I STA                              R-TWIRLC # LDA RUT-I STA RLT-I STA                              WHIZ-COUNT 1+ INC                  ELSE           WHIZ-COUNT 1+ STY B-TWIRLA # LDA BUT-I STA BLT-I STA                              R-TWIRLA # LDA RUT-I STA RLT-I STA                         THEN THEN THEN 88 # LDA BUT-A STA BLT-A STA               89 # LDA RUT-A STA RLT-A STA FF # LDA NETPLUG STA      ( TWIRLS - WHIZZING DURING ZAMBONI   2/2       11:24 04/14/87 )   DEX DL-TABLE-START >HI #     LDA TOS STA                        DEX DL-TABLE-START >LO #     LDA TOS STA                        DEX PLAYERS-ITAB   >HI #     LDA TOS STA                        DEX PLAYERS-ITAB   >LO #     LDA TOS STA                        DEX NETGOAL-ETAB   >HI #     LDA TOS STA                        DEX NETGOAL-ETAB   >LO #     LDA TOS STA                        BEGIN MSTAT BIT 0< UNTIL ( THEN WAIT FOR VBLANK )              ' (NEW-GRAPHICS) >BODY JMP   ( N N N--) END-CODE                                                                               CODE TWIRL ' (TWIRL) >BODY JSR NEXT JMP END-CODE                DECIMAL                                                                                                                                                                                         DECIMAL                                                                                                                         ( CHECK-FOR-GOAL                               23:12 02/09/87 ) : CHECK-FOR-GOAL                                                  puck @XY DUP GOAL-TOP U>                                         IF GOAL-BOTTOM U<                                                  IF DUP RIGHT-LINE U> IF  DROP -40 WHIZ-COUNT C!           SCORE1 DECIMAL-INC GOAL-SND                                     ELSE LEFT-LINE U< IF   40 WHIZ-COUNT C!                         SCORE2 DECIMAL-INC GOAL-SND                                     THEN THEN                                                       WHIZ-COUNT C@ IF                                                puck @FLAG 254 AND puck !FLAG                                   0 PLAYER1 !POSSESSION                                           0 PLAYER2 !POSSESSION                                           UPDATE-SCORE  WHIZ      THEN                                          ELSE DROP ( X---)    THEN                                    ELSE 2DROP ( X/Y) THEN ;                                     ( SERVE     fixed per memo.  jjt               09:43 08/27/87 ) : SERVE                  0 puck    !FLAG                          0 PLAYER1 !SHOOT-COUNT 0 PLAYER2 !SHOOT-COUNT                   0 PLAYER1 !ORIENTATION 4 PLAYER2 !ORIENTATION                   0 PLAYER1 !POSSESSION  0 PLAYER2 !POSSESSION                    0 PLAYER1 !TIMER       0 PLAYER2 !TIMER                         0 0 PLAYER1 !VELOCITY 57 256* 104 256* PLAYER1 !XY              0 0 PLAYER2 !VELOCITY 86 256* 102 256* PLAYER2 !XY              8 OLDJOY1 C! 8 OLDJOY2 C! 0 SHOOTFLAG1 ! 0 SHOOTFLAG2 !         [ RIGHT-LINE LEFT-LINE - -1 SHIFT 384 - LEFT-LINE + ]  LITERAL  [ 200 256 * ] LITERAL 0 puck !XY                                INIT-SOUND  ANIMATOR 9000 0 DO LOOP SERVE-SND                   SYSTIMER C@ 4 AND 0=                                                 IF      TOP-LINE 512 - puck !XY 0  2048                         ELSE    BOTTOM-LINE 512 + puck !XY 0  -2048 THEN                puck !VELOCITY ANIMATOR  ;                               ( PLAYER1-PROCESS                              00:38 02/05/87 ) : PLAYER1-PROCESS                                                 SHOOTFLAG1 C@ IF 4 PLAYER1 !SHOOT-COUNT SHOOTFLAG1 OFF THEN     PLAYER1 @SHOOT-COUNT IF PLAYER1 SHOOT-SEQUENCE ELSE                 READ-JOY1 DUP 8 = IF     150 111 PLAYER1 @XY    ( 156 )         V256/  ANGLE 4 - 7 AND   ELSE DUP THEN                          PLAYER1 @ORIENTATION SWAP NEAREST                               PLAYER1 !ORIENTATION PLAYER1 APPLY-JOYSTICK  THEN            PLAYER1 MOVE-PLAYER ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ( PLAYER2-PROCESS                              10:43 02/11/87 ) : PLAYER2-PROCESS                                                 SHOOTFLAG2 C@ IF 4 PLAYER2 !SHOOT-COUNT SHOOTFLAG2 OFF THEN     PLAYER2 @SHOOT-COUNT IF PLAYER2 SHOOT-SEQUENCE ELSE                 READ-JOY2 DUP 8 = IF     05 111 PLAYER2 @XY                     V256/  ANGLE 4 - 7 AND   ELSE DUP THEN                          PLAYER2 @ORIENTATION SWAP NEAREST                               PLAYER2 !ORIENTATION PLAYER2 APPLY-JOYSTICK  THEN            PLAYER2 MOVE-PLAYER ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ( UMIN UMAX DRAW-GOALIE1 DRAW-GOALIE2          16:39 02/22/87 )                                                                 : UMIN 2DUP U> IF SWAP THEN DROP ;                                                                                              : UMAX 2DUP U< IF SWAP THEN DROP ;                                                                                              CODE DRAW-GOALIE1 TOS 1+ LDA BLUE-GOALY-Y STA                       INX INX NEXT JMP END-CODE                                   CODE DRAW-GOALIE2 TOS 1+ LDA REDD-GOALY-Y STA                       INX INX NEXT JMP END-CODE                                                                                                                                                                                                                                                                                                                                                                                                                                   ( GOALIEN-PROCESS                              15:51 02/22/87 ) L:  GOALIE-MOVES   ( JOYSTICK -> Y CHANGE )                     0 , -2048 , -2048 , -2048 , 0 , 2048 , 2048 , 2048 , 0 ,        : GOALIE1-PROCESS                                                 GOALIE1-Y @                                                     OLDJOY1 C@ 2* GOALIE-MOVES + @ +                                GOAL-TOP UMAX [ GOAL-BOTTOM GOAL-HEIGHT - ] LITERAL UMIN        DUP GOALIE1-Y !                                                 ( GOAL1-X   SWAP V256/) ( ---Y256*) DRAW-GOALIE1 ;                                                                            : GOALIE2-PROCESS                                                 GOALIE2-Y @                                                     OLDJOY2 C@ 2* GOALIE-MOVES + @ +                                GOAL-TOP UMAX [ GOAL-BOTTOM GOAL-HEIGHT - ] LITERAL UMIN        DUP GOALIE2-Y !  ( GOAL2-X   SWAP V256/ ) ( ---Y256*)           DRAW-GOALIE2 ;                                                ( LIGHTEN-ICE DARKEN-ICE                       13:26 04/09/87 ) CODE (LIGHTEN-ICE) BG-TOP-ICE LDY INY BG-TOP-ICE STY RTS          END-CODE                                                      CODE LIGHTEN-ICE ' (LIGHTEN-ICE) >BODY JSR NEXT JMP END-CODE    CODE (DARKEN-ICE) BG-TOP-ICE LDY DEY BG-TOP-ICE STY RTS           END-CODE                                                      CODE DARKEN-ICE ' (DARKEN-ICE) >BODY JSR NEXT JMP END-CODE                                                                      HEX                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ( TIMER-INIT UPDATE-TIMER SUBROUTINE 1/2       09:04 04/07/87 ) CODE TIMER-INIT TIMER STY SECONDS STY SAVES1 STY SAVES2 STY       SCORE1 STY SCORE2 STY BONUS STY 2 # LDY MINUTES STY             (INIT-TIMER) JSR  NEXT JMP END-CODE                           CODE BONUS-INIT TIMER STY MINUTES STY 20 # LDY SECONDS STY        BONUS STY (INIT-TIMER) JSR NEXT JMP   END-CODE                CODE DEMO-TIMER TIMER STY MINUTES STY SAVES1 STY SAVES2 STY       SCORE1 STY SCORE2 STY BONUS STY 20 # LDY SECONDS STY NEXT JMP   END-CODE                                                      CODE (UPDATE-TIMER)                                               TIMER LDA 3C # CMP CS IF SECONDS LDA SED SEC 1 # SBC CLD                                 SECONDS STA TIMER   STY THEN           SECONDS LDA 0<        IF MINUTES LDA SED SEC 1 # SBC CLD                        MINUTES STA 59 # LDA SECONDS STA                MINUTES LDA   1 # CMP 0= NOT IF                                                 ' (LIGHTEN-ICE) >BODY JSR THEN   THEN         ( UPDATE-TIMER SUBROUTINE CONT. 2/2            10:15 04/06/87 ) L: (INIT-TIMER)                                                  SECONDS LDA PHA 0F # AND CLC 48 # ADC                           NUM6-N STA 88 # LDA NUM6-A STA                                  PLA A LSR A LSR A LSR A LSR CLC 48 # ADC                        NUM5-N STA 87 # LDA NUM5-A STA                                  MINUTES LDA CLC 48 # ADC                                        NUM4-N STA 86 # LDA NUM4-A STA                                   DEX DL-TABLE-START >HI #     LDA TOS STA                        DEX DL-TABLE-START >LO #     LDA TOS STA                        DEX PLAYERS-ITAB   >HI #     LDA TOS STA                        DEX PLAYERS-ITAB   >LO #     LDA TOS STA                        DEX NUMBERS-ETAB   >HI #     LDA TOS STA                        DEX NUMBERS-ETAB   >LO #     LDA TOS STA                        BEGIN MSTAT BIT 0< UNTIL ( THEN WAIT FOR VBLANK )              ' (NEW-GRAPHICS) >BODY JMP   ( N N N--) END-CODE               ( UPDATE-TIMER MIN-SEC-CHECK                   09:03 04/07/87 ) CODE UPDATE-TIMER                                                ' (UPDATE-TIMER) >BODY JSR NEXT JMP END-CODE                                                                                   CODE MIN-SEC-CHECK DEX TOS STY DEX TOS STY                        MINUTES LDA 0= IF SECONDS LDA 0= IF DEY TOS STY THEN THEN       NEXT JMP END-CODE                                                                                                             CODE OVERTIME-SIGN-ON                                             BEGIN MSTAT BIT 0< UNTIL ( THEN WAIT FOR VBLANK )               OVERT    # LDA BLUE-IMAGE# STA                                  3E # LDA BLUE-X STA                                             B8 # LDA BLUE-Y STA                                             8A # LDA BLUE-ALTER STA                                        ' (PLAYER-FRAME-DISPLAY) >BODY JSR NEXT JMP END-CODE                                                                           ( GAMEOVER-SIGN-ON                             14:50 04/08/87 ) CODE GAMEOVER-SIGN-ON                                             BEGIN MSTAT BIT 0< UNTIL ( THEN WAIT FOR VBLANK )               GOVER    # LDA BLUE-IMAGE# STA                                  3E # LDA BLUE-X STA                                             B8 # LDA BLUE-Y STA                                             8A # LDA BLUE-ALTER STA                                        ' (PLAYER-FRAME-DISPLAY) >BODY JSR NEXT JMP END-CODE           CODE GAMEOVER-SIGN-OFF                                            BEGIN MSTAT BIT 0< UNTIL ( THEN WAIT FOR VBLANK )               PUCK # LDA BLUE-IMAGE# STA                                      AA # LDA BLUE-X STA                                             B8 # LDA BLUE-Y STA                                             8A # LDA BLUE-ALTER STA                                        ' (PLAYER-FRAME-DISPLAY) >BODY JSR NEXT JMP END-CODE                                                                           ( ZAMBONI-MOVE  1/2  INCLUDES DIRECT-RTN       15:55 04/07/87 ) CODE ZAMBONI-MOVE ( FELLA-IMAGE#/DX/DY --- )                     ' (TWIRL) >BODY JSR                                              BEGIN MSTAT BIT 0< UNTIL ( THEN WAIT FOR VBLANK )             0 # LDY   DEX DEX   0A # LDA TOS STA  TOS 1+ STY                          DEX DEX   03 # LDA TOS STA  TOS 1+ STY                          DEX DEX   14 # LDA TOS STA  TOS 1+ STY                          ' (DIRECT-ERASE) >BODY JSR                            0 # LDY   DEX DEX   0B # LDA TOS STA  TOS 1+ STY                          DEX DEX   03 # LDA TOS STA  TOS 1+ STY                          DEX DEX   15 # LDA TOS STA  TOS 1+ STY                          ' (DIRECT-ERASE) >BODY JSR                                                                                                                                                                                                                                                                                            ( ZAMBONI-MOVE  2/3                            11:34 04/07/87 )  BLUE-IMAGE# LDA 1 # EOR BLUE-IMAGE# STA                         BLUE-X LDA CLC NOS ADC BLUE-X STA                               BLUE-Y LDA CLC TOS ADC BLUE-Y STA                               8A # LDA BLUE-ALTER STA                                         NOS 2+ LDA REDD-IMAGE# STA                                      REDD-X LDA CLC NOS ADC REDD-X STA                               REDD-Y LDA CLC TOS ADC REDD-Y STA                               8B # LDA REDD-ALTER STA                                         ' (PLAYER-FRAME-DISPLAY) >BODY JSR                              ' (TWIRL) >BODY JSR                                             INX INX INX INX INX INX                                         NEXT JMP END-CODE                                                                                                                                                                                                                                              ( ICE>LEFT                                     11:34 04/07/87 ) CODE ZL ( ICE>LEFT)                                                BLUE-X LDA BLUE-GOALY-X STA REDD-GOALY-X STA PUCK-X STA         BLUE-Y LDA BLUE-GOALY-Y STA CLC 8 # ADC                                    REDD-GOALY-Y STA CLC 8 # ADC PUCK-Y STA              BLUE-X LDA 1A # CMP CS IF 80 # LDA  LONG-ICE # LDY                                   ELSE 81 # LDA SHORT-ICE # LDY THEN         BLUE-GOALY-ALTER STA REDD-GOALY-ALTER STA PUCK-ALTER STA        BLUE-GOALY-IMAGE# STY REDD-GOALY-IMAGE# STY PUCK-IMAGE# STY     ' (PLAYER-FRAME-DISPLAY) >BODY JSR NEXT JMP END-CODE                                                                                                                                                                                                                                                                                                                                                                                                         ( ICE>RIGHT                                    11:34 04/07/87 ) CODE ZR ( ICE>RIGHT)                                               BLUE-Y LDA BLUE-GOALY-Y STA CLC 8 # ADC                                    REDD-GOALY-Y STA CLC 8 # ADC PUCK-Y STA              BLUE-X LDA 7F # CMP CS NOT                                   IF 80 # LDA  LONG-ICE # LDY BLUE-GOALY-ALTER STA                   REDD-GOALY-ALTER STA PUCK-ALTER STA BLUE-GOALY-IMAGE# STY       REDD-GOALY-IMAGE# STY PUCK-IMAGE# STY BLUE-X LDA SEC 74 # SBC   BLUE-GOALY-X STA REDD-GOALY-X STA PUCK-X STA                 ELSE 81 # LDA SHORT-ICE # LDY BLUE-GOALY-ALTER STA                 REDD-GOALY-ALTER STA PUCK-ALTER STA BLUE-GOALY-IMAGE# STY       REDD-GOALY-IMAGE# STY PUCK-IMAGE# STY ( 83) BLUE-X LDA          SEC 8 # SBC                                                     BLUE-GOALY-X STA REDD-GOALY-X STA PUCK-X STA                 THEN ' (PLAYER-FRAME-DISPLAY) >BODY JSR NEXT JMP END-CODE                                                                       ( SETUP-NET-ICE-RIGHT                          14:11 05/12/87 ) CODE SNIR ( SETUP-NET-ICE-RIGHT)                                     BG-TOP-ICE        LDA P6C1 STA P6C2 STA P6C3 STA ( PAL 6)     98 # LDA BLUE-GOALY-X STA REDD-GOALY-X STA PUCK-X STA           70 # LDA BLUE-GOALY-Y STA CLC 8 # ADC REDD-GOALY-Y STA               CLC 8 # ADC PUCK-Y STA                                     81 # LDA BLUE-GOALY-ALTER STA REDD-GOALY-ALTER STA                         PUCK-ALTER STA                                       NET-ICE # LDA BLUE-GOALY-IMAGE# STA REDD-GOALY-IMAGE# STA                  PUCK-IMAGE# STA                                      ' (PLAYER-FRAME-DISPLAY) >BODY JSR NEXT JMP END-CODE                                                                                                                                                                                                                                                                                                                                         ( SETUP-NET-ICE-LEFT                           14:11 05/12/87 ) CODE SNIL ( SETUP-NET-ICE-LEFT)                                      BG-TOP-ICE        LDA P6C1 STA P6C2 STA P6C3 STA ( PAL 6)     FC # LDA BLUE-GOALY-X STA REDD-GOALY-X STA PUCK-X STA           58 # LDA BLUE-GOALY-Y STA CLC 8 # ADC REDD-GOALY-Y STA               CLC 8 # ADC PUCK-Y STA                                     81 # LDA BLUE-GOALY-ALTER STA REDD-GOALY-ALTER STA                         PUCK-ALTER STA                                       NET-ICE # LDA BLUE-GOALY-IMAGE# STA REDD-GOALY-IMAGE# STA                  PUCK-IMAGE# STA                                      ' (PLAYER-FRAME-DISPLAY) >BODY JSR NEXT JMP END-CODE                                                                                                                                                                                                                                                                                                                                         ( ZAMBONI-INIT                                 11:36 04/07/87 ) CODE ZAMBONI-INIT ( ZAMBONI-X/ZAMBONI-Y --- )                    ZAM1 # LDA BLUE-IMAGE# STA                                      NOS LDA BLUE-X STA TOS LDA BLUE-Y STA                           8A # LDA BLUE-ALTER STA                                         FELLA1 # LDA REDD-IMAGE# STA                                    NOS LDA CLC 3 # ADC REDD-X STA TOS LDA CLC 6 # ADC REDD-Y STA   8B # LDA REDD-ALTER STA                                         ' (PLAYER-FRAME-DISPLAY) >BODY JSR                              INX INX INX INX  NEXT JMP END-CODE                                                                                                                                                                                                                                                                                                                                                                                                                             ( SCOREFLASH-PREP                              08:44 04/20/87 ) : WAIT  50 0 DO 0 DROP LOOP SCOREFLASH-RTN ;                                                                                    CODE SCOREFLASH-PREP SCOREFLASH STY ( DELAY COUNTER )                 SCORE1 1+ STY  ( PHASE FLAG VIZ. ERASE OR DISPLAY)              SCORE1 LDA SEC SCORE2 SBC  SCORE1 STA ( WHO WON FLAG)     0= IF NEXT JMP THEN                                             0< IF NUM2-N 1+ LDA SCORE2 STA NUM3-N 1+ LDA SCORE2 1+ STA       ELSE NUM0-N 1+ LDA SCORE2 STA NUM1-N 1+ LDA SCORE2 1+ STA       THEN NEXT JMP END-CODE                                                                                                                                                                                                                                                                                                                                                                                                                                         ( SCOREFLASH-RTN 1/2                           09:27 04/20/87 ) CODE (SCOREFLASH-RTN)   SCORE1 LDA 0= IF RTS THEN                 SCOREFLASH LDA 04 # CMP CS IF SCOREFLASH STY                                            ELSE SCOREFLASH INC RTS THEN                 SCORE1 1+ LDA 0= NOT IF  SCORE1 1+ STY SCORE1 LDA        0< IF SCORE2 LDA NUM2-N 1+ STA SCORE2 1+ LDA NUM3-N 1+ STA              84 # LDY NUM2-A    STY INY        NUM3-A    STY          ELSE SCORE2 LDA NUM0-N 1+ STA SCORE2 1+ LDA NUM1-N 1+ STA              82 # LDY NUM0-A    STY INY        NUM1-A    STY THEN                              ELSE  DEY SCORE1 1+ STY SCORE1 LDA    0< IF   AA # LDA NUM2-N 1+ STA NUM3-N 1+ STA                            84 # LDY NUM2-A    STY INY        NUM3-A    STY          ELSE   AA # LDA NUM0-N 1+ STA NUM1-N 1+ STA                            82 # LDY NUM0-A    STY INY        NUM1-A    STY THEN                              THEN                                                                                                  ( SCOREFLASH-RTN 2/2                           09:32 04/20/87 )   DEX DL-TABLE-START >HI #     LDA TOS STA                        DEX DL-TABLE-START >LO #     LDA TOS STA                        DEX PLAYERS-ITAB   >HI #     LDA TOS STA                        DEX PLAYERS-ITAB   >LO #     LDA TOS STA                        DEX NUMBERS-ETAB   >HI #     LDA TOS STA                        DEX NUMBERS-ETAB   >LO #     LDA TOS STA                        BEGIN MSTAT BIT 0< UNTIL ( THEN WAIT FOR VBLANK )              ' (NEW-GRAPHICS) >BODY JMP   ( N N N--) END-CODE                                                                               CODE SCOREFLASH-RTN                                              ' (SCOREFLASH-RTN) >BODY JSR NEXT JMP END-CODE                                                                                                                                                 DECIMAL                                                                                                                         ( REDO    - ZAMBONI LOOP EXIT TO NEW GAME 1/2  15:25 06/09/87 )                                                                 : WARM-RESET S0 @ SP! R0 @ RP!                                    0 SND?-FLAG C! INIT-SOUND 0 SCORE1 ! 0 SCORE2 ! 0 SAVES1        ! 0 SAVES2 ! 0 PLAYER1 !FLAG ( SKILL AND AUTOMATION STATE )     ( REMAIN UNCHANGED) BACKGROUND-INIT RED-CHECK MAIN-LOOP ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     (                                              19:22 08/29/87 ) : ?REDO FB0 C@ FB1 C@ OR IF WARM-RESET THEN ;                   : CONSOLE-CHECK GETRAW ?RESET IF WARM-RESET THEN                ?SELECT IF BEGIN GETRAW ?SELECT 0= UNTIL                                   TITLE-UP WARM-RESET THEN    GETRAW ?PAUSE  IF                 BEGIN GETRAW ?PAUSE 0= UNTIL ( DEBOUNCE )                       WORKAREA0 C@ -1  WORKAREA0 C! 0 AUDV0 C! ( AREA0 OFF)           WORKAREA1 C@ -1  WORKAREA1 C! 0 AUDV1 C! ( AREA1 OFF)           BEGIN GETRAW                                                ?SELECT IF BEGIN GETRAW ?SELECT 0= UNTIL                                   TITLE-UP WARM-RESET THEN                            ?RESET IF  WARM-RESET  ( BYE) THEN ?PAUSE UNTIL ( PAUSE )            BEGIN GETRAW ?PAUSE 0= UNTIL WORKAREA1 C! WORKAREA0 C!                                       THEN   ( DEBOUNCE )  ;                                                                                                                                    ( ZAMBONI-LOOP  1/2                            16:00 04/07/87 ) : ZAMBONI-LOOP  SCOREFLASH-PREP PUCK-ERASE BLUE-GOALY-ERASE         REDD-GOALY-ERASE BLUE-ERASE REDD-ERASE GAMEOVER-SIGN-ON         4000 0 DO 0 DROP LOOP 09 40 ZAMBONI-INIT SNIR SNIL                                 TURK-SND   2 0 DO                         65 0 DO FELLA1 2 0 ZAMBONI-MOVE ZR WAIT CONSOLE-CHECK           ( NEXT-JOYS ) ?REDO LOOP ( I 0= IF TURK-SND THEN )                             FELLA2 0 0 ZAMBONI-MOVE WAIT WAIT                24 0 DO FELLA3 0 1 ZAMBONI-MOVE WAIT CONSOLE-CHECK ( NEXT-JOYS) ?REDO LOOP     FELLA4 0 0 ZAMBONI-MOVE WAIT WAIT                65 0 DO FELLA5 -2 0 ZAMBONI-MOVE ZL WAIT CONSOLE-CHECK          ( NEXT-JOYS ) ?REDO LOOP                                                       FELLA4 0 0 ZAMBONI-MOVE WAIT WAIT TURK-SND       24 0 DO FELLA3 0 1 ZAMBONI-MOVE WAIT CONSOLE-CHECK ( NEXT-JOYS) ?REDO LOOP     FELLA2 0 0 ZAMBONI-MOVE WAIT WAIT                                          LOOP                                 ( ZAMBONI-LOOP 2/2                             16:00 04/07/87 )  65 0 DO FELLA1 2 0 ZAMBONI-MOVE ZR WAIT CONSOLE-CHECK           ( NEXT-JOYS)  ?REDO LOOP                                                                    FELLA2 0 0 ZAMBONI-MOVE  WAIT WAIT  24 0 DO FELLA3 0 1 ZAMBONI-MOVE   WAIT CONSOLE-CHECK            ( NEXT-JOYS)  ?REDO LOOP                                                          FELLA4 0 0 ZAMBONI-MOVE  WAIT WAIT            65 0 DO FELLA5 -2 0 ZAMBONI-MOVE ZL WAIT CONSOLE-CHECK          ( NEXT-JOYS)  ?REDO LOOP ;                                                                                                     CODE ?BONUS DEX TOS STY DEX TOS STY                                         BONUS LDA 0= IF       ( BONUS HASN'T BEEN GIVEN YET)            SCORE1 LDA SCORE2 CMP 0= IF DEY TOS STY THEN                                 ELSE BONUS STY THEN                         NEXT JMP END-CODE                                                                                                          ( USER-CHOICE no exp/nov for 2-plr...jjt       09:57 08/27/87 ) HEX CODE USER-CHOICE                                                 BG-FREE2 LDA                                                  (  DY0  LDA  DY1 ORA ) 1 # CMP 0=                                IF    1PLAYERB # LDA BLUE-IMAGE# STA  ( two player )                  2PLAYERR # LDA REDD-IMAGE# STA                                  EXPERTB # LDA BLUE-GOALY-IMAGE# STA  ( turn off )               NOVICEB # LDA REDD-GOALY-IMAGE# STA  ( exp/novice)              0 # LDA PLAYER2 9 + STA 01 # LDA BG-FREE2 STA             ELSE  FF # CMP 0= IF                                                  1PLAYERR # LDA BLUE-IMAGE# STA  ( one player)                   2PLAYERB # LDA REDD-IMAGE# STA                                  2 # LDA PLAYER2 9 + STA FF # LDA BG-FREE2 STA                   EXP-NOV JSR THEN                                       ( DY=0)  PLAYER2 9 + LDA 2 # CMP 0= IF EXP-NOV JSR THEN THEN                                                                   ( USER-CHOICE CONT.   REV. jjt                 09:58 08/27/87 )   82 # LDA BLUE-ALTER STA 83 # LDA REDD-ALTER STA                 85 # LDA BLUE-GOALY-ALTER STA 84 # LDA REDD-GOALY-ALTER STA    ' (PLAYER-FRAME-DISPLAY) >BODY JSR NEXT JMP                                                                                    L: EXP-NOV BG-FREE3 LDA ( DX0 LDA DX1 ORA ) L: LBL2                1 # CMP  0= IF NOVICEB # LDA REDD-GOALY-IMAGE# STA                          EXPERTR # LDA BLUE-GOALY-IMAGE# STA                ( 3) 0 # LDA SKILL STA 01 # LDA BG-FREE3 STA LBL1 JMP THEN       FF # CMP 0= IF NOVICER # LDA REDD-GOALY-IMAGE# STA                             EXPERTB # LDA BLUE-GOALY-IMAGE# STA             ( 6) 1 # LDA SKILL STA FF # LDA BG-FREE3 STA LBL1 JMP THEN       SKILL LDA 0= IF 1 # LDA ELSE FF # LDA THEN LBL2 JMP          L: LBL1 RTS END-CODE                                                                                                                                                                            ( DEMO-LOOP ATARI                              00:38 02/05/87 ) : DEMO-LOOP 1 SND?-FLAG C! DEMO-TIMER UPDATE-SCORE                            200 0 DO 0 DROP LOOP                                BEGIN SERVE WHIZ-DONE OFF WHIZ-COUNT OFF                             BEGIN  1 CYCLE# +! WHIZ-COUNT @ 0= IF ( NEXT-JOYS  )                   PLAYER1-PROCESS GOALIE1-PROCESS                                 PLAYER2-PROCESS GOALIE2-PROCESS                                 RANDOM-SOUNDS                                                   CHECK-PLAYER-PLAYER MOVE-PUCK     THEN                          WHIZ-COUNT C@ IF WHIZ ELSE CHECK-FOR-GOAL                       ANIMATOR                                                        UPDATE-TIMER UPDATE-SCORE  THEN CONSOLE-CHECK                   WHIZ-DONE @ MIN-SEC-CHECK OR FB0 C@ FB1 C@ OR OR                UNTIL MIN-SEC-CHECK  FB0 C@ FB1 C@ OR OR            UNTIL 0 SND?-FLAG C! INIT-SOUND ;                                                                                             ( DECIDE-SELECT                                09:55 06/10/87 ) ( PLAYER2 9+ = 2->ONE-PLAYER    0->TWO-PLAYER                 ) ( SKILL      = 1->NOVICE        0->EXPERT                     ) CODE DECIDE-SELECT PLAYER2 9 + LDA 0=  IF                         SKILL      LDA 0=                                               IF ( 2PLAYER/EXPERT>1PLAYER/NOVICE) DEY DX0 STY DY0 STY       ELSE ( 2PLAYER/NOVICE>2PLAYER/EXPERT) INY DX0 STY DY0 STY       THEN ELSE                                                         SKILL      LDA 0=                                               IF ( 1PLAYER/EXPERT>2PLAYER/NOVICE) INY DY0 STY DEY DEY                                             DX0 STY                   ELSE ( 1PLAYER/NOVICE>1PLAYER/EXPERT) DEY DY0 STY INY INY                                             DX0 STY                   THEN THEN NEXT JMP END-CODE                                                                                                                                                                     ( TITLE-SELECT-BUTTON-RTN LIMITED-CONSOLE-     09:20 06/10/87 ) : LIMITED-CONSOLE-CHECK GETRAW ?PAUSE  IF                                BEGIN GETRAW ?PAUSE 0= UNTIL ( DEBOUNCE )                       WORKAREA0 C@ 0FF WORKAREA0 C! 0 AUDV0 C! ( AREA0 OFF)           WORKAREA1 C@ 0FF WORKAREA1 C! 0 AUDV1 C! ( AREA1 OFF)           BEGIN GETRAW ?RESET IF -1 FB0 C!                                   WORKAREA1 C! WORKAREA0 C!     EXIT THEN                                    ?PAUSE UNTIL ( PAUSE )                            BEGIN GETRAW ?PAUSE 0= UNTIL WORKAREA1 C! WORKAREA0 C!             THEN   ( DEBOUNCE ) ?RESET FB0 C!                                                              ;                    : TITLE-SELECT-BUTTON-RTN   GETRAW ?SELECT IF                            BEGIN GETRAW ?SELECT 0= UNTIL ( DEBOUNCE )                      DECIDE-SELECT THEN ;                                                                                                                                                                   ( TITLE/DEMO-LOOP                              13:48 05/11/87 ) : TITLE-RTN                                                             USER-CHOICE                                               DY1 C@ DY0 C@ OR ?DUP IF BG-FREE2 C! THEN                       DX1 C@ DX0 C@ OR ?DUP IF BG-FREE3 C! THEN                     0    BEGIN  ( NEXT-JOYS )                                             ( TITLE-SELECT-BTN AFTER N-JOYS SINCE MODIFIES DX0/DY0)         LIMITED-CONSOLE-CHECK USER-CHOICE 1+                        TITLE-SELECT-BUTTON-RTN                                         DY1 C@ DY0 C@ OR ?DUP IF BG-FREE2 C! THEN                       DX1 C@ DX0 C@ OR ?DUP IF BG-FREE3 C! THEN                           DX0 C@ DY0 C@ OR DX1 C@ OR DY1 C@ OR IF DROP 0 THEN             DUP 750 = FB0 C@ OR FB1 C@ OR ?RESET  OR                      UNTIL DROP ;                                                                                                                                                                                ( TITLE SCREEN MANAGEMENT RTNS                 14:49 04/17/87 ) : DEMO-RTN  FB0 C@ FB1 C@ OR ?RESET OR IF -1 EXIT THEN            0 SCORE1 ! 0 SCORE2 ! 0 SAVES1 ! 0 SAVES2 !                     2 PLAYER1 !FLAG 2 PLAYER2 !FLAG BACKGROUND-INIT RED-CHECK       DEMO-LOOP 0 400 0 DO 0 DROP LOOP ;                            : TITLE-INIT 7B DUP BG-SCOREAREA C! BG-TOP-ICE C!                   GNE0  18 0F DL-INIT                                             GNE17  2  4 DL-INIT                                             TITLE-ETAB-ROM PLAYERS-ETAB 30 PLAYERS-ETAB-INIT ;                                                                          CODE FIRST-TITLE FF # LDA DY0 STA DX0 STA                            BG-FREE2 STA BG-FREE3 STA NEXT JMP END-CODE                CODE REPEAT-TITLE BG-FREE2 LDA DY0 STA BG-FREE3 LDA DX0 STA                       NEXT JMP END-CODE                                                                                                                                                             ( RED-CHECK - DETERMINES RED/COMPUTER DISPLAY  12:23 04/17/87 ) CODE RED-CHECK PLAYER2 9 + LDA 0= IF                              BEGIN MSTAT BIT 0< UNTIL ( THEN WAIT FOR VBLANK )               VS-RED   # LDA BLUE-IMAGE# STA                                  7C # LDA BLUE-X STA                                             0E # LDA BLUE-Y STA                                             8D # LDA BLUE-ALTER STA                                        ' (PLAYER-FRAME-DISPLAY) >BODY JSR THEN NEXT JMP END-CODE                                                                      DECIMAL                                                                                                                                                                                                                                                                                                                                                                                                                                                         ( MAIN-LOOP ATARI      rev. JJT                17:08 08/27/87 ) : MAIN-LOOP TIMER-INIT                                            BEGIN UPDATE-SCORE 200 0 DO 0 DROP LOOP                           BEGIN WHIZ-DONE OFF WHIZ-COUNT OFF SERVE                           BEGIN  CONSOLE-CHECK 1 CYCLE# +! WHIZ-COUNT C@                      IF    WHIZ                                                      ELSE  PLAYER1-PROCESS  GOALIE1-PROCESS                                PLAYER2-PROCESS  GOALIE2-PROCESS                                CHECK-PLAYER-PLAYER MOVE-PUCK                                   CHECK-FOR-GOAL ANIMATOR THEN                                    UPDATE-TIMER UPDATE-SCORE RANDOM-SOUNDS                WHIZ-DONE @ MIN-SEC-CHECK OR UNTIL                          BONUS C@ ( =20H IF OVERTIME) MIN-SEC-CHECK OR UNTIL ?BONUS    IF OVERTIME-SIGN-ON OVERTIME-SND 30000 0 DO LOOP BONUS-INIT     ELSE ENDGAME-SND ZAMBONI-LOOP TITLE-UP TIMER-INIT THEN          AGAIN ;                                                       ( HOCKEY                                       22:45 02/07/87 ) : FOREGRND-TASK 0 SND?-FLAG C! GRAPHICS-MODE                      INIT-SOUND TITLE-INIT FIRST-TITLE TITLE-RTN DEMO-RTN            IF NEW-GAME ELSE TITLE-UP THEN ;                              : TITLE-UP 0 SND?-FLAG C!                                         BEGIN INIT-SOUND TITLE-INIT REPEAT-TITLE TITLE-RTN DEMO-RTN     UNTIL NEW-GAME ;                                              : HOCKEY 0 SND?-FLAG C! INIT-SOUND  FANFARE-SND                             BEGIN GETRAW ?RESET 0= UNTIL                          0 SCORE1 ! 0 SCORE2 ! 0 SAVES1 ! 0 SAVES2 !                     0 PLAYER1 !FLAG   BEGIN CONSOLE-CHECK WORKAREA1 C@                WORKAREA0 C@ AND 255 = UNTIL                                  BACKGROUND-INIT RED-CHECK  ( BEGIN-SNDS ) MAIN-LOOP ;           ' HOCKEY main-loop ! ' TITLE-UP select-rtn !                  (  ?DIFFR IF 0 ELSE 2 THEN PLAYER2 !FLAG  )                     (  ?DIFFL IF 3 ELSE 6 THEN SKILL C!   HIGHER IS MORE STUPID)    ( LAST SCREEN--END OF MC ATARI 7800            23:52 05/22/86 ) ' FOREGRND-TASK ' ABVAR >BODY !  ( set the constant ABVAR )                                                                     HEX                                                             ( reset bootup literals )    ( NMI     RESET   IRQ )                                                                            FFF9 HERE - ALLOT 47 C,              NMI , ( VIDEO-INT-RTN )                                       RESET , ( ORIGIN )                                                IRQ , ( an RTI )           FF80 79 -1 FILL                                                 FORTH DEFINITIONS                                               LATEST INIT-FORTH !                                             THERE  INIT-DP !                                                                                                                                                                                ( X=14 SCOREBOARDA   X=110 SCOREBOARDB )