.DIL2 LDY #1 ; We want to start drawing the vertical indicator bar on ; the second line in the indicator's character block, so ; set Y to point to that row's offset STA Q ; Store the offset of the vertical bar to draw in Q ; We are now going to work our way along the indicator ; on the dashboard, from left to right, working our way ; along one character block at a time. Y will be used as ; a pixel row counter to work our way through the ; character blocks, so each time we draw a character ; block, we will increment Y by 8 to move on to the next ; block (as each character block contains 8 rows) .DLL10 SEC ; Set A = Q - 4, so that A contains the offset of the LDA Q ; vertical bar from the start of this character block SBC #4 BCS DLL11 ; If Q >= 4 then the character block we are drawing does ; not contain the vertical indicator bar, so jump to ; DLL11 to draw a blank character block LDA #$FF ; Set A to a high number (and $FF is as high as they go) LDX Q ; Set X to the offset of the vertical bar, which we know ; is within this character block STA Q ; Set Q to a high number ($FF, why not) so we will keep ; drawing blank characters after this one until we reach ; the end of the indicator row LDA CTWOS,X ; CTWOS is a table of ready-made 2-pixel multicolour ; bitmap mode bytes ; ; This fetches a 2-pixel multicolour bitmap mode byte ; with the pixel position at 2 * X, so the pixel is at ; the offset that we want for our vertical bar AND #YELLOW ; The 4-pixel multicolour bitmap mode colour byte in ; YELLOW represents four pixels of colour %10 (3), which ; is yellow in the dashboard palette. We AND this with A ; so that we only keep the pixel that matches the ; position of the vertical bar (i.e. A is acting as a ; mask on the 4-pixel colour byte) JMP DLL12 ; Jump to DLL12 to skip the code for drawing a blank, ; and move on to drawing the indicator .DLL11 ; If we get here then we want to draw a blank for this ; character block STA Q ; Update Q with the new offset of the vertical bar, so ; it becomes the offset after the character block we ; are about to draw LDA #0 ; Change the mask so no bits are set, so all of the ; character blocks we display from now on will be blank .DLL12 STA (SC),Y ; Draw the shape of the mask on pixel row Y of the ; character block we are processing INY ; Draw the next pixel row, incrementing Y STA (SC),Y INY ; And draw the third pixel row, incrementing Y STA (SC),Y INY ; And draw the fourth pixel row, incrementing Y STA (SC),Y TYA ; Add 5 to Y, so Y is now 8 more than when we started CLC ; this loop iteration, so Y now points to the address ADC #5 ; of the first line of the indicator bar in the next TAY ; character block (as each character is 8 bytes of ; screen memory) CPY #30 ; If Y < 30 then we still have some more character BCC DLL10 ; blocks to draw, so loop back to DLL10 to display the ; next one along ; We now need to move down into the character block ; below, and each character row in screen memory takes ; up $140 bytes ($100 for the visible part and $20 for ; each of the blank borders on the side of the screen), ; so that's what we need to add to SC(1 0) ; ; We also know the C flag is set, as we didn't take the ; BCC above, so we can add $13F in order to get the ; correct result LDA SC ; Set SC(1 0) = SC(1 0) + $140 ADC #$3F ; STA SC ; Starting with the low bytes LDA SC+1 ; And then adding the high bytes ADC #$01 STA SC+1 RTS ; Return from the subroutineName: DIL2 [Show more] Type: Subroutine Category: Dashboard Summary: Update the roll or pitch indicator on the dashboard Deep dive: The dashboard indicatorsContext: See this subroutine in context in the source code References: This subroutine is called as follows: * DIALS (Part 2 of 4) calls DIL2
The indicator can show a vertical bar in 16 positions, with a value of 8 showing the bar in the middle of the indicator. In practice this routine is only ever called with A in the range 1 to 15, so the vertical bar never appears in the leftmost position (though it does appear in the rightmost).
Arguments: A The offset of the vertical bar to show in the indicator, from 0 at the far left, to 8 in the middle, and 15 at the far right
Returns: C flag The C flag is set
[X]
Variable CTWOS (category: Drawing pixels)
Ready-made double-pixel character row bytes for the dashboard
[X]
Label DLL10 is local to this routine
[X]
Label DLL11 is local to this routine
[X]
Label DLL12 is local to this routine
[X]
Configuration variable YELLOW = %10101010
Four multicolour bitmap mode pixels of colour %10, which is mapped to the normal indicator colour for the dashboard dials, or yellow on the scanner, via the colour mapping in sdump (low nibble)