Skip to content

Commit

Permalink
Added second input port and tilt
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexOberhofer committed Jul 8, 2019
1 parent 61fc44f commit 7ffb4f3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ uint8_t shift1;
uint8_t shift_offset;

uint8_t input_port = 0;
uint8_t input_port_multiplayer = 0;

uint32_t timer = 0;

Expand Down Expand Up @@ -110,7 +111,7 @@ int process_keypress(SDL_Event *e){
case 1: COLOR_FLAG = 0; break;
}
} break;
case SDL_SCANCODE_T: break; //TODO: Tilt
case SDL_SCANCODE_T: input_port_multiplayer |= 0x04; break; //TODO: Tilt
}

} else if (event.type == SDL_KEYUP){
Expand All @@ -123,7 +124,7 @@ int process_keypress(SDL_Event *e){
case SDL_SCANCODE_A: input_port &= ~0x20; break;
case SDL_SCANCODE_S: input_port &= ~0x10; break;
case SDL_SCANCODE_D: input_port &= ~0x40; break;
case SDL_SCANCODE_T: break; //TODO: Tilt
case SDL_SCANCODE_T: input_port_multiplayer &= 0x04; break; //TODO: Tilt
}
}

Expand Down Expand Up @@ -174,6 +175,8 @@ uint8_t machine_in(uint8_t port){
return 1;
case 1:
return input_port;
case 2:
return input_port_multiplayer;
case 3:{
uint16_t v = (shift1 << 8) | shift0;
return ((v >> (8 - shift_offset)) & 0xff);
Expand Down

0 comments on commit 7ffb4f3

Please sign in to comment.