 let joy_sel_button = false;
 let joy_sel_direction = false;
 
+// 1 - Pressed
+let joy_state_start = false;
+let joy_state_sel = false;
+let joy_state_a = false;
+let joy_state_b = false;
+let joy_state_up = false;
+let joy_state_down = false;
+let joy_state_left = false;
+let joy_state_right = false;
+
 def joy_reset() {
   joy_sel_button = false;
   joy_sel_direction = false;
+
+  joy_state_start = false;
+  joy_state_sel = false;
+  joy_state_a = false;
+  joy_state_b = false;
+  joy_state_up = false;
+  joy_state_down = false;
+  joy_state_left = false;
+  joy_state_right = false;
 }
 
 def joy_write(address: uint16, value: uint8) {

      bit(true, 6) |
      bit(not joy_sel_button, 5) |
      bit(not joy_sel_direction, 4) |
      bit(true, 3) |
      bit(true, 2) |
      bit(true, 1) |
      bit(true, 0)
    );
  } else {
    printf("warn: unhandled read from Joypad register: $%04X\n", address);


  // Sprite Attribute Table (OAM): $FE00 – $FE9F
  if (address >= 0xFE00) and (address <= 0xFE9F) {
    // FIXME: OAM cannot be accessed in modes 2 or 3
    // let mode = mmu_read8(0xFF41) & 3;
    // if mode == 3 or mode == 2 { return; }

    *(oam + (address & 0xFF)) = value;
    return;
  }

