Skip to navigation

Elite on the BBC Micro and NES

Flight: DENGY

[6502 Second Processor version]

Name: DENGY [Show more] Type: Subroutine Category: Flight Summary: Drain some energy from the energy banks
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: * LASLI calls DENGY * Main flight loop (Part 16 of 16) calls DENGY

Returns: Z flag Set if we have no energy left, clear otherwise
.DENGY DEC ENERGY \ Decrement the energy banks in ENERGY PHP \ Save the flags on the stack BNE P%+5 \ If the energy levels are not yet zero, skip the \ following instruction INC ENERGY \ The minimum allowed energy level is 1, and we just \ reached 0, so increment ENERGY back to 1 PLP \ Restore the flags from the stack, so we return with \ the Z flag from the DEC instruction above RTS \ Return from the subroutine