Routines |
Prev: FE7E | Up: Map | Next: FECD |
This is the Fuller joystick input routine. Reading port $7F yields a byte of format F---RLDU, where the bits are active low
This is unused by the game!
|
||||||||
inputroutine_fuller | FEA3 | LD BC,$007F | Load BC with port number $7F | |||||
FEA6 | IN A,(C) | Read that port. We'll receive FxxxRLDU | ||||||
FEA8 | LD BC,$0000 | Clear our variables | ||||||
Commentary: This is odd. It's testing an unspecified bit to see whether to complement the read value. I don't see a reference for that behaviour anywhere.
|
||||||||
FEAB | BIT 4,A | Test bit 4 | ||||||
FEAD | JR Z,inputroutine_fuller_0 | Jump forward if clear | ||||||
FEAF | CPL | Complement the value | ||||||
Up
|
||||||||
inputroutine_fuller_0 | FEB0 | RRA | Rotate 'U' out: UFxxxRLD | |||||
FEB1 | JR NC,inputroutine_fuller_1 | If carry was set then up was pressed, otherwise skip | ||||||
FEB3 | LD C,$01 | up_down = input_UP | ||||||
Down
|
||||||||
inputroutine_fuller_1 | FEB5 | RRA | Rotate 'D' out: DUFxxxRL | |||||
FEB6 | JR NC,inputroutine_fuller_2 | If carry was set then down was pressed, otherwise skip | ||||||
FEB8 | LD C,$02 | up_down = input_DOWN | ||||||
Left
|
||||||||
inputroutine_fuller_2 | FEBA | RRA | Rotate 'L' out: LDUFxxxR | |||||
FEBB | JR NC,inputroutine_fuller_3 | If carry was set then down was pressed, otherwise skip | ||||||
FEBD | LD B,$03 | left_right = input_LEFT | ||||||
Right
|
||||||||
inputroutine_fuller_3 | FEBF | RRA | Rotate 'R' out: RLDUFxxx | |||||
FEC0 | JR NC,inputroutine_fuller_4 | If carry was set then right was pressed, otherwise skip | ||||||
FEC2 | LD B,$06 | left_right = input_RIGHT | ||||||
Fire
|
||||||||
inputroutine_fuller_4 | FEC4 | AND $08 | Test fire bit (and set A to zero if not set) | |||||
FEC6 | JR Z,inputroutine_fuller_5 | If bit was set then fire was pressed, otherwise skip | ||||||
FEC8 | LD A,$09 | fire = input_FIRE | ||||||
inputroutine_fuller_5 | FECA | ADD A,B | Combine the fire, up_down and left_right values | |||||
FECB | ADD A,C | |||||||
FECC | RET | Return |
Prev: FE7E | Up: Map | Next: FECD |