| 284 | } |
| 285 | |
| 286 | void MainWindow::debugExecute(uint32_t offset, uint8_t cmd) { |
| 287 | m_useSoftCom = true; |
| 288 | |
| 289 | if (offset == 0xFF) { |
| 290 | int tmp; |
| 291 | switch (cmd) { |
| 292 | case CMD_ABORT: |
| 293 | ui->debuggerLabel->setText(QStringLiteral("Program Aborted")); |
| 294 | debugRaise(); |
| 295 | m_useSoftCom = false; |
| 296 | return; // don't exit the debugger |
| 297 | case CMD_DEBUG: |
| 298 | ui->debuggerLabel->setText(QStringLiteral("Program Entered Debugger")); |
| 299 | debugRaise(); |
| 300 | m_useSoftCom = false; |
| 301 | return; // don't exit the debugger |
| 302 | case CMD_SET_BREAKPOINT: |
| 303 | breakAdd(breakNextLabel(), cpu.registers.DE, true, false, false); |
| 304 | break; |
| 305 | case CMD_REM_BREAKPOINT: |
| 306 | breakRemove(cpu.registers.DE); |
| 307 | break; |
| 308 | case CMD_SET_R_WATCHPOINT: |
| 309 | watchRemove(cpu.registers.DE); |
| 310 | if (cpu.registers.bc.l > 0) { |
| 311 | watchAdd(watchNextLabel(), cpu.registers.DE, cpu.registers.DE + cpu.registers.bc.l - 1, DBG_MASK_READ, false, false); |
| 312 | } |
| 313 | break; |
| 314 | case CMD_SET_W_WATCHPOINT: |
| 315 | watchRemove(cpu.registers.DE); |
| 316 | if (cpu.registers.bc.l > 0) { |
| 317 | watchAdd(watchNextLabel(), cpu.registers.DE, cpu.registers.DE + cpu.registers.bc.l - 1, DBG_MASK_WRITE, false, false); |
| 318 | } |
| 319 | break; |
| 320 | case CMD_SET_RW_WATCHPOINT: |
| 321 | watchRemove(cpu.registers.DE); |
| 322 | if (cpu.registers.bc.l > 0) { |
| 323 | watchAdd(watchNextLabel(), cpu.registers.DE, cpu.registers.DE + cpu.registers.bc.l - 1, DBG_MASK_RW, false, false); |
| 324 | } |
| 325 | break; |
| 326 | case CMD_REM_WATCHPOINT: |
| 327 | watchRemove(cpu.registers.DE); |
| 328 | break; |
| 329 | case CMD_REM_ALL_BREAK: |
| 330 | tmp = m_breakpoints->rowCount(); |
| 331 | for (int i = 0; i < tmp; i++) { |
| 332 | breakRemoveRow(0); |
| 333 | } |
| 334 | break; |
| 335 | case CMD_REM_ALL_WATCH: |
| 336 | tmp = m_watchpoints->rowCount(); |
| 337 | for (int i = 0; i < tmp; i++) { |
| 338 | watchRemoveRow(0); |
| 339 | } |
| 340 | break; |
| 341 | case CMD_SET_E_WATCHPOINT: |
| 342 | watchRemove(cpu.registers.DE); |
| 343 | if (cpu.registers.bc.l > 0) { |