diff options
Diffstat (limited to 'src/devices/cpu/alto2/a2roms.cpp')
-rw-r--r-- | src/devices/cpu/alto2/a2roms.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/devices/cpu/alto2/a2roms.cpp b/src/devices/cpu/alto2/a2roms.cpp index 995d1841da2..ec262d1be27 100644 --- a/src/devices/cpu/alto2/a2roms.cpp +++ b/src/devices/cpu/alto2/a2roms.cpp @@ -17,7 +17,7 @@ * but first step is mapping 2-bit values * into sum of 2 1-bit values in sneaky way. */ -static UINT32 ones_u32(UINT32 val) +static uint32_t ones_u32(uint32_t val) { val -= ((val >> 1) & 0x55555555); val = (((val >> 2) & 0x33333333) + (val & 0x33333333)); @@ -30,7 +30,7 @@ static UINT32 ones_u32(UINT32 val) /** * @brief return the log2 of an integer value */ -static UINT32 log2_u32(UINT32 val) +static uint32_t log2_u32(uint32_t val) { val |= (val >> 1); val |= (val >> 2); @@ -48,12 +48,12 @@ static UINT32 log2_u32(UINT32 val) * @param val value to map * @result returns the remapped value, or just val, if map was nullptr */ -static UINT32 map_lines(const UINT8 *map, int lines, UINT32 val) +static uint32_t map_lines(const uint8_t *map, int lines, uint32_t val) { if (nullptr == map) return val; - UINT32 res = 0; + uint32_t res = 0; for (int i = 0; i < lines; i++) if (val & (1 << i)) res |= 1 << map[i]; @@ -64,29 +64,29 @@ static UINT32 map_lines(const UINT8 *map, int lines, UINT32 val) * @brief write to a ROM base + address of type 'type', ANDing with and, ORing with or * * @param base ROM base address in memory - * @param type one of 1 for UINT8, 2 for UINT16, 4 for UINT32 + * @param type one of 1 for uint8_t, 2 for uint16_t, 4 for uint32_t * @param addr address offset into base * @param dand value to AND to contents before XORing * @param dxor value to XOR before writing back */ -static void write_type_and_xor(void *base, int type, UINT32 addr, UINT32 dand, UINT32 dxor) +static void write_type_and_xor(void *base, int type, uint32_t addr, uint32_t dand, uint32_t dxor) { switch (type) { - case sizeof(UINT8): + case sizeof(uint8_t): { - UINT8 *base8 = reinterpret_cast<UINT8 *>(base); + uint8_t *base8 = reinterpret_cast<uint8_t *>(base); base8[addr] = (base8[addr] & dand) ^ dxor; } break; - case sizeof(UINT16): + case sizeof(uint16_t): { - UINT16 *base16 = reinterpret_cast<UINT16 *>(base); + uint16_t *base16 = reinterpret_cast<uint16_t *>(base); base16[addr] = (base16[addr] & dand) ^ dxor; } break; - case sizeof(UINT32): + case sizeof(uint32_t): { - UINT32 *base32 = reinterpret_cast<UINT32 *>(base); + uint32_t *base32 = reinterpret_cast<uint32_t *>(base); base32[addr] = (base32[addr] & dand) ^ dxor; } break; @@ -103,39 +103,39 @@ static void write_type_and_xor(void *base, int type, UINT32 addr, UINT32 dand, U * @param segments number of segments in one page of the result * @return pointer to the newly allocated memory filled with source bits */ -UINT8* prom_load(running_machine& machine, const prom_load_t* prom, const UINT8* src, int pages, int segments) +uint8_t* prom_load(running_machine& machine, const prom_load_t* prom, const uint8_t* src, int pages, int segments) { void* array = nullptr; size_t type = prom->type; size_t size = prom->size; #if DEBUG_PROM_LOAD - UINT8 width = prom->width; + uint8_t width = prom->width; #endif switch (type) { - case sizeof(UINT8): - array = auto_alloc_array(machine, UINT8, pages * size); + case sizeof(uint8_t): + array = auto_alloc_array(machine, uint8_t, pages * size); break; - case sizeof(UINT16): - array = auto_alloc_array(machine, UINT16, pages * size); + case sizeof(uint16_t): + array = auto_alloc_array(machine, uint16_t, pages * size); break; - case sizeof(UINT32): - array = auto_alloc_array(machine, UINT32, pages * size); + case sizeof(uint32_t): + array = auto_alloc_array(machine, uint32_t, pages * size); break; } - UINT8* base = reinterpret_cast<UINT8*>(array); + uint8_t* base = reinterpret_cast<uint8_t*>(array); for (int page = 0; page < pages; page++) { - UINT8* dst = base + (prom->type * prom->size * page); + uint8_t* dst = base + (prom->type * prom->size * page); for (int segment = 0; segment < segments; segment++, prom++) { - for (UINT32 src_addr = 0; src_addr < prom->size; src_addr++) + for (uint32_t src_addr = 0; src_addr < prom->size; src_addr++) { // map destination address lines - UINT32 dst_addr = map_lines(prom->amap, log2_u32(prom->size) + 1, src_addr); + uint32_t dst_addr = map_lines(prom->amap, log2_u32(prom->size) + 1, src_addr); // fetch data bits - UINT32 data = src[src_addr ^ prom->axor] ^ prom->dxor; + uint32_t data = src[src_addr ^ prom->axor] ^ prom->dxor; // mask width bits data = data & ((1 << prom->width) - 1); // map destination data lines @@ -151,9 +151,9 @@ UINT8* prom_load(running_machine& machine, const prom_load_t* prom, const UINT8* #if DEBUG_PROM_LOAD switch (type) { - case sizeof(UINT8): + case sizeof(uint8_t): { - UINT8* data = reinterpret_cast<UINT8*>(array); + uint8_t* data = reinterpret_cast<uint8_t*>(array); for (int addr = 0; addr < pages*size; addr++) { if (0 == (addr % 16)) printf("%04x:", addr); @@ -166,9 +166,9 @@ UINT8* prom_load(running_machine& machine, const prom_load_t* prom, const UINT8* } } break; - case sizeof(UINT16): + case sizeof(uint16_t): { - UINT16* data = reinterpret_cast<UINT16*>(array); + uint16_t* data = reinterpret_cast<uint16_t*>(array); for (int addr = 0; addr < pages*size; addr++) { if (0 == (addr % 8)) printf("%04x:", addr); @@ -178,9 +178,9 @@ UINT8* prom_load(running_machine& machine, const prom_load_t* prom, const UINT8* } } break; - case sizeof(UINT32): + case sizeof(uint32_t): { - UINT32* data = reinterpret_cast<UINT32*>(array); + uint32_t* data = reinterpret_cast<uint32_t*>(array); for (int addr = 0; addr < pages*size; addr++) { if (0 == (addr % 4)) printf("%04x:", addr); @@ -192,5 +192,5 @@ UINT8* prom_load(running_machine& machine, const prom_load_t* prom, const UINT8* break; } #endif - return reinterpret_cast<UINT8 *>(array); + return reinterpret_cast<uint8_t *>(array); } |