# ROM Recognization

**How does the Mattel Aquarius recognizes a cartridge?**

The Aquarius uses the bytes at locations $E005, $E007, $E009, $E00B, $E00D and $E00F to check for the presence of a cartridge. These bytes are constants and are always the same. The numbers are compared back to front to a table in the Aquarius 8K ROM. This table contains: 43,55,36,36,51,44. The constant numbers (112,168,100,108,176,156) are divided by 4 and subtracted from the table numbers. It results in 15,13,11,9,7,5; the place numbers minus 1. If this calculation is correct then the Aquarius assumes that there is a valid cartridge present.

Next, it will calculate the scramble code that has been used to encrypt the ROM. The 4th byte to the penultimate byte (locations $E003 - $E00E) are added together and added to the sum of the relative positions 3 to 15 (= 78). The result is divided by 256 and the remainder is XOR with the last number at location $E00F; 112. The result is the scramble code.

Finally the Aquarius will send the scramble code to I/O port $FF (software lock at PLA1) and jumps to ROM address $E010 for execution.