News:

11 March 2016 - Forum Rules

Main Menu

Super Mario Bros. (NES) - "Pages"?

Started by MongoLloyd, June 06, 2019, 07:10:28 AM

Previous topic - Next topic

MongoLloyd

Hey! I'm pretty new to 6502 assembly and I've been trying to study the disassembly of Super Mario Bros. and I came upon the word pages and was wondering what they are referring to. What does pages mean in the context of the code?

Here's some examples of what I mean:

Near the beginning of RenderSceneryTerrain
lda CurrentPageLoc        ;otherwise check for every third page

At the start of Entrance_GameTimerSetup
lda ScreenLeft_PageLoc    ;set current page for area objects
sta Player_PageLoc        ;as page location for player


The code I'm using: https://www.romhacking.net/documents/344/

Disch

This is a little confusing because he does not appear to be using "page" to mean a memory page.  So this is not really a 6502 question as much as it is a question about this specific game.

From what I can tell having glanced at the code, I would bet that the level maps are broken into sections (which he's calling pages), and when the player transitions to a new page, new stuff on the map gets loaded.

I deduced this specifically from some code starting at line 5997:


CSetFDir:    lda Player_X_Position
             clc                      ;add or subtract from player's horizontal position
             adc ClimbAdderLow,x      ;using value here as adder and X as offset
             sta Player_X_Position
             lda Player_PageLoc       ;add or subtract carry or borrow using value here
             adc ClimbAdderHigh,x     ;from the player's page location
             sta Player_PageLoc


Player X position seems to be tied directly to player Page location.  As you move further right, you move onto a different page.

This also suggests that pages are 256 ?pixels? wide... so basically one "screen" worth of map?

Keep in mind this is all kind of a guess, as I looked at this for less than a minute.  But I can say for certain that "page" in this context is referring to something specific to this game and not to anything related to 6502 or NES architecture.

KingMike

I suspect a "page" might be a screen width.

I think Super Mario World ROM hacking uses the same term (or was it "screen"), as I think some things (such as door/pipe exit destinations) are coded to a limit of one per page.
"My watch says 30 chickens" Google, 2018

MongoLloyd

Thanks for the responses. As I studied the code some more it was the conclusion I started to suspect as well.