예제 #1
0
파일: MBC2.java 프로젝트: snigel/fajitaBoy
 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;
 }
예제 #2
0
파일: MBC2.java 프로젝트: snigel/fajitaBoy
  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);
    }
  }
예제 #3
0
파일: MBC2.java 프로젝트: snigel/fajitaBoy
 /** {@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);
 }
예제 #4
0
파일: MBC2.java 프로젝트: snigel/fajitaBoy
 /** {@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);
 }