From c6190703233707cb6aada30a70fc39e0e4857262 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 4 Sep 2015 19:58:17 +0300 Subject: [PATCH] 3200b11 --- custom.cpp | 1 + devices.cpp | 5 ++ dosbox/cmos.cpp | 12 +++- ide.cpp | 68 ++++++++++++++----- od-win32/win32.h | 4 +- od-win32/win32gfx.cpp | 49 ++++++++++++- od-win32/win32gui.cpp | 14 ++-- od-win32/winuae_msvc14/winuae_msvc.vcxproj | 1 + .../winuae_msvc14/winuae_msvc.vcxproj.filters | 9 ++- od-win32/winuaechangelog.txt | 26 +++++++ zfile.cpp | 2 +- 11 files changed, 159 insertions(+), 32 deletions(-) diff --git a/custom.cpp b/custom.cpp index 9c2f5d4a..96e34ef0 100644 --- a/custom.cpp +++ b/custom.cpp @@ -4239,6 +4239,7 @@ static void init_hz (bool checkvposw) #endif compute_framesync (); + devices_syncchange(); #ifdef PICASSO96 init_hz_p96 (); diff --git a/devices.cpp b/devices.cpp index 4498e6aa..e652eac6 100644 --- a/devices.cpp +++ b/devices.cpp @@ -417,3 +417,8 @@ void devices_restore_start(void) changed_prefs.mbresmem_low_size = 0; changed_prefs.mbresmem_high_size = 0; } + +void devices_syncchange(void) +{ + x86_bridge_sync_change(); +} \ No newline at end of file diff --git a/dosbox/cmos.cpp b/dosbox/cmos.cpp index e04682b4..68300fbc 100644 --- a/dosbox/cmos.cpp +++ b/dosbox/cmos.cpp @@ -95,6 +95,9 @@ void cmos_writereg(Bitu port,Bitu val,Bitu iolen) int reg = cmos.reg; if (reg >= 64 && x86_cmos_bank) reg += 64; + + //write_log("cmos_write %02x (%d) = %02x\n", cmos.reg, x86_cmos_bank, val); + reg &= cmos.ram_mask; switch (reg) @@ -148,7 +151,7 @@ extern unsigned long int timeframes; extern int vpos; extern bool x86_turbo_on; -Bitu cmos_readreg(Bitu port,Bitu iolen) { +static Bitu cmos_readreg2(Bitu port,Bitu iolen) { #if 0 if (cmos.reg>0x3f) { LOG(LOG_BIOS,LOG_ERROR)("CMOS:Read from illegal register %x",cmos.reg); @@ -325,6 +328,13 @@ Bitu cmos_readreg(Bitu port,Bitu iolen) { } } +Bitu cmos_readreg(Bitu port, Bitu iolen) +{ + Bitu v = cmos_readreg2(port, iolen); + //write_log("cmos_read %02x (%d) = %02x\n", cmos.reg, x86_cmos_bank, v); + return v; +} + void CMOS_SetRegister(Bitu regNr, Bit8u val) { cmos.regs[regNr] = val; } diff --git a/ide.cpp b/ide.cpp index dc618ade..3e82be80 100644 --- a/ide.cpp +++ b/ide.cpp @@ -46,7 +46,7 @@ #define ATAPI_CD 0x01 #define ATAPI_MAX_TRANSFER 32768 -#define MAX_IDE_MULTIPLE_SECTORS 64 +#define MAX_IDE_MULTIPLE_SECTORS 128 uae_u16 adide_decode_word(uae_u16 w) @@ -159,8 +159,9 @@ static void ide_grow_buffer(struct ide_hdf *ide, int newsize) static void pw (struct ide_hdf *ide, int offset, uae_u16 w) { - if (ide->byteswap) + if (ide->byteswap) { w = (w >> 8) | (w << 8); + } if (ide->adide) w = adide_decode_word(w); ide->secbuf[offset * 2 + 0] = (uae_u8)w; @@ -182,8 +183,9 @@ static void ps (struct ide_hdf *ide, int offset, const TCHAR *src, int max) if (i + 1 < len) c2 = s[i + 1]; uae_u16 w = (c1 << 0) | (c2 << 8); - if (ide->byteswap) + if (ide->byteswap) { w = (w >> 8) | (w << 8); + } if (ide->adide) w = adide_decode_word(w); ide->secbuf[offset * 2 + 0] = w >> 8; @@ -225,6 +227,7 @@ static bool ide_interrupt_do (struct ide_hdf *ide) ide->irq_delay = 0; if (ide->regs.ide_devcon & 2) return false; + ide->irq_new = true; ide->irq = 1; return true; } @@ -241,12 +244,20 @@ bool ide_drq_check(struct ide_hdf *idep) return false; } -bool ide_irq_check(struct ide_hdf *idep) +bool ide_irq_check(struct ide_hdf *idep, bool edge_triggered) { for (int i = 0; idep && i < 2; i++) { struct ide_hdf *ide = i == 0 ? idep : idep->pair; - if (ide->irq) + if (ide->irq) { + if (edge_triggered) { + if (ide->irq_new) { + ide->irq_new = false; + return true; + } + continue; + } return true; + } } return false; } @@ -317,6 +328,7 @@ static void ide_identify_drive (struct ide_hdf *ide) return; } memset (buf, 0, ide->blocksize); + ide->byteswapped_buffer = 1; if (IDE_LOG > 0) write_log (_T("IDE%d identify drive\n"), ide->num); ide_data_ready (ide); @@ -465,7 +477,26 @@ static void ide_set_features (struct ide_hdf *ide) int mode = ide->regs.ide_nsector & 7; write_log (_T("IDE%d set features %02X (%02X)\n"), ide->num, ide->regs.ide_feat, ide->regs.ide_nsector); - ide_fail (ide); + switch (ide->regs.ide_feat) + { + // 8-bit mode + case 1: + ide->mode_8bit = true; + ide_interrupt(ide); + break; + case 0x81: + ide->mode_8bit = false; + ide_interrupt(ide); + break; + // write cache + case 2: + case 0x82: + ide_interrupt(ide); + break; + default: + ide_fail (ide); + break; + } } static void get_lbachs (struct ide_hdf *ide, uae_u64 *lbap, unsigned int *cyl, unsigned int *head, unsigned int *sec) @@ -701,11 +732,11 @@ static void do_process_packet_command (struct ide_hdf *ide) if (atapi_set_size (ide)) { ide->intdrq = true; } else { + if (IDE_LOG > 1) + write_log(_T("IDE%d ATAPI write finished, %d bytes\n"), ide->num, ide->data_size); memcpy (&ide->scsi->buffer, ide->secbuf, ide->data_size); ide->scsi->data_len = ide->data_size; scsi_emulate_cmd (ide->scsi); - if (IDE_LOG > 1) - write_log (_T("IDE%d ATAPI write finished, %d bytes\n"), ide->num, ide->data_size); } } } @@ -764,10 +795,10 @@ static void do_process_rw_command (struct ide_hdf *ide) put_lbachs (ide, lba, cyl, head, sec, last ? nsec - 1 : nsec); } if (last && ide->direction) { + if (IDE_LOG > 1) + write_log(_T("IDE%d write finished, %d bytes\n"), ide->num, ide->start_nsec * ide->blocksize); ide->intdrq = false; hdf_write (&ide->hdhfd.hfd, ide->secbuf, ide->start_lba * ide->blocksize, ide->start_nsec * ide->blocksize); - if (IDE_LOG > 1) - write_log (_T("IDE%d write finished, %d bytes\n"), ide->num, ide->start_nsec * ide->blocksize); } if (ide->direction) { @@ -806,7 +837,8 @@ static void ide_read_sectors (struct ide_hdf *ide, int flags) return; } if (IDE_LOG > 0) - write_log (_T("IDE%d read off=%d, sec=%d (%d) lba48=%d\n"), ide->num, (uae_u32)lba, nsec, ide->multiple_mode, ide->lba48 + ide->lba48cmd); + write_log (_T("IDE%d %s off=%d, sec=%d (%d) lba48=%d\n"), + ide->num, (flags & 4) ? _T("verify") : _T("read"), (uae_u32)lba, nsec, ide->multiple_mode, ide->lba48 + ide->lba48cmd); if (flags & 4) { // verify ide_interrupt(ide); @@ -869,7 +901,9 @@ static void ide_do_command (struct ide_hdf *ide, uae_u8 cmd) write_log (_T("**** IDE%d command %02X\n"), ide->num, cmd); ide->regs.ide_status &= ~ (IDE_STATUS_DRDY | IDE_STATUS_DRQ | IDE_STATUS_ERR); ide->regs.ide_error = 0; + ide->intdrq = false; ide->lba48cmd = false; + ide->byteswapped_buffer = 0; if (ide->atapi) { @@ -959,7 +993,7 @@ static uae_u16 ide_get_data_2(struct ide_hdf *ide, int bussize) if (bussize) { v = ide->secbuf[ide->packet_data_offset + ide->data_offset + 1] | (ide->secbuf[ide->packet_data_offset + ide->data_offset + 0] << 8); } else { - v = ide->secbuf[ide->packet_data_offset + ide->data_offset]; + v = ide->secbuf[(ide->packet_data_offset + ide->data_offset)]; } if (IDE_LOG > 4) write_log (_T("IDE%d DATA read %04x\n"), ide->num, v); @@ -985,10 +1019,10 @@ static uae_u16 ide_get_data_2(struct ide_hdf *ide, int bussize) if (bussize) { v = ide->secbuf[ide->buffer_offset + ide->data_offset + 1] | (ide->secbuf[ide->buffer_offset + ide->data_offset + 0] << 8); } else { - v = ide->secbuf[ide->buffer_offset + ide->data_offset]; + v = ide->secbuf[(ide->buffer_offset + ide->data_offset)]; } if (IDE_LOG > 4) - write_log (_T("IDE%d DATA read %04x\n"), ide->num, v); + write_log (_T("IDE%d DATA read %04x %d/%d\n"), ide->num, v, ide->data_offset, ide->data_size); ide->data_offset += inc; if (ide->data_size < 0) { ide->data_size += inc; @@ -1040,14 +1074,14 @@ static void ide_put_data_2(struct ide_hdf *ide, uae_u16 v, int bussize) ide->secbuf[ide->packet_data_offset + ide->data_offset + 1] = v & 0xff; ide->secbuf[ide->packet_data_offset + ide->data_offset + 0] = v >> 8; } else { - ide->secbuf[ide->packet_data_offset + ide->data_offset] = v; + ide->secbuf[(ide->packet_data_offset + ide->data_offset) ^ 1] = v; } } else { if (bussize) { ide->secbuf[ide->buffer_offset + ide->data_offset + 1] = v & 0xff; ide->secbuf[ide->buffer_offset + ide->data_offset + 0] = v >> 8; } else { - ide->secbuf[ide->buffer_offset + ide->data_offset] = v; + ide->secbuf[(ide->buffer_offset + ide->data_offset)] = v; } } ide->data_offset += inc; @@ -1156,6 +1190,7 @@ uae_u32 ide_read_reg (struct ide_hdf *ide, int ide_reg) break; case IDE_STATUS: ide->irq = 0; + ide->irq_new = false; /* fall through */ case IDE_DEVCON: /* ALTSTATUS when reading */ if (!isdrv) { @@ -1241,6 +1276,7 @@ void ide_write_reg (struct ide_hdf *ide, int ide_reg, uae_u32 val) break; case IDE_STATUS: ide->irq = 0; + ide->irq_new = false; if (ide_isdrive (ide)) { ide->regs.ide_status |= IDE_STATUS_BSY; ide_do_command (ide, val); diff --git a/od-win32/win32.h b/od-win32/win32.h index 5917f33e..4a117603 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -20,12 +20,12 @@ #define LANG_DLL_FULL_VERSION_MATCH 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("10") +#define WINUAEBETA _T("11") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2015, 8, 28) +#define WINUAEDATE MAKEBD(2015, 9, 4) //#define WINUAEEXTRA _T("AmiKit Preview") //#define WINUAEEXTRA _T("Amiga Forever Edition") diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 1459cc9e..20c4c7d4 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -294,7 +294,7 @@ void desktop_coords (int *dw, int *dh, int *ax, int *ay, int *aw, int *ah) *ah = amigawin_rect.bottom - *ay; } -int target_get_display (const TCHAR *name) +static int target_get_display2(const TCHAR *name, int mode) { int found, found2; @@ -302,6 +302,10 @@ int target_get_display (const TCHAR *name) found2 = -1; for (int i = 0; Displays[i].monitorname; i++) { struct MultiDisplay *md = &Displays[i]; + if (mode == 1 && md->monitorid[0] == '\\') + continue; + if (mode == 2 && md->monitorid[0] != '\\') + continue; if (!_tcscmp (md->monitorid, name)) { if (found < 0) { found = i + 1; @@ -318,6 +322,10 @@ int target_get_display (const TCHAR *name) found = -1; for (int i = 0; Displays[i].monitorname; i++) { struct MultiDisplay *md = &Displays[i]; + if (mode == 1 && md->adapterid[0] == '\\') + continue; + if (mode == 2 && md->adapterid[0] != '\\') + continue; if (!_tcscmp (md->adapterid, name)) { if (found < 0) { found = i + 1; @@ -334,6 +342,10 @@ int target_get_display (const TCHAR *name) for (int i = 0; Displays[i].monitorname; i++) { struct MultiDisplay *md = &Displays[i]; + if (mode == 1 && md->adaptername[0] == '\\') + continue; + if (mode == 2 && md->adaptername[0] != '\\') + continue; if (!_tcscmp (md->adaptername, name)) { if (found < 0) { found = i + 1; @@ -350,6 +362,10 @@ int target_get_display (const TCHAR *name) for (int i = 0; Displays[i].monitorname; i++) { struct MultiDisplay *md = &Displays[i]; + if (mode == 1 && md->monitorname[0] == '\\') + continue; + if (mode == 2 && md->monitorname[0] != '\\') + continue; if (!_tcscmp (md->monitorname, name)) { if (found < 0) { found = i + 1; @@ -363,11 +379,38 @@ int target_get_display (const TCHAR *name) } if (found >= 0) return found; - if (found2 >= 0) - return found2; + if (mode == 3) { + if (found2 >= 0) + return found2; + } return -1; } + +int target_get_display(const TCHAR *name) +{ + int disp; + + //write_log(_T("target_get_display '%s'\n"), name); + disp = target_get_display2(name, 0); + //write_log(_T("Scan 0: %d\n"), disp); + if (disp >= 0) + return disp; + disp = target_get_display2(name, 1); + //write_log(_T("Scan 1: %d\n"), disp); + if (disp >= 0) + return disp; + disp = target_get_display2(name, 2); + //write_log(_T("Scan 2: %d\n"), disp); + if (disp >= 0) + return disp; + disp = target_get_display2(name, 3); + //write_log(_T("Scan 3: %d\n"), disp); + if (disp >= 0) + return disp; + return -1; +} + const TCHAR *target_get_display_name (int num, bool friendlyname) { if (num <= 0) diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 1bd6ebfc..32052734 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -18218,12 +18218,14 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l { case WM_DPICHANGED: { - int dx = LOWORD(wParam); - int dy = HIWORD(wParam); - RECT *r = (RECT*)lParam; - gui_width = r->right - r->left; - gui_height = r->bottom - r->top; - gui_size_changed = 1; + if (!gui_size_changed && hGUIWnd != NULL) { + int dx = LOWORD(wParam); + int dy = HIWORD(wParam); + RECT *r = (RECT*)lParam; + gui_width = r->right - r->left; + gui_height = r->bottom - r->top; + gui_size_changed = 1; + } } break; case WM_SIZING: diff --git a/od-win32/winuae_msvc14/winuae_msvc.vcxproj b/od-win32/winuae_msvc14/winuae_msvc.vcxproj index 223e7d7d..5a5b09fc 100644 --- a/od-win32/winuae_msvc14/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc14/winuae_msvc.vcxproj @@ -821,6 +821,7 @@ + diff --git a/od-win32/winuae_msvc14/winuae_msvc.vcxproj.filters b/od-win32/winuae_msvc14/winuae_msvc.vcxproj.filters index e93869e6..b8d17d91 100644 --- a/od-win32/winuae_msvc14/winuae_msvc.vcxproj.filters +++ b/od-win32/winuae_msvc14/winuae_msvc.vcxproj.filters @@ -790,9 +790,6 @@ x86 - - x86 - x86 @@ -802,6 +799,12 @@ x86 + + x86 + + + x86 + diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 3388bb17..508250ff 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,30 @@ +Beta 11 + +- Fixed A2386SX default video mode configuration, it is software controlled, not jumper like in + older models. Fixes unexpected "Invalid configuration information" BIOS messages. +- Added A2386SX-only hack to enable working 1.4M floppy images, I assume it thinks connected drive is + Amiga 1760k drive and it programs FDC to use 720k (1.4M half speed) bit rate. +- Autodetect *.ima PC disk images inside archives. +- Increased IDE emulation multiple transfer support from 64 blocks to 128 blocks (Max possible). +- Universal XTIDE BIOS load address is now user configurable. (Exxxx does not work in AT systems) +- x86 IDE emulation used wrong byte swapping mode if data port width was 16/32-bit (AT systems) +- Added support for IDE emulation edge triggered interrupts. ISA bus uses edge triggered interrupts, + Fixes A2386SX IDE configuration hang. +- Only first non-autoconfig "board" was initialized if more than one was configured (for example + both x86 AT IDE and XT IDE controller was enabled) +- Write-protect 0xDC000 region from Amiga-side writes if it is used by XTIDE Universal BIOS. This + address conflicts with Amiga-PC shared memory space but fortunately it seems only beginning of this + space is actually used for Amiga-PC communication. +- XTIDE Universal BIOS hardware is now correctly emulated. +- Per-monitor high DPI update caused repeated GUI re-open in some situations. +- DOSBox CPU modes now use DOSBox hardware timer emulation, fixes A2386SX floppy access delays. +- Added all currently available bridgeboard BIOS ROMs to ROM scanner. +- Cleaned up internal expansion ROM selection code. + +NOTE: Nearly all previously created DOS HD images are not supported anymore due to wrong +byte swapping. They need to be created from scratch. + Beta 10: - IDE emulation internal operation change. Previously next block was read from hardfile after previous diff --git a/zfile.cpp b/zfile.cpp index f16f6d6d..2ca665d4 100644 --- a/zfile.cpp +++ b/zfile.cpp @@ -264,7 +264,7 @@ static bool checkwrite (struct zfile *zf, int *retcode) static uae_u8 exeheader[]={ 0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00 }; -static TCHAR *diskimages[] = { _T("adf"), _T("adz"), _T("ipf"), _T("scp"), _T("fdi"), _T("dms"), _T("wrp"), _T("dsq"), _T("pkd"), 0 }; +static TCHAR *diskimages[] = { _T("adf"), _T("adz"), _T("ipf"), _T("scp"), _T("fdi"), _T("dms"), _T("wrp"), _T("dsq"), _T("pkd"), _T("ima"), 0 }; int zfile_gettype (struct zfile *z) { -- 2.47.3