.UpdateIconBar LDA iconBarType ; Set A to the current icon bar type JSR SetupIconBar ; Set up the icon bar LDA QQ11 ; If bit 6 of the view type is set, then there is no AND #%01000000 ; icon bar on the screen, so jump to ubar2 to return BNE ubar2 ; from the subroutine as there is no icon bar to update JSR SetIconBarRow ; Set the row on which the icon bar appears, which ; depends on the view type LDA #%10000000 ; Set bit 7 of skipBarPatternsPPU, so the NMI handler STA skipBarPatternsPPU ; only sends the nametable entries and not the tile ; patterns ASL A ; Set barPatternCounter = 0, so the NMI handler sends STA barPatternCounter ; icon bar data to the PPU .ubar1 SETUP_PPU_FOR_ICON_BAR ; If the PPU has started drawing the icon bar, configure ; the PPU to use nametable 0 and pattern table 0 LDA barPatternCounter ; Loop back to keep the PPU configured in this way until BPL ubar1 ; barPatternCounter is set to 128 ; ; This happens when the NMI handler has finished sending ; all the icon bar's nametable entries to the PPU, so ; this loop keeps the PPU configured to use nametable 0 ; and pattern table 0 until the icon bar nametable ; entries have been sent ASL skipBarPatternsPPU ; Set skipBarPatternsPPU = 0, so the NMI handler goes ; back to sending both nametable entries and tile ; patterns for the icon bar (when barPatternCounter is ; non-zero) .ubar2 RTS ; Return from the subroutineName: UpdateIconBar [Show more] Type: Subroutine Category: Icon bar Summary: Update the icon bar Deep dive: Views and view types in NES EliteContext: See this subroutine in context in the source code References: This subroutine is called as follows: * UpdateIconBar_b3 calls UpdateIconBar
[X]
Macro SETUP_PPU_FOR_ICON_BAR (category: PPU)
If the PPU has started drawing the icon bar, configure the PPU to use nametable 0 and pattern table 0
[X]
Subroutine SetIconBarRow (category: Icon bar)
Set the row on which the icon bar appears, which depends on the view type
[X]
Subroutine SetupIconBar (category: Icon bar)
Set up the icons on the icon bar to show all available options
[X]
Variable barPatternCounter in workspace ZP
The number of icon bar nametable and pattern entries that need to be sent to the PPU in the NMI handler
[X]
Variable iconBarType in workspace WP
The type of the current icon bar
[X]
Variable skipBarPatternsPPU in workspace ZP
A flag to control whether to send the icon bar's patterns to the PPU, after sending the nametable entries (this only applies if barPatternCounter = 0)
[X]
Label ubar1 is local to this routine
[X]
Label ubar2 is local to this routine