![]() |
Routines |
Prev: 7B5C | Up: Map |
Used by the command list at FCFC. Does nothing if Sam is not in jail; otherwise sets Sam's bail to some amount that he can afford, and lets him out of jail.
|
||||||||||
7B6A | XOR A | Remove the address of this primary command routine from bytes 0x08 and 0x09 of the jailer's buffer, triggering a move to the next command in the command list after we are finished here | ||||||||
7B6B | LD L,$09 | |||||||||
7B6D | LD (HL),A | |||||||||
7B6E | LD HL,$7FEB | The police flags are stored at 7FEB | ||||||||
7B71 | BIT 7,(HL) | Is Sam in jail? | ||||||||
7B73 | RET Z | Return if not | ||||||||
7B74 | LD (HL),A | Clear the police flags | ||||||||
7B75 | LD H,A | H=0 | ||||||||
7B76 | LD DE,($7F9E) | Collect the number of bucks from 7F9E | ||||||||
7B7A | CALL $F17F | Get a random number in A | ||||||||
7B7D | AND $07 | Now HL holds a randomly chosen multiple of 10 between 20 and 90 | ||||||||
7B7F | ADD A,$02 | |||||||||
7B81 | LD C,A | |||||||||
7B82 | ADD A,A | |||||||||
7B83 | ADD A,A | |||||||||
7B84 | ADD A,C | |||||||||
7B85 | ADD A,A | |||||||||
7B86 | LD L,A | |||||||||
7B87 | SBC HL,DE | Subtract Sam's cash supply from this number | ||||||||
7B89 | JR NC,$7B7A | Jump back to generate another bail amount if Sam's cash supply is too small (which could lead to an infinite loop) | ||||||||
7B8B | LD A,C | A=ASCII code for the tens digit of the bail amount | ||||||||
7B8C | ADD A,$30 | |||||||||
7B8E | LD ($7FD0),A | Store this at 7FD0 | ||||||||
7B91 | LD A,C | Subtract the bail amount from Sam's cash supply | ||||||||
7B92 | CALL $6E87 | |||||||||
7B95 | LD A,$34 | Message 0x34: ' THE BAIL WAS ${tens digit}0' | ||||||||
7B97 | JP $6EC5 | Queue this message |
Prev: 7B5C | Up: Map |