Skip to navigation

Elite on the BBC Micro and NES

Drawing planets: PL9 (Part 1 of 3)

[BBC Micro disc version, Flight]

Name: PL9 (Part 1 of 3) [Show more] Type: Subroutine Category: Drawing planets Summary: Draw the planet, with either an equator and meridian, or a crater
Context: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: This subroutine is called as follows: * PLANET calls PL9

Draw the planet with radius K at pixel coordinate (K3, K4), and with either an equator and meridian, or a crater.
Arguments: K(1 0) The planet's radius K3(1 0) Pixel x-coordinate of the centre of the planet K4(1 0) Pixel y-coordinate of the centre of the planet INWK The planet's ship data block
.PL9 JSR WPLS2 \ Call WPLS2 to remove the planet from the screen JSR CIRCLE \ Call CIRCLE to draw the planet's new circle BCS PL20 \ If the call to CIRCLE returned with the C flag set, \ then the circle does not fit on-screen, so jump to \ PL20 to return from the subroutine LDA K+1 \ If K+1 is zero, jump to PL25 as K(1 0) < 256, so the BEQ PL25 \ planet fits on the screen and we can draw meridians or \ craters .PL20 RTS \ The planet doesn't fit on-screen, so return from the \ subroutine .PL25 LDA TYPE \ If the planet type is 128 then it has an equator and CMP #128 \ a meridian, so this jumps to PL26 if this is not a BNE PL26 \ planet with an equator - in other words, if it is a \ planet with a crater \ Otherwise this is a planet with an equator and \ meridian, so fall through into the following to draw \ them