Routines |
Prev: FE47 | Up: Map | Next: FEA3 |
This is the Kempston joystick input routine. Reading port $1F yields a byte of format 000FUDLR, where the bits are active high.
|
||||||||
inputroutine_kempston | FE7E | LD BC,$001F | Load BC with port number $1F | |||||
FE81 | IN A,(C) | Read that port. We'll receive 000FUDLR | ||||||
FE83 | LD BC,$0000 | Clear our {...} variables | ||||||
Right
|
||||||||
FE86 | RRA | Rotate 'R' out: R000FUDL | ||||||
FE87 | JR NC,inputroutine_kempston_0 | If carry was set then right was pressed, otherwise skip | ||||||
FE89 | LD B,$06 | left_right = input_RIGHT | ||||||
Left
|
||||||||
inputroutine_kempston_0 | FE8B | RRA | Rotate 'L' out: LR000FUD | |||||
FE8C | JR NC,inputroutine_kempston_1 | If carry was set then left was pressed, otherwise skip | ||||||
FE8E | LD B,$03 | left_right = input_LEFT | ||||||
Down
|
||||||||
inputroutine_kempston_1 | FE90 | RRA | Rotate 'D' out: DLR000FU | |||||
FE91 | JR NC,inputroutine_kempston_2 | If carry was set then down was pressed, otherwise skip | ||||||
FE93 | LD C,$02 | up_down = input_DOWN | ||||||
Up
|
||||||||
inputroutine_kempston_2 | FE95 | RRA | Rotate 'U' out: UDLR000F | |||||
FE96 | JR NC,inputroutine_kempston_3 | If carry was set then up was pressed, otherwise skip | ||||||
FE98 | LD C,$01 | up_down = input_UP | ||||||
Fire
|
||||||||
inputroutine_kempston_3 | FE9A | RRA | Rotate 'F' out: FUDLR000 | |||||
FE9B | LD A,$09 | fire = input_FIRE | ||||||
FE9D | JR C,inputroutine_kempston_4 | If fire bit was set then jump forward | ||||||
FE9F | XOR A | fire = 0 | ||||||
inputroutine_kempston_4 | FEA0 | ADD A,B | Combine the fire, up_down and left_right values | |||||
FEA1 | ADD A,C | |||||||
FEA2 | RET | Return |
Prev: FE47 | Up: Map | Next: FEA3 |