Routines |
Prev: FDF3 | Up: Map | Next: FE47 |
This walks the keydefs table testing the ports against masks as setup by choose_keys.
|
||||||||
inputroutine_keyboard | FE00 | LD HL,$F06B | Point HL at keydefs table - a list of (port high byte, key mask) filled out when the user chose their keys | |||||
Check for left
|
||||||||
FE03 | LD C,$FE | Port $xxFE | ||||||
FE05 | LD B,(HL) | Fetch the port high byte | ||||||
FE06 | INC HL | Advance to key mask | ||||||
FE07 | IN A,(C) | Read that port | ||||||
FE09 | CPL | The keyboard is active low, so complement the value | ||||||
FE0A | AND (HL) | Mask off the wanted bit | ||||||
FE0B | INC HL | Advance to next definition | ||||||
FE0C | JR Z,inputroutine_keyboard_0 | Key NOT pressed - jump forward to test for right key | ||||||
FE0E | INC HL | Skip the right key definition | ||||||
FE0F | INC HL | |||||||
FE10 | LD E,$03 | result = input_LEFT | ||||||
FE12 | JR inputroutine_keyboard_2 | Jump to up/down checking | ||||||
Check for right
|
||||||||
inputroutine_keyboard_0 | FE14 | LD B,(HL) | Fetch the port high byte | |||||
FE15 | INC HL | Advance to key mask | ||||||
FE16 | IN A,(C) | Read that port | ||||||
FE18 | CPL | The keyboard is active low, so complement the value | ||||||
FE19 | AND (HL) | Mask off the wanted bit | ||||||
FE1A | INC HL | Advance to next definition | ||||||
FE1B | JR Z,inputroutine_keyboard_1 | Key NOT pressed - jump forward to test for up key | ||||||
FE1D | LD E,$06 | result = input_RIGHT | ||||||
FE1F | JR inputroutine_keyboard_2 | Jump to up/down checking | ||||||
inputroutine_keyboard_1 | FE21 | LD E,A | Otherwise result = 0 (A is zero here) | |||||
Check for up
|
||||||||
inputroutine_keyboard_2 | FE22 | LD B,(HL) | Fetch the port high byte | |||||
FE23 | INC HL | Advance to key mask | ||||||
FE24 | IN A,(C) | Read that port | ||||||
FE26 | CPL | The keyboard is active low, so complement the value | ||||||
FE27 | AND (HL) | Mask off the wanted bit | ||||||
FE28 | INC HL | Advance to next definition | ||||||
FE29 | JR Z,inputroutine_keyboard_3 | Key NOT pressed - jump forward to test for down key | ||||||
FE2B | INC HL | Skip down key definition | ||||||
FE2C | INC HL | |||||||
FE2D | INC E | result += input_UP | ||||||
FE2E | JR inputroutine_keyboard_4 | Jump to fire checking | ||||||
Check for down
|
||||||||
inputroutine_keyboard_3 | FE30 | LD B,(HL) | Fetch the port high byte | |||||
FE31 | INC HL | Advance to key mask | ||||||
FE32 | IN A,(C) | Read that port | ||||||
FE34 | CPL | The keyboard is active low, so complement the value | ||||||
FE35 | AND (HL) | Mask off the wanted bit | ||||||
FE36 | INC HL | Advance to next key definition | ||||||
FE37 | JR Z,inputroutine_keyboard_4 | Key NOT pressed - jump forward to test for fire key | ||||||
FE39 | INC E | result += input_DOWN | ||||||
FE3A | INC E | |||||||
Check for fire
|
||||||||
inputroutine_keyboard_4 | FE3B | LD B,(HL) | Fetch the port high byte | |||||
FE3C | INC HL | Advance to key mask | ||||||
FE3D | IN A,(C) | Read that port | ||||||
FE3F | CPL | The keyboard is active low, so complement the value | ||||||
FE40 | AND (HL) | Mask off the wanted bit | ||||||
FE41 | INC HL | Advance to next key definition | ||||||
FE42 | LD A,E | Result | ||||||
FE43 | RET Z | Return the result if fire NOT pressed | ||||||
FE44 | ADD A,$09 | result += input_FIRE | ||||||
FE46 | RET | Return |
Prev: FDF3 | Up: Map | Next: FE47 |