Routines |
Prev: 9C2E | Up: Map | Next: 9C6E |
|
||||
Annotated by Stephen Jones; Spectrum Discovery Club.
|
||||
Keyboard_Test | 9C53 | LD C,A | Key to test in C. | |
9C54 | AND $07 | Mask bits d0-d2 for row. | ||
9C56 | INC A | In range 1-8. | ||
9C57 | LD B,A | Place in B. | ||
9C58 | SRL C | Divide C by 08 to find position within row. | ||
9C5A | SRL C | |||
9C5C | SRL C | |||
9C5E | LD A,$05 | Only 05 keys per row. | ||
9C60 | SUB C | Subtract position. | ||
9C61 | LD C,A | Put into C. | ||
9C62 | LD A,$FE | High byte of port to read. | ||
Keyboard_Find_Row | 9C64 | RRCA | Rotate into position. | |
9C65 | DJNZ Keyboard_Find_Row | Repeat until we've found the relevant row. | ||
9C67 | IN A,($FE) | Read port (A=high, 254=low). | ||
Keyboard_Rotate_Loop | 9C69 | RRA | Rotate bit out of result. | |
9C6A | DEC C | Loop counter. | ||
9C6B | JR NZ,Keyboard_Rotate_Loop | Repeat until bit for position in carry flag. | ||
9C6D | RET | Return. |
Prev: 9C2E | Up: Map | Next: 9C6E |