.LL155 LDA NEEDKEY \ If NEEDKEY is zero, jump to notneed to skip the next BEQ notneed \ two instructions, so we only read the keyboard if \ NEEDKEY is non-zero STZ NEEDKEY \ Set NEEDKEY = 0 JSR RDKEY \ Scan the keyboard for a key press and return the \ internal key number in X (or 0 for no key press) .notneed LDA (XX19) \ Fetch the first byte from the ship line heap into A, \ which contains the number of bytes in the heap CMP #5 \ If the heap size is less than 5, there is nothing to BCC nolines \ draw, so return from the subroutine (as nolines \ contains an RTS) LDA #129 \ Send an OSWRCH 129 command to the I/O processor to JSR OSWRCH \ tell it to start receiving a new line to draw (so \ when we send it OSWRCH commands from now on, the I/O \ processor will add these bytes to this line until \ they are all sent, at which point it will draw the \ line) LDY #0 \ Fetch the first byte from the ship line heap into A, LDA (XX19),Y \ which contains the number of bytes in the heap STA XX20 \ Store the heap size in XX20 .LL27 LDA (XX19),Y \ Fetch the Y-th line coordinate from the heap and send JSR OSWRCH \ it to the I/O processor to add to the line buffer INY \ Increment the heap pointer CPY XX20 \ If the heap counter is less than the size of the heap, BCC LL27 \ loop back to LL27 to draw the next line from the heap \ By the time we get here, we have sent all the line \ coordinates to the I/O processor, so it will have \ drawn the line after we sent the last one .nolines RTS \ Return from the subroutineName: LL9 (Part 12 of 12) [Show more] Type: Subroutine Category: Drawing ships Summary: Draw ship: Draw all the visible edges from the ship line heap Deep dive: Drawing shipsContext: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: No direct references to this subroutine in this source file
This part draws the lines in the ship line heap, which is used both to draw the ship, and to remove it from the screen. If NEEDKEY is non-zero, then this routine also scans the keyboard for a key press and returns the internal key number in X (or 0 for no key press).
[X]
Label LL27 is local to this routine
[X]
Configuration variable OSWRCH = &FFEE
The address for the OSWRCH routine
[X]
Subroutine RDKEY (category: Keyboard)
Scan the keyboard for key presses by sending an OSWORD 240 command to the I/O processor
[X]
Label nolines is local to this routine
[X]
Label notneed is local to this routine