Anyone Interested in Doing "SMB Special" for NES?

Started by SMB2J-2Q, February 06, 2008, 11:26:50 AM

Previous topic - Next topic


It's too late to hold off, I finished the latest patch before reading your message. You can get the patch at the usual place. While I have extensively tested the new Piranha Plant code, there may still be issues, so please report any bugs that still remain. Thanks once again for all the feedback so far.

With the addition of world seven, space has gotten very tight in banks zero and three. I was only able to get it all in due to the reduced size of my refactored Red Piranha Plant code. In order to fit in world 8, I'll have to relocate more of the ROM to another bank. I've yet to investiage options for such relocation. Hopefully I'll be able to find some code that can be reloacted as easily as the sound engine was.

In light of this, my focus will instead be investigating how the ROM can be further rearranged. Only once I've found a solution to this will I have time (or space) to impliment additional gameplay related hacks.
Current ProjectsFinal Fantasy EngineSMB Special for NESStudio Karatorian
@loop: lda (src),y — sta (dst),y — iny — bne @loop — inc src+1 — inc dst+1 — dex — bne @loop


how about moving the level data and/or the whole level decoding engine? 

check DecodeAreaData


Quote from: frantik on April 09, 2008, 09:20:21 PM
oh and hey you might want to hold off for a day on the new ROM cause i'm almost down with world 8

Anybody else down with the world 8? I know I am!


w00t!  finally finished with porting the levels over  :woot!: :woot!:

Worlds 5 - 8 patch

This patch incorporates some other changes.

The current world 1 - 4 file is not suitable to be joined with this one because of the floor mods.

Changes include:

- Slight modification to floors.  Here new code to add to source (search for comment and replace values):

      .db %11111110, %00011000 ;ceiling 8, floor 2

- Modified platforms so they are always 6 blocks wide (instead of 4 blocks in castles and  after 5-3)
- changed world for underwater castle bricks
- set timers right for all levels (hadn't done that at all before) - still need to change timer value.. will determine how long it takes mario to run a certain distance and adjust timer accordingly


Found another flaw: at the bonus room in World 6-3, when you leave it you come right back to it.



^ corrected.  the pipe connector was there just set to the wrong world.  also removed a lot of junk objects and enemies which were stuck on the end of a few levels.  replaced the rom with the updated one.

working on world 1 - 4.  the floor changes freed up a fair amount of tiles.. now going through and checking the background stuff which i was kinda lazy about at first

edit:  finished with worlds 1-4 patch.  This patch is suitable for merging with the 5 - 8 patch, assuming the floor code has been modified in the expanded rom. 

Worlds 1 thru 4
Worlds 5 thru 8


Well, the changes you've made have definetly optomized things pretty well. The size of worlds 1 - 7 went from 8025k to 7500k. However, with world 8, it goes to 8319k, so it won't fit. I'm about to look into relocation options now. I'll let you know what I find out soon.
Current ProjectsFinal Fantasy EngineSMB Special for NESStudio Karatorian
@loop: lda (src),y — sta (dst),y — iny — bne @loop — inc src+1 — inc dst+1 — dex — bne @loop


good to know I was able to make a decent reduction in the size.. what is the current maximum size allowed for just level data?

edit.. actually.. hey don't we have a whole empty bank?  why not just put the first 4 worlds in one bank (plus the program code of course) and the other 4 in the other bank (with the same code).  then swap the banks at world 5.    this is basically what i'm doing for SMU..  if you switch the banks in the end of world code it's completely transparent.  sure its "wasteful" in that the same program code is included in both banks but it's a lot easier than trying to find another large self contained block of code like the sound engine.  and the bank is already there anyways completely empty so might as well fill it.  there would still be plenty of room in the other two banks for new program code


Thought about relocating to WRAM ($6000-$7FFF) by copying to it at init, simulating it like a hardwired bank?
Out of interest, could you give a technical summary what's been done?


Quote from: Karatorian on April 10, 2008, 06:23:52 PM
went from 8025k to 7500k.


uhhh.... wtf?  Am I reading that wrong?  or is your ROM 8 megabytes now?

Even if you mean "kilobit" (which is a retarded term, but don't get me started), that's still 1MB


1MB? Yeow. I think you need to use some mapper magic for an NES to handle games that size.


i suspect he meant bytes?

since space is at a premium, you can shrink down the halfway entrance code

new code (also remove HalfwayPageNybbles)

             inc DisableScreenFlag    ;disable screen and sprite 0 check
             lda #$00
             sta Sprite0HitDetectFlag
             lda #Silence             ;silence music
             sta EventMusicQueue
             dec NumberofLives        ;take one life from player
             bpl StillInGame          ;if player still has lives, branch
             lda #$00
             sta OperMode_Task        ;initialize mode task,
             lda #GameOverModeValue   ;switch to game over mode
             sta OperMode             ;and leave
StillInGame: lda #$00                 ;beginning of the level
SetHalfway:  sta HalfwayPage          ;store as halfway page for player
             jsr TransposePlayers     ;switch players around if 2-player game
             jmp ContinueGame         ;continue the game

you can also remove the warp zone related stuff such as
* ScrollLockObject_Warp (would be good if you removed the pointer to this subroutine from the table as well)
* WarpZoneObject

Also the in SMBS there are no whirlpools (holes which suck you down) so that needs to be disabled and removed as well.

new code to disable whirlpools.
            jsr ChkLrgObjLength          ;get lower nybble and save as length         
            ldx AreaType                 ;get appropriate metatile, then
            lda #$00          ;render the hole proper
            ldx #$08
            ldy #$0f                     ;start at ninth row and go to bottom, run RenderUnderPart

remove these blocks of code:
* HoleMetatiles
* ProcessWhirlpools (and also remove call to ProcessWhirlpools in GameEngine)

that should free up a lil space.. not sure if it'll be enough.  firework code could also be dropped


i thought they had warpzones in SMBS ? btw great work on this game


He must be talking about those picturesa of the levels.


no warp zones in SMBS.  in 4-2 there is what seems like a warp zone but it's a trap to send you back to the beginning of the level


Thanks for the hints on stuff that could be trimmed down. At the moment I'm working on relocating the level data and every fuction that requires direct access to it to bank one. While not as easy as moving the sound engine was, things are going pretty well. I've only got one function left that's unhappy about being relocated. But I know what's wrong with it, so it shouldn't be too hard to fix.

While this does free up tons of space, it's also lead to the code being hacked to bits. Perhaps just deleating unused functions will be cleaner and less likely to cause obscure bugs. If enough space can be freed that way, perhaps that'd be the best option. To fit in worlds 1 through 8, we'd need to delete about 300 bytes of stuff. Can we do that?

I actually though about relocating the level data to SRAM. That's how Final Fantasy does it, so I'm familiar with the technique. I'll have to look into that as it may be cleaner than my current method.

And yes, I meant bytes before. I don't know why I put the "k" in there. Perhaps my brain was still fried from the hour and a half drive home from work. He he.

Anyway, I've got to get some sleep. I may get the 1 - 8 expanded ROM patch up sometime tomorrow, but I may also have other things to do, so I may not.
Current ProjectsFinal Fantasy EngineSMB Special for NESStudio Karatorian
@loop: lda (src),y — sta (dst),y — iny — bne @loop — inc src+1 — inc dst+1 — dex — bne @loop


How are things coming on the NES SMBS project?

Oh, and before you start distributing the complete patch with Worlds 1-8, please do a thorough test of all the levels first so that if you come across any outstanding graphical errors, you'll be sure to correct them before final release.



After some consideration, I decided to use the SRAM loading method, rather than move all the level loading functions to a seperate bank. While I never finished the other method, it was ugly as sin and would have proabably introduced countless bugs that'd taken ages to track down and fix.

Basically, how it works is pretty simple. All the level pointers and whatnot are still in the main banks, just like the normal game. The actual object and enemy data has been moved into bank one. Also in bank one is a small function that copies the data into SRAM. From that point on, everything runs just like normal.

The total level data for worlds one through eight totals 8319 bytes. Of this, 269 bytes are headers and are stored in the main banks. The other 8050 bytes are the level data and are stored in a dedicated bank to be loaded into SRAM. This basically means that the level data (not including headers) could grow another 142 bytes before we have space issues. Hopefully that won't happen.

I've incorporated worlds 1 - 8, the changes to TerrainRenderBits for the latest patchs, and all the other changes so far. You can get the patch here.

While I agree that intensive testing is needed before we release a final patch, I wouldn't consider this patch final. There are still a lot of things to be done. Honestly, despite all the hard work done so far, I think we've really only done the easy bits so far. There are several enemies and powerups yet to be added. Additionally, there are several engine limiations that compromize the accuracy of the port.

Now that the levels are pretty much done. I intend to go straight into gameplay hacking. I'm interested in compiling a list of outstanding differences between the games so that we have a checklist of things that need to be done.

I'm going to clean up my source code and will be making it availible to those who wish to help out with ASM hacking.
Current ProjectsFinal Fantasy EngineSMB Special for NESStudio Karatorian
@loop: lda (src),y — sta (dst),y — iny — bne @loop — inc src+1 — inc dst+1 — dex — bne @loop


Fantastic! I was planning to do levels in SRAM, But you beat me!

Can you please give me the source if possible, I really want to save space now.
I Hath Returned...

BTW My username is not Hamtaro129. THAT IS WRONG, Please correct immediately or I will try to correct it myself!


Actually what could be nice is if you could modify a level editor to work with an expanded rom. I imagine SMB hacks could get even better if they weren't so limited on space.