Originally posted by Ultimaximus
wow, this is amazing! The ceiling generator will definately have a place in all the levels of my hack, and the status bar editor will be extremely useful, and essentially obsoletes Smallhacker's! I must ask, can it move the score counter?
1. I didn't include functionality to change any of the tiles editable by smallhacker's tool. I figure the GUI interface of that tool > tables of hex in my patch
2. The advanced version already moves the score counter to a new RAM address. Moving it exactly where you want on the bar itself isn't exactly easy, though.
WARNING: Wall of text and ASM incoming.
CODE_008ED7: LDX #$28
CODE_008ED9: LDY #$00
CODE_008EDB: JSR CODE_009012 ; go to very important subroutine
CODE_008EDE: LDX #$00 ; \
CODE_008EE0: LDA !RAM_BAR+238,X ; |
CODE_008EE3: BNE CODE_008EEF ; |
CODE_008EE5: LDA #$FC ; |Replace all leading zeroes in the score with spaces
CODE_008EE7: STA !RAM_BAR+238,X ; |
CODE_008EEA: INX ; |
CODE_008EEB: CPX #$0C ; |
CODE_008EED: BNE CODE_008EE0 ; |
CODE_008F05: LDX #$28
CODE_008F07: LDY #$00
CODE_008F09: JSR CODE_009012 ; go to very important subroutine
CODE_008F0C: LDX #$00 ; \
CODE_008F0E: LDA !RAM_BAR+238,X ; |
CODE_008F11: BNE CODE_008F1D ; |
CODE_008F13: LDA #$FC ; |Replace all leading zeroes in the score with spaces
CODE_008F15: STA !RAM_BAR+238,X ; |
CODE_008F18: INX ; |
CODE_008F19: CPX #$0C ; |
CODE_009012: SEP #$20 ; 8 bit A ; Accum (8 bit)
CODE_009014: STA !RAM_BAR+198,X
CODE_009017: REP #$20 ; 16 bit A ; Accum (16 bit)
CODE_009019: LDA $02
CODE_00901C: SBC DATA_008FFC,Y
CODE_00901F: STA $06
CODE_009021: LDA $00
CODE_009023: SBC DATA_008FFA,Y
CODE_009026: STA $04
CODE_009028: BCC CODE_009039
CODE_00902A: LDA $06
CODE_00902C: STA $02
CODE_00902E: LDA $04
CODE_009030: STA $00
CODE_009032: SEP #$20 ; 8 bit A ; Accum (8 bit)
CODE_009034: LDA !RAM_BAR+198,X
CODE_009037: BRA CODE_009017
Quite obviously, I just copy/pasted the routine and made the needed edits. So, you could follow this advice and apply these changes as hex edits instead of modifying my patch if you don't want to use it (but then you'd still be limited to the original 55 tiles).
Anyway, for whatever reason, Nintendo decided to always upload Mario's score and overwrite it if Luigi was playing. You'll have to make some edits twice to not screw up the score counter majorly if playing as luigi.
Before you make any changes, you must know that my table is interleaved. That means each tile takes up two bytes in ram; 1 for the tile number, 1 for the properties. Any tile changes MUST be done to even numbered addresses.
For what you should actually do:
- LDX #$28 before the subroutine call helps determine the starting offset.
- The 3 !RAM_BAR+198,x in the subroutine are actually where it is drawn on the status bar.
- Don't ask me why Nintendo didn't do LDX #$00 and !RAM_BAR+238,x (or rather their original equivalents) instead of this silliness.
- If you wanted it at, say, the top middle-ish of the screen, you'd use LDX #$00 and !RAM_BAR+32,x within the subroutine. (Remember you have to change the LDX before Luigi's score is written as well) Just after the subroutine call, you would also have to change the !RAM_BAR+238,x parts to !RAM_BAR+32,x. (Again you have to change Luigi's as well as Mario's)
- The !RAM_BAR's would be exchanged with the original RAM addresses if you're modifying the original code instead of my patch. Also, most of the x offset numbers are doubled (LDX #$28 was LDX #$14 in the original code). Fundamentally they're the same, so you should have no issues.
Things of note:
xkas, for some stupid reason, uses decimal numbers for !ADDRESS+number. This can get confusing, especially here, because x is a hex number (x28), and +198 is a decimal number. I spent 5 mins looking at my spreadsheet included with the patch wondering why it pointed to the center of the item box (number 226) instead of where the score counter is (number 238).
....All that was probably really confusing. To help alleviate some confusion as to where tiles are in the table, I included a spreadsheet with the patch that shows the hex, decimal, and original RAM offset (where applicable) of all tiles. If you don't know where the hell $0F15 (or whatever) is now, you can just open it up and see that the equivalent hex offset is x126, so the new address would be $7FA0126 (if you use the default free RAM assigned in the patch).
Still I suspect most people will be confused by the interleaving and sheer number of RAM they'd be working with (320 addresses). Once you wrap your head around it though, it makes a lot more sense than Nintendo's table simply because it doesn't skip any tiles.