public void handler() {
            /*
	                     Encryption Table
	                     ----------------
	+---+---+---+------+------+------+------+------+------+------+------+
	|A2 |A1 |A0 |D7    |D6    |D5    |D4    |D3    |D2    |D1    |D0    |
	+---+---+---+------+------+------+------+------+------+------+------+
	| 0 | 0 | 0 |D7    |D6    |D5    |D4    |D3    |D2    |D1    |D0^^D6|
	| 0 | 0 | 1 |D7    |D6    |D5    |D4    |D3    |D2    |D1^^D5|D0    |
	| 0 | 1 | 0 |D7    |D6    |D5    |D4    |D3    |D2^^D4|D1^^D6|D0    |
	| 0 | 1 | 1 |D7    |D6    |D5    |D4^^D2|D3    |D2    |D1    |D0^^D5|
	| 1 | 0 | 0 |D7    |D6^^D4|D5^^D1|D4    |D3    |D2    |D1    |D0    |
	| 1 | 0 | 1 |D7    |D6^^D0|D5^^D2|D4    |D3    |D2    |D1    |D0    |
	| 1 | 1 | 0 |D7    |D6    |D5    |D4    |D3    |D2^^D0|D1    |D0    |
	| 1 | 1 | 1 |D7    |D6    |D5    |D4^^D1|D3    |D2    |D1    |D0    |
	+---+---+---+------+------+------+------+------+------+------+------+
	
	For example if A2=1, A1=1 and A0=0 then D2 to the CPU would be an XOR of
	D2 and D0 from the ROM's. Note that D7 and D3 are not encrypted.
	
	Encryption PAL 16L8 on cardridge
	         +--- ---+
	    OE --|   U   |-- VCC
	 ROMD0 --|       |-- D0
	 ROMD1 --|       |-- D1
	 ROMD2 --|VER 5.2|-- D2
	    A0 --|       |-- NOT USED
	    A1 --|       |-- A2
	 ROMD4 --|       |-- D4
	 ROMD5 --|       |-- D5
	 ROMD6 --|       |-- D6
	   GND --|       |-- M1 (NOT USED)
	         +-------+
	Pin layout is such that links can replace the PAL if encryption is not used.
	
             */
            int A;
            int data_xor = 0;
            UBytePtr rom = memory_region(REGION_CPU1);

            for (A = 0; A < 0x2800; A++) {
                switch (A & 0x07) {
                    case 0:
                        data_xor = (rom.read(A) & 0x40) >> 6;
                        break;
                    case 1:
                        data_xor = (rom.read(A) & 0x20) >> 4;
                        break;
                    case 2:
                        data_xor = ((rom.read(A) & 0x10) >> 2) | ((rom.read(A) & 0x40) >> 5);
                        break;
                    case 3:
                        data_xor = ((rom.read(A) & 0x04) << 2) | ((rom.read(A) & 0x20) >> 5);
                        break;
                    case 4:
                        data_xor = ((rom.read(A) & 0x10) << 2) | ((rom.read(A) & 0x02) << 4);
                        break;
                    case 5:
                        data_xor = ((rom.read(A) & 0x01) << 6) | ((rom.read(A) & 0x04) << 3);
                        break;
                    case 6:
                        data_xor = (rom.read(A) & 0x01) << 2;
                        break;
                    case 7:
                        data_xor = (rom.read(A) & 0x02) << 3;
                        break;
                }
                rom.write(A, rom.read(A) ^ data_xor);
            }
        }