Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

NBA Jam Tournament Edition (SNES)/ROM map/Titlescreen code

From Data Crystal
Jump to navigation Jump to search

This is a sub-page of NBA Jam Tournament Edition (SNES)/ROM map.

Note for template.png
Note:
This code loops through a series of 16 bit values (8 of them) stored at 0B7C3A [$16:FC3A] and compares them to player input. Then sets a bit at $16FF if entered correctly.


Commented titlescreen input check routine

-------------------------
here are the input values
-------------------------
org $16FC3A
	dw #$4000		;Y
	dw #$0800		;up
	dw #$0400		;down
	dw #$8000		;B
	dw #$0200		;left
	dw #$0080		;A
	dw #$0100		;right
	dw #$0400		;down

--------------------------------------
get total correct input amount counter
--------------------------------------
$8A/8847 AE FD 16    LDX $16FD  [$00:16FD]   A:4000 X:0034

--------------------------------------------
use that as an index to get next input value
--------------------------------------------
$8A/884A BF 3A FC 16 LDA $16FC3A,x[$16:FC3A] A:4000 X:0000

-----------------------------------------
compare next input value to current input
-----------------------------------------
$8A/884E C5 88       CMP $88    [$00:0088]   A:4000 X:0000
$8A/8850 D0 12       BNE $12    [$8864]      A:4000 X:0000

$8A/8852 E8          INX                     A:4000 X:0000
$8A/8853 E8          INX                     A:4000 X:0001
$8A/8854 8E FD 16    STX $16FD  [$00:16FD]   A:4000 X:0002

---------------------------------------
compare to 16 decimal (8 correct inputs)
---------------------------------------
$8A/8857 E0 10 00    CPX #$0010              A:4000 X:0002
$8A/885A D0 0E       BNE $0E    [$886A]      A:4000 X:0002

--------------------------
code was entered correctly
--------------------------
$8A/885C A9 01 00    LDA #$0001              A:0400 X:0010
$8A/885F 8D FF 16    STA $16FF  [$00:16FF]   A:0001 X:0010
$8A/8862 80 06       BRA $06    [$886A]      A:0001 X:0010

--------------------------------------------------
wrong input, reset the total correct input counter
--------------------------------------------------
$8A/8864 A9 00 00    LDA #$0000              A:FFFF X:0010
$8A/8867 8D FD 16    STA $16FD  [$00:16FD]   A:0000 X:0010

$8A/886A end