diff options
author | Vas Crabb <vas@vastheman.com> | 2016-11-19 05:35:54 +1100 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2016-11-19 05:38:48 +1100 |
commit | 8179a84458204a5e767446fcf7d10f032a40fd0c (patch) | |
tree | 16105e1667f811dcb24dbf0fc255166cb06df5c2 /src/emu/debug | |
parent | 1b489fe83034072149fb0637b20c7ba57dc72a7a (diff) |
Introduce u8/u16/u32/u64/s8/s16/s32/s64
* New abbreviated types are in osd and util namespaces, and also in global namespace for things that #include "emu.h"
* Get rid of import of cstdint types to global namespace (C99 does this anyway)
* Remove the cstdint types from everything in emu
* Get rid of U64/S64 macros
* Fix a bug in dps16 caused by incorrect use of macro
* Fix debugcon not checking for "do " prefix case-insensitively
* Fix a lot of messed up tabulation
* More constexpr
* Fix up many __names
Diffstat (limited to 'src/emu/debug')
-rw-r--r-- | src/emu/debug/debugcmd.cpp | 282 | ||||
-rw-r--r-- | src/emu/debug/debugcmd.h | 58 | ||||
-rw-r--r-- | src/emu/debug/debugcon.cpp | 14 | ||||
-rw-r--r-- | src/emu/debug/debugcon.h | 6 | ||||
-rw-r--r-- | src/emu/debug/debugcpu.cpp | 207 | ||||
-rw-r--r-- | src/emu/debug/debugcpu.h | 180 | ||||
-rw-r--r-- | src/emu/debug/debughlp.cpp | 2 | ||||
-rw-r--r-- | src/emu/debug/debughlp.h | 6 | ||||
-rw-r--r-- | src/emu/debug/debugvw.cpp | 2 | ||||
-rw-r--r-- | src/emu/debug/debugvw.h | 70 | ||||
-rw-r--r-- | src/emu/debug/dvbpoints.cpp | 6 | ||||
-rw-r--r-- | src/emu/debug/dvbpoints.h | 6 | ||||
-rw-r--r-- | src/emu/debug/dvdisasm.cpp | 36 | ||||
-rw-r--r-- | src/emu/debug/dvdisasm.h | 24 | ||||
-rw-r--r-- | src/emu/debug/dvmemory.cpp | 68 | ||||
-rw-r--r-- | src/emu/debug/dvmemory.h | 38 | ||||
-rw-r--r-- | src/emu/debug/dvstate.cpp | 22 | ||||
-rw-r--r-- | src/emu/debug/dvstate.h | 26 | ||||
-rw-r--r-- | src/emu/debug/dvtext.cpp | 8 | ||||
-rw-r--r-- | src/emu/debug/dvtext.h | 10 | ||||
-rw-r--r-- | src/emu/debug/dvwpoints.cpp | 4 | ||||
-rw-r--r-- | src/emu/debug/express.cpp | 92 | ||||
-rw-r--r-- | src/emu/debug/express.h | 56 | ||||
-rw-r--r-- | src/emu/debug/textbuf.cpp | 50 | ||||
-rw-r--r-- | src/emu/debug/textbuf.h | 16 |
25 files changed, 645 insertions, 644 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 620f83985b5..b4d5197e702 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -49,15 +49,15 @@ bool debugger_commands::cheat_address_is_valid(address_space &space, offs_t addr the current cheat width, if signed -------------------------------------------------*/ -uint64_t debugger_commands::cheat_sign_extend(const cheat_system *cheatsys, uint64_t value) +u64 debugger_commands::cheat_sign_extend(const cheat_system *cheatsys, u64 value) { if (cheatsys->signed_cheat) { switch (cheatsys->width) { - case 1: value = (int8_t)value; break; - case 2: value = (int16_t)value; break; - case 4: value = (int32_t)value; break; + case 1: value = s8(value); break; + case 2: value = s16(value); break; + case 4: value = s32(value); break; } } return value; @@ -67,7 +67,7 @@ uint64_t debugger_commands::cheat_sign_extend(const cheat_system *cheatsys, uint cheat_byte_swap - swap a value -------------------------------------------------*/ -uint64_t debugger_commands::cheat_byte_swap(const cheat_system *cheatsys, uint64_t value) +u64 debugger_commands::cheat_byte_swap(const cheat_system *cheatsys, u64 value) { if (cheatsys->swapped_cheat) { @@ -75,8 +75,8 @@ uint64_t debugger_commands::cheat_byte_swap(const cheat_system *cheatsys, uint64 { case 2: value = ((value >> 8) & 0x00ff) | ((value << 8) & 0xff00); break; case 4: value = ((value >> 24) & 0x000000ff) | ((value >> 8) & 0x0000ff00) | ((value << 8) & 0x00ff0000) | ((value << 24) & 0xff000000); break; - case 8: value = ((value >> 56) & U64(0x00000000000000ff)) | ((value >> 40) & U64(0x000000000000ff00)) | ((value >> 24) & U64(0x0000000000ff0000)) | ((value >> 8) & U64(0x00000000ff000000)) | - ((value << 8) & U64(0x000000ff00000000)) | ((value << 24) & U64(0x0000ff0000000000)) | ((value << 40) & U64(0x00ff000000000000)) | ((value << 56) & U64(0xff00000000000000)); break; + case 8: value = ((value >> 56) & 0x00000000000000ffU) | ((value >> 40) & 0x000000000000ff00U) | ((value >> 24) & 0x0000000000ff0000U) | ((value >> 8) & 0x00000000ff000000U) | + ((value << 8) & 0x000000ff00000000U) | ((value << 24) & 0x0000ff0000000000U) | ((value << 40) & 0x00ff000000000000U) | ((value << 56) & 0xff00000000000000U); break; } } return value; @@ -88,7 +88,7 @@ uint64_t debugger_commands::cheat_byte_swap(const cheat_system *cheatsys, uint64 and swapping if necessary -------------------------------------------------*/ -uint64_t debugger_commands::cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address) +u64 debugger_commands::cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address) { return cheat_sign_extend(cheatsys, cheat_byte_swap(cheatsys, m_cpu.read_memory(space, address, cheatsys->width, true))); } @@ -111,7 +111,7 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu /* add all single-entry save state globals */ for (int itemnum = 0; itemnum < MAX_GLOBALS; itemnum++) { - uint32_t valsize, valcount; + u32 valsize, valcount; void *base; /* stop when we run out of items */ @@ -281,7 +281,7 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu execute_min - return the minimum of two values -------------------------------------------------*/ -uint64_t debugger_commands::execute_min(symbol_table &table, void *ref, int params, const uint64_t *param) +u64 debugger_commands::execute_min(symbol_table &table, void *ref, int params, const u64 *param) { return (param[0] < param[1]) ? param[0] : param[1]; } @@ -291,7 +291,7 @@ uint64_t debugger_commands::execute_min(symbol_table &table, void *ref, int para execute_max - return the maximum of two values -------------------------------------------------*/ -uint64_t debugger_commands::execute_max(symbol_table &table, void *ref, int params, const uint64_t *param) +u64 debugger_commands::execute_max(symbol_table &table, void *ref, int params, const u64 *param) { return (param[0] > param[1]) ? param[0] : param[1]; } @@ -301,7 +301,7 @@ uint64_t debugger_commands::execute_max(symbol_table &table, void *ref, int para execute_if - if (a) return b; else return c; -------------------------------------------------*/ -uint64_t debugger_commands::execute_if(symbol_table &table, void *ref, int params, const uint64_t *param) +u64 debugger_commands::execute_if(symbol_table &table, void *ref, int params, const u64 *param) { return param[0] ? param[1] : param[2]; } @@ -316,15 +316,15 @@ uint64_t debugger_commands::execute_if(symbol_table &table, void *ref, int param global_get - symbol table getter for globals -------------------------------------------------*/ -uint64_t debugger_commands::global_get(symbol_table &table, void *ref) +u64 debugger_commands::global_get(symbol_table &table, void *ref) { global_entry *global = (global_entry *)ref; switch (global->size) { - case 1: return *(uint8_t *)global->base; - case 2: return *(uint16_t *)global->base; - case 4: return *(uint32_t *)global->base; - case 8: return *(uint64_t *)global->base; + case 1: return *(u8 *)global->base; + case 2: return *(u16 *)global->base; + case 4: return *(u32 *)global->base; + case 8: return *(u64 *)global->base; } return ~0; } @@ -334,15 +334,15 @@ uint64_t debugger_commands::global_get(symbol_table &table, void *ref) global_set - symbol table setter for globals -------------------------------------------------*/ -void debugger_commands::global_set(symbol_table &table, void *ref, uint64_t value) +void debugger_commands::global_set(symbol_table &table, void *ref, u64 value) { global_entry *global = (global_entry *)ref; switch (global->size) { - case 1: *(uint8_t *)global->base = value; break; - case 2: *(uint16_t *)global->base = value; break; - case 4: *(uint32_t *)global->base = value; break; - case 8: *(uint64_t *)global->base = value; break; + case 1: *(u8 *)global->base = value; break; + case 2: *(u16 *)global->base = value; break; + case 4: *(u32 *)global->base = value; break; + case 8: *(u64 *)global->base = value; break; } } @@ -357,7 +357,7 @@ void debugger_commands::global_set(symbol_table &table, void *ref, uint64_t valu number parameter -------------------------------------------------*/ -bool debugger_commands::validate_number_parameter(const char *param, uint64_t *result) +bool debugger_commands::validate_number_parameter(const char *param, u64 *result) { /* nullptr parameter does nothing and returns no error */ if (param == nullptr) @@ -432,7 +432,7 @@ bool debugger_commands::validate_cpu_parameter(const char *param, device_t **res return true; /* then evaluate as an expression; on an error assume it was a tag */ - uint64_t cpunum; + u64 cpunum; try { parsed_expression expression(m_cpu.get_visible_symtable(), param, &cpunum); @@ -552,7 +552,7 @@ void debugger_commands::execute_help(int ref, int params, const char *param[]) void debugger_commands::execute_print(int ref, int params, const char *param[]) { /* validate the other parameters */ - uint64_t values[MAX_COMMAND_PARAMS]; + u64 values[MAX_COMMAND_PARAMS]; for (int i = 0; i < params; i++) if (!validate_number_parameter(param[i], &values[i])) return; @@ -568,7 +568,7 @@ void debugger_commands::execute_print(int ref, int params, const char *param[]) mini_printf - safe printf to a buffer -------------------------------------------------*/ -int debugger_commands::mini_printf(char *buffer, const char *format, int params, uint64_t *param) +int debugger_commands::mini_printf(char *buffer, const char *format, int params, u64 *param) { const char *f = format; char *p = buffer; @@ -624,11 +624,11 @@ int debugger_commands::mini_printf(char *buffer, const char *format, int params, m_console.printf("Not enough parameters for format!\n"); return 0; } - if ((uint32_t)(*param >> 32) != 0) - p += sprintf(p, zerofill ? "%0*X" : "%*X", (width <= 8) ? 1 : width - 8, (uint32_t)(*param >> 32)); + if (u32(*param >> 32) != 0) + p += sprintf(p, zerofill ? "%0*X" : "%*X", (width <= 8) ? 1 : width - 8, u32(*param >> 32)); else if (width > 8) p += sprintf(p, zerofill ? "%0*X" : "%*X", width - 8, 0); - p += sprintf(p, zerofill ? "%0*X" : "%*X", (width < 8) ? width : 8, (uint32_t)*param); + p += sprintf(p, zerofill ? "%0*X" : "%*X", (width < 8) ? width : 8, u32(*param)); param++; params--; break; @@ -640,7 +640,7 @@ int debugger_commands::mini_printf(char *buffer, const char *format, int params, m_console.printf("Not enough parameters for format!\n"); return 0; } - p += sprintf(p, zerofill ? "%0*d" : "%*d", width, (uint32_t)*param); + p += sprintf(p, zerofill ? "%0*d" : "%*d", width, u32(*param)); param++; params--; break; @@ -665,7 +665,7 @@ int debugger_commands::mini_printf(char *buffer, const char *format, int params, void debugger_commands::execute_printf(int ref, int params, const char *param[]) { /* validate the other parameters */ - uint64_t values[MAX_COMMAND_PARAMS]; + u64 values[MAX_COMMAND_PARAMS]; for (int i = 1; i < params; i++) if (!validate_number_parameter(param[i], &values[i])) return; @@ -684,7 +684,7 @@ void debugger_commands::execute_printf(int ref, int params, const char *param[]) void debugger_commands::execute_logerror(int ref, int params, const char *param[]) { /* validate the other parameters */ - uint64_t values[MAX_COMMAND_PARAMS]; + u64 values[MAX_COMMAND_PARAMS]; for (int i = 1; i < params; i++) if (!validate_number_parameter(param[i], &values[i])) return; @@ -703,7 +703,7 @@ void debugger_commands::execute_logerror(int ref, int params, const char *param[ void debugger_commands::execute_tracelog(int ref, int params, const char *param[]) { /* validate the other parameters */ - uint64_t values[MAX_COMMAND_PARAMS]; + u64 values[MAX_COMMAND_PARAMS]; for (int i = 1; i < params; i++) if (!validate_number_parameter(param[i], &values[i])) return; @@ -732,7 +732,7 @@ void debugger_commands::execute_quit(int ref, int params, const char *param[]) void debugger_commands::execute_do(int ref, int params, const char *param[]) { - uint64_t dummy; + u64 dummy; validate_number_parameter(param[0], &dummy); } @@ -744,7 +744,7 @@ void debugger_commands::execute_do(int ref, int params, const char *param[]) void debugger_commands::execute_step(int ref, int params, const char *param[]) { /* if we have a parameter, use it */ - uint64_t steps = 1; + u64 steps = 1; if (!validate_number_parameter(param[0], &steps)) return; @@ -759,7 +759,7 @@ void debugger_commands::execute_step(int ref, int params, const char *param[]) void debugger_commands::execute_over(int ref, int params, const char *param[]) { /* if we have a parameter, use it */ - uint64_t steps = 1; + u64 steps = 1; if (!validate_number_parameter(param[0], &steps)) return; @@ -783,7 +783,7 @@ void debugger_commands::execute_out(int ref, int params, const char *param[]) void debugger_commands::execute_go(int ref, int params, const char *param[]) { - uint64_t addr = ~0; + u64 addr = ~0; /* if we have a parameter, use it instead */ if (!validate_number_parameter(param[0], &addr)) @@ -810,7 +810,7 @@ void debugger_commands::execute_go_vblank(int ref, int params, const char *param void debugger_commands::execute_go_interrupt(int ref, int params, const char *param[]) { - uint64_t irqline = -1; + u64 irqline = -1; /* if we have a parameter, use it instead */ if (!validate_number_parameter(param[0], &irqline)) @@ -826,7 +826,7 @@ void debugger_commands::execute_go_interrupt(int ref, int params, const char *pa void debugger_commands::execute_go_time(int ref, int params, const char *param[]) { - uint64_t milliseconds = -1; + u64 milliseconds = -1; /* if we have a parameter, use it instead */ if (!validate_number_parameter(param[0], &milliseconds)) @@ -987,7 +987,7 @@ void debugger_commands::execute_observe(int ref, int params, const char *param[] void debugger_commands::execute_comment_add(int ref, int params, const char *param[]) { device_t *cpu; - uint64_t address; + u64 address; /* param 1 is the address for the comment */ if (!validate_number_parameter(param[0], &address)) @@ -1017,7 +1017,7 @@ void debugger_commands::execute_comment_add(int ref, int params, const char *par void debugger_commands::execute_comment_del(int ref, int params, const char *param[]) { device_t *cpu; - uint64_t address; + u64 address; /* param 1 can either be a command or the address for the comment */ if (!validate_number_parameter(param[0], &address)) @@ -1093,7 +1093,7 @@ void debugger_commands::execute_bpset(int ref, int params, const char *param[]) { device_t *cpu; const char *action = nullptr; - uint64_t address; + u64 address; int bpnum; /* CPU is implicit */ @@ -1126,7 +1126,7 @@ void debugger_commands::execute_bpset(int ref, int params, const char *param[]) void debugger_commands::execute_bpclear(int ref, int params, const char *param[]) { - uint64_t bpindex; + u64 bpindex; /* if 0 parameters, clear all */ if (params == 0) @@ -1146,9 +1146,9 @@ void debugger_commands::execute_bpclear(int ref, int params, const char *param[] if (device.debug()->breakpoint_clear(bpindex)) found = true; if (found) - m_console.printf("Breakpoint %X cleared\n", (uint32_t)bpindex); + m_console.printf("Breakpoint %X cleared\n", u32(bpindex)); else - m_console.printf("Invalid breakpoint number %X\n", (uint32_t)bpindex); + m_console.printf("Invalid breakpoint number %X\n", u32(bpindex)); } } @@ -1160,7 +1160,7 @@ void debugger_commands::execute_bpclear(int ref, int params, const char *param[] void debugger_commands::execute_bpdisenable(int ref, int params, const char *param[]) { - uint64_t bpindex; + u64 bpindex; /* if 0 parameters, clear all */ if (params == 0) @@ -1183,9 +1183,9 @@ void debugger_commands::execute_bpdisenable(int ref, int params, const char *par if (device.debug()->breakpoint_enable(bpindex, ref)) found = true; if (found) - m_console.printf("Breakpoint %X %s\n", (uint32_t)bpindex, ref ? "enabled" : "disabled"); + m_console.printf("Breakpoint %X %s\n", u32(bpindex), ref ? "enabled" : "disabled"); else - m_console.printf("Invalid breakpoint number %X\n", (uint32_t)bpindex); + m_console.printf("Invalid breakpoint number %X\n", u32(bpindex)); } } @@ -1233,7 +1233,7 @@ void debugger_commands::execute_wpset(int ref, int params, const char *param[]) { address_space *space; const char *action = nullptr; - uint64_t address, length; + u64 address, length; int type; int wpnum; @@ -1284,7 +1284,7 @@ void debugger_commands::execute_wpset(int ref, int params, const char *param[]) void debugger_commands::execute_wpclear(int ref, int params, const char *param[]) { - uint64_t wpindex; + u64 wpindex; /* if 0 parameters, clear all */ if (params == 0) @@ -1304,9 +1304,9 @@ void debugger_commands::execute_wpclear(int ref, int params, const char *param[] if (device.debug()->watchpoint_clear(wpindex)) found = true; if (found) - m_console.printf("Watchpoint %X cleared\n", (uint32_t)wpindex); + m_console.printf("Watchpoint %X cleared\n", u32(wpindex)); else - m_console.printf("Invalid watchpoint number %X\n", (uint32_t)wpindex); + m_console.printf("Invalid watchpoint number %X\n", u32(wpindex)); } } @@ -1318,7 +1318,7 @@ void debugger_commands::execute_wpclear(int ref, int params, const char *param[] void debugger_commands::execute_wpdisenable(int ref, int params, const char *param[]) { - uint64_t wpindex; + u64 wpindex; /* if 0 parameters, clear all */ if (params == 0) @@ -1341,9 +1341,9 @@ void debugger_commands::execute_wpdisenable(int ref, int params, const char *par if (device.debug()->watchpoint_enable(wpindex, ref)) found = true; if (found) - m_console.printf("Watchpoint %X %s\n", (uint32_t)wpindex, ref ? "enabled" : "disabled"); + m_console.printf("Watchpoint %X %s\n", u32(wpindex), ref ? "enabled" : "disabled"); else - m_console.printf("Invalid watchpoint number %X\n", (uint32_t)wpindex); + m_console.printf("Invalid watchpoint number %X\n", u32(wpindex)); } } @@ -1426,7 +1426,7 @@ void debugger_commands::execute_rpset(int ref, int params, const char *param[]) void debugger_commands::execute_rpclear(int ref, int params, const char *param[]) { - uint64_t rpindex; + u64 rpindex; /* if 0 parameters, clear all */ if (params == 0) @@ -1446,9 +1446,9 @@ void debugger_commands::execute_rpclear(int ref, int params, const char *param[] if (device.debug()->registerpoint_clear(rpindex)) found = true; if (found) - m_console.printf("Registerpoint %X cleared\n", (uint32_t)rpindex); + m_console.printf("Registerpoint %X cleared\n", u32(rpindex)); else - m_console.printf("Invalid registerpoint number %X\n", (uint32_t)rpindex); + m_console.printf("Invalid registerpoint number %X\n", u32(rpindex)); } } @@ -1460,7 +1460,7 @@ void debugger_commands::execute_rpclear(int ref, int params, const char *param[] void debugger_commands::execute_rpdisenable(int ref, int params, const char *param[]) { - uint64_t rpindex; + u64 rpindex; /* if 0 parameters, clear all */ if (params == 0) @@ -1483,9 +1483,9 @@ void debugger_commands::execute_rpdisenable(int ref, int params, const char *par if (device.debug()->registerpoint_enable(rpindex, ref)) found = true; if (found) - m_console.printf("Registerpoint %X %s\n", (uint32_t)rpindex, ref ? "enabled" : "disabled"); + m_console.printf("Registerpoint %X %s\n", u32(rpindex), ref ? "enabled" : "disabled"); else - m_console.printf("Invalid registerpoint number %X\n", (uint32_t)rpindex); + m_console.printf("Invalid registerpoint number %X\n", u32(rpindex)); } } @@ -1552,10 +1552,10 @@ void debugger_commands::execute_hotspot(int ref, int params, const char *param[] device_t *device = nullptr; if (!validate_cpu_parameter((params > 0) ? param[0] : nullptr, &device)) return; - uint64_t count = 64; + u64 count = 64; if (!validate_number_parameter(param[1], &count)) return; - uint64_t threshhold = 250; + u64 threshhold = 250; if (!validate_number_parameter(param[2], &threshhold)) return; @@ -1602,10 +1602,10 @@ void debugger_commands::execute_stateload(int ref, int params, const char *param void debugger_commands::execute_save(int ref, int params, const char *param[]) { - uint64_t offset, endoffset, length; + u64 offset, endoffset, length; address_space *space; FILE *f; - uint64_t i; + u64 i; /* validate parameters */ if (!validate_number_parameter(param[1], &offset)) @@ -1630,7 +1630,7 @@ void debugger_commands::execute_save(int ref, int params, const char *param[]) /* now write the data out */ for (i = offset; i <= endoffset; i++) { - uint8_t byte = m_cpu.read_byte(*space, i, true); + u8 byte = m_cpu.read_byte(*space, i, true); fwrite(&byte, 1, 1, f); } @@ -1646,10 +1646,10 @@ void debugger_commands::execute_save(int ref, int params, const char *param[]) void debugger_commands::execute_load(int ref, int params, const char *param[]) { - uint64_t offset, endoffset, length; + u64 offset, endoffset, length; address_space *space; FILE *f; - uint64_t i; + u64 i; /* validate parameters */ if (!validate_number_parameter(param[1], &offset)) @@ -1672,7 +1672,7 @@ void debugger_commands::execute_load(int ref, int params, const char *param[]) } /* now read the data in, ignore endoffset and load entire file if length has been set to zero (offset-1) */ - uint8_t byte; + u8 byte; for (i = offset; i <= endoffset || endoffset == offset - 1 ; i++) { fread(&byte, 1, 1, f); @@ -1697,23 +1697,23 @@ void debugger_commands::execute_load(int ref, int params, const char *param[]) void debugger_commands::execute_dump(int ref, int params, const char *param[]) { /* validate parameters */ - uint64_t offset; + u64 offset; if (!validate_number_parameter(param[1], &offset)) return; - uint64_t length; + u64 length; if (!validate_number_parameter(param[2], &length)) return; - uint64_t width = 0; + u64 width = 0; if (!validate_number_parameter(param[3], &width)) return; - uint64_t ascii = 1; + u64 ascii = 1; if (!validate_number_parameter(param[4], &ascii)) return; - uint64_t rowsize = 16; + u64 rowsize = 16; if (!validate_number_parameter(param[5], &rowsize)) return; @@ -1737,7 +1737,7 @@ void debugger_commands::execute_dump(int ref, int params, const char *param[]) return; } - uint64_t endoffset = space->address_to_byte(offset + length - 1) & space->bytemask(); + u64 endoffset = space->address_to_byte(offset + length - 1) & space->bytemask(); offset = space->address_to_byte(offset) & space->bytemask(); /* open the file */ @@ -1751,23 +1751,23 @@ void debugger_commands::execute_dump(int ref, int params, const char *param[]) /* now write the data out */ util::ovectorstream output; output.reserve(200); - for (uint64_t i = offset; i <= endoffset; i += rowsize) + for (u64 i = offset; i <= endoffset; i += rowsize) { output.clear(); output.rdbuf()->clear(); /* print the address */ - util::stream_format(output, "%0*X: ", space->logaddrchars(), (uint32_t)space->byte_to_address(i)); + util::stream_format(output, "%0*X: ", space->logaddrchars(), u32(space->byte_to_address(i))); /* print the bytes */ - for (uint64_t j = 0; j < rowsize; j += width) + for (u64 j = 0; j < rowsize; j += width) { if (i + j <= endoffset) { offs_t curaddr = i + j; if (space->device().memory().translate(space->spacenum(), TRANSLATE_READ_DEBUG, curaddr)) { - uint64_t value = m_cpu.read_memory(*space, i + j, width, true); + u64 value = m_cpu.read_memory(*space, i + j, width, true); util::stream_format(output, " %0*X", width * 2, value); } else @@ -1783,12 +1783,12 @@ void debugger_commands::execute_dump(int ref, int params, const char *param[]) if (ascii) { util::stream_format(output, " "); - for (uint64_t j = 0; j < rowsize && (i + j) <= endoffset; j++) + for (u64 j = 0; j < rowsize && (i + j) <= endoffset; j++) { offs_t curaddr = i + j; if (space->device().memory().translate(space->spacenum(), TRANSLATE_READ_DEBUG, curaddr)) { - uint8_t byte = m_cpu.read_byte(*space, i + j, true); + u8 byte = m_cpu.read_byte(*space, i + j, true); util::stream_format(output, "%c", (byte >= 32 && byte < 127) ? byte : '.'); } else @@ -1815,11 +1815,11 @@ void debugger_commands::execute_dump(int ref, int params, const char *param[]) void debugger_commands::execute_cheatinit(int ref, int params, const char *param[]) { - uint64_t offset, length = 0, real_length = 0; + u64 offset, length = 0, real_length = 0; address_space *space; - uint32_t active_cheat = 0; - uint64_t curaddr; - uint8_t i, region_count = 0; + u32 active_cheat = 0; + u64 curaddr; + u8 i, region_count = 0; cheat_region_map cheat_region[100]; @@ -1969,10 +1969,10 @@ void debugger_commands::execute_cheatinit(int ref, int params, const char *param void debugger_commands::execute_cheatnext(int ref, int params, const char *param[]) { address_space *space; - uint64_t cheatindex; - uint32_t active_cheat = 0; - uint8_t condition; - uint64_t comp_value = 0; + u64 cheatindex; + u32 active_cheat = 0; + u8 condition; + u64 comp_value = 0; enum { @@ -2038,9 +2038,9 @@ void debugger_commands::execute_cheatnext(int ref, int params, const char *param for (cheatindex = 0; cheatindex < m_cheat.cheatmap.size(); cheatindex += 1) if (m_cheat.cheatmap[cheatindex].state == 1) { - uint64_t cheat_value = cheat_read_extended(&m_cheat, *space, m_cheat.cheatmap[cheatindex].offset); - uint64_t comp_byte = (ref == 0) ? m_cheat.cheatmap[cheatindex].previous_value : m_cheat.cheatmap[cheatindex].first_value; - uint8_t disable_byte = false; + u64 cheat_value = cheat_read_extended(&m_cheat, *space, m_cheat.cheatmap[cheatindex].offset); + u64 comp_byte = (ref == 0) ? m_cheat.cheatmap[cheatindex].previous_value : m_cheat.cheatmap[cheatindex].first_value; + u8 disable_byte = false; switch (condition) { @@ -2065,30 +2065,30 @@ void debugger_commands::execute_cheatnext(int ref, int params, const char *param case CHEAT_DECREASE: if (m_cheat.signed_cheat) - disable_byte = ((int64_t)cheat_value >= (int64_t)comp_byte); + disable_byte = (s64(cheat_value) >= s64(comp_byte)); else - disable_byte = ((uint64_t)cheat_value >= (uint64_t)comp_byte); + disable_byte = (u64(cheat_value) >= u64(comp_byte)); break; case CHEAT_INCREASE: if (m_cheat.signed_cheat) - disable_byte = ((int64_t)cheat_value <= (int64_t)comp_byte); + disable_byte = (s64(cheat_value) <= s64(comp_byte)); else - disable_byte = ((uint64_t)cheat_value <= (uint64_t)comp_byte); + disable_byte = (u64(cheat_value) <= u64(comp_byte)); break; case CHEAT_DECREASE_OR_EQUAL: if (m_cheat.signed_cheat) - disable_byte = ((int64_t)cheat_value > (int64_t)comp_byte); + disable_byte = (s64(cheat_value) > s64(comp_byte)); else - disable_byte = ((uint64_t)cheat_value > (uint64_t)comp_byte); + disable_byte = (u64(cheat_value) > u64(comp_byte)); break; case CHEAT_INCREASE_OR_EQUAL: if (m_cheat.signed_cheat) - disable_byte = ((int64_t)cheat_value < (int64_t)comp_byte); + disable_byte = (s64(cheat_value) < s64(comp_byte)); else - disable_byte = ((uint64_t)cheat_value < (uint64_t)comp_byte); + disable_byte = (u64(cheat_value) < u64(comp_byte)); break; case CHEAT_DECREASEOF: @@ -2101,16 +2101,16 @@ void debugger_commands::execute_cheatnext(int ref, int params, const char *param case CHEAT_SMALLEROF: if (m_cheat.signed_cheat) - disable_byte = ((int64_t)cheat_value >= (int64_t)comp_value); + disable_byte = (s64(cheat_value) >= s64(comp_value)); else - disable_byte = ((uint64_t)cheat_value >= (uint64_t)comp_value); + disable_byte = (u64(cheat_value) >= u64(comp_value)); break; case CHEAT_GREATEROF: if (m_cheat.signed_cheat) - disable_byte = ((int64_t)cheat_value <= (int64_t)comp_value); + disable_byte = (s64(cheat_value) <= s64(comp_value)); else - disable_byte = ((uint64_t)cheat_value <= (uint64_t)comp_value); + disable_byte = (u64(cheat_value) <= u64(comp_value)); break; case CHEAT_CHANGEDBY: if (cheat_value > comp_byte) @@ -2148,9 +2148,9 @@ void debugger_commands::execute_cheatlist(int ref, int params, const char *param char spaceletter, sizeletter; address_space *space; device_t *cpu; - uint32_t active_cheat = 0; - uint64_t cheatindex; - uint64_t sizemask; + u32 active_cheat = 0; + u64 cheatindex; + u64 sizemask; FILE *f = nullptr; if (!validate_cpu_space_parameter(m_cheat.cpu, AS_PROGRAM, space)) @@ -2173,10 +2173,10 @@ void debugger_commands::execute_cheatlist(int ref, int params, const char *param switch (m_cheat.width) { default: - case 1: sizeletter = 'b'; sizemask = 0xff; break; - case 2: sizeletter = 'w'; sizemask = 0xffff; break; - case 4: sizeletter = 'd'; sizemask = 0xffffffff; break; - case 8: sizeletter = 'q'; sizemask = U64(0xffffffffffffffff); break; + case 1: sizeletter = 'b'; sizemask = 0xffU; break; + case 2: sizeletter = 'w'; sizemask = 0xffffU; break; + case 4: sizeletter = 'd'; sizemask = 0xffffffffU; break; + case 8: sizeletter = 'q'; sizemask = 0xffffffffffffffffU; break; } /* write the cheat list */ @@ -2185,7 +2185,7 @@ void debugger_commands::execute_cheatlist(int ref, int params, const char *param { if (m_cheat.cheatmap[cheatindex].state == 1) { - uint64_t value = cheat_byte_swap(&m_cheat, cheat_read_extended(&m_cheat, *space, m_cheat.cheatmap[cheatindex].offset)) & sizemask; + u64 value = cheat_byte_swap(&m_cheat, cheat_read_extended(&m_cheat, *space, m_cheat.cheatmap[cheatindex].offset)) & sizemask; offs_t address = space->byte_to_address(m_cheat.cheatmap[cheatindex].offset); if (params > 0) @@ -2226,8 +2226,8 @@ void debugger_commands::execute_cheatlist(int ref, int params, const char *param void debugger_commands::execute_cheatundo(int ref, int params, const char *param[]) { - uint64_t cheatindex; - uint32_t undo_count = 0; + u64 cheatindex; + u32 undo_count = 0; if (m_cheat.undo > 0) { @@ -2255,10 +2255,10 @@ void debugger_commands::execute_cheatundo(int ref, int params, const char *param void debugger_commands::execute_find(int ref, int params, const char *param[]) { - uint64_t offset, endoffset, length; + u64 offset, endoffset, length; address_space *space; - uint64_t data_to_find[256]; - uint8_t data_size[256]; + u64 data_to_find[256]; + u8 data_size[256]; int cur_data_size; int data_count = 0; int found = 0; @@ -2300,10 +2300,10 @@ void debugger_commands::execute_find(int ref, int params, const char *param[]) { /* check for a 'b','w','d',or 'q' prefix */ data_size[data_count] = cur_data_size; - if (tolower((uint8_t)pdata[0]) == 'b' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 1; pdata += 2; } - if (tolower((uint8_t)pdata[0]) == 'w' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 2; pdata += 2; } - if (tolower((uint8_t)pdata[0]) == 'd' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 4; pdata += 2; } - if (tolower((uint8_t)pdata[0]) == 'q' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 8; pdata += 2; } + if (tolower(u8(pdata[0])) == 'b' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 1; pdata += 2; } + if (tolower(u8(pdata[0])) == 'w' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 2; pdata += 2; } + if (tolower(u8(pdata[0])) == 'd' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 4; pdata += 2; } + if (tolower(u8(pdata[0])) == 'q' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 8; pdata += 2; } /* look for a wildcard */ if (!strcmp(pdata, "?")) @@ -2316,7 +2316,7 @@ void debugger_commands::execute_find(int ref, int params, const char *param[]) } /* now search */ - for (uint64_t i = offset; i <= endoffset; i += data_size[0]) + for (u64 i = offset; i <= endoffset; i += data_size[0]) { int suboffset = 0; int match = 1; @@ -2326,10 +2326,10 @@ void debugger_commands::execute_find(int ref, int params, const char *param[]) { switch (data_size[j]) { - case 1: match = ((uint8_t)m_cpu.read_byte(*space, i + suboffset, true) == (uint8_t)data_to_find[j]); break; - case 2: match = ((uint16_t)m_cpu.read_word(*space, i + suboffset, true) == (uint16_t)data_to_find[j]); break; - case 4: match = ((uint32_t)m_cpu.read_dword(*space, i + suboffset, true) == (uint32_t)data_to_find[j]); break; - case 8: match = ((uint64_t)m_cpu.read_qword(*space, i + suboffset, true) == (uint64_t)data_to_find[j]); break; + case 1: match = (u8(m_cpu.read_byte(*space, i + suboffset, true)) == u8(data_to_find[j])); break; + case 2: match = (u16(m_cpu.read_word(*space, i + suboffset, true)) == u16(data_to_find[j])); break; + case 4: match = (u32(m_cpu.read_dword(*space, i + suboffset, true)) == u32(data_to_find[j])); break; + case 8: match = (u64(m_cpu.read_qword(*space, i + suboffset, true)) == u64(data_to_find[j])); break; default: /* all other cases are wildcards */ break; } suboffset += data_size[j] & 0x0f; @@ -2339,7 +2339,7 @@ void debugger_commands::execute_find(int ref, int params, const char *param[]) if (match) { found++; - m_console.printf("Found at %0*X\n", space->addrchars(), (uint32_t)space->byte_to_address(i)); + m_console.printf("Found at %0*X\n", space->addrchars(), u32(space->byte_to_address(i))); } } @@ -2355,7 +2355,7 @@ void debugger_commands::execute_find(int ref, int params, const char *param[]) void debugger_commands::execute_dasm(int ref, int params, const char *param[]) { - uint64_t offset, length, bytes = 1; + u64 offset, length, bytes = 1; int minbytes, maxbytes, byteswidth; address_space *space, *decrypted_space; FILE *f; @@ -2402,7 +2402,7 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[]) /* now write the data out */ util::ovectorstream output; output.reserve(512); - for (uint64_t i = 0; i < length; ) + for (u64 i = 0; i < length; ) { int pcbyte = space->address_to_byte(offset + i) & space->bytemask(); char disasm[200]; @@ -2413,13 +2413,13 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[]) output.rdbuf()->clear(); /* print the address */ - stream_format(output, "%0*X: ", space->logaddrchars(), (uint32_t)space->byte_to_address(pcbyte)); + stream_format(output, "%0*X: ", space->logaddrchars(), u32(space->byte_to_address(pcbyte))); /* make sure we can translate the address */ tempaddr = pcbyte; if (space->device().memory().translate(space->spacenum(), TRANSLATE_FETCH_DEBUG, tempaddr)) { - uint8_t opbuf[64], argbuf[64]; + u8 opbuf[64], argbuf[64]; /* fetch the bytes up to the maximum */ for (numbytes = 0; numbytes < maxbytes; numbytes++) @@ -2573,7 +2573,7 @@ void debugger_commands::execute_history(int ref, int params, const char *param[] else decrypted_space = space; - uint64_t count = device_debug::HISTORY_SIZE; + u64 count = device_debug::HISTORY_SIZE; if (!validate_number_parameter(param[1], &count)) return; @@ -2597,7 +2597,7 @@ void debugger_commands::execute_history(int ref, int params, const char *param[] /* fetch the bytes up to the maximum */ offs_t pcbyte = space->address_to_byte(pc) & space->bytemask(); - uint8_t opbuf[64], argbuf[64]; + u8 opbuf[64], argbuf[64]; for (int numbytes = 0; numbytes < maxbytes; numbytes++) { opbuf[numbytes] = m_cpu.read_opcode(*decrypted_space, pcbyte + numbytes, 1); @@ -2619,7 +2619,7 @@ void debugger_commands::execute_history(int ref, int params, const char *param[] void debugger_commands::execute_trackpc(int ref, int params, const char *param[]) { // Gather the on/off switch (if present) - uint64_t turnOn = true; + u64 turnOn = true; if (!validate_number_parameter(param[0], &turnOn)) return; @@ -2629,7 +2629,7 @@ void debugger_commands::execute_trackpc(int ref, int params, const char *param[] return; // Should we clear the existing data? - uint64_t clear = false; + u64 clear = false; if (!validate_number_parameter(param[2], &clear)) return; @@ -2661,7 +2661,7 @@ void debugger_commands::execute_trackpc(int ref, int params, const char *param[] void debugger_commands::execute_trackmem(int ref, int params, const char *param[]) { // Gather the on/off switch (if present) - uint64_t turnOn = true; + u64 turnOn = true; if (!validate_number_parameter(param[0], &turnOn)) return; @@ -2671,7 +2671,7 @@ void debugger_commands::execute_trackmem(int ref, int params, const char *param[ return; // Should we clear the existing data? - uint64_t clear = false; + u64 clear = false; if (!validate_number_parameter(param[2], &clear)) return; @@ -2699,7 +2699,7 @@ void debugger_commands::execute_trackmem(int ref, int params, const char *param[ void debugger_commands::execute_pcatmem(int ref, int params, const char *param[]) { // Gather the required address parameter - uint64_t address; + u64 address; if (!validate_number_parameter(param[0], &address)) return; @@ -2715,7 +2715,7 @@ void debugger_commands::execute_pcatmem(int ref, int params, const char *param[] // Get the value of memory at the address const int native_data_width = space->data_width() / 8; - const uint64_t data = m_cpu.read_memory(*space, space->address_to_byte(address), native_data_width, true); + const u64 data = m_cpu.read_memory(*space, space->address_to_byte(address), native_data_width, true); // Recover the pc & print const address_spacenum space_num = (address_spacenum)ref; @@ -2791,7 +2791,7 @@ void debugger_commands::execute_map(int ref, int params, const char *param[]) { address_space *space; offs_t taddress; - uint64_t address; + u64 address; int intention; /* validate parameters */ @@ -2899,7 +2899,7 @@ void debugger_commands::execute_symlist(int ref, int params, const char **param) { const symbol_entry *entry = symtable->find(namelist[symnum]); assert(entry != nullptr); - uint64_t value = entry->value(); + u64 value = entry->value(); /* only display "register" type symbols */ m_console.printf("%s = %X", namelist[symnum], value); diff --git a/src/emu/debug/debugcmd.h b/src/emu/debug/debugcmd.h index b65b49b68ea..ac57622abd5 100644 --- a/src/emu/debug/debugcmd.h +++ b/src/emu/debug/debugcmd.h @@ -8,10 +8,10 @@ *********************************************************************/ -#pragma once +#ifndef MAME_EMU_DEBUG_DEBUGCMD_H +#define MAME_EMU_DEBUG_DEBUGCMD_H -#ifndef __DEBUGCMD_H__ -#define __DEBUGCMD_H__ +#pragma once #include "emu.h" #include "debugcpu.h" @@ -29,7 +29,7 @@ public: bool validate_boolean_parameter(const char *param, bool *result); /* validates a parameter as a numeric value */ - bool validate_number_parameter(const char *param, uint64_t *result); + bool validate_number_parameter(const char *param, u64 *result); /* validates a parameter as a cpu */ bool validate_cpu_parameter(const char *param, device_t **result); @@ -41,55 +41,55 @@ private: struct global_entry { void * base; - uint32_t size; + u32 size; }; struct cheat_map { - uint64_t offset; - uint64_t first_value; - uint64_t previous_value; - uint8_t state:1; - uint8_t undo:7; + u64 offset; + u64 first_value; + u64 previous_value; + u8 state:1; + u8 undo:7; }; // TODO [RH 31 May 2016]: Move this cheat stuff into its own class struct cheat_system { char cpu[2]; - uint8_t width; + u8 width; std::vector<cheat_map> cheatmap; - uint8_t undo; - uint8_t signed_cheat; - uint8_t swapped_cheat; + u8 undo; + u8 signed_cheat; + u8 swapped_cheat; }; struct cheat_region_map { - uint64_t offset; - uint64_t endoffset; + u64 offset; + u64 endoffset; const char *share; - uint8_t disabled; + u8 disabled; }; bool debug_command_parameter_expression(const char *param, parsed_expression &result); bool debug_command_parameter_command(const char *param); bool cheat_address_is_valid(address_space &space, offs_t address); - uint64_t cheat_sign_extend(const cheat_system *cheatsys, uint64_t value); - uint64_t cheat_byte_swap(const cheat_system *cheatsys, uint64_t value); - uint64_t cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address); + u64 cheat_sign_extend(const cheat_system *cheatsys, u64 value); + u64 cheat_byte_swap(const cheat_system *cheatsys, u64 value); + u64 cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address); - uint64_t execute_min(symbol_table &table, void *ref, int params, const uint64_t *param); - uint64_t execute_max(symbol_table &table, void *ref, int params, const uint64_t *param); - uint64_t execute_if(symbol_table &table, void *ref, int params, const uint64_t *param); + u64 execute_min(symbol_table &table, void *ref, int params, const u64 *param); + u64 execute_max(symbol_table &table, void *ref, int params, const u64 *param); + u64 execute_if(symbol_table &table, void *ref, int params, const u64 *param); - uint64_t global_get(symbol_table &table, void *ref); - void global_set(symbol_table &table, void *ref, uint64_t value); + u64 global_get(symbol_table &table, void *ref); + void global_set(symbol_table &table, void *ref, u64 value); - int mini_printf(char *buffer, const char *format, int params, uint64_t *param); + int mini_printf(char *buffer, const char *format, int params, u64 *param); void execute_trace_internal(int ref, int params, const char *param[], bool trace_over); @@ -161,8 +161,8 @@ private: void execute_dumpkbd(int ref, int params, const char **param); running_machine& m_machine; - debugger_cpu& m_cpu; - debugger_console& m_console; + debugger_cpu& m_cpu; + debugger_console& m_console; global_entry *m_global_array; cheat_system m_cheat; @@ -170,4 +170,4 @@ private: static const size_t MAX_GLOBALS; }; -#endif +#endif // MAME_EMU_DEBUG_DEBUGCMD_H diff --git a/src/emu/debug/debugcon.cpp b/src/emu/debug/debugcon.cpp index b0a7e1dd2a4..8cd565cbfa1 100644 --- a/src/emu/debug/debugcon.cpp +++ b/src/emu/debug/debugcon.cpp @@ -165,12 +165,12 @@ CMDERR debugger_console::internal_execute_command(bool execute, int params, char return CMDERR_NONE; /* the first parameter has the command and the real first parameter; separate them */ - for (p = param[0]; *p && isspace((uint8_t)*p); p++) { } - for (command = p; *p && !isspace((uint8_t)*p); p++) { } + for (p = param[0]; *p && isspace(u8(*p)); p++) { } + for (command = p; *p && !isspace(u8(*p)); p++) { } if (*p != 0) { *p++ = 0; - for ( ; *p && isspace((uint8_t)*p); p++) { } + for ( ; *p && isspace(u8(*p)); p++) { } if (*p != 0) param[0] = p; else @@ -271,7 +271,7 @@ CMDERR debugger_console::internal_parse_command(const char *original_command, bo case '+': if (parendex == 0 && paramcount == 1 && p[1] == '+') isexpr = true; *p = c; break; case '=': if (parendex == 0 && paramcount == 1) isexpr = true; *p = c; break; case 0: foundend = true; break; - default: *p = tolower((uint8_t)c); break; + default: *p = tolower(u8(c)); break; } } } @@ -290,7 +290,7 @@ CMDERR debugger_console::internal_parse_command(const char *original_command, bo command_start = params[0]; /* allow for "do" commands */ - if (tolower((uint8_t)command_start[0] == 'd') && tolower((uint8_t)command_start[1] == 'o') && isspace((uint8_t)command_start[2])) + if (tolower(u8(command_start[0])) == 'd' && tolower(u8(command_start[1])) == 'o' && isspace(u8(command_start[2]))) { isexpr = true; command_start += 3; @@ -301,7 +301,7 @@ CMDERR debugger_console::internal_parse_command(const char *original_command, bo { try { - uint64_t expresult; + u64 expresult; parsed_expression expression(m_machine.debugger().cpu().get_visible_symtable(), command_start, &expresult); } catch (expression_error &err) @@ -368,7 +368,7 @@ CMDERR debugger_console::validate_command(const char *command) register_command - register a command handler -------------------------------------------------*/ -void debugger_console::register_command(const char *command, uint32_t flags, int ref, int minparams, int maxparams, std::function<void(int, int, const char **)> handler) +void debugger_console::register_command(const char *command, u32 flags, int ref, int minparams, int maxparams, std::function<void(int, int, const char **)> handler) { assert_always(m_machine.phase() == MACHINE_PHASE_INIT, "Can only call register_command() at init time!"); assert_always((m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0, "Cannot call register_command() when debugger is not running"); diff --git a/src/emu/debug/debugcon.h b/src/emu/debug/debugcon.h index 7a06c68c5f1..cd226c93866 100644 --- a/src/emu/debug/debugcon.h +++ b/src/emu/debug/debugcon.h @@ -67,7 +67,7 @@ ***************************************************************************/ /* CMDERR is an error code for command evaluation */ -typedef uint32_t CMDERR; +typedef u32 CMDERR; class debugger_console { @@ -77,7 +77,7 @@ public: /* command handling */ CMDERR execute_command(const char *command, bool echo); CMDERR validate_command(const char *command); - void register_command(const char *command, uint32_t flags, int ref, int minparams, int maxparams, std::function<void(int, int, const char **)> handler); + void register_command(const char *command, u32 flags, int ref, int minparams, int maxparams, std::function<void(int, int, const char **)> handler); /* console management */ void vprintf(util::format_argument_pack<std::ostream> const &args); @@ -118,7 +118,7 @@ private: const char * params; const char * help; std::function<void(int, int, const char **)> handler; - uint32_t flags; + u32 flags; int ref; int minparams; int maxparams; diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index b8ef947b4f8..ba1b6d4f9a7 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -52,7 +52,7 @@ debugger_cpu::debugger_cpu(running_machine &machine) { screen_device *first_screen = m_machine.first_screen(); - m_tempvar = make_unique_clear<uint64_t[]>(NUM_TEMP_VARIABLES); + m_tempvar = make_unique_clear<u64[]>(NUM_TEMP_VARIABLES); /* create a global symbol table */ m_symtable = std::make_unique<symbol_table>(&m_machine); @@ -357,7 +357,7 @@ bool debugger_cpu::comment_load(bool is_inline) memory space -------------------------------------------------*/ -uint8_t debugger_cpu::read_byte(address_space &space, offs_t address, bool apply_translation) +u8 debugger_cpu::read_byte(address_space &space, offs_t address, bool apply_translation) { device_memory_interface &memory = space.device().memory(); @@ -369,8 +369,8 @@ uint8_t debugger_cpu::read_byte(address_space &space, offs_t address, bool apply space.set_debugger_access(true); /* translate if necessary; if not mapped, return 0xff */ - uint64_t custom; - uint8_t result; + u64 custom; + u8 result; if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { result = 0xff; @@ -396,16 +396,16 @@ uint8_t debugger_cpu::read_byte(address_space &space, offs_t address, bool apply memory space -------------------------------------------------*/ -uint16_t debugger_cpu::read_word(address_space &space, offs_t address, bool apply_translation) +u16 debugger_cpu::read_word(address_space &space, offs_t address, bool apply_translation) { /* mask against the logical byte mask */ address &= space.logbytemask(); - uint16_t result; + u16 result; if (!WORD_ALIGNED(address)) { /* if this is misaligned read, or if there are no word readers, just read two bytes */ - uint8_t byte0 = read_byte(space, address + 0, apply_translation); - uint8_t byte1 = read_byte(space, address + 1, apply_translation); + u8 byte0 = read_byte(space, address + 0, apply_translation); + u8 byte1 = read_byte(space, address + 1, apply_translation); /* based on the endianness, the result is assembled differently */ if (space.endianness() == ENDIANNESS_LITTLE) @@ -422,7 +422,7 @@ uint16_t debugger_cpu::read_word(address_space &space, offs_t address, bool appl space.set_debugger_access(true); /* translate if necessary; if not mapped, return 0xffff */ - uint64_t custom; + u64 custom; if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { result = 0xffff; @@ -450,16 +450,16 @@ uint16_t debugger_cpu::read_word(address_space &space, offs_t address, bool appl memory space -------------------------------------------------*/ -uint32_t debugger_cpu::read_dword(address_space &space, offs_t address, bool apply_translation) +u32 debugger_cpu::read_dword(address_space &space, offs_t address, bool apply_translation) { /* mask against the logical byte mask */ address &= space.logbytemask(); - uint32_t result; + u32 result; if (!DWORD_ALIGNED(address)) { /* if this is a misaligned read, or if there are no dword readers, just read two words */ - uint16_t word0 = read_word(space, address + 0, apply_translation); - uint16_t word1 = read_word(space, address + 2, apply_translation); + u16 word0 = read_word(space, address + 0, apply_translation); + u16 word1 = read_word(space, address + 2, apply_translation); /* based on the endianness, the result is assembled differently */ if (space.endianness() == ENDIANNESS_LITTLE) @@ -475,7 +475,7 @@ uint32_t debugger_cpu::read_dword(address_space &space, offs_t address, bool app m_debugger_access = true; space.set_debugger_access(true); - uint64_t custom; + u64 custom; if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { /* translate if necessary; if not mapped, return 0xffffffff */ result = 0xffffffff; @@ -503,22 +503,22 @@ uint32_t debugger_cpu::read_dword(address_space &space, offs_t address, bool app memory space -------------------------------------------------*/ -uint64_t debugger_cpu::read_qword(address_space &space, offs_t address, bool apply_translation) +u64 debugger_cpu::read_qword(address_space &space, offs_t address, bool apply_translation) { /* mask against the logical byte mask */ address &= space.logbytemask(); - uint64_t result; + u64 result; if (!QWORD_ALIGNED(address)) { /* if this is a misaligned read, or if there are no qword readers, just read two dwords */ - uint32_t dword0 = read_dword(space, address + 0, apply_translation); - uint32_t dword1 = read_dword(space, address + 4, apply_translation); + u32 dword0 = read_dword(space, address + 0, apply_translation); + u32 dword1 = read_dword(space, address + 4, apply_translation); /* based on the endianness, the result is assembled differently */ if (space.endianness() == ENDIANNESS_LITTLE) - result = dword0 | ((uint64_t)dword1 << 32); + result = dword0 | (u64(dword1) << 32); else - result = dword1 | ((uint64_t)dword0 << 32); + result = dword1 | (u64(dword0) << 32); } else { /* otherwise, this proceeds like the byte case */ @@ -529,10 +529,10 @@ uint64_t debugger_cpu::read_qword(address_space &space, offs_t address, bool app space.set_debugger_access(true); /* translate if necessary; if not mapped, return 0xffffffffffffffff */ - uint64_t custom; + u64 custom; if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { - result = ~(uint64_t)0; + result = ~u64(0); } else if (memory.read(space.spacenum(), address, 8, custom)) { /* if there is a custom read handler, and it returns true, use that value */ @@ -557,9 +557,9 @@ uint64_t debugger_cpu::read_qword(address_space &space, offs_t address, bool app from the specified memory space -------------------------------------------------*/ -uint64_t debugger_cpu::read_memory(address_space &space, offs_t address, int size, bool apply_translation) +u64 debugger_cpu::read_memory(address_space &space, offs_t address, int size, bool apply_translation) { - uint64_t result = ~(uint64_t)0 >> (64 - 8*size); + u64 result = ~u64(0) >> (64 - 8*size); switch (size) { case 1: result = read_byte(space, address, apply_translation); break; @@ -576,7 +576,7 @@ uint64_t debugger_cpu::read_memory(address_space &space, offs_t address, int siz memory space -------------------------------------------------*/ -void debugger_cpu::write_byte(address_space &space, offs_t address, uint8_t data, bool apply_translation) +void debugger_cpu::write_byte(address_space &space, offs_t address, u8 data, bool apply_translation) { device_memory_interface &memory = space.device().memory(); @@ -612,7 +612,7 @@ void debugger_cpu::write_byte(address_space &space, offs_t address, uint8_t data memory space -------------------------------------------------*/ -void debugger_cpu::write_word(address_space &space, offs_t address, uint16_t data, bool apply_translation) +void debugger_cpu::write_word(address_space &space, offs_t address, u16 data, bool apply_translation) { /* mask against the logical byte mask */ address &= space.logbytemask(); @@ -667,7 +667,7 @@ void debugger_cpu::write_word(address_space &space, offs_t address, uint16_t dat memory space -------------------------------------------------*/ -void debugger_cpu::write_dword(address_space &space, offs_t address, uint32_t data, bool apply_translation) +void debugger_cpu::write_dword(address_space &space, offs_t address, u32 data, bool apply_translation) { /* mask against the logical byte mask */ address &= space.logbytemask(); @@ -721,7 +721,7 @@ void debugger_cpu::write_dword(address_space &space, offs_t address, uint32_t da memory space -------------------------------------------------*/ -void debugger_cpu::write_qword(address_space &space, offs_t address, uint64_t data, bool apply_translation) +void debugger_cpu::write_qword(address_space &space, offs_t address, u64 data, bool apply_translation) { /* mask against the logical byte mask */ address &= space.logbytemask(); @@ -776,7 +776,7 @@ void debugger_cpu::write_qword(address_space &space, offs_t address, uint64_t da specified memory space -------------------------------------------------*/ -void debugger_cpu::write_memory(address_space &space, offs_t address, uint64_t data, int size, bool apply_translation) +void debugger_cpu::write_memory(address_space &space, offs_t address, u64 data, int size, bool apply_translation) { switch (size) { @@ -793,11 +793,11 @@ void debugger_cpu::write_memory(address_space &space, offs_t address, uint64_t d given offset from opcode space -------------------------------------------------*/ -uint64_t debugger_cpu::read_opcode(address_space &space, offs_t address, int size) +u64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size) { device_memory_interface &memory = space.device().memory(); - uint64_t result = ~(uint64_t)0 & (~(uint64_t)0 >> (64 - 8*size)), result2; + u64 result = ~u64(0) & (~u64(0) >> (64 - 8*size)), result2; /* keep in logical range */ address &= space.logbytemask(); @@ -816,8 +816,8 @@ uint64_t debugger_cpu::read_opcode(address_space &space, offs_t address, int siz if (size > space.data_width() / 8) { int halfsize = size / 2; - uint64_t r0 = read_opcode(space, address + 0, halfsize); - uint64_t r1 = read_opcode(space, address + halfsize, halfsize); + u64 r0 = read_opcode(space, address + 0, halfsize); + u64 r1 = read_opcode(space, address + halfsize, halfsize); if (space.endianness() == ENDIANNESS_LITTLE) return r0 | (r1 << (8 * halfsize)); @@ -1005,7 +1005,7 @@ void debugger_cpu::process_source_file() /* strip whitespace */ int i = (int)strlen(buf); - while((i > 0) && (isspace((uint8_t)buf[i-1]))) + while((i > 0) && (isspace(u8(buf[i-1])))) buf[--i] = '\0'; /* execute the command */ @@ -1040,7 +1040,7 @@ device_t* debugger_cpu::expression_get_device(const char *tag) space -------------------------------------------------*/ -uint64_t debugger_cpu::expression_read_memory(void *param, const char *name, expression_space spacenum, uint32_t address, int size) +u64 debugger_cpu::expression_read_memory(void *param, const char *name, expression_space spacenum, u32 address, int size) { switch (spacenum) { @@ -1126,9 +1126,9 @@ uint64_t debugger_cpu::expression_read_memory(void *param, const char *name, exp directly from an opcode or RAM pointer -------------------------------------------------*/ -uint64_t debugger_cpu::expression_read_program_direct(address_space &space, int opcode, offs_t address, int size) +u64 debugger_cpu::expression_read_program_direct(address_space &space, int opcode, offs_t address, int size) { - uint8_t *base; + u8 *base; /* adjust the address into a byte address, but not if being called recursively */ if ((opcode & 2) == 0) @@ -1140,8 +1140,8 @@ uint64_t debugger_cpu::expression_read_program_direct(address_space &space, int int halfsize = size / 2; /* read each half, from lower address to upper address */ - uint64_t r0 = expression_read_program_direct(space, opcode | 2, address + 0, halfsize); - uint64_t r1 = expression_read_program_direct(space, opcode | 2, address + halfsize, halfsize); + u64 r0 = expression_read_program_direct(space, opcode | 2, address + 0, halfsize); + u64 r1 = expression_read_program_direct(space, opcode | 2, address + halfsize, halfsize); /* assemble based on the target endianness */ if (space.endianness() == ENDIANNESS_LITTLE) @@ -1157,7 +1157,7 @@ uint64_t debugger_cpu::expression_read_program_direct(address_space &space, int offs_t lowmask = space.data_width() / 8 - 1; /* get the base of memory, aligned to the address minus the lowbits */ - base = (uint8_t *)space.get_read_ptr(address & ~lowmask); + base = (u8 *)space.get_read_ptr(address & ~lowmask); /* if we have a valid base, return the appropriate byte */ if (base != nullptr) @@ -1178,10 +1178,10 @@ uint64_t debugger_cpu::expression_read_program_direct(address_space &space, int from a memory region -------------------------------------------------*/ -uint64_t debugger_cpu::expression_read_memory_region(const char *rgntag, offs_t address, int size) +u64 debugger_cpu::expression_read_memory_region(const char *rgntag, offs_t address, int size) { memory_region *region = m_machine.root_device().memregion(rgntag); - uint64_t result = ~(uint64_t)0 >> (64 - 8*size); + u64 result = ~u64(0) >> (64 - 8*size); /* make sure we get a valid base before proceeding */ if (region != nullptr) @@ -1190,7 +1190,7 @@ uint64_t debugger_cpu::expression_read_memory_region(const char *rgntag, offs_t if (size > 1) { int halfsize = size / 2; - uint64_t r0, r1; + u64 r0, r1; /* read each half, from lower address to upper address */ r0 = expression_read_memory_region(rgntag, address + 0, halfsize); @@ -1207,8 +1207,8 @@ uint64_t debugger_cpu::expression_read_memory_region(const char *rgntag, offs_t else if (address < region->bytes()) { /* lowmask specified which address bits are within the databus width */ - uint32_t lowmask = region->bytewidth() - 1; - uint8_t *base = region->base() + (address & ~lowmask); + u32 lowmask = region->bytewidth() - 1; + u8 *base = region->base() + (address & ~lowmask); /* if we have a valid base, return the appropriate byte */ if (region->endianness() == ENDIANNESS_LITTLE) @@ -1227,7 +1227,7 @@ uint64_t debugger_cpu::expression_read_memory_region(const char *rgntag, offs_t space -------------------------------------------------*/ -void debugger_cpu::expression_write_memory(void *param, const char *name, expression_space spacenum, uint32_t address, int size, uint64_t data) +void debugger_cpu::expression_write_memory(void *param, const char *name, expression_space spacenum, u32 address, int size, u64 data) { device_t *device = nullptr; device_memory_interface *memory; @@ -1299,7 +1299,7 @@ void debugger_cpu::expression_write_memory(void *param, const char *name, expres directly to an opcode or RAM pointer -------------------------------------------------*/ -void debugger_cpu::expression_write_program_direct(address_space &space, int opcode, offs_t address, int size, uint64_t data) +void debugger_cpu::expression_write_program_direct(address_space &space, int opcode, offs_t address, int size, u64 data) { /* adjust the address into a byte address, but not if being called recursively */ if ((opcode & 2) == 0) @@ -1311,8 +1311,8 @@ void debugger_cpu::expression_write_program_direct(address_space &space, int opc int halfsize = size / 2; /* break apart based on the target endianness */ - uint64_t halfmask = ~(uint64_t)0 >> (64 - 8 * halfsize); - uint64_t r0, r1; + u64 halfmask = ~u64(0) >> (64 - 8 * halfsize); + u64 r0, r1; if (space.endianness() == ENDIANNESS_LITTLE) { r0 = data & halfmask; @@ -1336,7 +1336,7 @@ void debugger_cpu::expression_write_program_direct(address_space &space, int opc offs_t lowmask = space.data_width() / 8 - 1; /* get the base of memory, aligned to the address minus the lowbits */ - uint8_t *base = (uint8_t *)space.get_read_ptr(address & ~lowmask); + u8 *base = (u8 *)space.get_read_ptr(address & ~lowmask); /* if we have a valid base, write the appropriate byte */ if (base != nullptr) @@ -1356,7 +1356,7 @@ void debugger_cpu::expression_write_program_direct(address_space &space, int opc from a memory region -------------------------------------------------*/ -void debugger_cpu::expression_write_memory_region(const char *rgntag, offs_t address, int size, uint64_t data) +void debugger_cpu::expression_write_memory_region(const char *rgntag, offs_t address, int size, u64 data) { memory_region *region = m_machine.root_device().memregion(rgntag); @@ -1369,8 +1369,8 @@ void debugger_cpu::expression_write_memory_region(const char *rgntag, offs_t add int halfsize = size / 2; /* break apart based on the target endianness */ - uint64_t halfmask = ~(uint64_t)0 >> (64 - 8 * halfsize); - uint64_t r0, r1; + u64 halfmask = ~u64(0) >> (64 - 8 * halfsize); + u64 r0, r1; if (region->endianness() == ENDIANNESS_LITTLE) { r0 = data & halfmask; @@ -1391,8 +1391,8 @@ void debugger_cpu::expression_write_memory_region(const char *rgntag, offs_t add else if (address < region->bytes()) { /* lowmask specified which address bits are within the databus width */ - uint32_t lowmask = region->bytewidth() - 1; - uint8_t *base = region->base() + (address & ~lowmask); + u32 lowmask = region->bytewidth() - 1; + u8 *base = region->base() + (address & ~lowmask); /* if we have a valid base, set the appropriate byte */ if (region->endianness() == ENDIANNESS_LITTLE) @@ -1491,7 +1491,7 @@ expression_error::error_code debugger_cpu::expression_validate(void *param, cons get_beamx - get beam horizontal position -------------------------------------------------*/ -uint64_t debugger_cpu::get_beamx(symbol_table &table, void *ref) +u64 debugger_cpu::get_beamx(symbol_table &table, void *ref) { screen_device *screen = reinterpret_cast<screen_device *>(ref); return (screen != nullptr) ? screen->hpos() : 0; @@ -1502,7 +1502,7 @@ uint64_t debugger_cpu::get_beamx(symbol_table &table, void *ref) get_beamy - get beam vertical position -------------------------------------------------*/ -uint64_t debugger_cpu::get_beamy(symbol_table &table, void *ref) +u64 debugger_cpu::get_beamy(symbol_table &table, void *ref) { screen_device *screen = reinterpret_cast<screen_device *>(ref); return (screen != nullptr) ? screen->vpos() : 0; @@ -1513,7 +1513,7 @@ uint64_t debugger_cpu::get_beamy(symbol_table &table, void *ref) get_frame - get current frame number -------------------------------------------------*/ -uint64_t debugger_cpu::get_frame(symbol_table &table, void *ref) +u64 debugger_cpu::get_frame(symbol_table &table, void *ref) { screen_device *screen = reinterpret_cast<screen_device *>(ref); return (screen != nullptr) ? screen->frame_number() : 0; @@ -1525,7 +1525,7 @@ uint64_t debugger_cpu::get_frame(symbol_table &table, void *ref) 'cpunum' symbol -------------------------------------------------*/ -uint64_t debugger_cpu::get_cpunum(symbol_table &table, void *ref) +u64 debugger_cpu::get_cpunum(symbol_table &table, void *ref) { execute_interface_iterator iter(m_machine.root_device()); return iter.indexof(m_visiblecpu->execute()); @@ -1825,7 +1825,7 @@ void device_debug::instruction_hook(offs_t curpc) // are we tracking our recent pc visits? if (m_track_pc) { - const uint32_t crc = compute_opcode_crc32(curpc); + const u32 crc = compute_opcode_crc32(curpc); m_track_pc_set.insert(dasm_pc_tag(curpc, crc)); } @@ -1952,7 +1952,7 @@ void device_debug::instruction_hook(offs_t curpc) // memory read happens //------------------------------------------------- -void device_debug::memory_read_hook(address_space &space, offs_t address, uint64_t mem_mask) +void device_debug::memory_read_hook(address_space &space, offs_t address, u64 mem_mask) { // check watchpoints watchpoint_check(space, WATCHPOINT_READ, address, 0, mem_mask); @@ -1969,7 +1969,7 @@ void device_debug::memory_read_hook(address_space &space, offs_t address, uint64 // memory write happens //------------------------------------------------- -void device_debug::memory_write_hook(address_space &space, offs_t address, uint64_t data, uint64_t mem_mask) +void device_debug::memory_write_hook(address_space &space, offs_t address, u64 data, u64 mem_mask) { if (m_track_mem) { @@ -2134,7 +2134,7 @@ void device_debug::go_exception(int exception) // delay elapses //------------------------------------------------- -void device_debug::go_milliseconds(uint64_t milliseconds) +void device_debug::go_milliseconds(u64 milliseconds) { assert(m_exec != nullptr); @@ -2165,7 +2165,7 @@ void device_debug::halt_on_next_instruction_impl(util::format_argument_pack<std: int device_debug::breakpoint_set(offs_t address, const char *condition, const char *action) { // allocate a new one - uint32_t id = m_device.machine().debugger().cpu().get_breakpoint_index(); + u32 id = m_device.machine().debugger().cpu().get_breakpoint_index(); breakpoint *bp = auto_alloc(m_device.machine(), breakpoint(this, m_symtable, id, address, condition, action)); // hook it into our list @@ -2257,7 +2257,7 @@ int device_debug::watchpoint_set(address_space &space, int type, offs_t address, assert(space.spacenum() < ARRAY_LENGTH(m_wplist)); // allocate a new one - uint32_t id = m_device.machine().debugger().cpu().get_watchpoint_index(); + u32 id = m_device.machine().debugger().cpu().get_watchpoint_index(); watchpoint *wp = auto_alloc(m_device.machine(), watchpoint(this, m_symtable, id, space, type, address, length, condition, action)); // hook it into our list @@ -2352,7 +2352,7 @@ void device_debug::watchpoint_enable_all(bool enable) int device_debug::registerpoint_set(const char *condition, const char *action) { // allocate a new one - uint32_t id = m_device.machine().debugger().cpu().get_registerpoint_index(); + u32 id = m_device.machine().debugger().cpu().get_registerpoint_index(); registerpoint *rp = auto_alloc(m_device.machine(), registerpoint(m_symtable, id, condition, action)); // hook it into our list @@ -2487,7 +2487,7 @@ bool device_debug::track_pc_visited(const offs_t& pc) const { if (m_track_pc_set.empty()) return false; - const uint32_t crc = compute_opcode_crc32(pc); + const u32 crc = compute_opcode_crc32(pc); return m_track_pc_set.find(dasm_pc_tag(pc, crc)) != m_track_pc_set.end(); } @@ -2499,7 +2499,7 @@ bool device_debug::track_pc_visited(const offs_t& pc) const void device_debug::set_track_pc_visited(const offs_t& pc) { - const uint32_t crc = compute_opcode_crc32(pc); + const u32 crc = compute_opcode_crc32(pc); m_track_pc_set.insert(dasm_pc_tag(pc, crc)); } @@ -2512,7 +2512,7 @@ void device_debug::set_track_pc_visited(const offs_t& pc) offs_t device_debug::track_mem_pc_from_space_address_data(const address_spacenum& space, const offs_t& address, - const uint64_t& data) const + const u64& data) const { const offs_t missing = (offs_t)(-1); if (m_track_mem_set.empty()) @@ -2531,7 +2531,7 @@ offs_t device_debug::track_mem_pc_from_space_address_data(const address_spacenum void device_debug::comment_add(offs_t addr, const char *comment, rgb_t color) { // create a new item for the list - uint32_t const crc = compute_opcode_crc32(addr); + u32 const crc = compute_opcode_crc32(addr); dasm_comment const newComment = dasm_comment(addr, crc, comment, color); std::pair<std::set<dasm_comment>::iterator, bool> const inserted = m_comment_set.insert(newComment); if (!inserted.second) @@ -2553,7 +2553,7 @@ void device_debug::comment_add(offs_t addr, const char *comment, rgb_t color) bool device_debug::comment_remove(offs_t addr) { - const uint32_t crc = compute_opcode_crc32(addr); + const u32 crc = compute_opcode_crc32(addr); size_t const removed = m_comment_set.erase(dasm_comment(addr, crc, "", 0xffffffff)); if (removed != 0U) m_comment_change++; return removed != 0U; @@ -2566,7 +2566,7 @@ bool device_debug::comment_remove(offs_t addr) const char *device_debug::comment_text(offs_t addr) const { - const uint32_t crc = compute_opcode_crc32(addr); + const u32 crc = compute_opcode_crc32(addr); auto comment = m_comment_set.find(dasm_comment(addr, crc, "", 0)); if (comment == m_comment_set.end()) return nullptr; return comment->m_text.c_str(); @@ -2608,7 +2608,7 @@ bool device_debug::comment_import(xml_data_node const &cpunode, bool is_inline) offs_t address = datanode->get_attribute_int("address", 0); rgb_t color = datanode->get_attribute_int("color", 0); - uint32_t crc; + u32 crc; sscanf(datanode->get_attribute_string("crc", nullptr), "%08X", &crc); // add the new comment @@ -2626,7 +2626,7 @@ bool device_debug::comment_import(xml_data_node const &cpunode, bool is_inline) // the opcode bytes at the given address //------------------------------------------------- -uint32_t device_debug::compute_opcode_crc32(offs_t pc) const +u32 device_debug::compute_opcode_crc32(offs_t pc) const { // Basically the same thing as dasm_wrapped, but with some tiny savings assert(m_memory != nullptr); @@ -2637,7 +2637,7 @@ uint32_t device_debug::compute_opcode_crc32(offs_t pc) const offs_t pcbyte = space.address_to_byte(pc) & space.bytemask(); // fetch the bytes up to the maximum - uint8_t opbuf[64], argbuf[64]; + u8 opbuf[64], argbuf[64]; int maxbytes = (m_disasm != nullptr) ? m_disasm->max_opcode_bytes() : 1; for (int numbytes = 0; numbytes < maxbytes; numbytes++) { @@ -2645,7 +2645,7 @@ uint32_t device_debug::compute_opcode_crc32(offs_t pc) const argbuf[numbytes] = m_device.machine().debugger().cpu().read_opcode(space, pcbyte + numbytes, 1); } - uint32_t numbytes = maxbytes; + u32 numbytes = maxbytes; if (m_disasm != nullptr) { // disassemble to our buffer @@ -2881,12 +2881,12 @@ void device_debug::watchpoint_update_flags(address_space &space) // for a given CPU and address space //------------------------------------------------- -void device_debug::watchpoint_check(address_space& space, int type, offs_t address, uint64_t value_to_write, uint64_t mem_mask) +void device_debug::watchpoint_check(address_space& space, int type, offs_t address, u64 value_to_write, u64 mem_mask) { space.machine().debugger().cpu().watchpoint_check(space, type, address, value_to_write, mem_mask, m_wplist); } -void debugger_cpu::watchpoint_check(address_space& space, int type, offs_t address, uint64_t value_to_write, uint64_t mem_mask, device_debug::watchpoint** wplist) +void debugger_cpu::watchpoint_check(address_space& space, int type, offs_t address, u64 value_to_write, u64 mem_mask, device_debug::watchpoint** wplist) { // if we're within debugger code, don't stop if (m_within_instruction_hook || m_debugger_access) @@ -2915,15 +2915,16 @@ void debugger_cpu::watchpoint_check(address_space& space, int type, offs_t addre } // (1<<(size*8))-1 won't work when size is 8; let's just use a lut - static const uint64_t masks[] = {0, - 0xff, - 0xffff, - 0xffffff, - 0xffffffff, - U64(0xffffffffff), - U64(0xffffffffffff), - U64(0xffffffffffffff), - U64(0xffffffffffffffff)}; + static const u64 masks[] = { + 0x0U, + 0xffU, + 0xffffU, + 0xffffffU, + 0xffffffffU, + 0xffffffffffU, + 0xffffffffffffU, + 0xffffffffffffffU, + 0xffffffffffffffffU}; value_to_write &= masks[size]; if (space.endianness() == ENDIANNESS_LITTLE) @@ -2962,9 +2963,9 @@ void debugger_cpu::watchpoint_check(address_space& space, int type, offs_t addre { buffer = string_format("Stopped at watchpoint %X writing %s to %08X (PC=%X)", wp->index(), sizes[size], space.byte_to_address(address), pc); if (value_to_write >> 32) - buffer.append(string_format(" (data=%X%08X)", (uint32_t)(value_to_write >> 32), (uint32_t)value_to_write)); + buffer.append(string_format(" (data=%X%08X)", u32(value_to_write >> 32), u32(value_to_write))); else - buffer.append(string_format(" (data=%X)", (uint32_t)value_to_write)); + buffer.append(string_format(" (data=%X)", u32(value_to_write))); } else buffer = string_format("Stopped at watchpoint %X reading %s from %08X (PC=%X)", wp->index(), sizes[size], space.byte_to_address(address), pc); @@ -3029,7 +3030,7 @@ void device_debug::hotspot_check(address_space &space, offs_t address) // buffer and then disassembling them //------------------------------------------------- -uint32_t device_debug::dasm_wrapped(std::string &buffer, offs_t pc) +u32 device_debug::dasm_wrapped(std::string &buffer, offs_t pc) { assert(m_memory != nullptr && m_disasm != nullptr); @@ -3039,7 +3040,7 @@ uint32_t device_debug::dasm_wrapped(std::string &buffer, offs_t pc) offs_t pcbyte = space.address_to_byte(pc) & space.bytemask(); // fetch the bytes up to the maximum - uint8_t opbuf[64], argbuf[64]; + u8 opbuf[64], argbuf[64]; int maxbytes = m_disasm->max_opcode_bytes(); for (int numbytes = 0; numbytes < maxbytes; numbytes++) { @@ -3050,7 +3051,7 @@ uint32_t device_debug::dasm_wrapped(std::string &buffer, offs_t pc) // disassemble to our buffer char diasmbuf[200]; memset(diasmbuf, 0x00, 200); - uint32_t result = m_disasm->disassemble(diasmbuf, pc, opbuf, argbuf); + u32 result = m_disasm->disassemble(diasmbuf, pc, opbuf, argbuf); buffer.assign(diasmbuf); return result; } @@ -3061,7 +3062,7 @@ uint32_t device_debug::dasm_wrapped(std::string &buffer, offs_t pc) // current instruction pointer //------------------------------------------------- -uint64_t device_debug::get_current_pc(symbol_table &table, void *ref) +u64 device_debug::get_current_pc(symbol_table &table, void *ref) { device_t *device = reinterpret_cast<device_t *>(table.globalref()); return device->safe_pcbase(); @@ -3073,7 +3074,7 @@ uint64_t device_debug::get_current_pc(symbol_table &table, void *ref) // 'cycles' symbol //------------------------------------------------- -uint64_t device_debug::get_cycles(symbol_table &table, void *ref) +u64 device_debug::get_cycles(symbol_table &table, void *ref) { device_t *device = reinterpret_cast<device_t *>(table.globalref()); return device->debug()->m_exec->cycles_remaining(); @@ -3085,7 +3086,7 @@ uint64_t device_debug::get_cycles(symbol_table &table, void *ref) // 'totalcycles' symbol //------------------------------------------------- -uint64_t device_debug::get_totalcycles(symbol_table &table, void *ref) +u64 device_debug::get_totalcycles(symbol_table &table, void *ref) { device_t *device = reinterpret_cast<device_t *>(table.globalref()); return device->debug()->m_total_cycles; @@ -3097,7 +3098,7 @@ uint64_t device_debug::get_totalcycles(symbol_table &table, void *ref) // 'lastinstructioncycles' symbol //------------------------------------------------- -uint64_t device_debug::get_lastinstructioncycles(symbol_table &table, void *ref) +u64 device_debug::get_lastinstructioncycles(symbol_table &table, void *ref) { device_t *device = reinterpret_cast<device_t *>(table.globalref()); device_debug *debug = device->debug(); @@ -3110,7 +3111,7 @@ uint64_t device_debug::get_lastinstructioncycles(symbol_table &table, void *ref) // symbols //------------------------------------------------- -uint64_t device_debug::get_logunmap(symbol_table &table, void *ref) +u64 device_debug::get_logunmap(symbol_table &table, void *ref) { address_space &space = *reinterpret_cast<address_space *>(table.globalref()); return space.log_unmap(); @@ -3122,7 +3123,7 @@ uint64_t device_debug::get_logunmap(symbol_table &table, void *ref) // symbols //------------------------------------------------- -void device_debug::set_logunmap(symbol_table &table, void *ref, uint64_t value) +void device_debug::set_logunmap(symbol_table &table, void *ref, u64 value) { address_space &space = *reinterpret_cast<address_space *>(table.globalref()); space.set_log_unmap(value ? true : false); @@ -3134,7 +3135,7 @@ void device_debug::set_logunmap(symbol_table &table, void *ref, uint64_t value) // state symbols //------------------------------------------------- -uint64_t device_debug::get_state(symbol_table &table, void *ref) +u64 device_debug::get_state(symbol_table &table, void *ref) { device_t *device = reinterpret_cast<device_t *>(table.globalref()); return device->debug()->m_state->state_int(reinterpret_cast<uintptr_t>(ref)); @@ -3146,7 +3147,7 @@ uint64_t device_debug::get_state(symbol_table &table, void *ref) // state symbols //------------------------------------------------- -void device_debug::set_state(symbol_table &table, void *ref, uint64_t value) +void device_debug::set_state(symbol_table &table, void *ref, u64 value) { device_t *device = reinterpret_cast<device_t *>(table.globalref()); device->debug()->m_state->set_state_int(reinterpret_cast<uintptr_t>(ref), value); @@ -3454,7 +3455,7 @@ void device_debug::tracer::flush() // dasm_pc_tag - constructor //------------------------------------------------- -device_debug::dasm_pc_tag::dasm_pc_tag(const offs_t& address, const uint32_t& crc) +device_debug::dasm_pc_tag::dasm_pc_tag(const offs_t& address, const u32& crc) : m_address(address), m_crc(crc) { @@ -3466,7 +3467,7 @@ device_debug::dasm_pc_tag::dasm_pc_tag(const offs_t& address, const uint32_t& cr device_debug::dasm_memory_access::dasm_memory_access(const address_spacenum& address_space, const offs_t& address, - const uint64_t& data, + const u64& data, const offs_t& pc) : m_address_space(address_space), m_address(address), @@ -3479,7 +3480,7 @@ device_debug::dasm_memory_access::dasm_memory_access(const address_spacenum& add // dasm_comment - constructor //------------------------------------------------- -device_debug::dasm_comment::dasm_comment(offs_t address, uint32_t crc, const char *text, rgb_t color) +device_debug::dasm_comment::dasm_comment(offs_t address, u32 crc, const char *text, rgb_t color) : dasm_pc_tag(address, crc), m_text(text), m_color(std::move(color)) diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index bc262e382ef..079b17d1fd0 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -10,8 +10,8 @@ #pragma once -#ifndef __DEBUGCPU_H__ -#define __DEBUGCPU_H__ +#ifndef MAME_EMU_DEBUG_DEBUGCPU_H +#define MAME_EMU_DEBUG_DEBUGCPU_H #include "express.h" @@ -22,11 +22,11 @@ // CONSTANTS //************************************************************************** -const uint8_t WATCHPOINT_READ = 1; -const uint8_t WATCHPOINT_WRITE = 2; -const uint8_t WATCHPOINT_READWRITE = WATCHPOINT_READ | WATCHPOINT_WRITE; +constexpr u8 WATCHPOINT_READ = 1; +constexpr u8 WATCHPOINT_WRITE = 2; +constexpr u8 WATCHPOINT_READWRITE = WATCHPOINT_READ | WATCHPOINT_WRITE; -const int COMMENT_VERSION = 1; +constexpr int COMMENT_VERSION = 1; @@ -127,7 +127,7 @@ public: address_space & m_space; // address space int m_index; // user reported index bool m_enabled; // enabled? - uint8_t m_type; // type (read/write) + u8 m_type; // type (read/write) offs_t m_address; // start address offs_t m_length; // length of watch area parsed_expression m_condition; // condition @@ -179,8 +179,8 @@ public: void interrupt_hook(int irqline); void exception_hook(int exception); void instruction_hook(offs_t curpc); - void memory_read_hook(address_space &space, offs_t address, uint64_t mem_mask); - void memory_write_hook(address_space &space, offs_t address, uint64_t data, uint64_t mem_mask); + void memory_read_hook(address_space &space, offs_t address, u64 mem_mask); + void memory_write_hook(address_space &space, offs_t address, u64 data, u64 mem_mask); // hooks into our operations void set_instruction_hook(debug_instruction_hook_func hook); @@ -199,7 +199,7 @@ public: void go_vblank(); void go_interrupt(int irqline = -1); void go_exception(int exception); - void go_milliseconds(uint64_t milliseconds); + void go_milliseconds(u64 milliseconds); void go_next_device(); template <typename Format, typename... Params> @@ -240,11 +240,11 @@ public: void comment_add(offs_t address, const char *comment, rgb_t color); bool comment_remove(offs_t addr); const char *comment_text(offs_t addr) const; - uint32_t comment_count() const { return m_comment_set.size(); } - uint32_t comment_change_count() const { return m_comment_change; } + u32 comment_count() const { return m_comment_set.size(); } + u32 comment_change_count() const { return m_comment_change; } bool comment_export(xml_data_node &node); bool comment_import(xml_data_node const &node, bool is_inline); - uint32_t compute_opcode_crc32(offs_t pc) const; + u32 compute_opcode_crc32(offs_t pc) const; // history offs_t history_pc(int index) const; @@ -259,7 +259,7 @@ public: void set_track_mem(bool value) { m_track_mem = value; } offs_t track_mem_pc_from_space_address_data(const address_spacenum& space, const offs_t& address, - const uint64_t& data) const; + const u64& data) const; void track_mem_data_clear() { m_track_mem_set.clear(); } // tracing @@ -279,24 +279,24 @@ private: // internal helpers void prepare_for_step_overout(offs_t pc); - uint32_t dasm_wrapped(std::string &buffer, offs_t pc); + u32 dasm_wrapped(std::string &buffer, offs_t pc); // breakpoint and watchpoint helpers void breakpoint_update_flags(); void breakpoint_check(offs_t pc); void watchpoint_update_flags(address_space &space); - void watchpoint_check(address_space &space, int type, offs_t address, uint64_t value_to_write, uint64_t mem_mask); + void watchpoint_check(address_space &space, int type, offs_t address, u64 value_to_write, u64 mem_mask); void hotspot_check(address_space &space, offs_t address); // symbol get/set callbacks - static uint64_t get_current_pc(symbol_table &table, void *ref); - static uint64_t get_cycles(symbol_table &table, void *ref); - static uint64_t get_totalcycles(symbol_table &table, void *ref); - static uint64_t get_lastinstructioncycles(symbol_table &table, void *ref); - static uint64_t get_logunmap(symbol_table &table, void *ref); - static void set_logunmap(symbol_table &table, void *ref, uint64_t value); - static uint64_t get_state(symbol_table &table, void *ref); - static void set_state(symbol_table &table, void *ref, uint64_t value); + static u64 get_current_pc(symbol_table &table, void *ref); + static u64 get_cycles(symbol_table &table, void *ref); + static u64 get_totalcycles(symbol_table &table, void *ref); + static u64 get_lastinstructioncycles(symbol_table &table, void *ref); + static u64 get_logunmap(symbol_table &table, void *ref); + static void set_logunmap(symbol_table &table, void *ref, u64 value); + static u64 get_state(symbol_table &table, void *ref); + static void set_state(symbol_table &table, void *ref, u64 value); // basic device information device_t & m_device; // device we are attached to @@ -306,7 +306,7 @@ private: device_disasm_interface * m_disasm; // disasm interface, if present // global state - uint32_t m_flags; // debugging flags for this CPU + u32 m_flags; // debugging flags for this CPU symbol_table m_symtable; // symbol table for expression evaluation debug_instruction_hook_func m_instrhook; // per-instruction callback hook @@ -320,12 +320,12 @@ private: int m_stopirq; // stop IRQ number for DEBUG_FLAG_STOP_INTERRUPT int m_stopexception; // stop exception number for DEBUG_FLAG_STOP_EXCEPTION attotime m_endexectime; // ending time of the current execution - uint64_t m_total_cycles; // current total cycles - uint64_t m_last_total_cycles; // last total cycles + u64 m_total_cycles; // current total cycles + u64 m_last_total_cycles; // last total cycles // history offs_t m_pc_history[HISTORY_SIZE]; // history of recent PCs - uint32_t m_pc_history_index; // current history index + u32 m_pc_history_index; // current history index // breakpoints and watchpoints breakpoint * m_bplist; // list of breakpoints @@ -366,7 +366,7 @@ private: offs_t m_access; // access address offs_t m_pc; // PC of the access address_space * m_space; // space where the access occurred - uint32_t m_count; // number of hits + u32 m_count; // number of hits }; std::vector<hotspot_entry> m_hotspots; // hotspot list int m_hotspot_threshhold; // threshhold for the number of hits to print @@ -375,7 +375,7 @@ private: class dasm_pc_tag { public: - dasm_pc_tag(const offs_t& address, const uint32_t& crc); + dasm_pc_tag(const offs_t& address, const u32& crc); // required to be included in a set bool operator < (const dasm_pc_tag& rhs) const @@ -386,7 +386,7 @@ private: } offs_t m_address; // Stores [nothing] for a given address & crc32 - uint32_t m_crc; + u32 m_crc; }; std::set<dasm_pc_tag> m_track_pc_set; bool m_track_pc; @@ -395,13 +395,13 @@ private: class dasm_comment : public dasm_pc_tag { public: - dasm_comment(offs_t address, uint32_t crc, const char *text, rgb_t color); + dasm_comment(offs_t address, u32 crc, const char *text, rgb_t color); std::string m_text; // Stores comment text & color for a given address & crc32 - rgb_t m_color; + rgb_t m_color; }; std::set<dasm_comment> m_comment_set; // collection of comments - uint32_t m_comment_change; // change counter for comments + u32 m_comment_change; // change counter for comments // memory tracking class dasm_memory_access @@ -409,7 +409,7 @@ private: public: dasm_memory_access(const address_spacenum& address_space, const offs_t& address, - const uint64_t& data, + const u64& data, const offs_t& pc); // required to be included in a set @@ -426,31 +426,31 @@ private: // Stores the PC for a given address, memory region, and data value address_spacenum m_address_space; offs_t m_address; - uint64_t m_data; + u64 m_data; mutable offs_t m_pc; }; std::set<dasm_memory_access> m_track_mem_set; bool m_track_mem; // internal flag values - static const uint32_t DEBUG_FLAG_OBSERVING = 0x00000001; // observing this CPU - static const uint32_t DEBUG_FLAG_HISTORY = 0x00000002; // tracking this CPU's history - static const uint32_t DEBUG_FLAG_TRACING = 0x00000004; // tracing this CPU - static const uint32_t DEBUG_FLAG_TRACING_OVER = 0x00000008; // tracing this CPU with step over behavior - static const uint32_t DEBUG_FLAG_HOOKED = 0x00000010; // per-instruction callback hook - static const uint32_t DEBUG_FLAG_STEPPING = 0x00000020; // CPU is single stepping - static const uint32_t DEBUG_FLAG_STEPPING_OVER = 0x00000040; // CPU is stepping over a function - static const uint32_t DEBUG_FLAG_STEPPING_OUT = 0x00000080; // CPU is stepping out of a function - static const uint32_t DEBUG_FLAG_STOP_PC = 0x00000100; // there is a pending stop at cpu->breakpc - static const uint32_t DEBUG_FLAG_STOP_INTERRUPT = 0x00000400; // there is a pending stop on the next interrupt - static const uint32_t DEBUG_FLAG_STOP_EXCEPTION = 0x00000800; // there is a pending stop on the next exception - static const uint32_t DEBUG_FLAG_STOP_VBLANK = 0x00001000; // there is a pending stop on the next VBLANK - static const uint32_t DEBUG_FLAG_STOP_TIME = 0x00002000; // there is a pending stop at cpu->stoptime - static const uint32_t DEBUG_FLAG_LIVE_BP = 0x00010000; // there are live breakpoints for this CPU - - static const uint32_t DEBUG_FLAG_STEPPING_ANY = DEBUG_FLAG_STEPPING | DEBUG_FLAG_STEPPING_OVER | DEBUG_FLAG_STEPPING_OUT; - static const uint32_t DEBUG_FLAG_TRACING_ANY = DEBUG_FLAG_TRACING | DEBUG_FLAG_TRACING_OVER; - static const uint32_t DEBUG_FLAG_TRANSIENT = DEBUG_FLAG_STEPPING_ANY | DEBUG_FLAG_STOP_PC | + static constexpr u32 DEBUG_FLAG_OBSERVING = 0x00000001; // observing this CPU + static constexpr u32 DEBUG_FLAG_HISTORY = 0x00000002; // tracking this CPU's history + static constexpr u32 DEBUG_FLAG_TRACING = 0x00000004; // tracing this CPU + static constexpr u32 DEBUG_FLAG_TRACING_OVER = 0x00000008; // tracing this CPU with step over behavior + static constexpr u32 DEBUG_FLAG_HOOKED = 0x00000010; // per-instruction callback hook + static constexpr u32 DEBUG_FLAG_STEPPING = 0x00000020; // CPU is single stepping + static constexpr u32 DEBUG_FLAG_STEPPING_OVER = 0x00000040; // CPU is stepping over a function + static constexpr u32 DEBUG_FLAG_STEPPING_OUT = 0x00000080; // CPU is stepping out of a function + static constexpr u32 DEBUG_FLAG_STOP_PC = 0x00000100; // there is a pending stop at cpu->breakpc + static constexpr u32 DEBUG_FLAG_STOP_INTERRUPT = 0x00000400; // there is a pending stop on the next interrupt + static constexpr u32 DEBUG_FLAG_STOP_EXCEPTION = 0x00000800; // there is a pending stop on the next exception + static constexpr u32 DEBUG_FLAG_STOP_VBLANK = 0x00001000; // there is a pending stop on the next VBLANK + static constexpr u32 DEBUG_FLAG_STOP_TIME = 0x00002000; // there is a pending stop at cpu->stoptime + static constexpr u32 DEBUG_FLAG_LIVE_BP = 0x00010000; // there are live breakpoints for this CPU + + static constexpr u32 DEBUG_FLAG_STEPPING_ANY = DEBUG_FLAG_STEPPING | DEBUG_FLAG_STEPPING_OVER | DEBUG_FLAG_STEPPING_OUT; + static constexpr u32 DEBUG_FLAG_TRACING_ANY = DEBUG_FLAG_TRACING | DEBUG_FLAG_TRACING_OVER; + static constexpr u32 DEBUG_FLAG_TRANSIENT = DEBUG_FLAG_STEPPING_ANY | DEBUG_FLAG_STOP_PC | DEBUG_FLAG_STOP_INTERRUPT | DEBUG_FLAG_STOP_EXCEPTION | DEBUG_FLAG_STOP_VBLANK | DEBUG_FLAG_STOP_TIME; }; @@ -510,46 +510,46 @@ public: /* ----- debugger memory accessors ----- */ /* return a byte from the specified memory space */ - uint8_t read_byte(address_space &space, offs_t address, bool apply_translation); + u8 read_byte(address_space &space, offs_t address, bool apply_translation); /* return a word from the specified memory space */ - uint16_t read_word(address_space &space, offs_t address, bool apply_translation); + u16 read_word(address_space &space, offs_t address, bool apply_translation); /* return a dword from the specified memory space */ - uint32_t read_dword(address_space &space, offs_t address, bool apply_translation); + u32 read_dword(address_space &space, offs_t address, bool apply_translation); /* return a qword from the specified memory space */ - uint64_t read_qword(address_space &space, offs_t address, bool apply_translation); + u64 read_qword(address_space &space, offs_t address, bool apply_translation); /* return 1,2,4 or 8 bytes from the specified memory space */ - uint64_t read_memory(address_space &space, offs_t address, int size, bool apply_translation); + u64 read_memory(address_space &space, offs_t address, int size, bool apply_translation); /* write a byte to the specified memory space */ - void write_byte(address_space &space, offs_t address, uint8_t data, bool apply_translation); + void write_byte(address_space &space, offs_t address, u8 data, bool apply_translation); /* write a word to the specified memory space */ - void write_word(address_space &space, offs_t address, uint16_t data, bool apply_translation); + void write_word(address_space &space, offs_t address, u16 data, bool apply_translation); /* write a dword to the specified memory space */ - void write_dword(address_space &space, offs_t address, uint32_t data, bool apply_translation); + void write_dword(address_space &space, offs_t address, u32 data, bool apply_translation); /* write a qword to the specified memory space */ - void write_qword(address_space &space, offs_t address, uint64_t data, bool apply_translation); + void write_qword(address_space &space, offs_t address, u64 data, bool apply_translation); /* write 1,2,4 or 8 bytes to the specified memory space */ - void write_memory(address_space &space, offs_t address, uint64_t data, int size, bool apply_translation); + void write_memory(address_space &space, offs_t address, u64 data, int size, bool apply_translation); /* read 1,2,4 or 8 bytes at the given offset from opcode space */ - uint64_t read_opcode(address_space &space, offs_t offset, int size); + u64 read_opcode(address_space &space, offs_t offset, int size); // getters bool within_instruction_hook() const { return m_within_instruction_hook; } bool memory_modified() const { return m_memory_modified; } int execution_state() const { return m_execution_state; } device_t *live_cpu() { return m_livecpu; } - uint32_t get_breakpoint_index() { return m_bpindex++; } - uint32_t get_watchpoint_index() { return m_wpindex++; } - uint32_t get_registerpoint_index() { return m_rpindex++; } + u32 get_breakpoint_index() { return m_bpindex++; } + u32 get_watchpoint_index() { return m_wpindex++; } + u32 get_registerpoint_index() { return m_rpindex++; } // setters void set_visible_cpu(device_t * visiblecpu) { m_visiblecpu = visiblecpu; } @@ -568,26 +568,26 @@ public: void ensure_comments_loaded(); void reset_transient_flags(); void process_source_file(); - void watchpoint_check(address_space& space, int type, offs_t address, uint64_t value_to_write, uint64_t mem_mask, device_debug::watchpoint** wplist); + void watchpoint_check(address_space& space, int type, offs_t address, u64 value_to_write, u64 mem_mask, device_debug::watchpoint** wplist); private: static const size_t NUM_TEMP_VARIABLES; /* expression handlers */ - uint64_t expression_read_memory(void *param, const char *name, expression_space space, uint32_t address, int size); - uint64_t expression_read_program_direct(address_space &space, int opcode, offs_t address, int size); - uint64_t expression_read_memory_region(const char *rgntag, offs_t address, int size); - void expression_write_memory(void *param, const char *name, expression_space space, uint32_t address, int size, uint64_t data); - void expression_write_program_direct(address_space &space, int opcode, offs_t address, int size, uint64_t data); - void expression_write_memory_region(const char *rgntag, offs_t address, int size, uint64_t data); + u64 expression_read_memory(void *param, const char *name, expression_space space, u32 address, int size); + u64 expression_read_program_direct(address_space &space, int opcode, offs_t address, int size); + u64 expression_read_memory_region(const char *rgntag, offs_t address, int size); + void expression_write_memory(void *param, const char *name, expression_space space, u32 address, int size, u64 data); + void expression_write_program_direct(address_space &space, int opcode, offs_t address, int size, u64 data); + void expression_write_memory_region(const char *rgntag, offs_t address, int size, u64 data); expression_error::error_code expression_validate(void *param, const char *name, expression_space space); device_t* expression_get_device(const char *tag); /* variable getters/setters */ - uint64_t get_cpunum(symbol_table &table, void *ref); - uint64_t get_beamx(symbol_table &table, void *ref); - uint64_t get_beamy(symbol_table &table, void *ref); - uint64_t get_frame(symbol_table &table, void *ref); + u64 get_cpunum(symbol_table &table, void *ref); + u64 get_beamx(symbol_table &table, void *ref); + u64 get_beamy(symbol_table &table, void *ref); + u64 get_frame(symbol_table &table, void *ref); /* internal helpers */ void on_vblank(screen_device &device, bool vblank_state); @@ -602,25 +602,25 @@ private: std::unique_ptr<symbol_table> m_symtable; // global symbol table - bool m_within_instruction_hook; - bool m_vblank_occurred; - bool m_memory_modified; - bool m_debugger_access; + bool m_within_instruction_hook; + bool m_vblank_occurred; + bool m_memory_modified; + bool m_debugger_access; int m_execution_state; device_t * m_stop_when_not_device; // stop execution when the device ceases to be this - uint32_t m_bpindex; - uint32_t m_wpindex; - uint32_t m_rpindex; + u32 m_bpindex; + u32 m_wpindex; + u32 m_rpindex; - uint64_t m_wpdata; - uint64_t m_wpaddr; - std::unique_ptr<uint64_t[]> m_tempvar; + u64 m_wpdata; + u64 m_wpaddr; + std::unique_ptr<u64[]> m_tempvar; osd_ticks_t m_last_periodic_update_time; bool m_comments_loaded; }; -#endif +#endif // MAME_EMU_DEBUG_DEBUGCPU_H diff --git a/src/emu/debug/debughlp.cpp b/src/emu/debug/debughlp.cpp index 601bed4a440..ded8cafb993 100644 --- a/src/emu/debug/debughlp.cpp +++ b/src/emu/debug/debughlp.cpp @@ -1518,7 +1518,7 @@ const char *debug_get_help(const char *tag) /* make a lowercase copy of the tag */ for (i = 0; i <= taglen; i++) - tagcopy[i] = tolower((uint8_t)tag[i]); + tagcopy[i] = tolower(u8(tag[i])); /* find a match */ for (i = 0; i < ARRAY_LENGTH(static_help_list); i++) diff --git a/src/emu/debug/debughlp.h b/src/emu/debug/debughlp.h index 7f3eb6e4ad6..87881f6967f 100644 --- a/src/emu/debug/debughlp.h +++ b/src/emu/debug/debughlp.h @@ -8,8 +8,8 @@ *********************************************************************/ -#ifndef __DEBUGHLP_H__ -#define __DEBUGHLP_H__ +#ifndef MAME_EMU_DEBUG_DEBUGHLP_H +#define MAME_EMU_DEBUG_DEBUGHLP_H /*************************************************************************** @@ -19,4 +19,4 @@ /* help management */ const char * debug_get_help(const char *tag); -#endif +#endif // MAME_EMU_DEBUG_DEBUGHLP_H diff --git a/src/emu/debug/debugvw.cpp b/src/emu/debug/debugvw.cpp index c66034ef26b..f351896480e 100644 --- a/src/emu/debug/debugvw.cpp +++ b/src/emu/debug/debugvw.cpp @@ -506,7 +506,7 @@ bool debug_view_expression::recompute() // recompute the value of the expression try { - uint64_t newresult = m_parsed.execute(); + u64 newresult = m_parsed.execute(); if (newresult != m_result) { m_result = newresult; diff --git a/src/emu/debug/debugvw.h b/src/emu/debug/debugvw.h index 1dcdc9120c5..382f45e5e20 100644 --- a/src/emu/debug/debugvw.h +++ b/src/emu/debug/debugvw.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __DEBUGVIEW_H__ -#define __DEBUGVIEW_H__ +#ifndef MAME_EMU_DEBUG_DEBUGVIEW_H +#define MAME_EMU_DEBUG_DEBUGVIEW_H #include "express.h" @@ -43,36 +43,36 @@ enum debug_view_notification // attribute bits for debug_view_char.attrib -const uint8_t DCA_NORMAL = 0x00; // black on white -const uint8_t DCA_CHANGED = 0x01; // red foreground -const uint8_t DCA_SELECTED = 0x02; // light red background -const uint8_t DCA_INVALID = 0x04; // dark blue foreground -const uint8_t DCA_DISABLED = 0x08; // darker foreground -const uint8_t DCA_ANCILLARY = 0x10; // grey background -const uint8_t DCA_CURRENT = 0x20; // yellow background -const uint8_t DCA_COMMENT = 0x40; // green foreground -const uint8_t DCA_VISITED = 0x80; // light blue background +constexpr u8 DCA_NORMAL = 0x00; // black on white +constexpr u8 DCA_CHANGED = 0x01; // red foreground +constexpr u8 DCA_SELECTED = 0x02; // light red background +constexpr u8 DCA_INVALID = 0x04; // dark blue foreground +constexpr u8 DCA_DISABLED = 0x08; // darker foreground +constexpr u8 DCA_ANCILLARY = 0x10; // grey background +constexpr u8 DCA_CURRENT = 0x20; // yellow background +constexpr u8 DCA_COMMENT = 0x40; // green foreground +constexpr u8 DCA_VISITED = 0x80; // light blue background // special characters that can be passed to process_char() -const int DCH_UP = 1; // up arrow -const int DCH_DOWN = 2; // down arrow -const int DCH_LEFT = 3; // left arrow -const int DCH_RIGHT = 4; // right arrow -const int DCH_PUP = 5; // page up -const int DCH_PDOWN = 6; // page down -const int DCH_HOME = 7; // home -const int DCH_CTRLHOME = 8; // ctrl+home -const int DCH_END = 9; // end -const int DCH_CTRLEND = 10; // ctrl+end -const int DCH_CTRLRIGHT = 11; // ctrl+right -const int DCH_CTRLLEFT = 12; // ctrl+left +constexpr int DCH_UP = 1; // up arrow +constexpr int DCH_DOWN = 2; // down arrow +constexpr int DCH_LEFT = 3; // left arrow +constexpr int DCH_RIGHT = 4; // right arrow +constexpr int DCH_PUP = 5; // page up +constexpr int DCH_PDOWN = 6; // page down +constexpr int DCH_HOME = 7; // home +constexpr int DCH_CTRLHOME = 8; // ctrl+home +constexpr int DCH_END = 9; // end +constexpr int DCH_CTRLEND = 10; // ctrl+end +constexpr int DCH_CTRLRIGHT = 11; // ctrl+right +constexpr int DCH_CTRLLEFT = 12; // ctrl+left // special characters that can be passed to process_click() -const int DCK_LEFT_CLICK = 1; // left instantaneous click -const int DCK_RIGHT_CLICK = 2; // right instantaneous click -const int DCK_MIDDLE_CLICK = 3; // middle instantaneous click +constexpr int DCK_LEFT_CLICK = 1; // left instantaneous click +constexpr int DCK_RIGHT_CLICK = 2; // right instantaneous click +constexpr int DCK_MIDDLE_CLICK = 3; // middle instantaneous click //************************************************************************** @@ -90,8 +90,8 @@ typedef void (*debug_view_osd_update_func)(debug_view &view, void *osdprivate); // a single "character" in the debug view has an ASCII value and an attribute byte struct debug_view_char { - uint8_t byte; - uint8_t attrib; + u8 byte; + u8 attrib; }; @@ -101,8 +101,8 @@ class debug_view_xy public: debug_view_xy(int _x = 0, int _y = 0) : x(_x), y(_y) { } - int32_t x; - int32_t y; + s32 x; + s32 y; }; @@ -208,7 +208,7 @@ protected: // update info bool m_recompute; // does this view require a recomputation? - uint8_t m_update_level; // update level; updates when this hits 0 + u8 m_update_level; // update level; updates when this hits 0 bool m_update_pending; // true if there is a pending update bool m_osd_update_pending; // true if there is a pending update std::vector<debug_view_char> m_viewdata; // current array of view data @@ -259,8 +259,8 @@ public: // getters running_machine &machine() const { return m_machine; } bool dirty() const { return m_dirty; } - uint64_t last_value() const { return m_result; } - uint64_t value() { recompute(); return m_result; } + u64 last_value() const { return m_result; } + u64 value() { recompute(); return m_result; } const char *string() const { return m_string.c_str(); } symbol_table *context() const { return m_parsed.symbols(); } @@ -276,10 +276,10 @@ private: // internal state running_machine & m_machine; // reference to the machine bool m_dirty; // true if the expression needs to be re-evaluated - uint64_t m_result; // last result from the expression + u64 m_result; // last result from the expression parsed_expression m_parsed; // parsed expression data std::string m_string; // copy of the expression string }; -#endif +#endif // MAME_EMU_DEBUG_DEBUGVIEW_H diff --git a/src/emu/debug/dvbpoints.cpp b/src/emu/debug/dvbpoints.cpp index d7cd9527913..6bc4a008c5f 100644 --- a/src/emu/debug/dvbpoints.cpp +++ b/src/emu/debug/dvbpoints.cpp @@ -266,7 +266,7 @@ void debug_view_breakpoints::view_update() pad_ostream_to_length(linebuf, tableBreaks[5]); auto const &text(linebuf.vec()); - for (uint32_t i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) + for (u32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = (i < text.size()) ? text[i] : ' '; dest->attrib = DCA_ANCILLARY; @@ -298,7 +298,7 @@ void debug_view_breakpoints::view_update() pad_ostream_to_length(linebuf, tableBreaks[5]); auto const &text(linebuf.vec()); - for (uint32_t i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) + for (u32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = (i < text.size()) ? text[i] : ' '; dest->attrib = DCA_NORMAL; @@ -311,7 +311,7 @@ void debug_view_breakpoints::view_update() else { // Fill the remaining vertical space - for (uint32_t i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) + for (u32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = ' '; dest->attrib = DCA_NORMAL; diff --git a/src/emu/debug/dvbpoints.h b/src/emu/debug/dvbpoints.h index 7e52e7d4cae..b7037e06b0f 100644 --- a/src/emu/debug/dvbpoints.h +++ b/src/emu/debug/dvbpoints.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __DVBPOINTS_H__ -#define __DVBPOINTS_H__ +#ifndef MAME_EMU_DEBUG_DVBPOINTS_H +#define MAME_EMU_DEBUG_DVBPOINTS_H #include "debugvw.h" #include "debugcpu.h" @@ -52,4 +52,4 @@ private: }; -#endif +#endif // MAME_EMU_DEBUG_DVBPOINTS_H diff --git a/src/emu/debug/dvdisasm.cpp b/src/emu/debug/dvdisasm.cpp index 3dab8d13dd3..b36f1255a48 100644 --- a/src/emu/debug/dvdisasm.cpp +++ b/src/emu/debug/dvdisasm.cpp @@ -133,8 +133,8 @@ void debug_view_disasm::view_notify(debug_view_notification type) void debug_view_disasm::view_char(int chval) { debug_view_xy origcursor = m_cursor; - uint8_t end_buffer = 3; - int32_t temp; + u8 end_buffer = 3; + s32 temp; switch (chval) { @@ -250,7 +250,7 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs) { // fill the buffer up to the target offs_t curpcbyte = source.m_space.address_to_byte(curpc) & source.m_space.logbytemask(); - uint8_t opbuf[1024], argbuf[1024]; + u8 opbuf[1024], argbuf[1024]; while (curpcbyte < fillpcbyte) { fillpcbyte--; @@ -397,7 +397,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) offs_t physpcbyte = pcbyte; if (source.m_space.device().memory().translate(source.m_space.spacenum(), TRANSLATE_FETCH_DEBUG, physpcbyte)) { - uint8_t opbuf[64], argbuf[64]; + u8 opbuf[64], argbuf[64]; // fetch the bytes up to the maximum for (numbytes = 0; numbytes < maxbytes; numbytes++) @@ -466,14 +466,14 @@ void debug_view_disasm::view_update() m_recompute = true; // if we're tracking a value, make sure it is visible - uint64_t previous = m_expression.last_value(); - uint64_t result = m_expression.value(); + u64 previous = m_expression.last_value(); + u64 result = m_expression.value(); if (result != previous) { offs_t resultbyte = source.m_space.address_to_byte(result) & source.m_space.logbytemask(); // see if the new result is an address we already have - uint32_t row; + u32 row; for (row = 0; row < m_byteaddress.size(); row++) if (m_byteaddress[row] == resultbyte) break; @@ -512,7 +512,7 @@ recompute: else { // determine the addresses of what we will display - offs_t backpc = find_pc_backwards((uint32_t)m_expression.value(), m_backwards_steps); + offs_t backpc = find_pc_backwards(u32(m_expression.value()), m_backwards_steps); // put ourselves back in the top left m_topleft.y = 0; @@ -527,9 +527,9 @@ recompute: if (pcbyte != m_last_pcbyte) { // find the row with the PC on it - for (uint32_t row = 0; row < m_visible.y; row++) + for (u32 row = 0; row < m_visible.y; row++) { - uint32_t effrow = m_topleft.y + row; + u32 effrow = m_topleft.y + row; if (effrow >= m_byteaddress.size()) break; if (pcbyte == m_byteaddress[effrow]) @@ -552,13 +552,13 @@ recompute: // loop over visible rows debug_view_char *dest = &m_viewdata[0]; - for (uint32_t row = 0; row < m_visible.y; row++) + for (u32 row = 0; row < m_visible.y; row++) { - uint32_t effrow = m_topleft.y + row; - uint32_t col = 0; + u32 effrow = m_topleft.y + row; + u32 col = 0; // if this visible row is valid, add it to the buffer - uint8_t attrib = DCA_NORMAL; + u8 attrib = DCA_NORMAL; if (effrow < m_byteaddress.size()) { // if we're on the line with the PC, recompute and hilight it @@ -583,10 +583,10 @@ recompute: // get the effective string const char *data = &m_dasm.vec()[effrow * m_total.x]; - uint32_t len = (uint32_t)strlen(data); + u32 len = u32(strlen(data)); // copy data - uint32_t effcol = m_topleft.x; + u32 effcol = m_topleft.x; while (col < m_visible.x && effcol < len) { dest->byte = data[effcol++]; @@ -658,7 +658,7 @@ void debug_view_disasm::set_right_column(disasm_right_column contents) // instructions displayed before the home address //------------------------------------------------- -void debug_view_disasm::set_backward_steps(uint32_t steps) +void debug_view_disasm::set_backward_steps(u32 steps) { begin_update(); m_backwards_steps = steps; @@ -672,7 +672,7 @@ void debug_view_disasm::set_backward_steps(uint32_t steps) // of the main disassembly section //------------------------------------------------- -void debug_view_disasm::set_disasm_width(uint32_t width) +void debug_view_disasm::set_disasm_width(u32 width) { begin_update(); m_dasm_width = width; diff --git a/src/emu/debug/dvdisasm.h b/src/emu/debug/dvdisasm.h index 32a4e70eba5..ef8ad581f70 100644 --- a/src/emu/debug/dvdisasm.h +++ b/src/emu/debug/dvdisasm.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __DVDISASM_H__ -#define __DVDISASM_H__ +#ifndef MAME_EMU_DEBUG_DVDISASM_H +#define MAME_EMU_DEBUG_DVDISASM_H #include "debugvw.h" @@ -69,15 +69,15 @@ public: // getters const char *expression() const { return m_expression.string(); } disasm_right_column right_column() const { return m_right_column; } - uint32_t backward_steps() const { return m_backwards_steps; } - uint32_t disasm_width() const { return m_dasm_width; } + u32 backward_steps() const { return m_backwards_steps; } + u32 disasm_width() const { return m_dasm_width; } offs_t selected_address(); // setters void set_expression(const char *expression); void set_right_column(disasm_right_column contents); - void set_backward_steps(uint32_t steps); - void set_disasm_width(uint32_t width); + void set_backward_steps(u32 steps); + void set_disasm_width(u32 width); void set_selected_address(offs_t address); protected: @@ -96,11 +96,11 @@ private: // internal state disasm_right_column m_right_column; // right column contents - uint32_t m_backwards_steps; // number of backwards steps - uint32_t m_dasm_width; // width of the disassembly area - uint8_t * m_last_direct_raw; // last direct raw value - uint8_t * m_last_direct_decrypted;// last direct decrypted value - uint32_t m_last_change_count; // last comment change count + u32 m_backwards_steps; // number of backwards steps + u32 m_dasm_width; // width of the disassembly area + u8 * m_last_direct_raw; // last direct raw value + u8 * m_last_direct_decrypted;// last direct decrypted value + u32 m_last_change_count; // last comment change count offs_t m_last_pcbyte; // last PC byte value int m_divider1, m_divider2; // left and right divider columns int m_divider3; // comment divider column @@ -115,4 +115,4 @@ private: }; -#endif +#endif // MAME_EMU_DEBUG_DVDISASM_H diff --git a/src/emu/debug/dvmemory.cpp b/src/emu/debug/dvmemory.cpp index 5b828c989bb..ca73f1ac986 100644 --- a/src/emu/debug/dvmemory.cpp +++ b/src/emu/debug/dvmemory.cpp @@ -67,7 +67,7 @@ debug_view_memory_source::debug_view_memory_source(const char *name, memory_regi m_length(region.bytes()), m_offsetxor(ENDIAN_VALUE_NE_NNE(region.endianness(), 0, region.bytewidth() - 1)), m_endianness(region.endianness()), - m_prefsize(std::min<uint8_t>(region.bytewidth(), 8)) + m_prefsize(std::min<u8>(region.bytewidth(), 8)) { } @@ -156,7 +156,7 @@ void debug_view_memory::enumerate_sources() for (int itemnum = 0; itemnum < 10000; itemnum++) { // stop when we run out of items - uint32_t valsize, valcount; + u32 valsize, valcount; void *base; const char *itemname = machine().save().indexed_item(itemnum, base, valsize, valcount); if (itemname == nullptr) @@ -206,15 +206,15 @@ void debug_view_memory::view_notify(debug_view_notification type) //------------------------------------------------- -// uint32_to_float - return a floating point number +// u32_to_float - return a floating point number // whose 32 bit representation is value //------------------------------------------------- -static inline float uint32_to_float(uint32_t value) +static inline float u32_to_float(u32 value) { union { float f; - uint32_t i; + u32 i; } v; v.i = value; @@ -222,15 +222,15 @@ static inline float uint32_to_float(uint32_t value) } //------------------------------------------------- -// uint64_to_double - return a floating point number +// u64_to_double - return a floating point number // whose 64 bit representation is value //------------------------------------------------- -static inline float uint64_to_double(uint64_t value) +static inline float u64_to_double(u64 value) { union { double f; - uint64_t i; + u64 i; } v; v.i = value; @@ -254,18 +254,18 @@ void debug_view_memory::view_update() const memory_view_pos &posdata = s_memory_pos_table[m_data_format]; // loop over visible rows - for (uint32_t row = 0; row < m_visible.y; row++) + for (u32 row = 0; row < m_visible.y; row++) { debug_view_char *destmin = &m_viewdata[row * m_visible.x]; debug_view_char *destmax = destmin + m_visible.x; debug_view_char *destrow = destmin - m_topleft.x; - uint32_t effrow = m_topleft.y + row; + u32 effrow = m_topleft.y + row; // reset the line of data; section 1 is normal, others are ancillary, cursor is selected debug_view_char *dest = destmin; for (int ch = 0; ch < m_visible.x; ch++, dest++) { - uint32_t effcol = m_topleft.x + ch; + u32 effcol = m_topleft.x + ch; dest->byte = ' '; dest->attrib = DCA_ANCILLARY; if (m_section[1].contains(effcol)) @@ -297,13 +297,13 @@ void debug_view_memory::view_update() int spacing = posdata.m_spacing; if (m_data_format <= 8) { - uint64_t chunkdata; + u64 chunkdata; bool ismapped = read(m_bytes_per_chunk, addrbyte + chunknum * m_bytes_per_chunk, chunkdata); dest = destrow + m_section[1].m_pos + 1 + chunkindex * spacing; for (int ch = 0; ch < posdata.m_spacing; ch++, dest++) if (dest >= destmin && dest < destmax) { - uint8_t shift = posdata.m_shift[ch]; + u8 shift = posdata.m_shift[ch]; if (shift < 64) dest->byte = ismapped ? "0123456789ABCDEF"[(chunkdata >> shift) & 0x0f] : '*'; } @@ -311,7 +311,7 @@ void debug_view_memory::view_update() else { int ch; char valuetext[64]; - uint64_t chunkdata = 0; + u64 chunkdata = 0; floatx80 chunkdata80 = { 0, 0 }; bool ismapped; @@ -324,14 +324,14 @@ void debug_view_memory::view_update() switch (m_data_format) { case 9: - sprintf(valuetext, "%.8g", uint32_to_float((uint32_t)chunkdata)); + sprintf(valuetext, "%.8g", u32_to_float(u32(chunkdata))); break; case 10: - sprintf(valuetext, "%.24g", uint64_to_double(chunkdata)); + sprintf(valuetext, "%.24g", u64_to_double(chunkdata)); break; case 11: float64 f64 = floatx80_to_float64(chunkdata80); - sprintf(valuetext, "%.24g", uint64_to_double(f64)); + sprintf(valuetext, "%.24g", u64_to_double(f64)); break; } else { @@ -357,7 +357,7 @@ void debug_view_memory::view_update() for (int ch = 0; ch < m_bytes_per_row; ch++, dest++) if (dest >= destmin && dest < destmax) { - uint64_t chval; + u64 chval; bool ismapped = read(1, addrbyte + ch, chval); dest->byte = (ismapped && isprint(chval)) ? chval : '.'; } @@ -395,7 +395,7 @@ void debug_view_memory::view_char(int chval) break; case DCH_PUP: - for (uint32_t delta = (m_visible.y - 2) * m_bytes_per_row; delta > 0; delta -= m_bytes_per_row) + for (u32 delta = (m_visible.y - 2) * m_bytes_per_row; delta > 0; delta -= m_bytes_per_row) if (pos.m_address >= m_byte_offset + delta) { pos.m_address -= delta; @@ -404,7 +404,7 @@ void debug_view_memory::view_char(int chval) break; case DCH_PDOWN: - for (uint32_t delta = (m_visible.y - 2) * m_bytes_per_row; delta > 0; delta -= m_bytes_per_row) + for (u32 delta = (m_visible.y - 2) * m_bytes_per_row; delta > 0; delta -= m_bytes_per_row) if (pos.m_address <= m_maxaddr - delta) { pos.m_address += delta; @@ -449,13 +449,13 @@ void debug_view_memory::view_char(int chval) if (hexchar == nullptr) break; - uint64_t data; + u64 data; bool ismapped = read(m_bytes_per_chunk, pos.m_address, data); if (!ismapped) break; - data &= ~((uint64_t)0x0f << pos.m_shift); - data |= (uint64_t)(hexchar - hexvals) << pos.m_shift; + data &= ~(u64(0x0f) << pos.m_shift); + data |= u64(hexchar - hexvals) << pos.m_shift; write(m_bytes_per_chunk, pos.m_address, data); // fall through to the right-arrow press } @@ -549,7 +549,7 @@ void debug_view_memory::recompute() // if we are viewing a space with a minimum chunk size, clamp the bytes per chunk if (source.m_space != nullptr && source.m_space->byte_to_address(1) > 1) { - uint32_t min_bytes_per_chunk = source.m_space->byte_to_address(1); + u32 min_bytes_per_chunk = source.m_space->byte_to_address(1); while (m_bytes_per_chunk < min_bytes_per_chunk) { m_bytes_per_chunk *= 2; @@ -590,7 +590,7 @@ void debug_view_memory::recompute() } // derive total sizes from that - m_total.y = ((uint64_t)m_maxaddr - (uint64_t)m_byte_offset + (uint64_t)m_bytes_per_row /*- 1*/) / m_bytes_per_row; + m_total.y = (u64(m_maxaddr) - u64(m_byte_offset) + u64(m_bytes_per_row) /*- 1*/) / m_bytes_per_row; // reset the current cursor position set_cursor_pos(pos); @@ -732,7 +732,7 @@ void debug_view_memory::set_cursor_pos(cursor_pos pos) // read - generic memory view data reader //------------------------------------------------- -bool debug_view_memory::read(uint8_t size, offs_t offs, uint64_t &data) +bool debug_view_memory::read(u8 size, offs_t offs, u64 &data) { const debug_view_memory_source &source = downcast<const debug_view_memory_source &>(*m_source); @@ -742,7 +742,7 @@ bool debug_view_memory::read(uint8_t size, offs_t offs, uint64_t &data) offs_t dummyaddr = offs; bool ismapped = m_no_translation ? true : source.m_memintf->translate(source.m_space->spacenum(), TRANSLATE_READ_DEBUG, dummyaddr); - data = ~(uint64_t)0; + data = ~u64(0); if (ismapped) { switch (size) @@ -761,7 +761,7 @@ bool debug_view_memory::read(uint8_t size, offs_t offs, uint64_t &data) { size /= 2; - uint64_t data0, data1; + u64 data0, data1; bool ismapped = read(size, offs + 0 * size, data0); ismapped |= read(size, offs + 1 * size, data1); @@ -776,7 +776,7 @@ bool debug_view_memory::read(uint8_t size, offs_t offs, uint64_t &data) offs ^= source.m_offsetxor; if (offs >= source.m_length) return false; - data = *((uint8_t *)source.m_base + offs); + data = *((u8 *)source.m_base + offs); return true; } @@ -785,9 +785,9 @@ bool debug_view_memory::read(uint8_t size, offs_t offs, uint64_t &data) // read - read a 80 bit value //------------------------------------------------- -bool debug_view_memory::read(uint8_t size, offs_t offs, floatx80 &data) +bool debug_view_memory::read(u8 size, offs_t offs, floatx80 &data) { - uint64_t t; + u64 t; bool mappedhi, mappedlo; const debug_view_memory_source &source = downcast<const debug_view_memory_source &>(*m_source); @@ -810,7 +810,7 @@ bool debug_view_memory::read(uint8_t size, offs_t offs, floatx80 &data) // write - generic memory view data writer //------------------------------------------------- -void debug_view_memory::write(uint8_t size, offs_t offs, uint64_t data) +void debug_view_memory::write(u8 size, offs_t offs, u64 data) { const debug_view_memory_source &source = downcast<const debug_view_memory_source &>(*m_source); @@ -848,7 +848,7 @@ void debug_view_memory::write(uint8_t size, offs_t offs, uint64_t data) offs ^= source.m_offsetxor; if (offs >= source.m_length) return; - *((uint8_t *)source.m_base + offs) = data; + *((u8 *)source.m_base + offs) = data; // hack for FD1094 editing #ifdef FD1094_HACK @@ -880,7 +880,7 @@ void debug_view_memory::set_expression(const char *expression) // chunks displayed across a row //------------------------------------------------- -void debug_view_memory::set_chunks_per_row(uint32_t rowchunks) +void debug_view_memory::set_chunks_per_row(u32 rowchunks) { if (rowchunks < 1) return; diff --git a/src/emu/debug/dvmemory.h b/src/emu/debug/dvmemory.h index 695ba5909b0..ca659b64bda 100644 --- a/src/emu/debug/dvmemory.h +++ b/src/emu/debug/dvmemory.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __DVMEMORY_H__ -#define __DVMEMORY_H__ +#ifndef MAME_EMU_DEBUG_DVMEMORY_H +#define MAME_EMU_DEBUG_DVMEMORY_H #include "softfloat/mamesf.h" #include "softfloat/softfloat.h" @@ -37,7 +37,7 @@ private: offs_t m_length; // length of memory offs_t m_offsetxor; // XOR to apply to offsets endianness_t m_endianness; // endianness of memory - uint8_t m_prefsize; // preferred bytes per chunk + u8 m_prefsize; // preferred bytes per chunk }; @@ -54,7 +54,7 @@ public: // getters const char *expression() const { return m_expression.string(); } int get_data_format() { flush_updates(); return m_data_format; } - uint32_t chunks_per_row() { flush_updates(); return m_chunks_per_row; } + u32 chunks_per_row() { flush_updates(); return m_chunks_per_row; } bool reverse() const { return m_reverse_view; } bool ascii() const { return m_ascii_view; } bool physical() const { return m_no_translation; } @@ -62,7 +62,7 @@ public: // setters void set_expression(const char *expression); - void set_chunks_per_row(uint32_t rowchunks); + void set_chunks_per_row(u32 rowchunks); void set_data_format(int format); // 1-8 current values 9 32bit floating point void set_reverse(bool reverse); void set_ascii(bool reverse); @@ -78,9 +78,9 @@ protected: private: struct cursor_pos { - cursor_pos(offs_t address = 0, uint8_t shift = 0) : m_address(address), m_shift(shift) { } + cursor_pos(offs_t address = 0, u8 shift = 0) : m_address(address), m_shift(shift) { } offs_t m_address; - uint8_t m_shift; + u8 m_shift; }; // internal helpers @@ -95,36 +95,36 @@ private: void end_update_and_set_cursor_pos(cursor_pos pos) { set_cursor_pos(pos); end_update(); } // memory access - bool read(uint8_t size, offs_t offs, uint64_t &data); - void write(uint8_t size, offs_t offs, uint64_t data); - bool read(uint8_t size, offs_t offs, floatx80 &data); + bool read(u8 size, offs_t offs, u64 &data); + void write(u8 size, offs_t offs, u64 data); + bool read(u8 size, offs_t offs, floatx80 &data); // internal state debug_view_expression m_expression; // expression describing the start address - uint32_t m_chunks_per_row; // number of chunks displayed per line - uint8_t m_bytes_per_chunk; // bytes per chunk + u32 m_chunks_per_row; // number of chunks displayed per line + u8 m_bytes_per_chunk; // bytes per chunk int m_data_format; // 1-8 current values 9 32bit floating point bool m_reverse_view; // reverse-endian view? bool m_ascii_view; // display ASCII characters? bool m_no_translation; // don't run addresses through the cpu translation hook bool m_edit_enabled; // can modify contents ? offs_t m_maxaddr; // (derived) maximum address to display - uint32_t m_bytes_per_row; // (derived) number of bytes displayed per line - uint32_t m_byte_offset; // (derived) offset of starting visible byte + u32 m_bytes_per_row; // (derived) number of bytes displayed per line + u32 m_byte_offset; // (derived) offset of starting visible byte std::string m_addrformat; // (derived) format string to use to print addresses struct section { bool contains(int x) const { return x >= m_pos && x < m_pos + m_width; } - int32_t m_pos; /* starting position */ - int32_t m_width; /* width of this section */ + s32 m_pos; /* starting position */ + s32 m_width; /* width of this section */ }; section m_section[3]; // (derived) 3 sections to manage struct memory_view_pos { - uint8_t m_spacing; /* spacing between each entry */ - uint8_t m_shift[24]; /* shift for each character */ + u8 m_spacing; /* spacing between each entry */ + u8 m_shift[24]; /* shift for each character */ }; static const memory_view_pos s_memory_pos_table[12]; // table for rendering at different data formats @@ -133,4 +133,4 @@ private: }; -#endif +#endif // MAME_EMU_DEBUG_DVMEMORY_H diff --git a/src/emu/debug/dvstate.cpp b/src/emu/debug/dvstate.cpp index fe3ea7d8082..a7a2215bd9e 100644 --- a/src/emu/debug/dvstate.cpp +++ b/src/emu/debug/dvstate.cpp @@ -142,7 +142,7 @@ void debug_view_state::recompute() // count the entries and determine the maximum tag and value sizes std::size_t count = 0; std::size_t maxtaglen = 0; - uint8_t maxvallen = 0; + u8 maxvallen = 0; for (auto const &item : m_state_list) { count++; @@ -152,8 +152,8 @@ void debug_view_state::recompute() // set the current divider and total cols m_divider = unsigned(1U + maxtaglen + 1U); - m_total.x = uint32_t(1U + maxtaglen + 2U + maxvallen + 1U); - m_total.y = uint32_t(count); + m_total.x = u32(1U + maxtaglen + 2U + maxvallen + 1U); + m_total.y = u32(count); m_topleft.x = 0; m_topleft.y = 0; @@ -187,17 +187,17 @@ void debug_view_state::view_update() // get cycle count if we have an execute interface debug_view_state_source const &source(downcast<debug_view_state_source const &>(*m_source)); - uint64_t const total_cycles(source.m_execintf ? source.m_execintf->total_cycles() : 0); + u64 const total_cycles(source.m_execintf ? source.m_execintf->total_cycles() : 0); bool const cycles_changed(m_last_update != total_cycles); // loop over rows auto it(m_state_list.begin()); screen_device const *const screen(machine().first_screen()); debug_view_char *dest(&m_viewdata[0]); - for (int32_t index = 0, limit = m_topleft.y + m_visible.y; (index < limit) || (it != m_state_list.end()); ++index) + for (s32 index = 0, limit = m_topleft.y + m_visible.y; (index < limit) || (it != m_state_list.end()); ++index) { bool const visible((index >= m_topleft.y) && (index < limit)); - uint32_t col(0); + u32 col(0); if (it != m_state_list.end()) { @@ -254,11 +254,11 @@ void debug_view_state::view_update() if (visible) { // see if we changed - const uint8_t attrib(curitem.changed() ? DCA_CHANGED: DCA_NORMAL); + const u8 attrib(curitem.changed() ? DCA_CHANGED: DCA_NORMAL); // build up a string char temp[256]; - uint32_t len(0); + u32 len(0); if (curitem.m_symbol.length() < (m_divider - 1)) { memset(&temp[len], ' ', m_divider - 1 - curitem.m_symbol.length()); @@ -278,7 +278,7 @@ void debug_view_state::view_update() temp[len] = 0; // copy data - for (uint32_t effcol = m_topleft.x; (col < m_visible.x) && (effcol < len); ++dest, ++col) + for (u32 effcol = m_topleft.x; (col < m_visible.x) && (effcol < len); ++dest, ++col) { dest->byte = temp[effcol++]; dest->attrib = attrib | ((effcol <= m_divider) ? DCA_ANCILLARY : DCA_NORMAL); @@ -305,7 +305,7 @@ void debug_view_state::view_update() // state_item - constructor //------------------------------------------------- -debug_view_state::state_item::state_item(int index, const char *name, uint8_t valuechars) +debug_view_state::state_item::state_item(int index, const char *name, u8 valuechars) : m_lastval(0) , m_currval(0) , m_index(index) @@ -319,7 +319,7 @@ debug_view_state::state_item::state_item(int index, const char *name, uint8_t va // update - update value and save previous //------------------------------------------------- -void debug_view_state::state_item::update(uint64_t newval, bool save) +void debug_view_state::state_item::update(u64 newval, bool save) { if (save) m_lastval = m_currval; diff --git a/src/emu/debug/dvstate.h b/src/emu/debug/dvstate.h index ffc24d6ba57..402ed09ec23 100644 --- a/src/emu/debug/dvstate.h +++ b/src/emu/debug/dvstate.h @@ -53,24 +53,24 @@ private: class state_item { public: - state_item(int index, const char *name, uint8_t valuechars); + state_item(int index, const char *name, u8 valuechars); state_item(const state_item &) = default; state_item(state_item &&) = default; state_item &operator=(const state_item &) = default; state_item &operator=(state_item &&) = default; - uint64_t value() const { return m_currval; } + u64 value() const { return m_currval; } bool changed() const { return m_lastval != m_currval; } int index() const { return m_index; } - uint8_t value_length() const { return m_vallen; } + u8 value_length() const { return m_vallen; } - void update(uint64_t newval, bool save); + void update(u64 newval, bool save); private: - uint64_t m_lastval; // last value - uint64_t m_currval; // current value + u64 m_lastval; // last value + u64 m_currval; // current value int m_index; // index - uint8_t m_vallen; // number of value chars + u8 m_vallen; // number of value chars public: std::string m_symbol; // symbol @@ -83,15 +83,15 @@ private: // internal state int m_divider; // dividing column - uint64_t m_last_update; // execution counter at last update + u64 m_last_update; // execution counter at last update std::vector<state_item> m_state_list; // state data // constants - static const int REG_DIVIDER = -10; - static const int REG_CYCLES = -11; - static const int REG_BEAMX = -12; - static const int REG_BEAMY = -13; - static const int REG_FRAME = -14; + static constexpr int REG_DIVIDER = -10; + static constexpr int REG_CYCLES = -11; + static constexpr int REG_BEAMX = -12; + static constexpr int REG_BEAMY = -13; + static constexpr int REG_FRAME = -14; }; diff --git a/src/emu/debug/dvtext.cpp b/src/emu/debug/dvtext.cpp index 3a86e0eb877..e4672b81974 100644 --- a/src/emu/debug/dvtext.cpp +++ b/src/emu/debug/dvtext.cpp @@ -53,7 +53,7 @@ void debug_view_textbuf::view_update() m_total.x = 80; // determine the starting sequence number - uint32_t curseq = 0; + u32 curseq = 0; if (!m_at_bottom) { curseq = m_topseq; @@ -72,16 +72,16 @@ void debug_view_textbuf::view_update() // loop over visible rows debug_view_char *dest = &m_viewdata[0]; - for (uint32_t row = 0; row < m_visible.y; row++) + for (u32 row = 0; row < m_visible.y; row++) { const char *line = text_buffer_get_seqnum_line(&m_textbuf, curseq++); - uint32_t col = 0; + u32 col = 0; // if this visible row is valid, add it to the buffer if (line != nullptr) { size_t len = strlen(line); - uint32_t effcol = m_topleft.x; + u32 effcol = m_topleft.x; // copy data while (col < m_visible.x && effcol < len) diff --git a/src/emu/debug/dvtext.h b/src/emu/debug/dvtext.h index 7a0efbb9a61..01bd4ee5706 100644 --- a/src/emu/debug/dvtext.h +++ b/src/emu/debug/dvtext.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __DVTEXT_H__ -#define __DVTEXT_H__ +#ifndef MAME_EMU_DEBUG_DVTEXT_H +#define MAME_EMU_DEBUG_DVTEXT_H #include "debugvw.h" #include "textbuf.h" @@ -37,8 +37,8 @@ protected: private: // internal state text_buffer & m_textbuf; /* pointer to the text buffer */ - bool m_at_bottom; /* are we tracking new stuff being added? */ - uint32_t m_topseq; /* sequence number of the top line */ + bool m_at_bottom; /* are we tracking new stuff being added? */ + u32 m_topseq; /* sequence number of the top line */ }; @@ -58,4 +58,4 @@ class debug_view_log : public debug_view_textbuf }; -#endif +#endif // MAME_EMU_DEBUG_DVTEXT_H diff --git a/src/emu/debug/dvwpoints.cpp b/src/emu/debug/dvwpoints.cpp index 68f7d9d5389..d3eb7a00de7 100644 --- a/src/emu/debug/dvwpoints.cpp +++ b/src/emu/debug/dvwpoints.cpp @@ -300,7 +300,7 @@ void debug_view_watchpoints::view_update() pad_ostream_to_length(linebuf, tableBreaks[7]); auto const &text(linebuf.vec()); - for (uint32_t i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) + for (u32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = (i < text.size()) ? text[i] : ' '; dest->attrib = DCA_ANCILLARY; @@ -339,7 +339,7 @@ void debug_view_watchpoints::view_update() pad_ostream_to_length(linebuf, tableBreaks[7]); auto const &text(linebuf.vec()); - for (uint32_t i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) + for (u32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = (i < text.size()) ? text[i] : ' '; dest->attrib = DCA_NORMAL; diff --git a/src/emu/debug/express.cpp b/src/emu/debug/express.cpp index 7c3cc74b3d0..ebc7765ef31 100644 --- a/src/emu/debug/express.cpp +++ b/src/emu/debug/express.cpp @@ -112,24 +112,24 @@ class integer_symbol_entry : public symbol_entry { public: // construction/destruction - integer_symbol_entry(symbol_table &table, const char *name, symbol_table::read_write rw, uint64_t *ptr = nullptr); - integer_symbol_entry(symbol_table &table, const char *name, uint64_t constval); + integer_symbol_entry(symbol_table &table, const char *name, symbol_table::read_write rw, u64 *ptr = nullptr); + integer_symbol_entry(symbol_table &table, const char *name, u64 constval); integer_symbol_entry(symbol_table &table, const char *name, void *ref, symbol_table::getter_func getter, symbol_table::setter_func setter); // symbol access virtual bool is_lval() const override; - virtual uint64_t value() const override; - virtual void set_value(uint64_t newvalue) override; + virtual u64 value() const override; + virtual void set_value(u64 newvalue) override; private: // internal helpers - static uint64_t internal_getter(symbol_table &table, void *symref); - static void internal_setter(symbol_table &table, void *symref, uint64_t value); + static u64 internal_getter(symbol_table &table, void *symref); + static void internal_setter(symbol_table &table, void *symref, u64 value); // internal state symbol_table::getter_func m_getter; symbol_table::setter_func m_setter; - uint64_t m_value; + u64 m_value; }; @@ -142,16 +142,16 @@ public: // symbol access virtual bool is_lval() const override; - virtual uint64_t value() const override; - virtual void set_value(uint64_t newvalue) override; + virtual u64 value() const override; + virtual void set_value(u64 newvalue) override; // execution helper - virtual uint64_t execute(int numparams, const uint64_t *paramlist); + virtual u64 execute(int numparams, const u64 *paramlist); private: // internal state - uint16_t m_minparams; - uint16_t m_maxparams; + u16 m_minparams; + u16 m_maxparams; symbol_table::execute_func m_execute; }; @@ -231,7 +231,7 @@ symbol_entry::~symbol_entry() // integer_symbol_entry - constructor //------------------------------------------------- -integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, symbol_table::read_write rw, uint64_t *ptr) +integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, symbol_table::read_write rw, u64 *ptr) : symbol_entry(table, SMT_INTEGER, name, (ptr == nullptr) ? &m_value : ptr), m_getter(internal_getter), m_setter((rw == symbol_table::READ_ONLY) ? nullptr : internal_setter), @@ -240,7 +240,7 @@ integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name } -integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, uint64_t constval) +integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, u64 constval) : symbol_entry(table, SMT_INTEGER, name, &m_value), m_getter(internal_getter), m_setter(nullptr), @@ -272,7 +272,7 @@ bool integer_symbol_entry::is_lval() const // value - return the value of this symbol //------------------------------------------------- -uint64_t integer_symbol_entry::value() const +u64 integer_symbol_entry::value() const { return m_getter(m_table, m_ref); } @@ -282,7 +282,7 @@ uint64_t integer_symbol_entry::value() const // set_value - set the value of this symbol //------------------------------------------------- -void integer_symbol_entry::set_value(uint64_t newvalue) +void integer_symbol_entry::set_value(u64 newvalue) { if (m_setter != nullptr) m_setter(m_table, m_ref, newvalue); @@ -296,9 +296,9 @@ void integer_symbol_entry::set_value(uint64_t newvalue) // returning the value of a variable //------------------------------------------------- -uint64_t integer_symbol_entry::internal_getter(symbol_table &table, void *symref) +u64 integer_symbol_entry::internal_getter(symbol_table &table, void *symref) { - return *(uint64_t *)symref; + return *(u64 *)symref; } @@ -307,9 +307,9 @@ uint64_t integer_symbol_entry::internal_getter(symbol_table &table, void *symref // the value of a variable //------------------------------------------------- -void integer_symbol_entry::internal_setter(symbol_table &table, void *symref, uint64_t value) +void integer_symbol_entry::internal_setter(symbol_table &table, void *symref, u64 value) { - *(uint64_t *)symref = value; + *(u64 *)symref = value; } @@ -345,7 +345,7 @@ bool function_symbol_entry::is_lval() const // value - return the value of this symbol //------------------------------------------------- -uint64_t function_symbol_entry::value() const +u64 function_symbol_entry::value() const { throw emu_fatalerror("Symbol '%s' is a function and cannot be used in this context", m_name.c_str()); } @@ -355,7 +355,7 @@ uint64_t function_symbol_entry::value() const // set_value - set the value of this symbol //------------------------------------------------- -void function_symbol_entry::set_value(uint64_t newvalue) +void function_symbol_entry::set_value(u64 newvalue) { throw emu_fatalerror("Symbol '%s' is a function and cannot be written", m_name.c_str()); } @@ -365,7 +365,7 @@ void function_symbol_entry::set_value(uint64_t newvalue) // execute - execute the function //------------------------------------------------- -uint64_t function_symbol_entry::execute(int numparams, const uint64_t *paramlist) +u64 function_symbol_entry::execute(int numparams, const u64 *paramlist) { if (numparams < m_minparams) throw emu_fatalerror("Function '%s' requires at least %d parameters", m_name.c_str(), m_minparams); @@ -396,7 +396,7 @@ symbol_table::symbol_table(void *globalref, symbol_table *parent) //------------------------------------------------- -// add - add a new uint64_t pointer symbol +// add - add a new u64 pointer symbol //------------------------------------------------- void symbol_table::configure_memory(void *param, valid_func valid, read_func read, write_func write) @@ -409,10 +409,10 @@ void symbol_table::configure_memory(void *param, valid_func valid, read_func rea //------------------------------------------------- -// add - add a new uint64_t pointer symbol +// add - add a new u64 pointer symbol //------------------------------------------------- -void symbol_table::add(const char *name, read_write rw, uint64_t *ptr) +void symbol_table::add(const char *name, read_write rw, u64 *ptr) { m_symlist.erase(name); m_symlist.emplace(name, std::make_unique<integer_symbol_entry>(*this, name, rw, ptr)); @@ -423,7 +423,7 @@ void symbol_table::add(const char *name, read_write rw, uint64_t *ptr) // add - add a new value symbol //------------------------------------------------- -void symbol_table::add(const char *name, uint64_t value) +void symbol_table::add(const char *name, u64 value) { m_symlist.erase(name); m_symlist.emplace(name, std::make_unique<integer_symbol_entry>(*this, name, value)); @@ -474,7 +474,7 @@ symbol_entry *symbol_table::find_deep(const char *symbol) // value - return the value of a symbol //------------------------------------------------- -uint64_t symbol_table::value(const char *symbol) +u64 symbol_table::value(const char *symbol) { symbol_entry *entry = find_deep(symbol); return (entry != nullptr) ? entry->value() : 0; @@ -485,7 +485,7 @@ uint64_t symbol_table::value(const char *symbol) // set_value - set the value of a symbol //------------------------------------------------- -void symbol_table::set_value(const char *symbol, uint64_t value) +void symbol_table::set_value(const char *symbol, u64 value) { symbol_entry *entry = find_deep(symbol); if (entry != nullptr) @@ -516,7 +516,7 @@ expression_error::error_code symbol_table::memory_valid(const char *name, expres // memory_value - return a value read from memory //------------------------------------------------- -uint64_t symbol_table::memory_value(const char *name, expression_space space, uint32_t offset, int size) +u64 symbol_table::memory_value(const char *name, expression_space space, u32 offset, int size) { // walk up the table hierarchy to find the owner for (symbol_table *symtable = this; symtable != nullptr; symtable = symtable->m_parent) @@ -535,7 +535,7 @@ uint64_t symbol_table::memory_value(const char *name, expression_space space, ui // set_memory_value - write a value to memory //------------------------------------------------- -void symbol_table::set_memory_value(const char *name, expression_space space, uint32_t offset, int size, uint64_t value) +void symbol_table::set_memory_value(const char *name, expression_space space, u32 offset, int size, u64 value) { // walk up the table hierarchy to find the owner for (symbol_table *symtable = this; symtable != nullptr; symtable = symtable->m_parent) @@ -558,7 +558,7 @@ void symbol_table::set_memory_value(const char *name, expression_space space, ui // parsed_expression - constructor //------------------------------------------------- -parsed_expression::parsed_expression(symbol_table *symtable, const char *expression, uint64_t *result) +parsed_expression::parsed_expression(symbol_table *symtable, const char *expression, u64 *result) : m_symtable(symtable), m_token_stack_ptr(0) { @@ -627,7 +627,7 @@ void parsed_expression::print_tokens(FILE *out) break; case parse_token::NUMBER: - fprintf(out, "NUMBER: %08X%08X\n", (uint32_t)(token->value.i >> 32), (uint32_t)token->value.i); + fprintf(out, "NUMBER: %08X%08X\n", (u32)(token->value.i >> 32), u32(token->value.i)); break; case parse_token::STRING: @@ -635,7 +635,7 @@ void parsed_expression::print_tokens(FILE *out) break; case parse_token::SYMBOL: - fprintf(out, "SYMBOL: %08X%08X\n", (uint32_t)(token->value.i >> 32), (uint32_t)token->value.i); + fprintf(out, "SYMBOL: %08X%08X\n", u32(token->value.i >> 32), u32(token->value.i)); break; case parse_token::OPERATOR: @@ -708,7 +708,7 @@ void parsed_expression::parse_string_into_tokens() while (string[0] != 0) { // ignore any whitespace - while (string[0] != 0 && isspace((uint8_t)string[0])) + while (string[0] != 0 && isspace(u8(string[0]))) string++; if (string[0] == 0) break; @@ -717,7 +717,7 @@ void parsed_expression::parse_string_into_tokens() parse_token &token = m_tokenlist.append(*global_alloc(parse_token(string - stringstart))); // switch off the first character - switch (tolower((uint8_t)string[0])) + switch (tolower(u8(string[0]))) { case '(': string += 1, token.configure_operator(TVL_LPAREN, 0); @@ -865,7 +865,7 @@ void parsed_expression::parse_symbol_or_number(parse_token &token, const char *& while (1) { static const char valid[] = "abcdefghijklmnopqrstuvwxyz0123456789_$#.:"; - char val = tolower((uint8_t)string[0]); + char val = tolower(u8(string[0])); if (val == 0 || strchr(valid, val) == nullptr) break; buffer.append(&val, 1); @@ -965,12 +965,12 @@ void parsed_expression::parse_symbol_or_number(parse_token &token, const char *& void parsed_expression::parse_number(parse_token &token, const char *string, int base, expression_error::error_code errcode) { // parse the actual value - uint64_t value = 0; + u64 value = 0; while (*string != 0) { // look up the number's value, stopping if not valid static const char numbers[] = "0123456789abcdef"; - const char *ptr = strchr(numbers, tolower((uint8_t)*string)); + const char *ptr = strchr(numbers, tolower(u8(*string))); if (ptr == nullptr) break; @@ -980,7 +980,7 @@ void parsed_expression::parse_number(parse_token &token, const char *string, int break; // shift previous digits up and add in new digit - value = (value * (uint64_t)base) + digit; + value = (value * u64(base)) + digit; string++; } @@ -1001,7 +1001,7 @@ void parsed_expression::parse_quoted_char(parse_token &token, const char *&strin { // accumulate the value of the character token string++; - uint64_t value = 0; + u64 value = 0; while (string[0] != 0) { // allow '' to mean a nested single quote @@ -1011,7 +1011,7 @@ void parsed_expression::parse_quoted_char(parse_token &token, const char *&strin break; string++; } - value = (value << 8) | (uint8_t)*string++; + value = (value << 8) | u8(*string++); } // if we didn't find the ending quote, report an error @@ -1388,7 +1388,7 @@ inline void parsed_expression::pop_token_rval(parse_token &token) // of tokens //------------------------------------------------- -uint64_t parsed_expression::execute_tokens() +u64 parsed_expression::execute_tokens() { // reset the token stack m_token_stack_ptr = 0; @@ -1674,7 +1674,7 @@ parsed_expression::parse_token::parse_token(int offset) // for a SYMBOL token //------------------------------------------------- -uint64_t parsed_expression::parse_token::get_lval_value(symbol_table *table) +u64 parsed_expression::parse_token::get_lval_value(symbol_table *table) { // get the value of a symbol if (is_symbol()) @@ -1693,7 +1693,7 @@ uint64_t parsed_expression::parse_token::get_lval_value(symbol_table *table) // for a SYMBOL token //------------------------------------------------- -inline void parsed_expression::parse_token::set_lval_value(symbol_table *table, uint64_t value) +inline void parsed_expression::parse_token::set_lval_value(symbol_table *table, u64 value) { // set the value of a symbol if (is_symbol()) @@ -1713,7 +1713,7 @@ inline void parsed_expression::parse_token::set_lval_value(symbol_table *table, void parsed_expression::execute_function(parse_token &token) { // pop off all pushed parameters - uint64_t funcparams[MAX_FUNCTION_PARAMS]; + u64 funcparams[MAX_FUNCTION_PARAMS]; symbol_entry *symbol = nullptr; int paramcount = 0; while (paramcount < MAX_FUNCTION_PARAMS) diff --git a/src/emu/debug/express.h b/src/emu/debug/express.h index 7618bfada20..b9ddde14501 100644 --- a/src/emu/debug/express.h +++ b/src/emu/debug/express.h @@ -129,8 +129,8 @@ public: // symbol access virtual bool is_lval() const = 0; - virtual uint64_t value() const = 0; - virtual void set_value(uint64_t newvalue) = 0; + virtual u64 value() const = 0; + virtual void set_value(u64 newvalue) = 0; protected: // internal state @@ -150,16 +150,16 @@ class symbol_table { public: // callback functions for getting/setting a symbol value - typedef std::function<uint64_t(symbol_table &table, void *symref)> getter_func; - typedef std::function<void(symbol_table &table, void *symref, uint64_t value)> setter_func; + typedef std::function<u64(symbol_table &table, void *symref)> getter_func; + typedef std::function<void(symbol_table &table, void *symref, u64 value)> setter_func; // callback functions for function execution - typedef std::function<uint64_t(symbol_table &table, void *symref, int numparams, const uint64_t *paramlist)> execute_func; + typedef std::function<u64(symbol_table &table, void *symref, int numparams, const u64 *paramlist)> execute_func; // callback functions for memory reads/writes typedef std::function<expression_error::error_code(void *cbparam, const char *name, expression_space space)> valid_func; - typedef std::function<uint64_t(void *cbparam, const char *name, expression_space space, uint32_t offset, int size)> read_func; - typedef std::function<void(void *cbparam, const char *name, expression_space space, uint32_t offset, int size, uint64_t value)> write_func; + typedef std::function<u64(void *cbparam, const char *name, expression_space space, u32 offset, int size)> read_func; + typedef std::function<void(void *cbparam, const char *name, expression_space space, u32 offset, int size, u64 value)> write_func; enum read_write { @@ -179,21 +179,21 @@ public: void configure_memory(void *param, valid_func valid, read_func read, write_func write); // symbol access - void add(const char *name, read_write rw, uint64_t *ptr = nullptr); - void add(const char *name, uint64_t constvalue); + void add(const char *name, read_write rw, u64 *ptr = nullptr); + void add(const char *name, u64 constvalue); void add(const char *name, void *ref, getter_func getter, setter_func setter = nullptr); void add(const char *name, void *ref, int minparams, int maxparams, execute_func execute); symbol_entry *find(const char *name) const { if (name) { auto search = m_symlist.find(name); if (search != m_symlist.end()) return search->second.get(); else return nullptr; } else return nullptr; } symbol_entry *find_deep(const char *name); // value getter/setter - uint64_t value(const char *symbol); - void set_value(const char *symbol, uint64_t value); + u64 value(const char *symbol); + void set_value(const char *symbol, u64 value); // memory accessors expression_error::error_code memory_valid(const char *name, expression_space space); - uint64_t memory_value(const char *name, expression_space space, uint32_t offset, int size); - void set_memory_value(const char *name, expression_space space, uint32_t offset, int size, uint64_t value); + u64 memory_value(const char *name, expression_space space, u32 offset, int size); + void set_memory_value(const char *name, expression_space space, u32 offset, int size, u64 value); private: // internal state @@ -216,7 +216,7 @@ class parsed_expression public: // construction/destruction parsed_expression(const parsed_expression &src) { copy(src); } - parsed_expression(symbol_table *symtable = nullptr, const char *expression = nullptr, uint64_t *result = nullptr); + parsed_expression(symbol_table *symtable = nullptr, const char *expression = nullptr, u64 *result = nullptr); // operators parsed_expression &operator=(const parsed_expression &src) { copy(src); return *this; } @@ -231,7 +231,7 @@ public: // execution void parse(const char *string); - uint64_t execute() { return execute_tokens(); } + u64 execute() { return execute_tokens(); } private: // a single token @@ -279,15 +279,15 @@ private: bool is_memory() const { return (m_type == MEMORY); } bool is_symbol() const { return (m_type == SYMBOL); } bool is_operator() const { return (m_type == OPERATOR); } - bool is_operator(uint8_t type) const { return (m_type == OPERATOR && optype() == type); } + bool is_operator(u8 type) const { return (m_type == OPERATOR && optype() == type); } bool is_lval() const { return ((m_type == SYMBOL && m_symbol->is_lval()) || m_type == MEMORY); } - uint64_t value() const { assert(m_type == NUMBER); return m_value; } - uint32_t address() const { assert(m_type == MEMORY); return m_value; } + u64 value() const { assert(m_type == NUMBER); return m_value; } + u32 address() const { assert(m_type == MEMORY); return m_value; } symbol_entry *symbol() const { assert(m_type == SYMBOL); return m_symbol; } - uint8_t optype() const { assert(m_type == OPERATOR); return (m_flags & TIN_OPTYPE_MASK) >> TIN_OPTYPE_SHIFT; } - uint8_t precedence() const { assert(m_type == OPERATOR); return (m_flags & TIN_PRECEDENCE_MASK) >> TIN_PRECEDENCE_SHIFT; } + u8 optype() const { assert(m_type == OPERATOR); return (m_flags & TIN_OPTYPE_MASK) >> TIN_OPTYPE_SHIFT; } + u8 precedence() const { assert(m_type == OPERATOR); return (m_flags & TIN_PRECEDENCE_MASK) >> TIN_PRECEDENCE_SHIFT; } bool is_function_separator() const { assert(m_type == OPERATOR); return ((m_flags & TIN_FUNCTION_MASK) != 0); } bool right_to_left() const { assert(m_type == OPERATOR); return ((m_flags & TIN_RIGHT_TO_LEFT_MASK) != 0); } expression_space memory_space() const { assert(m_type == OPERATOR || m_type == MEMORY); return expression_space((m_flags & TIN_MEMORY_SPACE_MASK) >> TIN_MEMORY_SPACE_SHIFT); } @@ -297,11 +297,11 @@ private: parse_token &set_offset(int offset) { m_offset = offset; return *this; } parse_token &set_offset(const parse_token &src) { m_offset = src.m_offset; return *this; } parse_token &set_offset(const parse_token &src1, const parse_token &src2) { m_offset = std::min(src1.m_offset, src2.m_offset); return *this; } - parse_token &configure_number(uint64_t value) { m_type = NUMBER; m_value = value; return *this; } + parse_token &configure_number(u64 value) { m_type = NUMBER; m_value = value; return *this; } parse_token &configure_string(const char *string) { m_type = STRING; m_string = string; return *this; } - parse_token &configure_memory(uint32_t address, parse_token &memoryat) { m_type = MEMORY; m_value = address; m_flags = memoryat.m_flags; m_string = memoryat.m_string; return *this; } + parse_token &configure_memory(u32 address, parse_token &memoryat) { m_type = MEMORY; m_value = address; m_flags = memoryat.m_flags; m_string = memoryat.m_string; return *this; } parse_token &configure_symbol(symbol_entry &symbol) { m_type = SYMBOL; m_symbol = &symbol; return *this; } - parse_token &configure_operator(uint8_t optype, uint8_t precedence) + parse_token &configure_operator(u8 optype, u8 precedence) { m_type = OPERATOR; m_flags = ((optype << TIN_OPTYPE_SHIFT) & TIN_OPTYPE_MASK) | ((precedence << TIN_PRECEDENCE_SHIFT) & TIN_PRECEDENCE_MASK); return *this; } parse_token &set_function_separator() { assert(m_type == OPERATOR); m_flags |= TIN_FUNCTION_MASK; return *this; } @@ -311,16 +311,16 @@ private: parse_token &set_memory_source(const char *string) { assert(m_type == OPERATOR || m_type == MEMORY); m_string = string; return *this; } // access - uint64_t get_lval_value(symbol_table *symtable); - void set_lval_value(symbol_table *symtable, uint64_t value); + u64 get_lval_value(symbol_table *symtable); + void set_lval_value(symbol_table *symtable, u64 value); private: // internal state parse_token * m_next; // next token in list token_type m_type; // type of token int m_offset; // offset within the string - uint64_t m_value; // integral value - uint32_t m_flags; // additional flags/info + u64 m_value; // integral value + u32 m_flags; // additional flags/info const char * m_string; // associated string symbol_entry * m_symbol; // symbol pointer }; @@ -366,7 +366,7 @@ private: parse_token *peek_token(int count); void pop_token_lval(parse_token &token); void pop_token_rval(parse_token &token); - uint64_t execute_tokens(); + u64 execute_tokens(); void execute_function(parse_token &token); // constants diff --git a/src/emu/debug/textbuf.cpp b/src/emu/debug/textbuf.cpp index 3e5202476c4..279ce8dead6 100644 --- a/src/emu/debug/textbuf.cpp +++ b/src/emu/debug/textbuf.cpp @@ -27,16 +27,16 @@ struct text_buffer { - char * buffer; - int32_t * lineoffs; - int32_t bufsize; - int32_t bufstart; - int32_t bufend; - int32_t linesize; - int32_t linestart; - int32_t lineend; - uint32_t linestartseq; - int32_t maxwidth; + char * buffer; + s32 * lineoffs; + s32 bufsize; + s32 bufstart; + s32 bufend; + s32 linesize; + s32 linestart; + s32 lineend; + u32 linestartseq; + s32 maxwidth; }; @@ -50,9 +50,9 @@ struct text_buffer currently held in the buffer -------------------------------------------------*/ -static inline int32_t buffer_used(text_buffer *text) +static inline s32 buffer_used(text_buffer *text) { - int32_t used = text->bufend - text->bufstart; + s32 used = text->bufend - text->bufstart; if (used < 0) used += text->bufsize; return used; @@ -64,7 +64,7 @@ static inline int32_t buffer_used(text_buffer *text) available in the buffer -------------------------------------------------*/ -static inline int32_t buffer_space(text_buffer *text) +static inline s32 buffer_space(text_buffer *text) { return text->bufsize - buffer_used(text); } @@ -81,7 +81,7 @@ static inline int32_t buffer_space(text_buffer *text) text_buffer_alloc - allocate a new text buffer -------------------------------------------------*/ -text_buffer *text_buffer_alloc(uint32_t bytes, uint32_t lines) +text_buffer *text_buffer_alloc(u32 bytes, u32 lines) { text_buffer *text; @@ -99,7 +99,7 @@ text_buffer *text_buffer_alloc(uint32_t bytes, uint32_t lines) } /* allocate memory for the lines array */ - text->lineoffs = global_alloc_array_nothrow(int32_t, lines); + text->lineoffs = global_alloc_array_nothrow(s32, lines); if (!text->lineoffs) { global_free_array(text->buffer); @@ -179,11 +179,11 @@ void text_buffer_print(text_buffer *text, const char *data) void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol) { - int32_t stopcol = (wrapcol < MAX_LINE_LENGTH) ? wrapcol : MAX_LINE_LENGTH; - int32_t needed_space; + s32 stopcol = (wrapcol < MAX_LINE_LENGTH) ? wrapcol : MAX_LINE_LENGTH; + s32 needed_space; /* we need to ensure there is enough space for this string plus enough for the max line length */ - needed_space = (int32_t)strlen(data) + MAX_LINE_LENGTH; + needed_space = s32(strlen(data)) + MAX_LINE_LENGTH; /* make space in the buffer if we need to */ while (buffer_space(text) < needed_space && text->linestart != text->lineend) @@ -278,7 +278,7 @@ void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol) width of all lines seen so far -------------------------------------------------*/ -uint32_t text_buffer_max_width(text_buffer *text) +u32 text_buffer_max_width(text_buffer *text) { return text->maxwidth; } @@ -289,9 +289,9 @@ uint32_t text_buffer_max_width(text_buffer *text) lines in the text buffer -------------------------------------------------*/ -uint32_t text_buffer_num_lines(text_buffer *text) +u32 text_buffer_num_lines(text_buffer *text) { - int32_t lines = text->lineend + 1 - text->linestart; + s32 lines = text->lineend + 1 - text->linestart; if (lines <= 0) lines += text->linesize; return lines; @@ -303,7 +303,7 @@ uint32_t text_buffer_num_lines(text_buffer *text) line index into a sequence number -------------------------------------------------*/ -uint32_t text_buffer_line_index_to_seqnum(text_buffer *text, uint32_t index) +u32 text_buffer_line_index_to_seqnum(text_buffer *text, u32 index) { return text->linestartseq + index; } @@ -314,10 +314,10 @@ uint32_t text_buffer_line_index_to_seqnum(text_buffer *text, uint32_t index) an indexed line in the buffer -------------------------------------------------*/ -const char *text_buffer_get_seqnum_line(text_buffer *text, uint32_t seqnum) +const char *text_buffer_get_seqnum_line(text_buffer *text, u32 seqnum) { - uint32_t numlines = text_buffer_num_lines(text); - uint32_t index = seqnum - text->linestartseq; + u32 numlines = text_buffer_num_lines(text); + u32 index = seqnum - text->linestartseq; if (index >= numlines) return nullptr; return &text->buffer[text->lineoffs[(text->linestart + index) % text->linesize]]; diff --git a/src/emu/debug/textbuf.h b/src/emu/debug/textbuf.h index e9b65c503a7..aed50428d30 100644 --- a/src/emu/debug/textbuf.h +++ b/src/emu/debug/textbuf.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __TEXTBUF_H__ -#define __TEXTBUF_H__ +#ifndef MAME_EMU_DEBUG_TEXTBUF_H +#define MAME_EMU_DEBUG_TEXTBUF_H /*************************************************************************** @@ -25,7 +25,7 @@ struct text_buffer; ***************************************************************************/ /* allocate a new text buffer */ -text_buffer *text_buffer_alloc(uint32_t bytes, uint32_t lines); +text_buffer *text_buffer_alloc(u32 bytes, u32 lines); /* free a text buffer */ void text_buffer_free(text_buffer *text); @@ -40,16 +40,16 @@ void text_buffer_print(text_buffer *text, const char *data); void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol); /* get the maximum width of lines seen so far */ -uint32_t text_buffer_max_width(text_buffer *text); +u32 text_buffer_max_width(text_buffer *text); /* get the current number of lines in the buffer */ -uint32_t text_buffer_num_lines(text_buffer *text); +u32 text_buffer_num_lines(text_buffer *text); /* get an absolute sequence number for a given line */ -uint32_t text_buffer_line_index_to_seqnum(text_buffer *text, uint32_t index); +u32 text_buffer_line_index_to_seqnum(text_buffer *text, u32 index); /* get a sequenced line from the text buffer */ -const char *text_buffer_get_seqnum_line(text_buffer *text, uint32_t seqnum); +const char *text_buffer_get_seqnum_line(text_buffer *text, u32 seqnum); -#endif /* __TEXTBUF_H__ */ +#endif /* MAME_EMU_DEBUG_TEXTBUF_H */ |