Skip to navigation

Aviator on the BBC Micro

Graphics: ClearRows

Name: ClearRows [Show more] Type: Subroutine Category: Graphics Summary: Clear the specified number of rows on-screen
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * DrawCanopy calls ClearRows

This routine zeroes a block of Y bytes on R screen rows, starting from screen address (Q P) on the first row. A value of Y = 0 will zero 256 bytes. In other words, (Q P) represents the top-left pixel to blank, Y represents the width of the area to blank (with a value of 8 per character block), and R contains the number of rows to blank.
Arguments: Y The width of each character row to zero (in bytes), 0 indicates 256 bytes (Q P) The screen address to start zeroing from R The number of character rows to zero
.ClearRows STY S \ Store the width of each character row in S .crow1 LDA #0 \ We are about to zero a block of memory, so set A = 0 \ so we can use it as our overwrite value LDY S \ Fetch the width of each character row, which we stored \ in S above .crow2 STA (P),Y \ Zero the Y-th byte of the page at (Q P), which sets 4 \ pixels to black DEY \ Decrement the byte pointer BNE crow2 \ Loop back until we have zeroed (Q P) to (Q P) + Y LDA P \ Set (Q P) = (Q P) + 320 CLC \ ADC #LO(320) \ starting with the low bytes STA P LDA Q \ And then the high bytes ADC #HI(320) STA Q DEC R \ Decrement the row counter in R BNE crow1 \ Loop back until we have zeroed R rows RTS \ Return from the subroutine SKIP 30 \ These bytes appear to be unused EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF EQUB &FF, &FF SKIP 32 EQUB &40