Jump to content
NHL'94 Forums

HOW TO: Pull CPU Goalie earlier & by how many goals [GENS]


McMarkis

Recommended Posts

Pull CPU Goalie earlier when losing


Note:
Thanks to @chaos & @smozoma for assisting with some 68K assembly knowledge sharing.

Pull CPU Goalie earlier in the 3rd:
Want to change how early the CPU pulls its goalie when losing?

ROM Offset: (hex)0000F766-0000F767
Change: 00 3C to 00 96

The above change will pull the goalie with 2:30 remaining in the 3rd period.

image.png

Pull CPU Goalie when losing by 1 goal instead of 2:
You can also modify how many goals the CPU is losing by when the goalie gets pulled.
**There is currently a bug in GENS where it will only pull the goalie if its equal to this value. See below patch by @smozoma to fix this.

ROM Offset: (hex)0000F75F
Change: 02 to 01

The above change will pull the goalie when losing by 1 goal instead of 2 goals.

image.png

Edited by McMarkis
update
  • Love 2
  • Thanks 1
  • Like 2
  • Wow 2
Link to comment
Share on other sites

  • McMarkis changed the title to HOW TO: Pull CPU Goalie earlier & by how many goals [GENS]

Pull CPU Goalie when losing by 1 to N goals

Triple-team job (McMarkis, chaos, and me) on Discord to solve the number of goals bug.

I ran a trace in the emulator tonight and I think this should work:

ROM Offset: 0000 F758
Change:     6B to 63  (BMI to BLS)

ROM Offset: 0000 F760
Change:     66 to 62  (BNE to BHI)
  
ROM Offset: 0000 F75F
Change:     02 to 0N
Note:       N is the max number of goals to pull the goalie on. 
            Example: Set to 03 for the goalie to be pulled when down 1,2, or 3 goals.

For how it works, here is the code:

================================================================================
OLD - Only pulls goalie if goal differential is exactly 2.
      The code is run twice, swapping the teams the second time.
--------------------------------------------------------------------------------
00:F750  30 29  MOVE.W  $000C(A1),D0       ; D0 = "Score of one of the teams"
00:F754  90 6A  SUB.W   $000C(A2),D0       ; D0 = D0 - "Score of the other team"
00:F758  6B 00  BMI     #$5D0A [01:5464]   ; Abort if D0 < 0 (don't pull goalie)
                                           ; Continue if D0 >=0
00:F75C  B0 7C  CMP.W   #$0002,D0          ; Bits = D0 minus 2
00:F760  66 00  BNE     #$5D02 [01:5464]   ; Abort if D0 != 2 (don't pull goalie)
                                           ; Continue if D0 == 2
================================================================================

================================================================================
NEW - Pull goalie if goal differential is >0 and <=2.
      (Still runs twice with the teams swapped)
--------------------------------------------------------------------------------
00:F750  30 29  MOVE.W  $000C(A1),D0       ; D0 = "Score of one of the teams"
00:F754  90 6A  SUB.W   $000C(A2),D0       ; D0 = D0 - "Score of the other team"
00:F758  63 00  BLS     #$5D0A [01:5464]   ; Abort if D0 <= 0 (don't pull goalie)
                                           ; Continue if D0 >0
00:F75C  B0 7C  CMP.W   #$0002,D0          ; Bits = D0 minus 2
00:F760  62 00  BHI     #$5D02 [01:5464]   ; Abort if D0 > 2 (don't pull goalie)
                                           ; Continue if D0 <= 2
================================================================================
                                                              
                                                              
How to read an instruction:
00:F750  30 29  MOVE.W  $000C(A1),D0       ; D0 = "Score of one of the teams"
                                           ; stuff after a semicolon is a "comment" not code
^^:^^^^                                    ; address in ROM file
         ^^ ^^                             ; instruction hex code
                ^^^^^^                     ; instruction human-readable name
                        ^^^^^^^^^^^^^      ; instruction parameters
                                           ; "D0" is "Data Register 0" (a place to store temporary calulation values)

 

Edited by chaos
Fixed "Old Code" D0 branch
  • Love 3
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...