public final short addressRead(int addr) {

		/*  if ((addr >= 0xDFD8) && (addr <= 0xDFF0) && (running)) {
   System.out.println(LowLevelData.hexWord(addr) + " read at " + LowLevelData.hexWord(pc) + " bank " + cartridge.currentBank);
  }*/

		/*  if ((addr < 0) || (addr > 65535)) {
    System.out.println("Tried to read address " + addr + ".  pc = " + LowLevelData.hexWord(pc));
    return 0xFF;
  }*/

		addr = addr & 0xFFFF;

		switch ((addr & 0xF000)) {
		case 0x0000 :
		case 0x1000 :
		case 0x2000 :
		case 0x3000 :
		case 0x4000 :
		case 0x5000 :
		case 0x6000 :
		case 0x7000 :
			return cartridge.addressRead(addr);

		case 0x8000 :
		case 0x9000 :
			return graphicsChip.addressRead(addr - 0x8000);

		case 0xA000 :
		case 0xB000 :
			return cartridge.addressRead(addr);

		case 0xC000 :
			return (mainRam[addr - 0xC000]);

		case 0xD000 :
			return (mainRam[addr - 0xD000 + (gbcRamBank * 0x1000)]);

		case 0xE000 :
			return mainRam[addr - 0xE000];
			/* (short) (mainRam[addr - 0xE000] & 0x00FF); */

		case 0xF000 :
			if (addr < 0xFE00) {
				return mainRam[addr - 0xE000];
			} else if (addr < 0xFF00) {
				return (short) (oam[addr - 0xFE00] & 0x00FF);
			} else {
				return ioHandler.ioRead(addr - 0xFF00);
			}

		default:
			System.out.println("Tried to read address " + addr + ".  pc = " + LowLevelData.hexWord(pc));
		return 0xFF;
		}

	}