This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

[Sprites] Need a suggestion for Source Replacement

[Sprites] Need a suggestion for Source Replacement
by on (#226640)
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:
.dsb 256
also known as:
Code:
.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:
;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.
Re: [Sprites] Need a suggestion for Source Replacement
by on (#226653)
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).
Re: [Sprites] Need a suggestion for Source Replacement
by on (#226673)
These disassemblies are using the wrong formatting conventions, This is an example of what was done for both:

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


Code Snippet 2 - ROM:
Code:
;... [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.