CMDERR debug_console_execute_command(const char *command, int echo) { CMDERR result; /* echo if requested */ if (echo) debug_console_printf(">%s\n", command); /* parse and execute */ result = internal_parse_command(command, TRUE); /* display errors */ if (result != CMDERR_NONE) { if (!echo) debug_console_printf(">%s\n", command); debug_console_printf(" %*s^\n", CMDERR_ERROR_OFFSET(result), ""); debug_console_printf("%s\n", debug_cmderr_to_string(result)); } /* update all views */ if (echo) { debug_view_update_all(); debug_refresh_display(); } return result; }
static void video_debug(running_machine &machine, int ref, int params, const char *param[]) { mbc55x_state *mstate = machine.driver_data<mbc55x_state>(); if(params>0) { sscanf(param[0],"%d",&mstate->m_debug_video); } else { debug_console_printf(machine,"Error usage : mbc55x_vid_debug <debuglevel>\n"); debug_console_printf(machine,"Current debuglevel=%02X\n",mstate->m_debug_video); } }
void debug_console_init(running_machine *machine) { /* allocate text buffers */ console_textbuf = text_buffer_alloc(CONSOLE_BUF_SIZE, CONSOLE_MAX_LINES); if (!console_textbuf) return; errorlog_textbuf = text_buffer_alloc(ERRORLOG_BUF_SIZE, ERRORLOG_MAX_LINES); if (!errorlog_textbuf) return; /* print the opening lines */ debug_console_printf("MAME new debugger version %s\n", build_version); debug_console_printf("Currently targeting %s (%s)\n", Machine->gamedrv->name, Machine->gamedrv->description); /* request callback upon exiting */ add_exit_callback(machine, debug_console_exit); }
void debug_console_init(running_machine &machine) { /* allocate text buffers */ console_textbuf = text_buffer_alloc(CONSOLE_BUF_SIZE, CONSOLE_MAX_LINES); if (!console_textbuf) return; errorlog_textbuf = text_buffer_alloc(ERRORLOG_BUF_SIZE, ERRORLOG_MAX_LINES); if (!errorlog_textbuf) return; /* print the opening lines */ debug_console_printf(machine, "%s debugger version %s\n", emulator_info::get_appname(), build_version); debug_console_printf(machine, "Currently targeting %s (%s)\n", machine.system().name, machine.system().description); /* request callback upon exiting */ machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debug_console_exit), &machine)); }
void MainWindow::mountImage(bool changedTo) { // The image interface index was assigned to the QAction's data memeber const int imageIndex = dynamic_cast<QAction*>(sender())->data().toInt(); image_interface_iterator iter(m_machine->root_device()); device_image_interface *img = iter.byindex(imageIndex); if (img == NULL) { debug_console_printf(*m_machine, "Something is wrong with the mount menu.\n"); refreshAll(); return; } // File dialog QString filename = QFileDialog::getOpenFileName(this, "Select an image file", QDir::currentPath(), tr("All files (*.*)")); if (img->load(filename.toUtf8().data()) != IMAGE_INIT_PASS) { debug_console_printf(*m_machine, "Image could not be mounted.\n"); refreshAll(); return; } // Activate the unmount menu option QAction* unmountAct = sender()->parent()->findChild<QAction*>("unmount"); unmountAct->setEnabled(true); // Set the mount name QMenu* parentMenuItem = dynamic_cast<QMenu*>(sender()->parent()); QString baseString = parentMenuItem->title(); baseString.truncate(baseString.lastIndexOf(QString(" : "))); const QString newTitle = baseString + QString(" : ") + QString(img->filename()); parentMenuItem->setTitle(newTitle); debug_console_printf(*m_machine, "Image %s mounted successfully.\n", filename.toUtf8().data()); refreshAll(); }
void DasmWindow::toggleBreakpointAtCursor(bool changedTo) { if (m_dasmView->view()->cursor_visible()) { offs_t const address = downcast<debug_view_disasm *>(m_dasmView->view())->selected_address(); device_t *const device = m_dasmView->view()->source()->device(); device_debug *const cpuinfo = device->debug(); // Find an existing breakpoint at this address INT32 bpindex = -1; for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first(); bp != nullptr; bp = bp->next()) { if (address == bp->address()) { bpindex = bp->index(); break; } } // If none exists, add a new one if (bpindex == -1) { bpindex = cpuinfo->breakpoint_set(address, nullptr, nullptr); debug_console_printf(*m_machine, "Breakpoint %X set\n", bpindex); } else { cpuinfo->breakpoint_clear(bpindex); debug_console_printf(*m_machine, "Breakpoint %X cleared\n", bpindex); } m_machine->debug_view().update_all(); m_machine->debugger().refresh_display(); } refreshAll(); }
/* access to the first 128K or ram. */ void vid_set_gctrl(int data) { GCtrl=data; #ifdef MAME_DEBUG if (LogRegWrites) debug_console_printf("I28-PB=$%2X, %2X-%s-%s-%s-%s-%s-%s PC=%4X\n", data, data & GCtrlAddrLines, data & GCtrlFS ? "FS" : " ", data & GCtrlControl ? "CT" : " ", data & GCtrlChrGfx ? "Ch" : "Gf", data & GCtrlHiLo ? "Hi" : "Lo", data & GCtrlSWChar ? "C0" : "C1", data & GCtrlWI ? "Wi" : " ", activecpu_get_pc()); #endif }
void MainWindow::unmountImage(bool changedTo) { // The image interface index was assigned to the QAction's data memeber const int imageIndex = dynamic_cast<QAction*>(sender())->data().toInt(); image_interface_iterator iter(m_machine->root_device()); device_image_interface *img = iter.byindex(imageIndex); img->unload(); // Deactivate the unmount menu option dynamic_cast<QAction*>(sender())->setEnabled(false); // Set the mount name QMenu* parentMenuItem = dynamic_cast<QMenu*>(sender()->parent()); QString baseString = parentMenuItem->title(); baseString.truncate(baseString.lastIndexOf(QString(" : "))); const QString newTitle = baseString + QString(" : ") + QString("[empty slot]"); parentMenuItem->setTitle(newTitle); debug_console_printf(*m_machine, "Image successfully unmounted.\n"); refreshAll(); }
void DasmWindow::enableBreakpointAtCursor(bool changedTo) { if (m_dasmView->view()->cursor_visible()) { offs_t const address = downcast<debug_view_disasm *>(m_dasmView->view())->selected_address(); device_t *const device = m_dasmView->view()->source()->device(); device_debug *const cpuinfo = device->debug(); // Find an existing breakpoint at this address device_debug::breakpoint* bp = cpuinfo->breakpoint_first(); while ((bp != nullptr) && (bp->address() != address)) bp = bp->next(); if (bp != nullptr) { cpuinfo->breakpoint_enable(bp->index(), !bp->enabled()); debug_console_printf(*m_machine, "Breakpoint %X %s\n", (UINT32)bp->index(), bp->enabled() ? "enabled" : "disabled"); m_machine->debug_view().update_all(); m_machine->debugger().refresh_display(); } } refreshAll(); }
void dgn_beta_state::UpdateBanks(int first, int last) { address_space &space_0 = m_maincpu->space(AS_PROGRAM); address_space &space_1 = machine().device(DMACPU_TAG)->memory().space(AS_PROGRAM); int Page; UINT8 *readbank; int bank_start; int bank_end; int MapPage; char page_num[10]; LOG_BANK_UPDATE(("\n\nUpdating banks %d to %d at PC=$%X\n",first,last,space_0.device().safe_pc())); for(Page=first;Page<=last;Page++) { sprintf(page_num,"bank%d",Page+1); bank_start = bank_info[Page].start; bank_end = bank_info[Page].end; // bank16 and bank17 are mapped to the same page with a hole for the IO memory if (!is_last_page(Page)) MapPage = m_PageRegs[m_TaskReg][Page].value; else MapPage = m_PageRegs[m_TaskReg][LastPage].value; // // Map block, $00-$BF are ram, $FC-$FF are Boot ROM // if ((MapPage*4) < ((m_ram->size() / 1024)-1)) // Block is ram { if (!is_last_page(Page)) { readbank = &m_ram->pointer()[MapPage*RamPageSize]; if(m_LogDatWrites) debug_console_printf(machine(), "Mapping page %X, pageno=%X, mess_ram)[%X]\n",Page,MapPage,(MapPage*RamPageSize)); } else { readbank = &m_ram->pointer()[(MapPage*RamPageSize)-256]; logerror("Error RAM in Last page !\n"); } write8_delegate func = bank_info[Page].func; if (!func.isnull()) func.late_bind(*this); space_0.install_write_handler(bank_start, bank_end, func); space_1.install_write_handler(bank_start, bank_end, func); } else // Block is rom, or undefined { if (MapPage>0xfB) { if (Page!=IOPage+1) readbank=&m_system_rom[(MapPage-0xFC)*0x1000]; else readbank=&m_system_rom[0x3F00]; } else readbank=m_system_rom; space_0.unmap_write(bank_start, bank_end); space_1.unmap_write(bank_start, bank_end); } m_PageRegs[m_TaskReg][Page].memory=readbank; membank(page_num)->set_base(readbank); LOG_BANK_UPDATE(("UpdateBanks:MapPage=$%02X readbank=$%X\n",MapPage,(int)(FPTR)readbank)); LOG_BANK_UPDATE(("PageRegsSet Task=%X Page=%x\n",m_TaskReg,Page)); //LOG_BANK_UPDATE(("%X)\n",membank(Page+1))); LOG_BANK_UPDATE(("memory_install_write8_handler CPU=0\n")); LOG_BANK_UPDATE(("memory_install_write8_handler CPU=1\n")); } }
/* jamtable disassembler */ static void jamtable_disasm(running_machine &machine, address_space *space,UINT32 address,UINT32 size) // 0xff000080 == fff00080 { UINT32 base,addr; UINT32 opcode,op1,op2; char sop1[16]; char sop2[16]; char pcrel[16]; int prefix; addr=address; while (1) { base=addr; opcode=space->read_byte(addr); addr++; op1=space->read_dword(addr); addr+=4; op2=space->read_dword(addr); addr+=4; if (opcode == 0xe1) { opcode=op2 & 255; op2=op1; //op1=edi; sprintf(sop2,"%08X",op2); sprintf(sop1,"ACC"); sprintf(pcrel,"PC+ACC"); prefix=1; } else { sprintf(sop2,"%08X",op2); sprintf(sop1,"%08X",op1); sprintf(pcrel,"%08X",base+9+op1); prefix=0; } debug_console_printf(machine,"%08X ",base); // dl=instr ebx=par1 eax=par2 switch (opcode) { case 0x01: // if ((op2 & 0xff) == 0x880) op1=op1 & 0xfffffffd // out cf8,op2 // out cfc,op1 // out cf8,0 // cf8 (CONFIG_ADDRESS) format: // 31 30 24 23 16 15 11 10 8 7 2 1 0 // +-+----------+------------+---------------+-----------------+-----------------+-+-+ // | | Reserved | Bus Number | Device Number | Function Number | Register Number |0|0| // +-+----------+------------+---------------+-----------------+-----------------+-+-+ // 31 - Enable bit debug_console_printf(machine,"POKEPCI PCICONF[%s]=%s\n",sop2,sop1); break; case 0x02: debug_console_printf(machine,"OUTB PORT[%s]=%s\n",sop2,sop1); break; case 0x03: debug_console_printf(machine,"POKE MEM[%s]=%s\n",sop2,sop1); break; case 0x04: debug_console_printf(machine,"BNE IF ACC != %s THEN PC=%s\n",sop2,pcrel); break; case 0x05: // out cf8,op2 // in acc,cfc debug_console_printf(machine,"PEEKPCI ACC=PCICONF[%s]\n",sop2); break; case 0x06: debug_console_printf(machine,"AND/OR ACC=(ACC & %s) | %s\n",sop2,sop1); break; case 0x07: debug_console_printf(machine,"BRA PC=%s\n",pcrel); break; case 0x08: debug_console_printf(machine,"INB ACC=PORT[%s]\n",sop2); break; case 0x09: debug_console_printf(machine,"PEEK ACC=MEM[%s]\n",sop2); break; case 0xee: debug_console_printf(machine,"END\n"); break; default: debug_console_printf(machine,"NOP ????\n"); break; } if (opcode == 0xee) break; if (size <= 9) break; size-=9; } }
bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) { disasmview_info *const dasmview = downcast<disasmview_info *>(m_views[0].get()); switch (HIWORD(wparam)) { // menu selections case 0: switch (LOWORD(wparam)) { case ID_TOGGLE_BREAKPOINT: if (dasmview->cursor_visible()) { offs_t const address = dasmview->selected_address(); device_debug *const debug = dasmview->source_device()->debug(); INT32 bpindex = -1; // first find an existing breakpoint at this address for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != NULL; bp = bp->next()) { if (address == bp->address()) { bpindex = bp->index(); break; } } // if it doesn't exist, add a new one if (!is_main_console()) { if (bpindex == -1) { bpindex = debug->breakpoint_set(address, NULL, NULL); debug_console_printf(machine(), "Breakpoint %X set\n", bpindex); } else { debug->breakpoint_clear(bpindex); debug_console_printf(machine(), "Breakpoint %X cleared\n", bpindex); } machine().debug_view().update_all(); debugger_refresh_display(machine()); } else if (dasmview->source_is_visible_cpu()) { astring command; if (bpindex == -1) command.printf("bpset 0x%X", address); else command.printf("bpclear 0x%X", bpindex); debug_console_execute_command(machine(), command, 1); } } return true; case ID_DISABLE_BREAKPOINT: if (dasmview->cursor_visible()) { offs_t const address = dasmview->selected_address(); device_debug *const debug = dasmview->source_device()->debug(); // first find an existing breakpoint at this address device_debug::breakpoint *bp = debug->breakpoint_first(); while ((bp != NULL) && (bp->address() != address)) bp = bp->next(); // if it doesn't exist, add a new one if (bp != NULL) { if (!is_main_console()) { debug->breakpoint_enable(bp->index(), !bp->enabled()); debug_console_printf(machine(), "Breakpoint %X %s\n", (UINT32)bp->index(), bp->enabled() ? "enabled" : "disabled"); machine().debug_view().update_all(); debugger_refresh_display(machine()); } else if (dasmview->source_is_visible_cpu()) { astring command; command.printf(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", (UINT32)bp->index()); debug_console_execute_command(machine(), command, 1); } } } return true; case ID_RUN_TO_CURSOR: if (dasmview->cursor_visible()) { offs_t const address = dasmview->selected_address(); if (dasmview->source_is_visible_cpu()) { astring command; command.printf("go 0x%X", address); debug_console_execute_command(machine(), command, 1); } else { dasmview->source_device()->debug()->go(address); } } return true; case ID_SHOW_RAW: dasmview->set_right_column(DASM_RIGHTCOL_RAW); recompute_children(); return true; case ID_SHOW_ENCRYPTED: dasmview->set_right_column(DASM_RIGHTCOL_ENCRYPTED); recompute_children(); return true; case ID_SHOW_COMMENTS: dasmview->set_right_column(DASM_RIGHTCOL_COMMENTS); recompute_children(); return true; } break; } return editwin_info::handle_command(wparam, lparam); }