.SendBitplaneToPPU STX drawingBitplane ; Set the drawing bitplane and the NMI bitplane to the STX nmiBitplane ; argument in X, so all the following operations apply ; to the specified bitplane STX hiddenBitplane ; Hide bitplane X so it isn't visible on-screen while ; we do the following LDA #0 ; Tell the NMI handler to send nametable entries from STA firstNameTile ; tile 0 onwards LDA QQ11 ; If the view type in QQ11 is not $DF (Start screen with CMP #$DF ; the normal font loaded), then jump to sbit1 to skip BNE sbit1 ; the following and start sending pattern data from ; pattern 37 onwards LDA #4 ; This is the Start screen with font loaded in bitplane BNE sbit2 ; 0, so set A = 4 so we start sending pattern data ; from pattern 4 onwards .sbit1 LDA #37 ; So set A = 37 so we start sending pattern data from ; pattern 37 onwards .sbit2 STA firstPattern ; Tell the NMI handler to send pattern entries from ; pattern A in the buffer LDA firstFreePattern ; Tell the NMI handler to send pattern entries up to the STA lastPattern,X ; first free pattern, for the drawing bitplane in X LDA #%11000100 ; Set the bitplane flags for the drawing bitplane to the JSR SetDrawPlaneFlags ; following: ; ; * Bit 2 set = send tiles up to end of the buffer ; * Bit 3 clear = don't clear buffers after sending ; * Bit 4 clear = we've not started sending data yet ; * Bit 5 clear = we have not yet sent all the data ; * Bit 6 set = send both pattern and nametable data ; * Bit 7 set = send data to the PPU ; ; Bits 0 and 1 are ignored and are always clear ; ; This configures the NMI to send nametable and pattern ; data for the drawing bitplane to the PPU during VBlank JSR SendDataNowToPPU ; Send the drawing bitplane buffers to the PPU ; immediately, without trying to squeeze it into VBlanks LDA firstFreePattern ; Set clearingPattern for the drawing bitplane to the STA clearingPattern,X ; number of the first free pattern, so the NMI handler ; only clears patterns from this point onwards ; ; This ensures that the tiles that we just sent to the ; PPU don't get cleared out by the NMI handler RTS ; Return from the subroutineName: SendBitplaneToPPU [Show more] Type: Subroutine Category: PPU Summary: Send a bitplane to the PPU immediately 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: * SendBitplaneToPPU_b3 calls SendBitplaneToPPU * SendViewToPPU calls SendBitplaneToPPU
Arguments: X The number of the bitplane to configure to be sent to the PPU in the NMI handler
[X]
Subroutine SendDataNowToPPU (category: PPU)
Send the specified bitplane buffers to the PPU immediately, without trying to squeeze it into VBlanks
[X]
Subroutine SetDrawPlaneFlags (category: Drawing the screen)
Set the drawing bitplane flags to the specified value, draw the box edges and set the next free tile number
[X]
Variable clearingPattern in workspace ZP
The number of the first pattern to clear in pattern buffer 0 when the NMI handler clears patterns
[X]
Variable drawingBitplane in workspace ZP
Flipped manually by calling FlipDrawingPlane, controls whether we are showing nametable/palette buffer 0 or 1
[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 firstNameTile in workspace ZP
The number of the first tile for which we send nametable data to the PPU in the NMI handler (potentially for both bitplanes, if both are configured to be sent)
[X]
Variable firstPattern in workspace ZP
The number of the first pattern for which we send data to the PPU in the NMI handler (potentially for both bitplanes, if both are configured to be sent)
[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 nmiBitplane in workspace ZP
The number of the bitplane (0 or 1) that is currently being processed in the NMI handler during VBlank
[X]
Label sbit1 is local to this routine
[X]
Label sbit2 is local to this routine