This code appears in the following versions (click to see it in the source code):
Code variations between these versions are shown below.
Name: PIX Type: Subroutine Category: Drawing pixels Summary: Draw a single pixel at a specific coordinate
This variation is blank in the Cassette, Disc (flight), 6502 Second Processor and Master versions.
Deep dive: Drawing pixels in the Electron version
Draw a pixel at screen coordinate (X, -A). The sign bit of A gets flipped before drawing, and then the routine uses the same approach as the PIXEL routine in the main game code, except it plots a single pixel from TWOS instead of a two pixel dash from TWOS2. This applies to the top part of the
See the PIXEL routine in the main game code for more details.
Arguments: X The screen x-coordinate of the pixel to draw A The screen y-coordinate of the pixel to draw, negated
This variation is blank in the Cassette, 6502 Second Processor and Master versions.
Tap on a block to expand it, and tap it again to revert.
.PIX
This variation is blank in the Cassette, Disc (flight), 6502 Second Processor and Master versions.
LDY #128 \ Set ZP = 128 for use in the calculation below STY ZP
TAY \ Copy A into Y, for use later EOR #%10000000 \ Flip the sign of A
This variation is blank in the Cassette, Disc (flight), 6502 Second Processor and Master versions.
CMP #248 \ If the y-coordinate in A >= 248, then this is the BCS PIX-1 \ bottom row of the screen, which we want to leave blank \ as it's below the bottom of the dashboard, so return \ from the subroutine (as PIX-1 contains an RTS)
TYA \ Set Y = Y mod 8, which is the pixel row within the AND #7 \ character block at which we want to draw our pixel TAY \ (as each character block has 8 rows) TXA \ Set X = X mod 8, which is the horizontal pixel number AND #7 \ within the character block where the pixel lies (as TAX \ each pixel line in the character block is 8 pixels \ wide)
In the cassette and Electron versions, the loading screen's Saturn has a much higher dot density than the other versions, as the drawing routine plots individual pixels into the screen using OR logic, so pixels within a character block can be next to each other. The other versions poke whole one-pixel bytes directly into screen memory without the OR logic, which overwrites any pixels already plotted in that byte and ensures a much greater pixel spacing (though pixels at the ends of neighbouring character blocks can still be next to each other).
Tap on a block to expand it, and tap it again to revert.
This variation is blank in the Cassette, 6502 Second Processor, Master and Electron versions.
RTS \ Return from the subroutine