This code appears in the following versions (click to see it in the source code):
Code variations between these versions are shown below.
.PIXEL2 LDA X1 \ Fetch the x-coordinate offset into AName: PIXEL2 Type: Subroutine Category: Drawing pixels Summary: Draw a stardust particle relative to the screen centre
Draw a point (X1, Y1) from the middle of the screen with a size determined by a distance value. Used to draw stardust particles.
Arguments: X1 The x-coordinate offset Y1 The y-coordinate offset (positive means up the screen from the centre, negative means down the screen) ZZ The distance of the point (further away = smaller point)
EOR #%10000000 \ Set X = X1 + 128 TAX \ \ So X is now the offset converted to an x-coordinate, \ centred on x-coordinate 128 LDA Y1 \ Fetch the y-coordinate offset into A and clear the AND #%01111111 \ sign bit, so A = |Y1|
LDA Y1 \ Fetch the y-coordinate offset into A
STA T \ Set A = #Y + 1 - Y1 LDA #Y+1 \ SBC T \ So if Y1 is positive we display the point up from the \ centre at y-coordinate 97, while a negative Y1 means \ down from the centre \ Fall through into PIXEL to draw the stardust at the \ screen coordinates in (X, A)