public short ioRead(int num) {
		if (num <= 0x4B) {
			//   System.out.println("Read of register " + JavaBoy.hexByte(num) + " at " + JavaBoy.hexWord(dmgcpu.pc));
		}

		switch (num) {
		// Read Handlers go here
		//   case 0x00 :
		// System.out.println("Reading Joypad register");
		//return registers[num];

		case 0x41 :         // LCDSTAT

			int output = 0;

			if (registers[0x44] == registers[0x45]) {
				output |= 4;
			}

			int cyclePos = dmgcpu.getInstrCount() % dmgcpu.INSTRS_PER_HBLANK;
			int sectionLength = dmgcpu.INSTRS_PER_HBLANK / 6;

			if (unsign(registers[0x44]) > 144) {
				output |= 1;
			} else {
				if (cyclePos <= sectionLength * 3) {
					// Mode 0
				} else if (cyclePos <= sectionLength * 4) {
					// Mode 2
					output |= 2;
				} else {
					output |= 3;
				}
			}


			//    System.out.println("Checking LCDSTAT");
			return (byte) (output | (registers[0x41] & 0xF8));

			//   case 0x44 :
			//    System.out.println("Checking LCDY at " + JavaBoy.hexWord(dmgcpu.pc));
			//    return registers[num];

		case 0x55 :
			return (byte) (registers[0x55]);

		case 0x69 :       // GBC BG Sprite palette

			if (dmgcpu.isGbcFeatures()) {
				int palNumber = (registers[0x68] & 0x38) >> 3;
				return dmgcpu.graphicsChip.gbcBackground[palNumber].getGbcColours(
						(unsign(registers[0x68]) & 0x06) >> 1,
						(unsign(registers[0x68]) & 0x01) == 1);
			} else {
				return registers[num];
			}


		case 0x6B :       // GBC OBJ Sprite palette

			if (dmgcpu.isGbcFeatures()) {
				int palNumber = (registers[0x6A] & 0x38) >> 3;
				return dmgcpu.graphicsChip.gbcSprite[palNumber].getGbcColours(
						(unsign(registers[0x6A]) & 0x06) >> 1,
						(unsign(registers[0x6A]) & 0x01) == 1);
			} else {
				return registers[num];
			}


		default:
			return registers[num];
		}
	}