void riot_Reset(void) { riot_SetDRA(0); riot_SetDRB(0); riot_timing = false; riot_timer = TIM64T; riot_intervals = 0; riot_clocks = 0; riot_elapsed = false; riot_currentTime = 0; }
// ---------------------------------------------------------------------------- // Write // ---------------------------------------------------------------------------- void memory_Write(word address, byte data) { if(!memory_rom[address]) { switch(address) { case WSYNC: if(!(cartridge_flags & 128)) { memory_ram[WSYNC] = true; } break; case INPTCTRL: if(data == 22 && cartridge_IsLoaded( )) { cartridge_Store( ); } else if(data == 2 && bios_enabled) { bios_Store( ); } break; case INPT0: break; case INPT1: break; case INPT2: break; case INPT3: break; case INPT4: break; case INPT5: break; case AUDC0: tia_SetRegister(AUDC0, data); break; case AUDC1: tia_SetRegister(AUDC1, data); break; case AUDF0: tia_SetRegister(AUDF0, data); break; case AUDF1: tia_SetRegister(AUDF1, data); break; case AUDV0: tia_SetRegister(AUDV0, data); break; case AUDV1: tia_SetRegister(AUDV1, data); break; case SWCHA: /*gdement: Writing here actually writes to DRA inside the RIOT chip. This value only indirectly affects output of SWCHA. Ditto for SWCHB.*/ riot_SetDRA(data); break; case SWCHB: riot_SetDRB(data); break; case TIM1T: case TIM1T | 0x8: riot_SetTimer(TIM1T, data); break; case TIM8T: case TIM8T | 0x8: riot_SetTimer(TIM8T, data); break; case TIM64T: case TIM64T | 0x8: riot_SetTimer(TIM64T, data); break; case T1024T: case T1024T | 0x8: riot_SetTimer(T1024T, data); break; default: memory_ram[address] = data; if(address >= 8256 && address <= 8447) { memory_ram[address - 8192] = data; } else if(address >= 8512 && address <= 8702) { memory_ram[address - 8192] = data; } else if(address >= 64 && address <= 255) { memory_ram[address + 8192] = data; } else if(address >= 320 && address <= 511) { memory_ram[address + 8192] = data; } break; /*TODO: gdement: test here for debug port. Don't put it in the switch because that will change behavior.*/ } } else { cartridge_Write(address, data); } }