Mots-clé : nitendo

HTML5 et réalisations : un projet assez impressionnant

Une personne a développé en JavaScript un émulateur complet de la Super NES : JSNES.
Cliquez ici pour le voir : http://fir.sh/projects/jsnes/

Si vous regardez le code source, c’est impressionnant : il a vraiment retranscrit les registres, et le code assembleur de la SNES.
Voici un extrait que j’ai trouvé assez épatant :

switch(opinf&0xFF){
  case 0:{
    // *******
    // * ADC *
    // *******

    // Add with carry.
    temp = this.REG_ACC + this.load(addr) + this.F_CARRY;
    this.F_OVERFLOW = ((!(((this.REG_ACC ^ this.load(addr)) & 0x80)!=0) && (((this.REG_ACC ^ temp) & 0x80))!=0)?1:0);
    this.F_CARRY = (temp>255?1:0);
    this.F_SIGN = (temp>>7)&1;
    this.F_ZERO = temp&0xFF;
    this.REG_ACC = (temp&255);
    cycleCount+=cycleAdd;
    break;

  }case 1:{
    // *******
    // * AND *
    // *******

    // AND memory with accumulator.
    this.REG_ACC = this.REG_ACC & this.load(addr);
    this.F_SIGN = (this.REG_ACC>>7)&1;
    this.F_ZERO = this.REG_ACC;
    //this.REG_ACC = temp;
    if(addrMode!=11)cycleCount+=cycleAdd; // PostIdxInd = 11
    break;
  }case 2:{
    // *******
    // * ASL *
    // *******