Skip to navigation

Screen buffer: DrawTrackBytes (Part 2 of 3)

Name: DrawTrackBytes (Part 2 of 3) [Show more] Type: Subroutine Category: Screen buffer Summary: Draw the pixel bytes that make up the track view (16 to 39) Deep dive: Drawing around the dashboard Drawing the track view
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * DrawTrackView (Part 2 of 4) calls via byte2 * DrawTrackView (Part 3 of 4) calls via byte2 * DrawTrackView (Part 4 of 4) calls via byte2

Note that the latter half of this routine, from .byte2 onwards, starts on a page boundary (byte2 = &7E00). This is important as it means the code can be modified at a specific address using only the low byte of that address, as we know that high byte is the same throughout the routine. This is why the lookup tables at staDrawByte and ldaDrawByte only need to store the low bytes of the addresses for instructions that we need to modify.
Other entry points: byte2 Only draw pixel bytes 26 to 39
.byte1 DRAW_BYTE 16 \ Draw pixel bytes 16 to 25 DRAW_BYTE 17 DRAW_BYTE 18 DRAW_BYTE 19 DRAW_BYTE 20 DRAW_BYTE 21 DRAW_BYTE 22 DRAW_BYTE 23 DRAW_BYTE 24 DRAW_BYTE 25 .byte2 DRAW_BYTE 26 \ Draw pixel bytes 26 to 39 DRAW_BYTE 27 DRAW_BYTE 28 DRAW_BYTE 29 DRAW_BYTE 30 DRAW_BYTE 31 DRAW_BYTE 32 DRAW_BYTE 33 DRAW_BYTE 34 DRAW_BYTE 35 DRAW_BYTE 36 DRAW_BYTE 37 DRAW_BYTE 38 DRAW_BYTE 39 .byte3 CPX #44 \ If X = 44, then we have just drawn the last pixel BEQ byte4 \ line above the top of the dashboard, so return from \ the subroutine so we can modify the routine to draw \ subsequent lines in two parts, to fit around the \ dashboard (as byte4 contains an RTS) DEX \ Decrement the dash data pointer in X to move on to the \ next pixel line \ Fall through into DrawTrackLine to draw the next line