diff --git a/src/emu/cpu/mc68hc11/mc68hc11.c b/src/emu/cpu/mc68hc11/mc68hc11.c index a0d1cf7a3cf..9e73eb79b42 100644 --- a/src/emu/cpu/mc68hc11/mc68hc11.c +++ b/src/emu/cpu/mc68hc11/mc68hc11.c @@ -550,13 +550,11 @@ static void check_irq_lines(hc11_state *cpustate) { int divider = div_tab[cpustate->pr & 3]; UINT64 cur_time = cpustate->device->total_cycles(); - UINT64 add = (cur_time - cpustate->frc_base) / divider; + UINT32 add = (cur_time - cpustate->frc_base) / divider; if (add > 0) { - int i; - - for(i=0;itcnt++; if(cpustate->tcnt == cpustate->toc1) diff --git a/src/emu/cpu/rsp/rspdrc.c b/src/emu/cpu/rsp/rspdrc.c index 59c501b47e9..0d75a8fdda8 100644 --- a/src/emu/cpu/rsp/rspdrc.c +++ b/src/emu/cpu/rsp/rspdrc.c @@ -2448,13 +2448,13 @@ INLINE void cfunc_rsp_vmacu(void *param) { if (ACCUM_H(i) != 0) { - vres[i] = 0xffff; + vres[i] = (INT16)0xffff; } else { if ((INT16)ACCUM_M(i) < 0) { - vres[i] = 0xffff; + vres[i] = (INT16)0xffff; } else { diff --git a/src/emu/cpu/tms32031/32031ops.c b/src/emu/cpu/tms32031/32031ops.c index ba58851e64f..dcc4142740a 100644 --- a/src/emu/cpu/tms32031/32031ops.c +++ b/src/emu/cpu/tms32031/32031ops.c @@ -84,8 +84,8 @@ #define OR_V_ADD(a,b,r) do { UINT32 temp = ((((a) ^ (r)) & ((b) ^ (r))) >> 30) & VFLAG; IREG(TMR_ST) |= temp | (temp << 4); } while (0) #define OR_C_SUB(a,b,r) do { IREG(TMR_ST) |= ((UINT32)(b) > (UINT32)(a)); } while (0) #define OR_C_ADD(a,b,r) do { IREG(TMR_ST) |= ((UINT32)(a) > (UINT32)(r)); } while (0) -#define OR_C_SBB(a,b,c) do { INT64 temp = (UINT32)(a) - (UINT32)(b) - (UINT32)(c); IREG(TMR_ST) |= (temp < 0); } while (0) -#define OR_C_ADC(a,b,c) do { UINT64 temp = (UINT32)(a) + (UINT32)(b) + (UINT32)(c); IREG(TMR_ST) |= (temp > 0xffffffffUL); } while (0) +#define OR_C_SBB(a,b,c) do { INT64 temp = (INT64)(a) - (UINT32)(b) - (UINT32)(c); IREG(TMR_ST) |= (temp < 0); } while (0) +#define OR_C_ADC(a,b,c) do { UINT64 temp = (UINT64)(a) + (UINT32)(b) + (UINT32)(c); IREG(TMR_ST) |= (temp > 0xffffffff); } while (0) #define OVM() (IREG(TMR_ST) & OVMFLAG) diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c index e112939bb1d..badc0cb997f 100644 --- a/src/emu/debug/debugcmd.c +++ b/src/emu/debug/debugcmd.c @@ -2061,7 +2061,7 @@ static void execute_cheatinit(running_machine &machine, int ref, int params, con return; cheat_map *newmap = auto_alloc_array(machine, cheat_map, cheat.length + real_length); - for (int item = 0; item < cheat.length; item++) + for (UINT64 item = 0; item < cheat.length; item++) newmap[item] = cheat.cheatmap[item]; auto_free(machine, cheat.cheatmap); cheat.cheatmap = newmap; @@ -2373,7 +2373,7 @@ static void execute_find(running_machine &machine, int ref, int params, const ch int cur_data_size; int data_count = 0; int found = 0; - UINT64 i, j; + int j; /* validate parameters */ if (!debug_command_parameter_number(machine, param[0], &offset)) @@ -2391,7 +2391,7 @@ static void execute_find(running_machine &machine, int ref, int params, const ch cur_data_size = 1; /* parse the data parameters */ - for (i = 2; i < params; i++) + for (int i = 2; i < params; i++) { const char *pdata = param[i]; @@ -2426,7 +2426,7 @@ static void execute_find(running_machine &machine, int ref, int params, const ch } /* now search */ - for (i = offset; i <= endoffset; i += data_size[0]) + for (UINT64 i = offset; i <= endoffset; i += data_size[0]) { int suboffset = 0; int match = 1; @@ -2469,7 +2469,7 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch int minbytes, maxbytes, byteswidth; address_space *space; FILE *f = NULL; - int i, j; + int j; /* validate parameters */ if (!debug_command_parameter_number(machine, param[1], &offset)) @@ -2501,7 +2501,7 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch } /* now write the data out */ - for (i = 0; i < length; ) + for (UINT64 i = 0; i < length; ) { int pcbyte = space->address_to_byte(offset + i) & space->bytemask(); char output[512], disasm[200]; @@ -2677,7 +2677,7 @@ static void execute_history(running_machine &machine, int ref, int params, const /* loop over lines */ int maxbytes = debug->max_opcode_bytes(); - for (int index = 0; index < count; index++) + for (int index = 0; index < (int) count; index++) { offs_t pc = debug->history_pc(-index); diff --git a/src/emu/machine/msm6242.c b/src/emu/machine/msm6242.c index 6ad5b587def..0e515e7329f 100644 --- a/src/emu/machine/msm6242.c +++ b/src/emu/machine/msm6242.c @@ -251,7 +251,7 @@ void msm6242_device::update_rtc_registers() return; // ticks - if ((m_tick % 200) != ((delta + m_tick) % 0x200)) + if ((m_tick % 200) != (int)((delta + m_tick) % 0x200)) irq(IRQ_64THSECOND); delta = bump(RTC_TICKS, delta, 0, 0x8000); if (delta == 0) diff --git a/src/emu/machine/pit8253.c b/src/emu/machine/pit8253.c index e046c586522..845043a8d87 100644 --- a/src/emu/machine/pit8253.c +++ b/src/emu/machine/pit8253.c @@ -226,7 +226,7 @@ static UINT32 adjusted_count(int bcd, UINT16 val) void pit8253_device::decrease_counter_value(pit8253_timer *timer, UINT64 cycles) { UINT16 value; - int units, tens, hundreds, thousands; + UINT8 units, tens, hundreds, thousands; if (CTRL_BCD(timer->control) == 0) { diff --git a/src/emu/rendfont.c b/src/emu/rendfont.c index d91d1d5b67f..39d733136b9 100644 --- a/src/emu/rendfont.c +++ b/src/emu/rendfont.c @@ -605,7 +605,7 @@ bool render_font::load_cached(emu_file &file, UINT32 hash) m_height = (header[8] << 8) | header[9]; m_scale = 1.0f / (float)m_height; m_yoffs = (INT16)((header[10] << 8) | header[11]); - int numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15]; + UINT32 numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15]; if (filesize - CACHED_HEADER_SIZE < numchars * CACHED_CHAR_SIZE) return false; diff --git a/src/lib/formats/ap2_dsk.c b/src/lib/formats/ap2_dsk.c index 4fde450ab69..1f7ea4a6b4b 100644 --- a/src/lib/formats/ap2_dsk.c +++ b/src/lib/formats/ap2_dsk.c @@ -576,8 +576,8 @@ bool a2_16sect_format::supports_save() const int a2_16sect_format::identify(io_generic *io, UINT32 form_factor) { - int size = io_generic_size(io); - int expected_size = 35 * 16 * 256; + UINT64 size = io_generic_size(io); + UINT32 expected_size = 35 * 16 * 256; return size == expected_size; } @@ -935,8 +935,8 @@ bool a2_rwts18_format::supports_save() const int a2_rwts18_format::identify(io_generic *io, UINT32 form_factor) { - int size = io_generic_size(io); - int expected_size = 35 * 16 * 256; + UINT64 size = io_generic_size(io); + UINT32 expected_size = 35 * 16 * 256; return size == expected_size; } diff --git a/src/lib/formats/ap_dsk35.c b/src/lib/formats/ap_dsk35.c index 092c0831898..ceee8d08825 100644 --- a/src/lib/formats/ap_dsk35.c +++ b/src/lib/formats/ap_dsk35.c @@ -1259,13 +1259,13 @@ bool dc42_format::supports_save() const int dc42_format::identify(io_generic *io, UINT32 form_factor) { UINT8 h[0x54]; - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); if(size < 0x54) return 0; io_generic_read(io, h, 0, 0x54); - int dsize = (h[0x40] << 24) | (h[0x41] << 16) | (h[0x42] << 8) | h[0x43]; - int tsize = (h[0x44] << 24) | (h[0x45] << 16) | (h[0x46] << 8) | h[0x47]; + UINT32 dsize = (h[0x40] << 24) | (h[0x41] << 16) | (h[0x42] << 8) | h[0x43]; + UINT32 tsize = (h[0x44] << 24) | (h[0x45] << 16) | (h[0x46] << 8) | h[0x47]; return dsize > 0 && tsize >= 0 && size == 0x54+tsize+dsize && h[0] < 64 && h[0x52] == 1 && h[0x53] == 0 ? 100 : 0; } diff --git a/src/lib/formats/coco_dsk.c b/src/lib/formats/coco_dsk.c index 9fb5e933d53..2ab89bae312 100644 --- a/src/lib/formats/coco_dsk.c +++ b/src/lib/formats/coco_dsk.c @@ -487,7 +487,8 @@ static FLOPPY_CONSTRUCT(coco_os9_construct) static int coco_vdk_decode_header(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry) { UINT8 header[12]; - int heads, tracks, sectors, sector_length, offset; + UINT8 heads, tracks, sectors; + UINT16 sector_length, offset; UINT64 size; size = floppy_image_size(floppy); @@ -508,9 +509,9 @@ static int coco_vdk_decode_header(floppy_image_legacy *floppy, struct basicdsk_g sectors = 18; sector_length = 0x100; - offset = ((int) header[3]) * 0x100 + header[2]; + offset = header[3] * 0x100 + header[2]; - if (size != (heads * tracks * sectors * sector_length + offset)) + if (size != ((UINT32) heads * tracks * sectors * sector_length + offset)) return -1; if (geometry) diff --git a/src/lib/formats/coupedsk.c b/src/lib/formats/coupedsk.c index 32297663170..30ddcd394a8 100644 --- a/src/lib/formats/coupedsk.c +++ b/src/lib/formats/coupedsk.c @@ -63,7 +63,7 @@ bool mgt_format::supports_save() const int mgt_format::identify(io_generic *io, UINT32 form_factor) { - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); if(/*size == 737280 || */ size == 819200) return 50; @@ -73,7 +73,7 @@ int mgt_format::identify(io_generic *io, UINT32 form_factor) bool mgt_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) { - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); int sector_count = size == 737280 ? 9 : 10; UINT8 sectdata[10*512]; diff --git a/src/lib/formats/d64_dsk.c b/src/lib/formats/d64_dsk.c index 9186f07d510..74620be94b5 100644 --- a/src/lib/formats/d64_dsk.c +++ b/src/lib/formats/d64_dsk.c @@ -113,12 +113,12 @@ const int d64_format::speed_zone[] = int d64_format::find_size(io_generic *io, UINT32 form_factor) { - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); for(int i=0; formats[i].sector_count; i++) { const format &f = formats[i]; - if(size == f.sector_count*f.sector_base_size) + if(size == (UINT32) f.sector_count*f.sector_base_size) return i; - if(size == (f.sector_count*f.sector_base_size) + f.sector_count) + if(size == (UINT32) (f.sector_count*f.sector_base_size) + f.sector_count) return i; } return -1; @@ -218,10 +218,10 @@ bool d64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) return false; const format &f = formats[type]; - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); UINT8 *img; - if(size == f.sector_count*f.sector_base_size) { + if(size == (UINT32)f.sector_count*f.sector_base_size) { img = global_alloc_array(UINT8, size + f.sector_count); memset(&img[size], ERROR_00, f.sector_count); } diff --git a/src/lib/formats/d64_dsk.h b/src/lib/formats/d64_dsk.h index 7f73f45ae89..b28cd9aed04 100644 --- a/src/lib/formats/d64_dsk.h +++ b/src/lib/formats/d64_dsk.h @@ -17,12 +17,12 @@ public: UINT32 form_factor; // See floppy_image for possible values UINT32 variant; // See floppy_image for possible values - int sector_count; - int track_count; - int head_count; - int sector_base_size; - int gap_1; - int gap_2; + UINT16 sector_count; + UINT8 track_count; + UINT8 head_count; + UINT16 sector_base_size; + UINT8 gap_1; + UINT8 gap_2; }; d64_format(); diff --git a/src/lib/formats/d88_dsk.c b/src/lib/formats/d88_dsk.c index e2d476d8087..d576d6f940e 100644 --- a/src/lib/formats/d88_dsk.c +++ b/src/lib/formats/d88_dsk.c @@ -444,7 +444,7 @@ const char *d88_format::extensions() const int d88_format::identify(io_generic *io, UINT32 form_factor) { - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); UINT8 h[32]; io_generic_read(io, h, 0, 32); diff --git a/src/lib/formats/dfi_dsk.c b/src/lib/formats/dfi_dsk.c index 32371010b5f..6a6c6f63552 100644 --- a/src/lib/formats/dfi_dsk.c +++ b/src/lib/formats/dfi_dsk.c @@ -96,8 +96,8 @@ int dfi_format::identify(io_generic *io, UINT32 form_factor) bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) { - int size = io_generic_size(io); - int pos = 4; + UINT64 size = io_generic_size(io); + UINT64 pos = 4; UINT8 *data = 0; int data_size = 0; // size of currently allocated array for a track int onerev_time = 0; // time for one revolution, used to guess clock and rpm for DFE2 files diff --git a/src/lib/formats/dsk_dsk.c b/src/lib/formats/dsk_dsk.c index 9445c7dedd6..d74c7b7e3d7 100644 --- a/src/lib/formats/dsk_dsk.c +++ b/src/lib/formats/dsk_dsk.c @@ -343,7 +343,7 @@ bool dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) UINT8 header[0x100]; bool extendformat = FALSE; - int image_size = io_generic_size(io); + UINT64 image_size = io_generic_size(io); io_generic_read(io, &header, 0, sizeof(header)); if ( memcmp( header, EXT_FORMAT_HEADER, 16 ) ==0) { diff --git a/src/lib/formats/esq16_dsk.c b/src/lib/formats/esq16_dsk.c index b0224111ff1..e5d5c0f65cd 100644 --- a/src/lib/formats/esq16_dsk.c +++ b/src/lib/formats/esq16_dsk.c @@ -68,14 +68,15 @@ bool esqimg_format::supports_save() const return true; } -void esqimg_format::find_size(io_generic *io, int &track_count, int &head_count, int §or_count) +void esqimg_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 §or_count) { - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); track_count = 80; head_count = 2; sector_count = 10; - if (size == 512*track_count*head_count*sector_count) + UINT32 expected_size = 512 * track_count*head_count*sector_count; + if (size == expected_size) { return; } @@ -85,7 +86,7 @@ void esqimg_format::find_size(io_generic *io, int &track_count, int &head_count, int esqimg_format::identify(io_generic *io, UINT32 form_factor) { - int track_count, head_count, sector_count; + UINT8 track_count, head_count, sector_count; find_size(io, track_count, head_count, sector_count); if(track_count) @@ -95,7 +96,7 @@ int esqimg_format::identify(io_generic *io, UINT32 form_factor) bool esqimg_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) { - int track_count, head_count, sector_count; + UINT8 track_count, head_count, sector_count; find_size(io, track_count, head_count, sector_count); UINT8 sectdata[10*512]; diff --git a/src/lib/formats/esq16_dsk.h b/src/lib/formats/esq16_dsk.h index 7c53babac6c..476e14106f6 100644 --- a/src/lib/formats/esq16_dsk.h +++ b/src/lib/formats/esq16_dsk.h @@ -30,7 +30,7 @@ public: static const desc_e esq_10_desc[]; private: - void find_size(io_generic *io, int &track_count, int &head_count, int §or_count); + void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 §or_count); }; extern const floppy_format_type FLOPPY_ESQIMG_FORMAT; diff --git a/src/lib/formats/esq8_dsk.c b/src/lib/formats/esq8_dsk.c index ccf9dff80e0..08fcb5bd7d1 100644 --- a/src/lib/formats/esq8_dsk.c +++ b/src/lib/formats/esq8_dsk.c @@ -72,7 +72,7 @@ bool esq8img_format::supports_save() const void esq8img_format::find_size(io_generic *io, int &track_count, int &head_count, int §or_count) { - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); track_count = 80; head_count = 1; sector_count = 6; diff --git a/src/lib/formats/g64_dsk.c b/src/lib/formats/g64_dsk.c index 7ce61b87d8e..0a7bf18f0ea 100644 --- a/src/lib/formats/g64_dsk.c +++ b/src/lib/formats/g64_dsk.c @@ -84,7 +84,7 @@ int g64_format::identify(io_generic *io, UINT32 form_factor) bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) { - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); UINT8 *img = global_alloc_array(UINT8, size); io_generic_read(io, img, 0, size); diff --git a/src/lib/formats/imd_dsk.c b/src/lib/formats/imd_dsk.c index 88defbae1d6..b814ace862a 100644 --- a/src/lib/formats/imd_dsk.c +++ b/src/lib/formats/imd_dsk.c @@ -364,11 +364,11 @@ int imd_format::identify(io_generic *io, UINT32 form_factor) bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) { - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); UINT8 *img = global_alloc_array(UINT8, size); io_generic_read(io, img, 0, size); - int pos; + UINT64 pos; for(pos=0; pos < size && img[pos] != 0x1a; pos++); pos++; diff --git a/src/lib/formats/ipf_dsk.c b/src/lib/formats/ipf_dsk.c index 8ba57ef393b..88af68e4713 100644 --- a/src/lib/formats/ipf_dsk.c +++ b/src/lib/formats/ipf_dsk.c @@ -41,7 +41,7 @@ int ipf_format::identify(io_generic *io, UINT32 form_factor) bool ipf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) { - UINT32 size = io_generic_size(io); + UINT64 size = io_generic_size(io); UINT8 *data = global_alloc_array(UINT8, size); io_generic_read(io, data, 0, size); bool res = parse(data, size, image); diff --git a/src/lib/formats/oric_dsk.c b/src/lib/formats/oric_dsk.c index f36cbde018e..eb3bd159f89 100644 --- a/src/lib/formats/oric_dsk.c +++ b/src/lib/formats/oric_dsk.c @@ -52,8 +52,8 @@ static FLOPPY_IDENTIFY(oric_dsk_identify) floppy_image_read(floppy, header, 0, mfm_disk_header_size); if ( memcmp( header, MFM_ID, 8 ) ==0) { - int heads = pick_integer_le(header, 8, 4); - int tracks = pick_integer_le(header, 12, 4); + UINT32 heads = pick_integer_le(header, 8, 4); + UINT32 tracks = pick_integer_le(header, 12, 4); if (floppy_image_size(floppy)==((tracks*heads*TRACK_SIZE_MFM)+mfm_disk_header_size)) { *vote = 100; diff --git a/src/lib/formats/pc98fdi_dsk.c b/src/lib/formats/pc98fdi_dsk.c index ceb9b69cfca..43e2ebbbfaf 100644 --- a/src/lib/formats/pc98fdi_dsk.c +++ b/src/lib/formats/pc98fdi_dsk.c @@ -63,16 +63,16 @@ const char *pc98fdi_format::extensions() const int pc98fdi_format::identify(io_generic *io, UINT32 form_factor) { - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); UINT8 h[32]; io_generic_read(io, h, 0, 32); - int hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x8)); - int psize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0xc)); - int ssize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x10)); - int scnt = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x14)); - int sides = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x18)); - int ntrk = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c)); + UINT32 hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x8)); + UINT32 psize = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0xc)); + UINT32 ssize = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x10)); + UINT32 scnt = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x14)); + UINT32 sides = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x18)); + UINT32 ntrk = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x1c)); if(size == hsize + psize && psize == ssize*scnt*sides*ntrk) return 100; @@ -85,11 +85,11 @@ bool pc98fdi_format::load(io_generic *io, UINT32 form_factor, floppy_image *imag io_generic_read(io, h, 0, 32); - int hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x8)); - int sector_size = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x10)); - int sector_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x14)); - int head_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x18)); - int track_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c)); + UINT32 hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x8)); + UINT32 sector_size = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x10)); + UINT32 sector_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x14)); + UINT32 head_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x18)); + UINT32 track_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c)); int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666; diff --git a/src/lib/formats/st_dsk.c b/src/lib/formats/st_dsk.c index 48d764e3c54..8e7c8cee264 100644 --- a/src/lib/formats/st_dsk.c +++ b/src/lib/formats/st_dsk.c @@ -66,20 +66,20 @@ bool st_format::supports_save() const return true; } -void st_format::find_size(io_generic *io, int &track_count, int &head_count, int §or_count) +void st_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 §or_count) { - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); for(track_count=80; track_count <= 82; track_count++) for(head_count=1; head_count <= 2; head_count++) for(sector_count=9; sector_count <= 11; sector_count++) - if(size == 512*track_count*head_count*sector_count) + if(size == (UINT32)512*track_count*head_count*sector_count) return; track_count = head_count = sector_count = 0; } int st_format::identify(io_generic *io, UINT32 form_factor) { - int track_count, head_count, sector_count; + UINT8 track_count, head_count, sector_count; find_size(io, track_count, head_count, sector_count); if(track_count) @@ -89,7 +89,7 @@ int st_format::identify(io_generic *io, UINT32 form_factor) bool st_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) { - int track_count, head_count, sector_count; + UINT8 track_count, head_count, sector_count; find_size(io, track_count, head_count, sector_count); UINT8 sectdata[11*512]; diff --git a/src/lib/formats/st_dsk.h b/src/lib/formats/st_dsk.h index d8dea7cce3c..7dd54967acb 100644 --- a/src/lib/formats/st_dsk.h +++ b/src/lib/formats/st_dsk.h @@ -26,7 +26,7 @@ public: virtual bool supports_save() const; private: - void find_size(io_generic *io, int &track_count, int &head_count, int §or_count); + void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 §or_count); }; class msa_format : public floppy_image_format_t diff --git a/src/lib/formats/td0_dsk.c b/src/lib/formats/td0_dsk.c index 383d67f5f28..80566dd4f5c 100644 --- a/src/lib/formats/td0_dsk.c +++ b/src/lib/formats/td0_dsk.c @@ -318,8 +318,9 @@ static floperr_t td0_get_indexed_sector_info(floppy_image_legacy *floppy, int he int td0dsk_t::data_read(UINT8 *buf, UINT16 size) { - if (floppy_file_offset + size > io_generic_size(floppy_file) ) { - size = io_generic_size(floppy_file) - floppy_file_offset; + UINT64 image_size = io_generic_size(floppy_file); + if (size > image_size - floppy_file_offset) { + size = image_size - floppy_file_offset; } io_generic_read(floppy_file,buf,floppy_file_offset,size); floppy_file_offset += size; diff --git a/src/lib/formats/thom_dsk.c b/src/lib/formats/thom_dsk.c index df910bcbc94..b3cf47234a2 100644 --- a/src/lib/formats/thom_dsk.c +++ b/src/lib/formats/thom_dsk.c @@ -251,7 +251,7 @@ static FLOPPY_CONSTRUCT(sap_dsk_construct) { struct FloppyCallbacks *callbacks; struct sap_dsk_tag *tag; - int i,j; + int j; UINT8 fmt; tag = (struct sap_dsk_tag *) floppy_create_tag(floppy, sizeof(struct sap_dsk_tag)); if (!tag) @@ -263,12 +263,12 @@ static FLOPPY_CONSTRUCT(sap_dsk_construct) /* start with an empty offset table */ tag->tracks = 0; - for ( i = 0; i < 80; i++ ) + for ( int i = 0; i < 80; i++ ) for ( j = 0; j < 16; j++ ) tag->sector_pos[i][j] = 0; /* count tracks & fill sector offset table */ - for ( i = 0x42; i+4 < floppy_image_size(floppy); i += tag->sector_size + 6 ) // CRC 2 bytes + 4 bytes sector header + for ( UINT64 i = 0x42; i+4 < floppy_image_size(floppy); i += tag->sector_size + 6 ) // CRC 2 bytes + 4 bytes sector header { UINT8 sector, track; floppy_image_read(floppy, &track, i+2, 1); diff --git a/src/lib/formats/upd765_dsk.c b/src/lib/formats/upd765_dsk.c index 5899024854c..2fb082c4cd3 100644 --- a/src/lib/formats/upd765_dsk.c +++ b/src/lib/formats/upd765_dsk.c @@ -49,13 +49,13 @@ upd765_format::upd765_format(const format *_formats) int upd765_format::find_size(io_generic *io, UINT32 form_factor) { - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); for(int i=0; formats[i].form_factor; i++) { const format &f = formats[i]; if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor) continue; - if(size == compute_track_size(f) * f.track_count * f.head_count) + if(size == (UINT64) compute_track_size(f) * f.track_count * f.head_count) return i; } return -1; diff --git a/src/lib/formats/wd177x_dsk.c b/src/lib/formats/wd177x_dsk.c index 8819c1bbd6d..49c5086a8be 100644 --- a/src/lib/formats/wd177x_dsk.c +++ b/src/lib/formats/wd177x_dsk.c @@ -49,13 +49,13 @@ wd177x_format::wd177x_format(const format *_formats) int wd177x_format::find_size(io_generic *io, UINT32 form_factor) { - int size = io_generic_size(io); + UINT64 size = io_generic_size(io); for(int i=0; formats[i].form_factor; i++) { const format &f = formats[i]; if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor) continue; - if(size == compute_track_size(f) * f.track_count * f.head_count) + if(size == (UINT64)compute_track_size(f) * f.track_count * f.head_count) return i; } return -1; diff --git a/src/lib/softfloat/softfloat-macros b/src/lib/softfloat/softfloat-macros index e4a059f3df8..f58a30472ac 100644 --- a/src/lib/softfloat/softfloat-macros +++ b/src/lib/softfloat/softfloat-macros @@ -368,7 +368,7 @@ INLINE void ) { bits64 z0, z1, z2; - int8 carry0, carry1; + uint8 carry0, carry1; z2 = a2 + b2; carry1 = ( z2 < a2 ); @@ -424,7 +424,7 @@ INLINE void ) { bits64 z0, z1, z2; - int8 borrow0, borrow1; + uint8 borrow0, borrow1; z2 = a2 - b2; borrow1 = ( a2 < b2 ); diff --git a/src/mame/drivers/beathead.c b/src/mame/drivers/beathead.c index f7c25e82676..6ed7a8d74ba 100644 --- a/src/mame/drivers/beathead.c +++ b/src/mame/drivers/beathead.c @@ -475,7 +475,7 @@ ROM_END READ32_MEMBER( beathead_state::speedup_r ) { - int result = *m_speedup_data; + UINT32 result = *m_speedup_data; if ((space.device().safe_pcbase() & 0xfffff) == 0x006f0 && result == space.device().state().state_int(ASAP_R3)) space.device().execute().spin_until_interrupt(); return result; diff --git a/src/mame/machine/harddriv.c b/src/mame/machine/harddriv.c index 85e5bc3944f..5934776f59b 100644 --- a/src/mame/machine/harddriv.c +++ b/src/mame/machine/harddriv.c @@ -1985,11 +1985,11 @@ WRITE16_HANDLER( hdgsp_speedup2_w ) READ16_HANDLER( rdgsp_speedup1_r ) { harddriv_state *state = space.machine().driver_data(); - int result = state->m_gsp_speedup_addr[0][offset]; + UINT16 result = state->m_gsp_speedup_addr[0][offset]; /* if this address is equal to $f000, spin until something gets written */ if (&space.device() == state->m_gsp && space.device().safe_pc() == state->m_gsp_speedup_pc && - (result & 0xff) < space.device().state().state_int(TMS34010_A1)) + (UINT8)result < space.device().state().state_int(TMS34010_A1)) { state->m_gsp_speedup_count[0]++; space.device().execute().spin_until_interrupt(); diff --git a/src/mame/video/tank8.c b/src/mame/video/tank8.c index c3c1cf97d04..9a406aa30cc 100644 --- a/src/mame/video/tank8.c +++ b/src/mame/video/tank8.c @@ -215,7 +215,7 @@ void tank8_state::screen_eof_tank8(screen_device &screen, bool state) const UINT16* p2 = &m_helper2.pix16(y); const UINT16* p3 = &m_helper3.pix16(y); - if (y % 2 != machine().primary_screen->frame_number() % 2) + if ((machine().primary_screen->frame_number() ^ y) & 1) continue; /* video display is interlaced */ for (x = visarea.min_x; x <= visarea.max_x; x++) diff --git a/src/mame/video/tia.c b/src/mame/video/tia.c index f38ee28258d..8e53e9809d9 100644 --- a/src/mame/video/tia.c +++ b/src/mame/video/tia.c @@ -835,7 +835,7 @@ WRITE8_MEMBER( tia_video_device::VBLANK_w ) { if (data & 0x80) { - paddle_cycles = machine().firstcpu->total_cycles(); + paddle_start = machine().firstcpu->total_cycles(); } if ( ! ( VBLANK & 0x40 ) ) { INPT4 = 0x80; @@ -1588,8 +1588,8 @@ WRITE8_MEMBER( tia_video_device::GRP1_w ) READ8_MEMBER( tia_video_device::INPT_r ) { - UINT64 elapsed = machine().firstcpu->total_cycles() - paddle_cycles; - int input = TIA_INPUT_PORT_ALWAYS_ON; + UINT64 elapsed = machine().firstcpu->total_cycles() - paddle_start; + UINT16 input = TIA_INPUT_PORT_ALWAYS_ON; if ( !m_read_input_port_func.isnull() ) { input = m_read_input_port_func(offset & 3, 0xFFFF); @@ -1600,7 +1600,8 @@ READ8_MEMBER( tia_video_device::INPT_r ) if ( input == TIA_INPUT_PORT_ALWAYS_OFF ) return 0x00; - return elapsed > 76 * input ? 0x80 : 0x00; + UINT16 paddle_cycles = input * 76; + return elapsed > paddle_cycles ? 0x80 : 0x00; } diff --git a/src/mame/video/tia.h b/src/mame/video/tia.h index 9ebf6806beb..56218830885 100644 --- a/src/mame/video/tia.h +++ b/src/mame/video/tia.h @@ -117,7 +117,7 @@ private: struct player_gfx p1gfx; UINT64 frame_cycles; - UINT64 paddle_cycles; + UINT64 paddle_start; int horzP0; int horzP1; diff --git a/src/osd/windows/ledutil.c b/src/osd/windows/ledutil.c index 9931e2f053d..25035f4c037 100644 --- a/src/osd/windows/ledutil.c +++ b/src/osd/windows/ledutil.c @@ -104,7 +104,6 @@ typedef int running_machine; // LED methods #define LED_METHOD_PS2 0 #define LED_METHOD_USB 1 -#define LED_METHOD_WIN9X 2 // window parameters #define WINDOW_CLASS TEXT("LEDSample") @@ -508,18 +507,11 @@ static LRESULT handle_update_state(WPARAM wparam, LPARAM lparam) static void output_startup(const char *commandline) { - OSVERSIONINFO osinfo = { sizeof(OSVERSIONINFO) }; - // default to PS/2, override if USB is specified as a parameter ledmethod = LED_METHOD_PS2; if (commandline != NULL && strcmp(commandline, "-usb") == 0) ledmethod = LED_METHOD_USB; - // force Win9x method if we're on Win 9x - GetVersionEx(&osinfo); - if (osinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) - ledmethod = LED_METHOD_WIN9X; - // output the method switch (ledmethod) { @@ -530,10 +522,6 @@ static void output_startup(const char *commandline) case LED_METHOD_USB: DEBUG_PRINTF(("Using USB method\n")); break; - - case LED_METHOD_WIN9X: - DEBUG_PRINTF(("Using Win9x method\n")); - break; } } @@ -653,7 +641,6 @@ static int led_get_state(void) switch (ledmethod) { - case LED_METHOD_WIN9X: case LED_METHOD_USB: { BYTE key_states[256]; @@ -704,23 +691,6 @@ static void led_set_state(int state) switch (ledmethod) { - case LED_METHOD_WIN9X: - { - // thanks to Lee Taylor for the original version of this code - BYTE key_states[256]; - - // get the current state - GetKeyboardState(&key_states[0]); - - // mask states and set new states - key_states[VK_NUMLOCK] = (key_states[VK_NUMLOCK] & ~1) | ((state >> 0) & 1); - key_states[VK_CAPITAL] = (key_states[VK_CAPITAL] & ~1) | ((state >> 1) & 1); - key_states[VK_SCROLL] = (key_states[VK_SCROLL] & ~1) | ((state >> 2) & 1); - - SetKeyboardState(&key_states[0]); - break; - } - case LED_METHOD_USB: { static const BYTE vk[3] = { VK_NUMLOCK, VK_CAPITAL, VK_SCROLL }; diff --git a/src/osd/windows/winprefix.h b/src/osd/windows/winprefix.h index 1e82d355ef1..1287b840206 100644 --- a/src/osd/windows/winprefix.h +++ b/src/osd/windows/winprefix.h @@ -44,8 +44,10 @@ #ifdef _MSC_VER #include #include +#if _MSC_VER < 1800 #define alloca _alloca #define round(x) floor((x) + 0.5) +#endif #if _MSC_VER < 1500 #define vsnprintf _vsnprintf #endif diff --git a/src/tools/chdman.c b/src/tools/chdman.c index 4f36ded7956..c888fccfdd5 100644 --- a/src/tools/chdman.c +++ b/src/tools/chdman.c @@ -400,7 +400,7 @@ public: virtual UINT32 read_data(void *_dest, UINT64 offset, UINT32 length) { UINT8 *dest = reinterpret_cast(_dest); - int interlace_factor = m_info.interlaced ? 2 : 1; + UINT8 interlace_factor = m_info.interlaced ? 2 : 1; UINT32 length_remaining = length; // iterate over frames @@ -1497,7 +1497,7 @@ static void do_verify(parameters_t ¶ms) progress(false, "Verifying, %.1f%% complete... \r", 100.0 * double(offset) / double(input_chd.logical_bytes())); // determine how much to read - UINT32 bytes_to_read = MIN(buffer.count(), input_chd.logical_bytes() - offset); + UINT32 bytes_to_read = MIN((UINT32)buffer.count(), input_chd.logical_bytes() - offset); chd_error err = input_chd.read_bytes(offset, buffer, bytes_to_read); if (err != CHDERR_NONE) report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err)); @@ -2213,7 +2213,7 @@ static void do_extract_raw(parameters_t ¶ms) progress(false, "Extracting, %.1f%% complete... \r", 100.0 * double(offset - input_start) / double(input_end - input_start)); // determine how much to read - UINT32 bytes_to_read = MIN(buffer.count(), input_end - offset); + UINT32 bytes_to_read = MIN((UINT32)buffer.count(), input_end - offset); chd_error err = input_chd.read_bytes(offset, buffer, bytes_to_read); if (err != CHDERR_NONE) report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err)); @@ -2475,7 +2475,7 @@ static void do_extract_ld(parameters_t ¶ms) report_error(1, "Improperly formatted A/V metadata found"); fps_times_1million = fps * 1000000 + fpsfrac; } - int interlace_factor = interlaced ? 2 : 1; + UINT8 interlace_factor = interlaced ? 2 : 1; // determine key parameters and validate max_samples_per_frame = (UINT64(rate) * 1000000 + fps_times_1million - 1) / fps_times_1million; @@ -2543,9 +2543,9 @@ static void do_extract_ld(parameters_t ¶ms) // iterate over frames bitmap_yuy16 fullbitmap(width, height * interlace_factor); - for (int framenum = input_start; framenum < input_end; framenum++) + for (UINT64 framenum = input_start; framenum < input_end; framenum++) { - progress(framenum == 0, "Extracting, %.1f%% complete... \r", 100.0 * double(framenum - input_start) / double(input_end - input_start)); + progress(framenum == input_start, "Extracting, %.1f%% complete... \r", 100.0 * double(framenum - input_start) / double(input_end - input_start)); // set up the fake bitmap for this frame avconfig.video.wrap(&fullbitmap.pix(framenum % interlace_factor), fullbitmap.width(), fullbitmap.height() / interlace_factor, fullbitmap.rowpixels() * interlace_factor); @@ -2565,7 +2565,7 @@ static void do_extract_ld(parameters_t ¶ms) } // write video - if (framenum % interlace_factor == interlace_factor - 1) + if ((framenum + 1) % interlace_factor == 0) { avi_error avierr = avi_append_video_frame(output_file, fullbitmap); if (avierr != AVIERR_NONE)