- Implementat un canal de só en crú, sense envelope, sweep ni res
This commit is contained in:
33
mem.cpp
33
mem.cpp
@@ -3,6 +3,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <SDL2/SDL.h>
|
||||
#include "APU.h"
|
||||
|
||||
#include "mbc_none.h"
|
||||
#include "mbc1.h"
|
||||
@@ -67,6 +68,8 @@ namespace mem
|
||||
mem::writeRam = mbc1::writeRam;
|
||||
break;
|
||||
};
|
||||
|
||||
APU::init();
|
||||
}
|
||||
|
||||
void reset()
|
||||
@@ -85,6 +88,7 @@ namespace mem
|
||||
for (int i=0; i<65536; ++i) { tags[i] = MEMTAG_NONE; }
|
||||
|
||||
resetMbc();
|
||||
APU::reset();
|
||||
}
|
||||
|
||||
uint8_t getKeypad(uint8_t value)
|
||||
@@ -123,7 +127,7 @@ namespace mem
|
||||
} else {
|
||||
if (address==0xFF00) {
|
||||
hram[address - 0XFE00] = getKeypad(hram[address - 0XFE00]);
|
||||
}
|
||||
} else if (address>=0xFF10 && address<=0xFF26) { return APU::readRegister(address); }
|
||||
return hram[address - 0XFE00];
|
||||
}
|
||||
}
|
||||
@@ -141,11 +145,23 @@ namespace mem
|
||||
} else if (address < 0xFE00) {
|
||||
wram[address - 0xE000] = value;
|
||||
} else {
|
||||
if ( (address==0xFF50) && ((value&0x01) != 1) ) return; //Only allow disabling boot room
|
||||
if ( (address==0xFF00) ) { value = value & 0x30; }
|
||||
if ( (address==0xFF04) ) { hram[address-0xFE00] = 0; return; }
|
||||
if ( (address==0xFF0F) ) { hram[address-0xFE00] = value; sm83::processInterrupts(); return; }
|
||||
if ( (address==0xFF46) ) mem::init_dma_transfer(value);
|
||||
if ( (address==0xFF50) && ((value&0x01) != 1) ) {
|
||||
return; //Only allow disabling boot room
|
||||
} else if ( (address==0xFF00) ) {
|
||||
value = value & 0x30;
|
||||
} else if ( (address==0xFF04) ) {
|
||||
hram[address-0xFE00] = 0;
|
||||
return;
|
||||
} else if ( (address==0xFF0F) ) { // IF
|
||||
hram[address-0xFE00] = value;
|
||||
sm83::processInterrupts();
|
||||
return;
|
||||
} else if (address>=0xFF10 && address<=0xFF26) { // APU
|
||||
APU::writeRegister(address, value);
|
||||
return;
|
||||
} else if ( (address==0xFF46) ) { // OAM DMA
|
||||
mem::init_dma_transfer(value);
|
||||
}
|
||||
hram[address - 0xFE00] = value;
|
||||
}
|
||||
}
|
||||
@@ -190,7 +206,9 @@ namespace mem
|
||||
div_counter += dt;
|
||||
if (div_counter>=256) {
|
||||
div_counter -= 256;
|
||||
bool bitset = DIV&0x10;
|
||||
DIV++;
|
||||
if (bitset && !(DIV&0x10)) APU::incDIVAPU();
|
||||
}
|
||||
|
||||
// Timer
|
||||
@@ -209,6 +227,9 @@ namespace mem
|
||||
|
||||
}
|
||||
|
||||
// APU
|
||||
APU::update(dt);
|
||||
|
||||
// OAM DMA
|
||||
if (dma_pos<160) {
|
||||
dma_dots += dt;
|
||||
|
||||
Reference in New Issue
Block a user