.spat30 ; We now store the following variables, so they can be ; picked up when we return in the next VBlank: ; ; * (patternBufferHi patternBufferLo) ; ; * sendingPattern STX patternCounter ; Store X in patternCounter to use below LDX nmiBitplane ; Set (patternBufferHi patternBufferLo) for this STY patternBufferLo,X ; bitplane to dataForPPU(1 0) + Y (which is the address LDA dataForPPU+1 ; of the next byte of data to be sent from the pattern STA patternBufferHi,X ; buffer in the next VBlank) LDA patternCounter ; Set sendingPattern for this bitplane to the value of STA sendingPattern,X ; X we stored above (which is the number / 8 of the next ; pattern to be sent from the pattern buffer in the next ; VBlank) JMP RTS1 ; Return from the subroutine (as RTS1 contains an RTS)Name: SendPatternsToPPU (Part 6 of 6) [Show more] Type: Subroutine Category: PPU Summary: Save progress for use in the next VBlank and return from the subroutine Deep dive: Drawing vector graphics using NES tilesContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
[X]
Entry point RTS1 in subroutine ConsiderSendTiles (category: PPU)
Contains an RTS
[X]
Variable dataForPPU in workspace ZP
An address pointing to data that we send to the PPU
[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]
Variable patternBufferHi in workspace WP
(patternBufferHi patternBufferLo) contains the address of the pattern buffer for the pattern we are sending to the PPU from bitplane 0 (i.e. for pattern number sendingPattern in bitplane 0)
[X]
Variable patternBufferLo in workspace ZP
(patternBufferHi patternBufferLo) contains the address of the pattern buffer for the pattern we are sending to the PPU from bitplane 0 (i.e. for pattern number sendingPattern in bitplane 0)
[X]
Variable patternCounter in workspace ZP
Counts patterns as they are written to the PPU pattern table in the NMI handler
[X]
Variable sendingPattern in workspace ZP
The number of the most recent pattern that was sent to the PPU pattern table by the NMI handler for bitplane 0 (or the number of the first pattern to send if none have been sent)