News: 11 March 2016 - Forum Rules, Mobile Version
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia

Author Topic: NBA Jam TE (SNES) ASM Tidbits  (Read 162 times)

eskayelle

  • Jr. Member
  • **
  • Posts: 12
    • View Profile
NBA Jam TE (SNES) ASM Tidbits
« on: June 13, 2018, 03:38:58 pm »
I wanted to throw this onto the forum in case there are some folks out there pondering an annual update to NBA Jam TE but looking for more data before digging in.  With a big shout-out to phonymike for all his guidance to date regarding ASM, team values, etc., I provide below some assembly code that should mimic the current order of teams in Jam TE, such that a hacker could modify it, re-assemble, and effectively re-sort the 27 teams (such as based on current year standings, if that were the intent).

Code: [Select]
lorom

org $CCFDB2
dw #$0007 ;Mavs
dw #$000A ;T-Wolves
dw #$0015 ;Heat
dw #$001A ;Bullets
dw #$0019 ;76ers
dw #$0006 ;Kings
dw #$0008 ;Nuggets
dw #$0013 ;Bucks
dw #$0012 ;Indiana
dw #$000D ;Atlanta
dw #$0001 ;Clippers
dw #$0018 ;Magic
dw #$0011 ;Pistons
dw #$0000 ;Warriors
dw #$0014 ;Celtics
dw #$000E ;Hornets
dw #$0002 ;Lakers
dw #$0016 ;Nets
dw #$0010 ;Cavs
dw #$000B ;Spurs
dw #$0017 ;Knicks
dw #$0004 ;Blazers
dw #$000C ;Jazz
dw #$0005 ;Sonics
dw #$0003 ;Suns
dw #$000F ;Bulls
dw #$0009 ;Rockets

Please forgive any apparent syntax errors, and hopefully it's a value to someone!

June 19, 2018, 10:33:09 am - (Auto Merged - Double Posts are not allowed before 7 days.)
For those interested in hacking NBA Jam TE, I figured I'd tack on to this thread some additional discoveries as I have them.  This portion of the ROM would allow anyone to change the maximum amount of injuries that can be accumulated in the game.

Please forgive any syntax errors, copy/paste errors (players 1 through 4 have the same 5 operations, just hitting 4 different RAM addresses) or transpositions.

Code: [Select]
lorom

;===
;NBA Jam TE
;Injury Max Disassembly
;===
org $8085E6 ;PC address $0005E6
LDA $1677 ;AD 77 16 ;Load into A the P1 injury value stored in RAM ($7E001677)
CMP #$0019 ;C9 19 00 ;Compare value in A to #$19 (25 in base 10/decimal)
BCC #$06 ;90 06 ;Branch if Carry Clear (goto a label (06?)) if injuries < #$19; otherwise...
LDA #$0019 ;A9 19 00 ;Reset A to the max injury value of #$19
STA $1677 ;8D 77 16 ;Store that max injury value into RAM
LDA $1679 ;AD 79 16 ;Load into A the P2 injury value stored in RAM ($7E001679)
CMP #$0019 ;C9 19 00 ;Compare value in A to #$19 (25 in base 10/decimal)
BCC #$06 ;90 06 ;Branch if Carry Clear (goto a label (06?)) if injuries < #$19; otherwise...
LDA #$0019 ;A9 19 00 ;Reset A to the max injury value of #$19
STA $1679 ;8D 79 16 ;Store that max injury value into RAM
LDA $167B ;AD 7B 16 ;Load into A the P3 injury value stored in RAM ($7E00167B)
CMP #$0019 ;C9 19 00 ;Compare value in A to #$19 (25 in base 10/decimal)
BCC #$06 ;90 06 ;Branch if Carry Clear (goto a label (06?)) if injuries < #$19; otherwise...
LDA #$0019 ;A9 19 00 ;Reset A to the max injury value of #$19
STA $167B ;8D 7B 16 ;Store that max injury value into RAM
LDA $167D ;AD 7D 16 ;Load into A the P4 injury value stored in RAM ($7E00167D)
CMP #$0019 ;C9 19 00 ;Compare value in A to #$19 (25 in base 10/decimal)
BCC #$06 ;90 06 ;Branch if Carry Clear (goto a label (06?)) if injuries < #$19; otherwise...
LDA #$0019 ;A9 19 00 ;Reset A to the max injury value of #$19
STA $167D ;8D 7D 16 ;Store that max injury value into RAM


3.3 [6/18 and 6/19/18 - 2.5 hrs]:
Having previously performed a cheat search in the ROM using SNES9X Geiger, and having determined that the following RAM values store injuries:
1) Player 1 = $7E1677 (SNES LOROM Address)
2) Player 2 = $7E1679
3) Player 3 = $7E167B
4) Player 4 = $7E167D
conducted a search in the hex code for a byte-swapped string "AD 77 16" (translates to LDA $1677).
Looked for a CMP, BCC, or BCS function near that code, with a value of #$19 (25 in decimal).  Located such at PC address $0005E6.
Using an opcode/hex code table from assembler.it/portale/5/65816_guide/opcode_reference.asp, translated by hand the hex codes to opcodes near that address.
(I didn't have my tools at the time...)
Based on the above, replaced 8 instances of #$19 (hex code 19; decimal 25) with #$63 (decimal 99). 
Effectively replaced the value in the compare function and the store function to increase the max injury value allowed from 25 (decimal) to 99.
Playtest was successful!

« Last Edit: June 20, 2018, 08:14:35 am by eskayelle »