![]() |
Routines |
| Prev: DD72 | Up: Map | Next: DDCF |
|
Used by the routine at STEER.
The facing that points most nearly at the knight: along V if he is at least as far away in V as in U, along U if further in U, the sign from the difference.
|
||||||||||||
| KNIGHT_DIRECTION | DD99 | LD HL,(KNIGHT_U) | His U less its U; DE its size | |||||||||
| DD9C | LD E,(IX+$01) | |||||||||||
| DD9F | LD D,(IX+$02) | |||||||||||
| DDA2 | AND A | |||||||||||
| DDA3 | SBC HL,DE | |||||||||||
| DDA5 | PUSH HL | |||||||||||
| DDA6 | BIT 7,H | |||||||||||
| DDA8 | CALL NZ,NEGATE_HL | |||||||||||
| DDAB | EX DE,HL | His V less its V; HL its size | ||||||||||
| DDAC | LD HL,(KNIGHT_V) | |||||||||||
| DDAF | LD C,(IX+$03) | |||||||||||
| DDB2 | LD B,(IX+$04) | |||||||||||
| DDB5 | AND A | |||||||||||
| DDB6 | SBC HL,BC | |||||||||||
| DDB8 | PUSH HL | |||||||||||
| DDB9 | BIT 7,H | |||||||||||
| DDBB | CALL NZ,NEGATE_HL | |||||||||||
| DDBE | AND A | Further in V (or as far)? A=0, HL the V difference | ||||||||||
| DDBF | SBC HL,DE | |||||||||||
| DDC1 | LD A,$00 | |||||||||||
| DDC3 | POP HL | |||||||||||
| DDC4 | POP DE | |||||||||||
| DDC5 | JR NC,KNIGHT_DIRECTION_0 | |||||||||||
| DDC7 | INC A | Further in U: A=1, HL the U difference | ||||||||||
| DDC8 | EX DE,HL | |||||||||||
| KNIGHT_DIRECTION_0 | DDC9 | BIT 7,H | Negative: 2 on | |||||||||
| DDCB | RET Z | |||||||||||
| DDCC | ADD A,$02 | |||||||||||
| DDCE | RET | |||||||||||
| Prev: DD72 | Up: Map | Next: DDCF |