uint8_t port_read_byte(uint16_t address) { #ifdef DEBUG_SUPPORT if (debugger.data.ports[address] & DBG_PORT_READ) { open_debugger(HIT_PORT_READ_BREAKPOINT, address); } #endif return port_read(address, false); }
void Ui_MainWindowBase::ConfigControlMenu(void) { int i; actionReset = new Action_Control(this); actionReset->setObjectName(QString::fromUtf8("actionReset")); connect(actionReset, SIGNAL(triggered()), this, SLOT(OnReset())); // OK? if(using_flags->is_use_special_reset()) { actionSpecial_Reset = new Action_Control(this); actionSpecial_Reset->setObjectName(QString::fromUtf8("actionSpecial_Reset")); connect(actionSpecial_Reset, SIGNAL(triggered()), this, SLOT(OnSpecialReset())); // OK? } actionExit_Emulator = new Action_Control(this); actionExit_Emulator->setObjectName(QString::fromUtf8("actionExit_Emulator")); //connect(actionExit_Emulator, SIGNAL(triggered()), // this, SLOT(on_actionExit_triggered())); // OnGuiExit()? if(using_flags->is_use_auto_key()) { actionPaste_from_Clipboard = new Action_Control(this); actionPaste_from_Clipboard->setObjectName(QString::fromUtf8("actionPaste_from_Clipboard")); connect(actionPaste_from_Clipboard, SIGNAL(triggered()), this, SLOT(OnStartAutoKey())); // OK? actionStop_Pasting = new Action_Control(this); actionStop_Pasting->setObjectName(QString::fromUtf8("actionStop_Pasting")); connect(actionStop_Pasting, SIGNAL(triggered()), this, SLOT(OnStopAutoKey())); // OK? } if(using_flags->is_use_state()) { actionSave_State = new Action_Control(this); actionSave_State->setObjectName(QString::fromUtf8("actionSave_State")); connect(actionSave_State, SIGNAL(triggered()), this, SLOT(OnSaveState())); // OK? actionLoad_State = new Action_Control(this); actionLoad_State->setObjectName(QString::fromUtf8("actionLoad_State")); connect(actionLoad_State, SIGNAL(triggered()), this, SLOT(OnLoadState())); // OK? } if(using_flags->is_use_debugger()) { for(i = 0; i < _MAX_DEBUGGER; i++) { QString tmps; tmps.setNum(i); actionDebugger[i] = new Action_Control(this); actionDebugger[i]->setObjectName(QString::fromUtf8("actionDebugger") + tmps); actionDebugger[i]->binds->setValue1(i); connect(actionDebugger[i], SIGNAL(triggered()), actionDebugger[i]->binds, SLOT(open_debugger())); // OK? connect(actionDebugger[i]->binds, SIGNAL(on_open_debugger(int)), this, SLOT(OnOpenDebugger(int))); // OK? } } ConfigCpuSpeed(); }
void port_write_byte(uint16_t address, uint8_t value) { #ifdef DEBUG_SUPPORT if (debugger.data.ports[address] & DBG_PORT_FREEZE) { return; } if (debugger.data.ports[address] & DBG_PORT_WRITE) { open_debugger(HIT_PORT_WRITE_BREAKPOINT, address); } #endif port_write(address, value, false); }
static void emu_main_loop_inner(void) { if (!emulationPaused) { if (cpuEvents & EVENT_RESET) { gui_console_printf("[CEmu] Calculator reset triggered...\n"); cpu_reset(); cpuEvents &= ~EVENT_RESET; } #ifdef DEBUG_SUPPORT if (!cpu.halted && (cpuEvents & EVENT_DEBUG_STEP)) { cpuEvents &= ~EVENT_DEBUG_STEP; open_debugger(DBG_STEP, 0); } #endif if (!asic.shipModeEnabled) { sched_process_pending_events(); cpu_execute(); } else { gui_emu_sleep(50); } } else { gui_emu_sleep(50); } }
/* Write to the 0x0XXX range of ports */ static void control_write(const uint16_t pio, const uint8_t byte) { uint8_t index = pio & 0x7F; switch (index) { case 0x00: control.ports[index] = byte; switch (control.readBatteryStatus) { case 3: /* Battery Level is 0 */ control.readBatteryStatus = (control.setBatteryStatus == BATTERY_0) ? 0 : (byte == 0x83) ? 5 : 0; break; case 5: /* Battery Level is 1 */ control.readBatteryStatus = (control.setBatteryStatus == BATTERY_1) ? 0 : (byte == 0x03) ? 7 : 0; break; case 7: /* Battery Level is 2 */ control.readBatteryStatus = (control.setBatteryStatus == BATTERY_2) ? 0 : (byte == 0x83) ? 9 : 0; break; case 9: /* Battery Level is 3 (Or 4) */ control.readBatteryStatus = (control.setBatteryStatus == BATTERY_3) ? 0 : (byte == 0x03) ? 11 : 0; break; } break; case 0x01: control.cpuSpeed = byte & 19; switch(control.cpuSpeed & 3) { case 0: set_cpu_clock_rate(6e6); /* 6 MHz */ break; case 1: set_cpu_clock_rate(12e6); /* 12 MHz */ break; case 2: set_cpu_clock_rate(24e6); /* 24 MHz */ break; case 3: set_cpu_clock_rate(48e6); /* 48 MHz */ break; default: break; } gui_console_printf("[CEmu] CPU clock rate set to: %d MHz\n", 6*(1<<(control.cpuSpeed & 3))); #ifdef DEBUG_SUPPORT if (cpuEvents & EVENT_DEBUG_STEP) { cpuEvents &= ~EVENT_DEBUG_STEP; open_debugger(DBG_STEP, 0); } #endif break; case 0x06: control.ports[index] = byte & 7; break; case 0x07: control.readBatteryStatus = (byte & 0x90) ? 1 : 0; break; case 0x09: switch (control.readBatteryStatus) { case 1: /* Battery is bad */ control.readBatteryStatus = (control.setBatteryStatus == BATTERY_DISCHARGED) ? 0 : (byte & 0x80) ? 0 : 3; break; } control.ports[index] = byte; /* Appears to enter low-power mode (For now; this will be fine) */ if (byte == 0xD4) { asic.ship_mode_enabled = true; control.ports[0] |= 0x40; // Turn calc off cpuEvents |= EVENT_RESET; } break; case 0x0A: control.readBatteryStatus += (control.readBatteryStatus == 3) ? 1 : 0; control.ports[index] = byte; break; case 0x0B: case 0x0C: control.readBatteryStatus = 0; break; case 0x0D: control.ports[index] = (byte & 0xF) << 4 | (byte & 0xF); break; case 0x0F: control.ports[index] = byte & 3; break; case 0x1D: case 0x1E: case 0x1F: write8(control.privileged, (index - 0x1D) << 3, byte); break; case 0x28: if (cpu.registers.PC < control.privileged) { mem.flash.locked = (byte & 4) == 0; } control.ports[index] = byte & 247; break; default: control.ports[index] = byte; break; } }