diff --git a/src/808x.c b/src/808x.c index 24587e8ca..75dd2ad46 100644 --- a/src/808x.c +++ b/src/808x.c @@ -644,7 +644,7 @@ void resetx86() eflags=0; cgate32=0; loadcs(0xFFFF); - rammask=0xFFFFFFFF; + rammask = AT ? 0xFFFFFFFF : 0xfffff; idt.base = 0; flags=2; makeznptable(); diff --git a/src/disc_86f.c b/src/disc_86f.c index e30f9009d..beed65d37 100644 --- a/src/disc_86f.c +++ b/src/disc_86f.c @@ -86,9 +86,9 @@ static struct FILE *f; uint16_t version; uint16_t disk_flags; - uint8_t track_data[2][50000]; - uint16_t track_encoded_data[2][50000]; - uint8_t track_layout[2][50000]; + uint8_t track_data[2][51000]; + uint16_t track_encoded_data[2][51000]; + uint8_t track_layout[2][51000]; uint16_t side_flags[2]; uint16_t index_hole_pos[2]; uint8_t track_in_file; @@ -121,7 +121,6 @@ static struct uint16_t old_track_data_word; uint8_t cur_track; uint8_t side_flag_bytes; - uint8_t wait_state; uint8_t id_am_counter; uint8_t id_counter; uint8_t id_match; @@ -390,7 +389,7 @@ int d86f_get_array_size(int drive) pos = 7575; break; case 2: - pos = 7613; + pos = 7612; break; case 3: pos = 7650; @@ -409,7 +408,7 @@ int d86f_get_array_size(int drive) pos = 12625; break; case 2: - pos = 12688; + pos = 12687; break; case 3: pos = 12750; @@ -790,26 +789,25 @@ uint32_t d86f_get_raw_size(int drive) mfm = d86f_is_mfm(drive); rpm = ((d86f_track_flags(drive) & 0xE0) == 0x20) ? 360.0 : 300.0; - rpm_diff = rpm * 0.005; + rpm_diff = 1.0; if (d86f[drive].version == 0x0132) { switch (d86f_get_rpm_mode(drive)) { case 1: - rpm_diff *= 2.0; + rpm_diff = 1.01; break; case 2: - rpm_diff *= 3.0; + rpm_diff = 1.015; break; case 3: - rpm_diff *= 4.0; + rpm_diff = 1.02; break; default: - rpm_diff = 0.0; + rpm_diff = 1.0; break; } - rpm -= rpm_diff; } switch (d86f_track_flags(drive) & 7) { @@ -835,6 +833,7 @@ uint32_t d86f_get_raw_size(int drive) if (!mfm) rate /= 2.0; size = (size / 250.0) * rate; size = (size * 300.0) / rpm; + size *= rpm_diff; return (uint16_t) size; } @@ -843,26 +842,8 @@ void d86f_seek(int drive, int track) uint8_t track_id = track; int sides; int side; -#if 0 - int full_size, store_size; - int flag_bytes = 5; -#endif sides = d86f_get_sides(drive); -#if 0 - full_size = d86f_get_array_size(drive); - store_size = full_size << 1; - if (d86f_is_encoded(drive)) store_size += full_size; - if (!d86f_is_old_style(drive)) - { - store_size -= full_size; - if (d86f_has_mini_table(drive)) - { - store_size += d86f_get_mini_size(drive); - } - } - if (d86f_get_sides(drive) == 2) flag_bytes += 4; -#endif if (d86f_is_40_track(drive) && fdd_doublestep_40(drive)) track /= 2; @@ -945,23 +926,6 @@ void d86f_writeback(int drive) int track = d86f[drive].cur_track; uint8_t track_id = track; int side; -#if 0 - int full_size, store_size; - int flag_bytes = 5; - - full_size = d86f_get_array_size(drive); - store_size = full_size << 1; - if (d86f_is_encoded(drive)) store_size += full_size; - if (!d86f_is_old_style(drive)) - { - store_size -= full_size; - if (d86f_has_mini_table(drive)) - { - store_size += d86f_get_mini_size(drive); - } - } - if (d86f_get_sides(drive) == 2) flag_bytes += 4; -#endif if (!d86f[drive].f) { @@ -1091,7 +1055,6 @@ void d86f_readsector(int drive, int sector, int track, int side, int rate, int s d86f[drive].last_sector.dword = 0xFFFFFFFF; d86f[drive].req_sector.id.n = sector_size; d86f[drive].index_count = d86f[drive].satisfying_bytes = 0; - d86f[drive].wait_state = 1; d86f_new_style_reset(drive); d86f[drive].state = STATE_READ_FIND_SECTOR; } @@ -1125,7 +1088,6 @@ void d86f_writesector(int drive, int sector, int track, int side, int rate, int d86f[drive].last_sector.dword = 0xFFFFFFFF; d86f_drive = drive; d86f[drive].index_count = d86f[drive].satisfying_bytes = 0; - d86f[drive].wait_state = 1; d86f_new_style_reset(drive); d86f[drive].state = STATE_WRITE_FIND_SECTOR; } @@ -1159,7 +1121,6 @@ void d86f_comparesector(int drive, int sector, int track, int side, int rate, in d86f[drive].last_sector.dword = 0xFFFFFFFF; d86f_drive = drive; d86f[drive].index_count = d86f[drive].satisfying_bytes = 0; - d86f[drive].wait_state = 1; d86f_new_style_reset(drive); d86f[drive].state = STATE_COMPARE_FIND_SECTOR; } @@ -1183,7 +1144,6 @@ void d86f_readaddress(int drive, int track, int side, int rate) d86f[drive].last_sector.dword = 0xFFFFFFFF; d86f_drive = drive; d86f[drive].index_count = d86f[drive].satisfying_bytes = 0; - d86f[drive].wait_state = 1; d86f_new_style_reset(drive); d86f[drive].state = STATE_READ_FIND_ADDRESS; } @@ -2155,44 +2115,6 @@ void d86f_poll_readwrite(int drive, int side) } } -int d86f_end_wait_state(int drive) -{ - int temp = 0; - int fdc_mfm = 0; - int disk_mfm = 0; - fdc_mfm = fdc_is_mfm(); - disk_mfm = d86f_is_mfm(drive); - temp = temp || ((d86f[drive].track_byte == BYTE_IDAM_SYNC) && fdc_mfm && disk_mfm); - temp = temp || ((d86f[drive].track_byte == BYTE_IDAM) && !fdc_mfm && !disk_mfm); - temp = temp && d86f_can_read_address(drive); /* This is so the wait state never ends if the data rate or encoding is wrong. */ - return temp; -} - -#if 0 -void d86f_poll_find_nf_wait(int drive, int side) -{ - if (d86f[drive].track_index) - { - // pclog("d86f_poll_find_nf(): Index pulse\n"); - index_pulse(drive); - d86f[drive].index_count++; - } - - d86f_poll_advancebyte(drive, side); - - if (d86f_poll_check_notfound(drive)) return; - - if (d86f[drive].track_byte != d86f[drive].old_track_byte) - { - if (d86f_end_wait_state(drive)) - { - d86f[drive].calc_crc.word = 0xffff; - d86f[drive].id_am_counter = d86f[drive].id_counter = d86f[drive].id_match = d86f[drive].data_am_counter = d86f[drive].wait_state = 0; - } - } -} -#endif - void d86f_poll_find_nf(int drive, int side) { uint8_t mfm = 0; @@ -3029,8 +2951,10 @@ void d86f_poll() // int drive = d86f_drive; int drive = 0; int side = 0; + int mfm; drive = fdc_get_drive(); side = fdd_get_head(drive); + mfm = d86f_is_mfm(drive); if ((d86f[drive].state == STATE_FORMAT) && d86f_is_old_style(drive)) { @@ -3052,17 +2976,6 @@ void d86f_poll() if (d86f_find_state_nf(drive) && d86f_is_old_style(drive)) { -#if 0 - if (d86f[drive].wait_state) - { - d86f_poll_find_nf_wait(drive, side); - } - else - { - d86f_poll_find_nf(drive, side); - } - return; -#endif d86f_poll_find_nf(drive, side); } @@ -3081,6 +2994,27 @@ void d86f_poll() if ((d86f[drive].state == STATE_SEEK) || (d86f[drive].state == STATE_IDLE)) { d86f_poll_advancebyte(drive, side); - return; + + if (d86f[drive].track_byte != d86f[drive].old_track_byte) + { + d86f[drive].section_pos = d86f[drive].track_pos; + + switch(d86f[drive].track_byte) + { + case BYTE_IDAM_SYNC: + if (mfm) + { + d86f[drive].calc_crc.word = 0xffff; + } + break; + case BYTE_IDAM: + if (!mfm) + { + d86f[drive].calc_crc.word = 0xffff; + } + break; + } + return; + } } } diff --git a/src/disc_img_86box.c b/src/disc_img_86box.c index a19589e6e..091049f2e 100644 --- a/src/disc_img_86box.c +++ b/src/disc_img_86box.c @@ -114,7 +114,13 @@ int gap3_sizes[5][8][256] = { [0][1][16] = 0x54, [0][2][20] = 0x2A, [0][2][21] = 0x08, /* Microsoft DMFWRITE.EXE uses this, 0x0C is used by FDFORMAT. */ [0][2][23] = 0x01, + [0][3][10] = 0x83, [0][3][11] = 0x26, + [1][2][11] = 0x54, + [1][2][12] = 0x1C, + [1][2][13] = 0x0E, + [1][3][6] = 0x79, + [1][3][7] = 0x06, [2][1][10] = 0x32, [2][1][11] = 0x0C, [2][1][15] = 0x36, @@ -122,20 +128,29 @@ int gap3_sizes[5][8][256] = { [0][1][16] = 0x54, [2][2][8] = 0x58, [2][2][9] = 0x50, [2][2][10] = 0x2E, - [2][2][11] = 0x02, [2][2][21] = 0x1C, [2][3][4] = 0xF0, [2][3][5] = 0x74, [3][2][36] = 0x53, - [3][2][39] = 0x20, - [3][2][40] = 0x27, - [3][2][41] = 0x23, + [3][2][37] = 0x4E, + [3][2][38] = 0x40, + [3][2][39] = 0x30, + [3][2][40] = 0x20, + [3][2][41] = 0x10, [3][2][46] = 0x01, + [3][3][18] = 0xF7, + [3][3][19] = 0xAF, + [3][3][20] = 0x6F, + [3][3][21] = 0x55, + [3][3][22] = 0x1F, [4][1][32] = 0x36, + [4][2][14] = 0x92, [4][2][15] = 0x54, + [4][2][16] = 0x38, [4][2][17] = 0x23, [4][2][19] = 0x01, - [4][3][8] = 0x74 + [4][3][8] = 0x74, + [4][3][9] = 0x24 }; void img_writeback(int drive); @@ -278,18 +293,26 @@ void img_load(int drive, char *fn) else if (size <= (640*1024)) { img[drive].sectors = 8; img[drive].tracks = 80; } /*Double density 640k*/ else if (size <= (720*1024)) { img[drive].sectors = 9; img[drive].tracks = 80; } /*Double density*/ else if (size <= (800*1024)) { img[drive].sectors = 10; img[drive].tracks = 80; } /*Double density*/ + else if (size <= (880*1024)) { img[drive].sectors = 11; img[drive].tracks = 80; } /*Double density*/ + else if (size <= (960*1024)) { img[drive].sectors = 12; img[drive].tracks = 80; } /*Double density*/ + else if (size <= (1040*1024)) { img[drive].sectors = 13; img[drive].tracks = 80; } /*Double density*/ + else if (size <= (1120*1024)) { img[drive].sectors = 14; img[drive].tracks = 80; } /*Double density*/ else if (size <= 1228800) { img[drive].sectors = 15; img[drive].tracks = 80; } /*High density 1.2MB*/ else if (size <= 1261568) { img[drive].sectors = 8; img[drive].tracks = 77; img[drive].sector_size = 3; } /*High density 1.25MB Japanese format*/ else if (size <= (0x1A4000-1)) { img[drive].sectors = 18; img[drive].tracks = 80; } /*High density (not supported by Tandy 1000)*/ else if (size <= 1556480) { img[drive].sectors = 19; img[drive].tracks = 80; } /*High density (not supported by Tandy 1000)*/ else if (size <= 1638400) { img[drive].sectors = 10; img[drive].tracks = 80; img[drive].sector_size = 3; } /*High density (not supported by Tandy 1000)*/ - else if (size <= 1720320) { img[drive].sectors = 21; img[drive].tracks = 80; } /*DMF format - used by Windows 95 - changed by OBattler to 2000000, ie. the real unformatted capacity @ 500 kbps and 300 rpm */ + else if (size <= 1720320) { img[drive].sectors = 21; img[drive].tracks = 80; } /*DMF format - used by Windows 95 */ + else if (size <= 1741824) { img[drive].sectors = 21; img[drive].tracks = 81; } + else if (size <= 1763328) { img[drive].sectors = 21; img[drive].tracks = 82; } else if (size <= 1802240) { img[drive].sectors = 11; img[drive].tracks = 80; img[drive].sector_size = 3; } /*High density (not supported by Tandy 1000)*/ else if (size == 1884160) { img[drive].sectors = 23; img[drive].tracks = 80; } /*XDF format - used by OS/2 Warp*/ else if (size <= 2949120) { img[drive].sectors = 36; img[drive].tracks = 80; } /*E density*/ else if (size <= 3194880) { img[drive].sectors = 39; img[drive].tracks = 80; } /*E density*/ else if (size <= 3276800) { img[drive].sectors = 40; img[drive].tracks = 80; } /*E density*/ else if (size <= 3358720) { img[drive].sectors = 41; img[drive].tracks = 80; } /*E density, maximum possible size*/ + else if (size <= 3440640) { img[drive].sectors = 21; img[drive].tracks = 80; img[drive].sector_size = 3; } /*High density (not supported by Tandy 1000)*/ + else if (size <= 3604480) { img[drive].sectors = 22; img[drive].tracks = 80; img[drive].sector_size = 3; } /*High density (not supported by Tandy 1000)*/ else { pclog("Image is bigger than can fit on an ED floppy, ejecting...\n"); @@ -328,7 +351,7 @@ void img_load(int drive, char *fn) temp_rate = rates[i]; img[drive].disk_flags = holes[i] << 1; img[drive].xdf_type = (img[drive].sectors == xdf_sectors[img[drive].sector_size][i]) ? xdf_types[img[drive].sector_size][i] : 0; - if ((bit_rate_300 == 500.0) && (img[drive].sectors == 21) && (img[drive].sector_size == 2) && (img[drive].tracks == 80) && (img[drive].sides == 2)) + if ((bit_rate_300 == 500.0) && (img[drive].sectors == 21) && (img[drive].sector_size == 2) && (img[drive].tracks >= 80) && (img[drive].tracks <= 82) && (img[drive].sides == 2)) { /* This is a DMF floppy, set the flag so we know to interleave the sectors. */ img[drive].dmf = 1; diff --git a/src/vid_svga.c b/src/vid_svga.c index 3d741792f..01f95d45c 100644 --- a/src/vid_svga.c +++ b/src/vid_svga.c @@ -1760,10 +1760,12 @@ void svga_add_status_info(char *s, int max_len, void *p) char temps[128]; if (svga->chain4) strcpy(temps, "SVGA chained (possibly mode 13h)\n"); - else if ((svga->chain2_read) || (svga->chain2_write)) sprintf(temps, "SVGA chained odd/even (r: %s, w: %s, c: %s, p: %s)\n", svga->chain2_read ? "ON" : "OFF", svga->chain2_write ? "ON" : "OFF", svga->oddeven_chain ? "ON" : "OFF", svga->oddeven_page ? "lo" : "hi"); else strcpy(temps, "SVGA unchained (possibly mode-X)\n"); strncat(s, temps, max_len); + sprintf(temps, "SVGA chained odd/even (r: %s, w: %s, c: %s, p: %s)\n", svga->chain2_read ? "ON" : "OFF", svga->chain2_write ? "ON" : "OFF", svga->oddeven_chain ? "ON" : "OFF", svga->oddeven_page ? "lo" : "hi"); + strncat(s, temps, max_len); + if (!svga->video_bpp) strcpy(temps, "SVGA in text mode\n"); else sprintf(temps, "SVGA colour depth : %i bpp\n", svga->video_bpp); strncat(s, temps, max_len); diff --git a/src/win-hdconf.c b/src/win-hdconf.c index 401b5b444..1b06e290d 100644 --- a/src/win-hdconf.c +++ b/src/win-hdconf.c @@ -425,67 +425,67 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR hd_changed = 0; h = GetDlgItem(hdlg, IDC_EDIT_C_SPT); - sprintf(s, "%i", hdc[0].spt); + sprintf(s, "%" PRIu64, hdc[0].spt); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_C_HPC); - sprintf(s, "%i", hdc[0].hpc); + sprintf(s, "%" PRIu64, hdc[0].hpc); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_C_CYL); - sprintf(s, "%i", hdc[0].tracks); + sprintf(s, "%" PRIu64, hdc[0].tracks); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_C_FN); SendMessage(h, WM_SETTEXT, 0, (LPARAM)ide_fn[0]); h = GetDlgItem(hdlg, IDC_EDIT_D_SPT); - sprintf(s, "%i", hdc[1].spt); + sprintf(s, "%" PRIu64, hdc[1].spt); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_D_HPC); - sprintf(s, "%i", hdc[1].hpc); + sprintf(s, "%" PRIu64, hdc[1].hpc); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_D_CYL); - sprintf(s, "%i", hdc[1].tracks); + sprintf(s, "%" PRIu64, hdc[1].tracks); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h= GetDlgItem(hdlg, IDC_EDIT_D_FN); SendMessage(h, WM_SETTEXT, 0, (LPARAM)ide_fn[1]); h = GetDlgItem(hdlg, IDC_EDIT_E_SPT); - sprintf(s, "%i", hdc[2].spt); + sprintf(s, "%" PRIu64, hdc[2].spt); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_E_HPC); - sprintf(s, "%i", hdc[2].hpc); + sprintf(s, "%" PRIu64, hdc[2].hpc); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_E_CYL); - sprintf(s, "%i", hdc[2].tracks); + sprintf(s, "%" PRIu64, hdc[2].tracks); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h= GetDlgItem(hdlg, IDC_EDIT_E_FN); SendMessage(h, WM_SETTEXT, 0, (LPARAM)ide_fn[2]); h = GetDlgItem(hdlg, IDC_EDIT_F_SPT); - sprintf(s, "%i", hdc[3].spt); + sprintf(s, "%" PRIu64, hdc[3].spt); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_F_HPC); - sprintf(s, "%i", hdc[3].hpc); + sprintf(s, "%" PRIu64, hdc[3].hpc); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_F_CYL); - sprintf(s, "%i", hdc[3].tracks); + sprintf(s, "%" PRIu64, hdc[3].tracks); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h= GetDlgItem(hdlg, IDC_EDIT_F_FN); SendMessage(h, WM_SETTEXT, 0, (LPARAM)ide_fn[3]); h = GetDlgItem(hdlg, IDC_TEXT_C_SIZE); - sprintf(s, "Size : %i MB", (hd[0].tracks*hd[0].hpc*hd[0].spt) >> 11); + sprintf(s, "Size: %" PRIu64 " MB", (hd[0].tracks*hd[0].hpc*hd[0].spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_TEXT_D_SIZE); - sprintf(s, "Size : %i MB", (hd[1].tracks*hd[1].hpc*hd[1].spt) >> 11); + sprintf(s, "Size: %" PRIu64 " MB", (hd[1].tracks*hd[1].hpc*hd[1].spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_TEXT_E_SIZE); - sprintf(s, "Size : %i MB", (hd[2].tracks*hd[2].hpc*hd[2].spt) >> 11); + sprintf(s, "Size: %" PRIu64 " MB", (hd[2].tracks*hd[2].hpc*hd[2].spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_TEXT_F_SIZE); - sprintf(s, "Size : %i MB", (hd[3].tracks*hd[3].hpc*hd[3].spt) >> 11); + sprintf(s, "Size: %" PRIu64 " MB", (hd[3].tracks*hd[3].hpc*hd[3].spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); new_cdrom_channel = cdrom_channel; @@ -503,49 +503,49 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR { h = GetDlgItem(hdlg, IDC_EDIT_C_SPT); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[0].spt); + sscanf(s, "%" PRIu64, &hd[0].spt); h = GetDlgItem(hdlg, IDC_EDIT_C_HPC); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[0].hpc); + sscanf(s, "%" PRIu64, &hd[0].hpc); h = GetDlgItem(hdlg, IDC_EDIT_C_CYL); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[0].tracks); + sscanf(s, "%" PRIu64, &hd[0].tracks); h = GetDlgItem(hdlg, IDC_EDIT_C_FN); SendMessage(h, WM_GETTEXT, 511, (LPARAM)ide_fn[0]); h = GetDlgItem(hdlg, IDC_EDIT_D_SPT); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[1].spt); + sscanf(s, "%" PRIu64, &hd[1].spt); h = GetDlgItem(hdlg, IDC_EDIT_D_HPC); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[1].hpc); + sscanf(s, "%" PRIu64, &hd[1].hpc); h = GetDlgItem(hdlg, IDC_EDIT_D_CYL); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[1].tracks); + sscanf(s, "%" PRIu64, &hd[1].tracks); h = GetDlgItem(hdlg, IDC_EDIT_D_FN); SendMessage(h, WM_GETTEXT, 511, (LPARAM)ide_fn[1]); h = GetDlgItem(hdlg, IDC_EDIT_E_SPT); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[2].spt); + sscanf(s, "%" PRIu64, &hd[2].spt); h = GetDlgItem(hdlg, IDC_EDIT_E_HPC); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[2].hpc); + sscanf(s, "%" PRIu64, &hd[2].hpc); h = GetDlgItem(hdlg, IDC_EDIT_E_CYL); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[2].tracks); + sscanf(s, "%" PRIu64, &hd[2].tracks); h = GetDlgItem(hdlg, IDC_EDIT_E_FN); SendMessage(h, WM_GETTEXT, 511, (LPARAM)ide_fn[2]); h = GetDlgItem(hdlg, IDC_EDIT_F_SPT); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[3].spt); + sscanf(s, "%" PRIu64, &hd[3].spt); h = GetDlgItem(hdlg, IDC_EDIT_F_HPC); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[3].hpc); + sscanf(s, "%" PRIu64, &hd[3].hpc); h = GetDlgItem(hdlg, IDC_EDIT_F_CYL); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[3].tracks); + sscanf(s, "%" PRIu64, &hd[3].tracks); h = GetDlgItem(hdlg, IDC_EDIT_F_FN); SendMessage(h, WM_GETTEXT, 511, (LPARAM)ide_fn[3]); @@ -615,19 +615,19 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR if (DialogBox(hinstance, TEXT("HdNewDlg"), hdlg, hdnew_dlgproc) == 1) { h = GetDlgItem(hdlg, IDC_EDIT_C_SPT); - sprintf(s, "%i", hd_new_spt); + sprintf(s, "%" PRIu64, hd_new_spt); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_C_HPC); - sprintf(s, "%i", hd_new_hpc); + sprintf(s, "%" PRIu64, hd_new_hpc); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_C_CYL); - sprintf(s, "%i", hd_new_cyl); + sprintf(s, "%" PRIu64, hd_new_cyl); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_C_FN); SendMessage(h, WM_SETTEXT, 0, (LPARAM)hd_new_name); h = GetDlgItem(hdlg, IDC_TEXT_C_SIZE); - sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); + sprintf(s, "Size: %" PRIu64 " MB", (hd_new_cyl*hd_new_hpc*hd_new_spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); hd_changed = 1; @@ -674,19 +674,19 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR if (ret == 1) { h = GetDlgItem(hdlg, IDC_EDIT_C_SPT); - sprintf(s, "%i", hd_new_spt); + sprintf(s, "%" PRIu64, hd_new_spt); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_C_HPC); - sprintf(s, "%i", hd_new_hpc); + sprintf(s, "%" PRIu64, hd_new_hpc); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_C_CYL); - sprintf(s, "%i", hd_new_cyl); + sprintf(s, "%" PRIu64, hd_new_cyl); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_C_FN); SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring); h = GetDlgItem(hdlg, IDC_TEXT_C_SIZE); - sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); + sprintf(s, "Size: %" PRIu64 " MB", (hd_new_cyl*hd_new_hpc*hd_new_spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); hd_changed = 1; @@ -698,19 +698,19 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR if (DialogBox(hinstance, TEXT("HdNewDlg"), hdlg, hdnew_dlgproc) == 1) { h = GetDlgItem(hdlg, IDC_EDIT_D_SPT); - sprintf(s, "%i", hd_new_spt); + sprintf(s, "%" PRIu64, hd_new_spt); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_D_HPC); - sprintf(s, "%i", hd_new_hpc); + sprintf(s, "%" PRIu64, hd_new_hpc); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_D_CYL); - sprintf(s, "%i", hd_new_cyl); + sprintf(s, "%" PRIu64, hd_new_cyl); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_D_FN); SendMessage(h, WM_SETTEXT, 0, (LPARAM)hd_new_name); h= GetDlgItem(hdlg, IDC_TEXT_D_SIZE); - sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); + sprintf(s, "Size: %" PRIu64 " MB", (hd_new_cyl*hd_new_hpc*hd_new_spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); hd_changed = 1; @@ -757,19 +757,19 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR if (ret == 1) { h = GetDlgItem(hdlg, IDC_EDIT_D_SPT); - sprintf(s, "%i", hd_new_spt); + sprintf(s, "%" PRIu64, hd_new_spt); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_D_HPC); - sprintf(s, "%i", hd_new_hpc); + sprintf(s, "%" PRIu64, hd_new_hpc); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_D_CYL); - sprintf(s, "%i", hd_new_cyl); + sprintf(s, "%" PRIu64, hd_new_cyl); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_D_FN); SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring); h = GetDlgItem(hdlg, IDC_TEXT_D_SIZE); - sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); + sprintf(s, "Size: %" PRIu64 " MB", (hd_new_cyl*hd_new_hpc*hd_new_spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); hd_changed = 1; @@ -781,19 +781,19 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR if (DialogBox(hinstance, TEXT("HdNewDlg"), hdlg, hdnew_dlgproc) == 1) { h = GetDlgItem(hdlg, IDC_EDIT_E_SPT); - sprintf(s, "%i", hd_new_spt); + sprintf(s, "%" PRIu64, hd_new_spt); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_E_HPC); - sprintf(s, "%i", hd_new_hpc); + sprintf(s, "%" PRIu64, hd_new_hpc); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_E_CYL); - sprintf(s, "%i", hd_new_cyl); + sprintf(s, "%" PRIu64, hd_new_cyl); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_E_FN); SendMessage(h, WM_SETTEXT, 0, (LPARAM)hd_new_name); h= GetDlgItem(hdlg, IDC_TEXT_E_SIZE); - sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); + sprintf(s, "Size: %" PRIu64 " MB", (hd_new_cyl*hd_new_hpc*hd_new_spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); hd_changed = 1; @@ -840,19 +840,19 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR if (ret == 1) { h = GetDlgItem(hdlg, IDC_EDIT_E_SPT); - sprintf(s, "%i", hd_new_spt); + sprintf(s, "%" PRIu64, hd_new_spt); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_E_HPC); - sprintf(s, "%i", hd_new_hpc); + sprintf(s, "%" PRIu64, hd_new_hpc); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_E_CYL); - sprintf(s, "%i", hd_new_cyl); + sprintf(s, "%" PRIu64, hd_new_cyl); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_E_FN); SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring); h = GetDlgItem(hdlg, IDC_TEXT_E_SIZE); - sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); + sprintf(s, "Size: %" PRIu64 " MB", (hd_new_cyl*hd_new_hpc*hd_new_spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); hd_changed = 1; @@ -864,19 +864,19 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR if (DialogBox(hinstance, TEXT("HdNewDlg"), hdlg, hdnew_dlgproc) == 1) { h = GetDlgItem(hdlg, IDC_EDIT_F_SPT); - sprintf(s, "%i", hd_new_spt); + sprintf(s, "%" PRIu64, hd_new_spt); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_F_HPC); - sprintf(s, "%i", hd_new_hpc); + sprintf(s, "%" PRIu64, hd_new_hpc); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_F_CYL); - sprintf(s, "%i", hd_new_cyl); + sprintf(s, "%" PRIu64, hd_new_cyl); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_F_FN); SendMessage(h, WM_SETTEXT, 0, (LPARAM)hd_new_name); h= GetDlgItem(hdlg, IDC_TEXT_F_SIZE); - sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); + sprintf(s, "Size: %" PRIu64 " MB", (hd_new_cyl*hd_new_hpc*hd_new_spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); hd_changed = 1; @@ -923,19 +923,19 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR if (ret == 1) { h = GetDlgItem(hdlg, IDC_EDIT_F_SPT); - sprintf(s, "%i", hd_new_spt); + sprintf(s, "%" PRIu64, hd_new_spt); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_F_HPC); - sprintf(s, "%i", hd_new_hpc); + sprintf(s, "%" PRIu64, hd_new_hpc); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_F_CYL); - sprintf(s, "%i", hd_new_cyl); + sprintf(s, "%" PRIu64, hd_new_cyl); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); h = GetDlgItem(hdlg, IDC_EDIT_F_FN); SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring); h = GetDlgItem(hdlg, IDC_TEXT_F_SIZE); - sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); + sprintf(s, "Size: %" PRIu64 " MB", (hd_new_cyl*hd_new_hpc*hd_new_spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); hd_changed = 1; @@ -946,64 +946,64 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR case IDC_EDIT_C_SPT: case IDC_EDIT_C_HPC: case IDC_EDIT_C_CYL: h = GetDlgItem(hdlg, IDC_EDIT_C_SPT); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[0].spt); + sscanf(s, "%" PRIu64, &hd[0].spt); h = GetDlgItem(hdlg, IDC_EDIT_C_HPC); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[0].hpc); + sscanf(s, "%" PRIu64, &hd[0].hpc); h = GetDlgItem(hdlg, IDC_EDIT_C_CYL); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[0].tracks); + sscanf(s, "%" PRIu64, &hd[0].tracks); h = GetDlgItem(hdlg, IDC_TEXT_C_SIZE); - sprintf(s, "Size : %imb", ((((hd[0].tracks*hd[0].hpc)*hd[0].spt)*512)/1024)/1024); + sprintf(s, "Size: %" PRIu64 " MB", (hd[0].tracks*hd[0].hpc*hd[0].spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); return TRUE; case IDC_EDIT_D_SPT: case IDC_EDIT_D_HPC: case IDC_EDIT_D_CYL: h = GetDlgItem(hdlg, IDC_EDIT_D_SPT); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[1].spt); + sscanf(s, "%" PRIu64, &hd[1].spt); h = GetDlgItem(hdlg, IDC_EDIT_D_HPC); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[1].hpc); + sscanf(s, "%" PRIu64, &hd[1].hpc); h = GetDlgItem(hdlg, IDC_EDIT_D_CYL); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[1].tracks); + sscanf(s, "%" PRIu64, &hd[1].tracks); h = GetDlgItem(hdlg, IDC_TEXT_D_SIZE); - sprintf(s, "Size : %imb", ((((hd[1].tracks*hd[1].hpc)*hd[1].spt)*512)/1024)/1024); + sprintf(s, "Size: %" PRIu64 " MB", (hd[1].tracks*hd[1].hpc*hd[1].spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); return TRUE; case IDC_EDIT_E_SPT: case IDC_EDIT_E_HPC: case IDC_EDIT_E_CYL: h = GetDlgItem(hdlg, IDC_EDIT_E_SPT); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[2].spt); + sscanf(s, "%" PRIu64, &hd[2].spt); h = GetDlgItem(hdlg, IDC_EDIT_E_HPC); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[2].hpc); + sscanf(s, "%" PRIu64, &hd[2].hpc); h = GetDlgItem(hdlg, IDC_EDIT_E_CYL); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[2].tracks); + sscanf(s, "%" PRIu64, &hd[2].tracks); h = GetDlgItem(hdlg, IDC_TEXT_E_SIZE); - sprintf(s, "Size : %imb", ((((hd[2].tracks*hd[2].hpc)*hd[2].spt)*512)/1024)/1024); + sprintf(s, "Size: %" PRIu64 " MB", (hd[2].tracks*hd[2].hpc*hd[2].spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); return TRUE; case IDC_EDIT_F_SPT: case IDC_EDIT_F_HPC: case IDC_EDIT_F_CYL: h = GetDlgItem(hdlg, IDC_EDIT_F_SPT); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[3].spt); + sscanf(s, "%" PRIu64, &hd[3].spt); h = GetDlgItem(hdlg, IDC_EDIT_F_HPC); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[3].hpc); + sscanf(s, "%" PRIu64, &hd[3].hpc); h = GetDlgItem(hdlg, IDC_EDIT_F_CYL); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); - sscanf(s, "%i", &hd[3].tracks); + sscanf(s, "%" PRIu64, &hd[3].tracks); h = GetDlgItem(hdlg, IDC_TEXT_F_SIZE); - sprintf(s, "Size : %imb", ((((hd[3].tracks*hd[3].hpc)*hd[3].spt)*512)/1024)/1024); + sprintf(s, "Size: %" PRIu64 " MB", (hd[3].tracks*hd[3].hpc*hd[3].spt) >> 11); SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); return TRUE;