.CopyNameBuffer0To1 LDY #0 ; Set Y = 0 so we can use it as an index starting at 0, ; and then counting down from 255 to 0 LDX #16 ; The following loop also updates a counter in X that ; counts down from 16 to 1 and back to 16 again, but it ; isn't used anywhere, so presumably this is left over ; from some functionality that was later removed .copy1 LDA nameBuffer0,Y ; Copy the Y-th byte of nametable buffer 0 to nametable STA nameBuffer1,Y ; buffer 1, so this copies the first 256 bytes as Y ; counts down LDA nameBuffer0+256,Y ; Copy byte 256, and bytes 511 to 255 into nametable STA nameBuffer1+256,Y ; buffer 1 as Y counts down LDA nameBuffer0+512,Y ; Copy byte 512, and bytes 767 to 511 into nametable STA nameBuffer1+512,Y ; buffer 1 as Y counts down LDA nameBuffer0+768,Y ; Copy byte 768, and bytes 1023 to 769 into nametable STA nameBuffer1+768,Y ; buffer 1 as Y counts down JSR SetupPPUForIconBar ; If the PPU has started drawing the icon bar, configure ; the PPU to use nametable 0 and pattern table 0 DEX ; Decrement the counter in X, wrapping it back up to 16 BNE copy2 ; when it reaches 0 LDX #16 .copy2 DEY ; Decrement the index counter in Y BNE copy1 ; Loop back to copy1 to copy the next four bytes, until ; we have copied the whole buffer LDA firstFreePattern ; Tell the NMI handler to send pattern entries up to the STA lastPattern ; first free pattern, for both bitplanes STA lastPattern+1 RTS ; Return from the subroutineName: CopyNameBuffer0To1 [Show more] Type: Subroutine Category: Drawing the screen Summary: Copy the contents of nametable buffer 0 to nametable buffer 1Context: See this subroutine in context in the source code References: This subroutine is called as follows: * ChangeToView calls CopyNameBuffer0To1 * DEATH calls CopyNameBuffer0To1 * DrawScreenInNMI calls CopyNameBuffer0To1 * PlayDemo calls CopyNameBuffer0To1 * SendSpaceViewToPPU calls CopyNameBuffer0To1 * SetSpaceViewInNMI calls CopyNameBuffer0To1 * UpdateHangarView calls CopyNameBuffer0To1 * UpdateView calls CopyNameBuffer0To1
[X]
Subroutine SetupPPUForIconBar (category: PPU)
If the PPU has started drawing the icon bar, configure the PPU to use nametable 0 and pattern table 0, while preserving A
[X]
Label copy1 is local to this routine
[X]
Label copy2 is local to this routine
[X]
Variable firstFreePattern in workspace ZP
Contains the number of the first free pattern in the pattern buffer that we can draw into next (or 0 if there are no free patterns)
[X]
Variable lastPattern in workspace ZP
The number of the last pattern entry to send from pattern buffer 0 to bitplane 0 of the PPU pattern table in the NMI handler
[X]
Variable nameBuffer0 in workspace Cartridge WRAM
The buffer for nametable 0 that gets sent to the PPU during VBlank
[X]
Variable nameBuffer1 in workspace Cartridge WRAM
The buffer for nametable 1 that gets sent to the PPU during VBlank