Routines |
Prev: 31580 | Up: Map | Next: 31642 |
Used by the command list at 64764. 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.
|
||||||||
31594 | XOR A | Remove the address of this primary command routine from bytes 8 and 9 of the jailer's buffer, triggering a move to the next command in the command list after we are finished here | ||||||
31595 | LD L,9 | |||||||
31597 | LD (HL),A | |||||||
31598 | LD HL,32747 | The police flags are stored at 32747 | ||||||
31601 | BIT 7,(HL) | Is Sam in jail? | ||||||
31603 | RET Z | Return if not | ||||||
31604 | LD (HL),A | Clear the police flags | ||||||
31605 | LD H,A | H=0 | ||||||
31606 | LD DE,(32670) | Collect the number of bucks from 32670 | ||||||
31610 | CALL 61823 | Get a random number in A | ||||||
31613 | AND 7 | Now HL holds a randomly chosen multiple of 10 between 20 and 90 | ||||||
31615 | ADD A,2 | |||||||
31617 | LD C,A | |||||||
31618 | ADD A,A | |||||||
31619 | ADD A,A | |||||||
31620 | ADD A,C | |||||||
31621 | ADD A,A | |||||||
31622 | LD L,A | |||||||
31623 | SBC HL,DE | Subtract Sam's cash supply from this number | ||||||
31625 | JR NC,31610 | Jump back to generate another bail amount if Sam's cash supply is too small (which could lead to an infinite loop) | ||||||
31627 | LD A,C | A=ASCII code for the tens digit of the bail amount | ||||||
31628 | ADD A,48 | |||||||
31630 | LD (32720),A | Store this at 32720 | ||||||
31633 | LD A,C | Subtract the bail amount from Sam's cash supply | ||||||
31634 | CALL 28295 | |||||||
31637 | LD A,52 | Message 52: ' THE BAIL WAS ${tens digit}0' | ||||||
31639 | JP 28357 | Queue this message |
Prev: 31580 | Up: Map | Next: 31642 |