![]() |
Routines |
| Prev: BCC0 | Up: Map | Next: BD52 |
|
Type 03: the crosshair, which the player moves about the screen in the duel to aim at the outlaw. It is moved by the controls, and stays between limits. When the fire control is pressed it fires the revolver.
|
||||
|
Reload the revolver if it needs it.
|
||||
| HandleCrosshair | BCCA | CALL ReloadRevolver | Call ReloadRevolver. | |
| BCCD | LD L,(IX+$02) | Fetch the horizontal position into L. | ||
| BCD0 | LD H,(IX+$04) | Fetch the vertical position into H. | ||
| BCD3 | LD E,(IX+$05) | Fetch the speed into E. | ||
|
Read the controls.
|
||||
| BCD6 | CALL ReadControls | Call ReadControls. | ||
|
Move left or right, but not past the edges.
|
||||
| BCD9 | LD A,B | Fetch the controls into A. | ||
| BCDA | AND %00000011 | Keep the two bits. | ||
| BCDC | JR Z,HandleCrosshair_Vertical | Jump to HandleCrosshair_Vertical if neither or both are pressed. | ||
| BCDE | CP $03 | Jump to HandleCrosshair_Vertical if both are pressed. | ||
| BCE0 | JR Z,HandleCrosshair_Vertical | |||
| BCE2 | CP $01 | Jump to MoveCrosshairLeft to move left if left is pressed. | ||
| BCE4 | JR Z,MoveCrosshairLeft | |||
| BCE6 | LD A,L | Fetch the horizontal position. | ||
| BCE7 | ADD A,E | Add the speed. | ||
| BCE8 | CP $C5 | Jump to HandleCrosshair_SetHorizontal if the crosshair is not past it. | ||
| BCEA | JR C,HandleCrosshair_SetHorizontal | |||
| BCEC | LD A,$C4 | Stop at the right limit. | ||
|
This entry point is used by the routine at MoveCrosshairLeft.
|
||||
| HandleCrosshair_SetHorizontal | BCEE | LD L,A | Set the horizontal position. | |
|
See whether the controls are the keyboard.
|
||||
| HandleCrosshair_Vertical | BCEF | LD A,($A21C) | Fetch Options. | |
| BCF2 | RRCA | Move the bits for the controls into the low bits. | ||
| BCF3 | AND %00000011 | Keep the two bits. | ||
| BCF5 | JP Z,HandleCrosshair_Keyboard | Jump to HandleCrosshair_Keyboard if the controls are the keyboard. | ||
|
Copy the joystick bits for up, down and fire into B.
|
||||
| BCF8 | LD A,B | Fetch the controls into A. | ||
| BCF9 | LD B,$00 | Clear B. | ||
| BCFB | BIT 2,A | Jump to HandleCrosshair_TestDown if up is not pressed. | ||
| BCFD | JR Z,HandleCrosshair_TestDown | |||
| BCFF | SET 1,B | Set the bit for up. | ||
| HandleCrosshair_TestDown | BD01 | BIT 4,A | Jump to HandleCrosshair_TestFire if down is not pressed. | |
| BD03 | JR Z,HandleCrosshair_TestFire | |||
| BD05 | SET 0,B | Set the bit for down. | ||
| HandleCrosshair_TestFire | BD07 | BIT 3,A | Jump to HandleCrosshair_MoveVertical if the fire control is not pressed. | |
| BD09 | JR Z,HandleCrosshair_MoveVertical | |||
| BD0B | SET 3,B | Set the bit for fire. | ||
|
Move up or down, but not past the edges.
|
||||
| HandleCrosshair_MoveVertical | BD0D | LD A,B | Fetch the controls. | |
| BD0E | AND %00000011 | Keep the up and down bits. | ||
| BD10 | JR Z,HandleCrosshair_SetPosition | Jump to HandleCrosshair_SetPosition if neither or both are pressed. | ||
| BD12 | CP $03 | Jump to HandleCrosshair_SetPosition if both are pressed. | ||
| BD14 | JR Z,HandleCrosshair_SetPosition | |||
| BD16 | CP $01 | Jump to MoveCrosshairDown to move down if down is pressed. | ||
| BD18 | JR Z,MoveCrosshairDown | |||
| BD1A | LD A,H | Fetch the vertical position. | ||
| BD1B | ADD A,E | Add the speed. | ||
| BD1C | CP $AD | Jump to HandleCrosshair_SetVertical if the crosshair is not past it. | ||
| BD1E | JR C,HandleCrosshair_SetVertical | |||
| BD20 | LD A,$AC | Stop at the upper limit. | ||
|
This entry point is used by the routine at MoveCrosshairDown.
|
||||
| HandleCrosshair_SetVertical | BD22 | LD H,A | Set the vertical position. | |
|
Store the new position.
|
||||
| HandleCrosshair_SetPosition | BD23 | LD (IX+$02),L | Set the horizontal position of the crosshair. | |
| BD26 | LD (IX+$04),H | Set the vertical position of the crosshair. | ||
|
Set the position for drawing.
|
||||
| BD29 | LD A,H | Fetch the vertical position and clear H. | ||
| BD2A | LD H,$00 | |||
| BD2C | LD ($A24E),HL | Set ScreenHorizontalPosition. | ||
| BD2F | LD L,A | Copy the vertical position into L. | ||
| BD30 | LD ($A250),HL | Set ScreenVerticalPosition. | ||
|
Fire the revolver if the fire control is pressed, then draw the crosshair.
|
||||
| BD33 | LD E,B | Pass the controls to the routine which fires the revolver. | ||
| BD34 | CALL FireRevolver | Call FireRevolver. | ||
| BD37 | JP DrawSpriteList | Jump to DrawSpriteList. | ||
|
The controls are the keyboard, which sets the bits for down and up the other way round to the joysticks.
|
||||
| HandleCrosshair_Keyboard | BD3A | LD A,B | Fetch the controls. | |
| BD3B | LD B,$00 | Clear B. | ||
| BD3D | BIT 2,A | Jump to HandleCrosshair_KeyboardTestUp if down is not pressed. | ||
| BD3F | JR Z,HandleCrosshair_KeyboardTestUp | |||
| BD41 | SET 0,B | Set the bit for down. | ||
| HandleCrosshair_KeyboardTestUp | BD43 | BIT 3,A | Jump to HandleCrosshair_KeyboardTestFire if up is not pressed. | |
| BD45 | JR Z,HandleCrosshair_KeyboardTestFire | |||
| BD47 | SET 1,B | Set the bit for up. | ||
| HandleCrosshair_KeyboardTestFire | BD49 | BIT 4,A | Jump to HandleCrosshair_KeyboardMove if the fire control is not pressed. | |
| BD4B | JR Z,HandleCrosshair_KeyboardMove | |||
| BD4D | SET 3,B | Set the bit for fire. | ||
|
Move the crosshair up or down.
|
||||
| HandleCrosshair_KeyboardMove | BD4F | JP HandleCrosshair_MoveVertical | Jump to HandleCrosshair_MoveVertical. | |
| Prev: BCC0 | Up: Map | Next: BD52 |