[4.5.9] *UPDATED* Method for Freeing Some Space & Reduce Glitched Tiles in Scrolling Modules

smilehero65

Active member
Hi there!
I don't think this is not an standard/proper tutorial, but didn't knew in which place share my finding (or should I call it a tip?)

So in my scrolling platformer I went from 16% to 18% on PRG$1F by:
  • Removing Paths.
  • Removing the standard/background HUD (this only applies if you're planning to use a sprite HUD)

Even though in the scrolling modules these two don't work (in Script Settings these are blank scripts) the game still handles part of them.

UPDATES FOR THE ONES WHO FOLLOWED THE THREAD PREVIOUSLY:
***EDIT#1: There is an Extra Step on the HUD part
***EDIT#2: There is an extra step to remove the paths on Bank16


⚠️BEFORE PROCEDING REMEMBER TO MAKE BACKUPS OF THE SCRIPTS I WILL BE MENTIONING⚠️
--------
PATHS
--------

  1. Go to your Subroutines folder (not Script Settings, I didn't find it in mine) and open doLoadNametableData.asm
  2. Go to Line 129, below notBlankTile, and you will comment:
    Code:
    ;;;; check for screen modes.    ;LDA tileLayout
        ;CLC                ;; dale_coop
        ;CMP #%01000000
        ;BEQ checkForPathUpdates
        ;CMP #%01100000
        ;BEQ checkForPathUpdates1
        ;;;; THIS DOES NOT USE PATHS!!!
        ;;;; so just restore the temp value and proceed with metaTiles as if it wasn't a path value.
        ;LDA temp
        ;JMP notPath
        ;RTS
  3. You will do the same for the next lines:​
Code:
checkForPathUpdates1:;;;;; THIS MODE USES ONLY THE FIRST TWO "paths" AS PATHS.
    ;LDA temp
    ;CLC            ;; dale_coop
    ;CMP #$A0
    ;BEQ doPathUpdate
    ;CMP #$B0
    ;BEQ doPathUpdate
    ;JMP notPath
 
checkForPathUpdates:
;;;;;; THIS MODE USES ALL FOUR "paths" AS PATHS.
 
    ;LDA temp
    ;CLC            ;; dale_coop
    ;CMP #$80
    ;BEQ doPathUpdate
    ;CMP #$90
    ;BEQ doPathUpdate
    ;CMP #$A0
    ;BEQ doPathUpdate
    ;CMP #$B0
    ;BEQ doPathUpdate
    ;JMP notPath
 
doPathUpdate:
 
    ;; now we have to do evaluations of other tiles around us to know
    ;; exactly what to draw here.
    ;JSR handlePath
    ;RTS

... and at the end (around Line 235):

Code:
handlePath:
 ;   TXA
  ;  PHA
   ; TYA
    ;PHA

    ;.include SCR_HANDLE_PATHS

 
    ;PLA
    ;TAY
    ;PLA
    ;TAX

4. So, technically Paths are not called... or are they?​
Turns out the images are still loaded in Bank #16.​
To counter this, you will find PathCHRAddHi and PathCHRAddLo​
... and commenting:​
1715573564221.png

--------
HUD
--------

1. In Load All Subroutines (this appears on Script Settings)
1709420943431.png

In my case I will go to Line 65 and comment it:
Code:
doCamera:
    .include SCR_HANDLE_CAMERA
    RTS
;doDrawHud:
    ;.include SCR_HANDLE_HUD
    ;RTS

This is basically telling NESMaker to don't ever bother to call the HUD script (is blank anyways)

2. There is still more, however.
Do you remember the screen flag Hide Hud?

It is useless in scrolling with Sprite HUD, because it only cares to hide the background sprite.
So, go to your Extra Screen Load:
1709421370705.png

In that script you will look for this part, and delete it:

Code:
  LDA ScreenFlags00
    AND #%01000000
    BEQ doNotTurnOffHud
        HideHud
        JMP doneWithExtraScreenCheckForHud
    doNotTurnOffHud:
        ShowHud
    doneWithExtraScreenCheckForHud:

Now it will not Hide the nonexistent HUD, freeing a Screen Flag for you in the process!

3. Go to your Subroutines folder (not Script Settings, I didn't find it in mine) and open doLoadScreen.asm
In there, around Line 159, you will comment DrawHud:
Code:
nevermindSettingNewContinueByte:
    JSR doWaitFrame
    ;DrawHud


I just came up with this today, so please let me know if you encounter anything weird.
Hope it helps!

P.S: According to other people using scrolling, this tutorial is also useful for reducing Graphical Glitches!
 
Last edited:

smilehero65

Active member
removing all path code is also a good way of reducing weird tile graphical glitches, if not removing them entirely.
Yeah, that actually was my first intention with the code.
Maybe I am just dreaming, but I encountered less graphic glitches.
 

kevintron

Active member
This is very helpful. There is one small thing I don't understand in the last example. Which color is the highlighted color you remove? I think it is keep the brighter color comments and remove the darker colors. Is that what you meant?
 

smilehero65

Active member
This is very helpful. There is one small thing I don't understand in the last example. Which color is the highlighted color you remove? I think it is keep the brighter color comments and remove the darker colors. Is that what you meant?
Hi!
Yeah... sorry for that.
Now I modified the post to be more clear.
 

kevintron

Active member
This works great for the Shooter module. I did have to change one thing. It would no compile for me if I commented out the whole doDrawHud so I just did the .include SCR_HANDLE_CAMERA and it worked.
Code:
;;example from post
doCamera:
    .include SCR_HANDLE_CAMERA
    RTS
;doDrawHud:
    ;.include SCR_HANDLE_HUD
    ;RTS
;;update for shooter
doCamera:
    .include SCR_HANDLE_CAMERA
    RTS
doDrawHud:
    ;.include SCR_HANDLE_HUD
    RTS

Only other difference for the Shooter is the last step for the Extra Screen Load can be skipped because it already points to a blank file. I recommend anyone building a Shooter give this a try. I think you will be pleased with what I found to be noticeable results.
 

smilehero65

Active member
This works great for the Shooter module. I did have to change one thing. It would no compile for me if I commented out the whole doDrawHud so I just did the .include SCR_HANDLE_CAMERA and it worked.
Code:
doCamera:
    .include SCR_HANDLE_CAMERA
    RTS
;doDrawHud:
    ;.include SCR_HANDLE_HUD
    ;RTS

doCamera:
    .include SCR_HANDLE_CAMERA
    RTS
doDrawHud:
    ;.include SCR_HANDLE_HUD
    RTS

Only other difference for the Shooter is the last step for the Extra Screen Load can be skipped because it already points to a blank file. I recommend anyone building a Shooter give this a try. I think you will be pleased with what I found to be noticeable results.
Weird instance, but great finding!
 

smilehero65

Active member
Updates on this method!!
Now I would assure it removes the graphical glitches altogether!

Also, I want to add something...
In my next game, I will not be using paths at all, neither the HUD, or even text.
I found the places on NESMaker where to delete all of them.

In addition that I didn't found any glitches, my space went from 15 to 25%!!
Maybe if all of you want, I can make a separate thread explaining all of this, since there is a lot of stuff that can be removed and will just be occupying space in your memory.

--------------------------------------------------------------------

AND... I made a discovery.
This is the first level of Snackventure, and this image was taken from Mesen's Tilemap Viewer

before.png

There is a lot of garbage graphics, which I think are responsible of artifacts and other stuff.
Remember this is from a scrolling game, but even in single screen games this issue happens.

leprachun.png
I am not sure if my method can get rid of these issues (at least my method before coming up with deleting paths in Bank16)
But for my new game...

after.png
This is not happening (at the moment)

So I would please love if you test this thread and your Tilemap Viewer, so I can see the results.
 

mileco

Active member
Updates on this method!!
Now I would assure it removes the graphical glitches altogether!

Also, I want to add something...
In my next game, I will not be using paths at all, neither the HUD, or even text.
I found the places on NESMaker where to delete all of them.

In addition that I didn't found any glitches, my space went from 15 to 25%!!
Maybe if all of you want, I can make a separate thread explaining all of this, since there is a lot of stuff that can be removed and will just be occupying space in your memory.

--------------------------------------------------------------------

AND... I made a discovery.
This is the first level of Snackventure, and this image was taken from Mesen's Tilemap Viewer

View attachment 8164

There is a lot of garbage graphics, which I think are responsible of artifacts and other stuff.
Remember this is from a scrolling game, but even in single screen games this issue happens.

View attachment 8165
I am not sure if my method can get rid of these issues (at least my method before coming up with deleting paths in Bank16)
But for my new game...

View attachment 8166
This is not happening (at the moment)

So I would please love if you test this thread and your Tilemap Viewer, so I can see the results.
Hola Héctor! Is your original post updated with your discovery or should I apply it just as it is right now?
 

dale_coop

Moderator
Staff member
Hola Héctor! Is your original post updated with your discovery or should I apply it just as it is right now?
Try that one:
 

mileco

Active member
I tried to remove the paths in the BBI 2.2.2. the Adventure Module, because I don't need it and want to keep it simpler, then it encountered an error on doLoadScreen16.asm line 76, and I took care of this. After this was fixed, I ran level one stage back and forth multiple times, and I have not seen any rare one-spot tile mismatch. I am hoping it is fixed for the rest of the game.
 
Unfortunately, there is still one very rare tile mismatch in the Adventure Module on the random screens, and removing the path from the Adventure Module doesn't fix it. Edit: But it is better than it was.
 
Last edited:
I have found a few more things to remove Paths.

In doLoadNametableData.asm. I changed the line JMP notBlankTile to JMP notPath, and followed the steps as smilehero65 suggested in step #2, including notBlankTile, and step #3.


Code:
    BEQ isBlankTile ;isFFtile ;; solid "BLACK" translate
    JMP notPath
isBlankTile:
    ;; it was a blank tile.  They are all now blank tiles
    STA updateTile_00
    STA updateTile_01
    STA updateTile_02
    STA updateTile_03
    RTS
 
;notBlankTile:

;    ;;;; check for screen modes.
;    LDA tileLayout
;    CLC                ;; dale_coop
;    CMP #%01000000
;    BEQ checkForPathUpdates
;    CMP #%01100000
;    BEQ checkForPathUpdates1
;    ;;;; THIS DOES NOT USE PATHS!!!
;    ;;;; so just restore the temp value and proceed with metaTiles as if it wasn't a path value.
;    LDA temp
;    JMP notPath
;    RTS
 
;checkForPathUpdates1:
;;;;; THIS MODE USES ONLY THE FIRST TWO "paths" AS PATHS.
;    LDA temp
;    CLC            ;; dale_coop
;    CMP #$A0
;    BEQ doPathUpdate
;    CMP #$B0
;    BEQ doPathUpdate
;    JMP notPath
 
;checkForPathUpdates:
;;;;;; THIS MODE USES ALL FOUR "paths" AS PATHS.
 
;    LDA temp
;    CLC            ;; dale_coop
;    CMP #$80
;    BEQ doPathUpdate
;    CMP #$90
;    BEQ doPathUpdate
;    CMP #$A0
;    BEQ doPathUpdate
;    CMP #$B0
;    BEQ doPathUpdate
;    JMP notPath
 
;doPathUpdate:
 
;   ;; now we have to do evaluations of other tiles around us to know
;   ;; exactly what to draw here.
;    JSR handlePath
;    RTS

At the end

Code:
;handlePath:
;    TXA
;    PHA
;    TYA
;    PHA

;    .include SCR_HANDLE_PATHS

 
;    PLA
;    TAY
;    PLA
;    TAX
 
;    RTS


Go to Bank 16.asm, followed the steps as smilehero65 suggested in step #4, but include PathCHRAddLo: and PathCHRAddHi:

Code:
;PathCHRAddLo:  ;; chr type 1
;    ;paths
;    .db <PathTiles00, <PathTiles01, <PathTiles02, <PathTiles03, <PathTiles04, <PathTiles05, <PathTiles06, <PathTiles07
;    .db <PathTiles08, <PathTiles09, <PathTiles10, <PathTiles11, <PathTiles12, <PathTiles13, <PathTiles14, <PathTiles15
;    .db <PathTiles16, <PathTiles17, <PathTiles18, <PathTiles19, <PathTiles20, <PathTiles21, <PathTiles22, <PathTiles23

;PathCHRAddHi:
;    ;paths
;    .db >PathTiles00, >PathTiles01, >PathTiles02, >PathTiles03, >PathTiles04, >PathTiles05, >PathTiles06, >PathTiles07
;    .db >PathTiles08, >PathTiles09, >PathTiles10, >PathTiles11, >PathTiles12, >PathTiles13, >PathTiles14, >PathTiles15
;    .db >PathTiles16, >PathTiles17, >PathTiles18, >PathTiles19, >PathTiles20, >PathTiles21, >PathTiles22, >PathTiles23

We are not done yet.

Go to doLoadScreen16.asm, then go to line around #61 and comment it:


Code:
    ;LDA backgroundTilesToLoad+2
    ;LSR
    ;LSR
    ;LSR
    ;LSR
    ;CLC
    ;ADC #$0F
    ;STA tempA
    ;LDA backgroundTilesToLoad+2
    ;AND #%00001111
    ;STA tempB
    ;LoadChrData tempA, #$18, #$00, #$40, PathCHRAddLo, PathCHRAddHi, tempB

Go to doLoadScreenData.asm, then go to line #61 and comment it.
Code:
;; #126 - Load paths, through a loop to figure out path choices
;    LDA (collisionPointer),y
;    STA temp
;
    TYA ;;;leave it alone!!!
    PHA ;;;leave it alone!!!
;
;    LDY #$00
;    LDX #$00
;loadPathTilesLoop:
;    LDA temp
;    AND ValToBitTable,y
;    BEQ notFirstPath
;    TYA
;    STA pathTile00,x
;    INX
;    CPX #$04
;    BEQ doneGettingPaths
;    INY
;    JMP loadPathTilesLoop
;notFirstPath:
;    INY
;
;    JMP loadPathTilesLoop
;doneGettingPaths:
;    LDY tempy

Go to Bank10.asm, Bank11.asm, and Bank12.asm at the end of each Bank.

Bank10.asm

Code:
;PathTiles00:
;    .incbin "Graphics\Backgrounds\CHR_Path_00.chr"
;PathTiles01:
;    .incbin "Graphics\Backgrounds\CHR_Path_01.chr"
;PathTiles02:
;    .incbin "Graphics\Backgrounds\CHR_Path_02.chr"
;PathTiles03:
;    .incbin "Graphics\Backgrounds\CHR_Path_03.chr"
;PathTiles04:
;    .incbin "Graphics\Backgrounds\CHR_Path_04.chr"
;PathTiles05:
;    .incbin "Graphics\Backgrounds\CHR_Path_05.chr"
;PathTiles06:
;    .incbin "Graphics\Backgrounds\CHR_Path_06.chr"
;PathTiles07:
;    .incbin "Graphics\Backgrounds\CHR_Path_07.chr"

Bank11.asm
Code:
;PathTiles08:
;    .incbin "Graphics\Backgrounds\CHR_Path_08.chr"
;PathTiles09:
;    .incbin "Graphics\Backgrounds\CHR_Path_09.chr"
;PathTiles10:
;    .incbin "Graphics\Backgrounds\CHR_Path_10.chr"
;PathTiles11:
;    .incbin "Graphics\Backgrounds\CHR_Path_11.chr"
;PathTiles12:
;    .incbin "Graphics\Backgrounds\CHR_Path_12.chr"
;PathTiles13:
;    .incbin "Graphics\Backgrounds\CHR_Path_13.chr"
;PathTiles14:
;    .incbin "Graphics\Backgrounds\CHR_Path_14.chr"
;PathTiles15:
;    .incbin "Graphics\Backgrounds\CHR_Path_15.chr"

Bank12.asm
Code:
;PathTiles16:
;    .incbin "Graphics\Backgrounds\CHR_Path_16.chr"
;PathTiles17:
;    .incbin "Graphics\Backgrounds\CHR_Path_17.chr"
;PathTiles18:
;    .incbin "Graphics\Backgrounds\CHR_Path_18.chr"
;PathTiles19:
;    .incbin "Graphics\Backgrounds\CHR_Path_19.chr"
;PathTiles20:
;    .incbin "Graphics\Backgrounds\CHR_Path_20.chr"
;PathTiles21:
;    .incbin "Graphics\Backgrounds\CHR_Path_21.chr"
;PathTiles22:
;    .incbin "Graphics\Backgrounds\CHR_Path_22.chr"
;PathTiles23:
;    .incbin "Graphics\Backgrounds\CHR_Path_23.chr"

We are done.
 
Last edited:
Also adding "JSR doWaitFrame" in doLoadScreen16.ASM does help reduce glitched tiles and main character sprites for the Adventure Module, and it might help other modules.

This is an example of what I did by adding more "JSR doWaitFrame" to the rest of the script.

Code:
doLoadScreen16:
    LoadBackgroundPalettes newPal
   
JSR doWaitFrame
   
    ;; We wait this frame because the LoadBackgroundPalettes routine
        ;; sets bckpal variables and activates the update palette.
        ;; waiting this frame holds up on the next routine until the
        ;; background palettes are loaded into the PPU.
    ;LoadObjectPalettes #$00
   
    LoadObjectSubPalettes spriteSubPal1, #$00
    LoadObjectSubPalettes spriteSubPal2, #$04
    LoadObjectSubPalettes spriteSubPal3, #$08
    LoadObjectSubPalettes spriteSubPal4, #$0C
   
JSR doWaitFrame

    LDA tileLayout
    CMP #%01000000
    BEQ LOAD_MSP
    JMP notMSP
LOAD_MSP:  
    LDA backgroundTilesToLoad
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$10, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
        ;arg0 - bank where graphics live
        ;arg1 - row
        ;arg2 - column (by 10s...must end in zero)
        ;arg3 - how many tiles to load.  If 00, will load whole sheet.
        ;arg4 - Label in bank 16 table, low.
        ;arg5 - Label in bank 16 table, hi.
        ;arg6 - Bank 16 table offset
       
JSR doWaitFrame
   
    LDA backgroundTilesToLoad+1
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+1
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$16, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
    ;;; load paths.
       
JSR doWaitFrame
   
    ;LDA backgroundTilesToLoad+2
    ;LSR
    ;LSR
    ;LSR
    ;LSR
    ;CLC
    ;ADC #$0F
    ;STA tempA
    ;LDA backgroundTilesToLoad+2
    ;AND #%00001111
    ;STA tempB
   
    ;LoadChrData tempA, #$18, #$00, #$40, PathCHRAddLo, PathCHRAddHi, tempB

;JSR doWaitFrame
       
    ;; Load Hud
    LoadChrData #$1E, #$1C, #$00, #$40, OtherChrTiles_Lo, OtherChrTiles_Hi, #$00
   
JSR doWaitFrame
   
    JMP doneLoadingChrs
notMSP:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;DOUBLE MAIN;;;;;;;;;;;;;;;;;;;;;;;

    CMP #%00000000
    BEQ Load_MM
    JMP notMM
Load_MM:
    LDA backgroundTilesToLoad
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$10, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
   
JSR doWaitFrame  
   
    LDA backgroundTilesToLoad+1
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+1
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$16, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
   
JSR doWaitFrame
   
    ;; Load Hud
    LoadChrData #$1E, #$1C, #$00, #$40, OtherChrTiles_Lo, OtherChrTiles_Hi, #$00
   
JSR doWaitFrame  

    JMP doneLoadingChrs
notMM:
    CMP #%01110000
    BEQ LOAD_MSSS
    JMP notMSSS
LOAD_MSSS:
    LDA backgroundTilesToLoad
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$10, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
   
JSR doWaitFrame
   
    LDA backgroundTilesToLoad+1
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+1
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$16, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
   
JSR doWaitFrame
   
    LDA backgroundTilesToLoad+2
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+2
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$18, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
   
JSR doWaitFrame
   
    LDA backgroundTilesToLoad+3
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+3
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$1A, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
   
JSR doWaitFrame  
   
    ;; Load Hud
    LoadChrData #$1E, #$1C, #$00, #$40, OtherChrTiles_Lo, OtherChrTiles_Hi, #$00
   
JSR doWaitFrame
   
    JMP doneLoadingChrs
notMSSS:
    CMP #%01111100
    BEQ doMSSSSS
    JMP notMSSSSS
doMSSSSS
    LDA backgroundTilesToLoad
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$10, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
   
JSR doWaitFrame
   
    LDA backgroundTilesToLoad+1
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+1
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$16, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
   
JSR doWaitFrame
   
    LDA backgroundTilesToLoad+2
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+2
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$18, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
   
JSR doWaitFrame
   
    LDA backgroundTilesToLoad+3
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+3
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$1A, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
   
JSR doWaitFrame
   
    LDA backgroundTilesToLoad+4
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+4
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$1C, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
   
JSR doWaitFrame
   
    LDA backgroundTilesToLoad+5
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+5
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$1E, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
   
JSR doWaitFrame
   
    JMP doneLoadingChrs
notMSSSSS
    CMP #%00001100
    BEQ doMMSS
    JMP notMMSS
doMMSS:
    LDA backgroundTilesToLoad
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$10, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
   
JSR doWaitFrame  
   
    LDA backgroundTilesToLoad+1
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+1
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$16, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB

JSR doWaitFrame
   
    LDA backgroundTilesToLoad+2
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+2
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$1C, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
   
JSR doWaitFrame
   
    LDA backgroundTilesToLoad+3
    LSR
    LSR
    LSR
    LSR
    CLC
    ADC #$0F
    STA tempA
    LDA backgroundTilesToLoad+3
    AND #%00001111
    STA tempB
    LoadChrData tempA, #$1E, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
   
JSR doWaitFrame
   
    JMP doneLoadingChrs
notMMSS:
doneLoadingChrs:
       
    LoadChrData #$15, #$00, #$00, #$80, GameObjectCHRAddLo, GameObjectCHRAddHi, #$00
        ;arg0 - bank where graphics live
        ;arg1 - row
        ;arg2 - column (by 10s...must end in zero)
        ;arg3 - how many tiles to load.  If 00, will load whole sheet.
        ;arg4 - Label in bank 16 table, low.
        ;arg5 - Label in bank 16 table, hi.
        ;arg6 - Bank 16 table offset
           
        LDA monsterTableOffset
        CMP #$08
        BCC inMonsterBank0
            ;; in monster bank 1
            LDA #$14
            JMP gotMonsterBank
        inMonsterBank0
            LDA #$13
        gotMonsterBank:
            STA temp
       
        LoadChrData temp, #$08, #$00, #$80, MonsterAddressLo, MonsterAddressHi, monsterTableOffset
        ;arg0 - bank where graphics live
        ;arg1 - row
        ;arg2 - column (by 10s...must end in zero)
        ;arg3 - how many tiles to load.  If 00, will load whole sheet.
        ;arg4 - Label in bank 16 table, low.
        ;arg5 - Label in bank 16 table, hi.
        ;arg6 - Bank 16 table offset
   
JSR doWaitFrame
           
RTS

This is Optional; you can disable pathTile00, pathTile01, pathTile02, and pathTile03 in Overflow RAM to save 4 bytes.
 
Last edited:
Top Bottom