.CheckDashData STA T \ Store A and X in T and U so we can retrieve them below STX U LDX UU \ Set X to the dash data block number TYA \ Set the C flag as follows: CMP dashDataOffset,X \ \ * C flag clear if Y < dashDataOffset,X \ \ * C flag set if Y >= dashDataOffset,X BNE cdas1 \ If Y <> the dashDataOffset of block X, skip the \ following instruction CLC \ If we get here then Y = the dashDataOffset of block X, \ so clear the C flag \ So by this point we have: \ \ * C flag clear if Y <= dashDataOffset,X \ \ * C flag set if Y > dashDataOffset,X \ \ As the dash data lives at the top of each dash data \ block, this gives us the result we want (as Y is \ pointing to data when Y > dashDataOffset,X) .cdas1 LDA T \ Restore the values of A and X that we stored above LDX U RTS \ Return from the subroutineName: CheckDashData [Show more] Type: Subroutine Category: Screen buffer Summary: Check whether a dash data block index is pointing to dash dataContext: See this subroutine in context in the source code References: This subroutine is called as follows: * DrawGrassLeft calls CheckDashData * DrawGrassRight calls CheckDashData * DrawVergeByteLeft calls CheckDashData * DrawVergeByteRight calls CheckDashData
This routine checks whether an index in Y, which is relative to the start of a dash data block, is pointing to dash data within the block.
Arguments: UU Dash data block number (0 to 39) Y The index from the start of the dash data block
Returns: C flag The result, as follows: * Clear if offset Y does not point to dash data * Set if offset Y does point to dash data A A is unchanged X X is unchanged
[X]
Label cdas1 is local to this routine
[X]
Variable dashDataOffset (category: Screen buffer)
Offset of the dash data within each dash data block