如何使用Javascript匿名函数转换成Java可能与开关? [英] How to convert Javascript Anonymous Function to Java maybe with switch?

查看:256
本文介绍了如何使用Javascript匿名函数转换成Java可能与开关?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是下面链接到它的一些匿名的内部功能,似乎每个开关2数组索引的JavaScript code,他们似乎还有些价值太多,但我不知道他们正在返回到 memoryReadJumpCompile()函数或这两个数组索引的。

他们很有可能将reuturning实际数组索引和函数名编译似乎每次调用任何这些数组索引,他们将重新评估与它们相关的一些新的结果的功能仍然不知道在哪里如果实际指数的保持功能,我最好的猜测是实际的数组索引都像函数名,结果存储,它们是由另一块返回code其中前所未有否则该指数在code的地方调用,但让说的第2例子数组索引。

  this.memoryHighReader [0] = this.memoryReader [为0xFF00]

所以,他们都成为了同样的事情,我发现,它就会在指令执行器进行处理,像这样

 案例242:
    a.registerA = a.memoryHighReader [a.registerC](一,a.registerC);
    打破;

  GameBoyCore.prototype.memoryReadJumpCompile =功能(){
    // ...
    否则,如果(索引> =为0xFF00){
      开关(指数){
        案例为0xFF00:
          //手柄:
          this.memoryHighReader [0] = this.memoryReader [为0xFF00] =函数(parentObj,地址){
            返回将0xC0 | parentObj.memory [为0xFF00] //前四位的回报为集。
          }
          打破;
        案例0xFF01:
          // SB
          this.memoryHighReader [0×01] = this.memoryReader [0xFF01] =功能(parentObj,地址){
            返回(parentObj.memory [0xFF02< 0x80的)? parentObj.memory [0xFF01]:0xFF的;
          }
          打破;
        案例0xFF02:
          // SC
          如果(this.cGBC){
            this.memoryHighReader [0X02 = this.memoryReader [0xFF02] =功能(parentObj,地址){
              收益率((parentObj.serialTimer< = 0)0x7C:0xFC有)| parentObj.memory [0xFF02]
            }
          }
          其他{
            this.memoryHighReader [0X02 = this.memoryReader [0xFF02] =功能(parentObj,地址){
              返回((parentObj.serialTimer< = 0)的0x7E:0xFE的?)| parentObj.memory [0xFF02]
            }
          }
          打破;
    }
  }

以上的JavaScript几乎像Java,但我不明白如何将功能(parentObj,地址){...} 转换中的 memoryReadJumpCompile 什么将此转换为Java,而无需使用任何接口最简单的方法。我想用一个开关()

下面是我迄今为止在Java中(因为我用精缩JavaScript版本,当我开始转换它没有使用十六进制字母)

 公共无效memoryReadJumpCompile(){
  对于(VAR一个= 0; A< = 65535; A ++){
    如果(一个或下; 16384){
      this.memoryReader [A] = this.memoryReadNormal;
    }其他{
      如果(一个或下; 32768){
        this.memoryReader [A] = this.memoryReadROM;
      }其他{
        如果(A< 38912){
          this.memoryReader [A] =(this.cGBC)? this.VRAMDATAReadCGBCPU:this.VRAMDATAReadDMGCPU;
        }其他{
          如果(一个或下; 40960){
            this.memoryReader [A] =(this.cGBC)? this.VRAMCHRReadCGBCPU:this.VRAMCHRReadDMGCPU;
          }其他{
            如果(A> = 40960&放大器;&安培; A< 49152){
              如果((this.numRAMBanks == 1/16和;&放大器;一个与所述; 41472)|| this.numRAMBanks> = 1){
                如果(this.cMBC7){
                  this.memoryReader [A] = this.memoryReadMBC7;
                }其他{
                  如果(!this.cMBC3){
                    this.memoryReader [A] = this.memoryReadMBC;
                  }其他{
                    this.memoryReader [A] = this.memoryReadMBC3;
                  }
                }
              }其他{
                this.memoryReader [A] = this.memoryReadBAD;
              }
            }其他{
              如果(A> = 49152&放大器;&安培; A< 57344){
                如果(this.cGBC || A<!53248){
                  this.memoryReader [A] = this.memoryReadNormal;
                }其他{
                  this.memoryReader [A] = this.memoryReadGBCMemory;
                }
              }其他{
                如果(A> = 57344&放大器;&安培; A< 65024){
                  如果(this.cGBC || A<!61440){
                    this.memoryReader [A] = this.memoryReadECHONormal;
                  }其他{
                    this.memoryReader [A] = this.memoryReadECHOGBCMemory;
                  }
                }其他{
                  如果(A< 65184){
                    this.memoryReader [A] = this.memoryReadOAM;
                  }其他{
                    如果(this.cGBC&安培;&安培; A> = 65184&放大器;&安培; A< 65280){
                      this.memoryReader [A] = this.memoryReadNormal;
                    }其他{
                      如果(一个或GT = 65280){
                        开关(一){
                        案例65280:
                          this.memoryHighReader [0] = this.memoryReader [65280] =功能(C,B){
                            返回192 | c.memory [65280]
                          };
                          打破;
                        案例65281:
                          this.memoryHighReader [1] = this.memoryReader [65281] =功能(C,B){
                            回报(c.memory [65282]< 128)? c.memory [65281]:255;
                          };
                          打破;
                        案例65282:
                          如果(this.cGBC){
                            this.memoryHighReader [2] = this.memoryReader [65282] =函数(C,B){
                              返回((c.serialTimer< = 0)124:252?)| c.memory [65282]
                            }
                          }其他{
                            this.memoryHighReader [2] = this.memoryReader [65282] =函数(C,B){
                              返回((c.serialTimer< = 0)126:254?)| c.memory [65282]
                            }
                          }
                          打破;
                        案例65283:
                          this.memoryHighReader [3] = this.memoryReader [65283] = this.memoryReadBAD;
                          打破;
                        案例65284:
                          this.memoryHighReader [4] = this.memoryReader [65284] =函数(C,B){
                            c.memory [65284] =(c.memory [65284] +(c.DIVTicks>→8))及255;
                            c.DIVTicks&安培; = 255;
                            返回c.memory [65284]
                          };
                          打破;
                        案例65285:
                        案例65286:
                          this.memoryHighReader [A和255] = this.memoryHighReadNormal;
                          this.memoryReader [A] = this.memoryReadNormal;
                          打破;
                        案例65287:
                          this.memoryHighReader [7] = this.memoryReader [65287] =函数(C,B){
                            返回248 | c.memory [65287]
                          };
                          打破;
                        案例65288:
                        案例65289:
                        案例65290:
                        案例65291个:
                        案例65292:
                        案例65293:
                        案例65294:
                          this.memoryHighReader [A和255] = this.memoryReader [A] = this.memoryReadBAD;
                          打破;
                        案例65295:
                          this.memoryHighReader [15] = this.memoryReader [65295] =函数(C,B){
                            返回224 | c.interruptsRequested;
                          };
                          打破;
                        案例65296:
                          this.memoryHighReader [16] = this.memoryReader [65296] =函数(C,B){
                            返回128 | c.memory [65296]
                          };
                          打破;
                        65297的情况下:
                          this.memoryHighReader [17] = this.memoryReader [65297] =函数(C,B){
                            返回63 | c.memory [65297]
                          };
                          打破;
                        案例65298:
                          this.memoryHighReader [18] = this.memoryHighReadNormal;
                          this.memoryReader [65298] = this.memoryReadNormal;
                          打破;
                        案例65299:
                          this.memoryHighReader [19] = this.memoryReader [65299] = this.memoryReadBAD;
                          打破;
                        案例65300:
                          this.memoryHighReader [20] = this.memoryReader [65300] =函数(C,B){
                            返回191 | c.memory [65300]
                          };
                          打破;
                        案例65301:
                          this.memoryHighReader [21] = this.memoryReadBAD;
                          this.memoryReader [65301] = this.memoryReadBAD;
                          打破;
                        案例65302:
                          this.memoryHighReader [22] = this.memoryReader [65302] =函数(C,B){
                            返回63 | c.memory [65302]
                          };
                          打破;
                        案例65303:
                          this.memoryHighReader [23] = this.memoryHighReadNormal;
                          this.memoryReader [65303] = this.memoryReadNormal;
                          打破;
                        案例65304:
                          this.memoryHighReader [24] = this.memoryReader [65304] = this.memoryReadBAD;
                          打破;
                        案例65305:
                          this.memoryHighReader [25] = this.memoryReader [65305] =函数(C,B){
                            返回191 | c.memory [65305]
                          };
                          打破;
                        案例65306:
                          this.memoryHighReader [26] = this.memoryReader [65306] =功能(C,B){
                            返回127 | c.memory [65306]
                          };
                          打破;
                        案例65307:
                          this.memoryHighReader [27] ​​= this.memoryReader [65307] = this.memoryReadBAD;
                          打破;
                        案例65308:
                          this.memoryHighReader [28] = this.memoryReader [65308] =函数(C,B){
                            返回159 | c.memory [65308]
                          };
                          打破;
                        案例65309:
                          this.memoryHighReader [29] = this.memoryReader [65309] = this.memoryReadBAD;
                          打破;
                        案例65310:
                          this.memoryHighReader [30] = this.memoryReader [65310] =函数(C,B){
                            返回191 | c.memory [65310]
                          };
                          打破;
                        案例65311:
                        案例65312:
                          this.memoryHighReader [A和255] = this.memoryReader [A] = this.memoryReadBAD;
                          打破;
                        案例65313:
                        案例65314:
                          this.memoryHighReader [A和255] = this.memoryHighReadNormal;
                          this.memoryReader [A] = this.memoryReadNormal;
                          打破;
                        案例65315:
                          this.memoryHighReader [35] = this.memoryReader [65315] =函数(C,B){
                            返回191 | c.memory [65315]
                          };
                          打破;
                        案例65316:
                        案例65317:
                          this.memoryHighReader [A和255] = this.memoryHighReadNormal;
                          this.memoryReader [A] = this.memoryReadNormal;
                          打破;
                        案例65318:
                          this.memoryHighReader [38] = this.memoryReader [65318] =函数(C,B){
                            c.audioJIT();
                            返回112 | c.memory [65318]
                          };
                          打破;
                        案例65319:
                        案例65320:
                        案例65321:
                        案例65322:
                        案例65323:
                        案例65324:
                        案例65325:
                        案例65326:
                        案例65327:
                          this.memoryHighReader [A和255] = this.memoryReader [A] = this.memoryReadBAD;
                          打破;
                        案例65328:
                        案例65329:
                        案例65330:
                        案例65331:
                        案例65332:
                        案例65333:
                        案例65334:
                        案例65335:
                        65336的情况下:
                        案例65337:
                        案例65338:
                        案例65339:
                        案例65340:
                        案例65341:
                        案例65342:
                        案例65343:
                          this.memoryReader [α] =函数(C,B){
                            返回(c.channel3canPlay)? c.memory [65280 | (c.channel3lastSampleLookup>→1)〕:c.memory并[b]
                          };
                          this.memoryHighReader [A和255] =功能(C,B){
                            返回(c.channel3canPlay)? c.memory [65280 | (c.channel3lastSampleLookup>→1)〕:c.memory [65280 | B];
                          };
                          打破;
                        案例65344:
                          this.memoryHighReader [64] = this.memoryHighReadNormal;
                          this.memoryReader [65344] = this.memoryReadNormal;
                          打破;
                        案例65345:
                          this.memoryHighReader [65] = this.memoryReader [65345] =函数(C,B){
                            返回128 | c.memory [65345] | c.modeSTAT;
                          };
                          打破;
                        案例65346:
                          this.memoryHighReader [66] = this.memoryReader [65346] =函数(C,B){
                            返回c.backgroundY;
                          };
                          打破;
                        案例65347:
                          this.memoryHighReader [67] = this.memoryReader [65347] =函数(C,B){
                            返回c.backgroundX;
                          };
                          打破;
                        案例65348:
                          this.memoryHighReader [68] = this.memoryReader [65348] =函数(C,B){
                            回报((c.LCDisOn)c.memory [65348]:0);
                          };
                          打破;
                        案例65349:
                        案例65350:
                        案例65351:
                        案例65352:
                        案例65353:
                          this.memoryHighReader [A和255] = this.memoryHighReadNormal;
                          this.memoryReader [A] = this.memoryReadNormal;
                          打破;
                        案例65354:
                          this.memoryHighReader [74] = this.memoryReader [65354] =函数(C,B){
                            返回c.windowY;
                          };
                          打破;
                        案例65355:
                          this.memoryHighReader [75] = this.memoryHighReadNormal;
                          this.memoryReader [65355] = this.memoryReadNormal;
                          打破;
                        案例65356:
                          this.memoryHighReader [76] = this.memoryReader [65356] = this.memoryReadBAD;
                          打破;
                        案例65357:
                          this.memoryHighReader [77] = this.memoryHighReadNormal;
                          this.memoryReader [65357] = this.memoryReadNormal;
                          打破;
                        案例65358:
                          this.memoryHighReader [78] = this.memoryReader [65358] = this.memoryReadBAD;
                          打破;
                        案例65359:
                          this.memoryHighReader [79] = this.memoryReader [65359] =函数(C,B){
                            返回c.currVRAMBank;
                          };
                          打破;
                        案例65360:
                        案例65361:
                        案例65362:
                        案例65363:
                        案例65364:
                          this.memoryHighReader [A和255] = this.memoryHighReadNormal;
                          this.memoryReader [A] = this.memoryReadNormal;
                          打破;
                        案例65365:
                          如果(this.cGBC){
                            this.memoryHighReader [85] = this.memoryReader [65365] =函数(C,B){
                              如果(c.LCDisOn&安培;!&安培; c.hdmaRunning){
                                c.DMAWrite((c.memory [65365]&放大器; 127)+1);
                                c.memory [65365] = 255;
                                c.hdmaRunning = FALSE;
                              }
                              返回c.memory [65365]
                            }
                          }其他{
                            this.memoryReader [65365] = this.memoryReadNormal;
                            this.memoryHighReader [85] = this.memoryHighReadNormal;
                          }
                          打破;
                        案例65366:
                          如果(this.cGBC){
                            this.memoryHighReader [86] = this.memoryReader [65366] =功能(C,B){
                              返回60 | ((c.memory [65366]≥= 192)(2 |(c.memory [65366]&放大器; 193)):(c.memory [65366]&放大器; 195));
                            }
                          }其他{
                            this.memoryReader [65366] = this.memoryReadNormal;
                            this.memoryHighReader [86] = this.memoryHighReadNormal;
                          }
                          打破;
                        案例65367:
                        案例65368:
                        案例65369:
                        案例65370:
                        案例65371:
                        案例65372:
                        案例65373:
                        案例65374:
                        案例65375:
                        案例65376:
                        案例65377:
                        案例65378:
                        案例65379:
                        案例65380:
                        案例65381:
                        案例65382:
                        案例65383:
                          this.memoryHighReader [A和255] = this.memoryReader [A] = this.memoryReadBAD;
                          打破;
                        案例65384:
                        案例65385:
                        案例65386:
                        案例65387:
                          this.memoryHighReader [A和255] = this.memoryHighReadNormal;
                          this.memoryReader [A] = this.memoryReadNormal;
                          打破;
                        案例65388:
                          如果(this.cGBC){
                            this.memoryHighReader [108] = this.memoryReader [65388] =功能(C,B){
                              返回254 | c.memory [65388]
                            }
                          }其他{
                            this.memoryHighReader [108] = this.memoryReader [65388] = this.memoryReadBAD;
                          }
                          打破;
                        案例65389:
                        案例65390:
                        65391的情况下:
                          this.memoryHighReader [A和255] = this.memoryReader [A] = this.memoryReadBAD;
                          打破;
                        案例65392:
                          如果(this.cGBC){
                            this.memoryHighReader [112] = this.memoryReader [65392] =函数(C,B){
                              返回64 | c.memory [65392]
                            }
                          }其他{
                            this.memoryHighReader [112] = this.memoryReader [65392] = this.memoryReadBAD;
                          }
                          打破;
                        案例65393:
                          this.memoryHighReader [113] = this.memoryReader [65393] = this.memoryReadBAD;
                          打破;
                        案例65394:
                        案例65395:
                          this.memoryHighReader [A和255] = this.memoryReader [A] = this.memoryReadNormal;
                          打破;
                        案例65396:
                          如果(this.cGBC){
                            this.memoryHighReader [116] = this.memoryReader [65396] = this.memoryReadNormal;
                          }其他{
                            this.memoryHighReader [116] = this.memoryReader [65396] = this.memoryReadBAD;
                          }
                          打破;
                        案例65397:
                          this.memoryHighReader [117] = this.memoryReader [65397] =功能(C,B){
                            返回143 | c.memory [65397]
                          };
                          打破;
                        案例65398:
                        案例65399:
                          this.memoryHighReader [A和255] = this.memoryReader [α] =函数(C,B){
                            返回0;
                          };
                          打破;
                        案例65400:
                        案例65401:
                        案例65402:
                        案例65403:
                        案例65404:
                        案例65405:
                        案例65406:
                        案例65407:
                          this.memoryHighReader [A和255] = this.memoryReader [A] = this.memoryReadBAD;
                          打破;
                        案例65535:
                          this.memoryHighReader [255] = this.memoryReader [65535] =功能(C,B){
                            返回c.interruptsEnabled;
                          };
                          打破;
                        默认:
                          this.memoryReader [A] = this.memoryReadNormal;
                          this.memoryHighReader [A和255] = this.memoryHighReadNormal;
                        }
                      }其他{
                        this.memoryReader [A] = this.memoryReadBAD;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}


解决方案

我开始分裂 memoryReadJumpCompile 进入它们合并成memoryHighRead和memoryRead功能。每个功能约需1小时。

下面是一个例子 memoryReader ,我完成了他们他们(memoryRead / memoryReadHigh / memoryWrite / memoryWriteHigh)的所有4个,不知道它的工作原理,仍超过100错误!哈哈很长的路要走。

 众长memoryReader(地址){
    //返回memoryReader [地址](本,地址);
    如果(地址< 16384){
        返回memoryReadNormal(地址);
    }否则如果(地址< 32768){
        返回memoryReadROM(地址);
    }否则如果(地址< 38912){
        返回(CGBC)? VRAMDATAReadCGBCPU(地址):VRAMDATAReadDMGCPU(地址);
    }否则如果(地址< 40960){
        返回(CGBC)? VRAMCHRReadCGBCPU(地址):VRAMCHRReadDMGCPU(地址);
    }否则如果(地址> = 40960&放大器;&安培;地址< 49152){
        如果((numRAMBanks == 1月16日和放大器;&安培;地址< 41472)|| numRAMBanks> = 1){
            如果(cMBC7){
                返回memoryReadMBC7(地址);
            }否则如果(!cMBC3){
                返回memoryReadMBC(地址);
            }其他{
                返回memoryReadMBC3(地址);
            }
        }其他{
            返回memoryReadBAD();
        }
    }否则如果(地址> = 49152&放大器;&安培;地址< 57344){
        如果(CGBC ||地址<!53248){
            返回memoryReadNormal(地址);
        }其他{
            返回memoryReadGBCMemory(地址);
        }
    }否则如果(地址> = 57344&放大器;&安培;地址< 65024){
        如果(CGBC ||地址<!61440){
            返回memoryReadECHONormal(地址);
        }其他{
            返回memoryReadECHOGBCMemory(地址);
        }
    }否则如果(地址< 65184){
        返回memoryReadOAM(地址);
    }否则如果(CGBC和放大器;&安培;地址> = 65184&放大器;&安培;地址< 65280){
        返回memoryReadNormal(地址);
    }否则如果(地址> = 65280){
        开关(地址){
        案例65280:
            返回192 |内存[65280]
            打破;
        案例65281:
            回报(内存[65282]< 128)?内存[65281]:255;
            打破;
        案例65282:
            如果(CGBC){
                返回((serialTimer< = 0)124:252?)|内存[65282]
            }其他{
                返回((serialTimer< = 0)126:254?)|内存[65282]
            }
            打破;
        案例65283:
            返回memoryReadBAD();
            打破;
        案例65284:
            内存[65284] =(内存[65284] +(DIVTicks>> 8))及255;
            DIVTicks&安培; = 255;
            返回内存[65284]
            打破;
        案例65285:
        案例65286:
            返回memoryReadNormal(地址);
            打破;
        案例65287:
            返回248 |内存[65287]
            打破;
        案例65288:
        案例65289:
        案例65290:
        案例65291个:
        案例65292:
        案例65293:
        案例65294:
            返回memoryReadBAD();
            打破;
        案例65295:
            返回224 | interruptsRequested;
            打破;
        案例65296:
            返回128 |内存[65296]
            打破;
        65297的情况下:
            返回63 |内存[65297]
            打破;
        案例65298:
            返回memoryReadNormal(地址);
            打破;
        案例65299:
            返回memoryReadBAD();
            打破;
        案例65300:
            返回191 |内存[65300]
            打破;
        案例65301:
            返回memoryReadBAD();
            打破;
        案例65302:
            返回63 |内存[65302]
            打破;
        案例65303:
            返回memoryReadNormal(地址);
            打破;
        案例65304:
            返回memoryReadBAD();
            打破;
        案例65305:
            返回191 |内存[65305]
            打破;
        案例65306:
            返回127 |内存[65306]
            打破;
        案例65307:
            返回memoryReadBAD();
            打破;
        案例65308:
            返回159 |内存[65308]
            打破;
        案例65309:
            返回memoryReadBAD();
            打破;
        案例65310:
            返回191 |内存[65310]
            打破;
        案例65311:
        案例65312:
            返回memoryReadBAD();
            打破;
        案例65313:
        案例65314:
            返回memoryReadNormal(地址);
            打破;
        案例65315:
            返回191 |内存[65315]
            打破;
        案例65316:
        案例65317:
            返回memoryReadNormal(地址);
            打破;
        案例65318:
            c.audioJIT();
            返回112 |内存[65318]
            打破;
        案例65319:
        案例65320:
        案例65321:
        案例65322:
        案例65323:
        案例65324:
        案例65325:
        案例65326:
        案例65327:
            返回memoryReadBAD();
            打破;
        案例65328:
        案例65329:
        案例65330:
        案例65331:
        案例65332:
        案例65333:
        案例65334:
        案例65335:
        65336的情况下:
        案例65337:
        案例65338:
        案例65339:
        案例65340:
        案例65341:
        案例65342:
        案例65343:
            返回(channel3canPlay)?内存[65280 | (channel3lastSampleLookup>> 1)]:内存[地址]
            打破;
        案例65344:
            返回memoryReadNormal(地址);
            打破;
        案例65345:
            返回128 |内存[65345] | modeSTAT;
            打破;
        案例65346:
            返回backgroundY;
            打破;
        案例65347:
            返回backgroundX;
            打破;
        案例65348:
            回报((LCDisOn)内存[65348]:0);
            打破;
        案例65349:
        案例65350:
        案例65351:
        案例65352:
        案例65353:
            返回memoryReadNormal(地址);
            打破;
        案例65354:
            返回windowY;
            打破;
        案例65355:
            返回memoryReadNormal(地址);
            打破;
        案例65356:
            返回memoryReadBAD();
            打破;
        案例65357:
            返回memoryReadNormal(地址);
            打破;
        案例65358:
            返回memoryReadBAD();
            打破;
        案例65359:
            返回currVRAMBank;
            打破;
        案例65360:
        案例65361:
        案例65362:
        案例65363:
        案例65364:
            返回memoryReadNormal(地址);
            打破;
        案例65365:
            如果(CGBC){
                如果(LCDisOn&安培;!&安培; hdmaRunning){
                    DMAWrite((内存[65365]&安培; 127)+ 1);
                    内存[65365] = 255;
                    hdmaRunning = FALSE;
                }
                返回内存[65365]
            }其他{
                返回memoryReadNormal(地址);
            }
            打破;
        案例65366:
            如果(CGBC){
                返回60 | ((内存[65366]> = 192)(2 |(内存[65366]&安培; 193)):(内存[65366]&安培; 195));
            }其他{
                返回memoryReadNormal(地址);
            }
            打破;
        案例65367:
        案例65368:
        案例65369:
        案例65370:
        案例65371:
        案例65372:
        案例65373:
        案例65374:
        案例65375:
        案例65376:
        案例65377:
        案例65378:
        案例65379:
        案例65380:
        案例65381:
        案例65382:
        案例65383:
            返回memoryReadBAD();
            打破;
        案例65384:
        案例65385:
        案例65386:
        案例65387:
            返回memoryReadNormal(地址);
            打破;
        案例65388:
            如果(CGBC){
                返回254 |内存[65388]
            }其他{
                返回memoryReadBAD();
            }
            打破;
        案例65389:
        案例65390:
        65391的情况下:
            返回memoryReadBAD();
            打破;
        案例65392:
            如果(CGBC){
                返回64 |内存[65392]
            }其他{
                返回memoryReadBAD();
            }
            打破;
        案例65393:
            返回memoryReadBAD();
            打破;
        案例65394:
        案例65395:
            返回memoryReadNormal(地址);
            打破;
        案例65396:
            如果(CGBC){
                返回memoryReadNormal(地址);
            }其他{
                返回memoryReadBAD();
            }
            打破;
        案例65397:
            返回143 |内存[65397]
            打破;
        案例65398:
        案例65399:
            返回0;
            打破;
        案例65400:
        案例65401:
        案例65402:
        案例65403:
        案例65404:
        案例65405:
        案例65406:
        案例65407:
            返回memoryReadBAD();
            打破;
        案例65535:
            返回interruptsEnabled;
            打破;
        默认:
            返回memoryReadNormal(地址);
        }
    }其他{
        返回memoryReadBAD();
    }
}

Here is the javascript code below with a few anonymous inner functions linked to it seems 2 array indexes for each switch, they seem to return some value too, but I have no idea where they are returning to the memoryReadJumpCompile() function or both those array index's.

Most likely they are reuturning to the actual array indexes and by the function name Compile it seems that everytime you call any of those array indexes they will re-evaluate the function linked to them with some new result still don't know where the result is stored if the actual index's hold functions, my best guess is the actual array indexes are like function names and they are returned by another piece of code where-ever else the index's are called somewhere in code but lets say the first 2 example array indexes.

this.memoryHighReader[0] = this.memoryReader[0xFF00]

So they both become the same thing, I found that it gets processed in the instruction executor like so

case 242:
    a.registerA = a.memoryHighReader[a.registerC](a, a.registerC);
    break;

  GameBoyCore.prototype.memoryReadJumpCompile = function () {
    //...
    else if (index >= 0xFF00) {
      switch (index) {
        case 0xFF00:
          //JOYPAD:
          this.memoryHighReader[0] = this.memoryReader[0xFF00] = function (parentObj, address) {
            return 0xC0 | parentObj.memory[0xFF00];  //Top nibble returns as set.
          }
          break;
        case 0xFF01:
          //SB
          this.memoryHighReader[0x01] = this.memoryReader[0xFF01] = function (parentObj, address) {
            return (parentObj.memory[0xFF02] < 0x80) ? parentObj.memory[0xFF01] : 0xFF;
          }
          break;
        case 0xFF02:
          //SC
          if (this.cGBC) {
            this.memoryHighReader[0x02] = this.memoryReader[0xFF02] = function (parentObj, address) {
              return ((parentObj.serialTimer <= 0) ? 0x7C : 0xFC) | parentObj.memory[0xFF02];
            }
          }
          else {
            this.memoryHighReader[0x02] = this.memoryReader[0xFF02] = function (parentObj, address) {
              return ((parentObj.serialTimer <= 0) ? 0x7E : 0xFE) | parentObj.memory[0xFF02];
            }
          }
          break;
    }
  }

The above javascript is nearly like Java but I can't understand how to convert the function(parentObj, address) {...} in the memoryReadJumpCompile whats the easiest way to convert this to Java without using Interfaces either. I would like to use a switch()

Here is what I have so far in Java (it doesn't use hexadecimal letters because I used Minified JavaScript version when I started converting)

public void memoryReadJumpCompile() {
  for (var a = 0; a <= 65535; a++) {
    if (a < 16384) {
      this.memoryReader[a] = this.memoryReadNormal;
    } else {
      if (a < 32768) {
        this.memoryReader[a] = this.memoryReadROM;
      } else {
        if (a < 38912) {
          this.memoryReader[a] = (this.cGBC) ? this.VRAMDATAReadCGBCPU : this.VRAMDATAReadDMGCPU;
        } else {
          if (a < 40960) {
            this.memoryReader[a] = (this.cGBC) ? this.VRAMCHRReadCGBCPU : this.VRAMCHRReadDMGCPU;
          } else {
            if (a >= 40960 && a < 49152) {
              if ((this.numRAMBanks == 1 / 16 && a < 41472) || this.numRAMBanks >= 1) {
                if (this.cMBC7) {
                  this.memoryReader[a] = this.memoryReadMBC7;
                } else {
                  if (!this.cMBC3) {
                    this.memoryReader[a] = this.memoryReadMBC;
                  } else {
                    this.memoryReader[a] = this.memoryReadMBC3;
                  }
                }
              } else {
                this.memoryReader[a] = this.memoryReadBAD;
              }
            } else {
              if (a >= 49152 && a < 57344) {
                if (!this.cGBC || a < 53248) {
                  this.memoryReader[a] = this.memoryReadNormal;
                } else {
                  this.memoryReader[a] = this.memoryReadGBCMemory;
                }
              } else {
                if (a >= 57344 && a < 65024) {
                  if (!this.cGBC || a < 61440) {
                    this.memoryReader[a] = this.memoryReadECHONormal;
                  } else {
                    this.memoryReader[a] = this.memoryReadECHOGBCMemory;
                  }
                } else {
                  if (a < 65184) {
                    this.memoryReader[a] = this.memoryReadOAM;
                  } else {
                    if (this.cGBC && a >= 65184 && a < 65280) {
                      this.memoryReader[a] = this.memoryReadNormal;
                    } else {
                      if (a >= 65280) {
                        switch (a) {
                        case 65280:
                          this.memoryHighReader[0] = this.memoryReader[65280] = function(c, b) {
                            return 192 | c.memory[65280];
                          };
                          break;
                        case 65281:
                          this.memoryHighReader[1] = this.memoryReader[65281] = function(c, b) {
                            return (c.memory[65282] < 128) ? c.memory[65281] : 255;
                          };
                          break;
                        case 65282:
                          if (this.cGBC) {
                            this.memoryHighReader[2] = this.memoryReader[65282] = function(c, b) {
                              return ((c.serialTimer <= 0) ? 124 : 252) | c.memory[65282];
                            }
                          } else {
                            this.memoryHighReader[2] = this.memoryReader[65282] = function(c, b) {
                              return ((c.serialTimer <= 0) ? 126 : 254) | c.memory[65282];
                            }
                          }
                          break;
                        case 65283:
                          this.memoryHighReader[3] = this.memoryReader[65283] = this.memoryReadBAD;
                          break;
                        case 65284:
                          this.memoryHighReader[4] = this.memoryReader[65284] = function(c, b) {
                            c.memory[65284] = (c.memory[65284] + (c.DIVTicks >> 8)) & 255;
                            c.DIVTicks &= 255;
                            return c.memory[65284];
                          };
                          break;
                        case 65285:
                        case 65286:
                          this.memoryHighReader[a & 255] = this.memoryHighReadNormal;
                          this.memoryReader[a] = this.memoryReadNormal;
                          break;
                        case 65287:
                          this.memoryHighReader[7] = this.memoryReader[65287] = function(c, b) {
                            return 248 | c.memory[65287];
                          };
                          break;
                        case 65288:
                        case 65289:
                        case 65290:
                        case 65291:
                        case 65292:
                        case 65293:
                        case 65294:
                          this.memoryHighReader[a & 255] = this.memoryReader[a] = this.memoryReadBAD;
                          break;
                        case 65295:
                          this.memoryHighReader[15] = this.memoryReader[65295] = function(c, b) {
                            return 224 | c.interruptsRequested;
                          };
                          break;
                        case 65296:
                          this.memoryHighReader[16] = this.memoryReader[65296] = function(c, b) {
                            return 128 | c.memory[65296];
                          };
                          break;
                        case 65297:
                          this.memoryHighReader[17] = this.memoryReader[65297] = function(c, b) {
                            return 63 | c.memory[65297];
                          };
                          break;
                        case 65298:
                          this.memoryHighReader[18] = this.memoryHighReadNormal;
                          this.memoryReader[65298] = this.memoryReadNormal;
                          break;
                        case 65299:
                          this.memoryHighReader[19] = this.memoryReader[65299] = this.memoryReadBAD;
                          break;
                        case 65300:
                          this.memoryHighReader[20] = this.memoryReader[65300] = function(c, b) {
                            return 191 | c.memory[65300];
                          };
                          break;
                        case 65301:
                          this.memoryHighReader[21] = this.memoryReadBAD;
                          this.memoryReader[65301] = this.memoryReadBAD;
                          break;
                        case 65302:
                          this.memoryHighReader[22] = this.memoryReader[65302] = function(c, b) {
                            return 63 | c.memory[65302];
                          };
                          break;
                        case 65303:
                          this.memoryHighReader[23] = this.memoryHighReadNormal;
                          this.memoryReader[65303] = this.memoryReadNormal;
                          break;
                        case 65304:
                          this.memoryHighReader[24] = this.memoryReader[65304] = this.memoryReadBAD;
                          break;
                        case 65305:
                          this.memoryHighReader[25] = this.memoryReader[65305] = function(c, b) {
                            return 191 | c.memory[65305];
                          };
                          break;
                        case 65306:
                          this.memoryHighReader[26] = this.memoryReader[65306] = function(c, b) {
                            return 127 | c.memory[65306];
                          };
                          break;
                        case 65307:
                          this.memoryHighReader[27] = this.memoryReader[65307] = this.memoryReadBAD;
                          break;
                        case 65308:
                          this.memoryHighReader[28] = this.memoryReader[65308] = function(c, b) {
                            return 159 | c.memory[65308];
                          };
                          break;
                        case 65309:
                          this.memoryHighReader[29] = this.memoryReader[65309] = this.memoryReadBAD;
                          break;
                        case 65310:
                          this.memoryHighReader[30] = this.memoryReader[65310] = function(c, b) {
                            return 191 | c.memory[65310];
                          };
                          break;
                        case 65311:
                        case 65312:
                          this.memoryHighReader[a & 255] = this.memoryReader[a] = this.memoryReadBAD;
                          break;
                        case 65313:
                        case 65314:
                          this.memoryHighReader[a & 255] = this.memoryHighReadNormal;
                          this.memoryReader[a] = this.memoryReadNormal;
                          break;
                        case 65315:
                          this.memoryHighReader[35] = this.memoryReader[65315] = function(c, b) {
                            return 191 | c.memory[65315];
                          };
                          break;
                        case 65316:
                        case 65317:
                          this.memoryHighReader[a & 255] = this.memoryHighReadNormal;
                          this.memoryReader[a] = this.memoryReadNormal;
                          break;
                        case 65318:
                          this.memoryHighReader[38] = this.memoryReader[65318] = function(c, b) {
                            c.audioJIT();
                            return 112 | c.memory[65318];
                          };
                          break;
                        case 65319:
                        case 65320:
                        case 65321:
                        case 65322:
                        case 65323:
                        case 65324:
                        case 65325:
                        case 65326:
                        case 65327:
                          this.memoryHighReader[a & 255] = this.memoryReader[a] = this.memoryReadBAD;
                          break;
                        case 65328:
                        case 65329:
                        case 65330:
                        case 65331:
                        case 65332:
                        case 65333:
                        case 65334:
                        case 65335:
                        case 65336:
                        case 65337:
                        case 65338:
                        case 65339:
                        case 65340:
                        case 65341:
                        case 65342:
                        case 65343:
                          this.memoryReader[a] = function(c, b) {
                            return (c.channel3canPlay) ? c.memory[65280 | (c.channel3lastSampleLookup >> 1)] : c.memory[b];
                          };
                          this.memoryHighReader[a & 255] = function(c, b) {
                            return (c.channel3canPlay) ? c.memory[65280 | (c.channel3lastSampleLookup >> 1)] : c.memory[65280 | b];
                          };
                          break;
                        case 65344:
                          this.memoryHighReader[64] = this.memoryHighReadNormal;
                          this.memoryReader[65344] = this.memoryReadNormal;
                          break;
                        case 65345:
                          this.memoryHighReader[65] = this.memoryReader[65345] = function(c, b) {
                            return 128 | c.memory[65345] | c.modeSTAT;
                          };
                          break;
                        case 65346:
                          this.memoryHighReader[66] = this.memoryReader[65346] = function(c, b) {
                            return c.backgroundY;
                          };
                          break;
                        case 65347:
                          this.memoryHighReader[67] = this.memoryReader[65347] = function(c, b) {
                            return c.backgroundX;
                          };
                          break;
                        case 65348:
                          this.memoryHighReader[68] = this.memoryReader[65348] = function(c, b) {
                            return ((c.LCDisOn) ? c.memory[65348] : 0);
                          };
                          break;
                        case 65349:
                        case 65350:
                        case 65351:
                        case 65352:
                        case 65353:
                          this.memoryHighReader[a & 255] = this.memoryHighReadNormal;
                          this.memoryReader[a] = this.memoryReadNormal;
                          break;
                        case 65354:
                          this.memoryHighReader[74] = this.memoryReader[65354] = function(c, b) {
                            return c.windowY;
                          };
                          break;
                        case 65355:
                          this.memoryHighReader[75] = this.memoryHighReadNormal;
                          this.memoryReader[65355] = this.memoryReadNormal;
                          break;
                        case 65356:
                          this.memoryHighReader[76] = this.memoryReader[65356] = this.memoryReadBAD;
                          break;
                        case 65357:
                          this.memoryHighReader[77] = this.memoryHighReadNormal;
                          this.memoryReader[65357] = this.memoryReadNormal;
                          break;
                        case 65358:
                          this.memoryHighReader[78] = this.memoryReader[65358] = this.memoryReadBAD;
                          break;
                        case 65359:
                          this.memoryHighReader[79] = this.memoryReader[65359] = function(c, b) {
                            return c.currVRAMBank;
                          };
                          break;
                        case 65360:
                        case 65361:
                        case 65362:
                        case 65363:
                        case 65364:
                          this.memoryHighReader[a & 255] = this.memoryHighReadNormal;
                          this.memoryReader[a] = this.memoryReadNormal;
                          break;
                        case 65365:
                          if (this.cGBC) {
                            this.memoryHighReader[85] = this.memoryReader[65365] = function(c, b) {
                              if (!c.LCDisOn && c.hdmaRunning) {
                                c.DMAWrite((c.memory[65365] & 127) + 1);
                                c.memory[65365] = 255;
                                c.hdmaRunning = false;
                              }
                              return c.memory[65365];
                            }
                          } else {
                            this.memoryReader[65365] = this.memoryReadNormal;
                            this.memoryHighReader[85] = this.memoryHighReadNormal;
                          }
                          break;
                        case 65366:
                          if (this.cGBC) {
                            this.memoryHighReader[86] = this.memoryReader[65366] = function(c, b) {
                              return 60 | ((c.memory[65366] >= 192) ? (2 | (c.memory[65366] & 193)) : (c.memory[65366] & 195));
                            }
                          } else {
                            this.memoryReader[65366] = this.memoryReadNormal;
                            this.memoryHighReader[86] = this.memoryHighReadNormal;
                          }
                          break;
                        case 65367:
                        case 65368:
                        case 65369:
                        case 65370:
                        case 65371:
                        case 65372:
                        case 65373:
                        case 65374:
                        case 65375:
                        case 65376:
                        case 65377:
                        case 65378:
                        case 65379:
                        case 65380:
                        case 65381:
                        case 65382:
                        case 65383:
                          this.memoryHighReader[a & 255] = this.memoryReader[a] = this.memoryReadBAD;
                          break;
                        case 65384:
                        case 65385:
                        case 65386:
                        case 65387:
                          this.memoryHighReader[a & 255] = this.memoryHighReadNormal;
                          this.memoryReader[a] = this.memoryReadNormal;
                          break;
                        case 65388:
                          if (this.cGBC) {
                            this.memoryHighReader[108] = this.memoryReader[65388] = function(c, b) {
                              return 254 | c.memory[65388];
                            }
                          } else {
                            this.memoryHighReader[108] = this.memoryReader[65388] = this.memoryReadBAD;
                          }
                          break;
                        case 65389:
                        case 65390:
                        case 65391:
                          this.memoryHighReader[a & 255] = this.memoryReader[a] = this.memoryReadBAD;
                          break;
                        case 65392:
                          if (this.cGBC) {
                            this.memoryHighReader[112] = this.memoryReader[65392] = function(c, b) {
                              return 64 | c.memory[65392];
                            }
                          } else {
                            this.memoryHighReader[112] = this.memoryReader[65392] = this.memoryReadBAD;
                          }
                          break;
                        case 65393:
                          this.memoryHighReader[113] = this.memoryReader[65393] = this.memoryReadBAD;
                          break;
                        case 65394:
                        case 65395:
                          this.memoryHighReader[a & 255] = this.memoryReader[a] = this.memoryReadNormal;
                          break;
                        case 65396:
                          if (this.cGBC) {
                            this.memoryHighReader[116] = this.memoryReader[65396] = this.memoryReadNormal;
                          } else {
                            this.memoryHighReader[116] = this.memoryReader[65396] = this.memoryReadBAD;
                          }
                          break;
                        case 65397:
                          this.memoryHighReader[117] = this.memoryReader[65397] = function(c, b) {
                            return 143 | c.memory[65397];
                          };
                          break;
                        case 65398:
                        case 65399:
                          this.memoryHighReader[a & 255] = this.memoryReader[a] = function(c, b) {
                            return 0;
                          };
                          break;
                        case 65400:
                        case 65401:
                        case 65402:
                        case 65403:
                        case 65404:
                        case 65405:
                        case 65406:
                        case 65407:
                          this.memoryHighReader[a & 255] = this.memoryReader[a] = this.memoryReadBAD;
                          break;
                        case 65535:
                          this.memoryHighReader[255] = this.memoryReader[65535] = function(c, b) {
                            return c.interruptsEnabled;
                          };
                          break;
                        default:
                          this.memoryReader[a] = this.memoryReadNormal;
                          this.memoryHighReader[a & 255] = this.memoryHighReadNormal;
                        }
                      } else {
                        this.memoryReader[a] = this.memoryReadBAD;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

解决方案

I started splitting the memoryReadJumpCompile into combining them into memoryHighRead and memoryRead functions. Takes about 1 hour per function.

Here is a example of the memoryReader, I completed them all 4 of them (memoryRead/memoryReadHigh/memoryWrite/memoryWriteHigh), not sure if it works, still over 100 errors! haha long way to go.

public long memoryReader(address) {
    //return memoryReader[address](this, address);
    if (address < 16384) {
        return memoryReadNormal(address);
    } else if (address < 32768) {
        return memoryReadROM(address);
    } else if (address < 38912) {
        return (cGBC) ? VRAMDATAReadCGBCPU(address) : VRAMDATAReadDMGCPU(address);
    } else if (address < 40960) {
        return (cGBC) ? VRAMCHRReadCGBCPU(address) : VRAMCHRReadDMGCPU(address);
    } else if (address >= 40960 && address < 49152) {
        if ((numRAMBanks == 1 / 16 && address < 41472) || numRAMBanks >= 1) {
            if (cMBC7) {
                return memoryReadMBC7(address);
            } else if (!cMBC3) {
                return memoryReadMBC(address);
            } else {
                return memoryReadMBC3(address);
            }
        } else {
            return memoryReadBAD();
        }
    } else if (address >= 49152 && address < 57344) {
        if (!cGBC || address < 53248) {
            return memoryReadNormal(address);
        } else {
            return memoryReadGBCMemory(address);
        }
    } else if (address >= 57344 && address < 65024) {
        if (!cGBC || address < 61440) {
            return memoryReadECHONormal(address);
        } else {
            return memoryReadECHOGBCMemory(address);
        }
    } else if (address < 65184) {
        return memoryReadOAM(address);
    } else if (cGBC && address >= 65184 && address < 65280) {
        return memoryReadNormal(address);
    } else if (address >= 65280) {
        switch (address) {
        case 65280:
            return 192 | memory[65280];
            break;
        case 65281:
            return (memory[65282] < 128) ? memory[65281] : 255;
            break;
        case 65282:
            if (cGBC) {
                return ((serialTimer <= 0) ? 124 : 252) | memory[65282];
            } else {
                return ((serialTimer <= 0) ? 126 : 254) | memory[65282];
            }
            break;
        case 65283:
            return memoryReadBAD();
            break;
        case 65284:
            memory[65284] = (memory[65284] + (DIVTicks >> 8)) & 255;
            DIVTicks &= 255;
            return memory[65284];
            break;
        case 65285:
        case 65286:
            return memoryReadNormal(address);
            break;
        case 65287:
            return 248 | memory[65287];
            break;
        case 65288:
        case 65289:
        case 65290:
        case 65291:
        case 65292:
        case 65293:
        case 65294:
            return memoryReadBAD();
            break;
        case 65295:
            return 224 | interruptsRequested;
            break;
        case 65296:
            return 128 | memory[65296];
            break;
        case 65297:
            return 63 | memory[65297];
            break;
        case 65298:
            return memoryReadNormal(address);
            break;
        case 65299:
            return memoryReadBAD();
            break;
        case 65300:
            return 191 | memory[65300];
            break;
        case 65301:
            return memoryReadBAD();
            break;
        case 65302:
            return 63 | memory[65302];
            break;
        case 65303:
            return memoryReadNormal(address);
            break;
        case 65304:
            return memoryReadBAD();
            break;
        case 65305:
            return 191 | memory[65305];
            break;
        case 65306:
            return 127 | memory[65306];
            break;
        case 65307:
            return memoryReadBAD();
            break;
        case 65308:
            return 159 | memory[65308];
            break;
        case 65309:
            return memoryReadBAD();
            break;
        case 65310:
            return 191 | memory[65310];
            break;
        case 65311:
        case 65312:
            return memoryReadBAD();
            break;
        case 65313:
        case 65314:
            return memoryReadNormal(address);
            break;
        case 65315:
            return 191 | memory[65315];
            break;
        case 65316:
        case 65317:
            return memoryReadNormal(address);
            break;
        case 65318:
            c.audioJIT();
            return 112 | memory[65318];
            break;
        case 65319:
        case 65320:
        case 65321:
        case 65322:
        case 65323:
        case 65324:
        case 65325:
        case 65326:
        case 65327:
            return memoryReadBAD();
            break;
        case 65328:
        case 65329:
        case 65330:
        case 65331:
        case 65332:
        case 65333:
        case 65334:
        case 65335:
        case 65336:
        case 65337:
        case 65338:
        case 65339:
        case 65340:
        case 65341:
        case 65342:
        case 65343:
            return (channel3canPlay) ? memory[65280 | (channel3lastSampleLookup >> 1)] : memory[address];
            break;
        case 65344:
            return memoryReadNormal(address);
            break;
        case 65345:
            return 128 | memory[65345] | modeSTAT;
            break;
        case 65346:
            return backgroundY;
            break;
        case 65347:
            return backgroundX;
            break;
        case 65348:
            return ((LCDisOn) ? memory[65348] : 0);
            break;
        case 65349:
        case 65350:
        case 65351:
        case 65352:
        case 65353:
            return memoryReadNormal(address);
            break;
        case 65354:
            return windowY;
            break;
        case 65355:
            return memoryReadNormal(address);
            break;
        case 65356:
            return memoryReadBAD();
            break;
        case 65357:
            return memoryReadNormal(address);
            break;
        case 65358:
            return memoryReadBAD();
            break;
        case 65359:
            return currVRAMBank;
            break;
        case 65360:
        case 65361:
        case 65362:
        case 65363:
        case 65364:
            return memoryReadNormal(address);
            break;
        case 65365:
            if (cGBC) {
                if (!LCDisOn && hdmaRunning) {
                    DMAWrite((memory[65365] & 127) + 1);
                    memory[65365] = 255;
                    hdmaRunning = false;
                }
                return memory[65365];
            } else {
                return memoryReadNormal(address);
            }
            break;
        case 65366:
            if (cGBC) {
                return 60 | ((memory[65366] >= 192) ? (2 | (memory[65366] & 193)) : (memory[65366] & 195));
            } else {
                return memoryReadNormal(address);
            }
            break;
        case 65367:
        case 65368:
        case 65369:
        case 65370:
        case 65371:
        case 65372:
        case 65373:
        case 65374:
        case 65375:
        case 65376:
        case 65377:
        case 65378:
        case 65379:
        case 65380:
        case 65381:
        case 65382:
        case 65383:
            return memoryReadBAD();
            break;
        case 65384:
        case 65385:
        case 65386:
        case 65387:
            return memoryReadNormal(address);
            break;
        case 65388:
            if (cGBC) {
                return 254 | memory[65388];
            } else {
                return memoryReadBAD();
            }
            break;
        case 65389:
        case 65390:
        case 65391:
            return memoryReadBAD();
            break;
        case 65392:
            if (cGBC) {
                return 64 | memory[65392];
            } else {
                return memoryReadBAD();
            }
            break;
        case 65393:
            return memoryReadBAD();
            break;
        case 65394:
        case 65395:
            return memoryReadNormal(address);
            break;
        case 65396:
            if (cGBC) {
                return memoryReadNormal(address);
            } else {
                return memoryReadBAD();
            }
            break;
        case 65397:
            return 143 | memory[65397];
            break;
        case 65398:
        case 65399:
            return 0;
            break;
        case 65400:
        case 65401:
        case 65402:
        case 65403:
        case 65404:
        case 65405:
        case 65406:
        case 65407:
            return memoryReadBAD();
            break;
        case 65535:
            return interruptsEnabled;
            break;
        default:
            return memoryReadNormal(address);
        }
    } else {
        return memoryReadBAD();
    }
}

这篇关于如何使用Javascript匿名函数转换成Java可能与开关?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆