Buggy code:
} } private static class Inc8InstructionFactory extends InstructionFactory { @ Override protected boolean canParse ( byte nextByte ) { } @ Override public int getMinimumCycles ( ByteScanner scanner ) { } @ Override protected Instruction uncheckedDecodeInstruction ( ByteScanner scanner ) { return new ArithmeticInstructions . Inc8Instruction ( DecodingUtil . incDec8Arg ( scanner . readByte ( ) ) ) ; } } private static class Dec8InstructionFactory extends InstructionFactory { @ Override protected boolean canParse ( byte nextByte ) { } @ Override public int getMinimumCycles ( ByteScanner scanner ) { } @ Override protected Instruction uncheckedDecodeInstruction ( ByteScanner scanner ) { return new ArithmeticInstructions . Dec8Instruction ( DecodingUtil . incDec8Arg ( scanner . readByte ( ) ) ) ; } } private static class Inc16InstructionFactory extends InstructionFactory { @ Override protected boolean canParse ( byte nextByte ) { } @ Override public int getMinimumCycles ( ByteScanner scanner ) { } @ Override protected Instruction uncheckedDecodeInstruction ( ByteScanner scanner ) { return new ArithmeticInstructions . Inc16Instruction ( DecodingUtil . incDec16Arg ( scanner . readByte ( ) ) ) ; } } private static class Dec16InstructionFactory extends InstructionFactory { @ Override protected boolean canParse ( byte nextByte ) { } @ Override public int getMinimumCycles ( ByteScanner scanner ) { } @ Override protected Instruction uncheckedDecodeInstruction ( ByteScanner scanner ) { return new ArithmeticInstructions . Dec16Instruction ( DecodingUtil . incDec16Arg ( scanner . readByte ( ) ) ) ; } } private static class Add16InstructionFactory extends InstructionFactory { @ Override protected boolean canParse ( byte nextByte ) { } @ Override public int getMinimumCycles ( ByteScanner scanner ) { } @ Override protected Instruction uncheckedDecodeInstruction ( ByteScanner scanner ) { byte command = scanner . readByte ( ) ; if ( ( command & 255 ) == 232 ) return new ArithmeticInstructions . Add16Instruction ( Register16 . SP , new ShortConst ( scanner . readByte ( ) ) ) ; return new ArithmeticInstructions . Add16Instruction ( Register16 . HL , DecodingUtil . add16Arg ( command ) ) ; } } private static class ArithInstructionFactory extends InstructionFactory { @ Override protected boolean canParse ( byte nextByte ) { } @ Override public int getMinimumCycles ( ByteScanner scanner ) { } private static Instruction instrFromIndexArgs ( int index , ValueContainer < Byte > src ) { } @ Override protected Instruction uncheckedDecodeInstruction ( ByteScanner scanner ) { byte command = scanner . readByte ( ) ; int index ; ValueContainer < Byte > src ; if ( ( command & 255 ) < 192 ) { index = ( ( command & 255 ) - 128 ) // 8 ; src = DecodingUtil . byteContainerFromByte ( command ) ; } else { index = ( ( command & 255 ) - 192 ) // 8 ; src = new ByteConst ( scanner . readByte ( ) ) ; } return RootInstructionDecoder . ArithInstructionFactory . instrFromIndexArgs ( index , src ) ; } } private static class Ld8RegInstructionFactory extends InstructionFactory { @ Override protected boolean canParse ( byte nextByte ) { } @ Override public int getMinimumCycles ( ByteScanner scanner ) { } @ Override protected Instruction uncheckedDecodeInstruction ( ByteScanner scanner ) { byte command = scanner . readByte ( ) ; SettableValueContainer < Byte > dest = DecodingUtil . byteContainerFromIndex ( ( ( ( command & 255 ) - 64 ) // 8 ) ) ; ValueContainer < Byte > src = DecodingUtil . byteContainerFromByte ( command ) ; return new MemoryInstructions . Ld8Instruction ( dest , src ) ; } } private static class LdhInstructionFactory extends InstructionFactory { @ Override protected boolean canParse ( byte nextByte ) { } @ Override public int getMinimumCycles ( ByteScanner scanner ) { } @ Override protected Instruction uncheckedDecodeInstruction ( ByteScanner scanner ) { byte command = scanner . readByte ( ) ; <START_BUG> short addr = ( ( short ) ( 65280 + ( scanner . readByte ( ) ) ) ) ; <END_BUG> SettableValueContainer < Byte > container = new BytePointer ( addr ) ; return ( command & 255 ) == 224 ? new MemoryInstructions . Ld8Instruction ( container , Register8 . A ) : new MemoryInstructions . Ld8Instruction ( Register8 . A , container ) ; } } private static class LdPointerAInstructionFactory extends InstructionFactory { @ Override protected boolean canParse ( byte nextByte ) { } @ Override public int getMinimumCycles ( ByteScanner scanner ) { } private static boolean aIsDest ( byte command ) { } private static SettableValueContainer < Byte > containerFromByte ( ByteScanner scanner , byte command ) { } @ Override protected Instruction uncheckedDecodeInstruction ( ByteScanner scanner ) { byte command = scanner . readByte ( ) ; SettableValueContainer < Byte > container = RootInstructionDecoder . LdPointerAInstructionFactory . containerFromByte ( scanner , command ) ; return RootInstructionDecoder . LdPointerAInstructionFactory . aIsDest ( command ) ? new MemoryInstructions . Ld8Instruction ( Register8 . A , container ) : new MemoryInstructions . Ld8Instruction ( container , Register8 . A ) ; } } private static class LdSpConstInstructionFactory extends InstructionFactory { @ Override protected boolean canParse ( byte nextByte ) { } @ Override public int getMinimumCycles ( ByteScanner scanner ) { } @ Override protected Instruction uncheckedDecodeInstruction ( ByteScanner scanner ) { scanner . readByte ( ) ; short addr = scanner . readLittleEndianShort ( ) ; SettableValueContainer < Short > container = new ShortPointer ( addr ) ; return new MemoryInstructions . Ld16Instruction ( container , Register16 . SP ) ; } } private static class Ld8ConstInstructionFactory extends InstructionFactory { @ Override protected boolean canParse ( byte nextByte ) { } @ Override public int getMinimumCycles ( ByteScanner scanner ) { } @ Override protected Instruction uncheckedDecodeInstruction ( ByteScanner scanner ) { byte command = scanner . readByte ( ) ; ValueContainer < Byte > container = new ByteConst ( scanner . readByte ( ) ) ; return new MemoryInstructions . Ld8Instruction ( DecodingUtil . ld8ConstDest ( command ) , container ) ; } }

Fix:
short addr = ( ( short ) ( 65280 + ( ( scanner . readByte ( ) ) & 255 ) ) ) ;