Skip to navigation


PPU: SETUP_PPU_FOR_ICON_BAR

[NES version, Common]

Name: SETUP_PPU_FOR_ICON_BAR [Show more] Type: Macro Category: PPU Summary: If the PPU has started drawing the icon bar, configure the PPU to use nametable 0 and pattern table 0 Deep dive: The split-screen mode in NES Elite
Context: See this macro in context in the source code References: This macro is used as follows: * ABORT2 uses SETUP_PPU_FOR_ICON_BAR * BLINE uses SETUP_PPU_FOR_ICON_BAR * BPRNT uses SETUP_PPU_FOR_ICON_BAR * CalculateGridLines uses SETUP_PPU_FOR_ICON_BAR * ChargeShields uses SETUP_PPU_FOR_ICON_BAR * CheckAltitude uses SETUP_PPU_FOR_ICON_BAR * CHPR (Part 1 of 6) uses SETUP_PPU_FOR_ICON_BAR * CHPR (Part 3 of 6) uses SETUP_PPU_FOR_ICON_BAR * CIRCLE uses SETUP_PPU_FOR_ICON_BAR * ClearDrawingPlane (Part 1 of 3) uses SETUP_PPU_FOR_ICON_BAR * ClearDrawingPlane (Part 2 of 3) uses SETUP_PPU_FOR_ICON_BAR * ClearDrawingPlane (Part 3 of 3) uses SETUP_PPU_FOR_ICON_BAR * ClearScreen uses SETUP_PPU_FOR_ICON_BAR * CopyCommanderToBuf uses SETUP_PPU_FOR_ICON_BAR * cpl uses SETUP_PPU_FOR_ICON_BAR * DETOK uses SETUP_PPU_FOR_ICON_BAR * DETOK2 uses SETUP_PPU_FOR_ICON_BAR * DILX uses SETUP_PPU_FOR_ICON_BAR * DOCKIT uses SETUP_PPU_FOR_ICON_BAR * DOEXP uses SETUP_PPU_FOR_ICON_BAR * Draw4OptionTiles uses SETUP_PPU_FOR_ICON_BAR * DrawBackground uses SETUP_PPU_FOR_ICON_BAR * DrawBlankButton2x2 uses SETUP_PPU_FOR_ICON_BAR * DrawBlankButton3x2 uses SETUP_PPU_FOR_ICON_BAR * DrawBoxEdges uses SETUP_PPU_FOR_ICON_BAR * DrawDash uses SETUP_PPU_FOR_ICON_BAR * DrawDashNames uses SETUP_PPU_FOR_ICON_BAR * DrawExplosionBurst uses SETUP_PPU_FOR_ICON_BAR * DrawHangarWallLine uses SETUP_PPU_FOR_ICON_BAR * DrawIconBar uses SETUP_PPU_FOR_ICON_BAR * DrawScrollFrame uses SETUP_PPU_FOR_ICON_BAR * DrawSmallLogo uses SETUP_PPU_FOR_ICON_BAR * DrawSpriteImage uses SETUP_PPU_FOR_ICON_BAR * DrawSunRowOfBlocks uses SETUP_PPU_FOR_ICON_BAR * DrawVerticalLine (Part 1 of 3) uses SETUP_PPU_FOR_ICON_BAR * DrawVerticalLine (Part 2 of 3) uses SETUP_PPU_FOR_ICON_BAR * DrawVerticalLine (Part 3 of 3) uses SETUP_PPU_FOR_ICON_BAR * DVID3B2 uses SETUP_PPU_FOR_ICON_BAR * EDGES uses SETUP_PPU_FOR_ICON_BAR * EQSHP uses SETUP_PPU_FOR_ICON_BAR * ex uses SETUP_PPU_FOR_ICON_BAR * FAROF2 uses SETUP_PPU_FOR_ICON_BAR * FLIP uses SETUP_PPU_FOR_ICON_BAR * FlushSoundChannel uses SETUP_PPU_FOR_ICON_BAR * GetScrollDivisions uses SETUP_PPU_FOR_ICON_BAR * GRIDSET uses SETUP_PPU_FOR_ICON_BAR * GRS1 uses SETUP_PPU_FOR_ICON_BAR * HAL3 uses SETUP_PPU_FOR_ICON_BAR * HAS3 uses SETUP_PPU_FOR_ICON_BAR * HideFromScanner uses SETUP_PPU_FOR_ICON_BAR * HideMostSprites uses SETUP_PPU_FOR_ICON_BAR * HideStardust uses SETUP_PPU_FOR_ICON_BAR * HLOIN (Part 1 of 5) uses SETUP_PPU_FOR_ICON_BAR * HLOIN (Part 2 of 5) uses SETUP_PPU_FOR_ICON_BAR * HLOIN (Part 3 of 5) uses SETUP_PPU_FOR_ICON_BAR * HLOIN (Part 4 of 5) uses SETUP_PPU_FOR_ICON_BAR * HLOIN (Part 5 of 5) uses SETUP_PPU_FOR_ICON_BAR * HME2 uses SETUP_PPU_FOR_ICON_BAR * IncreaseTally uses SETUP_PPU_FOR_ICON_BAR * KILLSHP uses SETUP_PPU_FOR_ICON_BAR * KS2 uses SETUP_PPU_FOR_ICON_BAR * LAUN uses SETUP_PPU_FOR_ICON_BAR * LL118 uses SETUP_PPU_FOR_ICON_BAR * LL145 (Part 4 of 4) uses SETUP_PPU_FOR_ICON_BAR * LL164 uses SETUP_PPU_FOR_ICON_BAR * LL51 uses SETUP_PPU_FOR_ICON_BAR * LL9 (Part 1 of 12) uses SETUP_PPU_FOR_ICON_BAR * LL9 (Part 3 of 12) uses SETUP_PPU_FOR_ICON_BAR * LL9 (Part 5 of 12) uses SETUP_PPU_FOR_ICON_BAR * LL9 (Part 6 of 12) uses SETUP_PPU_FOR_ICON_BAR * LL9 (Part 8 of 12) uses SETUP_PPU_FOR_ICON_BAR * LL9 (Part 10 of 12) uses SETUP_PPU_FOR_ICON_BAR * LoadHighFont uses SETUP_PPU_FOR_ICON_BAR * LoadNormalFont uses SETUP_PPU_FOR_ICON_BAR * LOIN (Part 1 of 7) uses SETUP_PPU_FOR_ICON_BAR * LOIN (Part 3 of 7) uses SETUP_PPU_FOR_ICON_BAR * LOIN (Part 4 of 7) uses SETUP_PPU_FOR_ICON_BAR * LOIN (Part 6 of 7) uses SETUP_PPU_FOR_ICON_BAR * LOIN (Part 7 of 7) uses SETUP_PPU_FOR_ICON_BAR * Main flight loop (Part 1 of 16) uses SETUP_PPU_FOR_ICON_BAR * Main flight loop (Part 3 of 16) uses SETUP_PPU_FOR_ICON_BAR * Main flight loop (Part 4 of 16) uses SETUP_PPU_FOR_ICON_BAR * Main flight loop (Part 6 of 16) uses SETUP_PPU_FOR_ICON_BAR * Main flight loop (Part 13 of 16) uses SETUP_PPU_FOR_ICON_BAR * MAS3 uses SETUP_PPU_FOR_ICON_BAR * MCASH uses SETUP_PPU_FOR_ICON_BAR * MESS uses SETUP_PPU_FOR_ICON_BAR * MULT1 uses SETUP_PPU_FOR_ICON_BAR * MULT12 uses SETUP_PPU_FOR_ICON_BAR * MULT3 uses SETUP_PPU_FOR_ICON_BAR * MVEIT (Part 1 of 9) uses SETUP_PPU_FOR_ICON_BAR * MVEIT (Part 2 of 9) uses SETUP_PPU_FOR_ICON_BAR * MVEIT (Part 3 of 9) uses SETUP_PPU_FOR_ICON_BAR * MVEIT (Part 5 of 9) uses SETUP_PPU_FOR_ICON_BAR * MVEIT (Part 6 of 9) uses SETUP_PPU_FOR_ICON_BAR * MVEIT (Part 8 of 9) uses SETUP_PPU_FOR_ICON_BAR * MVS4 uses SETUP_PPU_FOR_ICON_BAR * MVS5 uses SETUP_PPU_FOR_ICON_BAR * NOISE uses SETUP_PPU_FOR_ICON_BAR * NORM uses SETUP_PPU_FOR_ICON_BAR * nWq uses SETUP_PPU_FOR_ICON_BAR * NWSHP uses SETUP_PPU_FOR_ICON_BAR * PIXEL uses SETUP_PPU_FOR_ICON_BAR * PLFL uses SETUP_PPU_FOR_ICON_BAR * PLS22 uses SETUP_PPU_FOR_ICON_BAR * PLS6 uses SETUP_PPU_FOR_ICON_BAR * PrintFlightMessage uses SETUP_PPU_FOR_ICON_BAR * PrintNumberInHold uses SETUP_PPU_FOR_ICON_BAR * ResetScanner uses SETUP_PPU_FOR_ICON_BAR * ResetStardust uses SETUP_PPU_FOR_ICON_BAR * ScrollTextUpScreen uses SETUP_PPU_FOR_ICON_BAR * SetIconBarButtons uses SETUP_PPU_FOR_ICON_BAR * SetKeyLogger uses SETUP_PPU_FOR_ICON_BAR * SetLinePatterns uses SETUP_PPU_FOR_ICON_BAR * SetupIconBar uses SETUP_PPU_FOR_ICON_BAR * SetupPPUForIconBar uses SETUP_PPU_FOR_ICON_BAR * SetupSprite0 uses SETUP_PPU_FOR_ICON_BAR * SFS1 uses SETUP_PPU_FOR_ICON_BAR * ShowIconBar uses SETUP_PPU_FOR_ICON_BAR * ShowScrollText uses SETUP_PPU_FOR_ICON_BAR * SpawnSpaceStation uses SETUP_PPU_FOR_ICON_BAR * STARS1 uses SETUP_PPU_FOR_ICON_BAR * STARS2 uses SETUP_PPU_FOR_ICON_BAR * STARS6 uses SETUP_PPU_FOR_ICON_BAR * StartEffect_b7 uses SETUP_PPU_FOR_ICON_BAR * StartEffectOnNOISE uses SETUP_PPU_FOR_ICON_BAR * StartEffectOnSQ1 uses SETUP_PPU_FOR_ICON_BAR * StartEffectOnSQ2 uses SETUP_PPU_FOR_ICON_BAR * StoreMessage uses SETUP_PPU_FOR_ICON_BAR * SUN (Part 2 of 2) uses SETUP_PPU_FOR_ICON_BAR * TACTICS (Part 4 of 7) uses SETUP_PPU_FOR_ICON_BAR * TACTICS (Part 6 of 7) uses SETUP_PPU_FOR_ICON_BAR * TACTICS (Part 7 of 7) uses SETUP_PPU_FOR_ICON_BAR * TAS1 uses SETUP_PPU_FOR_ICON_BAR * TAS2 uses SETUP_PPU_FOR_ICON_BAR * TIDY uses SETUP_PPU_FOR_ICON_BAR * TITLE uses SETUP_PPU_FOR_ICON_BAR * TT111 uses SETUP_PPU_FOR_ICON_BAR * TT210 uses SETUP_PPU_FOR_ICON_BAR * TT23 uses SETUP_PPU_FOR_ICON_BAR * TT24 uses SETUP_PPU_FOR_ICON_BAR * TT26 uses SETUP_PPU_FOR_ICON_BAR * TT27 uses SETUP_PPU_FOR_ICON_BAR * UnpackToRAM uses SETUP_PPU_FOR_ICON_BAR * UpdateIconBar uses SETUP_PPU_FOR_ICON_BAR * WaitForIconBarPPU uses SETUP_PPU_FOR_ICON_BAR * WaitForNMI uses SETUP_PPU_FOR_ICON_BAR * WaitForPPUToFinish uses SETUP_PPU_FOR_ICON_BAR * WPSHPS uses SETUP_PPU_FOR_ICON_BAR * ZINF uses SETUP_PPU_FOR_ICON_BAR * ZINF_b1 uses SETUP_PPU_FOR_ICON_BAR

The following macro is used to ensure the game switches to the correct PPU nametable and pattern table for drawing the icon bar: SETUP_PPU_FOR_ICON_BAR It checks whether the PPU has started drawing the icon bar (which it does using sprite 0), and if it has it switches the PPU to nametable 0 and pattern table 0, as that's where the icon bar tiles live. If bit 7 of setupPPUForIconBar is set, it also affects the C flag as follows: * If bit 6 of PPU_STATUS is clear (sprite 0 has not been hit) then the C flag is set to bit 7 of PPU_STATUS (which is set if VBlank has started) * If bit 6 of PPU_STATUS is set (sprite 0 has been hit) then the C flag is cleared There are no arguments.
MACRO SETUP_PPU_FOR_ICON_BAR LDA setupPPUForIconBar ; If bit 7 of setupPPUForIconBar is clear then jump to BPL skip ; skip1, so we only update the PPU if bit 7 is set ; ; Bit 7 of setupPPUForIconBar is set when there is an ; on-screen user interface (i.e. an icon bar), and it ; is only clear if we are on the game over screen, which ; doesn't have an icon bar LDA PPU_STATUS ; If bit 6 of PPU_STATUS is clear then jump to skip1, ASL A ; so we only update the PPU if bit 6 is set BPL skip ; ; Bit 6 of PPU_STATUS is the sprite 0 hit flag, which is ; set when a non-transparent pixel in sprite 0 is drawn ; over a non-transparent background pixel ; ; It gets zeroed at the start of each VBlank and set ; when sprite 0 is drawn ; ; Sprite 0 is at the bottom-right corner of the space ; view, at coordinates (248, 163), so this means bit 6 ; of PPU_STATUS gets set when the PPU starts drawing the ; icon bar JSR SetPPUTablesTo0 ; If we get here then both bit 7 of setupPPUForIconBar ; and bit 6 of PPU_STATUS are set, which means there is ; an icon bar on-screen and the PPU has just started ; drawing it, so we call SetPPUTablesTo0 to: ; ; * Zero setupPPUForIconBar to disable this process ; until the next NMI interrupt at the next VBlank ; ; * Clear bits 0 and 4 of PPU_CTRL, to set the base ; nametable address to $2000 (for nametable 0) and ; the pattern table to $0000 (for pattern table 0) ; ; * Clear the C flag .skip ENDMACRO