Skip to navigation

Screen buffer: ConfigureBuffer

Name: ConfigureBuffer [Show more] Type: Subroutine Category: Screen buffer Summary: Set up the variables required to configure the screen buffer to a specific buffer type
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * ClearScreen calls ConfigureBuffer * MainGameLoop calls ConfigureBuffer * UseColumnBuffer calls ConfigureBuffer * UseRowBuffer calls ConfigureBuffer

Arguments: A The type of buffer to configure: * 0 = left row buffer (for up/down pan) for the first 256 bytes of the 320-byte row * 1 = right row buffer (for up/down pan) for the last 64 bytes of the 320-byte row * 2 = column buffer (for left/right pan)
.ConfigureBuffer STA screenBufferType \ Set screenBufferType to the new buffer type TAY \ Copy the buffer type into Y so we can use it as an \ index into the various buffer configuration tables LDA buffersMinYaw,Y \ Set the high byte of bufferMinYaw(Hi Lo) to the value STA bufferMinYawHi \ from the buffersMinYaw table for this screen buffer LSR A \ Set bufferMaxYawHi = bufferMinYawHi / 2 EOR #%10000000 \ STA bufferMaxYawHi \ and with bit 7 flipped LDA buffersOrigin,Y \ Set the high byte of bufferOrigin(Hi Lo) to the value STA bufferOriginHi \ from the buffersOrigin table for this screen buffer LDA xBuffersWidth,Y \ Set xBufferWidth to the value from the xBuffersWidth STA xBufferWidth \ table for this screen buffer LDA xBuffersLeft,Y \ Set xBufferLeft to the value from the xBuffersLeft STA xBufferLeft \ table for this screen buffer CLC \ Set xBufferRight = xBufferLeft + xBufferWidth ADC xBufferWidth \ STA xBufferRight \ So this sets the right edge of the screen buffer LDA #0 \ Zero the low byte of bufferMinYaw(Hi Lo) STA bufferMinYawLo STA bufferOriginLo \ Zero the low byte of bufferOrigin(Hi Lo) RTS \ Return from the subroutine