Dynamite Dan | Routines |
Prev: F270 | Up: Map | Next: F2A5 |
|
||||||||
F271 | LD HL,$F26E | Point HL at the key for left. | ||||||
F274 | LD E,$00 | Initialize E to no keys pressed. | ||||||
F276 | LD D,$03 | Number of keys to check. | ||||||
F278 | LD A,(HL) | Get the key to press. | ||||||
F279 | CALL $F32A | See if it was pressed. | ||||||
F27C | CCF | Invert the carry flag, then rotate E, putting the flag in as bit 0. This allows the various key presses to be built up as the keys are checked. | ||||||
F27D | RL E | |||||||
F27F | INC HL | Move to the next key. | ||||||
F280 | DEC D | Loop until all keys checked. | ||||||
F281 | JR NZ,$F278 | |||||||
All keys have been scanned, now check the values.
|
||||||||
F283 | LD A,E | Get the matrix of keys pressed. | ||||||
F284 | AND $06 | Only consider bits 1 - 2. | ||||||
F286 | CP $06 | Is the value 6? | ||||||
F288 | JR NZ,$F28E | Jump forward if not. | ||||||
F28A | LD A,E | Clear all bits except 1. | ||||||
F28B | AND $01 | |||||||
F28D | LD E,A | |||||||
Now decide what action to take.
|
||||||||
F28E | LD C,$05 | Default to value 5 (no action). | ||||||
F290 | LD A,E | Get the matrix of keys. | ||||||
F291 | AND A | Return if it is zero (nothing pressed). | ||||||
F292 | RET Z | |||||||
F293 | DEC C | Select option 4 (jump). | ||||||
F294 | CP $01 | Is only the jump bit set? | ||||||
F296 | RET Z | Return if it is. | ||||||
F297 | DEC C | Select option 3 (left). | ||||||
F298 | CP $04 | Is left pressed but not jump? | ||||||
F29A | RET Z | Return if it is. | ||||||
F29B | DEC C | Select option 2 (jump + left). | ||||||
F29C | CP $05 | Are left and jump pressed? | ||||||
F29E | RET Z | Return if they are. | ||||||
F29F | DEC C | Selecti option 1 (right). | ||||||
F2A0 | CP $02 | Is right pressed but not jump? | ||||||
F2A2 | RET Z | Return if is. | ||||||
F2A3 | DEC C | Only option left is right and jump pressed, select option 0 (jump right) and return. | ||||||
F2A4 | RET |
Prev: F270 | Up: Map | Next: F2A5 |