@Test public void shouldEnableSecondColumnIfAFirstColumnKeyIsDown() { Keypad keypad = givenAKeypad(); keypad.keyDown(Key.LEFT); assertEquals(0x0, mmu.readByte(KEYPAD_ADDRESS) & 0x20); }
public void keyDown(Key key) { pressedKeys[key.ordinal()] = true; byte keyDownValue = getKeyDownValue(key); byte newKeypadValue = (byte) (mmu.readByte(KEYPAD_ADDRESS) & 0xFF & keyDownValue); mmu.writeByte(KEYPAD_ADDRESS, newKeypadValue); updateColumn(); }
Keypad { public void keyDown(Key key) { pressedKeys[key.ordinal()] = true; byte keyDownValue = getKeyDownValue(key); byte newKeypadValue = (byte) (mmu.readByte(KEYPAD_ADDRESS) & 0xFF & keyDownValue); mmu.writeByte(KEYPAD_ADDRESS, newKeypadValue); updateColumn(); } }
Keypad { public void keyDown(Key key) { pressedKeys[key.ordinal()] = true; byte keyDownValue = getKeyDownValue(key); byte newKeypadValue = (byte) (mmu.readByte(KEYPAD_ADDRESS) & 0xFF & keyDownValue); mmu.writeByte(KEYPAD_ADDRESS, newKeypadValue); updateColumn(); } Keypad(MMU mmu); }
Keypad { public void keyDown(Key key) { pressedKeys[key.ordinal()] = true; byte keyDownValue = getKeyDownValue(key); byte newKeypadValue = (byte) (mmu.readByte(KEYPAD_ADDRESS) & 0xFF & keyDownValue); mmu.writeByte(KEYPAD_ADDRESS, newKeypadValue); updateColumn(); } Keypad(MMU mmu); void keyUp(Key key); void keyDown(Key key); }
Keypad { public void keyDown(Key key) { pressedKeys[key.ordinal()] = true; byte keyDownValue = getKeyDownValue(key); byte newKeypadValue = (byte) (mmu.readByte(KEYPAD_ADDRESS) & 0xFF & keyDownValue); mmu.writeByte(KEYPAD_ADDRESS, newKeypadValue); updateColumn(); } Keypad(MMU mmu); void keyUp(Key key); void keyDown(Key key);  }