Esempio n. 1
0
 public int read(int address) {
   if (address >= 0x0000 && address < 0x8000) {
     return rom.read(address);
   } else if (address >= ADDRESS_ERAM_START && address < ADDRESS_ERAM_4BIT_END && ramEnable) {
     return eram.read(address);
   }
   return 0;
 }
Esempio n. 2
0
  public void write(int address, int data) {

    if (address >= 0x0000 && address < 0x2000) {
      /* Writing to this address is supposed to enable/disable RAM. However, Pan Docs
       * fails to explain which specific values enable and disable RAM. Therefore, RAM
       * is treated as always ON.
       */
      // TODO Find information on this.
    } else if (address >= 0x2000 && address < 0x4000) {
      if ((data & 0x10) == 0) {
        setRomBank(data & 0x0F);
      }
    } else if (address >= ADDRESS_ERAM_START && address < ADDRESS_ERAM_4BIT_END && ramEnable) {
      eram.write(address, data);
    }
  }
Esempio n. 3
0
 /** {@inheritDoc} */
 public void saveState(FileOutputStream fos) throws IOException {
   rom.saveState(fos);
   eram.saveState(fos);
   FileIOStreamHelper.writeData(fos, (long) romBank, 4);
   FileIOStreamHelper.writeData(fos, (long) romBanks, 4);
 }
Esempio n. 4
0
 /** {@inheritDoc} */
 public void readState(FileInputStream fis) throws IOException {
   rom.readState(fis);
   eram.readState(fis);
   romBank = (int) FileIOStreamHelper.readData(fis, 4);
   romBanks = (int) FileIOStreamHelper.readData(fis, 4);
 }