+2/19/2019
+
+[VM/DEVICE] add is_primary_cpu() and update_extra_event()
+[VM/EVENT] support to udpate event while cpu is running one opecode
+[VM/Z80] improve to update event in every read/write cycle
+
+[MZ2500/MEMORY] improve pcgram wait in display timing
+
+
+2/16/2019
+
+[EMU/DEBUGGER] improve to enumerate devices that is debugger available
+[EMU/DEBUGGER] improve to show all breaked reasons
+[EMU/DEBUGGER] support breakpoint of cpu selected by "! device" command
+[EMU/*] simplify code for debugger
+[VM/*] simplify code for debugger
+
+[VM/I8237] support break point for direct memory access
+[VM/MB8877] fix not to wait 60ms to start read/write after seek is finished
+[VM/MC6844] support break point for direct memory access
+[VM/TMS9918A] support break point for registers and vram access
+[VM/UPD71071] support break point for direct memory access
+[VM/Z80DMA] support break point for direct i/o and memory access
+
+
+2/14/2019
+
+[EMU/DEBUGGER] support break point for non-cpu device
+[EMU/DEBUGGER] change command length from 64 to 1024
+
+[VM/AY_3_891X] support break point
+[VM/DEVICE] add get_debug_data_addr_space()
+[VM/DEVICE] change type of get_debug_regs_info() from void to bool
+[VM/MB8877] fix to decrease first seek time by 500us (2D/2DD) or 250us (2HD)
+[VM/TMS9918A] support break point
+[VM/YM2151] support break point
+[VM/YM2203] support break point
+[VM/Z80CTC] fix to reset interrupt req/in service by bit2 of control register
+[VM/Z80DMA] fix to reset interrupt req/in service by reset command
+
+[X1TURBO/EMM] support to access vram as memory space from debugger
+[X1TURBO/IOBUS] support to access vram as memory space from debugger
+[X1TURBO/IOBUS] support break point
+
+
+2/9/2019
+
+[EMU/DEBUGGER] enlarge text buffer size
+
+[VM/DEVICE] add get_context_child() to enumerate daisy-chained devices
+[VM/DISK] add get_sector_info()
+[VM/MB8877] improve debugger to show current head position and disk geometry
+[VM/MB8877] fix not to abort command when eject disk in unselected drive
+[VM/UPD765A] improve debugger to show current head position and disk geometry
+[VM/Z80*] add get_context_child() to enumerate daisy-chained devices
+
+[X1TURBO] fix to force clear iei/oei of z80 family devices when reset vm
+[X1TURBO/DISPLAY] fix to check bit0/2 of port 0x1fd0 in draw_text()
+
+
+2/8/2019
+
+[EMU/*] simplify code to draw screen while debugging cpu
+[OSD/*] simplify code to draw screen while debugging cpu
+[VM/*] simplify code to draw screen while debugging cpu
+
+[BUBCOM80/DISPLAY] improve dmac
+[HC80/IO] fix slave-cpu command 0x27 and 0x29 (thanks Mr.Stefano Bodrato)
+
+
+2/7/2019
+
+[EMU/DEBUGGER] improve to draw screen while debugging cpu
+[EMU] add override/restore/run_wndproc() for debugger
+[EMU] add create_bank_floppy_disk()
+[OSD/WIN32] add override/restore/run_wndproc() for debugger
+
+[VM/315_5124] improve draw_screen() for debugger
+[VM/H6280] improve to run window procedure while suspending for debugger
+[VM/I286] improve to run window procedure while suspending for debugger
+[VM/I386] improve to run window procedure while suspending for debugger
+[VM/I8080] improve to run window procedure while suspending for debugger
+[VM/M6502] improve to run window procedure while suspending for debugger
+[VM/MC6800] improve to run window procedure while suspending for debugger
+[VM/MC6809] improve to run window procedure while suspending for debugger
+[VM/MCS48] improve to run window procedure while suspending for debugger
+[VM/TMS9918A] improve draw_screen() for debugger
+[VM/TMS9995] improve to run window procedure while suspending for debugger
+[VM/UPD7801] improve to run window procedure while suspending for debugger
+[VM/UPD7810] improve to run window procedure while suspending for debugger
+[VM/V9938] improve draw_screen() for debugger
+[VM/V99X8] improve draw_screen() for debugger
+[VM/Z80] improve to run window procedure while suspending for debugger
+
+[BUBCOM80/DISPLAY] improve draw_screen() for debugger
+[FAMILYBASIC/PPU] improve draw_screen() for debugger
+[MZ80K/DISPLAY] improve draw_screen() for debugger
+[MZ1500/MEMORY] improve draw_screen() for debugger
+[PC8801/PC88] improve draw_screen() for debugger
+[PCENGINE/PCE] improve draw_screen() for debugger
+[SMC777/MEMORY] improve draw_screen() for debugger
+[X1/DISPLAY] improve draw_screen() for debugger
+
+
+1/29/2019
+
+[MZ80K/MEMORY] support COLOR GAL 5 (thanks Mr.Suga)
+[PC8001/PC88] fix issue that cursor is mistakenly hidden
+
+
+1/18/2019
+
+[PC8001/PC88] clear ram[0xff33] for DEMPA Galaxian
+[SMC777/MEMORY] improve to render screen in each scan line
+
+
+1/16/2019
+
+[EMU] improve to reinitialize vm in reset when dipswitch is changed
+
+[VM/UPD765A] fix st3 in sence devstat command to set two-side bit (temporary)
+
+[PC8801] support GSX-8800
+[PC8801] support to enable/disable PC-8801-11/GSX-8800/PCG-8100
+[PC8801] fix some degradations
+
+
1/11/2019
[PC8001] support NEC PC-8001
-<B><FONT SIZE=-1>Upstream 2019-01-11<BR>
-Qt Port and FM7 series 2019-01-13<BR>
+<B><FONT SIZE=-1>Upstream 2019-02-19<BR>
+Qt Port and FM7 series 2019-02-20<BR>
</FONT></B>
#include <stdlib.h>
#include <string.h>
#ifdef _MSC_VER
+#include <io.h>
#include <typeinfo.h>
#else
#include <typeinfo>
#ifdef USE_DEBUGGER
-#ifndef FOREGROUND_BLUE
-#define FOREGROUND_BLUE 0x0001 // text color contains blue.
-#endif
-#ifndef FOREGROUND_GREEN
-#define FOREGROUND_GREEN 0x0002 // text color contains green.
-#endif
-#ifndef FOREGROUND_RED
-#define FOREGROUND_RED 0x0004 // text color contains red.
-#endif
-#ifndef FOREGROUND_INTENSITY
-#define FOREGROUND_INTENSITY 0x0008 // text color is intensified.
-#endif
-
static FILEIO* logfile = NULL;
static FILEIO* cmdfile = NULL;
void my_printf(OSD *osd, const _TCHAR *format, ...)
{
- _TCHAR buffer[1024];
+ _TCHAR buffer[8192];
va_list ap;
va_start(ap, format);
- my_vstprintf_s(buffer, 1024, format, ap);
+ my_vstprintf_s(buffer, array_length(buffer), format, ap);
va_end(ap);
if(logfile != NULL && logfile->IsOpened()) {
osd->write_console(&c, 1);
}
-uint32_t my_hexatoi(DEVICE *target, const _TCHAR *str)
+uint32_t my_hexatoi(DEVICE *device, const _TCHAR *str)
{
_TCHAR tmp[1024], *s;
symbol_t *first_symbol = NULL;
if(str == NULL || _tcslen(str) == 0) {
return 0;
}
- my_tcscpy_s(tmp, 1024, str);
+ my_tcscpy_s(tmp, array_length(tmp), str);
- if(target) {
- DEBUGGER *debugger = (DEBUGGER *)target->get_debugger();
- if(debugger) {
+ if(device != NULL) {
+ DEBUGGER *debugger = (DEBUGGER *)device->get_debugger();
+ if(debugger != NULL) {
first_symbol = debugger->first_symbol;
}
}
} else if((s = _tcsstr(tmp, _T(":"))) != NULL) {
// 0000:0000
s[0] = _T('\0');
- return (my_hexatoi(target, tmp) << 4) + my_hexatoi(target, s + 1);
+ return (my_hexatoi(device, tmp) << 4) + my_hexatoi(device, s + 1);
} else if(tmp[0] == _T('%')) {
// decimal
#if defined(__MINGW32__)
return (uint16_t)strtoul(tmp, NULL, 16);
}
-const _TCHAR *my_get_symbol(DEVICE *target, uint32_t addr)
+const _TCHAR *my_get_symbol(DEVICE *device, uint32_t addr)
{
symbol_t *first_symbol = NULL;
- if(target) {
- DEBUGGER *debugger = (DEBUGGER *)target->get_debugger();
- if(debugger) {
+ if(device != NULL) {
+ DEBUGGER *debugger = (DEBUGGER *)device->get_debugger();
+ if(debugger != NULL) {
first_symbol = debugger->first_symbol;
}
}
return get_symbol(first_symbol, addr);
}
-const _TCHAR *my_get_value_or_symbol(DEVICE *target, const _TCHAR *format, uint32_t addr)
+const _TCHAR *my_get_value_or_symbol(DEVICE *device, const _TCHAR *format, uint32_t addr)
{
symbol_t *first_symbol = NULL;
- if(target) {
- DEBUGGER *debugger = (DEBUGGER *)target->get_debugger();
- if(debugger) {
+ if(device != NULL) {
+ DEBUGGER *debugger = (DEBUGGER *)device->get_debugger();
+ if(debugger != NULL) {
first_symbol = debugger->first_symbol;
}
}
return get_value_or_symbol(first_symbol, format, addr);
}
-const _TCHAR *my_get_value_and_symbol(DEVICE *target, const _TCHAR *format, uint32_t addr)
+const _TCHAR *my_get_value_and_symbol(DEVICE *device, const _TCHAR *format, uint32_t addr)
{
symbol_t *first_symbol = NULL;
- if(target) {
- DEBUGGER *debugger = (DEBUGGER *)target->get_debugger();
- if(debugger) {
+ if(device != NULL) {
+ DEBUGGER *debugger = (DEBUGGER *)device->get_debugger();
+ if(debugger != NULL) {
first_symbol = debugger->first_symbol;
}
}
}
return NULL;
}
+
+void show_break_reason(OSD *osd, DEVICE *cpu, DEVICE *target, bool hide_bp)
+{
+ DEBUGGER *cpu_debugger = (DEBUGGER *)cpu->get_debugger();
+ DEBUGGER *target_debugger = (DEBUGGER *)target->get_debugger();
+
+ osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_INTENSITY);
+
+ if(cpu_debugger != NULL) {
+ if(cpu_debugger->bp.hit && !hide_bp) {
+ my_printf(osd, _T("breaked at %s: breakpoint %s was hit\n"),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu_debugger->bp.hit_addr));
+ }
+ if(cpu_debugger->rbp.hit) {
+ my_printf(osd, _T("breaked at %s: memory %s was read at %s\n"),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu_debugger->rbp.hit_addr),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
+ }
+ if(cpu_debugger->wbp.hit) {
+ my_printf(osd, _T("breaked at %s: memory %s was written at %s\n"),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu_debugger->wbp.hit_addr),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
+ }
+ if(cpu_debugger->ibp.hit) {
+ my_printf(osd, _T("breaked at %s: port %s was read at %s\n"),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu_debugger->ibp.hit_addr),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
+ }
+ if(cpu_debugger->obp.hit) {
+ my_printf(osd, _T("breaked at %s: port %s was written at %s\n"),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu_debugger->obp.hit_addr),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
+ }
+ }
+ if(target != cpu && target_debugger != NULL) {
+ if(target_debugger->bp.hit) {
+ my_printf(osd, _T("breaked at %s: %s breakpoint %s was hit\n"),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
+ target->get_device_name(),
+ my_get_value_and_symbol(target, _T("%08X"), target_debugger->bp.hit_addr));
+ }
+ if(target_debugger->rbp.hit) {
+ my_printf(osd, _T("breaked at %s: %s memory %s was read at %s\n"),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
+ target->get_device_name(),
+ my_get_value_and_symbol(target, _T("%08X"), target_debugger->rbp.hit_addr),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
+ }
+ if(target_debugger->wbp.hit) {
+ my_printf(osd, _T("breaked at %s: %s memory %s was written at %s\n"),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
+ target->get_device_name(),
+ my_get_value_and_symbol(target, _T("%08X"), target_debugger->wbp.hit_addr),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
+ }
+ if(target_debugger->ibp.hit) {
+ my_printf(osd, _T("breaked at %s: %s port %s was read at %s\n"),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
+ target->get_device_name(),
+ my_get_value_and_symbol(target, _T("%08X"), target_debugger->ibp.hit_addr),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
+ }
+ if(target_debugger->obp.hit) {
+ my_printf(osd, _T("breaked at %s: %s port %s was written at %s\n"),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
+ target->get_device_name(),
+ my_get_value_and_symbol(target, _T("%08X"), target_debugger->obp.hit_addr),
+ my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
+ }
+ }
+}
+
#ifdef _MSC_VER
unsigned __stdcall debugger_thread(void *lpx)
#else
p->running = true;
// initialize console
- _TCHAR buffer[1024];
+ _TCHAR buffer[8192];
bool cp932 = (p->osd->get_console_code_page() == 932);
p->osd->open_console((_TCHAR *)create_string(_T("Debugger - %s"), _T(DEVICE_NAME)));
// break cpu
DEVICE *cpu = p->vm->get_cpu(p->cpu_index);
- DEBUGGER *debugger = (DEBUGGER *)cpu->get_debugger();
+ DEBUGGER *cpu_debugger = (DEBUGGER *)cpu->get_debugger();
DEVICE *target = cpu;
- DEBUGGER *target_debugger = debugger;
+ DEBUGGER *target_debugger = cpu_debugger;
- debugger->now_going = false;
- debugger->now_debugging = true;
+ cpu_debugger->set_context_child(NULL);
+ cpu_debugger->now_going = false;
+ cpu_debugger->now_debugging = true;
int wait_count = 0;
- while(!p->request_terminate && !(debugger->now_suspended && debugger->now_waiting)) {
+ while(!p->request_terminate && !(cpu_debugger->now_suspended && cpu_debugger->now_waiting)) {
if((wait_count++) == 100) {
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_INTENSITY);
my_printf(p->osd, _T("waiting until cpu is suspended...\n"));
}
p->osd->sleep(10);
uint32_t dump_addr = 0;
uint32_t dasm_addr = cpu->get_next_pc();
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- cpu->get_debug_regs_info(buffer, 1024);
- my_printf(p->osd, _T("%s\n"), buffer);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
+ if(cpu->get_debug_regs_info(buffer, array_length(buffer))) {
+ my_printf(p->osd, _T("%s\n"), buffer);
+ }
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_INTENSITY);
my_printf(p->osd, _T("breaked at %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()));
- p->osd->set_console_text_attribute(FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- cpu->debug_dasm(cpu->get_next_pc(), buffer, 1024);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
+ cpu->debug_dasm(cpu->get_next_pc(), buffer, array_length(buffer));
my_printf(p->osd, _T("next\t%s %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()), buffer);
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
// initialize files
logfile = NULL;
memset(prev_command, 0, sizeof(prev_command));
while(!p->request_terminate) {
+ p->emu->draw_screen();
+
my_printf(p->osd, _T("- "));
// get command
} else if(enter_ptr > 0) {
command[enter_ptr] = _T('\0');
memcpy(prev_command, command, sizeof(command));
- memcpy(debugger->history[debugger->history_ptr], command, sizeof(command));
- if (++debugger->history_ptr >= MAX_COMMAND_HISTORY) {
- debugger->history_ptr = 0;
+ if(_tcsicmp(cpu_debugger->history[cpu_debugger->history_ptr], command) != 0) {
+ memcpy(cpu_debugger->history[cpu_debugger->history_ptr], command, sizeof(command));
+ if(++cpu_debugger->history_ptr >= MAX_COMMAND_HISTORY) {
+ cpu_debugger->history_ptr = 0;
+ }
}
my_printf(p->osd, _T("\n"));
enter_done = true;
history_ptr = 0;
}
}
- int index = debugger->history_ptr - history_ptr;
+ int index = cpu_debugger->history_ptr - history_ptr;
while(index < 0) {
index += MAX_COMMAND_HISTORY;
}
while(index >= MAX_COMMAND_HISTORY) {
index -= MAX_COMMAND_HISTORY;
}
- if(debugger->history[index][0] != _T('\0')) {
+ if(cpu_debugger->history[index][0] != _T('\0')) {
for(int i = 0; i < enter_ptr; i++) {
my_putch(p->osd, 0x08);
my_putch(p->osd, _T(' '));
my_putch(p->osd, 0x08);
}
- memcpy(command, debugger->history[index], sizeof(command));
+ memcpy(command, cpu_debugger->history[index], sizeof(command));
my_printf(p->osd, _T("%s"), command);
enter_ptr = _tcslen(command);
} else {
if(num >= 2) {
start_addr = my_hexatoi(target, params[1]);
}
- start_addr &= target->get_debug_data_addr_mask();
+ start_addr %= target->get_debug_data_addr_space();
uint32_t end_addr = start_addr + 8 * 16 - 1;
if(num == 3) {
end_addr = my_hexatoi(target, params[2]);
}
- end_addr &= target->get_debug_data_addr_mask();
+ end_addr %= target->get_debug_data_addr_space();
if(start_addr > end_addr) {
- end_addr = target->get_debug_data_addr_mask();
+ end_addr = (uint32_t)(target->get_debug_data_addr_space() - 1);
}
for(uint64_t addr = start_addr & ~0x0f; addr <= end_addr; addr++) {
- if(addr > target->get_debug_data_addr_mask()) {
- end_addr = target->get_debug_data_addr_mask();
+ if(addr > target->get_debug_data_addr_space() - 1) {
+ end_addr = (uint32_t)(target->get_debug_data_addr_space() - 1);
break;
}
if((addr & 0x0f) == 0) {
- my_printf(p->osd, _T("%08X "), addr & target->get_debug_data_addr_mask());
+ my_printf(p->osd, _T("%08X "), addr % target->get_debug_data_addr_space());
memset(buffer, 0, sizeof(buffer));
}
if(addr < start_addr) {
my_printf(p->osd, _T(" "));
buffer[addr & 0x0f] = _T(' ');
} else {
- uint32_t data = target->read_debug_data8(addr & target->get_debug_data_addr_mask());
+ uint32_t data = target->read_debug_data8((uint32_t)(addr % target->get_debug_data_addr_space()));
my_printf(p->osd, _T(" %02X"), data);
buffer[addr & 0x0f] = ((data >= 0x20 && data <= 0x7e) || (cp932 && data >= 0xa1 && data <= 0xdf)) ? data : _T('.');
}
}
my_printf(p->osd, _T(" %s\n"), buffer);
}
- dump_addr = (end_addr + 1) & target->get_debug_data_addr_mask();
+ dump_addr = (end_addr + 1) % target->get_debug_data_addr_space();
prev_command[1] = _T('\0'); // remove parameters to dump continuously
} else {
my_printf(p->osd, _T("invalid parameter number\n"));
}
} else if(_tcsicmp(params[0], _T("E")) == 0 || _tcsicmp(params[0], _T("EB")) == 0) {
if(num >= 3) {
- uint32_t addr = my_hexatoi(target, params[1]) & target->get_debug_data_addr_mask();
+ uint32_t addr = my_hexatoi(target, params[1]) % target->get_debug_data_addr_space();
for(int i = 2; i < num; i++) {
target->write_debug_data8(addr, my_hexatoi(target, params[i]) & 0xff);
- addr = (addr + 1) & target->get_debug_data_addr_mask();
+ addr = (addr + 1) % target->get_debug_data_addr_space();
}
} else {
my_printf(p->osd, _T("invalid parameter number\n"));
}
} else if(_tcsicmp(params[0], _T("EW")) == 0) {
if(num >= 3) {
- uint32_t addr = my_hexatoi(target, params[1]) & target->get_debug_data_addr_mask();
+ uint32_t addr = my_hexatoi(target, params[1]) % target->get_debug_data_addr_space();
for(int i = 2; i < num; i++) {
target->write_debug_data16(addr, my_hexatoi(target, params[i]) & 0xffff);
- addr = (addr + 2) & target->get_debug_data_addr_mask();
+ addr = (addr + 2) % target->get_debug_data_addr_space();
}
} else {
my_printf(p->osd, _T("invalid parameter number\n"));
}
} else if(_tcsicmp(params[0], _T("ED")) == 0) {
if(num >= 3) {
- uint32_t addr = my_hexatoi(target, params[1]) & target->get_debug_data_addr_mask();
+ uint32_t addr = my_hexatoi(target, params[1]) % target->get_debug_data_addr_space();
for(int i = 2; i < num; i++) {
target->write_debug_data32(addr, my_hexatoi(target, params[i]));
- addr = (addr + 4) & target->get_debug_data_addr_mask();
+ addr = (addr + 4) % target->get_debug_data_addr_space();
}
} else {
my_printf(p->osd, _T("invalid parameter number\n"));
}
} else if(_tcsicmp(params[0], _T("EA")) == 0) {
if(num >= 3) {
- uint32_t addr = my_hexatoi(target, params[1]) & target->get_debug_data_addr_mask();
- my_tcscpy_s(buffer, 1024, prev_command);
+ uint32_t addr = my_hexatoi(target, params[1]) % target->get_debug_data_addr_space();
+ my_tcscpy_s(buffer, array_length(buffer), prev_command);
if((token = my_tcstok_s(buffer, _T("\""), &context)) != NULL && (token = my_tcstok_s(NULL, _T("\""), &context)) != NULL) {
int len = _tcslen(token);
for(int i = 0; i < len; i++) {
target->write_debug_data8(addr, token[i] & 0xff);
- addr = (addr + 1) & target->get_debug_data_addr_mask();
+ addr = (addr + 1) % target->get_debug_data_addr_space();
}
} else {
my_printf(p->osd, _T("invalid parameter\n"));
}
} else if(_tcsicmp(params[0], _T("R")) == 0) {
if(num == 1) {
- target->get_debug_regs_info(buffer, 1024);
- my_printf(p->osd, _T("%s\n"), buffer);
+ if(target->get_debug_regs_info(buffer, array_length(buffer))) {
+ my_printf(p->osd, _T("%s\n"), buffer);
+ }
} else if(num == 3) {
if(!target->write_debug_reg(params[1], my_hexatoi(target, params[2]))) {
my_printf(p->osd, _T("unknown register %s\n"), params[1]);
}
} else if(_tcsicmp(params[0], _T("S")) == 0) {
if(num >= 4) {
- uint32_t start_addr = my_hexatoi(target, params[1]) & target->get_debug_data_addr_mask();
- uint32_t end_addr = my_hexatoi(target, params[2]) & target->get_debug_data_addr_mask();
+ uint32_t start_addr = my_hexatoi(target, params[1]) % target->get_debug_data_addr_space();
+ uint32_t end_addr = my_hexatoi(target, params[2]) % target->get_debug_data_addr_space();
uint8_t list[32];
for(int i = 3, j = 0; i < num; i++, j++) {
list[j] = my_hexatoi(target, params[i]);
for(uint64_t addr = start_addr; addr <= end_addr; addr++) {
bool found = true;
for(int i = 3, j = 0; i < num; i++, j++) {
- if(target->read_debug_data8((uint32_t)((addr + j) & target->get_debug_data_addr_mask())) != list[j]) {
+ if(target->read_debug_data8((uint32_t)((addr + j) % target->get_debug_data_addr_space())) != list[j]) {
found = false;
break;
}
uint32_t end_addr = my_hexatoi(target, params[2]) & target->get_debug_prog_addr_mask();
while(dasm_addr <= end_addr) {
const _TCHAR *name = my_get_symbol(target, dasm_addr & target->get_debug_prog_addr_mask());
- int len = target->debug_dasm(dasm_addr & target->get_debug_prog_addr_mask(), buffer, 1024);
+ int len = target->debug_dasm(dasm_addr & target->get_debug_prog_addr_mask(), buffer, array_length(buffer));
if(name != NULL) {
my_printf(p->osd, _T("%08X "), dasm_addr & target->get_debug_prog_addr_mask());
- p->osd->set_console_text_attribute(FOREGROUND_GREEN | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_GREEN | OSD_CONSOLE_INTENSITY);
my_printf(p->osd, _T("%s:\n"), name);
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
}
my_printf(p->osd, _T("%08X "), dasm_addr & target->get_debug_prog_addr_mask());
for(int i = 0; i < len; i++) {
} else {
for(int i = 0; i < 16; i++) {
const _TCHAR *name = my_get_symbol(target, dasm_addr & target->get_debug_prog_addr_mask());
- int len = target->debug_dasm(dasm_addr & target->get_debug_prog_addr_mask(), buffer, 1024);
+ int len = target->debug_dasm(dasm_addr & target->get_debug_prog_addr_mask(), buffer, array_length(buffer));
if(name != NULL) {
my_printf(p->osd, _T("%08X "), dasm_addr & target->get_debug_prog_addr_mask());
- p->osd->set_console_text_attribute(FOREGROUND_GREEN | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_GREEN | OSD_CONSOLE_INTENSITY);
my_printf(p->osd, _T("%s:\n"), name);
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
}
my_printf(p->osd, _T("%08X "), dasm_addr & target->get_debug_prog_addr_mask());
for(int i = 0; i < len; i++) {
int index = (target_debugger->cpu_trace_ptr + i) & (MAX_CPU_TRACE - 1);
if(!(target_debugger->cpu_trace[index] & ~target->get_debug_prog_addr_mask())) {
const _TCHAR *name = my_get_symbol(target, target_debugger->cpu_trace[index] & target->get_debug_prog_addr_mask());
- int len = target->debug_dasm(target_debugger->cpu_trace[index] & target->get_debug_prog_addr_mask(), buffer, 1024);
+ int len = target->debug_dasm(target_debugger->cpu_trace[index] & target->get_debug_prog_addr_mask(), buffer, array_length(buffer));
if(name != NULL) {
my_printf(p->osd, _T("%08X "), target_debugger->cpu_trace[index] & target->get_debug_prog_addr_mask());
- p->osd->set_console_text_attribute(FOREGROUND_GREEN | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_GREEN | OSD_CONSOLE_INTENSITY);
my_printf(p->osd, _T("%s:\n"), name);
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
}
my_printf(p->osd, _T("%08X "), target_debugger->cpu_trace[index] & target->get_debug_prog_addr_mask());
for(int i = 0; i < len; i++) {
}
} else if(_tcsicmp(params[0], _T("N")) == 0) {
if(num >= 2 && params[1][0] == _T('\"')) {
- my_tcscpy_s(buffer, 1024, prev_command);
+ my_tcscpy_s(buffer, array_length(buffer), prev_command);
if((token = my_tcstok_s(buffer, _T("\""), &context)) != NULL && (token = my_tcstok_s(NULL, _T("\""), &context)) != NULL) {
- my_tcscpy_s(debugger->file_path, _MAX_PATH, my_absolute_path(token));
+ my_tcscpy_s(cpu_debugger->file_path, _MAX_PATH, my_absolute_path(token));
} else {
my_printf(p->osd, _T("invalid parameter\n"));
}
} else if(num == 2) {
- my_tcscpy_s(debugger->file_path, _MAX_PATH, my_absolute_path(params[1]));
+ my_tcscpy_s(cpu_debugger->file_path, _MAX_PATH, my_absolute_path(params[1]));
} else {
my_printf(p->osd, _T("invalid parameter number\n"));
}
} else if(_tcsicmp(params[0], _T("L")) == 0) {
- FILEIO* fio = new FILEIO();
- if(check_file_extension(debugger->file_path, _T(".sym"))) {
- if(target_debugger == NULL) {
- my_printf(p->osd, _T("debugger is not attached to target device %s\n"), target->this_device_name);
- } else if(fio->Fopen(debugger->file_path, FILEIO_READ_ASCII)) {
- target_debugger->release_symbols();
- _TCHAR line[1024];
- while(fio->Fgetts(line, array_length(line)) != NULL) {
- _TCHAR *next = NULL;
- _TCHAR *addr = my_tcstok_s(line, _T("\t #$*,;"), &next);
- while(addr != NULL) {
- if(_tcslen(addr) > 0) {
- _TCHAR *name = my_tcstok_s(NULL, _T("\t #$*,;"), &next);
- while(name != NULL) {
- while(_tcslen(name) > 0 && (name[_tcslen(name) - 1] == 0x0d || name[_tcslen(name) - 1] == 0x0a)) {
- name[_tcslen(name) - 1] = _T('\0');
- }
- if(_tcslen(name) > 0) {
- target_debugger->add_symbol(my_hexatoi(NULL, addr), name);
- break;
+ if(target_debugger == NULL) {
+ my_printf(p->osd, _T("debugger is not attached to target device %s\n"), target->this_device_name);
+ } else {
+ FILEIO* fio = new FILEIO();
+ if(check_file_extension(cpu_debugger->file_path, _T(".sym"))) {
+ if(fio->Fopen(cpu_debugger->file_path, FILEIO_READ_ASCII)) {
+ target_debugger->release_symbols();
+ _TCHAR line[1024];
+ while(fio->Fgetts(line, array_length(line)) != NULL) {
+ _TCHAR *next = NULL;
+ _TCHAR *addr = my_tcstok_s(line, _T("\t #$*,;"), &next);
+ while(addr != NULL) {
+ if(_tcslen(addr) > 0) {
+ _TCHAR *name = my_tcstok_s(NULL, _T("\t #$*,;"), &next);
+ while(name != NULL) {
+ while(_tcslen(name) > 0 && (name[_tcslen(name) - 1] == 0x0d || name[_tcslen(name) - 1] == 0x0a)) {
+ name[_tcslen(name) - 1] = _T('\0');
+ }
+ if(_tcslen(name) > 0) {
+ target_debugger->add_symbol(my_hexatoi(NULL, addr), name);
+ break;
+ }
+ name = my_tcstok_s(NULL, _T("\t #$*,;"), &next);
}
- name = my_tcstok_s(NULL, _T("\t #$*,;"), &next);
}
+ addr = my_tcstok_s(NULL, _T("\t #$*,;"), &next);
}
- addr = my_tcstok_s(NULL, _T("\t #$*,;"), &next);
}
+ fio->Fclose();
+ } else {
+ my_printf(p->osd, _T("can't open %s\n"), cpu_debugger->file_path);
}
- fio->Fclose();
- } else {
- my_printf(p->osd, _T("can't open %s\n"), debugger->file_path);
- }
- } else if(check_file_extension(debugger->file_path, _T(".hex"))) {
- if(fio->Fopen(debugger->file_path, FILEIO_READ_ASCII)) {
- uint32_t start_addr = 0, linear = 0, segment = 0;
- if(num >= 2) {
- start_addr = my_hexatoi(target, params[1]);
- }
- char line[1024];
- while(fio->Fgets(line, sizeof(line)) != NULL) {
- if(line[0] != ':') continue;
- int type = my_hexatob(line + 7);
- if(type == 0x00) {
- uint32_t bytes = my_hexatob(line + 1);
- uint32_t addr = my_hexatow(line + 3) + start_addr + linear + segment;
- for(uint32_t i = 0; i < bytes; i++) {
- target->write_debug_data8((addr + i) & target->get_debug_data_addr_mask(), my_hexatob(line + 9 + 2 * i));
+ } else if(check_file_extension(cpu_debugger->file_path, _T(".hex"))) {
+ if(fio->Fopen(cpu_debugger->file_path, FILEIO_READ_ASCII)) {
+ uint32_t start_addr = 0, linear = 0, segment = 0;
+ if(num >= 2) {
+ start_addr = my_hexatoi(target, params[1]);
+ }
+ char line[1024];
+ while(fio->Fgets(line, sizeof(line)) != NULL) {
+ if(line[0] != ':') continue;
+ int type = my_hexatob(line + 7);
+ if(type == 0x00) {
+ uint32_t bytes = my_hexatob(line + 1);
+ uint32_t addr = my_hexatow(line + 3) + start_addr + linear + segment;
+ for(uint32_t i = 0; i < bytes; i++) {
+ target->write_debug_data8((addr + i) % target->get_debug_data_addr_space(), my_hexatob(line + 9 + 2 * i));
+ }
+ } else if(type == 0x01) {
+ break;
+ } else if(type == 0x02) {
+ segment = my_hexatow(line + 9) << 4;
+ start_addr = 0;
+ } else if(type == 0x04) {
+ linear = my_hexatow(line + 9) << 16;
+ start_addr = 0;
}
- } else if(type == 0x01) {
- break;
- } else if(type == 0x02) {
- segment = my_hexatow(line + 9) << 4;
- start_addr = 0;
- } else if(type == 0x04) {
- linear = my_hexatow(line + 9) << 16;
- start_addr = 0;
}
+ fio->Fclose();
+ } else {
+ my_printf(p->osd, _T("can't open %s\n"), cpu_debugger->file_path);
}
- fio->Fclose();
} else {
- my_printf(p->osd, _T("can't open %s\n"), debugger->file_path);
- }
- } else {
- if(fio->Fopen(debugger->file_path, FILEIO_READ_BINARY)) {
- uint32_t start_addr = 0x100, end_addr = target->get_debug_data_addr_mask();
- if(num >= 2) {
- start_addr = my_hexatoi(target, params[1]) & target->get_debug_data_addr_mask();
- }
- if(num >= 3) {
- end_addr = my_hexatoi(target, params[2]) & target->get_debug_data_addr_mask();
- }
- for(uint32_t addr = start_addr; addr <= end_addr; addr++) {
- int data = fio->Fgetc();
- if(data == EOF) {
- break;
+ if(fio->Fopen(cpu_debugger->file_path, FILEIO_READ_BINARY)) {
+ uint32_t start_addr = 0x100, end_addr = (uint32_t)(target->get_debug_data_addr_space() - 1);
+ if(num >= 2) {
+ start_addr = my_hexatoi(target, params[1]) % target->get_debug_data_addr_space();
+ }
+ if(num >= 3) {
+ end_addr = my_hexatoi(target, params[2]) % target->get_debug_data_addr_space();
}
- target->write_debug_data8(addr & target->get_debug_data_addr_mask(), data);
+ for(uint32_t addr = start_addr; addr <= end_addr; addr++) {
+ int data = fio->Fgetc();
+ if(data == EOF) {
+ break;
+ }
+ target->write_debug_data8(addr % target->get_debug_data_addr_space(), data);
+ }
+ fio->Fclose();
+ } else {
+ my_printf(p->osd, _T("can't open %s\n"), cpu_debugger->file_path);
}
- fio->Fclose();
- } else {
- my_printf(p->osd, _T("can't open %s\n"), debugger->file_path);
}
+ delete fio;
}
- delete fio;
} else if(_tcsicmp(params[0], _T("W")) == 0) {
- if(num == 3) {
- uint32_t start_addr = my_hexatoi(target, params[1]) & target->get_debug_data_addr_mask(), end_addr = my_hexatoi(target, params[2]) & target->get_debug_data_addr_mask();
+ if(target_debugger == NULL) {
+ my_printf(p->osd, _T("debugger is not attached to target device %s\n"), target->this_device_name);
+ } else if(num == 3) {
+ uint32_t start_addr = my_hexatoi(target, params[1]) % target->get_debug_data_addr_space(), end_addr = my_hexatoi(target, params[2]) % target->get_debug_data_addr_space();
FILEIO* fio = new FILEIO();
- if(check_file_extension(debugger->file_path, _T(".hex"))) {
+ if(check_file_extension(cpu_debugger->file_path, _T(".hex"))) {
// write intel hex format file
- if(fio->Fopen(debugger->file_path, FILEIO_WRITE_ASCII)) {
+ if(fio->Fopen(cpu_debugger->file_path, FILEIO_WRITE_ASCII)) {
uint32_t addr = start_addr;
while(addr <= end_addr) {
uint32_t len = min(end_addr - addr + 1, (uint32_t)16);
uint32_t sum = len + ((addr >> 8) & 0xff) + (addr & 0xff) + 0x00;
fio->Fprintf(":%02X%04X%02X", len, addr & 0xffff, 0x00);
for(uint32_t i = 0; i < len; i++) {
- uint8_t data = target->read_debug_data8((addr++) & target->get_debug_data_addr_mask());
+ uint8_t data = target->read_debug_data8((addr++) % target->get_debug_data_addr_space());
sum += data;
fio->Fprintf("%02X", data);
}
fio->Fprintf(":00000001FF\n");
fio->Fclose();
} else {
- my_printf(p->osd, _T("can't open %s\n"), debugger->file_path);
+ my_printf(p->osd, _T("can't open %s\n"), cpu_debugger->file_path);
}
} else {
- if(fio->Fopen(debugger->file_path, FILEIO_WRITE_BINARY)) {
+ if(fio->Fopen(cpu_debugger->file_path, FILEIO_WRITE_BINARY)) {
for(uint32_t addr = start_addr; addr <= end_addr; addr++) {
- fio->Fputc(target->read_debug_data8(addr & target->get_debug_data_addr_mask()));
+ fio->Fputc(target->read_debug_data8(addr % target->get_debug_data_addr_space()));
}
fio->Fclose();
} else {
- my_printf(p->osd, _T("can't open %s\n"), debugger->file_path);
+ my_printf(p->osd, _T("can't open %s\n"), cpu_debugger->file_path);
}
}
delete fio;
if(target_debugger == NULL) {
my_printf(p->osd, _T("debugger is not attached to target device %s\n"), target->this_device_name);
} else if(num == 1) {
- for(symbol_t* symbol = debugger->first_symbol; symbol; symbol = symbol->next_symbol) {
+ for(symbol_t* symbol = target_debugger->first_symbol; symbol; symbol = symbol->next_symbol) {
my_printf(p->osd, _T("%08X %s\n"), symbol->addr, symbol->name);
}
} else {
my_printf(p->osd, _T("invalid parameter number\n"));
}
- } else if(_tcsicmp(params[0], _T( "BP")) == 0 || _tcsicmp(params[0], _T("RBP")) == 0 || _tcsicmp(params[0], _T("WBP")) == 0 ||
- _tcsicmp(params[0], _T( "CP")) == 0 || _tcsicmp(params[0], _T("RCP")) == 0 || _tcsicmp(params[0], _T("WCP")) == 0) {
- break_point_t *bp = get_break_point(debugger, params[0]);
- if(num == 2) {
- uint32_t addr = my_hexatoi(cpu, params[1]);
- bool found = false;
- for(int i = 0; i < MAX_BREAK_POINTS && !found; i++) {
- if(bp->table[i].status == 0 || (bp->table[i].addr == addr && bp->table[i].mask == cpu->get_debug_prog_addr_mask())) {
- bp->table[i].addr = addr;
- bp->table[i].mask = cpu->get_debug_prog_addr_mask();
- bp->table[i].status = 1;
- bp->table[i].check_point = (params[0][0] == 'C' || params[0][0] == 'c' || params[0][1] == 'C' || params[0][1] == 'c');
- found = true;
+ } else if(_tcsicmp(params[0], _T( "BP")) == 0 ||
+ _tcsicmp(params[0], _T( "CP")) == 0) {
+ if(target_debugger == NULL) {
+ my_printf(p->osd, _T("debugger is not attached to target device %s\n"), target->this_device_name);
+ } else {
+ break_point_t *bp = get_break_point(target_debugger, params[0]);
+ if(num == 2) {
+ uint32_t addr = my_hexatoi(target, params[1]);
+ bool found = false;
+ for(int i = 0; i < MAX_BREAK_POINTS && !found; i++) {
+ if(bp->table[i].status == 0 || (bp->table[i].addr == addr && bp->table[i].mask == target->get_debug_prog_addr_mask())) {
+ bp->table[i].addr = addr;
+ bp->table[i].mask = target->get_debug_prog_addr_mask();
+ bp->table[i].status = 1;
+ bp->table[i].check_point = (params[0][0] == 'C' || params[0][0] == 'c' || params[0][1] == 'C' || params[0][1] == 'c');
+ found = true;
+ }
}
+ if(!found) {
+ my_printf(p->osd, _T("too many break points\n"));
+ }
+ } else {
+ my_printf(p->osd, _T("invalid parameter number\n"));
}
- if(!found) {
- my_printf(p->osd, _T("too many break points\n"));
- }
- } else {
- my_printf(p->osd, _T("invalid parameter number\n"));
}
- } else if(_tcsicmp(params[0], _T("IBP")) == 0 || _tcsicmp(params[0], _T("OBP")) == 0 ||
- _tcsicmp(params[0], _T("ICP")) == 0 || _tcsicmp(params[0], _T("OCP")) == 0) {
- break_point_t *bp = get_break_point(debugger, params[0]);
- if(num == 2 || num == 3) {
- uint32_t addr = my_hexatoi(cpu, params[1]), mask = 0xff;
- if(num == 3) {
- mask = my_hexatoi(cpu, params[2]);
- }
- bool found = false;
- for(int i = 0; i < MAX_BREAK_POINTS && !found; i++) {
- if(bp->table[i].status == 0 || (bp->table[i].addr == addr && bp->table[i].mask == mask)) {
- bp->table[i].addr = addr;
- bp->table[i].mask = mask;
- bp->table[i].status = 1;
- bp->table[i].check_point = (params[0][1] == 'C' || params[0][1] == 'c');
- found = true;
+ } else if(_tcsicmp(params[0], _T("RBP")) == 0 || _tcsicmp(params[0], _T("WBP")) == 0 ||
+ _tcsicmp(params[0], _T("RCP")) == 0 || _tcsicmp(params[0], _T("WCP")) == 0) {
+ if(target_debugger == NULL) {
+ my_printf(p->osd, _T("debugger is not attached to target device %s\n"), target->this_device_name);
+ } else {
+ break_point_t *bp = get_break_point(target_debugger, params[0]);
+ if(num == 2) {
+ uint32_t addr = my_hexatoi(target, params[1]);
+ bool found = false;
+ for(int i = 0; i < MAX_BREAK_POINTS && !found; i++) {
+ if(bp->table[i].status == 0 || (bp->table[i].addr == addr && bp->table[i].mask == target->get_debug_data_addr_mask())) {
+ bp->table[i].addr = addr;
+ bp->table[i].mask = target->get_debug_data_addr_mask();
+ bp->table[i].status = 1;
+ bp->table[i].check_point = (params[0][0] == 'C' || params[0][0] == 'c' || params[0][1] == 'C' || params[0][1] == 'c');
+ found = true;
+ }
}
+ if(!found) {
+ my_printf(p->osd, _T("too many break points\n"));
+ }
+ } else {
+ my_printf(p->osd, _T("invalid parameter number\n"));
}
- if(!found) {
- my_printf(p->osd, _T("too many break points\n"));
- }
+ }
+ } else if(_tcsicmp(params[0], _T("IBP")) == 0 || _tcsicmp(params[0], _T("OBP")) == 0 ||
+ _tcsicmp(params[0], _T("ICP")) == 0 || _tcsicmp(params[0], _T("OCP")) == 0) {
+ if(target_debugger == NULL) {
+ my_printf(p->osd, _T("debugger is not attached to target device %s\n"), target->this_device_name);
} else {
- my_printf(p->osd, _T("invalid parameter number\n"));
+ break_point_t *bp = get_break_point(target_debugger, params[0]);
+ if(num == 2 || num == 3) {
+ uint32_t addr = my_hexatoi(target, params[1]), mask = 0xff;
+ if(num == 3) {
+ mask = my_hexatoi(target, params[2]);
+ }
+ bool found = false;
+ for(int i = 0; i < MAX_BREAK_POINTS && !found; i++) {
+ if(bp->table[i].status == 0 || (bp->table[i].addr == addr && bp->table[i].mask == mask)) {
+ bp->table[i].addr = addr;
+ bp->table[i].mask = mask;
+ bp->table[i].status = 1;
+ bp->table[i].check_point = (params[0][1] == 'C' || params[0][1] == 'c');
+ found = true;
+ }
+ }
+ if(!found) {
+ my_printf(p->osd, _T("too many break points\n"));
+ }
+ } else {
+ my_printf(p->osd, _T("invalid parameter number\n"));
+ }
}
} else if(_tcsicmp(params[0], _T("BC")) == 0 || _tcsicmp(params[0], _T("RBC")) == 0 || _tcsicmp(params[0], _T("WBC")) == 0 || _tcsicmp(params[0], _T("IBC")) == 0 || _tcsicmp(params[0], _T("OBC")) == 0) {
- break_point_t *bp = get_break_point(debugger, params[0]);
- if(num == 2 && (_tcsicmp(params[1], _T("*")) == 0 || _tcsicmp(params[1], _T("ALL")) == 0)) {
- memset(bp->table, 0, sizeof(bp->table));
- } else if(num >= 2) {
- for(int i = 1; i < num; i++) {
- int index = my_hexatoi(cpu, params[i]);
- if(!(index >= 0 && index < MAX_BREAK_POINTS)) {
- my_printf(p->osd, _T("invalid index %x\n"), index);
- } else {
- bp->table[index].addr = bp->table[index].mask = 0;
- bp->table[index].status = 0;
+ if(target_debugger == NULL) {
+ my_printf(p->osd, _T("debugger is not attached to target device %s\n"), target->this_device_name);
+ } else {
+ break_point_t *bp = get_break_point(target_debugger, params[0]);
+ if(num == 2 && (_tcsicmp(params[1], _T("*")) == 0 || _tcsicmp(params[1], _T("ALL")) == 0)) {
+ memset(bp->table, 0, sizeof(bp->table));
+ } else if(num >= 2) {
+ for(int i = 1; i < num; i++) {
+ int index = my_hexatoi(target, params[i]);
+ if(!(index >= 0 && index < MAX_BREAK_POINTS)) {
+ my_printf(p->osd, _T("invalid index %x\n"), index);
+ } else {
+ bp->table[index].addr = bp->table[index].mask = 0;
+ bp->table[index].status = 0;
+ }
}
+ } else {
+ my_printf(p->osd, _T("invalid parameter number\n"));
}
- } else {
- my_printf(p->osd, _T("invalid parameter number\n"));
}
} else if(_tcsicmp(params[0], _T("BD")) == 0 || _tcsicmp(params[0], _T("RBD")) == 0 || _tcsicmp(params[0], _T("WBD")) == 0 || _tcsicmp(params[0], _T("IBD")) == 0 || _tcsicmp(params[0], _T("OBD")) == 0 ||
_tcsicmp(params[0], _T("BE")) == 0 || _tcsicmp(params[0], _T("RBE")) == 0 || _tcsicmp(params[0], _T("WBE")) == 0 || _tcsicmp(params[0], _T("IBE")) == 0 || _tcsicmp(params[0], _T("OBE")) == 0) {
- break_point_t *bp = get_break_point(debugger, params[0]);
- bool enabled = (params[0][1] == _T('E') || params[0][1] == _T('e') || params[0][2] == _T('E') || params[0][2] == _T('e'));
- if(num == 2 && (_tcsicmp(params[1], _T("*")) == 0 || _tcsicmp(params[1], _T("ALL")) == 0)) {
- for(int i = 0; i < MAX_BREAK_POINTS; i++) {
- if(bp->table[i].status != 0) {
- bp->table[i].status = enabled ? 1 : -1;
+ if(target_debugger == NULL) {
+ my_printf(p->osd, _T("debugger is not attached to target device %s\n"), target->this_device_name);
+ } else {
+ break_point_t *bp = get_break_point(target_debugger, params[0]);
+ bool enabled = (params[0][1] == _T('E') || params[0][1] == _T('e') || params[0][2] == _T('E') || params[0][2] == _T('e'));
+ if(num == 2 && (_tcsicmp(params[1], _T("*")) == 0 || _tcsicmp(params[1], _T("ALL")) == 0)) {
+ for(int i = 0; i < MAX_BREAK_POINTS; i++) {
+ if(bp->table[i].status != 0) {
+ bp->table[i].status = enabled ? 1 : -1;
+ }
}
- }
- } else if(num >= 2) {
- for(int i = 1; i < num; i++) {
- int index = my_hexatoi(cpu, params[i]);
- if(!(index >= 0 && index < MAX_BREAK_POINTS)) {
- my_printf(p->osd, _T("invalid index %x\n"), index);
- } else if(bp->table[index].status == 0) {
- my_printf(p->osd, _T("break point %x is null\n"), index);
- } else {
- bp->table[index].status = enabled ? 1 : -1;
+ } else if(num >= 2) {
+ for(int i = 1; i < num; i++) {
+ int index = my_hexatoi(target, params[i]);
+ if(!(index >= 0 && index < MAX_BREAK_POINTS)) {
+ my_printf(p->osd, _T("invalid index %x\n"), index);
+ } else if(bp->table[index].status == 0) {
+ my_printf(p->osd, _T("break point %x is null\n"), index);
+ } else {
+ bp->table[index].status = enabled ? 1 : -1;
+ }
}
+ } else {
+ my_printf(p->osd, _T("invalid parameter number\n"));
}
- } else {
- my_printf(p->osd, _T("invalid parameter number\n"));
}
} else if(_tcsicmp(params[0], _T("BL")) == 0 || _tcsicmp(params[0], _T("RBL")) == 0 || _tcsicmp(params[0], _T("WBL")) == 0) {
- if(num == 1) {
- break_point_t *bp = get_break_point(debugger, params[0]);
- for(int i = 0; i < MAX_BREAK_POINTS; i++) {
- if(bp->table[i].status) {
- my_printf(p->osd, _T("%x %c %s %s\n"), i,
- bp->table[i].status == 1 ? _T('e') : _T('d'),
- my_get_value_and_symbol(cpu, _T("%08X"), bp->table[i].addr),
- bp->table[i].check_point ? "checkpoint" : "");
+ if(target_debugger == NULL) {
+ my_printf(p->osd, _T("debugger is not attached to target device %s\n"), target->this_device_name);
+ } else {
+ if(num == 1) {
+ break_point_t *bp = get_break_point(target_debugger, params[0]);
+ for(int i = 0; i < MAX_BREAK_POINTS; i++) {
+ if(bp->table[i].status) {
+ my_printf(p->osd, _T("%x %c %s %s\n"), i,
+ bp->table[i].status == 1 ? _T('e') : _T('d'),
+ my_get_value_and_symbol(target, _T("%08X"), bp->table[i].addr),
+ bp->table[i].check_point ? "checkpoint" : "");
+ }
}
+ } else {
+ my_printf(p->osd, _T("invalid parameter number\n"));
}
- } else {
- my_printf(p->osd, _T("invalid parameter number\n"));
}
} else if(_tcsicmp(params[0], _T("IBL")) == 0 || _tcsicmp(params[0], _T("OBL")) == 0) {
- if(num == 1) {
- break_point_t *bp = get_break_point(debugger, params[0]);
- for(int i = 0; i < MAX_BREAK_POINTS; i++) {
- if(bp->table[i].status) {
- my_printf(p->osd, _T("%x %c %s %08X %s\n"), i,
- bp->table[i].status == 1 ? _T('e') : _T('d'),
- my_get_value_and_symbol(cpu, _T("%08X"), bp->table[i].addr),
- bp->table[i].mask,
- bp->table[i].check_point ? "checkpoint" : "");
- }
- }
+ if(target_debugger == NULL) {
+ my_printf(p->osd, _T("debugger is not attached to target device %s\n"), target->this_device_name);
} else {
- my_printf(p->osd, _T("invalid parameter number\n"));
+ if(num == 1) {
+ break_point_t *bp = get_break_point(target_debugger, params[0]);
+ for(int i = 0; i < MAX_BREAK_POINTS; i++) {
+ if(bp->table[i].status) {
+ my_printf(p->osd, _T("%x %c %s %08X %s\n"), i,
+ bp->table[i].status == 1 ? _T('e') : _T('d'),
+ my_get_value_and_symbol(target, _T("%08X"), bp->table[i].addr),
+ bp->table[i].mask,
+ bp->table[i].check_point ? "checkpoint" : "");
+ }
+ }
+ } else {
+ my_printf(p->osd, _T("invalid parameter number\n"));
+ }
}
} else if(_tcsicmp(params[0], _T("G")) == 0 || _tcsicmp(params[0], _T("P")) == 0) {
if(num == 1 || num == 2) {
bool break_points_stored = false;
if(_tcsicmp(params[0], _T("P")) == 0) {
- debugger->store_break_points();
- debugger->bp.table[0].addr = (cpu->get_next_pc() + cpu->debug_dasm(cpu->get_next_pc(), buffer, 1024)) & cpu->get_debug_prog_addr_mask();
- debugger->bp.table[0].mask = cpu->get_debug_prog_addr_mask();
- debugger->bp.table[0].status = 1;
- debugger->bp.table[0].check_point = false;
+ cpu_debugger->store_break_points();
+ cpu_debugger->bp.table[0].addr = (cpu->get_next_pc() + cpu->debug_dasm(cpu->get_next_pc(), buffer, array_length(buffer))) & cpu->get_debug_prog_addr_mask();
+ cpu_debugger->bp.table[0].mask = cpu->get_debug_prog_addr_mask();
+ cpu_debugger->bp.table[0].status = 1;
+ cpu_debugger->bp.table[0].check_point = false;
break_points_stored = true;
} else if(num >= 2) {
- debugger->store_break_points();
- debugger->bp.table[0].addr = my_hexatoi(cpu, params[1]) & cpu->get_debug_prog_addr_mask();
- debugger->bp.table[0].mask = cpu->get_debug_prog_addr_mask();
- debugger->bp.table[0].status = 1;
- debugger->bp.table[0].check_point = false;
+ cpu_debugger->store_break_points();
+ cpu_debugger->bp.table[0].addr = my_hexatoi(cpu, params[1]) & cpu->get_debug_prog_addr_mask();
+ cpu_debugger->bp.table[0].mask = cpu->get_debug_prog_addr_mask();
+ cpu_debugger->bp.table[0].status = 1;
+ cpu_debugger->bp.table[0].check_point = false;
break_points_stored = true;
}
RESTART_GO:
- debugger->now_going = true;
- debugger->now_suspended = false;
+ cpu_debugger->now_going = true;
+ cpu_debugger->now_suspended = false;
#if defined(_MSC_VER)
- while(!p->request_terminate && !debugger->now_suspended) {
+ while(!p->request_terminate && !cpu_debugger->now_suspended) {
if(p->osd->is_console_key_pressed(VK_ESCAPE) && p->osd->is_console_active()) {
break;
}
p->osd->sleep(10);
}
#elif defined(OSD_QT)
- while(!p->request_terminate && !debugger->now_suspended) {
+ while(!p->request_terminate && !cpu_debugger->now_suspended) {
if(p->osd->console_input_string() != NULL && p->osd->is_console_active()) {
p->osd->clear_console_input_string();
break;
}
#endif
// break cpu
- debugger->now_going = false;
+ cpu_debugger->now_going = false;
wait_count = 0;
- while(!p->request_terminate && !(debugger->now_suspended && debugger->now_waiting)) {
+ while(!p->request_terminate && !(cpu_debugger->now_suspended && cpu_debugger->now_waiting)) {
if((wait_count++) == 100) {
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_INTENSITY);
my_printf(p->osd, _T("waiting until cpu is suspended...\n"));
}
p->osd->sleep(10);
}
- if(cpu == target) {
+ if(target == cpu) {
dasm_addr = cpu->get_next_pc();
}
- p->osd->set_console_text_attribute(FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- cpu->debug_dasm(cpu->get_pc(), buffer, 1024);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
+ cpu->debug_dasm(cpu->get_pc(), buffer, array_length(buffer));
my_printf(p->osd, _T("done\t%s %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()), buffer);
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- cpu->get_debug_regs_info(buffer, 1024);
- my_printf(p->osd, _T("%s\n"), buffer);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
+ if(cpu->get_debug_regs_info(buffer, array_length(buffer))) {
+ my_printf(p->osd, _T("%s\n"), buffer);
+ }
- if(cpu != target) {
- p->osd->set_console_text_attribute(FOREGROUND_GREEN | FOREGROUND_INTENSITY);
- if(target->debug_dasm(target->get_next_pc(), buffer, 1024) != 0) {
+ if(target != cpu) {
+ p->osd->set_console_text_attribute(OSD_CONSOLE_GREEN | OSD_CONSOLE_INTENSITY);
+ if(target->debug_dasm(target->get_next_pc(), buffer, array_length(buffer)) != 0) {
my_printf(p->osd, _T("next\t%s %s\n"), my_get_value_and_symbol(target, _T("%08X"), target->get_next_pc()), buffer);
}
- target->get_debug_regs_info(buffer, 1024);
- my_printf(p->osd, _T("%s\n"), buffer);
+ if(target->get_debug_regs_info(buffer, array_length(buffer))) {
+ my_printf(p->osd, _T("%s\n"), buffer);
+ }
}
- if(debugger->hit()) {
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_INTENSITY);
- if(debugger->bp.hit) {
- if(_tcsicmp(params[0], _T("G")) == 0) {
- my_printf(p->osd, _T("breaked at %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()));
- }
- debugger->bp.hit = false;
- if(debugger->bp.restart) goto RESTART_GO;
- } else if(debugger->rbp.hit) {
- my_printf(p->osd, _T("breaked at %s: memory %s was read at %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
- my_get_value_and_symbol(cpu, _T("%08X"), debugger->rbp.hit_addr),
- my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
- debugger->rbp.hit = false;
- if(debugger->rbp.restart) goto RESTART_GO;
- } else if(debugger->wbp.hit) {
- my_printf(p->osd, _T("breaked at %s: memory %s was written at %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
- my_get_value_and_symbol(cpu, _T("%08X"), debugger->wbp.hit_addr),
- my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
- debugger->wbp.hit = false;
- if(debugger->wbp.restart) goto RESTART_GO;
- } else if(debugger->ibp.hit) {
- my_printf(p->osd, _T("breaked at %s: port %s was read at %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
- my_get_value_and_symbol(cpu, _T("%08X"), debugger->ibp.hit_addr),
- my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
- debugger->ibp.hit = false;
- if(debugger->ibp.restart) goto RESTART_GO;
- } else if(debugger->obp.hit) {
- my_printf(p->osd, _T("breaked at %s: port %s was written at %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
- my_get_value_and_symbol(cpu, _T("%08X"), debugger->obp.hit_addr),
- my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
- debugger->obp.hit = false;
- if(debugger->obp.restart) goto RESTART_GO;
- }
+ if(cpu_debugger->hit()) {
+ show_break_reason(p->osd, cpu, target, (_tcsicmp(params[0], _T("P")) == 0));
+ bool restart = cpu_debugger->restartable();
+ cpu_debugger->clear_hit();
+ if(restart) goto RESTART_GO;
} else {
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_INTENSITY);
my_printf(p->osd, _T("breaked at %s: esc key was pressed\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()));
}
if(break_points_stored) {
- debugger->restore_break_points();
+ cpu_debugger->restore_break_points();
}
- p->osd->set_console_text_attribute(FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- cpu->debug_dasm(cpu->get_next_pc(), buffer, 1024);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
+ cpu->debug_dasm(cpu->get_next_pc(), buffer, array_length(buffer));
my_printf(p->osd, _T("next\t%s %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()), buffer);
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
} else {
my_printf(p->osd, _T("invalid parameter number\n"));
}
steps = my_hexatoi(cpu, params[1]);
}
for(int i = 0; i < steps; i++) {
- debugger->now_going = false;
- debugger->now_suspended = false;
+ cpu_debugger->now_going = false;
+ cpu_debugger->now_suspended = false;
wait_count = 0;
- while(!p->request_terminate && !(debugger->now_suspended && debugger->now_waiting)) {
+ while(!p->request_terminate && !(cpu_debugger->now_suspended && cpu_debugger->now_waiting)) {
if((wait_count++) == 100) {
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_INTENSITY);
my_printf(p->osd, _T("waiting until cpu is suspended...\n"));
}
p->osd->sleep(10);
}
- if(cpu == target) {
+ if(target == cpu) {
dasm_addr = cpu->get_next_pc();
}
- p->osd->set_console_text_attribute(FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- cpu->debug_dasm(cpu->get_pc(), buffer, 1024);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
+ cpu->debug_dasm(cpu->get_pc(), buffer, array_length(buffer));
my_printf(p->osd, _T("done\t%s %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()), buffer);
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- cpu->get_debug_regs_info(buffer, 1024);
- my_printf(p->osd, _T("%s\n"), buffer);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
+ if(cpu->get_debug_regs_info(buffer, array_length(buffer))) {
+ my_printf(p->osd, _T("%s\n"), buffer);
+ }
- if(cpu != target) {
- p->osd->set_console_text_attribute(FOREGROUND_GREEN | FOREGROUND_INTENSITY);
- if(target->debug_dasm(target->get_next_pc(), buffer, 1024) != 0) {
+ if(target != cpu) {
+ p->osd->set_console_text_attribute(OSD_CONSOLE_GREEN | OSD_CONSOLE_INTENSITY);
+ if(target->debug_dasm(target->get_next_pc(), buffer, array_length(buffer)) != 0) {
my_printf(p->osd, _T("next\t%s %s\n"), my_get_value_and_symbol(target, _T("%08X"), target->get_next_pc()), buffer);
}
- target->get_debug_regs_info(buffer, 1024);
- my_printf(p->osd, _T("%s\n"), buffer);
+ if(target->get_debug_regs_info(buffer, array_length(buffer))) {
+ my_printf(p->osd, _T("%s\n"), buffer);
+ }
}
- if(debugger->hit()) {
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_INTENSITY);
- if(debugger->bp.hit) {
- my_printf(p->osd, _T("breaked at %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()));
- debugger->bp.hit = false;
- if(!debugger->bp.restart) break;
- } else if(debugger->rbp.hit) {
- my_printf(p->osd, _T("breaked at %s: memory %s was read at %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
- my_get_value_and_symbol(cpu, _T("%08X"), debugger->rbp.hit_addr),
- my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
- debugger->rbp.hit = false;
- if(!debugger->rbp.restart) break;
- } else if(debugger->wbp.hit) {
- my_printf(p->osd, _T("breaked at %s: memory %s was written at %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
- my_get_value_and_symbol(cpu, _T("%08X"), debugger->wbp.hit_addr),
- my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
- debugger->wbp.hit = false;
- if(!debugger->wbp.restart) break;
- } else if(debugger->ibp.hit) {
- my_printf(p->osd, _T("breaked at %s: port %s was read at %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
- my_get_value_and_symbol(cpu, _T("%08X"), debugger->ibp.hit_addr),
- my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
- debugger->ibp.hit = false;
- if(!debugger->ibp.restart) break;
- } else if(debugger->obp.hit) {
- my_printf(p->osd, _T("breaked at %s: port %s was written at %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()),
- my_get_value_and_symbol(cpu, _T("%08X"), debugger->obp.hit_addr),
- my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_pc()));
- debugger->obp.hit = false;
- if(!debugger->obp.restart) break;
- }
+ if(cpu_debugger->hit()) {
+ show_break_reason(p->osd, cpu, target, false);
+ bool restart = cpu_debugger->restartable();
+ cpu_debugger->clear_hit();
+ if(!restart) break;
} else if(p->osd->is_console_key_pressed(VK_ESCAPE) && p->osd->is_console_active()) {
break;
}
}
- p->osd->set_console_text_attribute(FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- cpu->debug_dasm(cpu->get_next_pc(), buffer, 1024);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
+ cpu->debug_dasm(cpu->get_next_pc(), buffer, array_length(buffer));
my_printf(p->osd, _T("next\t%s %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()), buffer);
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
} else {
my_printf(p->osd, _T("invalid parameter number\n"));
}
} else if(_tcsicmp(params[1], _T("DEVICE")) == 0) {
if(num == 2) {
for(DEVICE* device = p->vm->first_device; device; device = device->next_device) {
- my_printf(p->osd, _T("ID=%02X %s"), device->this_device_id, device->this_device_name);
- if(device == target) {
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_INTENSITY);
- my_printf(p->osd, _T(" <=== target"));
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
+ if(device->is_debugger_available()) {
+ my_printf(p->osd, _T("ID=%02X %s"), device->this_device_id, device->this_device_name);
+ if(device == target) {
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_INTENSITY);
+ my_printf(p->osd, _T(" <=== target"));
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
+ }
+ my_printf(p->osd, _T("\n"));
}
- my_printf(p->osd, _T("\n"));
}
} else if(num == 3) {
DEVICE *device = NULL;
} else {
device = p->vm->get_device(my_hexatoi(NULL, params[2]));
}
- if(device != NULL) {
+ if(device != NULL && device->is_debugger_available()) {
if(device != target) {
+ if(target_debugger != NULL) {
+ target_debugger->now_device_debugging = false;
+ }
+ cpu_debugger->set_context_child(NULL);
target = device;
target_debugger = (DEBUGGER *)target->get_debugger();
+ if(target_debugger != NULL) {
+ if(target != cpu) {
+ target_debugger->now_device_debugging = true;
+ cpu_debugger->set_context_child(target_debugger);
+ } else {
+ target_debugger->now_device_debugging = false;
+ }
+ }
dump_addr = 0;
dasm_addr = target->get_next_pc();
}
} else if(_tcsicmp(params[1], _T("CPU")) == 0) {
if(num == 2) {
for(DEVICE* device = p->vm->first_device; device; device = device->next_device) {
- if(device->get_debugger() != NULL) {
+ if(device->is_cpu() && device->get_debugger() != NULL) {
my_printf(p->osd, _T("ID=%02X %s"), device->this_device_id, device->this_device_name);
if(device == cpu) {
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_INTENSITY);
my_printf(p->osd, _T(" <=== target"));
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
}
my_printf(p->osd, _T("\n"));
}
}
} else if(num == 3) {
DEVICE *device = p->vm->get_device(my_hexatoi(NULL, params[2]));
- if(device != NULL && device->get_debugger() != NULL) {
+ if(device != NULL && device->is_cpu() && device->get_debugger() != NULL) {
if(device != cpu) {
- DEBUGGER *prev_debugger = debugger;
+ DEBUGGER *prev_debugger = cpu_debugger;
cpu = device;
- debugger = (DEBUGGER *)cpu->get_debugger();
- debugger->now_going = false;
- debugger->now_debugging = true;
+ cpu_debugger = (DEBUGGER *)cpu->get_debugger();
+ cpu_debugger->set_context_child(NULL);
+ cpu_debugger->now_going = false;
+ cpu_debugger->now_debugging = true;
prev_debugger->now_debugging = prev_debugger->now_going = prev_debugger->now_suspended = prev_debugger->now_waiting = false;
+ if(target_debugger != NULL) {
+ target_debugger->now_device_debugging = false;
+ }
+ target = cpu;
+ target_debugger = cpu_debugger;
wait_count = 0;
- while(!p->request_terminate && !(debugger->now_suspended && debugger->now_waiting)) {
+ while(!p->request_terminate && !(cpu_debugger->now_suspended && cpu_debugger->now_waiting)) {
if((wait_count++) == 100) {
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_INTENSITY);
my_printf(p->osd, _T("waiting until cpu is suspended...\n"));
}
p->osd->sleep(10);
dump_addr = 0;
dasm_addr = cpu->get_next_pc();
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- cpu->get_debug_regs_info(buffer, 1024);
- my_printf(p->osd, _T("%s\n"), buffer);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
+ if(cpu->get_debug_regs_info(buffer, array_length(buffer))) {
+ my_printf(p->osd, _T("%s\n"), buffer);
+ }
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_INTENSITY);
my_printf(p->osd, _T("breaked at %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()));
- p->osd->set_console_text_attribute(FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- cpu->debug_dasm(cpu->get_next_pc(), buffer, 1024);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
+ cpu->debug_dasm(cpu->get_next_pc(), buffer, array_length(buffer));
my_printf(p->osd, _T("next\t%s %s\n"), my_get_value_and_symbol(cpu, _T("%08X"), cpu->get_next_pc()), buffer);
- p->osd->set_console_text_attribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
+ p->osd->set_console_text_attribute(OSD_CONSOLE_RED | OSD_CONSOLE_GREEN | OSD_CONSOLE_BLUE | OSD_CONSOLE_INTENSITY);
}
} else {
my_printf(p->osd, _T("device not found\n"));
} else {
my_printf(p->osd, _T("unknown command ! %s\n"), params[1]);
}
+ } else if(_tcsicmp(params[0], _T("!!")) == 0) {
+ // do nothing
} else if(_tcsicmp(params[0], _T("?")) == 0) {
my_printf(p->osd, _T("D [<range>] - dump memory\n"));
my_printf(p->osd, _T("E[{B,W,D}] <address> <list> - edit memory (byte,word,dword)\n"));
my_printf(p->osd, _T("{R,W}BP <address> - set breakpoint (break at memory access)\n"));
my_printf(p->osd, _T("{I,O}BP <port> [<mask>] - set breakpoint (break at i/o access)\n"));
my_printf(p->osd, _T("[{R,W,I,O}]B{C,D,E} {*,<list>} - clear/disable/enable breakpoint(s)\n"));
- my_printf(p->osd, _T("[{R,W,I,O}]BL - list breakpoint(s)\n"));
+ my_printf(p->osd, _T("[{R,W,I,O}]BL - list breakpoints\n"));
my_printf(p->osd, _T("[{R,W,I,O}]CP <address/port> [<mask>] - set checkpoint (don't break)\n"));
my_printf(p->osd, _T("G - go (press esc key to break)\n"));
- my_printf(p->osd, _T("G <address> - go and break at address\n"));
- my_printf(p->osd, _T("P - trace one opcode (step over)\n"));
+ my_printf(p->osd, _T("G <address> - go and break at address (ignore breakpoints)\n"));
+ my_printf(p->osd, _T("P - trace one opcode (step over, ignore breakpoints)\n"));
my_printf(p->osd, _T("T [<count>] - trace (step in)\n"));
my_printf(p->osd, _T("Q - quit\n"));
my_printf(p->osd, _T("! reset [all/cpu/target] - reset\n"));
my_printf(p->osd, _T("! key <code> [<msec>] - press key\n"));
- my_printf(p->osd, _T("! device - enumerate device\n"));
+ my_printf(p->osd, _T("! device - enumerate debugger available device\n"));
my_printf(p->osd, _T("! device <id/cpu> - select target device\n"));
- my_printf(p->osd, _T("! cpu - enumerate cpu\n"));
+ my_printf(p->osd, _T("! cpu - enumerate debugger available cpu\n"));
my_printf(p->osd, _T("! cpu <id> - select target cpu\n"));
+ my_printf(p->osd, _T("!! <remark> - do nothing\n"));
my_printf(p->osd, _T("<value> - hexa, decimal(%%d), ascii('a')\n"));
} else {
// stop debugger
try {
- debugger->now_debugging = debugger->now_going = debugger->now_suspended = debugger->now_waiting = false;
+ if(target_debugger != NULL) {
+ target_debugger->now_device_debugging = false;
+ }
+ cpu_debugger->now_debugging = cpu_debugger->now_going = cpu_debugger->now_suspended = cpu_debugger->now_waiting = false;
} catch(...) {
}
if(!(now_debugging && debugger_thread_param.cpu_index == cpu_index)) {
close_debugger();
if(vm->get_cpu(cpu_index) != NULL && vm->get_cpu(cpu_index)->get_debugger() != NULL) {
-// debugger_thread_param.emu = this;
+ debugger_thread_param.emu = this;
debugger_thread_param.osd = osd;
debugger_thread_param.vm = vm;
debugger_thread_param.cpu_index = cpu_index;
return (vm->get_cpu(cpu_index) != NULL && vm->get_cpu(cpu_index)->get_debugger() != NULL);
}
+void EMU::start_waiting_in_debugger()
+{
+ now_waiting_in_debugger = true;
+ osd->mute_sound();
+ osd->start_waiting_in_debugger();
+}
+
+void EMU::finish_waiting_in_debugger()
+{
+ osd->finish_waiting_in_debugger();
+ now_waiting_in_debugger = false;
+}
+
+void EMU::process_waiting_in_debugger()
+{
+ osd->process_waiting_in_debugger();
+ osd->sleep(10);
+}
+
#endif
#ifdef USE_CPU_TYPE
cpu_type = config.cpu_type;
#endif
+#ifdef USE_DIPSWITCH
+ dipswitch = config.dipswitch;
+#endif
#ifdef USE_SOUND_TYPE
sound_type = config.sound_type;
#endif
#ifdef USE_DEBUGGER
initialize_debugger();
#endif
+ now_waiting_in_debugger = false;
initialize_media();
vm->initialize_sound(sound_rate, sound_samples);
#ifdef USE_SOUND_VOLUME
reinitialize |= (cpu_type != config.cpu_type);
cpu_type = config.cpu_type;
#endif
+#ifdef USE_DIPSWITCH
+ reinitialize |= (dipswitch != config.dipswitch);
+ dipswitch = config.dipswitch;
+#endif
#ifdef USE_SOUND_TYPE
reinitialize |= (sound_type != config.sound_type);
sound_type = config.sound_type;
int EMU::draw_screen()
{
+#ifdef ONE_BOARD_MICRO_COMPUTER
+ if(now_waiting_in_debugger) {
+ osd->reload_bitmap();
+ }
+#endif
return osd->draw_screen();
}
#endif
#ifdef USE_FLOPPY_DISK
+void EMU::create_bank_floppy_disk(const _TCHAR* file_path, uint8_t type)
+{
+ /*
+ type: 0x00 = 2D, 0x10 = 2DD, 0x20 = 2HD
+ */
+ struct {
+ char title[17];
+ uint8_t rsrv[9];
+ uint8_t protect;
+ uint8_t type;
+ uint32_t size;
+ uint32_t trkptr[164];
+ } d88_hdr;
+
+ memset(&d88_hdr, 0, sizeof(d88_hdr));
+ my_strcpy_s(d88_hdr.title, sizeof(d88_hdr.title), "BLANK");
+ d88_hdr.type = type;
+ d88_hdr.size = sizeof(d88_hdr);
+
+ FILEIO *fio = new FILEIO();
+ if(fio->Fopen(file_path, FILEIO_WRITE_BINARY)) {
+ fio->Fwrite(&d88_hdr, sizeof(d88_hdr), 1);
+ fio->Fclose();
+ }
+ delete fio;
+}
+
void EMU::open_floppy_disk(int drv, const _TCHAR* file_path, int bank)
{
if(drv < USE_FLOPPY_DISK) {
reinitialize |= (cpu_type != config.cpu_type);
cpu_type = config.cpu_type;
#endif
+#ifdef USE_DIPSWITCH
+ reinitialize |= (dipswitch != config.dipswitch);
+ dipswitch = config.dipswitch;
+#endif
#ifdef USE_SOUND_TYPE
reinitialize |= (sound_type != config.sound_type);
sound_type = config.sound_type;
class CSP_DebuggerThread;
#endif
typedef struct {
+ EMU *emu;
OSD *osd;
VM_TEMPLATE *vm;
int cpu_index;
#ifdef USE_CPU_TYPE
int cpu_type;
#endif
+#ifdef USE_DIPSWITCH
+ uint32_t dipswitch;
+#endif
#ifdef USE_SOUND_TYPE
int sound_type;
#endif
// ----------------------------------------
// for windows
// ----------------------------------------
-#ifdef OSD_QT
- // qt dependent
- EmuThreadClass *get_parent_handler();
- void set_parent_handler(EmuThreadClass *p, DrawThreadClass *q);
VM_TEMPLATE *get_vm()
{
return (VM_TEMPLATE *)vm;
{
return osd;
}
+#ifdef OSD_QT
+ // qt dependent
+ EmuThreadClass *get_parent_handler();
+ void set_parent_handler(EmuThreadClass *p, DrawThreadClass *q);
void set_host_cpus(int v);
int get_host_cpus();
#endif
int debugger_thread_id;
#endif
#endif
+ void start_waiting_in_debugger();
+ void finish_waiting_in_debugger();
+ void process_waiting_in_debugger();
+ bool now_waiting_in_debugger;
// debug log
void out_debug_log(const _TCHAR* format, ...);
int bank_num;
int cur_bank;
} d88_file[USE_FLOPPY_DISK];
+ void create_bank_floppy_disk(const _TCHAR* file_path, uint8_t type);
+ void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
+ void close_floppy_disk(int drv);
+ bool is_floppy_disk_inserted(int drv);
+ void is_floppy_disk_protected(int drv, bool value);
+ bool is_floppy_disk_protected(int drv);
+ uint32_t is_floppy_disk_accessed();
#endif
// user interface
void close_cart(int drv);
bool is_cart_inserted(int drv);
#endif
-#ifdef USE_FLOPPY_DISK
- void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
- void close_floppy_disk(int drv);
- bool is_floppy_disk_inserted(int drv);
- void is_floppy_disk_protected(int drv, bool value);
- bool is_floppy_disk_protected(int drv);
- uint32_t is_floppy_disk_accessed();
-#endif
#ifdef USE_QUICK_DISK
void open_quick_disk(int drv, const _TCHAR* file_path);
void close_quick_disk(int drv);
void free_sound_file(int id, int16_t **data);
#endif
};
+
#endif // _EMU_H_
MENUITEM "Play CMT Noise", ID_VM_SOUND_NOISE_CMT
MENUITEM "Play CMT Sound", ID_VM_SOUND_PLAY_TAPE
END
+ POPUP "Display"
+ BEGIN
+ MENUITEM "Green", ID_VM_MONITOR_TYPE0
+ MENUITEM "Color (COLOR GAL 5)", ID_VM_MONITOR_TYPE1
+ MENUITEM "Both Green and Color", ID_VM_MONITOR_TYPE2
+ MENUITEM "Both Color and Green", ID_VM_MONITOR_TYPE3
+ END
POPUP "Printer"
BEGIN
MENUITEM "Write Printer to File", ID_VM_PRINTER_TYPE0
POPUP "Display"
BEGIN
MENUITEM "White (MZ-80K)", ID_VM_MONITOR_TYPE0
- MENUITEM "Green (MZ-80C)", ID_VM_MONITOR_TYPE1
+ MENUITEM "Green (MZ-80C)", ID_VM_MONITOR_TYPE4
+ MENUITEM "Color (COLOR GAL 5)", ID_VM_MONITOR_TYPE1
+ MENUITEM "Both White and Color", ID_VM_MONITOR_TYPE2
+ MENUITEM "Both Color and White", ID_VM_MONITOR_TYPE3
+ MENUITEM "Both Green and Color", ID_VM_MONITOR_TYPE6
+ MENUITEM "Both Color and Green", ID_VM_MONITOR_TYPE7
END
POPUP "Printer"
BEGIN
BEGIN
POPUP "Sound"
BEGIN
+ MENUITEM "GSX-8800", ID_VM_DIPSWITCH2
+ MENUITEM "PCG-8100", ID_VM_DIPSWITCH3
+ MENUITEM SEPARATOR
MENUITEM "Play FDD Noise", ID_VM_SOUND_NOISE_FDD
MENUITEM "Play CMT Noise", ID_VM_SOUND_NOISE_CMT, GRAYED
MENUITEM "Play CMT Sound", ID_VM_SOUND_PLAY_TAPE, GRAYED
// Dialog
//
-IDD_VOLUME DIALOG DISCARDABLE 0, 0, 250, 120
+IDD_VOLUME DIALOG DISCARDABLE 0, 0, 250, 150
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Volume"
FONT 9, "MS PGothic"
LTEXT "Sound Device #3",IDC_VOLUME_CAPTION2,6,66,60,8
CONTROL "",IDC_VOLUME_PARAM_L2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,66,175,12
CONTROL "",IDC_VOLUME_PARAM_R2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,81,175,12
- DEFPUSHBUTTON "OK",IDOK,70,100,50,14
- DEFPUSHBUTTON "Reset",IDC_VOLUME_RESET,130,100,50,14
+ LTEXT "Sound Device #4",IDC_VOLUME_CAPTION3,6,96,60,8
+ CONTROL "",IDC_VOLUME_PARAM_L3,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,96,175,12
+ CONTROL "",IDC_VOLUME_PARAM_R3,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,111,175,12
+ DEFPUSHBUTTON "OK",IDOK,70,130,50,14
+ DEFPUSHBUTTON "Reset",IDC_VOLUME_RESET,130,130,50,14
END
IDD_JOYSTICK DIALOG DISCARDABLE 0, 0, 175, 120
BEGIN
POPUP "Boot"
BEGIN
- MENUITEM "N80 mode" ID_VM_BOOT_MODE0
- MENUITEM "N mode" ID_VM_BOOT_MODE2
+ MENUITEM "N80 mode" ID_VM_BOOT_MODE0
+ MENUITEM "N mode" ID_VM_BOOT_MODE2
END
POPUP "Sound"
BEGIN
- MENUITEM "OPN", ID_VM_SOUND_TYPE0
- MENUITEM "OPNA", ID_VM_SOUND_TYPE1
+ MENUITEM "None", ID_VM_SOUND_TYPE0
+ MENUITEM "OPN", ID_VM_SOUND_TYPE1
+ MENUITEM SEPARATOR
+ MENUITEM "GSX-8800", ID_VM_DIPSWITCH2
+ MENUITEM "PCG-8100", ID_VM_DIPSWITCH3
MENUITEM SEPARATOR
MENUITEM "Play FDD Noise", ID_VM_SOUND_NOISE_FDD
MENUITEM "Play CMT Noise", ID_VM_SOUND_NOISE_CMT, GRAYED
// Dialog
//
-IDD_VOLUME DIALOG DISCARDABLE 0, 0, 250, 240
+IDD_VOLUME DIALOG DISCARDABLE 0, 0, 250, 210
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Volume"
FONT 9, "MS PGothic"
LTEXT "Sound Device #6",IDC_VOLUME_CAPTION5,6,156,60,8
CONTROL "",IDC_VOLUME_PARAM_L5,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,156,175,12
CONTROL "",IDC_VOLUME_PARAM_R5,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,171,175,12
- LTEXT "Sound Device #7",IDC_VOLUME_CAPTION6,6,186,60,8
- CONTROL "",IDC_VOLUME_PARAM_L6,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,186,175,12
- CONTROL "",IDC_VOLUME_PARAM_R6,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,201,175,12
- DEFPUSHBUTTON "OK",IDOK,70,220,50,14
- DEFPUSHBUTTON "Reset",IDC_VOLUME_RESET,130,220,50,14
+ DEFPUSHBUTTON "OK",IDOK,70,190,50,14
+ DEFPUSHBUTTON "Reset",IDC_VOLUME_RESET,130,190,50,14
END
IDD_JOYSTICK DIALOG DISCARDABLE 0, 0, 175, 120
BEGIN
POPUP "Boot"
BEGIN
- MENUITEM "N80 mode" ID_VM_BOOT_MODE0
- MENUITEM "N80(SR) mode" ID_VM_BOOT_MODE1
- MENUITEM "N mode" ID_VM_BOOT_MODE2
+ MENUITEM "N80 mode" ID_VM_BOOT_MODE0
+ MENUITEM "N80(SR) mode" ID_VM_BOOT_MODE1
+ MENUITEM "N mode" ID_VM_BOOT_MODE2
END
POPUP "DIP Switch"
BEGIN
END
POPUP "Sound"
BEGIN
- MENUITEM "OPN", ID_VM_SOUND_TYPE0
- MENUITEM "OPN+OPN", ID_VM_SOUND_TYPE1
- MENUITEM "OPN+OPNA", ID_VM_SOUND_TYPE2
+ MENUITEM "OPN", ID_VM_SOUND_TYPE0
+ MENUITEM "OPN+OPN", ID_VM_SOUND_TYPE1
+ MENUITEM SEPARATOR
+ MENUITEM "GSX-8800", ID_VM_DIPSWITCH2
+ MENUITEM "PCG-8100", ID_VM_DIPSWITCH3
MENUITEM SEPARATOR
MENUITEM "Play FDD Noise", ID_VM_SOUND_NOISE_FDD
MENUITEM "Play CMT Noise", ID_VM_SOUND_NOISE_CMT, GRAYED
// Dialog
//
-IDD_VOLUME DIALOG DISCARDABLE 0, 0, 250, 360
+IDD_VOLUME DIALOG DISCARDABLE 0, 0, 250, 270
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Volume"
FONT 9, "MS PGothic"
LTEXT "Sound Device #2",IDC_VOLUME_CAPTION1,6,36,60,8
CONTROL "",IDC_VOLUME_PARAM_L1,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,36,175,12
CONTROL "",IDC_VOLUME_PARAM_R1,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,51,175,12
- LTEXT "Sound Device #3",IDC_VOLUME_CAPTION2,6,66,60,8,WS_DISABLED
- CONTROL "",IDC_VOLUME_PARAM_L2,"msctls_trackbar32",TBS_AUTOTICKS | WS_DISABLED | WS_TABSTOP,70,66,175,12
- CONTROL "",IDC_VOLUME_PARAM_R2,"msctls_trackbar32",TBS_AUTOTICKS | WS_DISABLED | WS_TABSTOP,70,81,175,12
- LTEXT "Sound Device #4",IDC_VOLUME_CAPTION3,6,96,60,8,WS_DISABLED
- CONTROL "",IDC_VOLUME_PARAM_L3,"msctls_trackbar32",TBS_AUTOTICKS | WS_DISABLED | WS_TABSTOP,70,96,175,12
- CONTROL "",IDC_VOLUME_PARAM_R3,"msctls_trackbar32",TBS_AUTOTICKS | WS_DISABLED | WS_TABSTOP,70,111,175,12
+ LTEXT "Sound Device #3",IDC_VOLUME_CAPTION2,6,66,60,8
+ CONTROL "",IDC_VOLUME_PARAM_L2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,66,175,12
+ CONTROL "",IDC_VOLUME_PARAM_R2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,81,175,12
+ LTEXT "Sound Device #4",IDC_VOLUME_CAPTION3,6,96,60,8
+ CONTROL "",IDC_VOLUME_PARAM_L3,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,96,175,12
+ CONTROL "",IDC_VOLUME_PARAM_R3,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,111,175,12
LTEXT "Sound Device #5",IDC_VOLUME_CAPTION4,6,126,60,8
CONTROL "",IDC_VOLUME_PARAM_L4,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,126,175,12
CONTROL "",IDC_VOLUME_PARAM_R4,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,141,175,12
LTEXT "Sound Device #8",IDC_VOLUME_CAPTION7,6,216,60,8
CONTROL "",IDC_VOLUME_PARAM_L7,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,216,175,12
CONTROL "",IDC_VOLUME_PARAM_R7,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,231,175,12
- LTEXT "Sound Device #9",IDC_VOLUME_CAPTION8,6,246,60,8
- CONTROL "",IDC_VOLUME_PARAM_L8,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,246,175,12
- CONTROL "",IDC_VOLUME_PARAM_R8,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,261,175,12
- LTEXT "Sound Device #10",IDC_VOLUME_CAPTION9,6,276,60,8
- CONTROL "",IDC_VOLUME_PARAM_L9,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,276,175,12
- CONTROL "",IDC_VOLUME_PARAM_R9,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,291,175,12
- LTEXT "Sound Device #11",IDC_VOLUME_CAPTION10,6,306,60,8
- CONTROL "",IDC_VOLUME_PARAM_L10,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,306,175,12
- CONTROL "",IDC_VOLUME_PARAM_R10,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,321,175,12
- DEFPUSHBUTTON "OK",IDOK,70,340,50,14
- DEFPUSHBUTTON "Reset",IDC_VOLUME_RESET,130,340,50,14
+ DEFPUSHBUTTON "OK",IDOK,70,250,50,14
+ DEFPUSHBUTTON "Reset",IDC_VOLUME_RESET,130,250,50,14
END
IDD_JOYSTICK DIALOG DISCARDABLE 0, 0, 175, 120
BEGIN
POPUP "Boot"
BEGIN
- MENUITEM "N88 mode" ID_VM_BOOT_MODE0
- MENUITEM "N mode" ID_VM_BOOT_MODE3
+ MENUITEM "N88 mode" ID_VM_BOOT_MODE0
+ MENUITEM "N mode" ID_VM_BOOT_MODE3
END
POPUP "Sound"
BEGIN
+ MENUITEM "None", ID_VM_SOUND_TYPE0
+ MENUITEM "OPN", ID_VM_SOUND_TYPE1
+ MENUITEM SEPARATOR
+ MENUITEM "GSX-8800", ID_VM_DIPSWITCH2
+ MENUITEM "PCG-8100", ID_VM_DIPSWITCH3
+ MENUITEM SEPARATOR
MENUITEM "Play FDD Noise", ID_VM_SOUND_NOISE_FDD
MENUITEM "Play CMT Noise", ID_VM_SOUND_NOISE_CMT, GRAYED
MENUITEM "Play CMT Sound", ID_VM_SOUND_PLAY_TAPE, GRAYED
// Dialog
//
-IDD_VOLUME DIALOG DISCARDABLE 0, 0, 250, 120
+IDD_VOLUME DIALOG DISCARDABLE 0, 0, 250, 150
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Volume"
FONT 9, "MS PGothic"
LTEXT "Sound Device #3",IDC_VOLUME_CAPTION2,6,66,60,8
CONTROL "",IDC_VOLUME_PARAM_L2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,66,175,12
CONTROL "",IDC_VOLUME_PARAM_R2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,81,175,12
- DEFPUSHBUTTON "OK",IDOK,70,100,50,14
- DEFPUSHBUTTON "Reset",IDC_VOLUME_RESET,130,100,50,14
+ LTEXT "Sound Device #4",IDC_VOLUME_CAPTION3,6,96,60,8
+ CONTROL "",IDC_VOLUME_PARAM_L3,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,96,175,12
+ CONTROL "",IDC_VOLUME_PARAM_R3,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,111,175,12
+ DEFPUSHBUTTON "OK",IDOK,70,130,50,14
+ DEFPUSHBUTTON "Reset",IDC_VOLUME_RESET,130,130,50,14
END
IDD_JOYSTICK DIALOG DISCARDABLE 0, 0, 175, 120
BEGIN
POPUP "Boot"
BEGIN
- MENUITEM "N88-V1(S) mode" ID_VM_BOOT_MODE0
- MENUITEM "N88-V1(H) mode" ID_VM_BOOT_MODE1
- MENUITEM "N88-V2 mode" ID_VM_BOOT_MODE2
- MENUITEM "N mode" ID_VM_BOOT_MODE3
+ MENUITEM "N88-V1(S) mode" ID_VM_BOOT_MODE0
+ MENUITEM "N88-V1(H) mode" ID_VM_BOOT_MODE1
+ MENUITEM "N88-V2 mode" ID_VM_BOOT_MODE2
+ MENUITEM "N mode" ID_VM_BOOT_MODE3
+ MENUITEM "N88-V2(CD) mode" ID_VM_BOOT_MODE4
END
POPUP "CPU"
BEGIN
- MENUITEM "Z80 8MHz", ID_VM_CPU_TYPE0
- MENUITEM "Z80 4MHz", ID_VM_CPU_TYPE1
- MENUITEM "Z80 8MHz (FE2/MC)", ID_VM_CPU_TYPE2
+ MENUITEM "Z80 8MHz", ID_VM_CPU_TYPE0
+ MENUITEM "Z80 4MHz", ID_VM_CPU_TYPE1
+ MENUITEM "Z80 8MHz (FE2/MC)", ID_VM_CPU_TYPE2
END
POPUP "DIP Switch"
BEGIN
- MENUITEM "Memory Wait", ID_VM_DIPSWITCH0
+ MENUITEM "Memory Wait", ID_VM_DIPSWITCH0
END
POPUP "Joystick"
BEGIN
- MENUITEM "Joystick" ID_VM_JOYSTICK_TYPE0
- MENUITEM "Bus Mouse" ID_VM_JOYSTICK_TYPE1
+ MENUITEM "Joystick" ID_VM_JOYSTICK_TYPE0
+ MENUITEM "Bus Mouse" ID_VM_JOYSTICK_TYPE1
END
POPUP "Sound"
BEGIN
- MENUITEM "OPNA", ID_VM_SOUND_TYPE0
- MENUITEM "OPN", ID_VM_SOUND_TYPE1
- MENUITEM "OPN+OPNA", ID_VM_SOUND_TYPE2
- MENUITEM "OPN+OPN", ID_VM_SOUND_TYPE3
- MENUITEM "OPNA+OPNA", ID_VM_SOUND_TYPE4
- MENUITEM "OPNA+OPN", ID_VM_SOUND_TYPE5
+ MENUITEM "OPNA", ID_VM_SOUND_TYPE0
+ MENUITEM "OPN", ID_VM_SOUND_TYPE1
+ MENUITEM "OPN+OPNA", ID_VM_SOUND_TYPE2
+ MENUITEM "OPN+OPN", ID_VM_SOUND_TYPE3
+ MENUITEM "OPNA+OPNA", ID_VM_SOUND_TYPE4
+ MENUITEM "OPNA+OPN", ID_VM_SOUND_TYPE5
MENUITEM SEPARATOR
- MENUITEM "Play FDD Noise", ID_VM_SOUND_NOISE_FDD
- MENUITEM "Play CMT Noise", ID_VM_SOUND_NOISE_CMT, GRAYED
- MENUITEM "Play CMT Sound", ID_VM_SOUND_PLAY_TAPE, GRAYED
+ MENUITEM "HMB-20", ID_VM_DIPSWITCH1
+ MENUITEM "GSX-8800", ID_VM_DIPSWITCH2
+ MENUITEM "PCG-8100", ID_VM_DIPSWITCH3
+ MENUITEM SEPARATOR
+ MENUITEM "Play FDD Noise", ID_VM_SOUND_NOISE_FDD
+ MENUITEM "Play CMT Noise", ID_VM_SOUND_NOISE_CMT, GRAYED
+ MENUITEM "Play CMT Sound", ID_VM_SOUND_PLAY_TAPE, GRAYED
END
POPUP "Display"
BEGIN
- MENUITEM "High Resolution", ID_VM_MONITOR_TYPE0
- MENUITEM "Standard", ID_VM_MONITOR_TYPE1
+ MENUITEM "High Resolution", ID_VM_MONITOR_TYPE0
+ MENUITEM "Standard", ID_VM_MONITOR_TYPE1
MENUITEM SEPARATOR
- MENUITEM "Scanline", ID_VM_MONITOR_SCANLINE
+ MENUITEM "Scanline", ID_VM_MONITOR_SCANLINE
END
POPUP "Printer"
BEGIN
- MENUITEM "Write Printer to File", ID_VM_PRINTER_TYPE0
- MENUITEM "PC-PR201", ID_VM_PRINTER_TYPE1, GRAYED
- MENUITEM "None", ID_VM_PRINTER_TYPE2
+ MENUITEM "Write Printer to File", ID_VM_PRINTER_TYPE0
+ MENUITEM "PC-PR201", ID_VM_PRINTER_TYPE1, GRAYED
+ MENUITEM "None", ID_VM_PRINTER_TYPE2
END
END
POPUP "Host"
MENUITEM SEPARATOR
POPUP "Screen"
BEGIN
- MENUITEM "Window x1", ID_SCREEN_WINDOW
- MENUITEM "Fullscreen 640x400", ID_SCREEN_FULLSCREEN
+ MENUITEM "Window x1", ID_SCREEN_WINDOW
+ MENUITEM "Fullscreen 640x400", ID_SCREEN_FULLSCREEN
MENUITEM SEPARATOR
- MENUITEM "Window Stretch 1", ID_SCREEN_WINDOW_STRETCH
- MENUITEM "Window Stretch 2", ID_SCREEN_WINDOW_ASPECT
+ MENUITEM "Window Stretch 1", ID_SCREEN_WINDOW_STRETCH
+ MENUITEM "Window Stretch 2", ID_SCREEN_WINDOW_ASPECT
MENUITEM SEPARATOR
- MENUITEM "Fullscreen Stretch 1", ID_SCREEN_FULLSCREEN_DOTBYDOT
- MENUITEM "Fullscreen Stretch 2", ID_SCREEN_FULLSCREEN_STRETCH
- MENUITEM "Fullscreen Stretch 3", ID_SCREEN_FULLSCREEN_ASPECT
- MENUITEM "Fullscreen Stretch 4", ID_SCREEN_FULLSCREEN_FILL
+ MENUITEM "Fullscreen Stretch 1", ID_SCREEN_FULLSCREEN_DOTBYDOT
+ MENUITEM "Fullscreen Stretch 2", ID_SCREEN_FULLSCREEN_STRETCH
+ MENUITEM "Fullscreen Stretch 3", ID_SCREEN_FULLSCREEN_ASPECT
+ MENUITEM "Fullscreen Stretch 4", ID_SCREEN_FULLSCREEN_FILL
MENUITEM SEPARATOR
- MENUITEM "Rotate 0deg", ID_SCREEN_ROTATE_0
- MENUITEM "Rotate +90deg", ID_SCREEN_ROTATE_90
- MENUITEM "Rotate 180deg", ID_SCREEN_ROTATE_180
- MENUITEM "Rotate -90deg", ID_SCREEN_ROTATE_270
+ MENUITEM "Rotate 0deg", ID_SCREEN_ROTATE_0
+ MENUITEM "Rotate +90deg", ID_SCREEN_ROTATE_90
+ MENUITEM "Rotate 180deg", ID_SCREEN_ROTATE_180
+ MENUITEM "Rotate -90deg", ID_SCREEN_ROTATE_270
END
POPUP "Filter"
BEGIN
- MENUITEM "RGB Filter", ID_FILTER_RGB
- MENUITEM "None", ID_FILTER_NONE
+ MENUITEM "RGB Filter", ID_FILTER_RGB
+ MENUITEM "None", ID_FILTER_NONE
END
POPUP "Sound"
BEGIN
- MENUITEM "2000Hz", ID_SOUND_FREQ0
- MENUITEM "4000Hz", ID_SOUND_FREQ1
- MENUITEM "8000Hz", ID_SOUND_FREQ2
- MENUITEM "11025Hz", ID_SOUND_FREQ3
- MENUITEM "22050Hz", ID_SOUND_FREQ4
- MENUITEM "44100Hz", ID_SOUND_FREQ5
- MENUITEM "55467Hz", ID_SOUND_FREQ6
- MENUITEM "96000Hz", ID_SOUND_FREQ7
+ MENUITEM "2000Hz", ID_SOUND_FREQ0
+ MENUITEM "4000Hz", ID_SOUND_FREQ1
+ MENUITEM "8000Hz", ID_SOUND_FREQ2
+ MENUITEM "11025Hz", ID_SOUND_FREQ3
+ MENUITEM "22050Hz", ID_SOUND_FREQ4
+ MENUITEM "44100Hz", ID_SOUND_FREQ5
+ MENUITEM "55467Hz", ID_SOUND_FREQ6
+ MENUITEM "96000Hz", ID_SOUND_FREQ7
MENUITEM SEPARATOR
- MENUITEM "50msec", ID_SOUND_LATE0
- MENUITEM "100msec", ID_SOUND_LATE1
- MENUITEM "200msec", ID_SOUND_LATE2
- MENUITEM "300msec", ID_SOUND_LATE3
- MENUITEM "400msec", ID_SOUND_LATE4
+ MENUITEM "50msec", ID_SOUND_LATE0
+ MENUITEM "100msec", ID_SOUND_LATE1
+ MENUITEM "200msec", ID_SOUND_LATE2
+ MENUITEM "300msec", ID_SOUND_LATE3
+ MENUITEM "400msec", ID_SOUND_LATE4
MENUITEM SEPARATOR
- MENUITEM "Realtime Mix", ID_SOUND_STRICT_RENDER
- MENUITEM "Light Weight Mix", ID_SOUND_LIGHT_RENDER
+ MENUITEM "Realtime Mix", ID_SOUND_STRICT_RENDER
+ MENUITEM "Light Weight Mix", ID_SOUND_LIGHT_RENDER
MENUITEM SEPARATOR
- MENUITEM "Volume", ID_SOUND_VOLUME
+ MENUITEM "Volume", ID_SOUND_VOLUME
END
POPUP "Input"
BEGIN
- MENUITEM "Joystick #1", ID_INPUT_JOYSTICK0
- MENUITEM "Joystick #2", ID_INPUT_JOYSTICK1
- MENUITEM "Joystick To Keyboard", ID_INPUT_JOYTOKEY
+ MENUITEM "Joystick #1", ID_INPUT_JOYSTICK0
+ MENUITEM "Joystick #2", ID_INPUT_JOYSTICK1
+ MENUITEM "Joystick To Keyboard", ID_INPUT_JOYTOKEY
END
MENUITEM SEPARATOR
MENUITEM "Use Direct3D9", ID_HOST_USE_D3D9
// Dialog
//
-IDD_VOLUME DIALOG DISCARDABLE 0, 0, 250, 420
+IDD_VOLUME DIALOG DISCARDABLE 0, 0, 250, 450
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Volume"
FONT 9, "MS PGothic"
LTEXT "Sound Device #13",IDC_VOLUME_CAPTION12,6,366,60,8
CONTROL "",IDC_VOLUME_PARAM_L12,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,366,175,12
CONTROL "",IDC_VOLUME_PARAM_R12,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,381,175,12
- DEFPUSHBUTTON "OK",IDOK,70,400,50,14
- DEFPUSHBUTTON "Reset",IDC_VOLUME_RESET,130,400,50,14
+ LTEXT "Sound Device #14",IDC_VOLUME_CAPTION13,6,396,60,8
+ CONTROL "",IDC_VOLUME_PARAM_L13,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,396,175,12
+ CONTROL "",IDC_VOLUME_PARAM_R13,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,411,175,12
+ DEFPUSHBUTTON "OK",IDOK,70,430,50,14
+ DEFPUSHBUTTON "Reset",IDC_VOLUME_RESET,130,430,50,14
END
IDD_JOYSTICK DIALOG DISCARDABLE 0, 0, 175, 120
BEGIN
POPUP "Boot"
BEGIN
- MENUITEM "N88 mode" ID_VM_BOOT_MODE0
- MENUITEM "N mode" ID_VM_BOOT_MODE3
+ MENUITEM "N88 mode" ID_VM_BOOT_MODE0
+ MENUITEM "N mode" ID_VM_BOOT_MODE3
END
POPUP "Sound"
BEGIN
- MENUITEM "OPN", ID_VM_SOUND_TYPE0
- MENUITEM "OPNA", ID_VM_SOUND_TYPE1
+ MENUITEM "None", ID_VM_SOUND_TYPE0
+ MENUITEM "OPN", ID_VM_SOUND_TYPE1
+ MENUITEM SEPARATOR
+ MENUITEM "GSX-8800", ID_VM_DIPSWITCH2
+ MENUITEM "PCG-8100", ID_VM_DIPSWITCH3
MENUITEM SEPARATOR
MENUITEM "Play FDD Noise", ID_VM_SOUND_NOISE_FDD
MENUITEM "Play CMT Noise", ID_VM_SOUND_NOISE_CMT, GRAYED
// Dialog
//
-IDD_VOLUME DIALOG DISCARDABLE 0, 0, 250, 240
+IDD_VOLUME DIALOG DISCARDABLE 0, 0, 250, 210
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Volume"
FONT 9, "MS PGothic"
LTEXT "Sound Device #6",IDC_VOLUME_CAPTION5,6,156,60,8
CONTROL "",IDC_VOLUME_PARAM_L5,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,156,175,12
CONTROL "",IDC_VOLUME_PARAM_R5,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,171,175,12
- LTEXT "Sound Device #7",IDC_VOLUME_CAPTION6,6,186,60,8
- CONTROL "",IDC_VOLUME_PARAM_L6,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,186,175,12
- CONTROL "",IDC_VOLUME_PARAM_R6,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,201,175,12
- DEFPUSHBUTTON "OK",IDOK,70,220,50,14
- DEFPUSHBUTTON "Reset",IDC_VOLUME_RESET,130,220,50,14
+ DEFPUSHBUTTON "OK",IDOK,70,190,50,14
+ DEFPUSHBUTTON "Reset",IDC_VOLUME_RESET,130,190,50,14
END
IDD_JOYSTICK DIALOG DISCARDABLE 0, 0, 175, 120
void _315_5124::draw_screen()
{
+ if(emu->now_waiting_in_debugger) {
+ // store regs
+ uint16_t tmp_z80_icount = z80_icount;
+ uint16_t tmp_vcounter = vcounter;
+ uint8_t tmp_status_reg = status_reg;
+ uint16_t tmp_hlatch = hlatch;
+ bool tmp_intstat = intstat;
+
+ // drive vlines
+ for(int v = /*get_cur_vline() + 1*/0; v < get_lines_per_frame(); v++) {
+ event_vline(v, 0);
+ }
+
+ // restore regs
+ z80_icount = tmp_z80_icount;
+ vcounter = tmp_vcounter;
+ status_reg = tmp_status_reg;
+ hlatch = tmp_hlatch;
+ intstat = tmp_intstat;
+ }
+
// update screen buffer
for(int y = 0; y < 192; y++) {
//scrntype_t* dest = emu->get_screen_buffer(y);
/* Point to current line in output buffer */
linebuf = (uint8_t *)screen[v];
- /* Update pattern cache */
+ /* Update pattern cache */
update_bg_pattern_cache();
/* Blank line (full width) */
void _315_5124::set_intstat(bool val)
{
if(val != intstat) {
- write_signals(&outputs_irq, val ? 0xffffffff : 0);
+ if(!emu->now_waiting_in_debugger) {
+ write_signals(&outputs_irq, val ? 0xffffffff : 0);
+ }
intstat = val;
}
}
*/
#include "ay_3_891x.h"
+#include "debugger.h"
#define EVENT_FM_TIMER 0
register_vline_event(this);
mute = false;
clock_prev = clock_accum = clock_busy = 0;
+
+ if(d_debugger != NULL) {
+ d_debugger->set_device_name(_T("Debugger (AY-3-891X PSG)"));
+ d_debugger->set_context_mem(this);
+ d_debugger->set_context_io(vm->dummy);
+ }
}
void AY_3_891X::release()
{
touch_sound();
opn->Reset();
- fnum2 = 0;
// stop timer
timer_event_id = -1;
ch = data & 0x0f;
break;
case 1:
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_data8(ch, data);
+ } else
+ this->write_via_debugger_data8(ch, data);
+ break;
+ }
+}
+
+uint32_t AY_3_891X::read_io8(uint32_t addr)
+{
+ switch(addr & 1) {
+ case 1:
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ return d_debugger->read_via_debugger_data8(ch);
+ } else
+ return this->read_via_debugger_data8(ch);
+ }
+ return 0xff;
+}
+
+void AY_3_891X::write_via_debugger_data8(uint32_t addr, uint32_t data)
+{
+ if(addr < 16) {
#ifdef SUPPORT_AY_3_891X_PORT
- if(ch == 7) {
+ if(addr == 7) {
#ifdef AY_3_891X_PORT_MODE
mode = (data & 0x3f) | AY_3_891X_PORT_MODE;
#else
mode = data;
#endif
- } else if(ch == 14) {
+ } else if(addr == 14) {
#ifdef SUPPORT_AY_3_891X_PORT_A
if(port[0].wreg != data || port[0].first) {
write_signals(&port[0].outputs, data);
port[0].first = false;
}
#endif
- } else if(ch == 15) {
+ } else if(addr == 15) {
#ifdef SUPPORT_AY_3_891X_PORT_B
if(port[1].wreg != data || port[1].first) {
write_signals(&port[1].outputs, data);
#endif
}
#endif
- if(0x2d <= ch && ch <= 0x2f) {
- // don't write again for prescaler
- } else if(0xa4 <= ch && ch <= 0xa6) {
- // XM8 version 1.20
- fnum2 = data;
- } else {
- update_count();
- // XM8 version 1.20
- if(0xa0 <= ch && ch <= 0xa2) {
- this->set_reg(ch + 4, fnum2);
- }
- this->set_reg(ch, data);
- if(ch == 0x27) {
- update_event();
- }
- }
- break;
+ update_count();
+ this->set_reg(addr, data);
}
}
-uint32_t AY_3_891X::read_io8(uint32_t addr)
+uint32_t AY_3_891X::read_via_debugger_data8(uint32_t addr)
{
- switch(addr & 1) {
- case 1:
+ if(addr < 16) {
#ifdef SUPPORT_AY_3_891X_PORT
- if(ch == 14) {
+ if(addr == 14) {
#ifdef SUPPORT_AY_3_891X_PORT_A
return (mode & 0x40) ? port[0].wreg : port[0].rreg;
#endif
- } else if(ch == 15) {
+ } else if(addr == 15) {
#ifdef SUPPORT_AY_3_891X_PORT_B
return (mode & 0x80) ? port[1].wreg : port[1].rreg;
#endif
}
#endif
- return opn->GetReg(ch);
+ return opn->GetReg(addr);
}
- return 0xff;
+ return 0;
}
void AY_3_891X::write_signal(int id, uint32_t data, uint32_t mask)
clock_const = (uint32_t)((double)chip_clock * 1024.0 * 1024.0 / (double)new_clocks + 0.5);
}
-#define STATE_VERSION 3
+#define STATE_VERSION 4
bool AY_3_891X::process_state(FILEIO* state_fio, bool loading)
{
return false;
}
state_fio->StateValue(ch);
- state_fio->StateValue(fnum2);
#ifdef SUPPORT_AY_3_891X_PORT
for(int i = 0; i < 2; i++) {
state_fio->StateValue(port[i].wreg);
#endif
#define SIG_AY_3_891X_MUTE 2
+class DEBUGGER;
+
class AY_3_891X : public DEVICE
{
private:
+ DEBUGGER *d_debugger;
FM::OPN* opn;
int base_decibel_fm, base_decibel_psg;
uint8_t ch;
- uint8_t fnum2;
#ifdef SUPPORT_AY_3_891X_PORT
struct {
}
#endif
base_decibel_fm = base_decibel_psg = 0;
+ d_debugger = NULL;
#if defined(HAS_AY_3_8910)
set_device_name(_T("AY-3-8910 PSG"));
#elif defined(HAS_AY_3_8912)
#elif defined(HAS_AY_3_8913)
set_device_name(_T("AY-3-8913 PSG"));
#else
- set_device_name(_T("AY_3_891X PSG"));
+ set_device_name(_T("AY-3-891X PSG"));
#endif
}
~AY_3_891X() {}
void mix(int32_t* buffer, int cnt);
void set_volume(int ch, int decibel_l, int decibel_r);
void update_timing(int new_clocks, double new_frames_per_sec, int new_lines_per_frame);
+ // for debugging
+ void write_via_debugger_data8(uint32_t addr, uint32_t data);
+ uint32_t read_via_debugger_data8(uint32_t addr);
+ bool is_debugger_available()
+ {
+ return true;
+ }
+ void *get_debugger()
+ {
+ return d_debugger;
+ }
+ uint64_t get_debug_data_addr_space()
+ {
+ return 16;
+ }
+ void write_debug_data8(uint32_t addr, uint32_t data)
+ {
+ if(addr < 16) {
+ write_via_debugger_data8(addr, data);
+ }
+ }
+ uint32_t read_debug_data8(uint32_t addr)
+ {
+ if(addr < 16) {
+ return read_via_debugger_data8(addr);
+ }
+ return 0;
+ }
bool process_state(FILEIO* state_fio, bool loading);
// unique functions
register_output_signal(&port[1].outputs, device, id, mask, shift);
}
#endif
+ void set_context_debugger(DEBUGGER* device)
+ {
+ d_debugger = device;
+ }
void initialize_sound(int rate, int clock, int samples, int decibel_fm, int decibel_psg);
void set_reg(uint32_t addr, uint32_t data); // for patch
};
message("* vm/common_vm")
-SET(THIS_LIB_VERSION 2.6.1)
+SET(THIS_LIB_VERSION 2.7.0)
#include(cotire)
set(s_vm_common_vm_srcs
//#ifdef USE_DEBUGGER
#define MAX_BREAK_POINTS 16
-#define MAX_COMMAND_LENGTH 64
+#define MAX_COMMAND_LENGTH 1024
#define MAX_COMMAND_HISTORY 32
#define MAX_CPU_TRACE 1024
class DEBUGGER : public DEVICE
{
private:
- DEVICE *d_mem, *d_io;
+ DEVICE *d_parent, *d_mem, *d_io;
+ DEBUGGER *d_child;
void check_mem_break_points(break_point_t *bp, uint32_t addr, int length)
{
}
}
}
+ if(!now_suspended && d_child != NULL) {
+ if(d_child->is_cpu()) {
+ d_child->check_break_points();
+ }
+ now_suspended = d_child->hit();
+ }
}
void check_io_break_points(break_point_t *bp, uint32_t addr)
{
}
}
}
+ if(!now_suspended && d_child != NULL) {
+ if(d_child->is_cpu()) {
+ d_child->check_break_points();
+ }
+ now_suspended = d_child->hit();
+ }
}
public:
DEBUGGER(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
first_symbol = last_symbol = NULL;
my_tcscpy_s(file_path, _MAX_PATH, _T("debug.bin"));
now_debugging = now_going = now_suspended = now_waiting = false;
+ now_device_debugging = false;
+ d_parent = NULL;
+ d_child = NULL;
memset(history, 0, sizeof(history));
history_ptr = 0;
memset(cpu_trace, 0xff, sizeof(cpu_trace));
~DEBUGGER() {}
// common functions
+ void initialize()
+ {
+ for(DEVICE* device = vm->first_device; device; device = device->next_device) {
+ if(device->get_debugger() == this) {
+ d_parent = device;
+ break;
+ }
+ }
+ assert(d_parent != NULL);
+ }
void release()
{
release_symbols();
}
void write_data8(uint32_t addr, uint32_t data)
{
- check_mem_break_points(&wbp, addr, 1);
d_mem->write_data8(addr, data);
+ check_mem_break_points(&wbp, addr, 1);
}
uint32_t read_data8(uint32_t addr)
{
+ uint32_t val = d_mem->read_data8(addr);
check_mem_break_points(&rbp, addr, 1);
- return d_mem->read_data8(addr);
+ return val;
}
void write_data16(uint32_t addr, uint32_t data)
{
- check_mem_break_points(&wbp, addr, 2);
d_mem->write_data16(addr, data);
+ check_mem_break_points(&wbp, addr, 2);
}
uint32_t read_data16(uint32_t addr)
{
+ uint32_t val = d_mem->read_data16(addr);
check_mem_break_points(&rbp, addr, 2);
- return d_mem->read_data16(addr);
+ return val;
}
void write_data32(uint32_t addr, uint32_t data)
{
- check_mem_break_points(&wbp, addr, 4);
d_mem->write_data32(addr, data);
+ check_mem_break_points(&wbp, addr, 4);
}
uint32_t read_data32(uint32_t addr)
{
+ uint32_t val = d_mem->read_data32(addr);
check_mem_break_points(&rbp, addr, 4);
- return d_mem->read_data32(addr);
+ return val;
}
void write_data8w(uint32_t addr, uint32_t data, int* wait)
{
- check_mem_break_points(&wbp, addr, 1);
d_mem->write_data8w(addr, data, wait);
+ check_mem_break_points(&wbp, addr, 1);
}
uint32_t read_data8w(uint32_t addr, int* wait)
{
+ uint32_t val = d_mem->read_data8w(addr, wait);
check_mem_break_points(&rbp, addr, 1);
- return d_mem->read_data8w(addr, wait);
+ return val;
}
void write_data16w(uint32_t addr, uint32_t data, int* wait)
{
- check_mem_break_points(&wbp, addr, 2);
d_mem->write_data16w(addr, data, wait);
+ check_mem_break_points(&wbp, addr, 2);
}
uint32_t read_data16w(uint32_t addr, int* wait)
{
+ uint32_t val = d_mem->read_data16w(addr, wait);
check_mem_break_points(&rbp, addr, 2);
- return d_mem->read_data16w(addr, wait);
+ return val;
}
void write_data32w(uint32_t addr, uint32_t data, int* wait)
{
- check_mem_break_points(&wbp, addr, 4);
d_mem->write_data32w(addr, data, wait);
+ check_mem_break_points(&wbp, addr, 4);
}
uint32_t read_data32w(uint32_t addr, int* wait)
{
+ uint32_t val = d_mem->read_data32w(addr, wait);
check_mem_break_points(&rbp, addr, 4);
- return d_mem->read_data32w(addr, wait);
+ return val;
}
uint32_t fetch_op(uint32_t addr, int *wait)
{
+ uint32_t val = d_mem->fetch_op(addr, wait);
check_mem_break_points(&rbp, addr, 1);
- return d_mem->fetch_op(addr, wait);
+ return val;
}
void write_io8(uint32_t addr, uint32_t data)
{
- check_io_break_points(&obp, addr);
d_io->write_io8(addr, data);
+ check_io_break_points(&obp, addr);
}
uint32_t read_io8(uint32_t addr)
{
+ uint32_t val = d_io->read_io8(addr);
check_io_break_points(&ibp, addr);
- return d_io->read_io8(addr);
+ return val;
}
void write_io16(uint32_t addr, uint32_t data)
{
- check_io_break_points(&obp, addr);
d_io->write_io16(addr, data);
+ check_io_break_points(&obp, addr);
}
uint32_t read_io16(uint32_t addr)
{
+ uint32_t val = d_io->read_io16(addr);
check_io_break_points(&ibp, addr);
- return d_io->read_io16(addr);
+ return val;
}
void write_io32(uint32_t addr, uint32_t data)
{
- check_io_break_points(&obp, addr);
d_io->write_io32(addr, data);
+ check_io_break_points(&obp, addr);
}
uint32_t read_io32(uint32_t addr)
{
+ uint32_t val = d_io->read_io32(addr);
check_io_break_points(&ibp, addr);
- return d_io->read_io32(addr);
+ return val;
}
void write_io8w(uint32_t addr, uint32_t data, int* wait)
{
- check_io_break_points(&obp, addr);
d_io->write_io8w(addr, data, wait);
+ check_io_break_points(&obp, addr);
}
uint32_t read_io8w(uint32_t addr, int* wait)
{
+ uint32_t val = d_io->read_io8w(addr, wait);
check_io_break_points(&ibp, addr);
- return d_io->read_io8w(addr, wait);
+ return val;
}
void write_io16w(uint32_t addr, uint32_t data, int* wait)
{
- check_io_break_points(&obp, addr);
d_io->write_io16w(addr, data, wait);
+ check_io_break_points(&obp, addr);
}
uint32_t read_io16w(uint32_t addr, int* wait)
{
+ uint32_t val = d_io->read_io16w(addr, wait);
check_io_break_points(&ibp, addr);
- return d_io->read_io16w(addr, wait);
+ return val;
}
void write_io32w(uint32_t addr, uint32_t data, int* wait)
{
- check_io_break_points(&obp, addr);
d_io->write_io32w(addr, data, wait);
+ check_io_break_points(&obp, addr);
}
uint32_t read_io32w(uint32_t addr, int* wait)
{
+ uint32_t val = d_io->read_io32w(addr, wait);
check_io_break_points(&ibp, addr);
- return d_io->read_io32w(addr, wait);
+ return val;
+ }
+ void write_via_debugger_data8(uint32_t addr, uint32_t data)
+ {
+ d_mem->write_via_debugger_data8(addr, data);
+ check_mem_break_points(&wbp, addr, 1);
+ }
+ uint32_t read_via_debugger_data8(uint32_t addr)
+ {
+ uint32_t val = d_mem->read_via_debugger_data8(addr);
+ check_mem_break_points(&rbp, addr, 1);
+ return val;
+ }
+ void write_via_debugger_data16(uint32_t addr, uint32_t data)
+ {
+ d_mem->write_via_debugger_data16(addr, data);
+ check_mem_break_points(&wbp, addr, 2);
+ }
+ uint32_t read_via_debugger_data16(uint32_t addr)
+ {
+ uint32_t val = d_mem->read_via_debugger_data16(addr);
+ check_mem_break_points(&rbp, addr, 2);
+ return val;
+ }
+ void write_via_debugger_data32(uint32_t addr, uint32_t data)
+ {
+ d_mem->write_via_debugger_data32(addr, data);
+ check_mem_break_points(&wbp, addr, 4);
+ }
+ uint32_t read_via_debugger_data32(uint32_t addr)
+ {
+ uint32_t val = d_mem->read_via_debugger_data32(addr);
+ check_mem_break_points(&rbp, addr, 4);
+ return val;
+ }
+ void write_via_debugger_data8w(uint32_t addr, uint32_t data, int* wait)
+ {
+ d_mem->write_via_debugger_data8w(addr, data, wait);
+ check_mem_break_points(&wbp, addr, 1);
+ }
+ uint32_t read_via_debugger_data8w(uint32_t addr, int* wait)
+ {
+ uint32_t val = d_mem->read_via_debugger_data8w(addr, wait);
+ check_mem_break_points(&rbp, addr, 1);
+ return val;
+ }
+ void write_via_debugger_data16w(uint32_t addr, uint32_t data, int* wait)
+ {
+ d_mem->write_via_debugger_data16w(addr, data, wait);
+ check_mem_break_points(&wbp, addr, 2);
+ }
+ uint32_t read_via_debugger_data16w(uint32_t addr, int* wait)
+ {
+ uint32_t val = d_mem->read_via_debugger_data16w(addr, wait);
+ check_mem_break_points(&rbp, addr, 2);
+ return val;
+ }
+ void write_via_debugger_data32w(uint32_t addr, uint32_t data, int* wait)
+ {
+ d_mem->write_via_debugger_data32w(addr, data, wait);
+ check_mem_break_points(&wbp, addr, 4);
+ }
+ uint32_t read_via_debugger_data32w(uint32_t addr, int* wait)
+ {
+ uint32_t val = d_mem->read_via_debugger_data32w(addr, wait);
+ check_mem_break_points(&rbp, addr, 4);
+ return val;
+ }
+ void write_via_debugger_io8(uint32_t addr, uint32_t data)
+ {
+ d_io->write_via_debugger_io8(addr, data);
+ check_io_break_points(&obp, addr);
+ }
+ uint32_t read_via_debugger_io8(uint32_t addr)
+ {
+ uint32_t val = d_io->read_via_debugger_io8(addr);
+ check_io_break_points(&ibp, addr);
+ return val;
+ }
+ void write_via_debugger_io16(uint32_t addr, uint32_t data)
+ {
+ d_io->write_via_debugger_io16(addr, data);
+ check_io_break_points(&obp, addr);
+ }
+ uint32_t read_via_debugger_io16(uint32_t addr)
+ {
+ uint32_t val = d_io->read_via_debugger_io16(addr);
+ check_io_break_points(&ibp, addr);
+ return val;
+ }
+ void write_via_debugger_io32(uint32_t addr, uint32_t data)
+ {
+ d_io->write_via_debugger_io32(addr, data);
+ check_io_break_points(&obp, addr);
+ }
+ uint32_t read_via_debugger_io32(uint32_t addr)
+ {
+ uint32_t val = d_io->read_via_debugger_io32(addr);
+ check_io_break_points(&ibp, addr);
+ return val;
+ }
+ void write_via_debugger_io8w(uint32_t addr, uint32_t data, int* wait)
+ {
+ d_io->write_via_debugger_io8w(addr, data, wait);
+ check_io_break_points(&obp, addr);
+ }
+ uint32_t read_via_debugger_io8w(uint32_t addr, int* wait)
+ {
+ uint32_t val = d_io->read_via_debugger_io8w(addr, wait);
+ check_io_break_points(&ibp, addr);
+ return val;
+ }
+ void write_via_debugger_io16w(uint32_t addr, uint32_t data, int* wait)
+ {
+ d_io->write_via_debugger_io16w(addr, data, wait);
+ check_io_break_points(&obp, addr);
+ }
+ uint32_t read_via_debugger_io16w(uint32_t addr, int* wait)
+ {
+ uint32_t val = d_io->read_via_debugger_io16w(addr, wait);
+ check_io_break_points(&ibp, addr);
+ return val;
+ }
+ void write_via_debugger_io32w(uint32_t addr, uint32_t data, int* wait)
+ {
+ d_io->write_via_debugger_io32w(addr, data, wait);
+ check_io_break_points(&obp, addr);
+ }
+ uint32_t read_via_debugger_io32w(uint32_t addr, int* wait)
+ {
+ uint32_t val = d_io->read_via_debugger_io32w(addr, wait);
+ check_io_break_points(&ibp, addr);
+ return val;
+ }
+ bool is_debugger()
+ {
+ return true;
}
// unique functions
{
d_io = device;
}
+ void set_context_child(DEBUGGER* device)
+ {
+ d_child = device;
+ }
void check_break_points(uint32_t addr)
{
check_mem_break_points(&bp, addr, 1);
}
+ void check_break_points()
+ {
+ check_mem_break_points(&bp, d_parent->get_next_pc(), 1);
+ }
void store_break_points()
{
+ if(d_child != NULL) {
+ d_child->store_break_points();
+ }
memcpy( bp.stored, bp.table, sizeof( bp.table));
memcpy(rbp.stored, rbp.table, sizeof(rbp.table));
memcpy(wbp.stored, wbp.table, sizeof(wbp.table));
}
void restore_break_points()
{
+ if(d_child != NULL) {
+ d_child->restore_break_points();
+ }
memcpy( bp.table, bp.stored, sizeof( bp.table));
memcpy(rbp.table, rbp.stored, sizeof(rbp.table));
memcpy(wbp.table, wbp.stored, sizeof(wbp.table));
}
bool hit()
{
+ if(d_child != NULL && d_child->hit()) {
+ return true;
+ }
return (bp.hit || rbp.hit || wbp.hit || ibp.hit || obp.hit);
}
+ bool restartable()
+ {
+ if(d_child != NULL && !d_child->restartable()) {
+ return false;
+ }
+ if( bp.hit && ! bp.restart) return false;
+ if(rbp.hit && !rbp.restart) return false;
+ if(wbp.hit && !wbp.restart) return false;
+ if(ibp.hit && !ibp.restart) return false;
+ if(obp.hit && !obp.restart) return false;
+ return true;
+ }
+ void clear_hit()
+ {
+ if(d_child != NULL) {
+ d_child->clear_hit();
+ }
+ bp.hit = rbp.hit = wbp.hit = ibp.hit = obp.hit = false;
+ }
void add_symbol(uint32_t addr, const _TCHAR *name)
{
symbol_t *symbol = (symbol_t *)calloc(sizeof(symbol_t), 1);
symbol_t *first_symbol, *last_symbol;
_TCHAR file_path[_MAX_PATH];
bool now_debugging, now_going, now_suspended, now_waiting;
+ bool now_device_debugging; // for non-cpu devices
_TCHAR history[MAX_COMMAND_HISTORY][MAX_COMMAND_LENGTH + 1];
int history_ptr;
uint32_t cpu_trace[MAX_CPU_TRACE], prev_cpu_trace;
// z80 daisy chain
virtual void set_context_intr(DEVICE* device, uint32_t bit) {}
virtual void set_context_child(DEVICE* device) {}
+ virtual DEVICE *get_context_child()
+ {
+ return NULL;
+ }
// interrupt device to device
virtual void set_intr_iei(bool val) {}
}
return event_manager->this_device_id;
}
+ virtual bool is_primary_cpu(DEVICE* device)
+ {
+ if(event_manager == NULL) {
+ event_manager = vm->first_device->next_device;
+ }
+ return event_manager->is_primary_cpu(device);
+ }
+ virtual void update_extra_event(int clock)
+ {
+ if(event_manager == NULL) {
+ event_manager = vm->first_device->next_device;
+ }
+ event_manager->update_extra_event(clock);
+ }
virtual void register_event(DEVICE* device, int event_id, double usec, bool loop, int* register_id)
{
if(event_manager == NULL) {
#endif
}
}
+/*
+ These functions are used for debugging non-cpu device
+ Insert debugger between standard read/write functions and these functions for checking breakpoints
+
+ void DEVICE::write_data8(uint32_t addr, uint32_t data)
+ {
+ if(debugger != NULL && debugger->now_device_debugging) {
+ // debugger->mem = this;
+ // debugger->mem->write_via_debugger_data8(addr, data)
+ debugger->write_via_debugger_data8(addr, data);
+ } else {
+ this->write_via_debugger_data8(addr, data);
+ }
+ }
+ void DEVICE::write_via_debugger_data8(uint32_t addr, uint32_t data)
+ {
+ // write memory
+ }
+*/
+ virtual void write_via_debugger_data8(uint32_t addr, uint32_t data) {}
+ virtual uint32_t read_via_debugger_data8(uint32_t addr)
+ {
+ return 0xff;
+ }
+ virtual void write_via_debugger_data16(uint32_t addr, uint32_t data) {}
+ virtual uint32_t read_via_debugger_data16(uint32_t addr)
+ {
+ return 0xffff;
+ }
+ virtual void write_via_debugger_data32(uint32_t addr, uint32_t data) {}
+ virtual uint32_t read_via_debugger_data32(uint32_t addr)
+ {
+ return 0xffffffff;
+ }
+ virtual void write_via_debugger_data8w(uint32_t addr, uint32_t data, int* wait) {}
+ virtual uint32_t read_via_debugger_data8w(uint32_t addr, int* wait)
+ {
+ return 0xff;
+ }
+ virtual void write_via_debugger_data16w(uint32_t addr, uint32_t data, int* wait) {}
+ virtual uint32_t read_via_debugger_data16w(uint32_t addr, int* wait)
+ {
+ return 0xffff;
+ }
+ virtual void write_via_debugger_data32w(uint32_t addr, uint32_t data, int* wait) {}
+ virtual uint32_t read_via_debugger_data32w(uint32_t addr, int* wait)
+ {
+ return 0xffffffff;
+ }
+ virtual void write_via_debugger_io8(uint32_t addr, uint32_t data) {}
+ virtual uint32_t read_via_debugger_io8(uint32_t addr)
+ {
+ return 0xff;
+ }
+ virtual void write_via_debugger_io16(uint32_t addr, uint32_t data) {}
+ virtual uint32_t read_via_debugger_io16(uint32_t addr)
+ {
+ return 0xffff;
+ }
+ virtual void write_via_debugger_io32(uint32_t addr, uint32_t data) {}
+ virtual uint32_t read_via_debugger_io32(uint32_t addr)
+ {
+ return 0xffffffff;
+ }
+ virtual void write_via_debugger_io8w(uint32_t addr, uint32_t data, int* wait) {}
+ virtual uint32_t read_via_debugger_io8w(uint32_t addr, int* wait)
+ {
+ return 0xff;
+ }
+ virtual void write_via_debugger_io16w(uint32_t addr, uint32_t data, int* wait) {}
+ virtual uint32_t read_via_debugger_io16w(uint32_t addr, int* wait)
+ {
+ return 0xffff;
+ }
+ virtual void write_via_debugger_io32w(uint32_t addr, uint32_t data, int* wait) {}
+ virtual uint32_t read_via_debugger_io32w(uint32_t addr, int* wait)
+ {
+ return 0xffffffff;
+ }
virtual void out_debug_log(const char *fmt, ...)
{
char strbuf[4096];
#ifdef USE_DEBUGGER
// debugger
+ virtual bool is_cpu()
+ {
+ return false;
+ }
+ virtual bool is_debugger()
+ {
+ return false;
+ }
+ virtual bool is_debugger_available()
+ {
+ return false;
+ }
virtual void *get_debugger()
{
return NULL;
{
return 0;
}
- virtual void write_debug_data8(uint32_t addr, uint32_t data) {}
+ virtual uint64_t get_debug_data_addr_space()
+ {
+ // override this function when memory space is not (2 << n)
+ return (uint64_t)get_debug_data_addr_mask() + 1;
+ }
+ virtual void write_debug_data8(uint32_t addr, uint32_t data)
+ {
+// write_data8(addr, data);
+ }
virtual uint32_t read_debug_data8(uint32_t addr)
{
+// return read_data8(addr);
return 0xff;
}
virtual void write_debug_data16(uint32_t addr, uint32_t data)
val |= read_debug_data16(addr + 2) << 16;
return val;
}
- virtual void write_debug_io8(uint32_t addr, uint32_t data) {}
+ virtual void write_debug_io8(uint32_t addr, uint32_t data)
+ {
+// write_io8(addr, data);
+ }
virtual uint32_t read_debug_io8(uint32_t addr)
{
+// return read_io8(addr);
return 0xff;
}
virtual void write_debug_io16(uint32_t addr, uint32_t data)
{
return 0;
}
- virtual void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len) {}
+ virtual bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+ {
+ return false;
+ }
virtual int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len)
{
return 0;
sector_size.read_2bytes_le_from(t + 14);
}
+bool DISK::get_sector_info(int trk, int side, int index, uint8_t *c, uint8_t *h, uint8_t *r, uint8_t *n, int *length)
+{
+ if(media_type == MEDIA_TYPE_2D && drive_type == DRIVE_TYPE_2DD) {
+ if(trk >= 0) {
+ if(trk & 1) {
+ return false; // unformat
+ }
+ trk >>= 1;
+ }
+ } else if(media_type == MEDIA_TYPE_2DD && drive_type == DRIVE_TYPE_2D) {
+ if(trk >= 0) trk <<= 1;
+ }
+ return get_sector_info_tmp(trk, side, index, c, h, r, n, length);
+}
+
+bool DISK::get_sector_info_tmp(int trk, int side, int index, uint8_t *c, uint8_t *h, uint8_t *r, uint8_t *n, int *length)
+{
+ // search track
+ if(trk == -1 && side == -1) {
+ trk = cur_track;
+ side = cur_side;
+ }
+ int trkside = is_1dd_image ? trk : (trk * 2 + (side & 1));
+ if(!(0 <= trkside && trkside < 164)) {
+ return false;
+ }
+ pair32_t offset;
+ offset.read_4bytes_le_from(buffer + 0x20 + trkside * 4);
+
+ if(!IS_VALID_TRACK(offset.d)) {
+ return false;
+ }
+
+ // track found
+ uint8_t* t = buffer + offset.d;
+ pair32_t num, data_size;
+ num.read_2bytes_le_from(t + 4);
+
+ if(index >= num.sd) {
+ return false;
+ }
+
+ // skip sector
+ for(int i = 0; i < index; i++) {
+ data_size.read_2bytes_le_from(t + 14);
+ t += data_size.sd + 0x10;
+ }
+ data_size.read_2bytes_le_from(t + 14);
+ *c = t[0];
+ *h = t[1];
+ *r = t[2];
+ *n = t[3];
+ *length = data_size.sd;
+ return true;
+}
+
void DISK::set_deleted(bool value)
{
if(sector != NULL) {
bool get_track_tmp(int trk, int side);
bool make_track_tmp(int trk, int side);
bool get_sector_tmp(int trk, int side, int index);
+ bool get_sector_info_tmp(int trk, int side, int index, uint8_t *c, uint8_t *h, uint8_t *r, uint8_t *n, int *length);
bool format_track_tmp(int trk, int side);
public:
bool get_track(int trk, int side);
bool make_track(int trk, int side);
bool get_sector(int trk, int side, int index);
+ bool get_sector_info(int trk, int side, int index, uint8_t *c, uint8_t *h, uint8_t *r, uint8_t *n, int *length);
void set_deleted(bool value);
void set_data_crc_error(bool value);
void set_data_mark_missing();
#include "event.h"
#define EVENT_MIX 0
+#define EVENT_VLINE 1
void EVENT::initialize()
{
prev_skip = next_skip = false;
sound_changed = false;
+ // temporary
+ frame_clocks = (int)((double)d_cpu[0].cpu_clocks / (double)FRAMES_PER_SEC + 0.5);
vline_start_clock = 0;
cur_vline = 0;
- vclocks[0] = (int)((double)d_cpu[0].cpu_clocks / (double)FRAMES_PER_SEC / (double)LINES_PER_FRAME + 0.5); // temporary
+ vline_clocks[0] = (int)((double)d_cpu[0].cpu_clocks / (double)FRAMES_PER_SEC / (double)LINES_PER_FRAME + 0.5);
}
void EVENT::initialize_sound(int rate, int samples)
}
}
- event_remain = 0;
+ event_remain = event_extra = 0;
cpu_remain = cpu_accum = cpu_done = 0;
// reset sound
frames_per_sec = next_frames_per_sec;
lines_per_frame = next_lines_per_frame;
- int sum = (int)((double)d_cpu[0].cpu_clocks / frames_per_sec + 0.5);
- int remain = sum;
+ frame_clocks = (int)((double)d_cpu[0].cpu_clocks / frames_per_sec + 0.5);
+ int remain = frame_clocks;
for(int i = 0; i < lines_per_frame; i++) {
assert(i < MAX_LINES);
- vclocks[i] = (int)(sum / lines_per_frame);
- remain -= vclocks[i];
+ vline_clocks[i] = (int)(frame_clocks / lines_per_frame);
+ remain -= vline_clocks[i];
}
for(int i = 0; i < remain; i++) {
int index = (int)((double)lines_per_frame * (double)i / (double)remain);
assert(index < MAX_LINES);
- vclocks[index]++;
+ vline_clocks[index]++;
}
for(int i = 1; i < dcount_cpu; i++) {
d_cpu[i].update_clocks = (int)(1024.0 * (double)d_cpu[i].cpu_clocks / (double)d_cpu[0].cpu_clocks + 0.5);
for(int i = 0; i < frame_event_count; i++) {
frame_event[i]->event_frame();
}
- for(cur_vline = 0; cur_vline < lines_per_frame; cur_vline++) {
- vline_start_clock = get_current_clock();
-
- // run virtual machine per line
- for(int i = 0; i < vline_event_count; i++) {
- vline_event[i]->event_vline(cur_vline, vclocks[cur_vline]);
+
+ cur_vline = 0;
+ vline_start_clock = get_current_clock();
+
+ for(int i = 0; i < vline_event_count; i++) {
+ vline_event[i]->event_vline(cur_vline, vline_clocks[cur_vline]);
+ }
+ this->register_event_by_clock(this, EVENT_VLINE, vline_clocks[cur_vline], false, NULL);
+
+ if(event_remain < 0) {
+ if(-event_remain > vline_clocks[cur_vline]) {
+ update_event(vline_clocks[cur_vline]);
+ } else {
+ update_event(-event_remain);
}
-
- if(event_remain < 0) {
- if(-event_remain > vclocks[cur_vline]) {
- update_event(vclocks[cur_vline]);
+ }
+ event_remain += frame_clocks;
+ cpu_remain += frame_clocks << power;
+
+ while(event_remain > 0) {
+ int event_done = event_remain;
+ if(cpu_remain > 0) {
+ event_extra = 0;
+ int cpu_done_tmp;
+ if(dcount_cpu == 1) {
+ // run one opecode on primary cpu
+ cpu_done_tmp = d_cpu[0].device->run(-1);
} else {
- update_event(-event_remain);
- }
- }
- event_remain += vclocks[cur_vline];
- cpu_remain += vclocks[cur_vline] << power;
- while(event_remain > 0) {
- int event_done = event_remain;
- if(cpu_remain > 0) {
- int cpu_done_tmp;
- if(dcount_cpu == 1) {
+ // sync to sub cpus
+ if(cpu_done == 0) {
// run one opecode on primary cpu
#if !defined(USE_SUPRESS_VTABLE)
- cpu_done_tmp = d_cpu[0].device->run(-1);
-#else
- cpu_done_tmp = run_cpu(0, -1);
-#endif
- } else {
- // sync to sub cpus
- if(cpu_done == 0) {
- // run one opecode on primary cpu
-#if !defined(USE_SUPRESS_VTABLE)
- cpu_done = d_cpu[0].device->run(-1);
+ cpu_done = d_cpu[0].device->run(-1);
#else
- cpu_done = run_cpu(0, -1);
+ cpu_done = run_cpu(0, -1);
#endif
- }
- // sub cpu runs continuously and no events will be fired while the given clocks,
- // so I need to give small enough clocks...
- cpu_done_tmp = (cpu_done < 4) ? cpu_done : 4;
- cpu_done -= cpu_done_tmp;
-
- for(int i = 1; i < dcount_cpu; i++) {
- // run sub cpus
- //d_cpu[i].accum_clocks += d_cpu[i].update_clocks * cpu_done_tmp;
- d_cpu[i].accum_clocks += cpu_update_clocks[i][cpu_done_tmp];
- int sub_clock = d_cpu[i].accum_clocks >> 10;
- if(sub_clock) {
- d_cpu[i].accum_clocks -= sub_clock << 10;
+ }
+
+ // sub cpu runs continuously and no events will be fired while the given clocks,
+ // so I need to give small enough clocks...
+ cpu_done_tmp = (event_extra > 0 || cpu_done < 4) ? cpu_done : 4;
+ cpu_done -= cpu_done_tmp;
+
+ for(int i = 1; i < dcount_cpu; i++) {
+ // run sub cpus
+ d_cpu[i].accum_clocks += d_cpu[i].update_clocks * cpu_done_tmp;
+ int sub_clock = d_cpu[i].accum_clocks >> 10;
+ if(sub_clock) {
+ d_cpu[i].accum_clocks -= sub_clock << 10;
#if !defined(USE_SUPRESS_VTABLE)
- d_cpu[i].device->run(sub_clock);
+ d_cpu[i].device->run(sub_clock);
#else
- run_cpu(i, sub_clock);
+ run_cpu(i, sub_clock);
#endif
- }
}
}
- cpu_remain -= cpu_done_tmp;
- cpu_accum += cpu_done_tmp;
- event_done = cpu_accum >> power;
- cpu_accum -= event_done << power;
}
- if(event_done > 0) {
+ cpu_remain -= cpu_done_tmp;
+ cpu_accum += cpu_done_tmp;
+ event_done = cpu_accum >> power;
+ cpu_accum -= event_done << power;
+ event_done -= event_extra;
+ }
+ if(event_done > 0) {
+ if(event_remain > 0) {
if(event_done > event_remain) {
update_event(event_remain);
} else {
update_event(event_done);
}
- event_remain -= event_done;
+ }
+ event_remain -= event_done;
+ }
+ }
+}
+
+void EVENT::update_extra_event(int clock)
+{
+ // this is called from primary cpu while running one opecode
+ int event_done = clock >> power;
+
+ if(event_done > 0) {
+ if(event_remain > 0) {
+ if(event_done > event_remain) {
+ update_event(event_remain);
+ } else {
+ update_event(event_done);
}
}
+ event_remain -= event_done;
+ event_extra += event_done;
}
}
void EVENT::event_callback(int event_id, int err)
{
- // mix sound
- if(prev_skip && dont_skip_frames == 0 && !sound_changed) {
- buffer_ptr = 0;
- }
- int remain = sound_tmp_samples - buffer_ptr;
-
- if(remain > 0) {
- int samples = mix_counter;
+ if(event_id == EVENT_MIX) {
+ // mix sound
+ if(prev_skip && dont_skip_frames == 0 && !sound_changed) {
+ buffer_ptr = 0;
+ }
+ int remain = sound_tmp_samples - buffer_ptr;
- if(config.sound_strict_rendering || (need_mix > 0)) {
- if(samples < 1) {
- samples = 1;
+ if(remain > 0) {
+ int samples = mix_counter;
+
+ if(config.sound_strict_rendering || (need_mix > 0)) {
+ if(samples < 1) {
+ samples = 1;
+ }
+ }
+ if(samples >= remain) {
+ samples = remain;
+ }
+ if(config.sound_strict_rendering || (need_mix > 0)) {
+ if(samples > 0) {
+ mix_sound(samples);
+ }
+ mix_counter = 1;
+ } else {
+ if(samples > 0 && mix_counter >= mix_limit) {
+ mix_sound(samples);
+ mix_counter -= samples;
+ }
+ mix_counter++;
}
}
- if(samples >= remain) {
- samples = remain;
- }
- if(config.sound_strict_rendering || (need_mix > 0)) {
- if(samples > 0) {
- mix_sound(samples);
+ } else if(event_id == EVENT_VLINE) {
+ if(cur_vline + 1 < lines_per_frame) {
+ cur_vline++;
+ vline_start_clock = get_current_clock();
+
+ for(int i = 0; i < vline_event_count; i++) {
+ vline_event[i]->event_vline(cur_vline, vline_clocks[cur_vline]);
}
- mix_counter = 1;
- } else {
- if(samples > 0 && mix_counter >= mix_limit) {
- mix_sound(samples);
- mix_counter -= samples;
+
+ // do not register if next vline is the first vline of next frame
+ if(cur_vline + 1 < lines_per_frame) {
+ this->register_event_by_clock(this, EVENT_VLINE, vline_clocks[cur_vline], false, NULL);
}
- mix_counter++;
}
}
}
}
}
-#define STATE_VERSION 3
+#define STATE_VERSION 4
bool EVENT::process_state(FILEIO* state_fio, bool loading)
{
state_fio->StateValue(d_cpu[i].update_clocks);
state_fio->StateValue(d_cpu[i].accum_clocks);
}
- state_fio->StateArray(vclocks, sizeof(vclocks), 1);
+ state_fio->StateValue(frame_clocks);
+ state_fio->StateArray(vline_clocks, sizeof(vline_clocks), 1);
state_fio->StateValue(event_remain);
+ state_fio->StateValue(event_extra);
state_fio->StateValue(cpu_remain);
state_fio->StateValue(cpu_accum);
state_fio->StateValue(cpu_done);
int dcount_cpu;
- int vclocks[MAX_LINES];
+ int frame_clocks;
+ int vline_clocks[MAX_LINES];
int power;
- int event_remain;
+ int event_remain, event_extra;
int cpu_remain, cpu_accum, cpu_done;
uint64_t event_clocks;
{
return next_lines_per_frame;
}
+ bool is_primary_cpu(DEVICE* device)
+ {
+ return (d_cpu[0].device == device);
+ }
+ void update_extra_event(int clock);
void register_event(DEVICE* device, int event_id, double usec, bool loop, int* register_id);
void register_event_by_clock(DEVICE* device, int event_id, uint64_t clock, bool loop, int* register_id);
void cancel_event(DEVICE* device, int register_id);
}
int get_cur_vline_clocks()
{
- return vclocks[cur_vline];
+ return vline_clocks[cur_vline];
}
uint32_t get_cpu_pc(int index);
void request_skip_frames();
uint32_t get_pc();
uint32_t get_next_pc();
//#ifdef USE_DEBUGGER
+ bool is_cpu()
+ {
+ return true;
+ }
+ bool is_debugger_available()
+ {
+ return true;
+ }
void *get_debugger()
{
return d_debugger;
void write_debug_io8(uint32_t addr, uint32_t data);
uint32_t read_debug_io8(uint32_t addr);
bool write_debug_reg(const _TCHAR *reg, uint32_t data);
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
//#endif
return true;
}
-void HUC6280_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool HUC6280_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
h6280_Regs *cpustate = (h6280_Regs *)opaque;
my_stprintf_s(buffer, buffer_len,
- _T("PC = %04X SP = %04X ZP = %04X EA = %04X A = %02X X = %02X Y = %02X P = %02X\nClocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+ _T("PC = %04X SP = %04X ZP = %04X EA = %04X A = %02X X = %02X Y = %02X P = %02X\n")
+ _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
cpustate->pc.w.l, cpustate->sp.w.l, cpustate->zp.w.l, cpustate->ea.w.l, cpustate->a, cpustate->x, cpustate->y, cpustate->p,
total_icount, total_icount - prev_total_icount,
get_passed_clock_since_vline(), get_cur_vline_clocks(), get_cur_vline(), get_lines_per_frame());
prev_total_icount = total_icount;
+ return true;
}
// disassembler
return 0;
}
-void I286::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool I286::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
cpu_state *cpustate = (cpu_state *)opaque;
my_stprintf_s(buffer, buffer_len,
- _T("AX=%04X BX=%04X CX=%04X DX=%04X SP=%04X BP=%04X SI=%04X DI=%04X\nDS=%04X ES=%04X SS=%04X CS=%04X IP=%04X FLAG=[%c%c%c%c%c%c%c%c%c]\nClocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+ _T("AX=%04X BX=%04X CX=%04X DX=%04X SP=%04X BP=%04X SI=%04X DI=%04X\n")
+ _T("DS=%04X ES=%04X SS=%04X CS=%04X IP=%04X FLAG=[%c%c%c%c%c%c%c%c%c]\n")
+ _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
cpustate->regs.w[AX], cpustate->regs.w[BX], cpustate->regs.w[CX], cpustate->regs.w[DX], cpustate->regs.w[SP], cpustate->regs.w[BP], cpustate->regs.w[SI], cpustate->regs.w[DI],
cpustate->sregs[DS], cpustate->sregs[ES], cpustate->sregs[SS], cpustate->sregs[CS], cpustate->pc - cpustate->base[CS],
OF ? _T('O') : _T('-'), DF ? _T('D') : _T('-'), cpustate->IF ? _T('I') : _T('-'), cpustate->TF ? _T('T') : _T('-'),
cpustate->total_icount, cpustate->total_icount - cpustate->prev_total_icount,
get_passed_clock_since_vline(), get_cur_vline_clocks(), get_cur_vline(), get_lines_per_frame());
cpustate->prev_total_icount = cpustate->total_icount;
+ return true;
}
int I286::debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len)
uint32_t get_pc();
uint32_t get_next_pc();
#ifdef USE_DEBUGGER
+ bool is_cpu()
+ {
+ return true;
+ }
+ bool is_debugger_available()
+ {
+ return true;
+ }
void *get_debugger()
{
return d_debugger;
uint32_t read_debug_io16(uint32_t addr);
bool write_debug_reg(const _TCHAR *reg, uint32_t data);
uint32_t read_debug_reg(const _TCHAR *reg);
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
#endif
void save_state_cpustate(FILEIO* state_fio);
return 0;
}
-void I386::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool I386::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
i386_state *cpustate = (i386_state *)opaque;
my_stprintf_s(buffer, buffer_len,
- _T("AX=%04X BX=%04X CX=%04X DX=%04X SP=%04X BP=%04X SI=%04X DI=%04X\nDS=%04X ES=%04X SS=%04X CS=%04X IP=%04X FLAG=[%c%c%c%c%c%c%c%c%c]\nClocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+ _T("AX=%04X BX=%04X CX=%04X DX=%04X SP=%04X BP=%04X SI=%04X DI=%04X\n")
+ _T("DS=%04X ES=%04X SS=%04X CS=%04X IP=%04X FLAG=[%c%c%c%c%c%c%c%c%c]\n")
+ _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
REG16(AX), REG16(BX), REG16(CX), REG16(DX), REG16(SP), REG16(BP), REG16(SI), REG16(DI),
cpustate->sreg[DS].selector, cpustate->sreg[ES].selector, cpustate->sreg[SS].selector, cpustate->sreg[CS].selector, cpustate->eip,
cpustate->OF ? _T('O') : _T('-'), cpustate->DF ? _T('D') : _T('-'), cpustate->IF ? _T('I') : _T('-'), cpustate->TF ? _T('T') : _T('-'),
cpustate->total_cycles, cpustate->total_cycles - cpustate->prev_total_cycles,
get_passed_clock_since_vline(), get_cur_vline_clocks(), get_cur_vline(), get_lines_per_frame());
cpustate->prev_total_cycles = cpustate->total_cycles;
+ return true;
}
int I386::debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len)
uint32_t get_pc();
uint32_t get_next_pc();
#ifdef USE_DEBUGGER
+ bool is_cpu()
+ {
+ return true;
+ }
+ bool is_debugger_available()
+ {
+ return true;
+ }
void *get_debugger()
{
return d_debugger;
uint32_t read_debug_io16(uint32_t addr);
bool write_debug_reg(const _TCHAR *reg, uint32_t data);
uint32_t read_debug_reg(const _TCHAR *reg);
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
#endif
bool process_state(FILEIO* state_fio, bool loading);
if(now_debugging) {
d_debugger->check_break_points(PC);
if(d_debugger->now_suspended) {
- emu->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- emu->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
if(now_debugging) {
d_debugger->check_break_points(PC);
if(d_debugger->now_suspended) {
- emu->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- emu->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
return true;
}
-void I8080_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool I8080_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
/*
F = [--------] A = 00 BC = 0000 DE = 0000 HL = 0000 SP = 0000 PC = 0000
*/
int wait;
my_stprintf_s(buffer, buffer_len,
- _T("F = [%c%c%c%c%c%c%c%c] A = %02X BC = %04X DE = %04X HL = %04X SP = %04X PC = %04X\nIM= [%c%c%c%c%c%c%c%c] (BC)= %04X (DE)= %04X (HL)= %04X (SP)= %04X\nClocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+ _T("F = [%c%c%c%c%c%c%c%c] A = %02X BC = %04X DE = %04X HL = %04X SP = %04X PC = %04X\n")
+ _T("IM= [%c%c%c%c%c%c%c%c] (BC)= %04X (DE)= %04X (HL)= %04X (SP)= %04X\n")
+ _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
(_F & CF) ? _T('C') : _T('-'), (_F & NF) ? _T('N') : _T('-'), (_F & VF) ? _T('V') : _T('-'), (_F & XF) ? _T('X') : _T('-'),
(_F & HF) ? _T('H') : _T('-'), (_F & YF) ? _T('Y') : _T('-'), (_F & ZF) ? _T('Z') : _T('-'), (_F & SF) ? _T('S') : _T('-'),
_A, BC, DE, HL, SP, PC,
total_count, total_count - prev_total_count,
get_passed_clock_since_vline(), get_cur_vline_clocks(), get_cur_vline(), get_lines_per_frame());
prev_total_count = total_count;
+ return true;
}
// disassembler
return PC;
}
//#ifdef USE_DEBUGGER
+ bool is_cpu()
+ {
+ return true;
+ }
+ bool is_debugger_available()
+ {
+ return true;
+ }
void *get_debugger()
{
return d_debugger;
void write_debug_io8(uint32_t addr, uint32_t data);
uint32_t read_debug_io8(uint32_t addr);
bool write_debug_reg(const _TCHAR *reg, uint32_t data);
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
//#endif
// unique function
#include "vm.h"
#include "../emu.h"
#include "i8237.h"
+#ifdef USE_DEBUGGER
+#include "debugger.h"
+#endif
+
+void I8237::initialize()
+{
+ I8237_BASE::initialize();
+#ifdef USE_DEBUGGER
+ if(d_debugger != NULL) {
+ d_debugger->set_device_name(_T("Debugger (8237 DMAC)"));
+ d_debugger->set_context_mem(this);
+ d_debugger->set_context_io(vm->dummy);
+ }
+#endif
+}
I8237::I8237(VM_TEMPLATE* parent_vm, EMU* parent_emu) : I8237_BASE(parent_vm, parent_emu)
#endif
}
+
#define STATE_VERSION 2
bool I8237::process_state(FILEIO* state_fio, bool loading)
#define SIG_I8237_MASK2 10
#define SIG_I8237_MASK3 11
-
+class DEBUGGER;
class I8237_BASE : public DEVICE
{
protected:
DEVICE* d_mem;
+ DEBUGGER *d_debugger;
struct {
DEVICE* dev;
}
mode_word = false;
addr_mask = 0xffffffff;
+ d_debugger = NULL;
set_device_name(_T("i8237 DMAC"));
}
~I8237_BASE() {}
uint32_t read_io8(uint32_t addr);
virtual void write_signal(int id, uint32_t data, uint32_t mask);
virtual void do_dma();
+ // for debug
+ virtual bool is_debugger_available()
+ {
+ return false;
+ }
+ void *get_debugger()
+ {
+ return d_debugger;
+ }
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ void write_via_debugger_data8(uint32_t addr, uint32_t data);
+ uint32_t read_via_debugger_data8(uint32_t addr);
+ void write_via_debugger_data16(uint32_t addr, uint32_t data);
+ uint32_t read_via_debugger_data16(uint32_t addr);
virtual void save_state(FILEIO* state_fio) {};
virtual bool load_state(FILEIO* state_fio) { return false;}
public:
I8237(VM_TEMPLATE* parent_vm, EMU* parent_emu);
~I8237();
-
+
+ void initialize();
virtual void write_io8(uint32_t addr, uint32_t data);
void write_signal(int id, uint32_t data, uint32_t mask);
uint32_t read_signal(int id);
void do_dma();
bool process_state(FILEIO* state_fio, bool loading);
+#ifdef USE_DEBUGGER
+ bool is_debugger_available()
+ {
+ return true;
+ }
+#endif
#ifdef SINGLE_MODE_DMA
void set_context_child_dma(DEVICE* device)
{
d_dma = device;
}
#endif
+#ifdef USE_DEBUGGER
+ void set_context_debugger(DEBUGGER* device)
+ {
+ d_debugger = device;
+ }
+#endif
};
#endif
[ i8237 ]
*/
+#include "debugger.h"
#include "i8237.h"
void I8237_BASE::initialize()
// Dummy function
}
+void I8237_BASE::write_via_debugger_data8(uint32_t addr, uint32_t data)
+{
+ d_mem->write_dma_data8(addr, data);
+}
+
+uint32_t I8237_BASE::read_via_debugger_data8(uint32_t addr)
+{
+ return d_mem->read_dma_data8(addr);
+}
+
+void I8237_BASE::write_via_debugger_data16(uint32_t addr, uint32_t data)
+{
+ d_mem->write_dma_data16(addr, data);
+}
+
+uint32_t I8237_BASE::read_via_debugger_data16(uint32_t addr)
+{
+ return d_mem->read_dma_data16(addr);
+}
+
void I8237_BASE::write_mem(uint32_t addr, uint32_t data)
{
if(mode_word) {
- d_mem->write_dma_data16((addr << 1) & addr_mask, data);
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_data16((addr << 1) & addr_mask, data);
+ } else {
+ this->write_via_debugger_data16((addr << 1) & addr_mask, data);
+ }
} else {
- d_mem->write_dma_data8(addr & addr_mask, data);
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_data8(addr & addr_mask, data);
+ } else {
+ this->write_via_debugger_data8(addr & addr_mask, data);
+ }
}
}
uint32_t I8237_BASE::read_mem(uint32_t addr)
{
if(mode_word) {
- return d_mem->read_dma_data16((addr << 1) & addr_mask);
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ return d_debugger->read_via_debugger_data16((addr << 1) & addr_mask);
+ } else {
+ return this->read_via_debugger_data16((addr << 1) & addr_mask);
+ }
} else {
- return d_mem->read_dma_data8(addr & addr_mask);
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ return d_debugger->read_via_debugger_data8(addr & addr_mask);
+ } else {
+ return this->read_via_debugger_data8(addr & addr_mask);
+ }
}
}
}
}
+bool I8237_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+{
+/*
+CH0 AREG=FFFF CREG=FFFF BAREG=FFFF BCREG=FFFF REQ=1 MASK=1 MODE=FF MEM->I/O
+CH1 AREG=FFFF CREG=FFFF BAREG=FFFF BCREG=FFFF REQ=1 MASK=1 MODE=FF I/O->MEM
+CH2 AREG=FFFF CREG=FFFF BAREG=FFFF BCREG=FFFF REQ=1 MASK=1 MODE=FF VERIFY
+CH3 AREG=FFFF CREG=FFFF BAREG=FFFF BCREG=FFFF REQ=1 MASK=1 MODE=FF INVALID
+*/
+ static const _TCHAR *dir[4] = {
+ _T("VERIFY"), _T("I/O->MEM"), _T("MEM->I/O"), _T("INVALID")
+ };
+ my_stprintf_s(buffer, buffer_len,
+ _T("CH0 AREG=%04X CREG=%04X BAREG=%04X BCREG=%04X REQ=%d MASK=%d MODE=%02X %s\n")
+ _T("CH1 AREG=%04X CREG=%04X BAREG=%04X BCREG=%04X REQ=%d MASK=%d MODE=%02X %s\n")
+ _T("CH2 AREG=%04X CREG=%04X BAREG=%04X BCREG=%04X REQ=%d MASK=%d MODE=%02X %s\n")
+ _T("CH3 AREG=%04X CREG=%04X BAREG=%04X BCREG=%04X REQ=%d MASK=%d MODE=%02X %s"),
+ dma[0].areg, dma[0].creg, dma[0].bareg, dma[0].bcreg, (req >> 0) & 1, (mask >> 0) & 1, dma[0].mode, dir[(dma[0].mode >> 2) & 3],
+ dma[1].areg, dma[1].creg, dma[1].bareg, dma[1].bcreg, (req >> 1) & 1, (mask >> 1) & 1, dma[1].mode, dir[(dma[1].mode >> 2) & 3],
+ dma[2].areg, dma[2].creg, dma[2].bareg, dma[2].bcreg, (req >> 2) & 1, (mask >> 2) & 1, dma[2].mode, dir[(dma[2].mode >> 2) & 3],
+ dma[3].areg, dma[3].creg, dma[3].bareg, dma[3].bcreg, (req >> 3) & 1, (mask >> 3) & 1, dma[3].mode, dir[(dma[3].mode >> 2) & 3]);
+ return true;
+}
+
uint32_t I8237_BASE::read_io(int ch)
{
if(mode_word) {
}
return event_manager->this_device_id;
}
+bool DEVICE::is_primary_cpu(DEVICE* device)
+{
+ if(event_manager == NULL) {
+ event_manager = vm->first_device->next_device;
+ }
+ return event_manager->is_primary_cpu(device);
+}
+void DEVICE::update_extra_event(int clock)
+{
+ if(event_manager == NULL) {
+ event_manager = vm->first_device->next_device;
+ }
+ event_manager->update_extra_event(clock);
+}
void DEVICE::register_event(DEVICE* device, int event_id, double usec, bool loop, int* register_id)
{
if(event_manager == NULL) {
}
// debugger
+bool DEVICE::is_cpu()
+{
+ return false;
+}
+bool DEVICE::is_debugger()
+{
+ return false;
+}
+bool DEVICE::is_debugger_available()
+{
+ return false;
+}
void *DEVICE::get_debugger()
{
return NULL;
return 0;
}
+uint64_t DEVICE::get_debug_data_addr_space()
+{
+ // override this function when memory space is not (2 << n)
+ return (uint64_t)get_debug_data_addr_mask() + 1;
+}
void DEVICE::write_debug_data8(uint32_t addr, uint32_t data)
{
+// write_data8(addr, data);
}
-
uint32_t DEVICE::read_debug_data8(uint32_t addr)
{
+// return read_data8(addr);
return 0xff;
}
-
void DEVICE::write_debug_data16(uint32_t addr, uint32_t data)
{
write_debug_data8(addr, data & 0xff);
write_debug_data8(addr + 1, (data >> 8) & 0xff);
}
-
uint32_t DEVICE::read_debug_data16(uint32_t addr)
{
- uint32_t val = read_debug_data8(addr);
- val |= read_debug_data8(addr + 1) << 8;
- return val;
+ uint32_t val = read_debug_data8(addr);
+ val |= read_debug_data8(addr + 1) << 8;
+ return val;
}
-
void DEVICE::write_debug_data32(uint32_t addr, uint32_t data)
{
write_debug_data16(addr, data & 0xffff);
write_debug_data16(addr + 2, (data >> 16) & 0xffff);
}
-
uint32_t DEVICE::read_debug_data32(uint32_t addr)
{
uint32_t val = read_debug_data16(addr);
val |= read_debug_data16(addr + 2) << 16;
return val;
}
-
void DEVICE::write_debug_io8(uint32_t addr, uint32_t data)
{
+// write_io8(addr, data);
}
-
uint32_t DEVICE::read_debug_io8(uint32_t addr)
{
+// return read_io8(addr);
return 0xff;
}
void DEVICE::write_debug_io16(uint32_t addr, uint32_t data)
write_debug_io8(addr, data & 0xff);
write_debug_io8(addr + 1, (data >> 8) & 0xff);
}
-
uint32_t DEVICE::read_debug_io16(uint32_t addr)
{
uint32_t val = read_debug_io8(addr);
val |= read_debug_io8(addr + 1) << 8;
return val;
}
-
void DEVICE::write_debug_io32(uint32_t addr, uint32_t data)
{
write_debug_io16(addr, data & 0xffff);
write_debug_io16(addr + 2, (data >> 16) & 0xffff);
}
-
uint32_t DEVICE::read_debug_io32(uint32_t addr)
{
uint32_t val = read_debug_io16(addr);
val |= read_debug_io16(addr + 2) << 16;
return val;
}
-
bool DEVICE::write_debug_reg(const _TCHAR *reg, uint32_t data)
{
return false;
}
-
-void DEVICE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+uint32_t DEVICE::read_debug_reg(const _TCHAR *reg)
{
+ return 0;
+}
+bool DEVICE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+{
+ return false;
}
-
int DEVICE::debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len)
{
return 0;
}
+/*
+ These functions are used for debugging non-cpu device
+ Insert debugger between standard read/write functions and these functions for checking breakpoints
+
+ void DEVICE::write_data8(uint32_t addr, uint32_t data)
+ {
+ if(debugger != NULL && debugger->now_device_debugging) {
+ // debugger->mem = this;
+ // debugger->mem->write_via_debugger_data8(addr, data)
+ debugger->write_via_debugger_data8(addr, data);
+ } else {
+ this->write_via_debugger_data8(addr, data);
+ }
+ }
+ void DEVICE::write_via_debugger_data8(uint32_t addr, uint32_t data)
+ {
+ // write memory
+ }
+*/
+
+void DEVICE::write_via_debugger_data8(uint32_t addr, uint32_t data)
+{
+}
+uint32_t DEVICE::read_via_debugger_data8(uint32_t addr)
+{
+ return 0xff;
+}
+void DEVICE::write_via_debugger_data16(uint32_t addr, uint32_t data)
+{
+}
+uint32_t DEVICE::read_via_debugger_data16(uint32_t addr)
+{
+ return 0xffff;
+}
+void DEVICE::write_via_debugger_data32(uint32_t addr, uint32_t data)
+{
+}
+uint32_t DEVICE::read_via_debugger_data32(uint32_t addr)
+{
+ return 0xffffffff;
+}
+void DEVICE::write_via_debugger_data8w(uint32_t addr, uint32_t data, int* wait)
+{
+}
+uint32_t DEVICE::read_via_debugger_data8w(uint32_t addr, int* wait)
+{
+ return 0xff;
+}
+void DEVICE::write_via_debugger_data16w(uint32_t addr, uint32_t data, int* wait)
+{
+}
+uint32_t DEVICE::read_via_debugger_data16w(uint32_t addr, int* wait)
+{
+ return 0xffff;
+}
+void DEVICE::write_via_debugger_data32w(uint32_t addr, uint32_t data, int* wait)
+{
+}
+uint32_t DEVICE::read_via_debugger_data32w(uint32_t addr, int* wait)
+{
+ return 0xffffffff;
+}
+void DEVICE::write_via_debugger_io8(uint32_t addr, uint32_t data)
+{
+}
+uint32_t DEVICE::read_via_debugger_io8(uint32_t addr)
+{
+ return 0xff;
+}
+void DEVICE::write_via_debugger_io16(uint32_t addr, uint32_t data)
+{
+}
+uint32_t DEVICE::read_via_debugger_io16(uint32_t addr)
+{
+ return 0xffff;
+}
+void DEVICE::write_via_debugger_io32(uint32_t addr, uint32_t data)
+{
+}
+uint32_t DEVICE::read_via_debugger_io32(uint32_t addr)
+{
+ return 0xffffffff;
+}
+void DEVICE::write_via_debugger_io8w(uint32_t addr, uint32_t data, int* wait)
+{
+}
+uint32_t DEVICE::read_via_debugger_io8w(uint32_t addr, int* wait)
+{
+ return 0xff;
+}
+void DEVICE::write_via_debugger_io16w(uint32_t addr, uint32_t data, int* wait)
+{
+}
+uint32_t DEVICE::read_via_debugger_io16w(uint32_t addr, int* wait)
+{
+ return 0xffff;
+}
+void DEVICE::write_via_debugger_io32w(uint32_t addr, uint32_t data, int* wait)
+{
+}
+uint32_t DEVICE::read_via_debugger_io32w(uint32_t addr, int* wait)
+{
+ return 0xffffffff;
+}
+
const _TCHAR *DEVICE::get_lib_common_vm_version(void)
{
// z80 daisy chain
virtual void set_context_intr(DEVICE* device, uint32_t bit) {}
virtual void set_context_child(DEVICE* device) {}
+ virtual DEVICE *get_context_child()
+ {
+ return NULL;
+ }
// interrupt device to device
virtual void set_intr_iei(bool val) {}
event_manager = device;
}
virtual int get_event_manager_id();
+ virtual bool is_primary_cpu(DEVICE* device);
+ virtual void update_extra_event(int clock);
virtual void register_event(DEVICE* device, int event_id, double usec, bool loop, int* register_id);
virtual void register_event_by_clock(DEVICE* device, int event_id, uint64_t clock, bool loop, int* register_id);
virtual void cancel_event(DEVICE* device, int register_id);
virtual void mix(int32_t* buffer, int cnt) {}
virtual void set_volume(int ch, int decibel_l, int decibel_r) {} // +1 equals +0.5dB (same as fmgen)
virtual void set_device_name(const _TCHAR *format, ...);
- virtual void out_debug_log(const char *fmt, ...);
- virtual void force_out_debug_log(const char *fmt, ...);
// debugger
// DEBUGGER is enabled by default.
+ virtual bool is_cpu();
+ virtual bool is_debugger();
+ virtual bool is_debugger_available();
virtual void *get_debugger();
virtual uint32_t get_debug_prog_addr_mask();
virtual uint32_t get_debug_data_addr_mask();
+ virtual uint64_t get_debug_data_addr_space();
virtual void write_debug_data8(uint32_t addr, uint32_t data);
virtual uint32_t read_debug_data8(uint32_t addr);
virtual void write_debug_data16(uint32_t addr, uint32_t data);
virtual void write_debug_io32(uint32_t addr, uint32_t data);
virtual uint32_t read_debug_io32(uint32_t addr);
virtual bool write_debug_reg(const _TCHAR *reg, uint32_t data);
- virtual void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ virtual uint32_t read_debug_reg(const _TCHAR *reg);
+ virtual bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
virtual int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
-
+/*
+ These functions are used for debugging non-cpu device
+ Insert debugger between standard read/write functions and these functions for checking breakpoints
+
+ void DEVICE::write_data8(uint32_t addr, uint32_t data)
+ {
+ if(debugger != NULL && debugger->now_device_debugging) {
+ // debugger->mem = this;
+ // debugger->mem->write_via_debugger_data8(addr, data)
+ debugger->write_via_debugger_data8(addr, data);
+ } else {
+ this->write_via_debugger_data8(addr, data);
+ }
+ }
+ void DEVICE::write_via_debugger_data8(uint32_t addr, uint32_t data)
+ {
+ // write memory
+ }
+*/
+ virtual void write_via_debugger_data8(uint32_t addr, uint32_t data);
+ virtual uint32_t read_via_debugger_data8(uint32_t addr);
+ virtual void write_via_debugger_data16(uint32_t addr, uint32_t data);
+ virtual uint32_t read_via_debugger_data16(uint32_t addr);
+ virtual void write_via_debugger_data32(uint32_t addr, uint32_t data);
+ virtual uint32_t read_via_debugger_data32(uint32_t addr);
+ virtual void write_via_debugger_data8w(uint32_t addr, uint32_t data, int* wait);
+ virtual uint32_t read_via_debugger_data8w(uint32_t addr, int* wait);
+ virtual void write_via_debugger_data16w(uint32_t addr, uint32_t data, int* wait);
+ virtual uint32_t read_via_debugger_data16w(uint32_t addr, int* wait);
+ virtual void write_via_debugger_data32w(uint32_t addr, uint32_t data, int* wait);
+ virtual uint32_t read_via_debugger_data32w(uint32_t addr, int* wait);
+ virtual void write_via_debugger_io8(uint32_t addr, uint32_t data);
+ virtual uint32_t read_via_debugger_io8(uint32_t addr);
+ virtual void write_via_debugger_io16(uint32_t addr, uint32_t data);
+ virtual uint32_t read_via_debugger_io16(uint32_t addr);
+ virtual void write_via_debugger_io32(uint32_t addr, uint32_t data);
+ virtual uint32_t read_via_debugger_io32(uint32_t addr);
+ virtual void write_via_debugger_io8w(uint32_t addr, uint32_t data, int* wait);
+ virtual uint32_t read_via_debugger_io8w(uint32_t addr, int* wait);
+ virtual void write_via_debugger_io16w(uint32_t addr, uint32_t data, int* wait);
+ virtual uint32_t read_via_debugger_io16w(uint32_t addr, int* wait);
+ virtual void write_via_debugger_io32w(uint32_t addr, uint32_t data, int* wait);
+ virtual uint32_t read_via_debugger_io32w(uint32_t addr, int* wait);
+ virtual void out_debug_log(const char *fmt, ...);
+ virtual void force_out_debug_log(const char *fmt, ...);
+
// misc
const _TCHAR *get_lib_common_vm_version(void);
if(now_debugging) {
cpustate->debugger->check_break_points(cpustate->pc);
if(cpustate->debugger->now_suspended) {
- cpustate->emu->mute_sound();
cpustate->debugger->now_waiting = true;
+ cpustate->emu->start_waiting_in_debugger();
while(cpustate->debugger->now_debugging && cpustate->debugger->now_suspended) {
- cpustate->emu->sleep(10);
+ cpustate->emu->process_waiting_in_debugger();
}
+ cpustate->emu->finish_waiting_in_debugger();
cpustate->debugger->now_waiting = false;
}
if(cpustate->debugger->now_debugging) {
void M6502::initialize()
{
- DEVICE::initialize();
- A = X = Y = P = 0;
- SPD = EAD = ZPD = PCD = 0;
+ M6502_BASE::initialize();
#ifdef USE_DEBUGGER
d_mem_stored = d_mem;
d_debugger->set_context_mem(d_mem);
if(now_debugging) {
d_debugger->check_break_points(PCW);
if(d_debugger->now_suspended) {
- emu->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- emu->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
if(now_debugging) {
d_debugger->check_break_points(PCW);
if(d_debugger->now_suspended) {
- emu->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- emu->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
void write_debug_data8(uint32_t addr, uint32_t data);
uint32_t read_debug_data8(uint32_t addr);
bool write_debug_reg(const _TCHAR *reg, uint32_t data);
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
virtual int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
//#endif
return true;
}
-void M6502_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool M6502_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
my_stprintf_s(buffer, buffer_len,
- _T("PC = %04X A = %02X X = %02X Y = %02X S = %02X P = %02X [%c%c%c%c%c%c%c%c]\nClocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+ _T("PC = %04X A = %02X X = %02X Y = %02X S = %02X P = %02X [%c%c%c%c%c%c%c%c]\n")
+ _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
PCW, A, X, Y, S, P,
(P & F_N) ? _T('N') : _T('-'), (P & F_V) ? _T('V') : _T('-'), (P & F_T) ? _T('T') : _T('-'), (P & F_B) ? _T('B') : _T('-'),
(P & F_D) ? _T('D') : _T('-'), (P & F_I) ? _T('I') : _T('-'), (P & F_Z) ? _T('Z') : _T('-'), (P & F_C) ? _T('C') : _T('-'),
total_icount, total_icount - prev_total_icount,
get_passed_clock_since_vline(), get_cur_vline_clocks(), get_cur_vline(), get_lines_per_frame());
prev_total_icount = total_icount;
+ return true;
}
// disassembler
if(now_debugging) {
cpustate->debugger->check_break_points(cpustate->pc.w.l);
if(cpustate->debugger->now_suspended) {
- cpustate->emu->mute_sound();
cpustate->debugger->now_waiting = true;
+ cpustate->emu->start_waiting_in_debugger();
while(cpustate->debugger->now_debugging && cpustate->debugger->now_suspended) {
- cpustate->emu->sleep(10);
+ cpustate->emu->process_waiting_in_debugger();
}
+ cpustate->emu->finish_waiting_in_debugger();
cpustate->debugger->now_waiting = false;
}
if(cpustate->debugger->now_debugging) {
if(now_debugging) {
cpustate->debugger->check_break_points(cpustate->pc);
if(cpustate->debugger->now_suspended) {
- cpustate->emu->mute_sound();
cpustate->debugger->now_waiting = true;
+ cpustate->emu->start_waiting_in_debugger();
while(cpustate->debugger->now_debugging && cpustate->debugger->now_suspended) {
- cpustate->emu->sleep(10);
+ cpustate->emu->process_waiting_in_debugger();
}
+ cpustate->emu->finish_waiting_in_debugger();
cpustate->debugger->now_waiting = false;
}
if(cpustate->debugger->now_debugging) {
if(now_debugging) {
cpustate->debugger->check_break_points(cpustate->pc);
if(cpustate->debugger->now_suspended) {
- cpustate->emu->mute_sound();
cpustate->debugger->now_waiting = true;
+ cpustate->emu->start_waiting_in_debugger();
while(cpustate->debugger->now_debugging && cpustate->debugger->now_suspended) {
- cpustate->emu->sleep(10);
+ cpustate->emu->process_waiting_in_debugger();
}
+ cpustate->emu->finish_waiting_in_debugger();
cpustate->debugger->now_waiting = false;
}
if(cpustate->debugger->now_debugging) {
if(now_debugging) {
cpustate->debugger->check_break_points(cpustate->pc);
if(cpustate->debugger->now_suspended) {
- cpustate->emu->mute_sound();
cpustate->debugger->now_waiting = true;
+ cpustate->emu->start_waiting_in_debugger();
while(cpustate->debugger->now_debugging && cpustate->debugger->now_suspended) {
- cpustate->emu->sleep(10);
+ cpustate->emu->process_waiting_in_debugger();
}
+ cpustate->emu->finish_waiting_in_debugger();
cpustate->debugger->now_waiting = false;
}
if(cpustate->debugger->now_debugging) {
if(now_debugging) {
cpustate->debugger->check_break_points(cpustate->pc);
if(cpustate->debugger->now_suspended) {
- cpustate->emu->mute_sound();
cpustate->debugger->now_waiting = true;
+ cpustate->emu->start_waiting_in_debugger();
while(cpustate->debugger->now_debugging && cpustate->debugger->now_suspended) {
- cpustate->emu->sleep(10);
+ cpustate->emu->process_waiting_in_debugger();
}
+ cpustate->emu->finish_waiting_in_debugger();
cpustate->debugger->now_waiting = false;
}
if(cpustate->debugger->now_debugging) {
if(now_debugging) {
cpustate->debugger->check_break_points(cpustate->pc);
if(cpustate->debugger->now_suspended) {
- cpustate->emu->mute_sound();
cpustate->debugger->now_waiting = true;
+ cpustate->emu->start_waiting_in_debugger();
while(cpustate->debugger->now_debugging && cpustate->debugger->now_suspended) {
- cpustate->emu->sleep(10);
+ cpustate->emu->process_waiting_in_debugger();
}
+ cpustate->emu->finish_waiting_in_debugger();
cpustate->debugger->now_waiting = false;
}
if(cpustate->debugger->now_debugging) {
if(now_debugging) {
cpustate->debugger->check_break_points(cpustate->pc.w.l);
if(cpustate->debugger->now_suspended) {
- cpustate->emu->mute_sound();
cpustate->debugger->now_waiting = true;
+ cpustate->emu->start_waiting_in_debugger();
while(cpustate->debugger->now_debugging && cpustate->debugger->now_suspended) {
- cpustate->emu->sleep(10);
+ cpustate->emu->process_waiting_in_debugger();
}
+ cpustate->emu->finish_waiting_in_debugger();
cpustate->debugger->now_waiting = false;
}
if(cpustate->debugger->now_debugging) {
//#define DRIVE_MASK (MAX_DRIVE - 1)
-#define DELAY_TIME (disk[drvreg]->drive_type == DRIVE_TYPE_2HD ? 15000 : 30000)
+#define DELAY_AFTER_HLD (disk[drvreg]->drive_type == DRIVE_TYPE_2HD ? 15000 : 30000)
static const int seek_wait_hi[4] = {3000, 6000, 10000, 16000}; // 2MHz
static const int seek_wait_lo[4] = {6000, 12000, 20000, 30000}; // 1MHz
register_event(this, (event << 8) | (cmdtype & 0xff), usec, false, ®ister_id[event]);
}
-void MB8877::register_seek_event()
+void MB8877::register_seek_event(bool first)
{
cancel_my_event(EVENT_SEEK);
if(fdc[drvreg].track == seektrk) {
register_event(this, (EVENT_SEEK << 8) | (cmdtype & 0xff), 300, false, ®ister_id[EVENT_SEEK]); // From XM7 v3.4L77a Wait 300uS.
} else if(disk[drvreg]->drive_type == DRIVE_TYPE_2HD) {
- register_event(this, (EVENT_SEEK << 8) | (cmdtype & 0xff), seek_wait_hi[cmdreg & 3], false, ®ister_id[EVENT_SEEK]);
+ register_event(this, (EVENT_SEEK << 8) | (cmdtype & 0xff), seek_wait_hi[cmdreg & 3] - (first ? 250 : 0), false, ®ister_id[EVENT_SEEK]);
} else {
- register_event(this, (EVENT_SEEK << 8) | (cmdtype & 0xff), seek_wait_lo[cmdreg & 3], false, ®ister_id[EVENT_SEEK]);
+ register_event(this, (EVENT_SEEK << 8) | (cmdtype & 0xff), seek_wait_lo[cmdreg & 3] - (first ? 500 : 0), false, ®ister_id[EVENT_SEEK]);
}
now_seek = true;
}
if(osd->check_feature(_T("MB8877_NO_BUSY_AFTER_SEEK"))) {
mb8877_no_busy_after_seek = true;
}
+ if(osd->check_feature(_T("MB8877_DELAY_AFTER_SEEK"))) {
+ mb8877_delay_after_seek = osd->get_feature_int_value(_T("MB8877_DELAY_AFTER_SEEK"));
+ }
//if(osd->check_feature(_T("_FDC_DEBUG_LOG"))) {
// fdc_debug_log = true;
//}
//set_drq(false);
//set_irq(true); // 20180118 K.O Turn ON IRQ -> Turn OFF DRQ
//}
- register_seek_event();
+ register_seek_event(false);
break;
}
#if 1
seektrk = 0;
seekvct = true;
- register_seek_event();
+ register_seek_event(true);
}
void MB8877::cmd_seek()
trkreg = datareg;
set_irq(false);
set_drq(false);
- register_seek_event();
+ register_seek_event(true);
}
void MB8877::cmd_step()
seekvct = false;
set_irq(false);
set_drq(false);
- register_seek_event();
+ register_seek_event(true);
}
void MB8877::cmd_stepout()
seektrk = 0;
}
seekvct = true;
- register_seek_event();
+ register_seek_event(true);
}
void MB8877::cmd_readdata(bool first_sector)
if(status_tmp & FDC_ST_RECNFND) {
time = get_usec_to_detect_index_hole(5, first_sector && ((cmdreg & 4) != 0));
} else if(status & FDC_ST_WRITEFAULT) {
- time = (cmdreg & 4) ? DELAY_TIME : 1;
+ time = (cmdreg & 4) ? DELAY_AFTER_HLD : 1;
} else {
time = get_usec_to_start_trans(first_sector);
}
double time;
if(disk[drvreg]->write_protected) {
status_tmp = FDC_ST_WRITEFAULT;
- time = (cmdreg & 4) ? DELAY_TIME : 1;
+ time = (cmdreg & 4) ? DELAY_AFTER_HLD : 1;
} else {
if(cmdreg & 4) {
// wait 15msec before raise first drq
- fdc[drvreg].next_trans_position = (get_cur_position() + disk[drvreg]->get_bytes_per_usec(DELAY_TIME)) % disk[drvreg]->get_track_size();
- time = DELAY_TIME;
+ fdc[drvreg].next_trans_position = (get_cur_position() + disk[drvreg]->get_bytes_per_usec(DELAY_AFTER_HLD)) % disk[drvreg]->get_track_size();
+ time = DELAY_AFTER_HLD;
} else {
// raise first drq soon
fdc[drvreg].next_trans_position = (get_cur_position() + 1) % disk[drvreg]->get_track_size();
now_search = true;
status_tmp = FDC_ST_WRITEFAULT;
- double time = (cmdreg & 4) ? DELAY_TIME : 1;
+ double time = (cmdreg & 4) ? DELAY_AFTER_HLD : 1;
register_my_event(EVENT_SEARCH, time);
cancel_my_event(EVENT_LOST);
{
// get time from current position
double time = get_usec_to_next_trans_pos(first_sector && ((cmdreg & 4) != 0));
- if(first_sector && time < 60000 - get_passed_usec(seekend_clock)) {
- time += disk[drvreg]->get_usec_per_track();
+
+ if(mb8877_delay_after_seek > 0) {
+ // wait 60ms to start read/write after seek is finished (FM-Techknow, p.180)
+ if(first_sector && time < mb8877_delay_after_seek - get_passed_usec(seekend_clock)) {
+ time += disk[drvreg]->get_usec_per_track();
+ }
}
return time;
}
return 50000;
}
if(delay) {
- position = (position + disk[drvreg]->get_bytes_per_usec(DELAY_TIME)) % disk[drvreg]->get_track_size();
+ position = (position + disk[drvreg]->get_bytes_per_usec(DELAY_AFTER_HLD)) % disk[drvreg]->get_track_size();
}
int bytes = fdc[drvreg].next_trans_position - position;
if(fdc[drvreg].next_am1_position < position || bytes < 0) {
}
double time = disk[drvreg]->get_usec_per_bytes(bytes);
if(delay) {
- time += DELAY_TIME;
+ time += DELAY_AFTER_HLD;
}
return time;
}
{
int position = get_cur_position();
if(delay) {
- position = (position + disk[drvreg]->get_bytes_per_usec(DELAY_TIME)) % disk[drvreg]->get_track_size();
+ position = (position + disk[drvreg]->get_bytes_per_usec(DELAY_AFTER_HLD)) % disk[drvreg]->get_track_size();
}
int bytes = disk[drvreg]->get_track_size() * count - position;
if(bytes < 0) {
}
double time = disk[drvreg]->get_usec_per_bytes(bytes);
if(delay) {
- time += DELAY_TIME;
+ time += DELAY_AFTER_HLD;
}
return time;
}
if(drv < _max_drive) {
disk[drv]->close();
//cmdtype = 0;
- update_head_flag(drvreg, false);
+ if(drv == drvreg) {
+ cmdtype = 0;
+ }
+ update_head_flag(drv, false);
fdc[drv].count_immediate = false;
}
}
_T("RD DATA "), _T("RD DATA "), _T("RD DATA "), _T("WR DATA "),
_T("RD ADDR "), _T("FORCEINT"), _T("RD TRACK"), _T("WR TRACK")
};
-void MB8877::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+
+bool MB8877::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
+ int position = get_cur_position();
+
my_stprintf_s(buffer, buffer_len,
- _T("CMDREG=%02X (%s) DATAREG=%02X DRVREG=%02X TRKREG=%02X SIDEREG=%d SECREG=%02X\nUNIT: DRIVE=%d TRACK=%2d SIDE=%d SECTORS=%2d C=%02X H=%02X R=%02X N=%02X LENGTH=%d"),
+ _T("CMDREG=%02X (%s) DATAREG=%02X DRVREG=%02X TRKREG=%02X SIDEREG=%d SECREG=%02X\n")
+ _T("UNIT: DRIVE=%d TRACK=%2d SIDE=%d POSITION=%5d/%d"),
cmdreg, cmdstr[cmdreg >> 4], datareg, drvreg, trkreg, sidereg, secreg,
- drvreg, fdc[drvreg].track, sidereg, disk[drvreg]->sector_num.sd,
- disk[drvreg]->id[0], disk[drvreg]->id[1], disk[drvreg]->id[2], disk[drvreg]->id[3],
- disk[drvreg]->sector_size.sd);
+ drvreg, fdc[drvreg].track, sidereg,
+ position, disk[drvreg]->get_track_size());
+
+ for(int i = 0; i < disk[drvreg]->sector_num.sd; i++) {
+ uint8_t c, h, r, n;
+ int length;
+ if(disk[drvreg]->get_sector_info(-1, -1, i, &c, &h, &r, &n, &length)) {
+ my_tcscat_s(buffer, buffer_len,
+ create_string(_T("\nSECTOR %2d: C=%02X H=%02X R=%02X N=%02X SIZE=%4d AM1=%5d DATA=%5d"), i + 1, c, h, r, n, length, disk[drvreg]->am1_position[i], disk[drvreg]->data_position[i]));
+ if(position >= disk[drvreg]->am1_position[i] && position < disk[drvreg]->data_position[i] + length) {
+ my_tcscat_s(buffer, buffer_len, _T(" <==="));
+ }
+ }
+ }
+ return true;
}
//#endif
void cancel_my_event(int event);
void register_my_event(int event, double usec);
bool register_my_event_with_check(int event, double usec);
- void register_seek_event();
+ void register_seek_event(bool first);
void register_drq_event(int bytes);
void register_lost_event(int bytes);
bool type_fmr50;
bool type_fmr60;
bool mb8877_no_busy_after_seek;
+ int mb8877_delay_after_seek;
int _max_drive;
int _drive_mask;
drvreg = sidereg = 0;
motor_on = drive_sel = false;
//
+ mb8877_delay_after_seek = 0;
fdc_debug_log = invert_registers = type_fm77av_2dd = false;
type_mb8866 = type_mb89311 = false;
type_x1 = type_fm7 = type_fmr50 = type_fmr60 = false;
uint32_t read_signal(int ch);
void event_callback(int event_id, int err);
void update_config();
-//#ifdef USE_DEBUGGER
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
-//#endif
+ bool is_debugger_available()
+ {
+ return true;
+ }
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
bool process_state(FILEIO* state_fio, bool loading);
// unique functions
if(now_debugging) {
d_debugger->check_break_points(PC);
if(d_debugger->now_suspended) {
- emu->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- emu->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
return true;
}
-void MC6800::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool MC6800::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
my_stprintf_s(buffer, buffer_len,
- _T("CCR = [%c%c%c%c%c%c] A = %02X B = %02X IX = %04X PC = %04X SP = %04X\nClocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+ _T("CCR = [%c%c%c%c%c%c] A = %02X B = %02X IX = %04X PC = %04X SP = %04X\n")
+ _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
(CC & 0x01) ? _T('C') : _T('-'), (CC & 0x02) ? _T('V') : _T('-'), (CC & 0x04) ? _T('Z') : _T('-'), (CC & 0x08) ? _T('N') : _T('-'),
(CC & 0x10) ? _T('I') : _T('-'), (CC & 0x20) ? _T('X') : _T('-'), A, B, X, PC, S,
total_icount, total_icount - prev_total_icount,
get_passed_clock_since_vline(), get_cur_vline_clocks(), get_cur_vline(), get_lines_per_frame());
prev_total_icount = total_icount;
+ return true;
}
/*
void write_debug_data32(uint32_t addr, uint32_t data);
uint32_t read_debug_data32(uint32_t addr);
bool write_debug_reg(const _TCHAR *reg, uint32_t data);
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
virtual int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
//#endif
virtual bool process_state(FILEIO* state_fio, bool loading);
if(now_debugging) {
d_debugger->check_break_points(PC);
if(d_debugger->now_suspended) {
- emu->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- emu->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
if(now_debugging) {
d_debugger->check_break_points(PC);
if(d_debugger->now_suspended) {
- osd->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- osd->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
if(now_debugging) {
d_debugger->check_break_points(PC);
if(d_debugger->now_suspended) {
- osd->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- osd->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
}
~MC6809_BASE() {}
+ bool is_cpu()
+ {
+ return true;
+ }
+ bool is_debugger_available()
+ {
+ return true;
+ }
void *get_debugger()
{
return d_debugger;
return val;
}
bool write_debug_reg(const _TCHAR *reg, uint32_t data);
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
virtual int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
virtual uint32_t cpu_disassemble_m6809(_TCHAR *buffer, uint32_t pc, const uint8_t *oprom, const uint8_t *opram);
virtual void debugger_hook(void);
A = 00 B = 00 DP = 00 X = 0000 Y = 0000 U = 0000 S = 0000 EA = 0000
Clocks = 0 (0) Since Scanline = 0/0 (0/0)
*/
-void MC6809_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool MC6809_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
//#ifdef USE_DEBUGGER
my_stprintf_s(buffer, buffer_len,
- _T("PC = %04x PPC = %04x\nINTR = [%s %s %s %s][%s %s %s %s %s] CC = [%c%c%c%c%c%c%c%c]\nA = %02x B = %02x DP = %02x X = %04x Y = %04x U = %04x S = %04x EA = %04x\nClocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+ _T("PC = %04x PPC = %04x\n")
+ _T("INTR = [%s %s %s %s][%s %s %s %s %s] CC = [%c%c%c%c%c%c%c%c]\n")
+ _T("A = %02x B = %02x DP = %02x X = %04x Y = %04x U = %04x S = %04x EA = %04x\n")
+ _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
PC,
PPC,
((int_state & MC6809_IRQ_BIT) == 0) ? _T("----") : _T(" IRQ"),
);
prev_total_icount = total_icount;
//#endif
+ return true;
}
uint32_t MC6809_BASE::cpu_disassemble_m6809(_TCHAR *buffer, uint32_t pc, const uint8_t *oprom, const uint8_t *opram)
*/
#include "mc6844.h"
+//#ifdef USE_DEBUGGER
+#include "debugger.h"
+//#endif
#define STAT_BUSY 0x40
#define STAT_DEND 0x80
#define IRQ_FLAG 0x80
+void MC6844::initialize()
+{
+//#ifdef USE_DEBUGGER
+ if(d_debugger != NULL) {
+ d_debugger->set_device_name(_T("Debugger (MC6844 DMAC)"));
+ d_debugger->set_context_mem(this);
+ d_debugger->set_context_io(vm->dummy);
+ }
+//#endif
+}
+
void MC6844::reset()
{
for(int i = 0; i < 4; i++) {
}
}
+void MC6844::write_via_debugger_data8(uint32_t addr, uint32_t data)
+{
+ d_memory->write_dma_data8(addr, data);
+}
+
+uint32_t MC6844::read_via_debugger_data8(uint32_t addr)
+{
+ return d_memory->read_dma_data8(addr);
+}
+
void MC6844::transfer(int ch)
{
if(priority_ctrl_reg & (1 << ch)) {
if(dma[ch].byte_count_reg.w.l != 0) {
if(dma[ch].channel_ctrl_reg & 0x01) {
uint8_t data;
- data = d_memory->read_dma_data8(dma[ch].address_reg.w.l);
- dma[ch].device->write_dma_io8(0, data);
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ data = d_debugger->read_via_debugger_data8(dma[ch].address_reg.w.l);
+ } else {
+ data = this->read_via_debugger_data8(dma[ch].address_reg.w.l);
+ }
+ dma[ch].device->write_dma_io8(0, data);
} else {
- uint8_t data;
- data = dma[ch].device->read_dma_io8(0);
- d_memory->write_dma_data8(dma[ch].address_reg.w.l, data);
+ uint8_t data = dma[ch].device->read_dma_io8(0);
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_data8(dma[ch].address_reg.w.l, data);
+ } else {
+ this->write_via_debugger_data8(dma[ch].address_reg.w.l, data);
+ }
}
if(dma[ch].channel_ctrl_reg & 0x08) {
dma[ch].address_reg.d--;
}
}
+bool MC6844::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+{
+/*
+CH0 ADDR=FFFF COUNT=FFFF CTRL=FF ENABLE=1 MEM->I/O
+CH1 ADDR=FFFF COUNT=FFFF CTRL=FF ENABLE=1 I/O->MEM
+CH2 ADDR=FFFF COUNT=FFFF CTRL=FF ENABLE=1 MEM->I/O
+CH3 ADDR=FFFF COUNT=FFFF CTRL=FF ENABLE=1 I/O->MEM
+*/
+ static const _TCHAR *dir[2] = {
+ _T("MEM->I/O"), _T("I/O->MEM")
+ };
+ my_stprintf_s(buffer, buffer_len,
+ _T("CH0 ADDR=%04X COUNT=%04X CTRL=%02X ENABLE=%d %s\n")
+ _T("CH1 ADDR=%04X COUNT=%04X CTRL=%02X ENABLE=%d %s\n")
+ _T("CH2 ADDR=%04X COUNT=%04X CTRL=%02X ENABLE=%d %s\n")
+ _T("CH3 ADDR=%04X COUNT=%04X CTRL=%02X ENABLE=%d %s"),
+ dma[0].address_reg.w.l, dma[0].byte_count_reg.w.l, dma[0].channel_ctrl_reg, (priority_ctrl_reg >> 0) & 1, dir[dma[0].channel_ctrl_reg & 1],
+ dma[1].address_reg.w.l, dma[1].byte_count_reg.w.l, dma[1].channel_ctrl_reg, (priority_ctrl_reg >> 1) & 1, dir[dma[1].channel_ctrl_reg & 1],
+ dma[2].address_reg.w.l, dma[2].byte_count_reg.w.l, dma[2].channel_ctrl_reg, (priority_ctrl_reg >> 2) & 1, dir[dma[2].channel_ctrl_reg & 1],
+ dma[3].address_reg.w.l, dma[3].byte_count_reg.w.l, dma[3].channel_ctrl_reg, (priority_ctrl_reg >> 3) & 1, dir[dma[3].channel_ctrl_reg & 1]);
+ return true;
+}
+
#define STATE_VERSION 1
bool MC6844::process_state(FILEIO* state_fio, bool loading)
#define SIG_MC6844_TX_RQ_2 2
#define SIG_MC6844_TX_RQ_3 3
+class DEBUGGER;
+
class MC6844 : public DEVICE
{
private:
DEVICE* d_memory;
+ DEBUGGER *d_debugger;
struct {
DEVICE *device;
dma[i].device = __dev;
}
d_memory = __dev;
+ d_debugger = NULL;
initialize_output_signals(&outputs_irq);
set_device_name(_T("MC6844 DMAC"));
}
~MC6844() {}
// common functions
+ void initialize();
void reset();
void write_io8(uint32_t addr, uint32_t data);
uint32_t read_io8(uint32_t addr);
void write_signal(int id, uint32_t data, uint32_t mask);
+ // for debug
+ void write_via_debugger_data8(uint32_t addr, uint32_t data);
+ uint32_t read_via_debugger_data8(uint32_t addr);
+ bool is_debugger_available()
+ {
+ return true;
+ }
+ void *get_debugger()
+ {
+ return d_debugger;
+ }
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+
bool process_state(FILEIO* state_fio, bool loading);
// unique functions
{
dma[3].device = device;
}
+ void set_context_debugger(DEBUGGER* device)
+ {
+ d_debugger = device;
+ }
};
#endif
void MCS48::initialize()
{
- DEVICE::initialize();
+ MCS48_BASE::initialize();
opaque = calloc(1, sizeof(mcs48_state));
mcs48_state *cpustate = (mcs48_state *)opaque;
if(now_debugging) {
d_debugger->check_break_points(cpustate->pc);
if(d_debugger->now_suspended) {
- emu->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- emu->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
void write_debug_io8(uint32_t addr, uint32_t data);
uint32_t read_debug_io8(uint32_t addr);
bool write_debug_reg(const _TCHAR *reg, uint32_t data);
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
//#endif
int run(int icount);
bool process_state(FILEIO* state_fio, bool loading);
#ifdef USE_DEBUGGER
+ bool is_cpu()
+ {
+ return true;
+ }
+ bool is_debugger_available()
+ {
+ return true;
+ }
void *get_debugger()
{
return d_debugger;
void MCS48_BASE::initialize()
{
// Dummy function
+ DEVICE::initialize();
}
void MCS48_BASE::release()
return true;
}
-void MCS48_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool MCS48_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
/*
R0 = 00 R1 = 00 R2 = 00 R3 = 00 (R0)= 00 (R1)= 00 (SP-1)= 0000 PC = 0000
UINT8 prev_sp = 8 + 2 * ((cpustate->psw - 1) & 7);
my_stprintf_s(buffer, buffer_len,
- _T("R0 = %02X R1 = %02X R2 = %02X R3 = %02X (R0)= %02X (R1)= %02X (SP-1)= %04X PC = %04X\nR4 = %02X R5 = %02X R6 = %02X R7 = %02X AC = %02X SP = %02X [%s %s %s %s %s %s]\nClocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+ _T("R0 = %02X R1 = %02X R2 = %02X R3 = %02X (R0)= %02X (R1)= %02X (SP-1)= %04X PC = %04X\n")
+ _T("R4 = %02X R5 = %02X R6 = %02X R7 = %02X AC = %02X SP = %02X [%s %s %s %s %s %s]\n")
+ _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
__mcs48_reg_r(0), __mcs48_reg_r(1), __mcs48_reg_r(2), __mcs48_reg_r(3), d_mem_stored->read_data8(__mcs48_reg_r(0)), d_mem_stored->read_data8(__mcs48_reg_r(1)),
d_mem_stored->read_data8(prev_sp) | (d_mem_stored->read_data8(prev_sp + 1) << 8), cpustate->pc,
__mcs48_reg_r(4), __mcs48_reg_r(5), __mcs48_reg_r(6), __mcs48_reg_r(7), cpustate->a, sp,
total_icount, total_icount - prev_total_icount,
get_passed_clock_since_vline(), get_cur_vline_clocks(), get_cur_vline(), get_lines_per_frame());
prev_total_icount = total_icount;
+ return true;
}
// license:BSD-3-Clause
if(now_debugging) {
d_debugger->check_break_points(PCW);
if(d_debugger->now_suspended) {
- emu->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- emu->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
// control input from disk unit (port D2H)
unsigned char PC6031::FddCntIn60(void)
{
- if ((((old_D2H & 0x01) ^ mdisk.DAV) != 0) || (mdisk.RFD != 0) && (mdisk.DAV != 0)) { // ToDo: Check Logic 20180614 K.O
+ if ((((old_D2H & 0x01) ^ mdisk.DAV) != 0) || ((mdisk.RFD != 0) && (mdisk.DAV != 0))) { // ToDo: Check Logic 20180614 K.O
mdisk.DAC = mdisk.DAV;
} else if (mdisk.ATN != 0) {
mdisk.RFD = 1;
*/
#include "tms9918a.h"
+#include "debugger.h"
//#define ADDR_MASK (TMS9918A_VRAM_SIZE - 1)
}
register_vline_event(this);
+
+ if(d_debugger != NULL) {
+ d_debugger->set_device_name(_T("Debugger (TMS9918A VDP)"));
+ d_debugger->set_context_mem(this);
+ d_debugger->set_context_io(vm->dummy);
+ }
}
void TMS9918A::release()
// register
if(latch) {
if(data & 0x80) {
- switch(data & 7) {
- case 0:
- regs[0] = first_byte & 3;
- if(regs[0] & 2) {
- color_table = ((regs[3] & 0x80) * 64) & _ADDR_MASK;
- color_mask = ((regs[3] & 0x7f) * 8) | 7;
- pattern_table = ((regs[4] & 4) * 2048) & _ADDR_MASK;
- pattern_mask = ((regs[4] & 3) * 256) | (color_mask & 0xff);
- } else {
- color_table = (regs[3] * 64) & _ADDR_MASK;
- pattern_table = (regs[4] * 2048) & _ADDR_MASK;
- }
- break;
- case 1:
- regs[1] = first_byte & 0xfb;
- set_intstat((regs[1] & 0x20) && (status_reg & 0x80));
- break;
- case 2:
- regs[2] = first_byte & 0x0f;
- name_table = (regs[2] * 1024) & _ADDR_MASK;
- break;
- case 3:
- regs[3] = first_byte;
- if(regs[0] & 2) {
- color_table = ((regs[3] & 0x80) * 64) & _ADDR_MASK;
- color_mask = ((regs[3] & 0x7f) * 8) | 7;
- } else {
- color_table = (regs[3] * 64) & _ADDR_MASK;
- }
- pattern_mask = ((regs[4] & 3) * 256) | (color_mask & 0xff);
- break;
- case 4:
- regs[4] = first_byte & 7;
- if(regs[0] & 2) {
- pattern_table = ((regs[4] & 4) * 2048) & _ADDR_MASK;
- pattern_mask = ((regs[4] & 3) * 256) | 255;
- } else {
- pattern_table = (regs[4] * 2048) & _ADDR_MASK;
- }
- break;
- case 5:
- regs[5] = first_byte & 0x7f;
- sprite_attrib = (regs[5] * 128) & _ADDR_MASK;
- break;
- case 6:
- regs[6] = first_byte & 7;
- sprite_pattern = (regs[6] * 2048) & _ADDR_MASK;
- break;
- case 7:
- regs[7] = first_byte;
- break;
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_io8(data, first_byte);
+ } else {
+ this->write_via_debugger_io8(data, first_byte);
}
} else {
vram_addr = ((data * 256) | first_byte) & _ADDR_MASK;
}
} else {
// vram
- vram[vram_addr] = data;
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_data8(vram_addr, data);
+ } else {
+ this->write_via_debugger_data8(vram_addr, data);
+ }
+// vram[vram_addr] = data;
vram_addr = (vram_addr + 1) & _ADDR_MASK;
read_ahead = data;
latch = false;
} else {
// vram
uint8_t val = read_ahead;
- read_ahead = vram[vram_addr];
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ read_ahead = d_debugger->read_via_debugger_data8(vram_addr);
+ } else {
+ read_ahead = this->read_via_debugger_data8(vram_addr);
+ }
+
+// read_ahead = vram[vram_addr];
vram_addr = (vram_addr + 1) & _ADDR_MASK;
latch = false;
return val;
}
}
+void TMS9918A::write_via_debugger_data8(uint32_t addr, uint32_t data)
+{
+ vram[addr & _ADDR_MASK] = data;
+}
+
+uint32_t TMS9918A::read_via_debugger_data8(uint32_t addr)
+{
+ return vram[addr & _ADDR_MASK];
+}
+
+void TMS9918A::write_via_debugger_io8(uint32_t addr, uint32_t data)
+{
+ switch(addr & 7) {
+ case 0:
+ regs[0] = data & 3;
+ if(regs[0] & 2) {
+ color_table = ((regs[3] & 0x80) * 64) & _ADDR_MASK;
+ color_mask = ((regs[3] & 0x7f) * 8) | 7;
+ pattern_table = ((regs[4] & 4) * 2048) & _ADDR_MASK;
+ pattern_mask = ((regs[4] & 3) * 256) | (color_mask & 0xff);
+ } else {
+ color_table = (regs[3] * 64) & _ADDR_MASK;
+ pattern_table = (regs[4] * 2048) & _ADDR_MASK;
+ }
+ break;
+ case 1:
+ regs[1] = data & 0xfb;
+ set_intstat((regs[1] & 0x20) && (status_reg & 0x80));
+ break;
+ case 2:
+ regs[2] = data & 0x0f;
+ name_table = (regs[2] * 1024) & _ADDR_MASK;
+ break;
+ case 3:
+ regs[3] = data;
+ if(regs[0] & 2) {
+ color_table = ((regs[3] & 0x80) * 64) & _ADDR_MASK;
+ color_mask = ((regs[3] & 0x7f) * 8) | 7;
+ } else {
+ color_table = (regs[3] * 64) & _ADDR_MASK;
+ }
+ pattern_mask = ((regs[4] & 3) * 256) | (color_mask & 0xff);
+ break;
+ case 4:
+ regs[4] = data & 7;
+ if(regs[0] & 2) {
+ pattern_table = ((regs[4] & 4) * 2048) & _ADDR_MASK;
+ pattern_mask = ((regs[4] & 3) * 256) | 255;
+ } else {
+ pattern_table = (regs[4] * 2048) & _ADDR_MASK;
+ }
+ break;
+ case 5:
+ regs[5] = data & 0x7f;
+ sprite_attrib = (regs[5] * 128) & _ADDR_MASK;
+ break;
+ case 6:
+ regs[6] = data & 7;
+ sprite_pattern = (regs[6] * 2048) & _ADDR_MASK;
+ break;
+ case 7:
+ regs[7] = data;
+ break;
+ }
+}
+
+uint32_t TMS9918A::read_via_debugger_io8(uint32_t addr)
+{
+ return regs[addr & 7];
+}
+
//#ifdef TMS9918A_SUPER_IMPOSE
void TMS9918A::write_signal(int id, uint32_t data, uint32_t mask)
{
void TMS9918A::draw_screen()
{
+ if(emu->now_waiting_in_debugger) {
+ // store regs
+ uint8_t tmp_status_reg = status_reg;
+ bool tmp_intstat = intstat;
+
+ // drive vline
+ event_vline(192, 0);
+
+ // restore regs
+ status_reg = tmp_status_reg;
+ intstat = tmp_intstat;
+ }
+
//#ifdef TMS9918A_SUPER_IMPOSE
if(_tms9918a_super_impose) {
if(now_super_impose) {
void TMS9918A::set_intstat(bool val)
{
if(val != intstat) {
- write_signals(&outputs_irq, val ? 0xffffffff : 0);
+ if(!emu->now_waiting_in_debugger) {
+ write_signals(&outputs_irq, val ? 0xffffffff : 0);
+ }
intstat = val;
}
}
}
//#ifdef USE_DEBUGGER
-void TMS9918A::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool TMS9918A::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
my_stprintf_s(buffer, buffer_len,
_T("REGS=%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X VRAM_ADDR=%04X STATUS=%02X"),
regs[0], regs[1], regs[2], regs[3], regs[4], regs[5], regs[6], regs[7],
vram_addr, status_reg);
+ return true;
}
//#endif
#define SIG_TMS9918A_SUPER_IMPOSE 0
+class DEBUGGER;
class TMS9918A : public DEVICE
{
private:
+ DEBUGGER *d_debugger;
+
// output signals
outputs_t outputs_irq;
_tms9918a_super_impose = _tms9918a_limit_sprites = false;
_VRAM_SIZE = 0x4000;
_ADDR_MASK = 0x3fff;
+ d_debugger = NULL;
set_device_name(_T("TMS9918A VDP"));
}
~TMS9918A() {}
void reset();
void write_io8(uint32_t addr, uint32_t data);
uint32_t read_io8(uint32_t addr);
+ // for debugging
+ void write_via_debugger_data8(uint32_t addr, uint32_t data);
+ uint32_t read_via_debugger_data8(uint32_t addr);
+ void write_via_debugger_io8(uint32_t addr, uint32_t data);
+ uint32_t read_via_debugger_io8(uint32_t addr);
//#ifdef TMS9918A_SUPER_IMPOSE
void write_signal(int id, uint32_t data, uint32_t mask);
//#endif
void event_vline(int v, int clock);
//#ifdef USE_DEBUGGER
- uint32_t get_debug_data_addr_mask()
+ bool is_debugger_available()
{
- return _VRAM_SIZE - 1;
+ return true;
+ }
+ void *get_debugger()
+ {
+ return d_debugger;
}
+ uint64_t get_debug_data_addr_space()
+ {
+ return _VRAM_SIZE;
+ }
void write_debug_data8(uint32_t addr, uint32_t data)
{
- vram[addr & (_VRAM_SIZE - 1)] = data;
+ if(addr < _VRAM_SIZE) {
+ write_via_debugger_data8(addr, data);
+ }
}
uint32_t read_debug_data8(uint32_t addr)
{
- return vram[addr & (_VRAM_SIZE - 1)];
+ if(addr < _VRAM_SIZE) {
+ return read_via_debugger_data8(addr);
+ }
+ return 0;
+ }
+ void write_debug_io8(uint32_t addr, uint32_t data)
+ {
+ if(addr < 8) {
+ write_via_debugger_io8(addr, data);
+ }
}
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ uint32_t read_debug_io8(uint32_t addr)
+ {
+ if(addr < 8) {
+ return read_via_debugger_io8(addr);
+ }
+ return 0;
+ }
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
//#endif
bool process_state(FILEIO* state_fio, bool loading);
{
register_output_signal(&outputs_irq, device, id, mask);
}
+#ifdef USE_DEBUGGER
+ void set_context_debugger(DEBUGGER* device)
+ {
+ d_debugger = device;
+ }
+#endif
void draw_screen();
};
if(now_debugging) {
d_debugger->check_break_points(PC);
if(d_debugger->now_suspended) {
- emu->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- emu->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
return true;
}
-void TMS9995::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool TMS9995::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
/*
ST = 0000 [LGT:0 AGT:0 EQ:0 C:0 OV:0 OP:0 X:0 OVIE:0 IM:0]
Clocks = 0 (0) Since Scanline = 0/0 (0/0)
*/
my_stprintf_s(buffer, buffer_len,
- _T("ST = %04X [LGT:%01X AGT:%01X EQ:%01X C:%01X OV:%01X OP:%01X X:%01X OVIE:%01X IM:%01X]\nPC = %04X WP = %04X\nR0 = %04X R1 = %04X R2 = %04X R3 = %04X R4 = %04X R5 = %04X R6 = %04X R7 = %04X\nR8 = %04X R9 = %04X R10= %04X R11= %04X R12= %04X R13= %04X R14= %04X R15= %04X\nClocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+ _T("ST = %04X [LGT:%01X AGT:%01X EQ:%01X C:%01X OV:%01X OP:%01X X:%01X OVIE:%01X IM:%01X]\n")
+ _T("PC = %04X WP = %04X\n")
+ _T("R0 = %04X R1 = %04X R2 = %04X R3 = %04X R4 = %04X R5 = %04X R6 = %04X R7 = %04X\n")
+ _T("R8 = %04X R9 = %04X R10= %04X R11= %04X R12= %04X R13= %04X R14= %04X R15= %04X\n")
+ _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
ST,
(ST & ST_LGT ) ? 1 : 0,
(ST & ST_AGT ) ? 1 : 0,
total_count, total_count - prev_total_count,
get_passed_clock_since_vline(), get_cur_vline_clocks(), get_cur_vline(), get_lines_per_frame());
prev_total_count = total_count;
+ return true;
}
// disassembler
return PC;
}
#ifdef USE_DEBUGGER
+ bool is_cpu()
+ {
+ return true;
+ }
+ bool is_debugger_available()
+ {
+ return true;
+ }
void *get_debugger()
{
return d_debugger;
void write_debug_io8(uint32_t addr, uint32_t data);
uint32_t read_debug_io8(uint32_t addr);
bool write_debug_reg(const _TCHAR *reg, uint32_t data);
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
#endif
bool process_state(FILEIO* state_fio, bool loading);
*/
#include "upd71071.h"
+#include "debugger.h"
void UPD71071::initialize()
{
dma[i].areg = dma[i].bareg = 0;
dma[i].creg = dma[i].bcreg = 0;
}
+ if(d_debugger != NULL) {
+ d_debugger->set_device_name(_T("Debugger (uPD71071 DMAC)"));
+ d_debugger->set_context_mem(this);
+ d_debugger->set_context_io(vm->dummy);
+ }
}
void UPD71071::reset()
}
}
+void UPD71071::write_via_debugger_data8(uint32_t addr, uint32_t data)
+{
+ d_mem->write_dma_data8(addr, data);
+}
+
+uint32_t UPD71071::read_via_debugger_data8(uint32_t addr)
+{
+ return d_mem->read_dma_data8(addr);
+}
+
+void UPD71071::write_via_debugger_data16(uint32_t addr, uint32_t data)
+{
+ d_mem->write_dma_data16(addr, data);
+}
+
+uint32_t UPD71071::read_via_debugger_data16(uint32_t addr)
+{
+ return d_mem->read_dma_data16(addr);
+}
+
// note: if SINGLE_MODE_DMA is defined, do_dma() is called in every machine cycle
uint32_t UPD71071::read_signal(int ch)
// io -> memory
uint32_t val;
val = dma[c].dev->read_dma_io16(0);
- d_mem->write_dma_data16(dma[c].areg, val);
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_data16(dma[c].areg, val);
+ } else {
+ this->write_via_debugger_data16(dma[c].areg, val);
+ }
// update temporary register
tmp = val;
} else if((dma[c].mode & 0x0c) == 0x08) {
// memory -> io
- uint32_t val = d_mem->read_dma_data16(dma[c].areg);
+ uint32_t val;
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ val = d_debugger->read_via_debugger_data16(dma[c].areg);
+ } else {
+ val = this->read_via_debugger_data16(dma[c].areg);
+ }
dma[c].dev->write_dma_io16(0, val);
// update temporary register
tmp = val;
// io -> memory
uint32_t val;
val = dma[c].dev->read_dma_io8(0);
- d_mem->write_dma_data8(dma[c].areg, val);
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_data8(dma[c].areg, val);
+ } else {
+ this->write_via_debugger_data8(dma[c].areg, val);
+ }
// update temporary register
tmp = (tmp >> 8) | (val << 8);
} else if((dma[c].mode & 0x0c) == 0x08) {
// memory -> io
- uint32_t val = d_mem->read_dma_data8(dma[c].areg);
+ uint32_t val;
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ val = d_debugger->read_via_debugger_data8(dma[c].areg);
+ } else {
+ val = this->read_via_debugger_data8(dma[c].areg);
+ }
dma[c].dev->write_dma_io8(0, val);
// update temporary register
tmp = (tmp >> 8) | (val << 8);
//#endif
}
+bool UPD71071::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+{
+/*
+CH0 AREG=FFFF CREG=FFFF BAREG=FFFF BCREG=FFFF REQ=1 MASK=1 MODE=FF MEM->I/O
+CH1 AREG=FFFF CREG=FFFF BAREG=FFFF BCREG=FFFF REQ=1 MASK=1 MODE=FF I/O->MEM
+CH2 AREG=FFFF CREG=FFFF BAREG=FFFF BCREG=FFFF REQ=1 MASK=1 MODE=FF VERIFY
+CH3 AREG=FFFF CREG=FFFF BAREG=FFFF BCREG=FFFF REQ=1 MASK=1 MODE=FF INVALID
+*/
+ static const _TCHAR *dir[4] = {
+ _T("VERIFY"), _T("I/O->MEM"), _T("MEM->I/O"), _T("INVALID")
+ };
+ my_stprintf_s(buffer, buffer_len,
+ _T("CH0 AREG=%04X CREG=%04X BAREG=%04X BCREG=%04X REQ=%d MASK=%d MODE=%02X %s\n")
+ _T("CH1 AREG=%04X CREG=%04X BAREG=%04X BCREG=%04X REQ=%d MASK=%d MODE=%02X %s\n")
+ _T("CH2 AREG=%04X CREG=%04X BAREG=%04X BCREG=%04X REQ=%d MASK=%d MODE=%02X %s\n")
+ _T("CH3 AREG=%04X CREG=%04X BAREG=%04X BCREG=%04X REQ=%d MASK=%d MODE=%02X %s"),
+ dma[0].areg, dma[0].creg, dma[0].bareg, dma[0].bcreg, ((req | sreq) >> 0) & 1, (mask >> 0) & 1, dma[0].mode, dir[(dma[0].mode >> 2) & 3],
+ dma[1].areg, dma[1].creg, dma[1].bareg, dma[1].bcreg, ((req | sreq) >> 1) & 1, (mask >> 1) & 1, dma[1].mode, dir[(dma[1].mode >> 2) & 3],
+ dma[2].areg, dma[2].creg, dma[2].bareg, dma[2].bcreg, ((req | sreq) >> 2) & 1, (mask >> 2) & 1, dma[2].mode, dir[(dma[2].mode >> 2) & 3],
+ dma[3].areg, dma[3].creg, dma[3].bareg, dma[3].bcreg, ((req | sreq) >> 3) & 1, (mask >> 3) & 1, dma[3].mode, dir[(dma[3].mode >> 2) & 3]);
+ return true;
+}
+
#define STATE_VERSION 1
bool UPD71071::process_state(FILEIO* state_fio, bool loading)
#define SIG_UPD71071_CH3 3
#define SIG_UPD71071_IS_TRANSFERING 4 /* 4 - 7 */
#define SIG_UPD71071_IS_16BITS_TRANSFER 8 /* 8 - 11 */
+
+class DEBUGGER;
class UPD71071 : public DEVICE
{
private:
//#ifdef SINGLE_MODE_DMA
DEVICE* d_dma;
//#endif
+ DEBUGGER *d_debugger;
outputs_t outputs_tc;
struct {
void write_signal(int id, uint32_t data, uint32_t mask);
uint32_t read_signal(int id);
void do_dma();
+ // for debug
+ void write_via_debugger_data8(uint32_t addr, uint32_t data);
+ uint32_t read_via_debugger_data8(uint32_t addr);
+ void write_via_debugger_data16(uint32_t addr, uint32_t data);
+ uint32_t read_via_debugger_data16(uint32_t addr);
+ bool is_debugger_available()
+ {
+ return true;
+ }
+ void *get_debugger()
+ {
+ return d_debugger;
+ }
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
bool process_state(FILEIO* state_fio, bool loading);
// unique functions
void set_context_memory(DEVICE* device)
if(force_ready && !disk[drv]->inserted) {
return drv;
}
- return drv | ((fdc[drv].track & 1) ? ST3_HD : 0) | (disk[drv]->inserted && disk[drv]->two_side ? ST3_TS : 0) | (fdc[drv].track ? 0 : ST3_T0) | (force_ready || disk[drv]->inserted ? ST3_RY : 0) | (disk[drv]->write_protected ? ST3_WP : 0);
+// return drv | ((fdc[drv].track & 1) ? ST3_HD : 0) | (disk[drv]->inserted && disk[drv]->two_side ? ST3_TS : 0) | (fdc[drv].track ? 0 : ST3_T0) | (force_ready || disk[drv]->inserted ? ST3_RY : 0) | (disk[drv]->write_protected ? ST3_WP : 0);
+ return drv | ((fdc[drv].track & 1) ? ST3_HD : 0) | ST3_TS | (fdc[drv].track ? 0 : ST3_T0) | (force_ready || disk[drv]->inserted ? ST3_RY : 0) | (disk[drv]->write_protected ? ST3_WP : 0);
}
void UPD765A::cmd_seek()
#endif
continue;
}
-#ifdef _FDC_DEBUG_LOG
- this->out_debug_log(_T("FDC: SECTOR FOUND (TRK=%d SIDE=%d ID=%2x,%2x,%2x,%2x)\n"), trk, side, id[0], id[1], id[2], id[3]);
-#endif
+//#ifdef _FDC_DEBUG_LOG
+ if(_fdc_debug_log) this->out_debug_log(_T("FDC: SECTOR FOUND (TRK=%d SIDE=%d ID=%2x,%2x,%2x,%2x)\n"), trk, side, id[0], id[1], id[2], id[3]);
+//#endif
if(disk[drv]->sector_size.sd == 0) {
continue;
}
}
//#ifdef USE_DEBUGGER
-void UPD765A::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool UPD765A::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
int drv = hdu & DRIVE_MASK;
int side = (hdu >> 2) & 1;
+ int position = get_cur_position(drv);
my_stprintf_s(buffer, buffer_len,
- _T("CMD=%02X (%s) HDU=%02X C=%02X H=%02X R=%02X N=%02X EOT=%02X GPL=%02X DTL=%02X\nUNIT: DRIVE=%d TRACK=%2d(%2d) SIDE=%d SECTORS=%2d C=%02X H=%02X R=%02X N=%02X LENGTH=%d"),
+ _T("CMD=%02X (%s) HDU=%02X C=%02X H=%02X R=%02X N=%02X EOT=%02X GPL=%02X DTL=%02X\n")
+ _T("UNIT: DRIVE=%d TRACK=%2d(%2d) SIDE=%d POSITION=%5d/%d"),
command, get_command_name(command), hdu,id[0], id[1], id[2], id[3], eot, gpl, dtl,
- drv, fdc[drv].track, fdc[drv].cur_track, side, disk[drv]->sector_num.sd,
- disk[drv]->id[0], disk[drv]->id[1], disk[drv]->id[2], disk[drv]->id[3],
- disk[drv]->sector_size.sd);
+ drv, fdc[drv].track, fdc[drv].cur_track, side,
+ position, disk[drv]->get_track_size());
+
+ for(int i = 0; i < disk[drv]->sector_num.sd; i++) {
+ uint8_t c, h, r, n;
+ int length;
+ if(disk[drv]->get_sector_info(-1, -1, i, &c, &h, &r, &n, &length)) {
+ my_tcscat_s(buffer, buffer_len,
+ create_string(_T("\nSECTOR %2d: C=%02X H=%02X R=%02X N=%02X SIZE=%4d AM1=%5d DATA=%5d"), i + 1, c, h, r, n, length, disk[drv]->am1_position[i], disk[drv]->data_position[i]));
+ if(position >= disk[drv]->am1_position[i] && position < disk[drv]->data_position[i] + length) {
+ my_tcscat_s(buffer, buffer_len, _T(" <==="));
+ }
+ }
+ }
+ return true;
}
//#endif
void event_callback(int event_id, int err);
void update_config();
//#ifdef USE_DEBUGGER
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool is_debugger_available()
+ {
+ return true;
+ }
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
//#endif
bool process_state(FILEIO* state_fio, bool loading);
if(now_debugging) {
d_debugger->check_break_points(PC);
if(d_debugger->now_suspended) {
- emu->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- emu->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
return true;
}
-void UPD7801::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool UPD7801::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
/*
VA = 0000 BC = 0000 DE = 0000 HL = 0000 PSW= 00 [Z SK HC L1 L0 CY]
*/
int wait;
my_stprintf_s(buffer, buffer_len,
- _T("VA = %04X BC = %04X DE = %04X HL = %04X PSW= %02x [%s %s %s %s %s %s]\nVA'= %04X BC'= %04X DE'= %04X HL'= %04X SP = %04X PC = %04X\n (BC)= %04X (DE)=%04X (HL)= %04X (SP)= %04X <%s>\nClocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+ _T("VA = %04X BC = %04X DE = %04X HL = %04X PSW= %02x [%s %s %s %s %s %s]\n")
+ _T("VA'= %04X BC'= %04X DE'= %04X HL'= %04X SP = %04X PC = %04X\n")
+ _T(" (BC)= %04X (DE)=%04X (HL)= %04X (SP)= %04X <%s>\n")
+ _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
VA, BC, DE, HL, PSW,
(PSW & F_Z) ? _T("Z") : _T("-"), (PSW & F_SK) ? _T("SK") : _T("--"), (PSW & F_HC) ? _T("HC") : _T("--"), (PSW & F_L1) ? _T("L1") : _T("--"), (PSW & F_L0) ? _T("L0") : _T("--"), (PSW & F_CY) ? _T("CY") : _T("--"),
altVA, altBC, altDE, altHL, SP, PC,
total_count, total_count - prev_total_count,
get_passed_clock_since_vline(), get_cur_vline_clocks(), get_cur_vline(), get_lines_per_frame());
prev_total_count = total_count;
+ return true;
}
// disassembler
return PC;
}
//#ifdef USE_DEBUGGER
+ bool is_cpu()
+ {
+ return true;
+ }
+ bool is_debugger_available()
+ {
+ return true;
+ }
void *get_debugger()
{
return d_debugger;
void write_debug_io8(uint32_t addr, uint32_t data);
uint32_t read_debug_io8(uint32_t addr);
bool write_debug_reg(const _TCHAR *reg, uint32_t data);
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
//#endif
bool process_state(FILEIO* state_fio, bool loading);
return true;
}
-void UPD7810::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool UPD7810::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
/*
VA = 0000 BC = 0000 DE = 0000 HL = 0000 PSW= 00 [Z SK HC L1 L0 CY]
upd7810_state *cpustate = (upd7810_state *)opaque;
int wait;
my_stprintf_s(buffer, buffer_len,
- _T("VA = %04X BC = %04X DE = %04X HL = %04X PSW= %02x [%s %s %s %s %s %s]\nVA'= %04X BC'= %04X DE'= %04X HL'= %04X SP = %04X PC = %04X\n (BC)= %04X (DE)=%04X (HL)= %04X (SP)= %04X <%s>\nClocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+ _T("VA = %04X BC = %04X DE = %04X HL = %04X PSW= %02x [%s %s %s %s %s %s]\n")
+ _T("VA'= %04X BC'= %04X DE'= %04X HL'= %04X SP = %04X PC = %04X\n")
+ _T(" (BC)= %04X (DE)=%04X (HL)= %04X (SP)= %04X <%s>\n")
+ _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
VA, BC, DE, HL, PSW,
(PSW & Z) ? _T("Z") : _T("-"), (PSW & SK) ? _T("SK") : _T("--"), (PSW & HC) ? _T("HC") : _T("--"), (PSW & L1) ? _T("L1") : _T("--"), (PSW & L0) ? _T("L0") : _T("--"), (PSW & CY) ? _T("CY") : _T("--"),
VA2, BC2, DE2, HL2, SP, PC,
total_icount, total_icount - prev_total_icount,
get_passed_clock_since_vline(), get_cur_vline_clocks(), get_cur_vline(), get_lines_per_frame());
prev_total_icount = total_icount;
+ return true;
}
// disassembler
uint32_t get_pc();
uint32_t get_next_pc();
#ifdef USE_DEBUGGER
+ bool is_cpu()
+ {
+ return true;
+ }
+ bool is_debugger_available()
+ {
+ return true;
+ }
void *get_debugger()
{
return d_debugger;
void write_debug_io8(uint32_t addr, uint32_t data);
uint32_t read_debug_io8(uint32_t addr);
bool write_debug_reg(const _TCHAR *reg, uint32_t data);
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
#endif
bool process_state(FILEIO* state_fio, bool loading);
** called; because of this Mr. Ghost, Xevious and SD Snatcher don't
** run. As a patch it's called every scanline
*/
-// m_int_callback(n);
- write_signals(&outputs_irq, n ? 0xffffffff : 0);
+ if(!emu->now_waiting_in_debugger) {
+// m_int_callback(n);
+ write_signals(&outputs_irq, n ? 0xffffffff : 0);
+ }
}
/***************************************************************************
/* for common source code project */
void v99x8_device::draw_screen()
{
+ if(emu->now_waiting_in_debugger) {
+ // store regs
+// int tmp_offset_x = m_offset_x;
+ int tmp_offset_y = m_offset_y;
+ int tmp_visible_y = m_visible_y;
+ UINT8 tmp_stat_reg[10];
+ memcpy(tmp_stat_reg, m_stat_reg, sizeof(m_stat_reg));
+ UINT8 tmp_int_state = m_int_state;
+ int tmp_scanline = m_scanline;
+ int tmp_blink = m_blink;
+ int tmp_blink_count = m_blink_count;
+ UINT16 tmp_pal_ind16[16];
+ UINT16 tmp_pal_ind256[256];
+ memcpy(tmp_pal_ind16, m_pal_ind16, sizeof(m_pal_ind16));
+ memcpy(tmp_pal_ind256, m_pal_ind256, sizeof(m_pal_ind256));
+// mmc_t tmp_mmc = m_mmc;
+ int tmp_vdp_ops_count = m_vdp_ops_count;
+ int tmp_scanline_start = m_scanline_start;
+ int tmp_scanline_max = m_scanline_max;
+
+ // drive vlines
+ for(int v = /*get_cur_vline() + 1*/0; v < get_lines_per_frame(); v++) {
+ event_vline(v, 0);
+ }
+
+ // restore regs
+// m_offset_x = tmp_offset_x;
+ m_offset_y = tmp_offset_y;
+ m_visible_y = tmp_visible_y;
+ memcpy(m_stat_reg, tmp_stat_reg, sizeof(m_stat_reg));
+ m_int_state = tmp_int_state;
+ m_scanline = tmp_scanline;
+ m_blink = tmp_blink;
+ m_blink_count = tmp_blink_count;
+ memcpy(m_pal_ind16, tmp_pal_ind16, sizeof(m_pal_ind16));
+ memcpy(m_pal_ind256, tmp_pal_ind256, sizeof(m_pal_ind256));
+// m_mmc = tmp_mmc;
+ m_vdp_ops_count = tmp_vdp_ops_count;
+ m_scanline_start = tmp_scanline_start;
+ m_scanline_max = tmp_scanline_max;
+ }
+
scrntype_t *dst;
int y;
if(osd == NULL) return;
// render bitmap
//bitmap_ind16 m_bitmap;
// Command unit
- struct {
+ typedef struct mmc_s {
int SX,SY;
int DX,DY;
int TX,TY;
UINT8 LO;
UINT8 CM;
UINT8 MXS, MXD;
- } m_mmc;
+ } mmc_t;
+ mmc_t m_mmc;
int m_vdp_ops_count;
void (v99x8_device::*m_vdp_engine)();
void V99X8::draw_screen()
{
+ if(emu->now_waiting_in_debugger) {
+ // store regs
+ v99x8_t tmp_v99x8 = v99x8;
+ bool tmp_intstat = intstat;
+
+ // drive vlines
+ for(int v = /*get_cur_vline() + 1*/0; v < get_lines_per_frame(); v++) {
+ event_vline(v, 0);
+ }
+
+ // restore regs
+ v99x8 = tmp_v99x8;
+ intstat = tmp_intstat;
+ }
md_video_update(0, NULL);
}
void V99X8::set_intstat(bool val)
{
if(val != intstat) {
- write_signals(&outputs_irq, val ? 0xffffffff : 0);
+ if(!emu->now_waiting_in_debugger) {
+ write_signals(&outputs_irq, val ? 0xffffffff : 0);
+ }
intstat = val;
}
}
*/
#include "ym2151.h"
+#ifdef USE_DEBUGGER
+#include "debugger.h"
+#endif
#define EVENT_FM_TIMER 0
register_vline_event(this);
mute = false;
clock_prev = clock_accum = clock_busy = 0;
+
+#ifdef USE_DEBUGGER
+ if(d_debugger != NULL) {
+ d_debugger->set_device_name(_T("Debugger (YM2151 OPM)"));
+ d_debugger->set_context_mem(this);
+ d_debugger->set_context_io(vm->dummy);
+ }
+#endif
}
void YM2151::release()
if(dllchip) {
fmdll->Reset(dllchip);
}
- memset(port_log, 0, sizeof(port_log));
#endif
+ memset(port_log, 0, sizeof(port_log));
timer_event_id = -1;
irq_prev = busy = false;
}
void YM2151::write_io8(uint32_t addr, uint32_t data)
{
if(addr & 1) {
- update_count();
- this->set_reg(ch, data);
- if(ch == 0x14) {
- update_event();
- }
- update_interrupt();
- clock_busy = get_current_clock();
- busy = true;
+#ifdef USE_DEBUGGER
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_data8(ch, data);
+ } else
+#endif
+ this->write_via_debugger_data8(ch, data);
} else {
ch = data;
}
return 0xff;
}
+void YM2151::write_via_debugger_data8(uint32_t addr, uint32_t data)
+{
+ if(addr < 0x100) {
+ update_count();
+ this->set_reg(addr, data);
+ if(addr == 0x14) {
+ update_event();
+ }
+ update_interrupt();
+ clock_busy = get_current_clock();
+ busy = true;
+ }
+}
+
+uint32_t YM2151::read_via_debugger_data8(uint32_t addr)
+{
+ if(addr < 0x100) {
+ return port_log[addr].data;
+ }
+ return 0;
+}
+
void YM2151::write_signal(int id, uint32_t data, uint32_t mask)
{
if(id == SIG_YM2151_MUTE) {
if(dllchip) {
fmdll->SetReg(dllchip, addr, data);
}
+#endif
port_log[addr].written = true;
port_log[addr].data = data;
-#endif
}
void YM2151::update_timing(int new_clocks, double new_frames_per_sec, int new_lines_per_frame)
clock_const = (uint32_t)((double)chip_clock * 1024.0 * 1024.0 / (double)new_clocks + 0.5);
}
-#define STATE_VERSION 3
+#define STATE_VERSION 4
bool YM2151::process_state(FILEIO* state_fio, bool loading)
{
if(!opm->ProcessState((void *)state_fio, loading)) {
return false;
}
-#ifdef SUPPORT_MAME_FM_DLL
for(int i = 0; i < array_length(port_log); i++) {
state_fio->StateValue(port_log[i].written);
state_fio->StateValue(port_log[i].data);
}
-#endif
state_fio->StateValue(chip_clock);
state_fio->StateValue(ch);
state_fio->StateValue(irq_prev);
class VM;
class EMU;
+class DEBUGGER;
class YM2151 : public DEVICE
{
private:
// output signals
outputs_t outputs_irq;
+ DEBUGGER *d_debugger;
FM::OPM* opm;
#ifdef SUPPORT_MAME_FM_DLL
// CFMDLL* fmdll;
LPVOID* dllchip;
+#endif
struct {
bool written;
uint8_t data;
} port_log[0x100];
-#endif
int base_decibel;
int chip_clock;
{
initialize_output_signals(&outputs_irq);
base_decibel = 0;
+#ifdef USE_DEBUGGER
+ d_debugger = NULL;
+#endif
set_device_name(_T("YM2151 OPM"));
}
~YM2151() {}
void mix(int32_t* buffer, int cnt);
void set_volume(int ch, int decibel_l, int decibel_r);
void update_timing(int new_clocks, double new_frames_per_sec, int new_lines_per_frame);
+ // for debugging
+ void write_via_debugger_data8(uint32_t addr, uint32_t data);
+ uint32_t read_via_debugger_data8(uint32_t addr);
+#ifdef USE_DEBUGGER
+ bool is_debugger_available()
+ {
+ return true;
+ }
+ void *get_debugger()
+ {
+ return d_debugger;
+ }
+ uint64_t get_debug_data_addr_space()
+ {
+ return 0x100;
+ }
+ void write_debug_data8(uint32_t addr, uint32_t data)
+ {
+ if(addr < 0x100) {
+ write_via_debugger_data8(addr, data);
+ }
+ }
+ uint32_t read_debug_data8(uint32_t addr)
+ {
+ if(addr < 0x100) {
+ return read_via_debugger_data8(addr);
+ }
+ return 0;
+ }
+#endif
bool process_state(FILEIO* state_fio, bool loading);
// unique functions
void set_context_irq(DEVICE* device, int id, uint32_t mask)
{
register_output_signal(&outputs_irq, device, id, mask);
}
+#ifdef USE_DEBUGGER
+ void set_context_debugger(DEBUGGER* device)
+ {
+ d_debugger = device;
+ }
+#endif
void initialize_sound(int rate, int clock, int samples, int decibel);
void set_reg(uint32_t addr, uint32_t data); // for patch
};
*/
#include "ym2203.h"
+#include "debugger.h"
#include <math.h>
#define EVENT_FM_TIMER 0
dllchip = NULL;
#endif
register_vline_event(this);
+ left_volume = right_volume = 256;
+ v_left_volume = v_right_volume = 256;
mute = false;
clock_prev = clock_accum = clock_busy = 0;
- left_volume = right_volume = 256;
- v_left_volume = v_right_volume = 256;
+ if(d_debugger != NULL) {
+ if(is_ym2608) {
+ d_debugger->set_device_name(_T("Debugger (YM2608 OPNA)"));
+ } else {
+ d_debugger->set_device_name(_T("Debugger (YM2203 OPN)"));
+ }
+ d_debugger->set_context_mem(this);
+ d_debugger->set_context_io(vm->dummy);
+ }
}
void YM2203::release()
if(dllchip) {
fmdll->Reset(dllchip);
}
- memset(port_log, 0, sizeof(port_log));
#endif
+ memset(port_log, 0, sizeof(port_log));
fnum2 = 0;
fnum21 = 0;
}
break;
case 1:
- if(ch == 7) {
-// if(_IS_YM2203_PORT_MODE) {
-// mode = (data & 0x3f) | _YM2203_PORT_MODE;
-// } else {
- mode = data;
-// }
- } else if(ch == 14) {
-//#ifdef SUPPORT_YM2203_PORT_A
- if(_SUPPORT_YM2203_PORT_A) {
- if(port[0].wreg != data || port[0].first) {
- write_signals(&port[0].outputs, data);
- port[0].wreg = data;
- port[0].first = false;
- }
- }
-//#endif
- } else if(ch == 15) {
-//#ifdef SUPPORT_YM2203_PORT_B
- if(_SUPPORT_YM2203_PORT_B) {
- if(port[1].wreg != data || port[1].first) {
- write_signals(&port[1].outputs, data);
- port[1].wreg = data;
- port[1].first = false;
- }
- }
-//#endif
- }
- if(0x2d <= ch && ch <= 0x2f) {
- // don't write again for prescaler
- } else if(0xa4 <= ch && ch <= 0xa6) {
- // XM8 version 1.20
- fnum2 = data;
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_data8(ch, data);
} else {
- update_count();
- // XM8 version 1.20
- if(0xa0 <= ch && ch <= 0xa2) {
- this->set_reg(ch + 4, fnum2);
- }
- this->set_reg(ch, data);
- if(ch == 0x27) {
- update_event();
- }
-//#ifdef HAS_YM_SERIES
- if(_HAS_YM_SERIES) {
- update_interrupt();
- clock_busy = get_current_clock();
- busy = true;
- }
-//#endif
+ this->write_via_debugger_data8(ch, data);
}
break;
case 2:
ch1 = data1 = data;
break;
case 3:
- if(0xa4 <= ch1 && ch1 <= 0xa6) {
- // XM8 version 1.20
- fnum21 = data;
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_data8(0x100 | ch1, data);
} else {
- update_count();
- // XM8 version 1.20
- if(0xa0 <= ch1 && ch1 <= 0xa2) {
- this->set_reg(0x100 | (ch1 + 4), fnum21);
- }
- this->set_reg(0x100 | ch1, data);
- data1 = data;
- update_interrupt();
- clock_busy = get_current_clock();
- busy = true;
+ this->write_via_debugger_data8(0x100 | ch1, data);
}
break;
default:
//#endif
break;
case 1:
- if(ch == 14) {
- if(_SUPPORT_YM2203_PORT_A) {
- return (mode & 0x40) ? port[0].wreg : port[0].rreg;
- }
- } else if(ch == 15) {
- if(_SUPPORT_YM2203_PORT_B) {
- return (mode & 0x80) ? port[1].wreg : port[1].rreg;
- }
- }
- if(is_ym2608) {
- return opna->GetReg(ch);
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ return d_debugger->read_via_debugger_data8(ch);
} else {
- return opn->GetReg(ch);
+ return this->read_via_debugger_data8(ch);
}
break;
case 2:
return 0xff;
}
+void YM2203::write_via_debugger_data8(uint32_t addr, uint32_t data)
+{
+ if(addr < 0x100) {
+ // YM2203
+ if(addr == 7) {
+//#ifdef YM2203_PORT_MODE
+// mode = (data & 0x3f) | YM2203_PORT_MODE;
+//#else
+ mode = data;
+//#endif
+ } else if(addr == 14) {
+ if(_SUPPORT_YM2203_PORT_A) {
+ if(port[0].wreg != data || port[0].first) {
+ write_signals(&port[0].outputs, data);
+ port[0].wreg = data;
+ port[0].first = false;
+ }
+ }
+ } else if(addr == 15) {
+ if(_SUPPORT_YM2203_PORT_B) {
+ if(port[1].wreg != data || port[1].first) {
+ write_signals(&port[1].outputs, data);
+ port[1].wreg = data;
+ port[1].first = false;
+ }
+ }
+ }
+ if(0x2d <= addr && addr <= 0x2f) {
+ // don't write again for prescaler
+ } else if(0xa4 <= addr && addr <= 0xa6) {
+ // XM8 version 1.20
+ fnum2 = data;
+ } else {
+ update_count();
+ // XM8 version 1.20
+ if(0xa0 <= addr && addr <= 0xa2) {
+ this->set_reg(addr + 4, fnum2);
+ }
+ this->set_reg(addr, data);
+ if(addr == 0x27) {
+ update_event();
+ }
+ if(_HAS_YM_SERIES) {
+ update_interrupt();
+ clock_busy = get_current_clock();
+ busy = true;
+ }
+ }
+ } else if(addr < 0x200) {
+ // YM2608
+ if(0x1a4 <= addr && addr <= 0x1a6) {
+ // XM8 version 1.20
+ fnum21 = data;
+ } else {
+ update_count();
+ // XM8 version 1.20
+ if(0x1a0 <= addr && addr <= 0x1a2) {
+ this->set_reg(addr + 4, fnum21);
+ }
+ this->set_reg(addr, data);
+ data1 = data;
+ update_interrupt();
+ clock_busy = get_current_clock();
+ busy = true;
+ }
+ }
+}
+
+uint32_t YM2203::read_via_debugger_data8(uint32_t addr)
+{
+ if(addr < 0x100) {
+ // YM2203
+ if(addr == 14) {
+ if(_SUPPORT_YM2203_PORT_A) {
+ return (mode & 0x40) ? port[0].wreg : port[0].rreg;
+ }
+ } else if(addr == 15) {
+ if(_SUPPORT_YM2203_PORT_B) {
+ return (mode & 0x80) ? port[1].wreg : port[1].rreg;
+ }
+ }
+ if(is_ym2608) {
+ return opna->GetReg(addr);
+ } else {
+ return opn->GetReg(addr);
+ }
+ } else if(addr < 0x200) {
+ // YM2608
+ return port_log[addr].data;
+ }
+ return 0;
+}
+
void YM2203::write_signal(int id, uint32_t data, uint32_t mask)
{
if(id == SIG_YM2203_MUTE) {
if(0x2d <= addr && addr <= 0x2f) {
port_log[0x2d].written = port_log[0x2e].written = port_log[0x2f].written = false;
}
+#endif
port_log[addr].written = true;
port_log[addr].data = data;
-#endif
}
void YM2203::update_timing(int new_clocks, double new_frames_per_sec, int new_lines_per_frame)
}
}
-#define STATE_VERSION 5
+#define STATE_VERSION 7
bool YM2203::process_state(FILEIO* state_fio, bool loading)
{
return false;
}
}
-#ifdef SUPPORT_MAME_FM_DLL
for(int i = 0; i < array_length(port_log); i++) {
state_fio->StateValue(port_log[i].written);
state_fio->StateValue(port_log[i].data);
}
-#endif
state_fio->StateValue(ch);
state_fio->StateValue(fnum2);
state_fio->StateValue(ch1);
//#endif
#define SIG_YM2203_MUTE 2
+class DEBUGGER;
+
class YM2203 : public DEVICE
{
private:
+ DEBUGGER *d_debugger;
FM::OPNA* opna;
FM::OPN* opn;
#ifdef SUPPORT_MAME_FM_DLL
// CFMDLL* fmdll;
LPVOID* dllchip;
+#endif
struct {
bool written;
uint8_t data;
} port_log[0x200];
-#endif
int base_decibel_fm, base_decibel_psg;
int decibel_vol;
initialize_output_signals(&port[i].outputs);
port[i].wreg = port[i].rreg = 0;//0xff;
}
+ d_debugger = NULL;
initialize_output_signals(&outputs_irq);
+ this_device_name[0] = _T('\0');
}
~YM2203() {}
void mix(int32* buffer, int cnt);
void set_volume(int _ch, int decibel_l, int decibel_r);
void update_timing(int new_clocks, double new_frames_per_sec, int new_lines_per_frame);
+ // for debugging
+ void write_via_debugger_data8(uint32_t addr, uint32_t data);
+ uint32_t read_via_debugger_data8(uint32_t addr);
+ bool is_debugger_available()
+ {
+ return true;
+ }
+ void *get_debugger()
+ {
+ return d_debugger;
+ }
+ uint64_t get_debug_data_addr_space()
+ {
+ return is_ym2608 ? 0x200 : 0x100;
+ }
+ void write_debug_data8(uint32_t addr, uint32_t data)
+ {
+ if(addr < (uint32_t)(is_ym2608 ? 0x200 : 0x100)) {
+ write_via_debugger_data8(addr, data);
+ }
+ }
+ uint32_t read_debug_data8(uint32_t addr)
+ {
+ if(addr < (uint32_t)(is_ym2608 ? 0x200 : 0x100)) {
+ return read_via_debugger_data8(addr);
+ }
+ return 0;
+ }
+
bool process_state(FILEIO* state_fio, bool loading);
// unique functions
void set_context_irq(DEVICE* device, int id, uint32_t mask)
{
register_output_signal(&port[1].outputs, device, id, mask, shift);
}
+ void set_context_debugger(DEBUGGER* device)
+ {
+ d_debugger = device;
+ }
void initialize_sound(int rate, int clock, int samples, int decibel_fm, int decibel_psg);
void set_reg(uint32_t addr, uint32_t data); // for patch
bool is_ym2608;
after_ei = after_ldair = false;
intr_req_bit = intr_pend_bit = 0;
- icount = extra_icount = 0;
+ icount = extra_icount = busreq_icount = 0;
}
void Z80::debugger_hook(void)
extra_tmp_count += extra_icount;
}
if(clock == -1) {
+ // this is primary cpu
if(busreq) {
// run dma once
#ifdef SINGLE_MODE_DMA
return passed_icount;
} else {
// run only one opcode
- //#ifdef USE_DEBUGGER
+ if((extra_icount += busreq_icount) > 0) {
+ if(is_primary) {
+ update_extra_event(extra_icount);
+ }
total_icount += extra_icount;
- //#endif
+ }
icount = -extra_icount;
- extra_icount = 0;
+ extra_icount = busreq_icount = 0;
run_one_opecode();
insns_count++;
return -icount;
if(now_debugging) {
d_debugger->check_break_points(PC);
if(d_debugger->now_suspended) {
- emu->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- emu->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
if(now_debugging) {
d_debugger->check_break_points(PC);
if(d_debugger->now_suspended) {
- emu->mute_sound();
d_debugger->now_waiting = true;
+ emu->start_waiting_in_debugger();
while(d_debugger->now_debugging && d_debugger->now_suspended) {
- emu->sleep(10);
+ emu->process_waiting_in_debugger();
}
+ emu->finish_waiting_in_debugger();
d_debugger->now_waiting = false;
}
if(d_debugger->now_debugging) {
bool flags_initialized;
+ bool is_primary;
+
/* ---------------------------------------------------------------------------
registers
--------------------------------------------------------------------------- */
uint64_t prev_total_icount;
int icount;
int extra_icount;
+ int busreq_icount;
uint16_t prevpc;
pair32_t pc, sp, af, bc, de, hl, ix, iy, wz;
pair32_t af2, bc2, de2, hl2;
has_single_mode_dma = false;
total_icount = prev_total_icount = 0;
initialize_output_signals(&outputs_busack);
+ is_primary = false;
set_device_name(_T("Z80 CPU"));
}
return pc.w.l;
}
//#ifdef USE_DEBUGGER
+ bool is_cpu()
+ {
+ return true;
+ }
+ bool is_debugger_available()
+ {
+ return true;
+ }
void *get_debugger()
{
return d_debugger;
return 0xffff;
}
bool write_debug_reg(const _TCHAR *reg, uint32_t data);
- void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
virtual int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len);
//#endif
// unique functions
{
d_io = device;
}
+ DEVICE *get_context_child()
+ {
+ return d_pic;
+ }
void set_context_intr(DEVICE* device)
{
d_pic = device;
//#include "debugger.h"
//#endif
-#ifndef CPU_START_ADDR
-#define CPU_START_ADDR 0
-#endif
+//#ifndef CPU_START_ADDR
+//#define CPU_START_ADDR 0
+//#endif
#define NMI_REQ_BIT 0x80000000
} \
} while(0)
+#define UPDATE_EXTRA_EVENT(clock) do { \
+ if(is_primary) { \
+ if(busreq) { \
+ busreq_icount += (clock); \
+ } \
+ update_extra_event(clock); \
+ } \
+} while(0)
+
Z80_INLINE uint8_t Z80_BASE::RM8(uint32_t addr)
{
//#ifdef Z80_MEMORY_WAIT
int wait;
uint8_t val = d_mem->read_data8w(addr, &wait);
icount -= wait;
+ UPDATE_EXTRA_EVENT(3 + wait);
return val;
} else {
//#else
- return d_mem->read_data8(addr);
+ uint8_t val = d_mem->read_data8(addr);
+ UPDATE_EXTRA_EVENT(3);
+ return val;
}
//#endif
}
int wait;
d_mem->write_data8w(addr, val, &wait);
icount -= wait;
+ UPDATE_EXTRA_EVENT(3 + wait);
} else {
//#else
d_mem->write_data8(addr, val);
+ UPDATE_EXTRA_EVENT(3);
}
//#endif
}
int wait;
uint8_t val = d_mem->fetch_op(pctmp, &wait);
icount -= wait;
+ UPDATE_EXTRA_EVENT(4 + wait);
return val;
}
Z80_INLINE uint8_t Z80_BASE::IN8(uint32_t addr)
{
//#ifdef Z80_IO_WAIT
+ UPDATE_EXTRA_EVENT(1);
if(has_io_wait) {
int wait;
uint8_t val = d_io->read_io8w(addr, &wait);
icount -= wait;
+ UPDATE_EXTRA_EVENT(3 + wait);
return val;
} else {
//#else
- return d_io->read_io8(addr);
+ uint8_t val = d_io->read_io8(addr);
+ UPDATE_EXTRA_EVENT(3);
+ return val;
}
//#endif
}
Z80_INLINE void Z80_BASE::OUT8(uint32_t addr, uint8_t val)
{
//#ifdef HAS_NSC800
+ UPDATE_EXTRA_EVENT(1);
if(has_nsc800) {
if((addr & 0xff) == 0xbb) {
icr = val;
+ UPDATE_EXTRA_EVENT(3);
return;
}
}
int wait;
d_io->write_io8w(addr, val, &wait);
icount -= wait;
+ UPDATE_EXTRA_EVENT(3 + wait);
} else {
//#else
d_io->write_io8(addr, val);
+ UPDATE_EXTRA_EVENT(3);
}
//#endif
}
}
flags_initialized = true;
}
+ is_primary = is_primary_cpu(this);
// Collecting stateus.
cycles_tmp_count = 0;
return passed_icount;
} else {
// run only one opcode
+ if((extra_icount += busreq_icount) > 0) {
+ if(is_primary) {
+ update_extra_event(extra_icount);
+ }
+ total_icount += extra_icount;
+ }
icount = -extra_icount;
- extra_icount = 0;
+ extra_icount = busreq_icount = 0;
run_one_opecode();
insns_count++;
return -icount;
if(busreq) {
// run dma once
// run dma once
- #ifdef USE_DEBUGGER
+ //#ifdef USE_DEBUGGER
debugger_hook();
- #endif
+ //#endif
//#ifdef SINGLE_MODE_DMA
if(d_dma) {
d_dma->do_dma();
return true;
}
-void Z80_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+bool Z80_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
{
/*
F = [--------] A = 00 BC = 0000 DE = 0000 HL = 0000 IX = 0000 IY = 0000
*/
int wait;
my_stprintf_s(buffer, buffer_len,
- _T("F = [%c%c%c%c%c%c%c%c] A = %02X BC = %04X DE = %04X HL = %04X IX = %04X IY = %04X\nF'= [%c%c%c%c%c%c%c%c] A'= %02X BC'= %04X DE'= %04X HL'= %04X SP = %04X PC = %04X\n I = %02X R = %02X (BC)= %04X (DE)= %04X (HL)= %04X (SP)= %04X %cI:IFF2=%d\nTotal CPU Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+ _T("F = [%c%c%c%c%c%c%c%c] A = %02X BC = %04X DE = %04X HL = %04X IX = %04X IY = %04X\n")
+ _T("F'= [%c%c%c%c%c%c%c%c] A'= %02X BC'= %04X DE'= %04X HL'= %04X SP = %04X PC = %04X\n")
+ _T(" I = %02X R = %02X (BC)= %04X (DE)= %04X (HL)= %04X (SP)= %04X %cI:IFF2=%d\n")
+ _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
+
(F & CF) ? _T('C') : _T('-'), (F & NF) ? _T('N') : _T('-'), (F & PF) ? _T('P') : _T('-'), (F & XF) ? _T('X') : _T('-'),
(F & HF) ? _T('H') : _T('-'), (F & YF) ? _T('Y') : _T('-'), (F & ZF) ? _T('Z') : _T('-'), (F & SF) ? _T('S') : _T('-'),
A, BC, DE, HL, IX, IY,
total_icount, total_icount - prev_total_icount,
get_passed_clock_since_vline(), get_cur_vline_clocks(), get_cur_vline(), get_lines_per_frame());
prev_total_icount = total_icount;
+ return true;
}
// disassembler
}
//#endif
}
-#define STATE_VERSION 3
+#define STATE_VERSION 4
bool Z80_BASE::process_state(FILEIO* state_fio, bool loading)
{
state_fio->StateValue(icount);
state_fio->StateValue(extra_icount);
+ state_fio->StateValue(busreq_icount);
state_fio->StateValue(prevpc);
state_fio->StateValue(pc.d);
state_fio->StateValue(sp.d);
if(data & 1) {
// control word
counter[ch].prescaler = (data & 0x20) ? 256 : 16;
- counter[ch].latch = ((data & 4) != 0);
- counter[ch].freeze = ((data & 2) != 0);
- counter[ch].start = (counter[ch].freq || !(data & 8));
+ counter[ch].latch = ((data & 0x04) != 0);
+ counter[ch].freeze = ((data & 0x02) != 0);
+ counter[ch].start = (counter[ch].freq || !(data & 0x08));
counter[ch].control = data;
counter[ch].slope = ((data & 0x10) != 0);
+ if((data & 0x02) && (counter[ch].req_intr || counter[ch].in_service)) {
+ counter[ch].req_intr = false;
+ counter[ch].in_service = false;
+ update_intr();
+ }
if(!(data & 0x80) && counter[ch].req_intr) {
counter[ch].req_intr = false;
update_intr();
{
d_child = device;
}
+ DEVICE *get_context_child()
+ {
+ return d_child;
+ }
void set_intr_iei(bool val);
uint32_t get_intr_ack();
void notify_intr_reti();
*/
#include "z80dma.h"
+#include "debugger.h"
//#define DMA_DEBUG
DEVICE::initialize();
_SINGLE_MODE_DMA = osd->check_feature(_T("SINGLE_MODE_DMA"));
_DMA_DEBUG = osd->check_feature(_T("DMA_DEBUG"));
+ if(d_debugger != NULL) {
+ d_debugger->set_device_name(_T("Debugger (Z80DMA)"));
+ d_debugger->set_context_mem(this);
+ d_debugger->set_context_io(this);
+ }
}
void Z80DMA::reset()
case CMD_RESET:
enabled = false;
force_ready = false;
- req_intr = false;
+ req_intr = in_service = false;
update_intr();
status = 0x30;
// reset timing
}
}
+void Z80DMA::write_via_debugger_data8w(uint32_t addr, uint32_t data, int* wait)
+{
+ d_mem->write_dma_data8w(addr, data, wait);
+}
+
+uint32_t Z80DMA::read_via_debugger_data8w(uint32_t addr, int* wait)
+{
+ return d_mem->read_dma_data8w(addr, wait);
+}
+
+void Z80DMA::write_via_debugger_io8w(uint32_t addr, uint32_t data, int* wait)
+{
+ d_io->write_dma_io8w(addr, data, wait);
+}
+
+uint32_t Z80DMA::read_via_debugger_io8w(uint32_t addr, int* wait)
+{
+ return d_io->read_dma_io8w(addr, wait);
+}
+
+void Z80DMA::write_memory(uint32_t addr, uint32_t data, int* wait)
+{
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_data8w(addr, data, wait);
+ } else {
+ this->write_via_debugger_data8w(addr, data, wait);
+ }
+}
+
+uint32_t Z80DMA::read_memory(uint32_t addr, int* wait)
+{
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ return d_debugger->read_via_debugger_data8w(addr, wait);
+ } else {
+ return this->read_via_debugger_data8w(addr, wait);
+ }
+}
+
+void Z80DMA::write_ioport(uint32_t addr, uint32_t data, int* wait)
+{
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ d_debugger->write_via_debugger_io8w(addr, data, wait);
+ } else {
+ this->write_via_debugger_io8w(addr, data, wait);
+ }
+}
+
+uint32_t Z80DMA::read_ioport(uint32_t addr, int* wait)
+{
+ if(d_debugger != NULL && d_debugger->now_device_debugging) {
+ return d_debugger->read_via_debugger_io8w(addr, wait);
+ } else {
+ return this->read_via_debugger_io8w(addr, wait);
+ }
+}
+
// note: if SINGLE_MODE_DMA is defined, do_dma() is called in every machine cycle
void Z80DMA::do_dma()
if(PORTA_IS_SOURCE) {
if(PORTA_MEMORY) {
- data = d_mem->read_dma_data8w(addr_a, &wait_r);
+ data = read_memory(addr_a, &wait_r);
//#ifdef DMA_DEBUG
if(_DMA_DEBUG) this->out_debug_log(_T("Z80DMA: RAM[%4x]=%2x -> "), addr_a, data);
//#endif
} else {
- data = d_io->read_dma_io8w(addr_a, &wait_r);
+ data = read_ioport(addr_a, &wait_r);
//#ifdef DMA_DEBUG
if(_DMA_DEBUG) this->out_debug_log(_T("Z80DMA: INP(%4x)=%2x -> "), addr_a, data);
//#endif
}
} else {
if(PORTB_MEMORY) {
- data = d_mem->read_dma_data8w(addr_b, &wait_r);
+ data = read_memory(addr_b, &wait_r);
//#ifdef DMA_DEBUG
if(_DMA_DEBUG) this->out_debug_log(_T("Z80DMA: RAM[%4x]=%2x -> "), addr_b, data);
//#endif
} else {
- data = d_io->read_dma_io8w(addr_b, &wait_r);
+ data = read_ioport(addr_b, &wait_r);
//#ifdef DMA_DEBUG
if(_DMA_DEBUG) this->out_debug_log(_T("Z80DMA: INP(%4x)=%2x -> "), addr_b, data);
//#endif
//#ifdef DMA_DEBUG
if(_DMA_DEBUG) this->out_debug_log(_T("RAM[%4x]\n"), addr_b);
//#endif
- d_mem->write_dma_data8w(addr_b, data, &wait_w);
+ write_memory(addr_b, data, &wait_w);
} else {
//#ifdef DMA_DEBUG
if(_DMA_DEBUG) this->out_debug_log(_T("OUT(%4x)\n"), addr_b);
//#endif
- d_io->write_dma_io8w(addr_b, data, &wait_w);
+ write_ioport(addr_b, data, &wait_w);
}
if(d_cpu != NULL) {
if(CHECK_WAIT_SIGNAL) {
//#ifdef DMA_DEBUG
if(_DMA_DEBUG) this->out_debug_log(_T("RAM[%4x]\n"), addr_a);
//#endif
- d_mem->write_dma_data8w(addr_a, data, &wait_w);
+ write_memory(addr_a, data, &wait_w);
} else {
//#ifdef DMA_DEBUG
if(_DMA_DEBUG) this->out_debug_log(_T("OUT(%4x)\n"), addr_a);
//#endif
- d_io->write_dma_io8w(addr_a, data, &wait_w);
+ write_ioport(addr_a, data, &wait_w);
}
if(d_cpu != NULL) {
if(CHECK_WAIT_SIGNAL) {
}
}
+bool Z80DMA::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
+{
+/*
+PORT-A(MEM,FFFF)->PORT-B(I/O,FFFF) CNT=65536 BLK=65536 STAT=00 ENABLE=1 READY=1
+*/
+ my_stprintf_s(buffer, buffer_len,
+ _T("PORT-A(%s,%04X)%sPORT-B(%s,%04X) CNT=%d BLK=%d STAT=%02X ENABLE=%d READY=%d"),
+ PORTA_MEMORY ? "MEM" : "I/O", addr_a,
+ PORTA_IS_SOURCE ? "->" : "<-",
+ PORTB_MEMORY ? "MEM" : "I/O", addr_b,
+ upcount, blocklen,
+ status | (now_ready() ? 0 : 2) | (req_intr ? 0 : 8),
+ enabled, now_ready());
+ return true;
+}
+
#define STATE_VERSION 2
bool Z80DMA::process_state(FILEIO* state_fio, bool loading)
#define SIG_Z80DMA_READY 0
+class DEBUGGER;
+
class Z80DMA : public DEVICE
{
private:
DEVICE *d_mem, *d_io;
+ DEBUGGER *d_debugger;
typedef union {
uint16_t m[7][8];
bool dma_stop;
bool bus_master;
+ void write_memory(uint32_t addr, uint32_t data, int* wait);
+ uint32_t read_memory(uint32_t addr, int* wait);
+ void write_ioport(uint32_t addr, uint32_t data, int* wait);
+ uint32_t read_ioport(uint32_t addr, int* wait);
+
// interrupt
bool req_intr;
bool in_service;
}
_SINGLE_MODE_DMA = _DMA_DEBUG = false;
d_cpu = d_child = NULL;
+ d_debugger = NULL;
set_device_name(_T("Z80 DMA"));
}
~Z80DMA() {}
uint32_t read_io8(uint32_t addr);
void write_signal(int id, uint32_t data, uint32_t mask);
void do_dma();
+ // for debug
+ void write_via_debugger_data8w(uint32_t addr, uint32_t data, int* wait);
+ uint32_t read_via_debugger_data8w(uint32_t addr, int* wait);
+ void write_via_debugger_io8w(uint32_t addr, uint32_t data, int* wait);
+ uint32_t read_via_debugger_io8w(uint32_t addr, int* wait);
+ bool is_debugger_available()
+ {
+ return true;
+ }
+ void *get_debugger()
+ {
+ return d_debugger;
+ }
+ bool get_debug_regs_info(_TCHAR *buffer, size_t buffer_len);
bool process_state(FILEIO* state_fio, bool loading);
// interrupt common functions
void set_context_intr(DEVICE* device, uint32_t bit)
{
d_child = device;
}
+ DEVICE *get_context_child()
+ {
+ return d_child;
+ }
void set_intr_iei(bool val);
uint32_t get_intr_ack();
void notify_intr_reti();
{
d_io = device;
}
+#ifdef USE_DEBUGGER
+ void set_context_debugger(DEBUGGER* device)
+ {
+ d_debugger = device;
+ }
+#endif
};
#endif
{
d_child = device;
}
+ DEVICE *get_context_child()
+ {
+ return d_child;
+ }
void set_intr_iei(bool val);
uint32_t get_intr_ack();
void notify_intr_reti();
{
d_child = device;
}
+ DEVICE *get_context_child()
+ {
+ return d_child;
+ }
void set_intr_iei(bool val);
uint32_t get_intr_ack();
void notify_intr_reti();
Sleep(ms);
}
+#ifdef USE_DEBUGGER
+FARPROC hWndProc = NULL;
+OSD *my_osd = NULL;
+
+LRESULT CALLBACK MyWndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(iMsg) {
+ case WM_CLOSE:
+ return 0;
+ case WM_PAINT:
+ if(my_osd) {
+ PAINTSTRUCT ps;
+ HDC hdc = BeginPaint(hWnd, &ps);
+#ifdef ONE_BOARD_MICRO_COMPUTER
+ my_osd->reload_bitmap();
+#endif
+ my_osd->update_screen(hdc);
+ EndPaint(hWnd, &ps);
+ }
+ return 0;
+ }
+ return DefWindowProc(hWnd, iMsg, wParam, lParam);
+}
+
+void OSD::start_waiting_in_debugger()
+{
+ HMENU hMenu = GetMenu(main_window_handle);
+
+ if(hMenu != NULL) {
+ for(int i = 0;; i++) {
+ if(EnableMenuItem(hMenu, i, MF_BYPOSITION | MF_GRAYED) == -1) {
+ break;
+ }
+ }
+ }
+ hWndProc = (FARPROC)GetWindowLong(main_window_handle, GWL_WNDPROC);
+ SetWindowLong(main_window_handle, GWL_WNDPROC, (LONG)MyWndProc);
+ my_osd = this;
+}
+
+void OSD::finish_waiting_in_debugger()
+{
+ HMENU hMenu = GetMenu(main_window_handle);
+
+ if(hMenu != NULL) {
+ for(int i = 0;; i++) {
+ if(EnableMenuItem(hMenu, i, MF_BYPOSITION | MF_ENABLED) == -1) {
+ break;
+ }
+ }
+ }
+ SetWindowLong(main_window_handle, GWL_WNDPROC, (LONG)hWndProc);
+ my_osd = NULL;
+}
+
+void OSD::process_waiting_in_debugger()
+{
+ MSG msg;
+
+ while(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
+ if(GetMessage(&msg, NULL, 0, 0)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+}
+#endif
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
+// osd common
+
+#define OSD_CONSOLE_BLUE 1 // text color contains blue
+#define OSD_CONSOLE_GREEN 2 // text color contains green
+#define OSD_CONSOLE_RED 4 // text color contains red
+#define OSD_CONSOLE_INTENSITY 8 // text color is intensified
+
typedef struct bitmap_s {
// common
inline bool initialized()
void force_unlock_vm();
void sleep(uint32_t ms);
+ // common debugger
+#ifdef USE_DEBUGGER
+ void start_waiting_in_debugger();
+ void finish_waiting_in_debugger();
+ void process_waiting_in_debugger();
+#endif
+
// common console
void open_console(const _TCHAR* title);
void close_console();
unsigned int get_console_code_page();
bool is_console_active();
void set_console_text_attribute(unsigned short attr);
- void write_console(_TCHAR* buffer, unsigned int length);
+ void write_console(const _TCHAR* buffer, unsigned int length);
int read_console_input(_TCHAR* buffer, unsigned int length);
bool is_console_key_pressed(int vk);
void close_debugger_console();
void OSD::set_console_text_attribute(unsigned short attr)
{
+ unsigned short new_attr = 0;
+
+ if(attr & OSD_CONSOLE_BLUE ) new_attr |= FOREGROUND_BLUE;
+ if(attr & OSD_CONSOLE_GREEN ) new_attr |= FOREGROUND_GREEN;
+ if(attr & OSD_CONSOLE_RED ) new_attr |= FOREGROUND_RED;
+ if(attr & OSD_CONSOLE_INTENSITY) new_attr |= FOREGROUND_INTENSITY;
+
SetConsoleTextAttribute(hStdOut, attr);
}
-void OSD::write_console(_TCHAR* buffer, unsigned int length)
+void OSD::write_console(const _TCHAR* buffer, unsigned int length)
{
DWORD dwWritten;
WriteConsole(hStdOut, buffer, length, &dwWritten, NULL);
key_dik[DIK_RETURN ] |= key_dik[DIK_NUMPADENTER];
#endif
- for (int vk = 0; vk < 256; vk++) {
+ for(int vk = 0; vk < 256; vk++) {
int dik = vk_dik[vk];
if(dik) {
if(key_dik[dik] & 0x80) {
return false;
}
ImageCodecInfo* pImageCodecInfo = (ImageCodecInfo*)malloc(size);
- if (pImageCodecInfo == NULL) {
+ if(pImageCodecInfo == NULL) {
return false;
}
GetImageEncoders(num, size, pImageCodecInfo);
void open_any_file(const _TCHAR* path);
#endif
-_TCHAR* get_open_file_name(HWND hWnd, const _TCHAR* filter, const _TCHAR* title, _TCHAR* dir, size_t dir_len);
-_TCHAR* get_save_file_name(HWND hWnd, const _TCHAR* filter, const _TCHAR* file, const _TCHAR* title, _TCHAR* dir, size_t dir_len);
+_TCHAR* get_open_file_name(HWND hWnd, const _TCHAR* filter, const _TCHAR* title, const _TCHAR* new_file, _TCHAR* dir, size_t dir_len);
// screen
int desktop_width;
case ID_SELECT_D88_BANK + 56: case ID_SELECT_D88_BANK + 57: case ID_SELECT_D88_BANK + 58: case ID_SELECT_D88_BANK + 59: \
case ID_SELECT_D88_BANK + 60: case ID_SELECT_D88_BANK + 61: case ID_SELECT_D88_BANK + 62: case ID_SELECT_D88_BANK + 63: \
if(emu) { \
- select_d88_bank(drv, LOWORD(wParam) - ID_SELECT_D88_BANK) ; \
+ select_d88_bank(drv, LOWORD(wParam) - ID_SELECT_D88_BANK); \
} \
break; \
case ID_EJECT_D88_BANK: \
if(emu) { \
- select_d88_bank(drv, -1) ; \
+ select_d88_bank(drv, -1); \
} \
break;
FD_MENU_ITEMS(0, ID_OPEN_FD1, ID_CLOSE_FD1, ID_OPEN_BLANK_2D_FD1, ID_OPEN_BLANK_2DD_FD1, ID_OPEN_BLANK_2HD_FD1, ID_WRITE_PROTECT_FD1, ID_CORRECT_TIMING_FD1, ID_IGNORE_CRC_FD1, ID_RECENT_FD1, ID_SELECT_D88_BANK1, ID_EJECT_D88_BANK1)
}
break;
}
- return DefWindowProc(hWnd, iMsg, wParam, lParam) ;
+ return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
// ----------------------------------------------------------------------------
} else if(id >= ID_VM_JOYSTICK_MENU_START && id <= ID_VM_JOYSTICK_MENU_END) {
update_vm_joystick_menu(hMenu);
#endif
-#if defined(USE_SOUND_TYPE) || defined(USE_FLOPPY_DISK) || defined(USE_TAPE)
+#if defined(USE_SOUND_TYPE) || defined(USE_FLOPPY_DISK) || defined(USE_TAPE) || defined(USE_DIPSWITCH)
} else if(id >= ID_VM_SOUND_MENU_START && id <= ID_VM_SOUND_MENU_END) {
update_vm_sound_menu(hMenu);
+#ifdef USE_DIPSWITCH
+ // dipswitch may be in sound menu
+ update_vm_dipswitch_menu(hMenu);
+#endif
#endif
#if defined(USE_MONITOR_TYPE) || defined(USE_SCANLINE)
} else if(id >= ID_VM_MONITOR_MENU_START && id <= ID_VM_MONITOR_MENU_END) {
GetTextExtentPoint32(lpDrawItem->hDC, _T("HD:"), 3, &size);
draw_left += size.cx + 4;
- for (int i = 0; i < USE_HARD_DISK; i++) {
+ for(int i = 0; i < USE_HARD_DISK; i++) {
int idx = (hd_status >> i) & 1;
SelectObject(hdcMem, hBitmap[idx]);
TransparentBlt(lpDrawItem->hDC, draw_left, bmp_top, bmp_width, bmp_height, hdcMem, 0, 0, bmp_width, bmp_height, 0);
GetTextExtentPoint32(lpDrawItem->hDC, _T("CD:"), 3, &size);
draw_left += size.cx + 4;
- for (int i = 0; i < USE_COMPACT_DISC; i++) {
+ for(int i = 0; i < USE_COMPACT_DISC; i++) {
int idx = (cd_status >> i) & 1;
SelectObject(hdcMem, hBitmap[idx]);
TransparentBlt(lpDrawItem->hDC, draw_left, bmp_top, bmp_width, bmp_height, hdcMem, 0, 0, bmp_width, bmp_height, 0);
GetTextExtentPoint32(lpDrawItem->hDC, _T("LD:"), 3, &size);
draw_left += size.cx + 4;
- for (int i = 0; i < USE_LASER_DISC; i++) {
+ for(int i = 0; i < USE_LASER_DISC; i++) {
int idx = (ld_status >> i) & 1;
SelectObject(hdcMem, hBitmap[idx]);
TransparentBlt(lpDrawItem->hDC, draw_left, bmp_top, bmp_width, bmp_height, hdcMem, 0, 0, bmp_width, bmp_height, 0);
_T("Supported Files (*.rom;*.bin;*.hex)\0*.rom;*.bin;*.hex\0All Files (*.*)\0*.*\0\0"),
_T("Game Cartridge"),
#endif
+ NULL,
config.initial_cart_dir, _MAX_PATH
);
if(path) {
hWnd,
_T("Supported Files (*.d88;*.d77;*.1dd;*.td0;*.imd;*.dsk;*.nfd;*.fdi;*.hdm;*.hd5;*.hd4;*.hdb;*.dd9;*.dd6;*.tfd;*.xdf;*.2d;*.sf7;*.img;*.ima;*.vfd)\0*.d88;*.d77;*.1dd;*.td0;*.imd;*.dsk;*.nfd;*.fdi;*.hdm;*.hd5;*.hd4;*.hdb;*.dd9;*.dd6;*.tfd;*.xdf;*.2d;*.sf7;*.img;*.ima;*.vfd\0All Files (*.*)\0*.*\0\0"),
_T("Floppy Disk"),
+ NULL,
config.initial_floppy_disk_dir, _MAX_PATH
);
if(path) {
void open_blank_floppy_disk_dialog(HWND hWnd, int drv, uint8_t type)
{
- _TCHAR* path = get_save_file_name(
+ _TCHAR* path = get_open_file_name(
hWnd,
_T("Supported Files (*.d88;*.d77)\0*.d88;*.d77\0All Files (*.*)\0*.*\0\0"),
- create_date_file_name(_T("d88")),
_T("Floppy Disk"),
+ create_date_file_name(_T("d88")),
config.initial_floppy_disk_dir, _MAX_PATH
);
if(path) {
UPDATE_HISTORY(path, config.recent_floppy_disk_path[drv]);
my_tcscpy_s(config.initial_floppy_disk_dir, _MAX_PATH, get_parent_dir(path));
-
- struct {
- char title[17];
- uint8_t rsrv[9];
- uint8_t protect;
- uint8_t type;
- uint32_t size;
- uint32_t trkptr[164];
- } d88_hdr;
-
- memset(&d88_hdr, 0, sizeof(d88_hdr));
- my_strcpy_s(d88_hdr.title, sizeof(d88_hdr.title), "BLANK");
- d88_hdr.type = type;
- d88_hdr.size = sizeof(d88_hdr);
-
- FILEIO *fio = new FILEIO();
- if(fio->Fopen(path, FILEIO_WRITE_BINARY)) {
- fio->Fwrite(&d88_hdr, sizeof(d88_hdr), 1);
- fio->Fclose();
- open_floppy_disk(drv, path, 0);
- }
- delete fio;
+ emu->create_bank_floppy_disk(path, type);
+ open_floppy_disk(drv, path, 0);
}
}
hWnd,
_T("Supported Files (*.mzt;*.q20;*.qdf)\0*.mzt;*.q20;*.qdf\0All Files (*.*)\0*.*\0\0"),
_T("Quick Disk"),
+ NULL,
config.initial_quick_disk_dir, _MAX_PATH
);
if(path) {
hWnd,
_T("Supported Files (*.thd;*.nhd;*.hdi;*.hdd;*.dat)\0*.thd;*.nhd;*.hdi;*.hdd;*.dat\0All Files (*.*)\0*.*\0\0"),
_T("Hard Disk"),
+ NULL,
config.initial_hard_disk_dir, _MAX_PATH
);
if(path) {
#if defined(_PC6001) || defined(_PC6001MK2) || defined(_PC6001MK2SR) || defined(_PC6601) || defined(_PC6601SR)
play ? _T("Supported Files (*.wav;*.cas;*.p6;*.p6t;*.gz)\0*.wav;*.cas;*.p6;*.p6t;*.gz\0All Files (*.*)\0*.*\0\0")
: _T("Supported Files (*.wav;*.cas;*.p6;*.p6t)\0*.wav;*.cas;*.p6;*.p6t\0All Files (*.*)\0*.*\0\0"),
-#elif defined(_PC8001SR) || defined(_PC8801MA) || defined(_PC98DO)
+#elif defined(_PC8001) || defined(_PC8001MK2) || defined(_PC8001SR) || defined(_PC8801) || defined(_PC8801MK2) || defined(_PC8801MA) || defined(_PC98DO)
play ? _T("Supported Files (*.cas;*.cmt;*.n80;*.t88)\0*.cas;*.cmt;*.n80;*.t88\0All Files (*.*)\0*.*\0\0")
: _T("Supported Files (*.cas;*.cmt)\0*.cas;*.cmt\0All Files (*.*)\0*.*\0\0"),
#elif defined(_MZ80A) || defined(_MZ80K) || defined(_MZ1200) || defined(_MZ700) || defined(_MZ800) || defined(_MZ1500)
_T("Supported Files (*.cas;*.cmt)\0*.cas;*.cmt\0All Files (*.*)\0*.*\0\0"),
#endif
play ? _T("Data Recorder Tape [Play]") : _T("Data Recorder Tape [Rec]"),
+ NULL,
config.initial_tape_dir, _MAX_PATH
);
if(path) {
hWnd,
_T("Supported Files (*.ccd;*.cue)\0*.ccd;*.cue\0All Files (*.*)\0*.*\0\0"),
_T("Compact Disc"),
+ NULL,
config.initial_compact_disc_dir, _MAX_PATH
);
if(path) {
hWnd,
_T("Supported Files (*.avi;*.mpg;*.mpeg;*.mp4;*.wmv;*.ogv)\0*.avi;*.mpg;*.mpeg;*.mp4;*.wmv;*.ogv\0All Files (*.*)\0*.*\0\0"),
_T("Laser Disc"),
+ NULL,
config.initial_laser_disc_dir, _MAX_PATH
);
if(path) {
#else
_T("Memory Dump"),
#endif
+ NULL,
config.initial_binary_dir, _MAX_PATH
);
if(path) {
hWnd,
_T("Supported Files (*.b77;*.bbl)\0*.b77;*.bbl\0All Files (*.*)\0*.*\0\0"),
_T("Bubble Casette"),
+ NULL,
config.initial_bubble_casette_dir, _MAX_PATH
);
if(path) {
}
#endif
-_TCHAR* get_open_file_name(HWND hWnd, const _TCHAR* filter, const _TCHAR* title, _TCHAR* dir, size_t dir_len)
+_TCHAR* get_open_file_name(HWND hWnd, const _TCHAR* filter, const _TCHAR* title, const _TCHAR* new_file, _TCHAR* dir, size_t dir_len)
{
static _TCHAR path[_MAX_PATH];
_TCHAR tmp[_MAX_PATH] = _T("");
OPENFILENAME OpenFileName;
- memset(&OpenFileName, 0, sizeof(OpenFileName));
- OpenFileName.lStructSize = sizeof(OPENFILENAME);
- OpenFileName.hwndOwner = hWnd;
- OpenFileName.lpstrFilter = filter;
- OpenFileName.lpstrFile = tmp;
- OpenFileName.nMaxFile = _MAX_PATH;
- OpenFileName.lpstrTitle = title;
- OpenFileName.Flags = OFN_FILEMUSTEXIST;
- if(dir[0]) {
- OpenFileName.lpstrInitialDir = dir;
- } else {
- _TCHAR app[_MAX_PATH];
- GetModuleFileName(NULL, app, _MAX_PATH);
- OpenFileName.lpstrInitialDir = get_parent_dir(app);
- }
- if(GetOpenFileName(&OpenFileName)) {
- get_long_full_path_name(OpenFileName.lpstrFile, path, _MAX_PATH);
- my_tcscpy_s(dir, dir_len, get_parent_dir(path));
- return path;
+ if(new_file != NULL) {
+ my_tcscpy_s(tmp, _MAX_PATH, new_file);
}
- return NULL;
-}
-
-_TCHAR* get_save_file_name(HWND hWnd, const _TCHAR* filter, const _TCHAR* file, const _TCHAR* title, _TCHAR* dir, size_t dir_len)
-{
- static _TCHAR path[_MAX_PATH];
- _TCHAR tmp[_MAX_PATH] = _T("");
- OPENFILENAME OpenFileName;
-
- my_tcscpy_s(tmp, _MAX_PATH, file);
memset(&OpenFileName, 0, sizeof(OpenFileName));
OpenFileName.lStructSize = sizeof(OPENFILENAME);
OpenFileName.hwndOwner = hWnd;
OpenFileName.lpstrFile = tmp;
OpenFileName.nMaxFile = _MAX_PATH;
OpenFileName.lpstrTitle = title;
- OpenFileName.Flags = OFN_OVERWRITEPROMPT;
if(dir[0]) {
OpenFileName.lpstrInitialDir = dir;
} else {
GetModuleFileName(NULL, app, _MAX_PATH);
OpenFileName.lpstrInitialDir = get_parent_dir(app);
}
- if(GetSaveFileName(&OpenFileName)) {
+ if(GetOpenFileName(&OpenFileName)) {
get_long_full_path_name(OpenFileName.lpstrFile, path, _MAX_PATH);
my_tcscpy_s(dir, dir_len, get_parent_dir(path));
return path;
EndDialog(hDlg, IDOK);
break;
case IDC_VOLUME_RESET:
- for(int i = 0; i < 10; i++) {
+ for(int i = 0; i < USE_SOUND_VOLUME; i++) {
SendDlgItemMessage(hDlg, IDC_VOLUME_PARAM_L0 + i, TBM_SETPOS, TRUE, 0);
SendDlgItemMessage(hDlg, IDC_VOLUME_PARAM_R0 + i, TBM_SETPOS, TRUE, 0);
}
Filter="cpp"
>
<File
+ RelativePath="..\src\vm\ay_3_891x.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\src\vm\disk.cpp"
>
<FileConfiguration
/>
</FileConfiguration>
</File>
+ <Filter
+ Name="fmgen Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="..\src\vm\fmgen\fmgen.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\fmtimer.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\opna.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\psg.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
</Filter>
<Filter
Name="VM Driver Source Files"
Filter="h"
>
<File
+ RelativePath="..\src\vm\ay_3_891x.h"
+ >
+ </File>
+ <File
RelativePath="..\src\vm\debugger.h"
>
</File>
RelativePath="..\src\vm\z80.h"
>
</File>
+ <Filter
+ Name="fmgen Header Files"
+ >
+ <File
+ RelativePath="..\src\vm\fmgen\diag.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\fmgen.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\fmgeninl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\fmtimer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\headers.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\misc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\opna.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\psg.h"
+ >
+ </File>
+ </Filter>
</Filter>
<Filter
Name="VM Driver Header Files"
Filter="cpp"
>
<File
+ RelativePath="..\src\vm\ay_3_891x.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\src\vm\disk.cpp"
>
<FileConfiguration
Filter="h"
>
<File
+ RelativePath="..\src\vm\ay_3_891x.h"
+ >
+ </File>
+ <File
RelativePath="..\src\vm\debugger.h"
>
</File>
Filter="cpp"
>
<File
+ RelativePath="..\src\vm\ay_3_891x.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\src\vm\disk.cpp"
>
<FileConfiguration
Filter="h"
>
<File
+ RelativePath="..\src\vm\ay_3_891x.h"
+ >
+ </File>
+ <File
RelativePath="..\src\vm\debugger.h"
>
</File>
Filter="cpp"
>
<File
+ RelativePath="..\src\vm\ay_3_891x.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\src\vm\disk.cpp"
>
<FileConfiguration
</FileConfiguration>
</File>
<File
+ RelativePath="..\src\vm\ym2203.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\src\vm\z80.cpp"
>
<FileConfiguration
/>
</FileConfiguration>
</File>
+ <Filter
+ Name="fmgen Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="..\src\vm\fmgen\fmgen.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\fmtimer.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\opna.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\psg.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
</Filter>
<Filter
Name="VM Driver Source Files"
Filter="h"
>
<File
+ RelativePath="..\src\vm\ay_3_891x.h"
+ >
+ </File>
+ <File
RelativePath="..\src\vm\debugger.h"
>
</File>
>
</File>
<File
+ RelativePath="..\src\vm\ym2203.h"
+ >
+ </File>
+ <File
RelativePath="..\src\vm\z80.h"
>
</File>
+ <Filter
+ Name="fmgen Header Files"
+ >
+ <File
+ RelativePath="..\src\vm\fmgen\diag.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\fmgen.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\fmgeninl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\fmtimer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\headers.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\misc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\opna.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\vm\fmgen\psg.h"
+ >
+ </File>
+ </Filter>
</Filter>
<Filter
Name="VM Driver Header Files"
Filter="cpp"
>
<File
+ RelativePath="..\src\vm\ay_3_891x.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\src\vm\disk.cpp"
>
<FileConfiguration
Filter="h"
>
<File
+ RelativePath="..\src\vm\ay_3_891x.h"
+ >
+ </File>
+ <File
RelativePath="..\src\vm\debugger.h"
>
</File>
Filter="cpp"
>
<File
+ RelativePath="..\src\vm\ay_3_891x.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\src\vm\disk.cpp"
>
<FileConfiguration
Filter="h"
>
<File
+ RelativePath="..\src\vm\ay_3_891x.h"
+ >
+ </File>
+ <File
RelativePath="..\src\vm\debugger.h"
>
</File>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{699AB843-1860-4ABF-B52C-D6A84D0F81E8}</ProjectGuid>
- <RootNamespace>pc8001</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <PlatformToolset>v120_xp</PlatformToolset>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <PlatformToolset>v120_xp</PlatformToolset>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>12.0.21005.1</_ProjectFileVersion>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <OutDir>.\Debug\</OutDir>
- <IntDir>.\Debug\</IntDir>
- <LinkIncremental>true</LinkIncremental>
- <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(DXSDK_DIR)Include</IncludePath>
- <LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86</LibraryPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <OutDir>.\Release\</OutDir>
- <IntDir>.\Release\</IntDir>
- <LinkIncremental>false</LinkIncremental>
- <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(DXSDK_DIR)Include</IncludePath>
- <LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86</LibraryPath>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Debug/pc8001.tlb</TypeLibraryName>
- <HeaderFileName />
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_PC8001;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeaderOutputFile>.\Debug/pc8001.pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
- <ObjectFileName>.\Debug/</ObjectFileName>
- <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
- <BrowseInformation>true</BrowseInformation>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0411</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;winmm.lib;imm32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>.\Debug/pc8001.exe</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>.\Debug/pc8001.pdb</ProgramDatabaseFile>
- <SubSystem>Windows</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention />
- <TargetMachine>MachineX86</TargetMachine>
- <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
- <IgnoreSpecificDefaultLibraries>Libcmtd.lib</IgnoreSpecificDefaultLibraries>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>.\Debug/pc8001.bsc</OutputFile>
- </Bscmake>
- <Manifest>
- <AdditionalManifestFiles>..\src\res\vista.manifest</AdditionalManifestFiles>
- </Manifest>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Release/pc8001.tlb</TypeLibraryName>
- <HeaderFileName />
- </Midl>
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_PC8001;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
- <PrecompiledHeaderOutputFile>.\Release/pc8001.pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
- <ObjectFileName>.\Release/</ObjectFileName>
- <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
- <BrowseInformation>true</BrowseInformation>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;winmm.lib;imm32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>.\Release/pc8001.exe</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <ProgramDatabaseFile>.\Release/pc8001.pdb</ProgramDatabaseFile>
- <SubSystem>Windows</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention />
- <TargetMachine>MachineX86</TargetMachine>
- <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>.\Release/pc8001.bsc</OutputFile>
- </Bscmake>
- <Manifest>
- <AdditionalManifestFiles>..\src\res\vista.manifest</AdditionalManifestFiles>
- </Manifest>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\src\common.cpp" />
- <ClCompile Include="..\src\config.cpp" />
- <ClCompile Include="..\src\fifo.cpp" />
- <ClCompile Include="..\src\fileio.cpp" />
- <ClCompile Include="..\src\debugger.cpp" />
- <ClCompile Include="..\src\emu.cpp" />
- <ClCompile Include="..\src\win32\osd.cpp" />
- <ClCompile Include="..\src\win32\osd_console.cpp" />
- <ClCompile Include="..\src\win32\osd_input.cpp" />
- <ClCompile Include="..\src\win32\osd_screen.cpp" />
- <ClCompile Include="..\src\win32\osd_sound.cpp" />
- <ClCompile Include="..\src\win32\winmain.cpp" />
- <ClCompile Include="..\src\vm\disk.cpp" />
- <ClCompile Include="..\src\vm\event.cpp" />
- <ClCompile Include="..\src\vm\i8251.cpp" />
- <ClCompile Include="..\src\vm\i8253.cpp" />
- <ClCompile Include="..\src\vm\i8255.cpp" />
- <ClCompile Include="..\src\vm\noise.cpp" />
- <ClCompile Include="..\src\vm\pc80s31k.cpp" />
- <ClCompile Include="..\src\vm\pcm1bit.cpp" />
- <ClCompile Include="..\src\vm\prnfile.cpp" />
- <ClCompile Include="..\src\vm\upd1990a.cpp" />
- <ClCompile Include="..\src\vm\upd765a.cpp" />
- <ClCompile Include="..\src\vm\z80.cpp" />
- <ClCompile Include="..\src\vm\pc8801\pc88.cpp" />
- <ClCompile Include="..\src\vm\pc8801\pc8801.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\src\common.h" />
- <ClInclude Include="..\src\config.h" />
- <ClInclude Include="..\src\fifo.h" />
- <ClInclude Include="..\src\fileio.h" />
- <ClInclude Include="..\src\emu.h" />
- <ClInclude Include="..\src\win32\osd.h" />
- <ClInclude Include="..\src\vm\debugger.h" />
- <ClInclude Include="..\src\vm\device.h" />
- <ClInclude Include="..\src\vm\disk.h" />
- <ClInclude Include="..\src\vm\event.h" />
- <ClInclude Include="..\src\vm\i8251.h" />
- <ClInclude Include="..\src\vm\i8253.h" />
- <ClInclude Include="..\src\vm\i8255.h" />
- <ClInclude Include="..\src\vm\noise.h" />
- <ClInclude Include="..\src\vm\pc80s31k.h" />
- <ClInclude Include="..\src\vm\pcm1bit.h" />
- <ClInclude Include="..\src\vm\prnfile.h" />
- <ClInclude Include="..\src\vm\upd1990a.h" />
- <ClInclude Include="..\src\vm\upd765a.h" />
- <ClInclude Include="..\src\vm\vm.h" />
- <ClInclude Include="..\src\vm\vm_template.h" />
- <ClInclude Include="..\src\vm\z80.h" />
- <ClInclude Include="..\src\vm\pc8801\pc88.h" />
- <ClInclude Include="..\src\vm\pc8801\pc8801.h" />
- <ClInclude Include="..\src\res\resource.h" />
- </ItemGroup>
- <ItemGroup>
- <Image Include="..\src\res\pc8001.ico" />
- <Image Include="..\src\res\indicator\access_off.bmp" />
- <Image Include="..\src\res\indicator\access_on.bmp" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="..\src\res\pc8001.rc">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\src\res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\src\res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ResourceCompile>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
<UniqueIdentifier>{68b590a8-076d-453c-98d4-2eb5c8fe8788}</UniqueIdentifier>
<Extensions>cpp</Extensions>
</Filter>
+ <Filter Include="Source Files\VM Common Source Files\fmgen Source Files">
+ <UniqueIdentifier>{bed91dbb-7dbc-4385-adf2-5d0fdf2743cf}</UniqueIdentifier>
+ <Extensions>cpp</Extensions>
+ </Filter>
<Filter Include="Source Files\VM Driver Source Files">
<UniqueIdentifier>{b2e3df21-9020-4e09-8b26-8b7a8c0a7a73}</UniqueIdentifier>
<Extensions>cpp</Extensions>
<UniqueIdentifier>{9f2981f4-53b6-4bf1-bc48-9dc516a72a11}</UniqueIdentifier>
<Extensions>h</Extensions>
</Filter>
+ <Filter Include="Header Files\VM Common Header Files\fmgen Header Files">
+ <UniqueIdentifier>{4296e2df-942e-4e21-8f4e-c65873cd9947}</UniqueIdentifier>
+ </Filter>
<Filter Include="Header Files\VM Driver Header Files">
<UniqueIdentifier>{c8e1362e-38fa-4338-82d4-8e75537d2fbe}</UniqueIdentifier>
<Extensions>h</Extensions>
<ClCompile Include="..\src\win32\winmain.cpp">
<Filter>Source Files\OSD Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vm\ay_3_891x.cpp">
+ <Filter>Source Files\VM Common Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\src\vm\disk.cpp">
<Filter>Source Files\VM Common Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\vm\z80.cpp">
<Filter>Source Files\VM Common Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vm\fmgen\fmgen.cpp">
+ <Filter>Source Files\VM Common Source Files\fmgen Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\vm\fmgen\fmtimer.cpp">
+ <Filter>Source Files\VM Common Source Files\fmgen Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\vm\fmgen\opna.cpp">
+ <Filter>Source Files\VM Common Source Files\fmgen Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\vm\fmgen\psg.cpp">
+ <Filter>Source Files\VM Common Source Files\fmgen Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\src\vm\pc8801\pc88.cpp">
<Filter>Source Files\VM Driver Source Files</Filter>
</ClCompile>
<ClInclude Include="..\src\win32\osd.h">
<Filter>Header Files\OSD Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\src\vm\ay_3_891x.h">
+ <Filter>Header Files\VM Common Header Files</Filter>
+ </ClInclude>
<ClInclude Include="..\src\vm\debugger.h">
<Filter>Header Files\VM Common Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\vm\z80.h">
<Filter>Header Files\VM Common Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\diag.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\fmgen.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\fmgeninl.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\fmtimer.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\headers.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\misc.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\opna.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\psg.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
<ClInclude Include="..\src\vm\pc8801\pc88.h">
<Filter>Header Files\VM Driver Header Files</Filter>
</ClInclude>
<ClCompile Include="..\src\win32\osd_screen.cpp" />
<ClCompile Include="..\src\win32\osd_sound.cpp" />
<ClCompile Include="..\src\win32\winmain.cpp" />
+ <ClCompile Include="..\src\vm\ay_3_891x.cpp" />
<ClCompile Include="..\src\vm\disk.cpp" />
<ClCompile Include="..\src\vm\event.cpp" />
<ClCompile Include="..\src\vm\i8251.cpp" />
<ClInclude Include="..\src\fileio.h" />
<ClInclude Include="..\src\emu.h" />
<ClInclude Include="..\src\win32\osd.h" />
+ <ClInclude Include="..\src\vm\ay_3_891x.h" />
<ClInclude Include="..\src\vm\debugger.h" />
<ClInclude Include="..\src\vm\device.h" />
<ClInclude Include="..\src\vm\disk.h" />
<ClCompile Include="..\src\win32\winmain.cpp">
<Filter>Source Files\OSD Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vm\ay_3_891x.cpp">
+ <Filter>Source Files\VM Common Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\src\vm\disk.cpp">
<Filter>Source Files\VM Common Source Files</Filter>
</ClCompile>
<ClInclude Include="..\src\win32\osd.h">
<Filter>Header Files\OSD Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\src\vm\ay_3_891x.h">
+ <Filter>Header Files\VM Common Header Files</Filter>
+ </ClInclude>
<ClInclude Include="..\src\vm\debugger.h">
<Filter>Header Files\VM Common Header Files</Filter>
</ClInclude>
<ClCompile Include="..\src\win32\osd_screen.cpp" />
<ClCompile Include="..\src\win32\osd_sound.cpp" />
<ClCompile Include="..\src\win32\winmain.cpp" />
+ <ClCompile Include="..\src\vm\ay_3_891x.cpp" />
<ClCompile Include="..\src\vm\disk.cpp" />
<ClCompile Include="..\src\vm\event.cpp" />
<ClCompile Include="..\src\vm\i8251.cpp" />
<ClInclude Include="..\src\fileio.h" />
<ClInclude Include="..\src\emu.h" />
<ClInclude Include="..\src\win32\osd.h" />
+ <ClInclude Include="..\src\vm\ay_3_891x.h" />
<ClInclude Include="..\src\vm\debugger.h" />
<ClInclude Include="..\src\vm\device.h" />
<ClInclude Include="..\src\vm\disk.h" />
<ClCompile Include="..\src\win32\winmain.cpp">
<Filter>Source Files\OSD Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vm\ay_3_891x.cpp">
+ <Filter>Source Files\VM Common Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\src\vm\disk.cpp">
<Filter>Source Files\VM Common Source Files</Filter>
</ClCompile>
<ClInclude Include="..\src\win32\osd.h">
<Filter>Header Files\OSD Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\src\vm\ay_3_891x.h">
+ <Filter>Header Files\VM Common Header Files</Filter>
+ </ClInclude>
<ClInclude Include="..\src\vm\debugger.h">
<Filter>Header Files\VM Common Header Files</Filter>
</ClInclude>
<ClCompile Include="..\src\win32\osd_screen.cpp" />
<ClCompile Include="..\src\win32\osd_sound.cpp" />
<ClCompile Include="..\src\win32\winmain.cpp" />
+ <ClCompile Include="..\src\vm\ay_3_891x.cpp" />
<ClCompile Include="..\src\vm\disk.cpp" />
<ClCompile Include="..\src\vm\event.cpp" />
<ClCompile Include="..\src\vm\i8251.cpp" />
<ClCompile Include="..\src\vm\prnfile.cpp" />
<ClCompile Include="..\src\vm\upd1990a.cpp" />
<ClCompile Include="..\src\vm\upd765a.cpp" />
+ <ClCompile Include="..\src\vm\ym2203.cpp" />
<ClCompile Include="..\src\vm\z80.cpp" />
+ <ClCompile Include="..\src\vm\fmgen\fmgen.cpp" />
+ <ClCompile Include="..\src\vm\fmgen\fmtimer.cpp" />
+ <ClCompile Include="..\src\vm\fmgen\opna.cpp" />
+ <ClCompile Include="..\src\vm\fmgen\psg.cpp" />
<ClCompile Include="..\src\vm\pc8801\pc88.cpp" />
<ClCompile Include="..\src\vm\pc8801\pc8801.cpp" />
</ItemGroup>
<ClInclude Include="..\src\fileio.h" />
<ClInclude Include="..\src\emu.h" />
<ClInclude Include="..\src\win32\osd.h" />
+ <ClInclude Include="..\src\vm\ay_3_891x.h" />
<ClInclude Include="..\src\vm\debugger.h" />
<ClInclude Include="..\src\vm\device.h" />
<ClInclude Include="..\src\vm\disk.h" />
<ClInclude Include="..\src\vm\upd765a.h" />
<ClInclude Include="..\src\vm\vm.h" />
<ClInclude Include="..\src\vm\vm_template.h" />
+ <ClInclude Include="..\src\vm\ym2203.h" />
<ClInclude Include="..\src\vm\z80.h" />
+ <ClInclude Include="..\src\vm\fmgen\diag.h" />
+ <ClInclude Include="..\src\vm\fmgen\fmgen.h" />
+ <ClInclude Include="..\src\vm\fmgen\fmgeninl.h" />
+ <ClInclude Include="..\src\vm\fmgen\fmtimer.h" />
+ <ClInclude Include="..\src\vm\fmgen\headers.h" />
+ <ClInclude Include="..\src\vm\fmgen\misc.h" />
+ <ClInclude Include="..\src\vm\fmgen\opna.h" />
+ <ClInclude Include="..\src\vm\fmgen\psg.h" />
<ClInclude Include="..\src\vm\pc8801\pc88.h" />
<ClInclude Include="..\src\vm\pc8801\pc8801.h" />
<ClInclude Include="..\src\res\resource.h" />
<UniqueIdentifier>{68b590a8-076d-453c-98d4-2eb5c8fe8788}</UniqueIdentifier>
<Extensions>cpp</Extensions>
</Filter>
+ <Filter Include="Source Files\VM Common Source Files\fmgen Source Files">
+ <UniqueIdentifier>{bed91dbb-7dbc-4385-adf2-5d0fdf2743cf}</UniqueIdentifier>
+ <Extensions>cpp</Extensions>
+ </Filter>
<Filter Include="Source Files\VM Driver Source Files">
<UniqueIdentifier>{b2e3df21-9020-4e09-8b26-8b7a8c0a7a73}</UniqueIdentifier>
<Extensions>cpp</Extensions>
<UniqueIdentifier>{9f2981f4-53b6-4bf1-bc48-9dc516a72a11}</UniqueIdentifier>
<Extensions>h</Extensions>
</Filter>
+ <Filter Include="Header Files\VM Common Header Files\fmgen Header Files">
+ <UniqueIdentifier>{4296e2df-942e-4e21-8f4e-c65873cd9947}</UniqueIdentifier>
+ </Filter>
<Filter Include="Header Files\VM Driver Header Files">
<UniqueIdentifier>{c8e1362e-38fa-4338-82d4-8e75537d2fbe}</UniqueIdentifier>
<Extensions>h</Extensions>
<ClCompile Include="..\src\win32\winmain.cpp">
<Filter>Source Files\OSD Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vm\ay_3_891x.cpp">
+ <Filter>Source Files\VM Common Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\src\vm\disk.cpp">
<Filter>Source Files\VM Common Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\vm\upd765a.cpp">
<Filter>Source Files\VM Common Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vm\ym2203.cpp">
+ <Filter>Source Files\VM Common Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\src\vm\z80.cpp">
<Filter>Source Files\VM Common Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vm\fmgen\fmgen.cpp">
+ <Filter>Source Files\VM Common Source Files\fmgen Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\vm\fmgen\fmtimer.cpp">
+ <Filter>Source Files\VM Common Source Files\fmgen Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\vm\fmgen\opna.cpp">
+ <Filter>Source Files\VM Common Source Files\fmgen Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\vm\fmgen\psg.cpp">
+ <Filter>Source Files\VM Common Source Files\fmgen Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\src\vm\pc8801\pc88.cpp">
<Filter>Source Files\VM Driver Source Files</Filter>
</ClCompile>
<ClInclude Include="..\src\vm\debugger.h">
<Filter>Header Files\VM Common Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\src\vm\ay_3_891x.h">
+ <Filter>Header Files\VM Common Header Files</Filter>
+ </ClInclude>
<ClInclude Include="..\src\vm\device.h">
<Filter>Header Files\VM Common Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\vm\vm_template.h">
<Filter>Header Files\VM Common Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\src\vm\ym2203.h">
+ <Filter>Header Files\VM Common Header Files</Filter>
+ </ClInclude>
<ClInclude Include="..\src\vm\z80.h">
<Filter>Header Files\VM Common Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\diag.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\fmgen.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\fmgeninl.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\fmtimer.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\headers.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\misc.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\opna.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\vm\fmgen\psg.h">
+ <Filter>Header Files\VM Common Header Files\fmgen Header Files</Filter>
+ </ClInclude>
<ClInclude Include="..\src\vm\pc8801\pc88.h">
<Filter>Header Files\VM Driver Header Files</Filter>
</ClInclude>
<ClCompile Include="..\src\win32\osd_screen.cpp" />
<ClCompile Include="..\src\win32\osd_sound.cpp" />
<ClCompile Include="..\src\win32\winmain.cpp" />
+ <ClCompile Include="..\src\vm\ay_3_891x.cpp" />
<ClCompile Include="..\src\vm\disk.cpp" />
<ClCompile Include="..\src\vm\event.cpp" />
<ClCompile Include="..\src\vm\i8251.cpp" />
<ClInclude Include="..\src\fileio.h" />
<ClInclude Include="..\src\emu.h" />
<ClInclude Include="..\src\win32\osd.h" />
+ <ClInclude Include="..\src\vm\ay_3_891x.h" />
<ClInclude Include="..\src\vm\debugger.h" />
<ClInclude Include="..\src\vm\device.h" />
<ClInclude Include="..\src\vm\disk.h" />
<ClCompile Include="..\src\win32\winmain.cpp">
<Filter>Source Files\OSD Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vm\ay_3_891x.cpp">
+ <Filter>Source Files\VM Common Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\src\vm\disk.cpp">
<Filter>Source Files\VM Common Source Files</Filter>
</ClCompile>
<ClInclude Include="..\src\win32\osd.h">
<Filter>Header Files\OSD Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\src\vm\ay_3_891x.h">
+ <Filter>Header Files\VM Common Header Files</Filter>
+ </ClInclude>
<ClInclude Include="..\src\vm\debugger.h">
<Filter>Header Files\VM Common Header Files</Filter>
</ClInclude>
<ClCompile Include="..\src\win32\osd_screen.cpp" />
<ClCompile Include="..\src\win32\osd_sound.cpp" />
<ClCompile Include="..\src\win32\winmain.cpp" />
+ <ClCompile Include="..\src\vm\ay_3_891x.cpp" />
<ClCompile Include="..\src\vm\disk.cpp" />
<ClCompile Include="..\src\vm\event.cpp" />
<ClCompile Include="..\src\vm\i8251.cpp" />
<ClInclude Include="..\src\win32\osd.h" />
<ClInclude Include="..\src\vm\debugger.h" />
<ClInclude Include="..\src\vm\device.h" />
+ <ClInclude Include="..\src\vm\ay_3_891x.h" />
<ClInclude Include="..\src\vm\disk.h" />
<ClInclude Include="..\src\vm\event.h" />
<ClInclude Include="..\src\vm\i8251.h" />
<ClCompile Include="..\src\win32\winmain.cpp">
<Filter>Source Files\OSD Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vm\ay_3_891x.cpp">
+ <Filter>Source Files\VM Common Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\src\vm\disk.cpp">
<Filter>Source Files\VM Common Source Files</Filter>
</ClCompile>
<ClInclude Include="..\src\win32\osd.h">
<Filter>Header Files\OSD Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\src\vm\ay_3_891x.h">
+ <Filter>Header Files\VM Common Header Files</Filter>
+ </ClInclude>
<ClInclude Include="..\src\vm\debugger.h">
<Filter>Header Files\VM Common Header Files</Filter>
</ClInclude>