Skip to navigation

Elite on the BBC Micro and NES

Equipment: eq

[BBC Micro cassette version]

Name: eq [Show more] Type: Subroutine Category: Equipment Summary: Subtract the price of equipment from the cash pot
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * EQSHP calls eq

If we have enough cash, subtract the price of a specified piece of equipment from our cash pot and return from the subroutine. If we don't have enough cash, exit to the docking bay (i.e. show the Status Mode screen).
Arguments: A The item number of the piece of equipment (0-11) as shown in the table at PRXS
.eq JSR prx \ Call prx to set (Y X) to the price of equipment item \ number A JSR LCASH \ Subtract (Y X) cash from the cash pot, but only if \ we have enough cash BCS c \ If the C flag is set then we did have enough cash for \ the transaction, so jump to c to return from the \ subroutine (as c contains an RTS) LDA #197 \ Otherwise we don't have enough cash to buy this piece JSR prq \ of equipment, so print recursive token 37 ("CASH") \ followed by a question mark JMP err \ Jump to err to beep, pause and go to the docking bay \ (i.e. show the Status Mode screen)