57 if (hard) memset(
ram, 0,
sizeof(
ram));
103 input_latch(&
input1,
true);
104 input_latch(&
input2,
true);
105 input_latch(&
input1,
false);
106 input_latch(&
input2,
false);
107 for (
int i = 0; i < 16; i++) {
108 uint8_t val = input_read(&
input1);
111 val = input_read(&
input2);
188 bool starting_vblank =
false;
203 if (starting_vblank) {
237 for (
int i = 0; i < cycles; i += 2) {
246 count = sync_cycles - (
cycles_ % sync_cycles);
323 uint8_t bank = adr >> 16;
325 if (bank == 0x7e || bank == 0x7f) {
326 return ram[((bank & 1) << 16) | adr];
328 if (bank < 0x40 || (bank >= 0x80 && bank < 0xc0)) {
332 if (adr >= 0x2100 && adr < 0x2200) {
341 if (adr >= 0x4200 && adr < 0x4220) {
344 if (adr >= 0x4300 && adr < 0x4380) {
353 uint8_t val =
Rread(adr);
478 uint8_t bank = adr >> 16;
480 if (bank == 0x7e || bank == 0x7f) {
481 ram[((bank & 1) << 16) | adr] = val;
483 if (bank < 0x40 || (bank >= 0x80 && bank < 0xc0)) {
487 if (adr >= 0x2100 && adr < 0x2200) {
491 input_latch(&
input1, val & 1);
492 input_latch(&
input2, val & 1);
494 if (adr >= 0x4200 && adr < 0x4220) {
497 if (adr >= 0x4300 && adr < 0x4380) {
507 uint8_t bank = adr >> 16;
509 if ((bank < 0x40 || (bank >= 0x80 && bank < 0xc0)) && adr < 0x8000) {
511 if (adr < 0x2000 || adr >= 0x6000)
return 8;
512 if (adr < 0x4000 || adr >= 0x4200)
return 6;
525 uint8_t rv =
Read(adr);
569 int start = (recalc) ? 0x800000 : 0;
571 for (
int i = start; i < 0x1000000; i++) {
void Reset(bool hard=false)
void set_int_delay(bool delay)
uint16_t port_auto_read_[4]
void RunCycles(int cycles)
memory::MemoryImpl memory_
void InitAccessTime(bool recalc)
void Init(std::vector< uint8_t > &rom_data)
void SyncCycles(bool start, int sync_cycles)
uint8_t ReadReg(uint16_t adr)
uint8_t Rread(uint32_t adr)
void CpuIdle(bool waiting)
void SetSamples(int16_t *sample_data, int wanted_samples)
uint8_t CpuRead(uint32_t adr)
std::vector< uint8_t > access_time
void Write(uint32_t adr, uint8_t val)
double apu_catchup_cycles_
void CpuWrite(uint32_t adr, uint8_t val)
void WriteBBus(uint8_t adr, uint8_t val)
int GetAccessTime(uint32_t adr)
void SetButtonState(int player, int button, bool pressed)
void SetPixels(uint8_t *pixel_data)
uint32_t next_horiz_event
uint16_t multiply_result_
void WriteReg(uint16_t adr, uint8_t val)
std::vector< uint8_t > rom_data
uint8_t ReadBBus(uint8_t adr)
void Reset(bool hard=false)
uint8_t Read(uint32_t adr)
std::array< uint8_t, 6 > in_ports_
std::array< uint8_t, 4 > out_ports_
void RunCycles(uint64_t cycles)
auto v_pos() const -> uint16_t override
void set_h_pos(uint16_t value) override
void set_open_bus(uint8_t value) override
auto h_pos() const -> uint16_t override
void init_hdma_request() override
void run_hdma_request() override
uint8_t cart_read(uint8_t bank, uint16_t adr)
auto open_bus() const -> uint8_t override
void set_v_pos(uint16_t value) override
auto pal_timing() const -> bool override
void Initialize(const std::vector< uint8_t > &romData, bool verbose=false)
void cart_write(uint8_t bank, uint16_t adr, uint8_t val)
uint8_t Read(uint8_t adr, bool latch)
void Write(uint8_t adr, uint8_t val)
void PutPixels(uint8_t *pixel_data)
uint8_t input_read(Input *input)
void input_latch(Input *input, bool value)
void Reset(MemoryImpl *memory)
void HandleDma(SNES *snes, MemoryImpl *memory, int cpu_cycles)
void Write(MemoryImpl *memory, uint16_t adr, uint8_t val)
uint8_t Read(MemoryImpl *memory, uint16_t adr)
void StartDma(MemoryImpl *memory, uint8_t val, bool hdma)