.ANGRY CMP #SST \ If this is the space station, jump to AN2 to make the BEQ AN2 \ space station hostile BCS HI1 \ If A >= #SST then this is a missile, asteroid, cargo \ canister, Thargon or escape pod, and they can't get \ hostile, so return from the subroutine (as HI1 \ contains an RTS) CMP #CYL \ If this is not a Cobra Mk III trader, skip the BNE P%+5 \ following instruction JSR AN2 \ Call AN2 to make the space station hostile LDY #32 \ Fetch the ship's byte #32 (AI flag) LDA (INF),Y BEQ HI1 \ If the AI flag is zero then this ship has no AI and \ it can't get hostile, so return from the subroutine \ (as HI1 contains an RTS) ORA #%10000000 \ Otherwise set bit 7 (AI enabled) to ensure AI is STA (INF),Y \ definitely enabled LDY #28 \ Set the ship's byte #28 (acceleration) to 2, so it LDA #2 \ speeds up STA (INF),Y ASL A \ Set the ship's byte #30 (pitch counter) to 4, so it LDY #30 \ starts diving STA (INF),Y RTS \ Return from the subroutine .AN2 ASL K%+NI%+32 \ Fetch the AI counter (byte #32) of the second ship SEC \ in the ship data workspace at K%, which is reserved ROR K%+NI%+32 \ for the sun or the space station (in this case it's \ the latter), and set bit 7 to make it hostile CLC \ Clear the C flag, which isn't used by calls to this \ routine, but it does set up the entry point FR1-2 \ so that it clears the C flag and does an RTS RTS \ Return from the subroutineName: ANGRY [Show more] Type: Subroutine Category: Tactics Summary: Make a ship hostileContext: 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: * FRMIS calls ANGRY * Main flight loop (Part 11 of 16) calls ANGRY
All this routine does is set the ship's hostile flag, start it turning and give it a kick of acceleration - later calls to TACTICS will make the ship start to attack us.
Arguments: A The type of ship we're going to irritate INF The address of the data block for the ship we're going to infuriate
[X]
Label AN2 is local to this routine
[X]
Configuration variable CYL = 7
Ship type for a Cobra Mk III (trader)
[X]
Workspace K% (category: Workspaces)
Ship data blocks and ship line heaps
[X]
Configuration variable NI% = 36
The number of bytes in each ship's data block (as stored in INWK and K%)
[X]
Configuration variable SST = 8
Ship type for the space station