summaryrefslogtreecommitdiffstats
path: root/src/mame/machine/fddebug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/machine/fddebug.cpp')
-rw-r--r--src/mame/machine/fddebug.cpp212
1 files changed, 106 insertions, 106 deletions
diff --git a/src/mame/machine/fddebug.cpp b/src/mame/machine/fddebug.cpp
index 22276a29f66..ee7fe6f69f0 100644
--- a/src/mame/machine/fddebug.cpp
+++ b/src/mame/machine/fddebug.cpp
@@ -198,16 +198,16 @@ struct fd1094_possibility
{
offs_t basepc; /* starting PC of the possibility */
int length; /* number of words */
- UINT8 instrbuffer[10]; /* instruction data for disassembler */
- UINT8 keybuffer[10]; /* array of key values to produce the instruction data */
- UINT8 iffy; /* is this an iffy possibility? */
+ uint8_t instrbuffer[10]; /* instruction data for disassembler */
+ uint8_t keybuffer[10]; /* array of key values to produce the instruction data */
+ uint8_t iffy; /* is this an iffy possibility? */
char dasm[256]; /* disassembly */
};
/* an entry in the opcode table */
struct optable_entry
{
- UINT32 flags; /* per-opcode flags */
+ uint32_t flags; /* per-opcode flags */
const char * string; /* identifying string */
};
@@ -218,41 +218,41 @@ struct optable_entry
***************************************************************************/
/* array of PCs not to stop at */
-static UINT8 * ignorepc;
-static UINT8 ignore_all;
+static uint8_t * ignorepc;
+static uint8_t ignore_all;
/* array of information about each opcode */
static optable_entry * optable;
/* buffer for undoing operations */
-static UINT8 * undobuff;
+static uint8_t * undobuff;
/* array of possible instruction decodings */
static fd1094_possibility posslist[4*4*4*4*4];
static int posscount;
/* array of possible seeds */
-static UINT32 * possible_seed;
+static uint32_t * possible_seed;
/* array of constraints */
static fd1094_constraint constraints[MAX_CONSTRAINTS];
static int constcount;
/* stack of search addresses */
-static UINT32 searchstack[MAX_SEARCH_DEPTH];
+static uint32_t searchstack[MAX_SEARCH_DEPTH];
static int searchsp;
/* current key generation parameters */
-static UINT32 fd1094_global;
-static UINT32 fd1094_seed;
-static UINT8 keydirty;
+static uint32_t fd1094_global;
+static uint32_t fd1094_seed;
+static uint8_t keydirty;
/* pointers to our data */
-static UINT16 * coderegion;
-static UINT32 coderegion_words;
-static UINT8 * keyregion;
-static UINT16 * keystatus;
-static UINT32 keystatus_words;
+static uint16_t * coderegion;
+static uint32_t coderegion_words;
+static uint8_t * keyregion;
+static uint16_t * keystatus;
+static uint32_t keystatus_words;
/* key changed callback */
static void (*key_changed)(running_machine &);
@@ -286,18 +286,18 @@ static void execute_fdcset(running_machine &machine, int ref, int params, const
static void execute_fdclist(running_machine &machine, int ref, int params, const char **param);
static void execute_fdcsearch(running_machine &machine, int ref, int params, const char **param);
-static fd1094_possibility *try_all_possibilities(address_space &space, int basepc, int offset, int length, UINT8 *instrbuffer, UINT8 *keybuffer, fd1094_possibility *possdata);
-static void tag_possibility(running_machine &machine, fd1094_possibility *possdata, UINT8 status);
+static fd1094_possibility *try_all_possibilities(address_space &space, int basepc, int offset, int length, uint8_t *instrbuffer, uint8_t *keybuffer, fd1094_possibility *possdata);
+static void tag_possibility(running_machine &machine, fd1094_possibility *possdata, uint8_t status);
static void perform_constrained_search(running_machine &machine);
-static UINT32 find_global_key_matches(UINT32 startwith, UINT16 *output);
-static int find_constraint_sequence(UINT32 global, int quick);
-static int does_key_work_for_constraints(const UINT16 *base, UINT8 *key);
-static UINT32 reconstruct_base_seed(int keybaseaddr, UINT32 startseed);
+static uint32_t find_global_key_matches(uint32_t startwith, uint16_t *output);
+static int find_constraint_sequence(uint32_t global, int quick);
+static int does_key_work_for_constraints(const uint16_t *base, uint8_t *key);
+static uint32_t reconstruct_base_seed(int keybaseaddr, uint32_t startseed);
static void build_optable(running_machine &machine);
-static int validate_ea(address_space &space, UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 flags);
-static int validate_opcode(address_space &space, UINT32 pc, const UINT8 *opdata, int maxwords);
+static int validate_ea(address_space &space, uint32_t pc, uint8_t modereg, const uint8_t *parambase, uint32_t flags);
+static int validate_opcode(address_space &space, uint32_t pc, const uint8_t *opdata, int maxwords);
@@ -328,7 +328,7 @@ static inline int addr_to_keyaddr(offs_t address)
always be 1
-----------------------------------------------*/
-static inline UINT8 mask_for_keyaddr(offs_t address)
+static inline uint8_t mask_for_keyaddr(offs_t address)
{
/* the first half of the key always has bit 0x80 set; the second half 0x40 */
/* however, the values at 0000-0003 and 1000-1003 don't follow this rule */
@@ -346,7 +346,7 @@ static inline UINT8 mask_for_keyaddr(offs_t address)
the specified number of steps
-----------------------------------------------*/
-static inline UINT32 advance_seed(UINT32 seed, int count)
+static inline uint32_t advance_seed(uint32_t seed, int count)
{
/* iterate over the seed for 'count' reps */
while (count--)
@@ -363,7 +363,7 @@ static inline UINT32 advance_seed(UINT32 seed, int count)
from a seed and apply the given mask
-----------------------------------------------*/
-static inline UINT8 key_value_from_seed(UINT32 seed, UINT8 mask)
+static inline uint8_t key_value_from_seed(uint32_t seed, uint8_t mask)
{
/* put bits 16-21 of the seed in the low 6 bits and OR with the mask */
return ((~seed >> 16) & 0x3f) | mask;
@@ -376,15 +376,15 @@ static inline UINT8 key_value_from_seed(UINT32 seed, UINT8 mask)
given seed
-----------------------------------------------*/
-static inline void generate_key_bytes(UINT8 *dest, UINT32 keyoffs, UINT32 count, UINT32 seed)
+static inline void generate_key_bytes(uint8_t *dest, uint32_t keyoffs, uint32_t count, uint32_t seed)
{
int bytenum;
/* generate 'count' bytes of a key */
for (bytenum = 0; bytenum < count; bytenum++)
{
- UINT32 keyaddr = (keyoffs + bytenum) & 0x1fff;
- UINT8 mask = mask_for_keyaddr(keyaddr);
+ uint32_t keyaddr = (keyoffs + bytenum) & 0x1fff;
+ uint8_t mask = mask_for_keyaddr(keyaddr);
/* advance the seed first, then store the derived value */
seed = advance_seed(seed, 1);
@@ -398,7 +398,7 @@ static inline void generate_key_bytes(UINT8 *dest, UINT32 keyoffs, UINT32 count,
an opcode based on the opcode
-----------------------------------------------*/
-static inline UINT8 get_opcode_length(UINT16 opcode)
+static inline uint8_t get_opcode_length(uint16_t opcode)
{
/* return the length from the table */
return optable[opcode].flags >> 28;
@@ -410,7 +410,7 @@ static inline UINT8 get_opcode_length(UINT16 opcode)
constraint
-----------------------------------------------*/
-static inline void set_constraint(fd1094_constraint *constraint, UINT32 pc, UINT16 state, UINT16 value, UINT16 mask)
+static inline void set_constraint(fd1094_constraint *constraint, uint32_t pc, uint16_t state, uint16_t value, uint16_t mask)
{
constraint->pc = pc;
constraint->state = state;
@@ -436,7 +436,7 @@ static inline void print_possibilities(running_machine &machine)
0=no, 1=yes, 2=unlikely
-----------------------------------------------*/
-static inline int pc_is_valid(address_space &space, UINT32 pc, UINT32 flags)
+static inline int pc_is_valid(address_space &space, uint32_t pc, uint32_t flags)
{
/* if we're odd or out of range, fail */
if ((pc & 1) == 1)
@@ -454,7 +454,7 @@ static inline int pc_is_valid(address_space &space, UINT32 pc, UINT32 flags)
valid? 0=no, 1=yes, 2=unlikely
-----------------------------------------------*/
-static inline int addr_is_valid(address_space &space, UINT32 addr, UINT32 flags)
+static inline int addr_is_valid(address_space &space, uint32_t addr, uint32_t flags)
{
/* if this a JMP, the address is a PC */
if (flags & OF_JMP)
@@ -489,22 +489,22 @@ void fd1094_init_debugging(running_machine &machine, const char *cpureg, const c
key_changed = changed;
/* set up the regions */
- coderegion = (UINT16 *)machine.root_device().memregion(cpureg)->base();
+ coderegion = (uint16_t *)machine.root_device().memregion(cpureg)->base();
coderegion_words = machine.root_device().memregion(cpureg)->bytes() / 2;
- keyregion = (UINT8 *)machine.root_device().memregion(keyreg)->base();
- keystatus = (UINT16 *)machine.root_device().memregion(statreg)->base();
+ keyregion = (uint8_t *)machine.root_device().memregion(keyreg)->base();
+ keystatus = (uint16_t *)machine.root_device().memregion(statreg)->base();
keystatus_words = machine.root_device().memregion(statreg)->bytes() / 2;
assert(coderegion_words == keystatus_words);
/* allocate memory for the ignore table */
- ignorepc = make_unique_clear<UINT8>(1 << 23);
+ ignorepc = make_unique_clear<uint8_t>(1 << 23);
/* allocate memory for the undo buffer */
- undobuff = std::make_unique<UINT8[]>(keystatus_words * 2);
+ undobuff = std::make_unique<uint8_t[]>(keystatus_words * 2);
memcpy(undobuff, keystatus, keystatus_words * 2);
/* allocate memory for the possible seeds array */
- possible_seed = std::make_unique<UINT32[]>(65536);
+ possible_seed = std::make_unique<uint32_t[]>(65536);
/* build the opcode table */
build_optable(machine);
@@ -561,8 +561,8 @@ static void set_default_key_params(running_machine &machine)
static const struct
{
const char * gamename;
- UINT32 global;
- UINT32 seed;
+ uint32_t global;
+ uint32_t seed;
} default_keys[] =
{
{ "altbeastj1", 0xFCAFF9F9, 0x177AC6 },
@@ -691,7 +691,7 @@ void fd1094_regenerate_key(running_machine &machine)
static int instruction_hook(device_t &device, offs_t curpc)
{
int curfdstate = fd1094_set_state(keyregion, -1);
- UINT8 instrbuffer[10], keybuffer[5];
+ uint8_t instrbuffer[10], keybuffer[5];
int i, keystat;
/* quick exit if we're ignoring */
@@ -703,7 +703,7 @@ static int instruction_hook(device_t &device, offs_t curpc)
keystatus[curpc/2] = (keystatus[curpc/2] & ~STATE_MASK) | (curfdstate << 8);
if (keystat == STATUS_LOCKED || keystat == STATUS_NOCHANGE)
{
- UINT16 opcode = fd1094_decode(curpc/2, coderegion[curpc/2], keyregion, 0);
+ uint16_t opcode = fd1094_decode(curpc/2, coderegion[curpc/2], keyregion, 0);
int length = get_opcode_length(opcode);
for (i = 1; i < length; i++)
{
@@ -776,7 +776,7 @@ static void execute_fdoutput(running_machine &machine, int ref, int params, cons
static void execute_fdseed(running_machine &machine, int ref, int params, const char **param)
{
- UINT64 num1, num2;
+ uint64_t num1, num2;
/* extract the parameters */
if (!machine.debugger().commands().validate_number_parameter(param[0], &num1))
@@ -803,7 +803,7 @@ static void execute_fdseed(running_machine &machine, int ref, int params, const
static void execute_fdlockguess(running_machine &machine, int ref, int params, const char **param)
{
- UINT64 num1;
+ uint64_t num1;
/* extract the parameter */
if (!machine.debugger().commands().validate_number_parameter(param[0], &num1))
@@ -838,7 +838,7 @@ static void execute_fdeliminate(running_machine &machine, int ref, int params, c
/* extract parameters */
for (pnum = 0; pnum < params; pnum++)
{
- UINT64 num1;
+ uint64_t num1;
/* extract the parameters */
if (!machine.debugger().commands().validate_number_parameter(param[pnum], &num1))
@@ -886,7 +886,7 @@ static void execute_fdunlock(running_machine &machine, int ref, int params, cons
device_t *cpu = machine.debugger().cpu().get_visible_cpu();
/* support 0 or 1 parameters */
- UINT64 offset;
+ uint64_t offset;
if (params != 1 || !machine.debugger().commands().validate_number_parameter(param[0], &offset))
offset = cpu->safe_pc();
int keyaddr = addr_to_keyaddr(offset / 2);
@@ -898,7 +898,7 @@ static void execute_fdunlock(running_machine &machine, int ref, int params, cons
const int reps = keystatus_words / KEY_SIZE;
for (int repnum = 0; repnum < reps; repnum++)
{
- UINT16 *dest = &keystatus[repnum * KEY_SIZE + keyaddr];
+ uint16_t *dest = &keystatus[repnum * KEY_SIZE + keyaddr];
if ((*dest & STATUS_MASK) == STATUS_LOCKED)
*dest &= ~STATUS_MASK & ~HIBITS_MASK;
@@ -930,7 +930,7 @@ static void execute_fdignore(running_machine &machine, int ref, int params, cons
return;
}
- UINT64 offset;
+ uint64_t offset;
if (params != 1 || !machine.debugger().commands().validate_number_parameter(param[0], &offset))
offset = cpu->safe_pc();
offset /= 2;
@@ -1001,7 +1001,7 @@ static void execute_fdstatus(running_machine &machine, int ref, int params, cons
static void execute_fdstate(running_machine &machine, int ref, int params, const char **param)
{
- UINT64 newstate;
+ uint64_t newstate;
/* set the new state if we got a parameter */
if (params > 0)
@@ -1029,7 +1029,7 @@ static void execute_fdpc(running_machine &machine, int ref, int params, const ch
device_t *cpu = machine.debugger().cpu().get_visible_cpu();
/* support 0 or 1 parameters */
- UINT64 newpc = 0;
+ uint64_t newpc = 0;
if (!machine.debugger().commands().validate_number_parameter(param[0], &newpc))
newpc = cpu->safe_pc();
@@ -1051,8 +1051,8 @@ static void execute_fdsearch(running_machine &machine, int ref, int params, cons
address_space &space = machine->debugger().cpu().get_visible_cpu()->memory().space(AS_PROGRAM);
int pc = space.device().safe_pc();
int length, first = TRUE;
- UINT8 instrdata[2];
- UINT16 decoded;
+ uint8_t instrdata[2];
+ uint16_t decoded;
/* if we don't match, reset the stack */
if (searchsp == 0 || searchstack[searchsp-1] != pc)
@@ -1115,14 +1115,14 @@ static void execute_fdsearch(running_machine &machine, int ref, int params, cons
/* handle branches */
if (optable[decoded].flags & OF_BRANCH)
{
- int deltapc = (INT8)decoded;
+ int deltapc = (int8_t)decoded;
int targetpc;
/* extract the delta PC */
if ((optable[decoded].flags & OF_ISIZEMASK) == OF_IMMW)
- deltapc = (INT16)fd1094_decode((pc+2)/2, coderegion[(pc+2)/2], keyregion, 0);
+ deltapc = (int16_t)fd1094_decode((pc+2)/2, coderegion[(pc+2)/2], keyregion, 0);
else if ((optable[decoded].flags & OF_ISIZEMASK) == OF_IMML)
- deltapc = (INT32)(fd1094_decode((pc+2)/2, coderegion[(pc+2)/2], keyregion, 0) << 16) + fd1094_decode((pc+4)/2, coderegion[(pc+4)/2], keyregion, 0);
+ deltapc = (int32_t)(fd1094_decode((pc+2)/2, coderegion[(pc+2)/2], keyregion, 0) << 16) + fd1094_decode((pc+4)/2, coderegion[(pc+4)/2], keyregion, 0);
/* for everything but unconditional branches, push the target on the stack; else just go there */
targetpc = (pc + 2 + deltapc) & 0xffffff;
@@ -1143,9 +1143,9 @@ static void execute_fdsearch(running_machine &machine, int ref, int params, cons
/* determine the target PC */
if ((decoded & 0x3f) == 0x38)
- targetpc = (INT16)fd1094_decode((pc+2)/2, coderegion[(pc+2)/2], keyregion, 0);
+ targetpc = (int16_t)fd1094_decode((pc+2)/2, coderegion[(pc+2)/2], keyregion, 0);
else
- targetpc = (INT32)(fd1094_decode((pc+2)/2, coderegion[(pc+2)/2], keyregion, 0) << 16) + fd1094_decode((pc+4)/2, coderegion[(pc+4)/2], keyregion, 0);
+ targetpc = (int32_t)(fd1094_decode((pc+2)/2, coderegion[(pc+2)/2], keyregion, 0) << 16) + fd1094_decode((pc+4)/2, coderegion[(pc+4)/2], keyregion, 0);
/* for jsr's, add a stack entry to explore the destination; else just go there */
if ((decoded & 0xffc0) == 0x4e80)
@@ -1178,7 +1178,7 @@ static void execute_fddasm(running_machine &machine, int ref, int params, const
int origstate = fd1094_set_state(keyregion, -1);
const char *filename;
int skipped = FALSE;
- UINT32 pcaddr;
+ uint32_t pcaddr;
/* extract the parameters */
filename = param[0];
@@ -1195,11 +1195,11 @@ static void execute_fddasm(running_machine &machine, int ref, int params, const
/* now do the disassembly */
for (pcaddr = 0; pcaddr < coderegion_words; )
{
- UINT8 instrbuffer[10];
+ uint8_t instrbuffer[10];
int unknowns = FALSE;
int length, pcoffs;
char disasm[256];
- UINT16 decoded;
+ uint16_t decoded;
int pnum;
/* if we haven't visited this word, go to the next */
@@ -1259,7 +1259,7 @@ static void execute_fddasm(running_machine &machine, int ref, int params, const
/* if we have unknowns, display them as well */
if (unknowns > 0)
{
- UINT8 keybuffer[5];
+ uint8_t keybuffer[5];
int posscount = try_all_possibilities(space, pcaddr * 2, 0, 0, instrbuffer, keybuffer, posslist) - posslist;
for (pnum = 0; pnum < posscount; pnum++)
if (strcmp(disasm, posslist[pnum].dasm) != 0)
@@ -1290,7 +1290,7 @@ static void execute_fddasm(running_machine &machine, int ref, int params, const
static void execute_fdcset(running_machine &machine, int ref, int params, const char **param)
{
- UINT64 pc, value, mask = 0xffff, state = FD1094_STATE_RESET;
+ uint64_t pc, value, mask = 0xffff, state = FD1094_STATE_RESET;
int cnum;
/* extract the parameters */
@@ -1311,7 +1311,7 @@ static void execute_fdcset(running_machine &machine, int ref, int params, const
/* validate parameters */
if ((pc & 1) != 0 || pc > 0xffffff)
{
- machine.debugger().console().printf("Invalid PC specified (%08X)\n", (UINT32)pc);
+ machine.debugger().console().printf("Invalid PC specified (%08X)\n", (uint32_t)pc);
return;
}
@@ -1379,11 +1379,11 @@ static void execute_fdcsearch(running_machine &machine, int ref, int params, con
length
-----------------------------------------------*/
-static fd1094_possibility *try_all_possibilities(address_space &space, int basepc, int offset, int length, UINT8 *instrbuffer, UINT8 *keybuffer, fd1094_possibility *possdata)
+static fd1094_possibility *try_all_possibilities(address_space &space, int basepc, int offset, int length, uint8_t *instrbuffer, uint8_t *keybuffer, fd1094_possibility *possdata)
{
- UINT8 keymask, keystat;
- UINT16 possvalue[4];
- UINT8 posskey[4];
+ uint8_t keymask, keystat;
+ uint16_t possvalue[4];
+ uint8_t posskey[4];
int numposs = 0;
int decoded;
int keyaddr;
@@ -1408,7 +1408,7 @@ static fd1094_possibility *try_all_possibilities(address_space &space, int basep
else
{
/* remember the original key and iterate over high bits */
- UINT8 origkey = keyregion[keyaddr];
+ uint8_t origkey = keyregion[keyaddr];
for (hibit = 0x00; hibit < 0x100; hibit += 0x40)
if ((hibit & keymask) == keymask)
{
@@ -1418,7 +1418,7 @@ static fd1094_possibility *try_all_possibilities(address_space &space, int basep
/* see if we already got that value */
for (i = 0; i < numposs; i++)
- if ((UINT16)decoded == possvalue[i])
+ if ((uint16_t)decoded == possvalue[i])
break;
/* if not, add it to the list */
@@ -1503,12 +1503,12 @@ static fd1094_possibility *try_all_possibilities(address_space &space, int basep
with the specified status
-----------------------------------------------*/
-static void tag_possibility(running_machine &machine, fd1094_possibility *possdata, UINT8 status)
+static void tag_possibility(running_machine &machine, fd1094_possibility *possdata, uint8_t status)
{
int curfdstate = fd1094_set_state(keyregion, -1);
int nomatter = 0, locked = 0, guessed = 0;
int reps = keystatus_words / KEY_SIZE;
- UINT8 newstat[5];
+ uint8_t newstat[5];
int pcoffs;
/* determine the new status for each word */
@@ -1579,7 +1579,7 @@ static void tag_possibility(running_machine &machine, fd1094_possibility *possda
static void perform_constrained_search(running_machine &machine)
{
- UINT32 global;
+ uint32_t global;
/* ensure our first 4 constraints are what we expect */
assert(constraints[0].pc == 0x000000);
@@ -1593,7 +1593,7 @@ static void perform_constrained_search(running_machine &machine)
/* loop until we run out of possibilities */
while (1)
{
- UINT16 output[4];
+ uint16_t output[4];
int numseeds;
/* look for the next global key match */
@@ -1620,10 +1620,10 @@ static void perform_constrained_search(running_machine &machine)
given sequence/mask pair
-----------------------------------------------*/
-static UINT32 find_global_key_matches(UINT32 startwith, UINT16 *output)
+static uint32_t find_global_key_matches(uint32_t startwith, uint16_t *output)
{
int key0, key1, key2, key3;
- UINT8 key[4];
+ uint8_t key[4];
/* iterate over the first key byte, allowing all possible values */
for (key0 = (startwith >> 24) & 0xff; key0 < 256; key0++)
@@ -1692,16 +1692,16 @@ static UINT32 find_global_key_matches(UINT32 startwith, UINT16 *output)
results
-----------------------------------------------*/
-static int find_constraint_sequence(UINT32 global, int quick)
+static int find_constraint_sequence(uint32_t global, int quick)
{
const fd1094_constraint *minkeyaddr = &constraints[4];
const fd1094_constraint *maxkeyaddr = &constraints[4];
const fd1094_constraint *curr;
int keyvalue, keyaddr, keysneeded;
int seedcount = 0;
- UINT16 decrypted;
- UINT8 key[8192];
- UINT8 keymask;
+ uint16_t decrypted;
+ uint8_t key[8192];
+ uint8_t keymask;
offs_t pcaddr;
/* if we don't have any extra constraints, we're good */
@@ -1779,7 +1779,7 @@ static int find_constraint_sequence(UINT32 global, int quick)
/* if we got a match, then iterate over all possible PRNG sequences starting with this */
if ((decrypted & minkeyaddr->mask) == minkeyaddr->value)
{
- UINT32 seedlow;
+ uint32_t seedlow;
// machine.debugger().console().printf("Global %08X ... Looking for keys that generate a keyvalue of %02X at %04X\n",
// global, keyvalue, keyaddr);
@@ -1788,7 +1788,7 @@ static int find_constraint_sequence(UINT32 global, int quick)
for (seedlow = 0; seedlow < (1 << 16); seedlow++)
{
/* start with the known upper bits together with the 16 guessed lower bits */
- UINT32 seedstart = (~keyvalue << 16) | seedlow;
+ uint32_t seedstart = (~keyvalue << 16) | seedlow;
/* generate data starting with this seed into the key */
generate_key_bytes(key, keyaddr + 1, keysneeded - 1, seedstart);
@@ -1814,17 +1814,17 @@ static int find_constraint_sequence(UINT32 global, int quick)
of constraints
-----------------------------------------------*/
-static int does_key_work_for_constraints(const UINT16 *base, UINT8 *key)
+static int does_key_work_for_constraints(const uint16_t *base, uint8_t *key)
{
const fd1094_constraint *curr;
- UINT16 decrypted;
+ uint16_t decrypted;
/* iterate over the sequence */
for (curr = &constraints[4]; curr < &constraints[constcount]; curr++)
{
offs_t pcaddr = curr->pc / 2;
int keyaddr = addr_to_keyaddr(pcaddr);
- UINT8 keymask = mask_for_keyaddr(keyaddr);
+ uint8_t keymask = mask_for_keyaddr(keyaddr);
int hibits;
/* set the state */
@@ -1860,10 +1860,10 @@ static int does_key_work_for_constraints(const UINT16 *base, UINT8 *key)
first key value (at offset 4)
-----------------------------------------------*/
-static UINT32 reconstruct_base_seed(int keybaseaddr, UINT32 startseed)
+static uint32_t reconstruct_base_seed(int keybaseaddr, uint32_t startseed)
{
- UINT32 seed = startseed;
- UINT32 window[8192];
+ uint32_t seed = startseed;
+ uint32_t window[8192];
int index = 0;
/* keep generating, starting from the start seed until we re-generate the start seed */
@@ -1899,7 +1899,7 @@ static const struct
{
const char * bitstring;
const char * eastring;
- UINT32 flags;
+ uint32_t flags;
const char * instring;
} instr_table[] =
{
@@ -2100,10 +2100,10 @@ static void build_optable(running_machine &machine)
const char *bitstring = instr_table[inum].bitstring;
const char *eastring = instr_table[inum].eastring;
const char *instring = instr_table[inum].instring;
- UINT32 flags = instr_table[inum].flags;
- UINT8 ea_allowed[64], ea2_allowed[64];
+ uint32_t flags = instr_table[inum].flags;
+ uint8_t ea_allowed[64], ea2_allowed[64];
int bitnum, step, eanum, ea2num;
- UINT16 mask = 0, value = 0;
+ uint16_t mask = 0, value = 0;
/* build up the mask and value from the bitstring */
for (bitnum = 0; bitnum < 16; bitnum++)
@@ -2168,7 +2168,7 @@ static void build_optable(running_machine &machine)
for (eanum = 0; eanum < 64; eanum++)
if (ea_allowed[eanum])
{
- UINT16 eabits = ((ea2num & 0x38) << 3) | ((ea2num & 0x07) << 9) | eanum;
+ uint16_t eabits = ((ea2num & 0x38) << 3) | ((ea2num & 0x07) << 9) | eanum;
/* iterate over opcode entries */
for (opnum = 0; opnum <= mask; opnum += step)
@@ -2200,7 +2200,7 @@ static void build_optable(running_machine &machine)
#ifdef MAME_DEBUG
{
char dummybuffer[40];
- UINT8 instrbuffer[10];
+ uint8_t instrbuffer[10];
instrbuffer[0] = (opnum | eabits) >> 8;
instrbuffer[1] = (opnum | eabits);
dummybuffer[0] = 0;
@@ -2222,9 +2222,9 @@ static void build_optable(running_machine &machine)
valid or not, and return the length
-----------------------------------------------*/
-static int validate_ea(address_space &space, UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 flags)
+static int validate_ea(address_space &space, uint32_t pc, uint8_t modereg, const uint8_t *parambase, uint32_t flags)
{
- UINT32 addr;
+ uint32_t addr;
int valid;
/* switch off of the mode */
@@ -2254,7 +2254,7 @@ static int validate_ea(address_space &space, UINT32 pc, UINT8 modereg, const UIN
switch (modereg & 7)
{
case 0: /* (xxx).W -- make sure it is not odd for word/long */
- addr = (INT16)((parambase[0] << 8) | parambase[1]);
+ addr = (int16_t)((parambase[0] << 8) | parambase[1]);
valid = addr_is_valid(space, addr & 0xffffff, flags);
return (valid == 0) ? 1000 : (valid == 2) ? -1 : 1;
@@ -2263,7 +2263,7 @@ static int validate_ea(address_space &space, UINT32 pc, UINT8 modereg, const UIN
return (valid == 0) ? 1000 : (valid == 2) ? -2 : 2;
case 2: /* (d16,PC) -- make sure it is not odd for word/long */
- valid = addr_is_valid(space, pc + (INT16)((parambase[0] << 8) | parambase[1]), flags);
+ valid = addr_is_valid(space, pc + (int16_t)((parambase[0] << 8) | parambase[1]), flags);
return (valid == 0) ? 1000 : (valid == 2) ? -1 : 1;
case 3: /* (d8,PC,Xn) -- odd displacements are a warning for word/long */
@@ -2292,13 +2292,13 @@ static int validate_ea(address_space &space, UINT32 pc, UINT8 modereg, const UIN
the length specified
-----------------------------------------------*/
-static int validate_opcode(address_space &space, UINT32 pc, const UINT8 *opdata, int maxwords)
+static int validate_opcode(address_space &space, uint32_t pc, const uint8_t *opdata, int maxwords)
{
- UINT32 immvalue = 0;
+ uint32_t immvalue = 0;
int iffy = FALSE;
int offset = 0;
- UINT16 opcode;
- UINT32 flags;
+ uint16_t opcode;
+ uint32_t flags;
int oplength;
assert(maxwords >= 1);
@@ -2362,9 +2362,9 @@ static int validate_opcode(address_space &space, UINT32 pc, const UINT8 *opdata,
/* first adjust the PC based on the size of the branch */
pc += 2;
if ((flags & OF_SIZEMASK) == OF_BYTE)
- pc += (INT8)opcode;
+ pc += (int8_t)opcode;
else if ((flags & OF_SIZEMASK) == OF_WORD)
- pc += (INT16)immvalue;
+ pc += (int16_t)immvalue;
else
pc += immvalue;