Prev: 47219 Up: Map Next: 47267
47225: Set Up Duel
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 47225 LD DE,41597 Point DE at the first object slot.
47228 LD A,(DE) Fetch the type of the object in the slot.
47229 AND A Return if the slot is in use.
47230 RET NZ
47231 PUSH DE Copy the address of the first object slot into IY (using the stack).
47232 POP IY
47234 LD HL,47267 Point HL at DuelTemplates.
47237 LD BC,32 Set the size of two object slots in BC.
47240 LDIR Copy the templates into the slots.
Choose how many times he moves and where he stands.
47242 LD A,(41496) Fetch a random number.
47245 AND %00000111 Keep a number from 0 to 7.
47247 ADD A,2 Add two to give two to nine.
47249 LD (IY+10),A Set the number of times the outlaw moves before he draws.
47252 LD A,(41497) Fetch another random number.
47255 AND %01111111 Keep a number from 0 to 127.
47257 ADD A,64 Add 64 to give the horizontal position of the outlaw.
47259 LD (IY+2),A Set the horizontal position of the outlaw.
47262 XOR A Write 0 to DrawMessageState so the draw message has not been shown.
47263 LD (41489),A
47266 RET Return.
Prev: 47219 Up: Map Next: 47267