[SMB] --004.AreaParserTaskControl source analytic series ranks of rendering control program

Prerequisite knowledge:

Nintendo game system image resolution is 256 * 240 pixels, the display unit is substantially the tile, comprising 8x8 = 64 pixels

Depending on the TV standard, NTSC format display only 256 * 224, i.e. a 32x28 tile, a first line of the screen and the bottom tile row is not displayed

PAL standard complete a 32x30 display, SMB is NTSC system development.

 

AreaParserTaskControl is a more central program, under which the associated subroutine tree completed almost all of the game screen drawing work.

We can see from the screenshot, this function is mainly used to cycle call another handler AreaParserTaskHandler, AreaParserTaskNum controlled by a variable number of cycles.

When AreaParserTaskNum equal to 0, will be decremented ColumnSets showing a screen drawing is complete (here having a width of 4 tile, each tile line 4 is, in fact, is drawn AreaParserTaskHandler a 4x4 tile size region).

After ColumnSets minus one, then the result is negative will be identified bpl instruction, the program jumps to OutputCol, where a total of 12 plots, i.e. 32 + 16 = 48 one-half screen screen tile width.

AreaParserTaskHandler in the tree is called a routine called AreaParserTasks of, AreaParserTaskNum will be assigned to # $ 08 at the outset, that is to say AreaParserTaskHandler is called eight times.

(Speaking of SMB is the beginning of the NTSC system, only to see the tile 28 rows, 4x7 = 28, 8th As for what will be mentioned later)

We can see from the 3050 line, AreaParserTaskNum is decreasing, and as a JumpEngine into the Senate, so we know AreaParserTasks the routine is called forward from the rear, tree 8 per cycle just call a function .

AreaParserTaskNum decreasing values ​​to zero, RenderAttributeTables 3052 final row is called, can be seen from the name attribute that is used to populate the table,

Side that is executed once AreaParserTasks draws a byte attribute table corresponding to 4x4 = 16 th tile of the screen area (named attribute table on the relationships between tables until later described).

 

SMB map data is pre-compressed good, AreaParserCore program for decompressing the data (by ProcessAreaData function), and then written to MetatileBuffer (by RenderSceneryTerrain function)

The first call will RenderAreaGraphics MetatileBuffer value in the upper left of the drawing tile 4x4 tile area, and the second lower left drawing, the switching function IncrementColumnPos draw the target to the other side,

By drawing a RenderAreaGraphics upper right, lower right tile, again drawn to the left by IncrementColumnPos handover target, the next tile to be drawn.

 

After the above process for the main with understanding, let us explain in detail the specific content AreaParserCore, RenderAreaGraphics, IncrementColumnPos of

Guess you like

Origin www.cnblogs.com/rebeldancer/p/11758159.html