Language…
6 users online: cozyduck, Firstnamebutt, Golden Yoshi, GRIMMKIN, Pink Gold Peach, qantuum - Guests: 244 - Bots: 426
Users: 64,795 (2,377 active)
Latest user: mathew

NBA Jam TE (SNES) ROM Questions

Hello, friends of the portly plumber.

I've been lurking the board for a tad, along with zophar.net and romhacking.net and was hoping I might be able to pose some questions and get some additional guidance with respect to a romhack I'm working on for NBA Jam TE. My personal goal is to simply tidy it up by getting some answers or guidance for the questions that follow... and perhaps if I were able to tidy it up enough, maybe some folks or a group would be eventually interested in taking that hack and developing an annual NBA Jam update, much like is done for Tecmo Bowl...

...But that's perhaps a future dream...

For now, I'm hoping I might be able to get some directions with respect to a handful of items.

1) I'd like to change the Rookies' uniforms such that they look like Olympics uniforms, reason being last year I hacked the team and replaced it with the 1992 Dream Team. Running through the game, I think an easy fix would be to reset the team's uniform reference to that of the Detroit Pistons (the white and blue alternate uniform, presuming there's only one option for the palette/color; otherwise both uniform types). If the fix is this simple, I'm wondering if anyone can guide me to where perhaps the pointers would be to the uniforms such that I could swap out the Rookies uniform reference for the Pistons one. SOLVED!

2) I'd like to set up the team select screen such that two buttons cycle backward through the various player combinations. Currently, A, B, X, and Y all cycle forward; I'd like to set X and Y to go in the other direction. This would require an ASM hack, which I don't have enough knowledge of to pull off (much of my work has been direct hex editing and use of TileMolester). Is there code someone would be able to walk me through that would accomplish this? I'm playing with xkas and injecting some simple assembly here and there, and I'd like to learn about the various commands required by such an ASM hack, so if you were willing to provide me a quick tutorial and maybe answer a follow-up question or two on the whys of coding, I'd definitely appreciate it.

3) I've read of a bug in the original game where players who beat all 27 teams don't get their initials in the Grand Champions screen (I've now playtested my own hack more than enough times over the past year to verify this). If there's a bug fix, is there a simple hex edit I can do, or does it require an ASM hack? SOLVED!

4) Injuries - There looks to be another bug where the injury values for a two person team used in game 1 will extend to the first quarter of game 2 if the same team and same player combination is selected. It may be a tad more than this, as I did some cheat code searches using SNES Geiger and thought I saw the player two injury value reset from previous game Q4 injury value to zero at new game tip-off, and then jump to another value (in one game, all the way to 14). I think I found the 4 values in RAM for injuries, one for each player on the court via that search and some breakpoint attempts, but I don't quite know where to go from there. Looking to see if there's a simple fix here, or - again - if there's so tutelage I can get, such that the injury value resets properly to zero for all players at tip-off of each new game. SOLVED!

(Building on that one, I'd love to figure out how to ramp up that max injury value from 25 to perhaps 50 or 99.) SOLVED!

Thanks to all who read and especially to those who reply!

P.S., Mattrizzle, you don't happen to be active on the board and have a moment or two to provide some thoughts, do you?
A little "quid pro quo", in case someone can help with the above questions, or just to pay it forward to others...

With a big shout-out to phonymike for helping me find team values, I provide below some assembly code that should mimic the current order of teams in Jam TE.

Code
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


Here is a disassembly and translation I did for a part of the ROM. This particular portion would allow anyone to change the maximum amount of injuries that can be accumulated in the game.

Code
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


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.
Here is one solution to the injury bug. ASM below.

The Issue:
In the original game, there appears to be a bug whereby, if two games are played sequentially, with the same team selected, and the same line-up from quarter 4 of game 1 selected for quarter 1 of game 2, the first game's injury stats do not reset to zero in game 2, so you come off the bench with a potential handicap.

The caveats to this code:
1) I didn't necessarily consider SEPs and REPs, i.e., the 8 v. 16-bit status in the accumulators. It ended up not causing an issue and thus created more efficient code (because I didn't add in those SEP and REP commands), but...
a) If one were to hack the game and increase the timer from 180 (decimal) seconds to 256 or more, I suspect the game will crash.
b) If one were to hack the game and increase the maximum injury value permitted from 25 (decimal) to 256 or more, I suspect the game will crash.
2) I believe the bug is in large part due to the ram values for the visual injury stats not properly resetting, but to be safe, I'm resetting those to zero AND the actual injury values in ram. It's incredibly likely that more efficient code can be written to solve this bug, but this particular hack does the trick.
3) I'm using expanded rom (i.e., I expanded the rom to 32Mbit -- it's originally 24). So, one would either need to relocate where they're putting this code or expand their rom size for this to work.

Code
;===
;NBA Jam Injury Bugfix
;Written by eskayelle
;Proofread/debugged by phonymike
;General Idea - If the Timer is 3 minutes, check the quarter value
;Then, if the quarter value is zero, zero out all the injury stats
;Otherwise, leave those injury stats alone
;===
lorom

org $A7F429			;Need to find a place around tip-off to move about 4 bytes of original code into the hack below so I can create this JSL
	NOP #2			;Taking 6 bytes, since 2 commands will need to be moved to fit the 4 byte JSL $E08050 command
	JSL $E08050		;Jump to the subroutine at $E08050 (the injury bugfix hack); hex code will be 22 50 80 E0

org $E08050			;Goto expanded rom
	PHX			;Push X onto stack in case it's in use
	PHY			;Same for Y
	LDX $0D95		;Load quarter value (seems to increment from 0 to 3 at start of each quarter, no matter the game) into X ($7E0D95)
	LDY $0D89		;Load timer value into Y ($7E0D89)
	CPY #$B4		;Timer always starts at 3 minutes (unless hacked), or 180 seconds, at start of quarter, so compare Y to this - needs to be 8 bit 
	BNE +			;If Y <> 180 seconds (B4 in hex), goto +; otherwise, move on to next step
	JSR Timer
+	PLY			;Pull back Y from stack like nothing happened
	PLX			;Same for X
	LDA $07D8		;First 3 bytes of the original code moved here to make up for putting in the JSL above
	CMP $1756		;Last 3 of the original code - like we never moved it...
	RTL			;Return to original code (RTL goes to the most recent JSL/JSR executed (i.e., the original code)

Timer:
	CPX #$00		;Value in $7E0D7B in Q1 is zero, so compare value in X to zero
	BNE +			;If X <> zero, goto +; otherwise, move on to next step
	JSR Quarter
+	RTS			;Return to above subroutine

Quarter:
	STZ $1677		;Player 1 injury stat in RAM; accumulator bit size is not an issue as long as max injury allowed < 256
	STZ $1758		;$1677 is pulling from $1758 in the code (below where I injected this)
	STZ $1679		;Player 2 injury stat in RAM
	STZ $175C		;$1679 is pulling from $175C in the code (below where I injected this)
	STZ $167B		;Player 3 injury stat in RAM
	STZ $1760		;$167B is pulling from $1760 in the code (below where I injected this)
	STZ $167D		;Player 4 injury stat in RAM
	STZ $1764		;$167D is pulling from $1764 in the code (below where I injected this)
	RTS			;Return to above subroutine; disassemble $A7F429 thru $A7F4A9 to see the injury routine



Hoping this might prompt any takers to peek at my initial questions above and perhaps provide some thoughts/guidance?
Based on everything I've learned about the ROM so far, here is my current end product.

http://www.romhacking.net/hacks/4097/

Please feel free to provide constructive criticism or tips on my questions previously provided.

Thank you!
Woah, man...

That looks heckuva INSANE! Your hack screams 90's-esque, but hey, I like this so much!
The Hacking of PuyoPuyo. Come join the fun, friends. 『いけいけ団長、頑張れ頑張れ団長!』
Help us raise funds for the Armed Forces of Ukraine. #ДопомагаємоРазом / #HelpTogether
“Even if you personally are so dissatisfied with life that you want the world to end, surely the cruel reality is that it will continue on, unchanging. All the better for someone perfectly content, like me.”
Aya Shameimaru, Touhou Suzunaan ~ Forbidden Scrollery
Thanks for the kind words! The game was originally published in the early 90's, so I wanted to keep to that theme and not change too much on the players side. A current year update would be a bit too lofty a project for me alone, and there's already a pretty sweet NBA Jam 2k17 hack out there. I was going more for putting back in some players that deserved the Jam treatment back in the day, and making some more interesting secret players than the original game had. And then my wish list started to grow, and my revisons started to get a bit out of hand... :-)

Thanks again!