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.
The wiki has recently moved; please report any issues in Discord. Pardon the dust.
Boulder Dash (NES)/ROM map: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(→Disassembly: edited comments to reflect abstraction and not verbalization of asm opcodes.) |
||
Line 78: | Line 78: | ||
==Disassembly== | ==Disassembly== | ||
===Password Comparison Routine=== | |||
This fragment of code compares the input password with the passwords of all 24 levels of the game. | |||
<pre> | <pre> | ||
00:A8BA:A9 00 LDA #$00 | |||
00:A8BC:85 67 STA $0067 // Reset level counter | |||
00:A8BA:A9 00 LDA #$00 | loop: | ||
00:A8BC:85 67 STA $0067 | 00:A8BE:A5 67 LDA $0067 // Load level counter | ||
00:A8BE:A5 67 LDA $0067 | 00:A8C0:0A ASL | ||
00:A8C0:0A ASL | 00:A8C1:0A ASL | ||
00:A8C1:0A ASL | 00:A8C2:0A ASL | ||
00:A8C2:0A ASL | 00:A8C3:AA TAX // Level password character counter X:= A * 8 | ||
00:A8C3:AA TAX | 00:A8C4:A0 00 LDY #$00 // Reset input password character counter | ||
00:A8C4:A0 00 LDY #$00 | passwordCompare: | ||
00:A8C6:B9 4D 00 LDA $004D,Y | 00:A8C6:B9 4D 00 LDA $004D,Y // Load Ath character from input password at $004D | ||
00:A8C9:DD 27 A9 CMP $A927,X | 00:A8C9:DD 27 A9 CMP $A927,X // Compare to level passwords at $A927. | ||
00:A8CC:D0 09 BNE $A8D7 | // Data structure: [Lvl 1 password (8bytes)][Lvl 2 password (8bytes)]… | ||
00:A8CE:E8 INX | // Only the first 6 bytes are used, see below. | ||
00:A8CF:C8 INY | 00:A8CC:D0 09 BNE $A8D7 // If not equal, goto nextLevel | ||
00:A8D0:C0 06 CPY #$06 | 00:A8CE:E8 INX // Increment level password character counter | ||
00:A8D2:90 F2 BCC $A8C6 | 00:A8CF:C8 INY // Increment input password character counter | ||
00:A8D4:4C E2 A8 JMP $A8E2 | 00:A8D0:C0 06 CPY #$06 // Check if password length of $06 characters is reached | ||
00:A8D7:E6 67 INC $0067 | 00:A8D2:90 F2 BCC $A8C6 // If not, goto passwordCompare | ||
00:A8D9:A5 67 LDA $0067 | 00:A8D4:4C E2 A8 JMP $A8E2 // Comparison finished, current level password matches input password. Goto passwordCorrect. | ||
00:A8DB:C9 18 CMP #$18 | nextLevel: | ||
00:A8DD:90 DF BCC $A8BE | 00:A8D7:E6 67 INC $0067 // Increment level counter | ||
00:A8D9:A5 67 LDA $0067 | |||
00:A8DB:C9 18 CMP #$18 // Check if last level was reached | |||
00:A8DD:90 DF BCC $A8BE // If not, goto loop | |||
⋮ ⋮ | |||
</pre> | </pre> | ||
<includeonly>[[Category:ROM maps]][[Category:Boulder Dash|ROM map]]</includeonly> | <includeonly>[[Category:ROM maps]][[Category:Boulder Dash|ROM map]]</includeonly> |
Revision as of 13:03, 11 September 2010
Addresses:
- 0x2773 = Rockford Palette Selection
- 0x2931-0x2938 = World 1 Password Data
- 0x2939-0x2940 = World 2 Password Data
- 0x2941-0x2948 = World 3 Password Data
- 0x2948-0x2950 = World 4 Password Data
- 0x2951-0x2958 = World 5 Password Data
- 0x2959-0x2960 = World 6 Password Data
- 0x2961-0x2968 = World 7 Password Data
- 0x2969-0x2970 = World 8 Password Data
- 0x2971-0x2978 = World 9 Password Data
- 0x2979-0x2980 = World 10 Password Data
- 0x2981-0x2988 = World 11 Password Data
- 0x2989-0x2990 = World 12 Password Data
- 0x2991-0x2998 = World 13 Password Data
- 0x2999-0x29A0 = World 14 Password Data
- 0x29A1-0x29A8 = World 15 Password Data
- 0x29A9-0x29B0 = World 16 Password Data
- 0x29B1-0x29B8 = World 17 Password Data
- 0x29B9-0x29C0 = World 18 Password Data
- 0x29C1-0x29C8 = World 19 Password Data
- 0x29C9-0x29D0 = World 20 Password Data
- 0x29D1-0x29D8 = World 21 Password Data
- 0x29D9-0x29E0 = World 22 Password Data
- 0x29E1-0x29E8 = World 23 Password Data
- 0x29E9-0x29F0 = World 24 Password Data
- 0x3876 = World 1-1 CHR Bank for Level Data
- 0x3877-0x3878 = World 1-1 Level Data Pointers
- 0x3879 = World 1-2 CHR Bank for Level Data
- 0x387A-0x387B = World 1-2 Level Data Pointers
- 0x387C = World 1-3 CHR Bank for Level Data
- 0x387D-0x387E = World 1-3 Level Data Pointers
- 0x387F = World 1-4 CHR Bank for Level Data
- 0x3880-0x3881 = World 1-4 Level Data Pointers
- 0x3882 = World 2-1 CHR Bank for Level Data
- 0x3883-0x3884 = World 2-1 Level Data Pointers
- 0x3885 = World 2-2 CHR Bank for Level Data
- 0x3886-0x3887 = World 2-2 Level Data Pointers
- 0x3888 = World 2-3 CHR Bank for Level Data
- 0x3889-0x388A = World 2-3 Level Data Pointers
- 0x388B = World 2-4 CHR Bank for Level Data
- 0x388C-0x388D = World 2-4 Level Data Pointers
- 0x388E = World 3-1 CHR Bank for Level Data
- 0x388F-0x3890 = World 3-1 Level Data Pointers
- 0x3891 = World 3-2 CHR Bank for Level Data
- 0x3892-0x3893 = World 3-2 Level Data Pointers
- 0x3894 = World 3-3 CHR Bank for Level Data
- 0x3895-0x3896 = World 3-3 Level Data Pointers
- 0x3897 = World 3-4 CHR Bank for Level Data
- 0x3898-0x3899 = World 3-4 Level Data Pointers
- 0x389A = World 4-1 CHR Bank for Level Data
- 0x389B-0x389C = World 4-1 Level Data Pointers
- 0x389D = World 4-2 CHR Bank for Level Data
- 0x389E-0x389F = World 4-2 Level Data Pointers
- 0x38A0 = World 4-3 CHR Bank for Level Data
- 0x38A1-0x38A2 = World 4-3 Level Data Pointers
- 0x38A3 = World 4-4 CHR Bank for Level Data
- 0x38A4-0x38A5 = World 4-4 Level Data Pointers
- 0x38A6 = World 5-1 CHR Bank for Level Data
- 0x38A7-0x38A8 = World 5-1 Level Data Pointers
- 0x38A9 = World 5-2 CHR Bank for Level Data
- 0x38AA-0x38AB = World 5-2 Level Data Pointers
- 0x38AC = World 5-3 CHR Bank for Level Data
- 0x38AD-0x38AE = World 5-3 Level Data Pointers
- 0x38AF = World 5-4 CHR Bank for Level Data
- 0x38B0-0x38B1 = World 5-4 Level Data Pointers
- 0x38B2 = World 6-1 CHR Bank for Level Data
- 0x38B3-0x38B4 = World 6-1 Level Data Pointers
- 0x38B5 = World 6-2 CHR Bank for Level Data
- 0x38B6-0x38B7 = World 6-2 Level Data Pointers
- 0x38B8 = World 6-3 CHR Bank for Level Data
- 0x38B9-0x38BA = World 6-3 Level Data Pointers
- 0x38BB = World 6-4 CHR Bank for Level Data
- 0x38BC-0x38BD = World 6-4 Level Data Pointers
Disassembly
Password Comparison Routine
This fragment of code compares the input password with the passwords of all 24 levels of the game.
00:A8BA:A9 00 LDA #$00 00:A8BC:85 67 STA $0067 // Reset level counter loop: 00:A8BE:A5 67 LDA $0067 // Load level counter 00:A8C0:0A ASL 00:A8C1:0A ASL 00:A8C2:0A ASL 00:A8C3:AA TAX // Level password character counter X:= A * 8 00:A8C4:A0 00 LDY #$00 // Reset input password character counter passwordCompare: 00:A8C6:B9 4D 00 LDA $004D,Y // Load Ath character from input password at $004D 00:A8C9:DD 27 A9 CMP $A927,X // Compare to level passwords at $A927. // Data structure: [Lvl 1 password (8bytes)][Lvl 2 password (8bytes)]… // Only the first 6 bytes are used, see below. 00:A8CC:D0 09 BNE $A8D7 // If not equal, goto nextLevel 00:A8CE:E8 INX // Increment level password character counter 00:A8CF:C8 INY // Increment input password character counter 00:A8D0:C0 06 CPY #$06 // Check if password length of $06 characters is reached 00:A8D2:90 F2 BCC $A8C6 // If not, goto passwordCompare 00:A8D4:4C E2 A8 JMP $A8E2 // Comparison finished, current level password matches input password. Goto passwordCorrect. nextLevel: 00:A8D7:E6 67 INC $0067 // Increment level counter 00:A8D9:A5 67 LDA $0067 00:A8DB:C9 18 CMP #$18 // Check if last level was reached 00:A8DD:90 DF BCC $A8BE // If not, goto loop ⋮ ⋮