Skip to navigation

Elite on the BBC Micro and NES

Ship hangar: UNWISE

[BBC Micro disc version, Docked]

Name: UNWISE [Show more] Type: Subroutine Category: Ship hangar Summary: Switch the main line-drawing routine between EOR and OR logic
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: * HALL calls UNWISE * HAS1 calls via HA1

This routine toggles the main line-drawing routine between EOR and OR logic, for use when drawing the ship hangar. It does this by modifying the instructions in the main line-drawing routine at LOIN/LL30, flipping the drawing logic between the default EOR logic (which merges with whatever is already on screen, allowing us to erase anything we draw for animation purposes) and OR logic (which overwrites the screen, ignoring anything that's already there). We want to use OR logic for drawing the ship hangar, as it looks better and we don't need to animate it). The routine name, UNWISE, sums up this approach - if anything goes wrong, the results would be messy.
Other entry points: HA1 Contains an RTS
.UNWISE LDA LIL2+2 \ Flip bit 6 of LIL2+2 to change the EOR (SC),Y in LIL2 EOR #%01000000 \ to an ORA (SC),Y (or back again) STA LIL2+2 LDA LIL3+2 \ Flip bit 6 of LIL3+2 to change the EOR (SC),Y in LIL3 EOR #%01000000 \ to an ORA (SC),Y (or back again) STA LIL3+2 LDA LIL5+2 \ Flip bit 6 of LIL2+2 to change the EOR (SC),Y in LIL5 EOR #%01000000 \ to an ORA (SC),Y (or back again) STA LIL5+2 LDA LIL6+2 \ Flip bit 6 of LIL2+2 to change the EOR (SC),Y in LIL6 EOR #%01000000 \ to an ORA (SC),Y (or back again) STA LIL6+2 .HA1 RTS \ Return from the subroutine