[Sprites] Need a suggestion for Source Replacement

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
User avatar
Hamtaro126
Posts: 818
Joined: Thu Jan 19, 2006 5:08 pm

[Sprites] Need a suggestion for Source Replacement

Post by Hamtaro126 »

For example, the disassembly for "Super Mario Bros. 2 (U) [PRG0]" (currently updated by a user named "kmck" on Github), as well as the disassembly for "Super Mario Bros. 3 (U) [PRG1]" by Southbird, currently has an array of:

Code: Select all

.dsb 256
also known as:

Code: Select all

.res 256
making sprites not portable to any other semi-compatible system, with some work, such as SNES or PC-Engine...

That part was the easy part, The Stupid things I hate most that the disassembly: is that the sprites are supposed to be something like this (on the NES/Famicom):

Code: Select all

;Taken from SMBDIS
.enum $0200
Sprites_Y_Position: .dsb 1
Sprites_TileNumber: .dsb 1
Sprites_Attributes: .dsb 1
Sprites_X_Position: .dsb 1
.ende
The thing was to replace every "sprite DMA" store and load ($02xx) to all those, but I need a favor, In order to fork both disassemblies (or/and submit them to the author's cache of submissions/addenums) I need a special editor suggestion to try to get these done, If not, This may hurt...

Just so you know, There ARE LOTS of entrys for these sprite DMA things...

Thanks.
AKA SmilyMZX/AtariHacker.
qalle
Posts: 50
Joined: Wed Aug 16, 2017 12:15 am

Re: [Sprites] Need a suggestion for Source Replacement

Post by qalle »

I didn't really get what you're looking for, but you can do surprisingly much with a text editor that can search&replace regular expressions (e.g. Notepad++).

For example, to replace any lda instruction followed by an sta instruction with ldx and stx, respectively, replace (.*)lda(.*\r?\n.*)sta(.*) with \1ldx\2stx\3 (assuming . doesn't match newlines).
User avatar
Hamtaro126
Posts: 818
Joined: Thu Jan 19, 2006 5:08 pm

Re: [Sprites] Need a suggestion for Source Replacement

Post by Hamtaro126 »

These disassemblies are using the wrong formatting conventions, This is an example of what was done for both:

Code Snippet 2 - RAM:

Code: Select all

;OAM RAM
.enum $0200
SpriteDMAArea: .dsb 256
.ende
Code Snippet 2 - ROM:

Code: Select all

;... [Code here] ...
sta SpriteDMAArea,y ; Y position
;... [And here] ...
sta SpriteDMAArea+3,y ; X position
;... [Tile code here] ...
sta SpriteDMAArea+1,y ; Tile
;... [Attribute code here] ...
sta SpriteDMAArea+2,y ; Attributes
;... [Continue code here] ...
They just have to be reformatted to new names, Simply to make things better to understand.
AKA SmilyMZX/AtariHacker.
Post Reply