20static const double apuCyclesPerMaster = (32040 * 32) / (1364 * 262 * 60.0);
21static const double apuCyclesPerMasterPal = (32040 * 32) / (1364 * 312 * 50.0);
23static const uint8_t bootRom[0x40] = {
24 0xcd, 0xef, 0xbd, 0xe8, 0x00, 0xc6, 0x1d, 0xd0, 0xfc, 0x8f, 0xaa,
25 0xf4, 0x8f, 0xbb, 0xf5, 0x78, 0xcc, 0xf4, 0xd0, 0xfb, 0x2f, 0x19,
26 0xeb, 0xf4, 0xd0, 0xfc, 0x7e, 0xf4, 0xd0, 0x0b, 0xe4, 0xf5, 0xcb,
27 0xf4, 0xd7, 0x00, 0xfc, 0xd0, 0xf3, 0xab, 0x01, 0x10, 0xef, 0x7e,
28 0xf4, 0x10, 0xeb, 0xba, 0xf6, 0xda, 0x00, 0xba, 0xf4, 0xc4, 0xf4,
29 0xdd, 0x5d, 0xd0, 0xdb, 0x1f, 0x00, 0x00, 0xc0, 0xff};
33 for (
int i = 0; i < 0x10000; i++) {
37 for (
int i = 0; i < 0x40; i++) {
38 ram[0xffc0 + i] = bootRom[i];
45 for (
int i = 0; i < 0x10000; i++) {
49 for (
int i = 0; i < 0x40; i++) {
50 ram[0xffc0 + i] = bootRom[i];
57 for (
int i = 0; i < 3; i++) {
83 for (
int i = 0; i < 3; i++) {
84 if (
timer_[i].cycles == 0) {
85 timer_[i].cycles = i == 2 ? 16 : 128;
127 uint8_t ret =
timer_[adr - 0xfd].counter;
128 timer_[adr - 0xfd].counter = 0;
133 return bootRom[adr - 0xffc0];
144 for (
int i = 0; i < 3; i++) {
145 if (!
timer_[i].enabled && (val & (1 << i))) {
149 timer_[i].enabled = val & (1 << i);
185 timer_[adr - 0xfa].target = val;