Skip to navigation

Elite on the BBC Micro and NES

Tactics: FRMIS

[NES version, Bank 0]

Name: FRMIS [Show more] Type: Subroutine Category: Tactics Summary: Fire a missile from our ship Deep dive: The NES combat demo
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * Main flight loop (Part 3 of 16) calls FRMIS

We fired a missile, so send it streaking away from us to unleash mayhem and destruction on our sworn enemies.
.FRMIS LDX #MSL ; Call FRS1 to launch a missile straight ahead of us JSR FRS1 BCC FR1 ; If FRS1 returns with the C flag clear, then there ; isn't room in the universe for our missile, so jump ; down to FR1 to display a "missile jammed" message LDX MSTG ; Fetch the slot number of the missile's target JSR GINF ; Get the address of the data block for the target ship ; and store it in INF LDA FRIN,X ; Fetch the ship type of the missile's target into A JSR ANGRY ; Call ANGRY to make the target ship hostile LDY #133 ; We have just launched a missile, so we need to remove JSR ABORT ; missile lock and hide the active indicator on the ; dashboard by setting it to the pattern number in Y ; (no missile indicator = pattern 133) DEC NOMSL ; Reduce the number of missiles we have by 1 LDA demoInProgress ; If the demo is not in progress, jump to frmi1 to skip BEQ frmi1 ; the following ; If we get here then the demo is in progress and we ; just fired a missile, so we get a 60-second penalty ; added to the time taken to complete the demo LDA #147 ; Print recursive token 146 ("60 SECOND PENALTY") in LDY #10 ; the middle of the screen and leave it there for 10 JSR PrintMessage ; ticks of the DLY counter LDA #25 ; Set nmiTimer = 25 to add half a second on top of the STA nmiTimer ; penalty below (as 25 frames is half a second in PAL ; systems) LDA nmiTimerLo ; Add 60 to (nmiTimerHi nmiTimerLo) so the time recorded CLC ; to complete the combat demo is 60 seconds longer than ADC #60 ; it would have been if we hadn't fired the missile STA nmiTimerLo BCC frmi1 INC nmiTimerHi .frmi1 LDY #9 ; Call the NOISE routine with Y = 9 to make the sound JMP NOISE ; of a missile launch, returning from the subroutine ; using a tail call