![]() |
Routines |
| Prev: B873 | Up: Map | Next: B8A3 |
|
Sets up the duel in the first two object slots. The first is the outlaw, in a random place in the middle of the screen, who will move about a random number of times before he draws, and the second is his gun.
|
||||
|
Copy the outlaw and his gun into the first two slots.
|
||||
| SetUpDuel | B879 | LD DE,$A27D | Point DE at the first object slot. | |
| B87C | LD A,(DE) | Fetch the type of the object in the slot. | ||
| B87D | AND A | Return if the slot is in use. | ||
| B87E | RET NZ | |||
| B87F | PUSH DE | Copy the address of the first object slot into IY (using the stack). | ||
| B880 | POP IY | |||
| B882 | LD HL,$B8A3 | Point HL at DuelTemplates. | ||
| B885 | LD BC,$0020 | Set the size of two object slots in BC. | ||
| B888 | LDIR | Copy the templates into the slots. | ||
|
Choose how many times he moves and where he stands.
|
||||
| B88A | LD A,($A218) | Fetch a random number. | ||
| B88D | AND %00000111 | Keep a number from 00 to 07. | ||
| B88F | ADD A,$02 | Add two to give two to nine. | ||
| B891 | LD (IY+$0A),A | Set the number of times the outlaw moves before he draws. | ||
| B894 | LD A,($A219) | Fetch another random number. | ||
| B897 | AND %01111111 | Keep a number from 00 to 7F. | ||
| B899 | ADD A,$40 | Add 40 to give the horizontal position of the outlaw. | ||
| B89B | LD (IY+$02),A | Set the horizontal position of the outlaw. | ||
| B89E | XOR A | Write 00 to DrawMessageState so the draw message has not been shown. | ||
| B89F | LD ($A211),A | |||
| B8A2 | RET | Return. | ||
| Prev: B873 | Up: Map | Next: B8A3 |