]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
2600b1
authorToni Wilen <twilen@winuae.net>
Sat, 12 Jan 2013 15:27:04 +0000 (17:27 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 12 Jan 2013 15:27:04 +0000 (17:27 +0200)
76 files changed:
a2091.cpp
amax.cpp
archivers/zip/unzip.cpp
blitter.cpp
blkdev_cdimage.cpp
cd32_fmv.cpp
cdtv.cpp
cfgfile.cpp
cia.cpp
consolehook.cpp
cpummu.cpp
cpummu30.cpp [new file with mode: 0644]
custom.cpp
debug.cpp
disk.cpp
drawing.cpp
filesys.asm
filesys.cpp
filesys_bootrom.cpp
fpp.cpp
gayle.cpp
gencpu.cpp
hardfile.cpp
include/a2091.h
include/autoconf.h
include/blitter.h
include/cdtv.h
include/cpummu.h
include/cpummu030.h [new file with mode: 0644]
include/custom.h
include/debug.h
include/drawing.h
include/filesys.h
include/gayle.h
include/gfxfilter.h
include/gui.h
include/inputdevice.h
include/mmu_common.h [new file with mode: 0644]
include/newcpu.h
include/options.h
include/savestate.h
include/scsi.h
include/xwin.h
inputdevice.cpp
main.cpp
memory.cpp
newcpu.cpp
od-win32/dinput.cpp
od-win32/direct3d.cpp
od-win32/direct3d.h
od-win32/hardfile_win32.cpp
od-win32/picasso96_win.cpp
od-win32/resources/resource.h [changed mode: 0755->0644]
od-win32/resources/winuae.rc
od-win32/rp.cpp
od-win32/srcrelease.cmd
od-win32/sysconfig.h
od-win32/win32.cpp
od-win32/win32.h
od-win32/win32_filesys.cpp
od-win32/win32_scaler.cpp
od-win32/win32gfx.cpp
od-win32/win32gfx.h
od-win32/win32gui.cpp
od-win32/winuae_msvc10/winuae_msvc.vcxproj
od-win32/winuae_msvc10/winuae_msvc.vcxproj.filters
od-win32/winuae_msvc11/winuae_msvc.vcxproj
od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters
od-win32/winuaechangelog.txt
od-win32/writelog.cpp
savestate.cpp
scsi.cpp
statusline.cpp
uaeipc.cpp
zfile.cpp
zfile_archive.cpp

index fb399317c54574c1b96555a714cd4943fac8f29c..d19dcfcf417971e4f2f7958067856f2fc1e185ef 100644 (file)
--- a/a2091.cpp
+++ b/a2091.cpp
@@ -3,13 +3,14 @@
 *
 * A590/A2091/A3000/CDTV SCSI expansion (DMAC/SuperDMAC + WD33C93) emulation
 *
-* Copyright 2007 Toni Wilen
+* Copyright 2007-2013 Toni Wilen
 *
 */
 
 #define A2091_DEBUG 0
 #define A3000_DEBUG 0
-#define WD33C93_DEBUG 0
+#define WD33C93_DEBUG 1
+#define WD33C93_DEBUG_PIO 0
 
 #include "sysconfig.h"
 #include "sysdeps.h"
@@ -29,6 +30,7 @@
 #include "filesys.h"
 #include "autoconf.h"
 #include "cdtv.h"
+#include "savestate.h"
 
 #define ROM_VECTOR 0x2000
 #define ROM_OFFSET 0x2000
 #define WD_CMD_SBT_MODE                0x80
 
 /* paused or aborted interrupts */
-#define CSR_MSGIN          0x20
-#define CSR_SDP                    0x21
-#define CSR_SEL_ABORT      0x22
-#define CSR_RESEL_ABORT            0x25
-#define CSR_RESEL_ABORT_AM  0x27
-#define CSR_ABORT          0x28
+#define CSR_MSGIN                      0x20
+#define CSR_SDP                                0x21
+#define CSR_SEL_ABORT          0x22
+#define CSR_RESEL_ABORT                0x25
+#define CSR_RESEL_ABORT_AM     0x27
+#define CSR_ABORT                      0x28
 /* successful completion interrupts */
-#define CSR_RESELECT       0x10
-#define CSR_SELECT         0x11
-#define CSR_SEL_XFER_DONE   0x16
-#define CSR_XFER_DONE      0x18
+#define CSR_RESELECT           0x10
+#define CSR_SELECT                     0x11
+#define CSR_SEL_XFER_DONE      0x16
+#define CSR_XFER_DONE          0x18
 /* terminated interrupts */
-#define CSR_INVALID        0x40
-#define CSR_UNEXP_DISC     0x41
-#define CSR_TIMEOUT        0x42
-#define CSR_PARITY         0x43
-#define CSR_PARITY_ATN     0x44
-#define CSR_BAD_STATUS     0x45
-#define CSR_UNEXP          0x48
+#define CSR_INVALID                    0x40
+#define CSR_UNEXP_DISC         0x41
+#define CSR_TIMEOUT                    0x42
+#define CSR_PARITY                     0x43
+#define CSR_PARITY_ATN         0x44
+#define CSR_BAD_STATUS         0x45
+#define CSR_UNEXP                      0x48
 /* service required interrupts */
-#define CSR_RESEL          0x80
-#define CSR_RESEL_AM       0x81
-#define CSR_DISC           0x85
-#define CSR_SRV_REQ        0x88
+#define CSR_RESEL                      0x80
+#define CSR_RESEL_AM           0x81
+#define CSR_DISC                       0x85
+#define CSR_SRV_REQ                    0x88
 /* SCSI Bus Phases */
-#define PHS_DATA_OUT       0x00
-#define PHS_DATA_IN        0x01
-#define PHS_COMMAND        0x02
-#define PHS_STATUS         0x03
-#define PHS_MESS_OUT       0x06
-#define PHS_MESS_IN        0x07
+#define PHS_DATA_OUT   0x00
+#define PHS_DATA_IN            0x01
+#define PHS_COMMAND            0x02
+#define PHS_STATUS             0x03
+#define PHS_MESS_OUT   0x06
+#define PHS_MESS_IN            0x07
+
+/* Auxialiry status */
+#define ASR_INT                        0x80    /* Interrupt pending */
+#define ASR_LCI                        0x40    /* Last command ignored */
+#define ASR_BSY                        0x20    /* Busy, only cmd/data/asr readable */
+#define ASR_CIP                        0x10    /* Busy, cmd unavail also */
+#define ASR_xxx                        0x0c
+#define ASR_PE                 0x02    /* Parity error (even) */
+#define ASR_DBR                        0x01    /* Data Buffer Ready */
+/* Status */
+#define CSR_CAUSE              0xf0
+#define CSR_RESET              0x00    /* chip was reset */
+#define CSR_CMD_DONE   0x10    /* cmd completed */
+#define CSR_CMD_STOPPED        0x20    /* interrupted or abrted*/
+#define CSR_CMD_ERR            0x40    /* end with error */
+#define CSR_BUS_SERVICE        0x80    /* REQ pending on the bus */
+/* Control */
+#define CTL_DMA                        0x80    /* Single byte dma */
+#define CTL_DBA_DMA            0x40    /* direct buffer access (bus master) */
+#define CTL_BURST_DMA  0x20    /* continuous mode (8237) */
+#define CTL_NO_DMA             0x00    /* Programmed I/O */
+#define CTL_HHP                        0x10    /* Halt on host parity error */
+#define CTL_EDI                        0x08    /* Ending disconnect interrupt */
+#define CTL_IDI                        0x04    /* Intermediate disconnect interrupt*/
+#define CTL_HA                 0x02    /* Halt on ATN */
+#define CTL_HSP                        0x01    /* Halt on SCSI parity error */
+
+/* SCSI Messages */
+#define MSG_COMMAND_COMPLETE 0x00
+#define MSG_SAVE_DATA_POINTER 0x02
+#define MSG_RESTORE_DATA_POINTERS 0x03
+#define MSG_NOP 0x08
+#define MSG_IDENTIFY 0x80
 
 static int configured;
 static uae_u8 dmacmemory[100];
@@ -152,16 +187,22 @@ static uae_u32 dmac_wtc;
 static int dmac_dma;
 static uae_u8 sasr, scmd, auxstatus;
 static int wd_used;
-static int wd_phase, wd_next_phase, wd_busy;
-static int wd_dataoffset, wd_tc;
+static int wd_phase, wd_next_phase, wd_busy, wd_data_avail;
+static bool wd_selected;
+static int wd_dataoffset;
 static uae_u8 wd_data[32];
 
 static int superdmac;
-static int scsidelay_irq;
-static uae_u8 scsidelay_status;
+
+#define WD_STATUS_QUEUE 2
+static int scsidelay_irq[WD_STATUS_QUEUE];
+static uae_u8 scsidelay_status[WD_STATUS_QUEUE];
+static int queue_index;
+
 static int wd33c93a = 1;
 
 struct scsi_data *scsis[8];
+static struct scsi_data *scsi;
 
 uae_u8 wdregs[32];
 
@@ -181,7 +222,7 @@ void rethink_a2091 (void)
 {
        if (currprefs.cs_cdtvscsi)
                return;
-       if (isirq()) {
+       if (isirq ()) {
                uae_int_requested |= 2;
 #if A2091_DEBUG > 2 || A3000_DEBUG > 2
                write_log (_T("Interrupt_RETHINK\n"));
@@ -195,7 +236,7 @@ static void INT2 (void)
 {
        if (currprefs.cs_cdtvscsi)
                return;
-       if (!(auxstatus & 0x80))
+       if (!(auxstatus & ASR_INT))
                return;
        dmac_istr |= ISTR_INTS;
        if (isirq ())
@@ -238,15 +279,15 @@ static void incsasr (int w)
 static void dmac_cint (void)
 {
        dmac_istr = 0;
-       rethink_a2091();
+       rethink_a2091 ();
 }
 
-static void doscsistatus (void)
+static void doscsistatus (uae_u8 status)
 {
-       wdregs[WD_SCSI_STATUS] = scsidelay_status;
-       auxstatus |= 0x80;
+       wdregs[WD_SCSI_STATUS] = status;
+       auxstatus |= ASR_INT;
 #if WD33C93_DEBUG > 0
-       write_log (_T("%s STATUS=%02X\n"), WD33C93, scsidelay_status);
+       write_log (_T("%s STATUS=%02X\n"), WD33C93, status);
 #endif
        if (currprefs.cs_cdtvscsi) {
                cdtv_scsi_int ();
@@ -260,21 +301,35 @@ static void doscsistatus (void)
 #endif
 }
 
-void scsi_hsync (void)
+static void set_status (uae_u8 status, int delay)
 {
-       if (scsidelay_irq == 1) {
-               scsidelay_irq = 0;
-               doscsistatus();
-               return;
-       }
-       if (scsidelay_irq > 1)
-               scsidelay_irq--;
+       queue_index++;
+       if (queue_index >= WD_STATUS_QUEUE)
+               queue_index = 0;
+       scsidelay_irq[queue_index] = delay <= 2 ? 2 : delay;
+       if (scsidelay_irq[1] == scsidelay_irq[0])
+               scsidelay_irq[1]++;
+       scsidelay_status[queue_index] = status;
 }
 
-static void set_status (uae_u8 status, int quick)
+static uae_u32 gettc (void)
 {
-       scsidelay_irq = quick <= 2 ? 2 : quick;
-       scsidelay_status = status;
+       return wdregs[WD_TRANSFER_COUNT_LSB] | (wdregs[WD_TRANSFER_COUNT] << 8) | (wdregs[WD_TRANSFER_COUNT_MSB] << 16);
+}
+static void settc (uae_u32 tc)
+{
+       wdregs[WD_TRANSFER_COUNT_LSB] = tc & 0xff;
+       wdregs[WD_TRANSFER_COUNT] = (tc >> 8) & 0xff;
+       wdregs[WD_TRANSFER_COUNT_MSB] = (tc >> 16) & 0xff;
+}
+static bool decreasetc (void)
+{
+       uae_u32 tc = gettc ();
+       if (!tc)
+               return true;
+       tc--;
+       settc (tc);
+       return tc == 0;
 }
 
 static TCHAR *scsitostring (void)
@@ -285,7 +340,7 @@ static TCHAR *scsitostring (void)
 
        p = buf;
        p[0] = 0;
-       for (i = 0; i < wd_tc && i < sizeof wd_data; i++) {
+       for (i = 0; i < gettc () && i < sizeof wd_data; i++) {
                if (i > 0) {
                        _tcscat (p, _T("."));
                        p++;
@@ -296,27 +351,6 @@ static TCHAR *scsitostring (void)
        return buf;
 }
 
-static void wd_cmd_sel_xfer (void)
-{
-       int phase = wdregs[WD_COMMAND_PHASE];
-#if WD33C93_DEBUG > 0
-       write_log (_T("* %s select and transfer, ID=%d phase=%02X\n"), WD33C93, wdregs[WD_DESTINATION_ID] & 0x7, phase);
-#endif
-       if (!SCSIID) {
-               set_status (CSR_TIMEOUT, 0);
-               return;
-       }
-       SCSIID->buffer[0] = 0;
-       if (phase >= 0x46) {
-               phase = 0x50;
-               wdregs[WD_TARGET_LUN] = SCSIID->status;
-               SCSIID->buffer[0] = SCSIID->status;
-       }
-       wdregs[WD_COMMAND_PHASE] = phase;
-       wd_phase = CSR_XFER_DONE | PHS_MESS_IN;
-       set_status (wd_phase, 1);
-}
-
 static void dmacheck (void)
 {
        dmac_acr++;
@@ -328,137 +362,246 @@ static void dmacheck (void)
        }
 }
 
-static void do_dma (void)
+static void setphase (uae_u8 phase)
 {
+       wdregs[WD_COMMAND_PHASE] = phase;
+}
+
+static bool do_dma (void)
+{
+       wd_data_avail = 0;
        if (currprefs.cs_cdtvscsi)
                cdtv_getdmadata (&dmac_acr);
-       if (SCSIID->direction == 0) {
+       if (scsi->direction == 0) {
                write_log (_T("%s DMA but no data!?\n"), WD33C93);
-       } else if (SCSIID->direction < 0) {
+       } else if (scsi->direction < 0) {
+               uaecptr odmac_acr = dmac_acr;
                for (;;) {
                        uae_u8 v;
-                       int status = scsi_receive_data (SCSIID, &v);
+                       int status = scsi_receive_data (scsi, &v);
                        put_byte (dmac_acr, v);
                        if (wd_dataoffset < sizeof wd_data)
                                wd_data[wd_dataoffset++] = v;
                        dmacheck ();
+                       if (decreasetc ())
+                               break;
                        if (status)
                                break;
                }
-       } else if (SCSIID->direction > 0) {
+#if WD33C93_DEBUG > 0
+               write_log (_T("%s DMA from WD, %d/%d %08X\n"), WD33C93, scsi->offset, scsi->data_len, odmac_acr);
+#endif
+               return true;
+       } else if (scsi->direction > 0) {
+               uaecptr odmac_acr = dmac_acr;
                for (;;) {
                        int status;
                        uae_u8 v = get_byte (dmac_acr);
                        if (wd_dataoffset < sizeof wd_data)
                                wd_data[wd_dataoffset++] = v;
-                       status = scsi_send_data (SCSIID, v);
+                       status = scsi_send_data (scsi, v);
                        dmacheck ();
+                       if (decreasetc ())
+                               break;
                        if (status)
                                break;
                }
+#if WD33C93_DEBUG > 0
+               write_log (_T("%s DMA to WD, %d/%d %08x\n"), WD33C93, scsi->offset, scsi->data_len, odmac_acr);
+#endif
+               return true;
        }
+       return false;
 }
 
-static void wd_do_transfer_out (void)
+
+static bool wd_do_transfer_out (void)
 {
 #if WD33C93_DEBUG > 0
-       write_log (_T("%s SCSI O [%02X] %d/%d %s\n"), WD33C93, wdregs[WD_COMMAND_PHASE], wd_dataoffset, wd_tc, scsitostring ());
+       write_log (_T("%s SCSI O [%02X] %d/%d %s\n"), WD33C93, wdregs[WD_COMMAND_PHASE], wd_dataoffset, gettc (), scsitostring ());
 #endif
-       if (wdregs[WD_COMMAND_PHASE] == 0x11) {
-               wdregs[WD_COMMAND_PHASE] = 0x20;
+       if (wdregs[WD_COMMAND_PHASE] < 0x20) {
+               /* message was sent */
+               setphase (0x20);
                wd_phase = CSR_XFER_DONE | PHS_COMMAND;
+               scsi->status = 0;
+               scsi_start_transfer (scsi);
+#if WD33C93_DEBUG > 0
+               write_log (_T("%s SCSI got MESSAGE %02X\n"), WD33C93, wd_data[0]);
+#endif
        } else if (wdregs[WD_COMMAND_PHASE] == 0x30) {
-               /* command was sent */
-               SCSIID->direction = scsi_data_dir (SCSIID);
-               if (SCSIID->direction > 0) {
+#if WD33C93_DEBUG > 0
+               write_log (_T("%s SCSI got COMMAND %02X\n"), WD33C93, wd_data[0]);
+#endif
+               if (scsi->offset < scsi->data_len) {
+                       // data missing, ask for more
+                       wd_phase = CSR_XFER_DONE | PHS_COMMAND;
+                       setphase (0x30 + scsi->offset);
+                       set_status (wd_phase, 1);
+                       return false;
+               }
+               settc (0);
+               scsi_start_transfer (scsi);
+               scsi_emulate_analyze (scsi);
+               if (scsi->direction > 0) {
                        /* if write command, need to wait for data */
-                       wd_phase = CSR_XFER_DONE | PHS_DATA_OUT;
-                       wdregs[WD_COMMAND_PHASE] = 0x46;
+                       if (scsi->data_len <= 0 || scsi->direction == 0) {
+                               // Status phase if command didn't return anything and don't want anything
+                               wd_phase = CSR_XFER_DONE | PHS_STATUS;
+                               setphase (0x46);
+                       } else {
+                               wd_phase = CSR_XFER_DONE | PHS_DATA_OUT;
+                               setphase (0x45);
+                       }
                } else {
-                       scsi_emulate_cmd (SCSIID);
-                       if (SCSIID->data_len <= 0 || SCSIID->status != 0 || SCSIID->direction == 0) {
+                       scsi_emulate_cmd (scsi);
+                       if (scsi->data_len <= 0 || scsi->direction == 0) {
+                               // Status phase if command didn't return anything and don't want anything
                                wd_phase = CSR_XFER_DONE | PHS_STATUS;
-                               wdregs[WD_COMMAND_PHASE] = 0x47;
+                               setphase (0x46);
                        } else {
                                wd_phase = CSR_XFER_DONE | PHS_DATA_IN;
-                               wdregs[WD_COMMAND_PHASE] = 0x3f;
+                               setphase (0x45); // just skip all reselection and message stuff for now..
                        }
                }
-       } else if (wdregs[WD_COMMAND_PHASE] == 0x46) {
-               if (SCSIID->direction > 0) {
+       } else if (wdregs[WD_COMMAND_PHASE] == 0x46 || wdregs[WD_COMMAND_PHASE] == 0x45) {
+               if (scsi->offset < scsi->data_len) {
+                       // data missing, ask for more
+                       wd_phase = CSR_XFER_DONE | (scsi->direction < 0 ? PHS_DATA_IN : PHS_DATA_OUT);
+                       set_status (wd_phase, 10);
+                       return false;
+               }
+               settc (0);
+               if (scsi->direction > 0) {
                        /* data was sent */
-                       scsi_emulate_cmd (SCSIID);
+                       scsi_emulate_cmd (scsi);
+                       scsi->data_len = 0;
                        wd_phase = CSR_XFER_DONE | PHS_STATUS;
                }
-               wdregs[WD_COMMAND_PHASE] = 0x47;
+               scsi_start_transfer (scsi);
+               setphase (0x47);
        }
        wd_dataoffset = 0;
-       set_status (wd_phase, SCSIID->direction ? 0 : 1);
+       set_status (wd_phase, scsi->direction <= 0 ? 0 : 1);
        wd_busy = 0;
+       return true;
 }
 
-static void wd_do_transfer_in (void)
+static bool wd_do_transfer_in (void)
 {
 #if WD33C93_DEBUG > 0
-       write_log (_T("%s SCSI I [%02X] %d/%d %s\n"), WD33C93, wdregs[WD_COMMAND_PHASE], wd_dataoffset, wd_tc, scsitostring ());
+       write_log (_T("%s SCSI I [%02X] %d/%d TC=%d %s\n"), WD33C93, wdregs[WD_COMMAND_PHASE], scsi->offset, scsi->data_len, gettc (), scsitostring ());
 #endif
        wd_dataoffset = 0;
-       if (wdregs[WD_COMMAND_PHASE] >= 0x36 && wdregs[WD_COMMAND_PHASE] < 0x47) {
-               wdregs[WD_COMMAND_PHASE] = 0x47;
-               wd_phase = CSR_XFER_DONE | PHS_STATUS;
-       } else if (wdregs[WD_COMMAND_PHASE] == 0x47) {
-               wdregs[WD_COMMAND_PHASE] = 0x50;
+       if (wdregs[WD_COMMAND_PHASE] >= 0x36 && wdregs[WD_COMMAND_PHASE] < 0x46) {
+               if (scsi->offset < scsi->data_len) {
+                       // data missing, ask for more
+                       wd_phase = CSR_XFER_DONE | (scsi->direction < 0 ? PHS_DATA_IN : PHS_DATA_OUT);
+                       set_status (wd_phase, 1);
+                       return false;
+               }
+               if (gettc () != 0) {
+                       wd_phase = CSR_UNEXP | PHS_STATUS;
+                       setphase (0x46);
+               } else {
+                       wd_phase = CSR_XFER_DONE | PHS_STATUS;
+                       setphase (0x46);
+               }
+               scsi_start_transfer (scsi);
+       } else if (wdregs[WD_COMMAND_PHASE] == 0x46) {
+               setphase (0x50);
                wd_phase = CSR_XFER_DONE | PHS_MESS_IN;
+               scsi_start_transfer (scsi);
        } else if (wdregs[WD_COMMAND_PHASE] == 0x50) {
-               wdregs[WD_COMMAND_PHASE] = 0x60;
+               setphase (0x60);
                wd_phase = CSR_DISC;
+               wd_selected = false;
+               scsi_start_transfer (scsi);
        }
        set_status (wd_phase, 1);
-       wd_busy = 0;
-       SCSIID->direction = 0;
+       scsi->direction = 0;
+       return true;
 }
 
-static void wd_cmd_sel_xfer_atn (void)
+static void wd_cmd_sel_xfer (bool atn)
 {
        int i, tmp_tc;
+       int delay = 0;
 
-       tmp_tc = wdregs[WD_TRANSFER_COUNT_LSB] | (wdregs[WD_TRANSFER_COUNT] << 8) | (wdregs[WD_TRANSFER_COUNT_MSB] << 16);
-#if WD33C93_DEBUG > 0
-       write_log (_T("* %s select and transfer with atn, ID=%d PHASE=%02X TC=%d\n"),
-               WD33C93, wdregs[WD_DESTINATION_ID] & 0x7, wdregs[WD_COMMAND_PHASE], tmp_tc);
-#endif
-       if (wdregs[WD_COMMAND] & 0x80)
-               wd_tc = 1;
-       if (!SCSIID) {
+       tmp_tc = gettc ();
+       scsi = scsis[wdregs[WD_DESTINATION_ID] & 7];
+       if (!scsi) {
                set_status (CSR_TIMEOUT, 0);
+               wdregs[WD_COMMAND_PHASE] = 0x00;
                return;
        }
-       SCSIID->buffer[0] = 0;
-       SCSIID->direction = 0;
+       if (!wd_selected) {
+               wd_selected = true;
+               wdregs[WD_COMMAND_PHASE] = 0x10;
+       }
+#if WD33C93_DEBUG > 0
+       write_log (_T("* %s select and transfer%s, ID=%d PHASE=%02X TC=%d\n"),
+               WD33C93, atn ? _T(" with atn") : _T(""), wdregs[WD_DESTINATION_ID] & 0x7, wdregs[WD_COMMAND_PHASE], tmp_tc);
+#endif
        if (wdregs[WD_COMMAND_PHASE] <= 0x30) {
-               wd_tc = 6;
+               scsi->buffer[0] = 0;
+               scsi->status = 0;
+               memcpy (scsi->cmd, &wdregs[3], 16);
+               scsi_emulate_analyze (scsi);
+               settc (scsi->cmd_len);
                wd_dataoffset = 0;
-               scsi_start_transfer (SCSIID, 6);
-               for (i = 0; i < wd_tc; i++) {
-                       uae_u8 b = wdregs[3 + i];
+               scsi_start_transfer (scsi);
+               scsi->direction = 2;
+               scsi->data_len = scsi->cmd_len;
+               for (i = 0; i < gettc (); i++) {
+                       uae_u8 b = scsi->cmd[i];
                        wd_data[i] = b;
-                       scsi_send_data (SCSIID, b);
+                       scsi_send_data (scsi, b);
                        wd_dataoffset++;
                }
-               // command
-               SCSIID->direction = (wdregs[WD_SOURCE_ID] & 0x20) ? 1 : -1;
-               wdregs[WD_COMMAND_PHASE] = 0x30;
-               wd_do_transfer_out ();
-               wdregs[WD_COMMAND_PHASE] = 0x36;
+               // 0x30 = command phase has started
+               scsi_emulate_analyze (scsi);
+               wdregs[WD_COMMAND_PHASE] = 0x30 + gettc ();
+               settc (0);
+#if WD33C93_DEBUG > 0
+               write_log (_T("%s: Got Command %s, datalen=%d\n"), WD33C93, scsitostring (), scsi->data_len);
+#endif
        }
+
        if (wdregs[WD_COMMAND_PHASE] <= 0x41) {
-               wd_tc = tmp_tc;
+               wdregs[WD_COMMAND_PHASE] = 0x44;
+#if 0
+               if (wdregs[WD_CONTROL] & CTL_IDI) {
+                       wd_phase = CSR_DISC;
+                       set_status (wd_phase, delay);
+                       wd_phase = CSR_RESEL;
+                       set_status (wd_phase, delay + 10);
+                       return;
+               }
+#endif
+               wdregs[WD_COMMAND_PHASE] = 0x44;
+       }
+
+       if (wdregs[WD_COMMAND_PHASE] == 0x44) {
+               settc (tmp_tc);
                wd_dataoffset = 0;
-               wdregs[WD_COMMAND_PHASE] = 0x45;
-               if (wd_tc == 0) {
-                       if (SCSIID->direction != 0 && SCSIID->status == 0) {
+               // target replied
+               setphase (0x45);
+               scsi_start_transfer (scsi);
+
+               if (gettc () == 0) {
+                       if (scsi->direction != 0) {
+                               // TC = 0 but we may have data
+                               if (scsi->direction < 0) {
+                                       scsi_emulate_cmd (scsi);
+                                       if (scsi->data_len == 0) {
+                                               // no data, continue normally to status phase
+                                               setphase (0x46);
+                                               goto end;
+                                       }
+                               }
                                wd_phase = CSR_UNEXP;
-                               if (SCSIID->direction < 0)
+                               if (scsi->direction < 0)
                                        wd_phase |= PHS_DATA_IN;
                                else
                                        wd_phase |= PHS_DATA_OUT;
@@ -466,79 +609,174 @@ static void wd_cmd_sel_xfer_atn (void)
                                return;
                        }
                }
-               if ((wdregs[WD_CONTROL] >> 5) == 4) {
-                       if (wd_phase == (CSR_XFER_DONE | PHS_DATA_IN))
-                               do_dma ();
-                       else if(wd_phase == (CSR_XFER_DONE | PHS_DATA_OUT))
-                               do_dma ();
+
+               if (scsi->direction) {
+                       scsi_start_transfer (scsi);
+                       if ((wdregs[WD_CONTROL] >> 5) == 4) {
+                               if (scsi->direction <=  0) {
+                                       scsi_emulate_cmd (scsi);
+                                       do_dma ();
+                                       setphase (0x46);
+                               } else {
+                                       if (do_dma ()) {
+                                               setphase (0x46);
+                                               scsi_emulate_cmd (scsi);
+                                       }
+                               }
+                       } else {
+                               if (scsi->direction <  0)
+                                       scsi_emulate_cmd (scsi);
+                               wd_phase = CSR_SRV_REQ;
+                               if (scsi->direction < 0)
+                                       wd_phase |= PHS_DATA_IN;
+                               else
+                                       wd_phase |= PHS_DATA_OUT;
+                               set_status (wd_phase, 1);
+                               return;
+                       }
+               } else {
+                       if (gettc ()) {
+                               wd_phase = CSR_UNEXP | PHS_STATUS;
+                               set_status (wd_phase, 1);
+                               return;
+                       }
+
+                       // there was nothing to transfer
+                       wdregs[WD_COMMAND_PHASE] = 0x46;
                }
+       }
 
+       end:
+       if (wdregs[WD_COMMAND_PHASE] == 0x46) {
+               scsi->buffer[0] = 0;
+               wdregs[WD_COMMAND_PHASE] = 0x50;
+               wdregs[WD_TARGET_LUN] = scsi->status;
+               scsi->buffer[0] = scsi->status;
        }
+
+       // 0x60 = command complete
        wdregs[WD_COMMAND_PHASE] = 0x60;
-       wdregs[WD_TARGET_LUN] = SCSIID->status;
-       SCSIID->buffer[0] = SCSIID->status;
-       wd_phase = CSR_SEL_XFER_DONE;
-       set_status (wd_phase, 0);
+       if (!(wdregs[WD_CONTROL] & CTL_EDI)) {
+               wd_phase = CSR_SEL_XFER_DONE;
+               delay += 2;
+               set_status (wd_phase, delay);
+               delay += 2;
+               wd_phase = CSR_DISC;
+               set_status (wd_phase, delay);
+       } else {
+               delay += 2;
+               wd_phase = CSR_SEL_XFER_DONE;
+               set_status (wd_phase, delay);
+       }
+       wd_selected = 0;
 }
 
 
 static void wd_cmd_trans_info (void)
 {
-       if (wdregs[WD_COMMAND_PHASE] == 0x47)
-               SCSIID->buffer[0] = SCSIID->status;
-       if (wdregs[WD_COMMAND_PHASE] == 0x20)
+       if (wdregs[WD_COMMAND_PHASE] == 0x20) {
                wdregs[WD_COMMAND_PHASE] = 0x30;
+               scsi->status = 0;
+       }
        wd_busy = 1;
-       wd_tc = wdregs[WD_TRANSFER_COUNT_LSB] | (wdregs[WD_TRANSFER_COUNT] << 8) | (wdregs[WD_TRANSFER_COUNT_MSB] << 16);
        if (wdregs[WD_COMMAND] & 0x80)
-               wd_tc = 1;
+               settc (1);
+       if (gettc () == 0)
+               settc (1);
        wd_dataoffset = 0;
-#if WD33C93_DEBUG > 0
-       write_log (_T("* %s transfer info phase=%02x len=%d dma=%d\n"), WD33C93, wdregs[WD_COMMAND_PHASE], wd_tc, wdregs[WD_CONTROL] >> 5);
+
+
+//     if (wdregs[WD_COMMAND_PHASE] >= 0x36 && wdregs[WD_COMMAND_PHASE] <= 0x3f) {
+//             wdregs[WD_COMMAND_PHASE] = 0x45;
+//     } else if (wdregs[WD_COMMAND_PHASE] == 0x41) {
+//             wdregs[WD_COMMAND_PHASE] = 0x46;
+//     }
+
+#if 0
+       if (wdregs[WD_COMMAND_PHASE] >= 0x40 && scsi->direction < 0) {
+               if (wd_tc > scsi->data_len) {
+                       wd_tc = scsi->data_len;
+                       if (wd_tc < 0)
+                               wd_tc = 0;
+               }
+       }
 #endif
-       scsi_start_transfer (SCSIID, wd_tc);
-       if (wdregs[WD_COMMAND_PHASE] >= 0x36 && wdregs[WD_COMMAND_PHASE] <= 0x3f)
-               wdregs[WD_COMMAND_PHASE] = 0x45;
+       if (wdregs[WD_COMMAND_PHASE] == 0x30) {
+               scsi->direction = 2; // command
+               scsi->cmd_len = scsi->data_len = gettc ();
+       } else if (wdregs[WD_COMMAND_PHASE] == 0x10) {
+               scsi->direction = 1; // message
+               scsi->data_len = gettc ();
+       } else if (wdregs[WD_COMMAND_PHASE] == 0x45) {
+               scsi_emulate_analyze (scsi);
+       } else if (wdregs[WD_COMMAND_PHASE] == 0x47) {
+               scsi->direction = -1; // status
+               scsi->data_len = 1;
+       } else if (wdregs[WD_COMMAND_PHASE] == 0x46) {
+               scsi->buffer[0] = scsi->status;
+               wdregs[WD_TARGET_LUN] = scsi->status;
+               scsi->direction = -1; // status
+               scsi->data_len = 1;
+       } else if (wdregs[WD_COMMAND_PHASE] == 0x50) {
+               scsi->direction = -1;
+               scsi->data_len = gettc ();
+       }
+
        if ((wdregs[WD_CONTROL] >> 5) == 4) {
-               do_dma ();
-               if (SCSIID->direction < 0)
-                       wd_do_transfer_in ();
-               else if (SCSIID->direction > 0)
-                       wd_do_transfer_out ();
-               SCSIID->direction = 0;
-               dmac_dma = 0;
+               wd_data_avail = -1;
+       } else {
+               wd_data_avail = 1;
        }
+
+#if WD33C93_DEBUG > 0
+       write_log (_T("* %s transfer info phase=%02x TC=%d dir=%d data=%d/%d wddma=%d dmac=%d\n"),
+               WD33C93, wdregs[WD_COMMAND_PHASE], gettc (), scsi->direction, scsi->offset, scsi->data_len, wdregs[WD_CONTROL] >> 5, dmac_dma);
+#endif
+
 }
 
-static void wd_cmd_sel_atn (void)
+static void wd_cmd_sel (bool atn)
 {
 #if WD33C93_DEBUG > 0
-       write_log (_T("* %s select with atn, ID=%d\n"), WD33C93, wdregs[WD_DESTINATION_ID] & 0x7);
+       write_log (_T("* %s select%s, ID=%d\n"), WD33C93, atn ? _T(" with atn") : _T(""), wdregs[WD_DESTINATION_ID] & 0x7);
 #endif
        wd_phase = 0;
        wdregs[WD_COMMAND_PHASE] = 0;
-       if (SCSIID) {
-               wd_phase = CSR_SELECT;
-               set_status (wd_phase, 1);
-               wdregs[WD_COMMAND_PHASE] = 0x10;
+
+       scsi = scsis[wdregs[WD_DESTINATION_ID] & 7];
+       if (!scsi) {
+               set_status (CSR_TIMEOUT, 1000);
                return;
        }
-       set_status (CSR_TIMEOUT, 1000);
+       scsi_start_transfer (scsi);
+       wd_selected = true;
+       set_status (CSR_SELECT, 2);
+       if (atn) {
+               set_status (CSR_SRV_REQ | PHS_MESS_OUT, 4);
+               wdregs[WD_COMMAND_PHASE] = 0x10;
+       } else {
+               set_status (CSR_SRV_REQ | PHS_COMMAND, 4);
+               wdregs[WD_COMMAND_PHASE] = 0x10; // connected as an initiator
+       } 
 }
 
-static void wd_cmd_reset (void)
+static void wd_cmd_reset (bool irq)
 {
        int i;
 
 #if WD33C93_DEBUG > 0
-       write_log (_T("%s reset\n"), WD33C93);
+       if (irq)
+               write_log (_T("%s reset\n"), WD33C93);
 #endif
        for (i = 1; i < 0x16; i++)
                wdregs[i] = 0;
        wdregs[0x18] = 0;
        if (!wd33c93a)
                wdregs[0] &= ~(0x08 | 0x10);
-       set_status ((wdregs[0] & 0x10) ? 1 : 0, 1);
+       sasr = 0;
+       wd_selected = false;
+       if (irq)
+               set_status ((wdregs[0] & 0x08) ? 1 : 0, 200);
 }
 
 static void wd_cmd_abort (void)
@@ -546,7 +784,35 @@ static void wd_cmd_abort (void)
 #if WD33C93_DEBUG > 0
        write_log (_T("%s abort\n"), WD33C93);
 #endif
-       set_status (CSR_SEL_ABORT, 0);
+}
+
+void scsi_hsync (void)
+{
+       if (wd_data_avail < 0 && dmac_dma > 0) {
+               bool v;
+               do_dma ();
+               if (scsi->direction < 0)
+                       v = wd_do_transfer_in ();
+               else if (scsi->direction > 0)
+                       v = wd_do_transfer_out ();
+               if (v) {
+                       scsi->direction = 0;
+                       wd_data_avail = 0;
+               } else {
+                       dmac_dma = -1;
+               }
+       }
+       if (auxstatus & ASR_INT)
+               return;
+       for (int i = 0; i < WD_STATUS_QUEUE; i++) {
+               if (scsidelay_irq[i] == 1) {
+                       scsidelay_irq[i] = 0;
+                       doscsistatus(scsidelay_status[i]);
+                       wd_busy = 0;
+               } else if (scsidelay_irq[i] > 1) {
+                       scsidelay_irq[i]--;
+               }
+       }
 }
 
 static int writeonlyreg (int reg)
@@ -560,7 +826,7 @@ void wdscsi_put (uae_u8 d)
 {
 #if WD33C93_DEBUG > 1
        if (WD33C93_DEBUG > 3 || sasr != WD_DATA)
-               write_log (_T("W %s REG %02X (%d) = %02X (%d) PC=%08X\n"), WD33C93, sasr, sasr, d, d, M68K_GETPC);
+               write_log (_T("W %s REG %02X = %02X (%d) PC=%08X\n"), WD33C93, sasr, d, d, M68K_GETPC);
 #endif
        if (!writeonlyreg (sasr))
                wdregs[sasr] = d;
@@ -573,31 +839,49 @@ void wdscsi_put (uae_u8 d)
                write_log (_T("%s PHASE=%02X\n"), WD33C93, d);
 #endif
        } else if (sasr == WD_DATA) {
+#if WD33C93_DEBUG_PIO
+               write_log (_T("%s WD_DATA WRITE %02x %d/%d,%d\n"), WD33C93, d, wd_dataoffset, scsi->len, scsi->data_len);
+#endif
+               if (!wd_data_avail) {
+                       write_log (_T("%s WD_DATA WRITE without data request!?\n"), WD33C93);
+                       return;
+               }
                if (wd_dataoffset < sizeof wd_data)
                        wd_data[wd_dataoffset] = wdregs[sasr];
                wd_dataoffset++;
-               if (scsi_send_data (SCSIID, wdregs[sasr]))
+               decreasetc ();
+               wd_data_avail = 1;
+               if (scsi_send_data (scsi, wdregs[sasr]) || gettc () == 0) {
+                       wd_data_avail = 0;
                        wd_do_transfer_out ();
+               }
        } else if (sasr == WD_COMMAND) {
+               wd_busy = true;
                switch (d & 0x7f)
                {
                case WD_CMD_RESET:
-                       wd_cmd_reset ();
+                       wd_cmd_reset (true);
+                       break;
+               case WD_CMD_ABORT:
+                       wd_cmd_abort ();
                        break;
+               case WD_CMD_SEL:
+                       wd_cmd_sel (false);
                        break;
                case WD_CMD_SEL_ATN:
-                       wd_cmd_sel_atn ();
+                       wd_cmd_sel (true);
                        break;
                case WD_CMD_SEL_ATN_XFER:
-                       wd_cmd_sel_xfer_atn ();
+                       wd_cmd_sel_xfer (true);
                        break;
                case WD_CMD_SEL_XFER:
-                       wd_cmd_sel_xfer ();
+                       wd_cmd_sel_xfer (false);
                        break;
                case WD_CMD_TRANS_INFO:
                        wd_cmd_trans_info ();
                        break;
                default:
+                       wd_busy = false;
                        write_log (_T("%s unimplemented/unknown command %02X\n"), WD33C93, d);
                        break;
                }
@@ -611,7 +895,7 @@ void wdscsi_sasr (uae_u8 b)
 }
 uae_u8 wdscsi_getauxstatus (void)
 {
-       return (auxstatus & 0x80) | (wd_busy ? 0x20 : 0) | (wd_busy ? 0x01 : 0);
+       return (auxstatus & ASR_INT) | (wd_busy || wd_data_avail < 0 ? ASR_BSY : 0) | (wd_data_avail != 0 ? ASR_DBR : 0);
 }
 
 uae_u8 wdscsi_get (void)
@@ -623,208 +907,240 @@ uae_u8 wdscsi_get (void)
 
        v = wdregs[sasr];
        if (sasr == WD_DATA) {
-               int status = scsi_receive_data (SCSIID, &v);
+               if (!wd_data_avail) {
+                       write_log (_T("%s WD_DATA READ without data request!?\n"), WD33C93);
+                       return 0;
+               }
+               int status = scsi_receive_data (scsi, &v);
+#if WD33C93_DEBUG_PIO
+               write_log (_T("%s WD_DATA READ %02x %d/%d,%d\n"), WD33C93, v, wd_dataoffset, scsi->len, scsi->data_len);
+#endif
                if (wd_dataoffset < sizeof wd_data)
                        wd_data[wd_dataoffset] = v;
                wd_dataoffset++;
+               decreasetc ();
                wdregs[sasr] = v;
-               if (status)
+               wd_data_avail = 1;
+               if (status || gettc () == 0) {
+                       wd_data_avail = 0;
                        wd_do_transfer_in ();
+               }
        } else if (sasr == WD_SCSI_STATUS) {
                uae_int_requested &= ~2;
                auxstatus &= ~0x80;
                cdtv_scsi_clear_int ();
                dmac_istr &= ~ISTR_INTS;
+#if 0
                if (wdregs[WD_COMMAND_PHASE] == 0x10) {
                        wdregs[WD_COMMAND_PHASE] = 0x11;
                        wd_phase = CSR_SRV_REQ | PHS_MESS_OUT;
                        set_status (wd_phase, 1);
                }
+#endif
+       } else if (sasr == WD_AUXILIARY_STATUS) {
+               v = wdscsi_getauxstatus ();
        }
        incsasr (0);
 #if WD33C93_DEBUG > 1
        if (WD33C93_DEBUG > 3 || osasr != WD_DATA)
-               write_log (_T("R %s REG %02X (%d) = %02X (%d) PC=%08X\n"), WD33C93, osasr, osasr, v, v, M68K_GETPC);
+               write_log (_T("R %s REG %02X = %02X (%d) PC=%08X\n"), WD33C93, osasr, v, v, M68K_GETPC);
 #endif
        return v;
 }
 
-static uae_u32 dmac_bget2 (uaecptr addr)
+static uae_u32 dmac_read_word (uaecptr addr)
 {
        uae_u32 v = 0;
 
        if (addr < 0x40)
-               return dmacmemory[addr];
+               return (dmacmemory[addr] << 8) | dmacmemory[addr + 1];
        if (addr >= ROM_OFFSET) {
                if (rom) {
                        int off = addr & rom_mask;
                        if (rombankswitcher && (addr & 0xffe0) == ROM_OFFSET)
                                rombank = (addr & 0x02) >> 1;
                        off += rombank * rom_size;
-                       return rom[off];
+                       return (rom[off] << 8) | rom[off + 1];
                }
                return 0;
        }
 
+       addr &= ~1;
        switch (addr)
        {
-       case 0x41:
+       case 0x40:
                v = dmac_istr;
                if (v)
                        v |= ISTR_INT_P;
                dmac_istr &= ~0xf;
                break;
-       case 0x43:
+       case 0x42:
                v = dmac_cntr;
                break;
        case 0x80:
                if (old_dmac)
-                       v = (dmac_wtc >> 24) & 0xff;
-               break;
-       case 0x81:
-               if (old_dmac)
-                       v = (dmac_wtc >> 16) & 0xff;
+                       v = (dmac_wtc >> 16) & 0xffff;
                break;
        case 0x82:
                if (old_dmac)
-                       v = (dmac_wtc >>  8) & 0xff;
-               break;
-       case 0x83:
-               if (old_dmac)
-                       v = (dmac_wtc >>  0) & 0xff;
-               break;
-       case 0x91:
-               v = wdscsi_getauxstatus ();
-               break;
-       case 0x93:
-               v = wdscsi_get ();
+                       v = dmac_wtc & 0xffff;
                break;
-       case 0xc1:
+       case 0xc0:
                v = 0xf8 | (1 << 0) | (1 << 1) | (1 << 2); // bits 0-2 = dip-switches
                break;
                /* XT IO */
-       case 0xa1:
-       case 0xa3:
-       case 0xa5:
-       case 0xa7:
-       case 0xc3:
-       case 0xc5:
-       case 0xc7:
-               v = 0xff;
+       case 0xa0:
+       case 0xa2:
+       case 0xa4:
+       case 0xa6:
+       case 0xc2:
+       case 0xc4:
+       case 0xc6:
+               v = 0xffff;
                break;
        case 0xe0:
-       case 0xe1:
-               if (!dmac_dma)
+               if (dmac_dma <= 0)
                        dmac_start_dma ();
                break;
        case 0xe2:
-       case 0xe3:
                dmac_stop_dma ();
                break;
        case 0xe4:
-       case 0xe5:
                dmac_cint ();
                break;
        case 0xe8:
-       case 0xe9:
                /* FLUSH (new only) */
-               if (!old_dmac && dmac_dma)
+               if (!old_dmac && dmac_dma > 0)
                        dmac_istr |= ISTR_FE_FLG;
                break;
        }
+#if A2091_DEBUG > 0
+       write_log (_T("dmac_wget %04X=%04X PC=%08X\n"), addr, v, M68K_GETPC);
+#endif
+       return v;
+}
+
+static uae_u32 dmac_read_byte (uaecptr addr)
+{
+       uae_u32 v = 0;
+
+       if (addr < 0x40)
+               return dmacmemory[addr];
+       if (addr >= ROM_OFFSET) {
+               if (rom) {
+                       int off = addr & rom_mask;
+                       if (rombankswitcher && (addr & 0xffe0) == ROM_OFFSET)
+                               rombank = (addr & 0x02) >> 1;
+                       off += rombank * rom_size;
+                       return rom[off];
+               }
+               return 0;
+       }
+
+       switch (addr)
+       {
+       case 0x91:
+               v = wdscsi_getauxstatus ();
+               break;
+       case 0x93:
+               v = wdscsi_get ();
+               break;
+       default:
+               v = dmac_read_word (addr);
+               if (!(addr & 1))
+                       v >>= 8;
+               break;
+       }
 #if A2091_DEBUG > 0
        write_log (_T("dmac_bget %04X=%02X PC=%08X\n"), addr, v, M68K_GETPC);
 #endif
        return v;
 }
 
-static void dmac_bput2 (uaecptr addr, uae_u32 b)
+static void dmac_write_word (uaecptr addr, uae_u32 b)
 {
        if (addr < 0x40)
                return;
        if (addr >= ROM_OFFSET)
                return;
 
+#if A2091_DEBUG > 0
+       write_log (_T("dmac_wput %04X=%04X PC=%08X\n"), addr, b & 65535, M68K_GETPC);
+#endif
+
+       addr &= ~1;
        switch (addr)
        {
-       case 0x43:
+       case 0x42:
                dmac_cntr = b;
                if (dmac_cntr & CNTR_PREST)
                        dmac_reset ();
                break;
        case 0x80:
-               dmac_wtc &= 0x00ffffff;
-               dmac_wtc |= b << 24;
-               break;
-       case 0x81:
-               dmac_wtc &= 0xff00ffff;
+               dmac_wtc &= 0x0000ffff;
                dmac_wtc |= b << 16;
                break;
        case 0x82:
-               dmac_wtc &= 0xffff00ff;
-               dmac_wtc |= b << 8;
-               break;
-       case 0x83:
-               dmac_wtc &= 0xffffff00;
-               dmac_wtc |= b << 0;
+               dmac_wtc &= 0xffff0000;
+               dmac_wtc |= b & 0xffff;
                break;
        case 0x84:
-               dmac_acr &= 0x00ffffff;
-               dmac_acr |= b << 24;
-               break;
-       case 0x85:
-               dmac_acr &= 0xff00ffff;
+               dmac_acr &= 0x0000ffff;
                dmac_acr |= b << 16;
                break;
        case 0x86:
-               dmac_acr &= 0xffff00ff;
-               dmac_acr |= b << 8;
-               break;
-       case 0x87:
-               dmac_acr &= 0xffffff00;
-               dmac_acr |= b << 0;
-               dmac_acr &= ~1;
+               dmac_acr &= 0xffff0000;
+               dmac_acr |= b & 0xfffe;
                if (old_dmac)
                        dmac_acr &= ~3;
                break;
        case 0x8e:
-               dmac_dawr &= 0x00ff;
-               dmac_dawr |= b << 8;
+               dmac_dawr = b;
                break;
-       case 0x8f:
-               dmac_dawr &= 0xff00;
-               dmac_dawr |= b << 0;
-               break;
-       case 0x91:
-               wdscsi_sasr (b);
-               break;
-       case 0x93:
-               wdscsi_put (b);
                break;
        case 0xe0:
-       case 0xe1:
-               if (!dmac_dma)
+               if (dmac_dma <= 0)
                        dmac_start_dma ();
                break;
        case 0xe2:
-       case 0xe3:
                dmac_stop_dma ();
                break;
        case 0xe4:
-       case 0xe5:
                dmac_cint ();
                break;
        case 0xe8:
-       case 0xe9:
                /* FLUSH */
                dmac_istr |= ISTR_FE_FLG;
                break;
        }
+}
+
+static void dmac_write_byte (uaecptr addr, uae_u32 b)
+{
+       if (addr < 0x40)
+               return;
+       if (addr >= ROM_OFFSET)
+               return;
+
 #if A2091_DEBUG > 0
        write_log (_T("dmac_bput %04X=%02X PC=%08X\n"), addr, b & 255, M68K_GETPC);
 #endif
-}
 
+       switch (addr)
+       {
+       case 0x91:
+               wdscsi_sasr (b);
+               break;
+       case 0x93:
+               wdscsi_put (b);
+               break;
+       default:
+               if (addr & 1)
+                       dmac_write_word (addr, b);
+               else
+                       dmac_write_word (addr, b << 8);
+       }
+}
 
 
 static uae_u32 REGPARAM2 dmac_lget (uaecptr addr)
@@ -834,14 +1150,8 @@ static uae_u32 REGPARAM2 dmac_lget (uaecptr addr)
        special_mem |= S_READ;
 #endif
        addr &= 65535;
-       v = dmac_bget2 (addr) << 24;
-       v |= dmac_bget2 (addr + 1) << 16;
-       v |= dmac_bget2 (addr + 2) << 8;
-       v |= dmac_bget2 (addr + 3);
-#if A2091_DEBUG > 0
-       if (addr >= 0x40 && addr < ROM_OFFSET)
-               write_log (_T("dmac_lget %08X=%08X PC=%08X\n"), addr, v, M68K_GETPC);
-#endif
+       v = dmac_read_word (addr) << 16;
+       v |= dmac_read_word (addr + 2) & 0xffff;
        return v;
 }
 
@@ -852,12 +1162,7 @@ static uae_u32 REGPARAM2 dmac_wget (uaecptr addr)
        special_mem |= S_READ;
 #endif
        addr &= 65535;
-       v = dmac_bget2 (addr) << 8;
-       v |= dmac_bget2 (addr + 1);
-#if A2091_DEBUG > 0
-       if (addr >= 0x40 && addr < ROM_OFFSET)
-               write_log (_T("dmac_wget %08X=%04X PC=%08X\n"), addr, v, M68K_GETPC);
-#endif
+       v = dmac_read_word (addr);
        return v;
 }
 
@@ -868,7 +1173,7 @@ static uae_u32 REGPARAM2 dmac_bget (uaecptr addr)
        special_mem |= S_READ;
 #endif
        addr &= 65535;
-       v = dmac_bget2 (addr);
+       v = dmac_read_byte (addr);
        if (!configured)
                return v;
        return v;
@@ -880,14 +1185,8 @@ static void REGPARAM2 dmac_lput (uaecptr addr, uae_u32 l)
        special_mem |= S_WRITE;
 #endif
        addr &= 65535;
-#if A2091_DEBUG > 0
-       if (addr >= 0x40 && addr < ROM_OFFSET)
-               write_log (_T("dmac_lput %08X=%08X PC=%08X\n"), addr, l, M68K_GETPC);
-#endif
-       dmac_bput2 (addr, l >> 24);
-       dmac_bput2 (addr + 1, l >> 16);
-       dmac_bput2 (addr + 2, l >> 8);
-       dmac_bput2 (addr + 3, l);
+       dmac_write_word (addr + 0, l >> 16);
+       dmac_write_word (addr + 2, l);
 }
 
 static void REGPARAM2 dmac_wput (uaecptr addr, uae_u32 w)
@@ -896,12 +1195,7 @@ static void REGPARAM2 dmac_wput (uaecptr addr, uae_u32 w)
        special_mem |= S_WRITE;
 #endif
        addr &= 65535;
-#if A2091_DEBUG > 0
-       if (addr >= 0x40 && addr < ROM_OFFSET)
-               write_log (_T("dmac_wput %04X=%04X PC=%08X\n"), addr, w & 65535, M68K_GETPC);
-#endif
-       dmac_bput2 (addr, w >> 8);
-       dmac_bput2 (addr + 1, w);
+       dmac_write_word (addr, w);
 }
 
 static void REGPARAM2 dmac_bput (uaecptr addr, uae_u32 b)
@@ -926,7 +1220,7 @@ static void REGPARAM2 dmac_bput (uaecptr addr, uae_u32 b)
        }
        if (!configured)
                return;
-       dmac_bput2 (addr, b);
+       dmac_write_byte (addr, b);
 }
 
 static uae_u32 REGPARAM2 dmac_wgeti (uaecptr addr)
@@ -967,92 +1261,96 @@ addrbank dmaca2091_bank = {
        dmac_lget, dmac_wget, dmac_bget,
        dmac_lput, dmac_wput, dmac_bput,
        dmac_xlate, dmac_check, NULL, _T("A2091/A590"),
-       dmac_lgeti, dmac_wgeti, ABFLAG_IO
+       dmac_lgeti, dmac_wgeti, ABFLAG_IO | ABFLAG_SAFE
 };
 
-static void dmacreg_write (uae_u32 *reg, int addr, uae_u32 val, int size)
-{
-       addr = (size - 1) - addr;
-       (*reg) &= ~(0xff << (addr * 8));
-       (*reg) |= (val & 0xff) << (addr * 8);
-}
-static uae_u32 dmacreg_read (uae_u32 val, int addr, int size)
-{
-       addr = (size - 1) - addr;
-       return (val >> (addr * 8)) & 0xff;
-}
-
-static void mbdmac_write (uae_u32 addr, uae_u32 val, int mode)
+static void mbdmac_write_word (uae_u32 addr, uae_u32 val)
 {
        if (currprefs.cs_mbdmac > 1)
                return;
 #if A3000_DEBUG > 1
-       write_log (_T("DMAC_WRITE %08X=%02X PC=%08X\n"), addr, val & 0xff, M68K_GETPC);
+       write_log (_T("DMAC_WWRITE %08X=%04X PC=%08X\n"), addr, val & 0xffff, M68K_GETPC);
 #endif
-       addr &= 0xffff;
+       addr &= 0xfffe;
        switch (addr)
        {
        case 0x02:
-       case 0x03:
-               dmacreg_write (&dmac_dawr, addr - 0x02, val, 2);
+               dmac_dawr = val;
                break;
        case 0x04:
-       case 0x05:
+               dmac_wtc &= 0x0000ffff;
+               dmac_wtc |= val << 16;
+               break;
        case 0x06:
-       case 0x07:
-               dmacreg_write (&dmac_wtc, addr - 0x04, val, 4);
+               dmac_wtc &= 0xffff0000;
+               dmac_wtc |= val & 0xffff;
                break;
        case 0x0a:
-       case 0x0b:
-               dmacreg_write (&dmac_cntr, addr - 0x0a, val, 2);
+               dmac_cntr = val;
                if (dmac_cntr & SCNTR_PREST)
                        dmac_reset ();
                break;
        case 0x0c:
-       case 0x0d:
+               dmac_acr &= 0x0000ffff;
+               dmac_acr |= val << 16;
+               break;
        case 0x0e:
-       case 0x0f:
-               dmacreg_write (&dmac_acr, addr - 0x0c, val, 4);
+               dmac_acr &= 0xffff0000;
+               dmac_acr |= val & 0xfffe;
                break;
        case 0x12:
-       case 0x13:
-               if (!dmac_dma)
+               if (dmac_dma <= 0)
                        dmac_start_dma ();
                break;
        case 0x16:
-       case 0x17:
-               /* FLUSH */
-               dmac_istr |= ISTR_FE_FLG;
+               if (dmac_dma) {
+                       /* FLUSH */
+                       dmac_istr |= ISTR_FE_FLG;
+                       dmac_dma = 0;
+               }
                break;
        case 0x1a:
-       case 0x1b:
                dmac_cint();
                break;
        case 0x1e:
-       case 0x1f:
                /* ISTR */
                break;
        case 0x3e:
-       case 0x3f:
                dmac_stop_dma ();
                break;
+       }
+}
+
+static void mbdmac_write_byte (uae_u32 addr, uae_u32 val)
+{
+       if (currprefs.cs_mbdmac > 1)
+               return;
+#if A3000_DEBUG > 1
+       write_log (_T("DMAC_BWRITE %08X=%02X PC=%08X\n"), addr, val & 0xff, M68K_GETPC);
+#endif
+       addr &= 0xffff;
+       switch (addr)
+       {
+
        case 0x41:
-               if (mode & 0x10)
-                       sasr = val;
+               sasr = val;
                break;
        case 0x49:
                sasr = val;
                break;
        case 0x43:
-               if (mode & 0x10)
-                       wdscsi_put (val);
-               else
-                       sasr = val;
+       case 0x47:
+               wdscsi_put (val);
                break;
+       default:
+               if (addr & 1)
+                       mbdmac_write_word (addr, val);
+               else
+                       mbdmac_write_word (addr, val << 8);
        }
 }
 
-static uae_u32 mbdmac_read (uae_u32 addr, int mode)
+static uae_u32 mbdmac_read_word (uae_u32 addr)
 {
 #if A3000_DEBUG > 1
        uae_u32 vaddr = addr;
@@ -1062,62 +1360,85 @@ static uae_u32 mbdmac_read (uae_u32 addr, int mode)
        if (currprefs.cs_mbdmac > 1)
                return 0;
 
-       addr &= 0xffff;
+       addr &= 0xfffe;
        switch (addr)
        {
        case 0x02:
-       case 0x03:
-               v = dmacreg_read (dmac_dawr, addr - 0x02, 2);
+               v = dmac_dawr;
                break;
        case 0x04:
-       case 0x05:
        case 0x06:
-       case 0x07:
-               v = 0xff;
+               v = 0xffff;
                break;
        case 0x0a:
-       case 0x0b:
-               v = dmacreg_read (dmac_cntr, addr - 0x0a, 2);
+               v = dmac_cntr;
                break;
        case 0x0c:
-       case 0x0d:
+               v = dmac_acr >> 16;
+               break;
        case 0x0e:
-       case 0x0f:
-               v = dmacreg_read (dmac_acr, addr - 0x0c, 4);
+               v = dmac_acr;
                break;
        case 0x12:
-       case 0x13:
-               if (!dmac_dma)
+               if (dmac_dma <= 0)
                        dmac_start_dma ();
                v = 0;
                break;
        case 0x1a:
-       case 0x1b:
                dmac_cint ();
                v = 0;
                break;;
        case 0x1e:
-       case 0x1f:
-               v = dmacreg_read (dmac_istr, addr - 0x1e, 2);
+               v = dmac_istr;
                if (v & ISTR_INTS)
                        v |= ISTR_INT_P;
                dmac_istr &= ~15;
+               if (!dmac_dma)
+                       v |= ISTR_FE_FLG;
                break;
        case 0x3e:
-       case 0x3f:
-               dmac_stop_dma ();
+               if (dmac_dma) {
+                       dmac_stop_dma ();
+                       dmac_istr |= ISTR_FE_FLG;
+               }
                v = 0;
                break;
+       }
+#if A3000_DEBUG > 1
+       write_log (_T("DMAC_WREAD %08X=%04X PC=%X\n"), vaddr, v & 0xffff, M68K_GETPC);
+#endif
+       return v;
+}
+
+static uae_u32 mbdmac_read_byte (uae_u32 addr)
+{
+#if A3000_DEBUG > 1
+       uae_u32 vaddr = addr;
+#endif
+       uae_u32 v = 0xffffffff;
+
+       if (currprefs.cs_mbdmac > 1)
+               return 0;
+
+       addr &= 0xffff;
+       switch (addr)
+       {
        case 0x41:
        case 0x49:
                v = wdscsi_getauxstatus ();
                break;
        case 0x43:
+       case 0x47:
                v = wdscsi_get ();
                break;
+       default:
+               v = mbdmac_read_word (addr);
+               if (!(addr & 1))
+                       v >>= 8;
+               break;
        }
 #if A3000_DEBUG > 1
-       write_log (_T("DMAC_READ %08X=%02X PC=%X\n"), vaddr, v & 0xff, M68K_GETPC);
+       write_log (_T("DMAC_BREAD %08X=%02X PC=%X\n"), vaddr, v & 0xff, M68K_GETPC);
 #endif
        return v;
 }
@@ -1136,10 +1457,8 @@ static uae_u32 REGPARAM2 mbdmac_lget (uaecptr addr)
 #ifdef JIT
        special_mem |= S_READ;
 #endif
-       v =  mbdmac_read (addr, 0x40 | 0) << 24;
-       v |= mbdmac_read (addr + 1, 0x40 | 1) << 16;
-       v |= mbdmac_read (addr + 2, 0x40 | 2) << 8;
-       v |= mbdmac_read (addr + 3, 0x40 | 3);
+       v =  mbdmac_read_word (addr + 0) << 16;
+       v |= mbdmac_read_word (addr + 2) << 0;
        return v;
 }
 static uae_u32 REGPARAM2 mbdmac_wget (uaecptr addr)
@@ -1148,8 +1467,7 @@ static uae_u32 REGPARAM2 mbdmac_wget (uaecptr addr)
 #ifdef JIT
        special_mem |= S_READ;
 #endif
-       v =  mbdmac_read (addr, 0x40 | 0) << 8;
-       v |= mbdmac_read (addr + 1, 0x40 | 1) << 0;
+       v =  mbdmac_read_word (addr);
        return v;
 }
 static uae_u32 REGPARAM2 mbdmac_bget (uaecptr addr)
@@ -1157,39 +1475,41 @@ static uae_u32 REGPARAM2 mbdmac_bget (uaecptr addr)
 #ifdef JIT
        special_mem |= S_READ;
 #endif
-       return mbdmac_read (addr, 0x10);
+       return mbdmac_read_byte (addr);
 }
 static void REGPARAM2 mbdmac_lput (uaecptr addr, uae_u32 l)
 {
 #ifdef JIT
        special_mem |= S_WRITE;
 #endif
-       mbdmac_write (addr + 0, l >> 24, 0x40 | 0);
-       mbdmac_write (addr + 1, l >> 16, 0x40 | 1);
-       mbdmac_write (addr + 2, l >> 8, 0x40 | 2);
-       mbdmac_write (addr + 3, l, 0x40 | 3);
+       if ((addr & 0xffff) == 0x40) {
+               // long write to 0x40 = write byte to SASR
+               mbdmac_write_byte (0x41, l);
+       } else {
+               mbdmac_write_word (addr + 0, l >> 16);
+               mbdmac_write_word (addr + 2, l >> 0);
+       }
 }
 static void REGPARAM2 mbdmac_wput (uaecptr addr, uae_u32 w)
 {
 #ifdef JIT
        special_mem |= S_WRITE;
 #endif
-       mbdmac_write (addr + 0, w >> 8, 0x20 | 0);
-       mbdmac_write (addr + 1, w >> 0, 0x20 | 1);
+       mbdmac_write_word (addr + 0, w);
 }
 static void REGPARAM2 mbdmac_bput (uaecptr addr, uae_u32 b)
 {
 #ifdef JIT
        special_mem |= S_WRITE;
 #endif
-       mbdmac_write (addr, b, 0x10 | 0);
+       mbdmac_write_byte (addr, b);
 }
 
 addrbank mbdmac_a3000_bank = {
        mbdmac_lget, mbdmac_wget, mbdmac_bget,
        mbdmac_lput, mbdmac_wput, mbdmac_bput,
        default_xlate, default_check, NULL, _T("A3000 DMAC"),
-       dummy_lgeti, dummy_wgeti, ABFLAG_IO
+       dummy_lgeti, dummy_wgeti, ABFLAG_IO | ABFLAG_SAFE
 };
 
 static void ew (int addr, uae_u32 value)
@@ -1212,16 +1532,15 @@ static void freescsi (struct scsi_data *sd)
        scsi_free (sd);
 }
 
-int addscsi (int ch, const TCHAR *path, int blocksize, int readonly,
-       const TCHAR *devname, int sectors, int surfaces, int reserved,
-       int bootpri, const TCHAR *filesys, int scsi_level)
+int addscsi (int ch, struct hd_hardfiledata *hfd, struct uaedev_config_info *ci, int scsi_level)
 {
-       struct hd_hardfiledata *hfd;
-
        freescsi (scsis[ch]);
        scsis[ch] = NULL;
-       hfd = xcalloc (struct hd_hardfiledata, 1);
-       if (!hdf_hd_open (hfd, path, blocksize, readonly, devname, 0, sectors, surfaces, reserved, bootpri, filesys, 0, 0, 0))
+       if (!hfd) {
+               hfd = xcalloc (struct hd_hardfiledata, 1);
+               memcpy (&hfd->hfd.ci, ci, sizeof (struct uaedev_config_info));
+       }
+       if (!hdf_hd_open (hfd))
                return 0;
        hfd->ansi_version = scsi_level;
        scsis[ch] = scsi_alloc (ch, hfd);
@@ -1284,16 +1603,15 @@ static void addnativescsi (void)
        }
 }
 
-int a3000_add_scsi_unit (int ch, const TCHAR *path, int blocksize, int readonly,
-       const TCHAR *devname, int sectors, int surfaces, int reserved,
-       int bootpri, const TCHAR *filesys)
+int a3000_add_scsi_unit (int ch, struct uaedev_config_info *ci)
 {
-       return addscsi (ch, path, blocksize, readonly, devname, sectors, surfaces, reserved, bootpri, filesys, 2);
+       return addscsi (ch, NULL, ci, 2);
 }
 
 void a3000scsi_reset (void)
 {
        map_banks (&mbdmac_a3000_bank, 0xDD, 1, 0);
+       wd_cmd_reset (false);
 }
 
 void a3000scsi_free (void)
@@ -1301,11 +1619,9 @@ void a3000scsi_free (void)
        freenativescsi ();
 }
 
-int a2091_add_scsi_unit (int ch, const TCHAR *path, int blocksize, int readonly,
-       const TCHAR *devname, int sectors, int surfaces, int reserved,
-       int bootpri, const TCHAR *filesys)
+int a2091_add_scsi_unit (int ch, struct uaedev_config_info *ci)
 {
-       return addscsi (ch, path, blocksize, readonly, devname, sectors, surfaces, reserved, bootpri, filesys, 1);
+       return addscsi (ch, NULL, ci, 1);
 }
 
 
@@ -1324,6 +1640,7 @@ void a2091_reset (void)
        superdmac = currprefs.cs_mbdmac ? 1 : 0;
        if (currprefs.scsi == 2)
                addnativescsi ();
+       wd_cmd_reset (false);
 }
 
 void a2091_init (void)
@@ -1333,7 +1650,7 @@ void a2091_init (void)
        struct romdata *rd;
 
        configured = 0;
-       memset (dmacmemory, 0xff, 100);
+       memset (dmacmemory, 0xff, sizeof dmacmemory);
        ew (0x00, 0xc0 | 0x01 | 0x10);
        /* A590/A2091 hardware id */
        ew (0x04, old_dmac ? 0x02 : 0x03);
@@ -1349,11 +1666,19 @@ void a2091_init (void)
        ew (0x20, 0x00); /* ser.no. Byte 2 */
        ew (0x24, 0x00); /* ser.no. Byte 3 */
 
-       roms[0] = 55;
-       roms[1] = 54;
-       roms[2] = 53;
-       roms[3] = 56;
+#if 1
+       roms[0] = 55; // 7.0
+       roms[1] = 54; // 6.6
+       roms[2] = 53; // 6.0
+       roms[3] = -1; //roms[3] = 56; // guru
+       roms[4] = -1;
+#else
+       roms[0] = 56; // guru
+       roms[1] = 55; // 7.0
+       roms[2] = 54; // 6.6
+       roms[3] = 53; // 6.0
        roms[4] = -1;
+#endif
 
        rombankswitcher = 0;
        rombank = 0;
@@ -1367,12 +1692,18 @@ void a2091_init (void)
                        write_log (_T("A590/A2091 BOOT ROM %d.%d\n"), rd->ver, rd->rev);
                        rom_size = rd->size;
                        rom = xmalloc (uae_u8, slotsize);
-                       if (rl->rd->id == 56)
-                               rombankswitcher = 1;
                        zfile_fread (rom, rom_size, 1, z);
                        zfile_fclose (z);
-                       for (int i = 1; i < slotsize / rom_size; i++)
-                               memcpy (rom + i * rom_size, rom, rom_size);
+                       if (rl->rd->id == 56) {
+                               rombankswitcher = 1;
+                               for (int i = rom_size - 1; i >= 0; i--) {
+                                       rom[i * 2 + 0] = rom[i];
+                                       rom[i * 2 + 1] = 0xff;
+                               }
+                       } else {
+                               for (int i = 1; i < slotsize / rom_size; i++)
+                                       memcpy (rom + i * rom_size, rom, rom_size);
+                       }
                        rom_mask = rom_size - 1;
                }
        } else {
@@ -1380,3 +1711,110 @@ void a2091_init (void)
        }
        map_banks (&dmaca2091_bank, 0xe80000 >> 16, 0x10000 >> 16, 0x10000);
 }
+
+uae_u8 *save_scsi_dmac (int *len, uae_u8 *dstptr)
+{
+       uae_u8 *dstbak, *dst;
+       
+       if (!currprefs.cs_a2091 && !currprefs.cs_mbdmac)
+               return NULL;
+       if (dstptr)
+               dstbak = dst = dstptr;
+       else
+               dstbak = dst = xmalloc (uae_u8, 1000);
+
+       // model (0=original,1=rev2,2=superdmac)
+       save_u32 (currprefs.cs_mbdmac ? 2 : 1);
+       save_u32 (0); // reserved flags
+       save_u8 (dmac_istr);
+       save_u8 (dmac_cntr);
+       save_u32 (dmac_wtc);
+       save_u32 (dmac_acr);
+       save_u16 (dmac_dawr);
+       save_u32 (dmac_dma ? 1 : 0);
+       save_u8 (configured);
+       *len = dst - dstbak;
+       return dstbak;
+}
+
+uae_u8 *restore_scsi_dmac (uae_u8 *src)
+{
+       restore_u32 ();
+       restore_u32 ();
+       dmac_istr = restore_u8 ();
+       dmac_cntr = restore_u8 ();
+       dmac_wtc = restore_u32 ();
+       dmac_acr = restore_u32 ();
+       dmac_dawr = restore_u16 ();
+       restore_u32 ();
+       configured = restore_u8 ();
+       return src;
+}
+
+uae_u8 *save_scsi_hd (int num, int *len, uae_u8 *dstptr)
+{
+       uae_u8 *dstbak, *dst;
+       struct scsi_data *s;
+
+       if (!scsis[num])
+               return NULL;
+       s = scsis[num];
+       if (dstptr)
+               dstbak = dst = dstptr;
+       else
+               dstbak = dst = xmalloc (uae_u8, 1000);
+       save_u32 (num);
+       save_u32 (0); // flags
+       save_u64 (s->hfd->size);
+       save_string (s->hfd->hfd.ci.rootdir);
+       save_u32 (s->hfd->hfd.ci.blocksize);
+       save_u32 (s->hfd->hfd.ci.readonly);
+       save_u32 (s->hfd->cyls);
+       save_u32 (s->hfd->heads);
+       save_u32 (s->hfd->secspertrack);
+       save_u64 (s->hfd->hfd.virtual_size);
+       save_u32 (s->hfd->hfd.ci.sectors);
+       save_u32 (s->hfd->hfd.ci.surfaces);
+       save_u32 (s->hfd->hfd.ci.reserved);
+       save_u32 (s->hfd->hfd.ci.bootpri);
+       save_u32 (s->hfd->ansi_version);
+       *len = dst - dstbak;
+       return dstbak;
+}
+
+uae_u8 *restore_scsi_hd (uae_u8 *src)
+{
+       int num;
+       struct hd_hardfiledata *hfd;
+       struct scsi_data *s;
+       uae_u64 size;
+       int blocksize, readonly;
+       TCHAR *path;
+
+       num = restore_u32 ();
+
+       hfd = xcalloc (struct hd_hardfiledata, 1);
+       s = scsis[num] = scsi_alloc (num, hfd);
+       restore_u32 ();
+       size = restore_u64 ();
+       path = restore_string ();
+       _tcscpy (s->hfd->hfd.ci.rootdir, path);
+       blocksize = restore_u32 ();
+       readonly = restore_u32 ();
+       s->hfd->cyls = restore_u32 ();
+       s->hfd->heads = restore_u32 ();
+       s->hfd->secspertrack = restore_u32 ();
+       s->hfd->hfd.virtual_size = restore_u64 ();
+       s->hfd->hfd.ci.sectors = restore_u32 ();
+       s->hfd->hfd.ci.surfaces = restore_u32 ();
+       s->hfd->hfd.ci.reserved = restore_u32 ();
+       s->hfd->hfd.ci.bootpri = restore_u32 ();
+       s->hfd->ansi_version = restore_u32 ();
+
+       if (size) {
+               addscsi (num, hfd, NULL, s->hfd->ansi_version);
+       }
+       xfree (path);
+       return src;
+
+}
index 0a5ba7804e26daf8a6c6a253c75929dce895f834..0b156474b48eeb7dd2aac17ea8083d5011ca61e5 100644 (file)
--- a/amax.cpp
+++ b/amax.cpp
@@ -14,7 +14,7 @@ static int addr_scramble[16] = { 14, 12, 2, 10, 15, 13, 1, 0, 7, 6, 5, 4, 8, 9,
 
 static int romptr;
 static uae_u8 *rom;
-static int rom_size, rom_oddeven;
+static int amax_rom_size, rom_oddeven;
 static uae_u8 data;
 static uae_u8 bfd100, bfe001;
 static uae_u8 dselect;
@@ -73,7 +73,7 @@ void amax_diskwrite (uae_u16 w)
                dwlastbit = (w & 0x8000) ? 1 : 0;
                w <<= 1;
        }
-       romptr &= rom_size - 1;
+       romptr &= amax_rom_size - 1;
        amax_check ();
 }
 
@@ -145,12 +145,12 @@ void amax_init (void)
                return;
        }
        zfile_fseek (z, 0, SEEK_END);
-       rom_size = zfile_ftell (z);
+       amax_rom_size = zfile_ftell (z);
        zfile_fseek (z, 0, SEEK_SET);
-       rom = xmalloc (uae_u8, rom_size);
-       zfile_fread (rom, rom_size, 1, z);
+       rom = xmalloc (uae_u8, amax_rom_size);
+       zfile_fread (rom, amax_rom_size, 1, z);
        zfile_fclose (z);
-       write_log (_T("AMAX: '%s' loaded, %d bytes\n"), currprefs.amaxromfile, rom_size);
+       write_log (_T("AMAX: '%s' loaded, %d bytes\n"), currprefs.amaxromfile, amax_rom_size);
        dselect = 0x20;
 }
 
index c86c7a028815a9ab5309d2d43ad4bba21ab63cfa..c8a77a588fff8ee621d9560016022ab9580b7ee7 100644 (file)
@@ -4,8 +4,6 @@
    Read unzip.h for more info
 */
 
-#define ZLIB_WINAPI
-
 #include "sysconfig.h"
 #include "sysdeps.h"
 
index 20c7dbfec6b1483f3155fa04837e64e6229a2995..d5275cc0e13fcb6eb1a5180381956b447fb19e2d 100644 (file)
@@ -1436,7 +1436,10 @@ static void do_blitter2 (int hpos, int copper)
        blit_waitcyclecounter = 0;
 
        if (currprefs.immediate_blits) {
-               blitter_doit ();
+               if (dmaen (DMA_BLITTER)) {
+                       blitter_doit ();
+                       return;
+               }
                return;
        }
        
@@ -1453,6 +1456,16 @@ static void do_blitter2 (int hpos, int copper)
        }
 }
 
+void blitter_check_start (void)
+{
+       if (bltstate != BLT_init)
+               return;
+       bltstate = BLT_work;
+       if (currprefs.immediate_blits) {
+               blitter_doit ();
+       }
+}
+
 void do_blitter (int hpos, int copper)
 {
        if (bltstate == BLT_done || !currprefs.blitter_cycle_exact) {
index 5ab22361b724c96ae37a511a25893bfc68f53534..23c527a27129d1554b8378f2014d297291a1c7ce 100644 (file)
@@ -4,10 +4,11 @@
 * CD image file support
 *
 * - iso (2048/2352 block size)
-* - cue/bin, cue/bin/wav, cue/bin/mp3
+* - cue/bin, cue/bin/wav, cue/bin/mp3, cue/bin/flac
 * - ccd/img and ccd/img/sub
+* - chd cd
 *
-* Copyright 2010 Toni Wilen
+* Copyright 2010-2013 Toni Wilen
 *
 */
 #include "sysconfig.h"
 #define FLAC__NO_DLL
 #include "FLAC/stream_decoder.h"
 
+#include "archivers/chd/chdtypes.h"
+#include "archivers/chd/chd.h"
+#include "archivers/chd/chdcd.h"
+
 #define scsi_log write_log
 
 #define CDDA_BUFFERS 12
 
-enum audenc { AUDENC_NONE, AUDENC_PCM, AUDENC_MP3, AUDENC_FLAC };
+enum audenc { AUDENC_NONE, AUDENC_PCM, AUDENC_MP3, AUDENC_FLAC, ENC_CHD };
 
 struct cdtoc
 {
@@ -49,6 +54,7 @@ struct cdtoc
 
        uae_s64 filesize;
        TCHAR *fname;
+       TCHAR *extrainfo;
        int address;
        uae_u8 adr, ctrl;
        int track;
@@ -57,6 +63,7 @@ struct cdtoc
        audenc enctype;
        int writeoffset;
        int subcode;
+       const cdrom_track_info *chdtrack;
 };
 
 struct cdunit {
@@ -83,6 +90,8 @@ struct cdunit {
        TCHAR newfile[MAX_DPATH];
        uae_sem_t sub_sem;
        struct device_info di;
+       chd_file *chd_f;
+       cdrom_file *chd_cdf;
 };
 
 static struct cdunit cdunits[MAX_TOTAL_SCSI_DEVICES];
@@ -124,6 +133,18 @@ static struct cdtoc *findtoc (struct cdunit *cdu, int *sectorp)
        return NULL;
 }
 
+static int do_read (struct cdunit *cdu, struct cdtoc *t, uae_u8 *data, int sector, int offset, int size)
+{
+       if (t->enctype == ENC_CHD) {
+               return read_partial_sector(cdu->chd_cdf, data, sector + t->offset, 0, offset, size) == CHDERR_NONE;
+       } else if (t->handle) {
+               int ssize = t->size + t->skipsize;
+               zfile_fseek (t->handle, t->offset + (uae_u64)sector * ssize + offset, SEEK_SET);
+               return zfile_fread (data, 1, size, t->handle) == size;
+       }
+       return 0;
+}
+
 // WOHOO, library that supports virtual file access functions. Perfect!
 static void flac_metadata_callback (const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
 {
@@ -243,7 +264,12 @@ static int getsub_deinterleaved (uae_u8 *dst, struct cdunit *cdu, struct cdtoc *
        int ret = 0;
        uae_sem_wait (&cdu->sub_sem);
        if (t->subcode) {
-               if (t->subhandle) {
+               if (t->enctype == ENC_CHD) {
+                       const cdrom_track_info *cti = t->chdtrack;
+                       ret = do_read (cdu, t, dst, sector, cti->datasize, cti->subsize);
+                       if (ret)
+                               ret = t->subcode;
+               } else if (t->subhandle) {
                        int offset = 0;
                        int totalsize = SUB_CHANNEL_SIZE;
                        if (t->skipsize) {
@@ -471,15 +497,25 @@ static void *cdda_play_func (void *v)
 
                                t = findtoc (cdu, &sector);
                                if (t) {
-                                       if (t->handle && !(t->ctrl & 4)) {
-                                               int totalsize = t->size + t->skipsize;
-                                               if ((t->enctype == AUDENC_MP3 || t->enctype == AUDENC_FLAC) && t->data) {
-                                                       if (t->filesize >= sector * totalsize + t->offset + t->size)
-                                                               memcpy (dst, t->data + sector * totalsize + t->offset, t->size);
-                                               } else if (t->enctype == AUDENC_PCM) {
-                                                       if (sector * totalsize + t->offset + totalsize < t->filesize) {
-                                                               zfile_fseek (t->handle, (uae_u64)sector * totalsize + t->offset, SEEK_SET);
-                                                               zfile_fread (dst, t->size, 1, t->handle);
+                                       if (!(t->ctrl & 4)) {
+                                               if (t->enctype == ENC_CHD) {
+                                                       do_read (cdu, t, dst, sector, 0, t->size);
+                                                       for (int i = 0; i < 2352; i+=2) {
+                                                               uae_u8 p;
+                                                               p = dst[i + 0];
+                                                               dst[i + 0] = dst[i + 1];
+                                                               dst[i +1] = p;
+                                                       }
+                                               } else if (t->handle) {
+                                                       int totalsize = t->size + t->skipsize;
+                                                       if ((t->enctype == AUDENC_MP3 || t->enctype == AUDENC_FLAC) && t->data) {
+                                                               if (t->filesize >= sector * totalsize + t->offset + t->size)
+                                                                       memcpy (dst, t->data + sector * totalsize + t->offset, t->size);
+                                                       } else if (t->enctype == AUDENC_PCM) {
+                                                               if (sector * totalsize + t->offset + totalsize < t->filesize) {
+                                                                       zfile_fseek (t->handle, (uae_u64)sector * totalsize + t->offset, SEEK_SET);
+                                                                       zfile_fread (dst, t->size, 1, t->handle);
+                                                               }
                                                        }
                                                }
                                        }
@@ -679,7 +715,7 @@ static int command_rawread (int unitnum, uae_u8 *data, int sector, int size, int
        struct cdtoc *t = findtoc (cdu, &sector);
        int ssize = t->size + t->skipsize;
 
-       if (!t || t->handle == NULL)
+       if (!t)
                goto end;
 
        cdda_stop (cdu);
@@ -688,8 +724,7 @@ static int command_rawread (int unitnum, uae_u8 *data, int sector, int size, int
                        // 2048 -> 2352
                        while (size-- > 0) {
                                memset (data, 0, 16);
-                               zfile_fseek (t->handle, t->offset + (uae_u64)sector * ssize, SEEK_SET);
-                               zfile_fread (data + 16, t->size, 1, t->handle);
+                               do_read (cdu, t, data + 16, sector, 0, 2048);
                                encode_l2 (data, sector + 150);
                                sector++;
                                asector++;
@@ -700,11 +735,8 @@ static int command_rawread (int unitnum, uae_u8 *data, int sector, int size, int
                        // 2352 -> 2048
                        while (size-- > 0) {
                                uae_u8 b = 0;
-                               zfile_fseek (t->handle, t->offset + (uae_u64)sector * ssize + 15, SEEK_SET);
-                               zfile_fread (&b, 1, 1, t->handle);
-                               if (b == 2) // MODE2?
-                                       zfile_fseek (t->handle, t->offset + (uae_u64)sector * ssize + 24, SEEK_SET);
-                               zfile_fread (data, sectorsize, 1, t->handle);
+                               do_read (cdu, t, &b, sector, 15, 1);
+                               do_read (cdu, t, data, sector, b == 2 ? 24 : 16, sectorsize);
                                sector++;
                                asector++;
                                data += sectorsize;
@@ -714,11 +746,10 @@ static int command_rawread (int unitnum, uae_u8 *data, int sector, int size, int
                        // 2352 -> 2336
                        while (size-- > 0) {
                                uae_u8 b = 0;
-                               zfile_fseek (t->handle, t->offset + (uae_u64)sector * ssize + 15, SEEK_SET);
-                               zfile_fread (&b, 1, 1, t->handle);
+                               do_read (cdu, t, &b, sector, 15, 1);
                                if (b != 2 && b != 0) // MODE0 or MODE2 only allowed
-                                       return 0; 
-                               zfile_fread (data, sectorsize, 1, t->handle);
+                                       return 0;
+                               do_read (cdu, t, data, sector, 16, sectorsize);
                                sector++;
                                asector++;
                                data += sectorsize;
@@ -726,11 +757,13 @@ static int command_rawread (int unitnum, uae_u8 *data, int sector, int size, int
                        }
                } else if (sectorsize == t->size) {
                        // no change
-                       zfile_fseek (t->handle, t->offset + (uae_u64)sector * ssize, SEEK_SET);
-                       zfile_fread (data, sectorsize, size, t->handle);
-                       sector += size;
-                       asector += size;
-                       ret = size;
+                       while (size -- > 0) {
+                               do_read (cdu, t, data, sector, 0, sectorsize);
+                               sector++;
+                               asector++;
+                               data += sectorsize;
+                               ret++;
+                       }
                }
                cdu->cd_last_pos = asector;
 
@@ -759,8 +792,7 @@ static int command_rawread (int unitnum, uae_u8 *data, int sector, int size, int
                                goto end;
                        }
                        for (int i = 0; i < size; i++) {
-                               zfile_fseek (t->handle, t->offset + (uae_u64)sector * ssize, SEEK_SET);
-                               zfile_fread (data, t->size, 1, t->handle);
+                               do_read (cdu, t, data, sector, 0, t->size);
                                uae_u8 *p = data + t->size;
                                if (subs) {
                                        uae_u8 subdata[SUB_CHANNEL_SIZE];
@@ -787,34 +819,31 @@ end:
 }
 
 // this only supports 2048 byte sectors
-static int command_read (int unitnum, uae_u8 *data, int sector, int size)
+static int command_read (int unitnum, uae_u8 *data, int sector, int numsectors)
 {
        struct cdunit *cdu = unitisopen (unitnum);
        if (!cdu)
                return 0;
-
        struct cdtoc *t = findtoc (cdu, &sector);
-       int ssize = t->size + t->skipsize;
-
-       if (!t || t->handle == NULL)
+       if (!t)
                return 0;
        cdda_stop (cdu);
        if (t->size == 2048) {
-               zfile_fseek (t->handle, t->offset + (uae_u64)sector * ssize, SEEK_SET);
-               zfile_fread (data, size, 2048, t->handle);
-               sector += size;
+               while (numsectors-- > 0) {
+                       do_read (cdu, t, data, sector, 0, 2048);
+                       data += 2048;
+                       sector++;
+               }
        } else {
-               while (size-- > 0) {
+               while (numsectors-- > 0) {
                        if (t->size == 2352) {
                                uae_u8 b = 0;
-                               zfile_fseek (t->handle, t->offset + (uae_u64)sector * ssize + 15, SEEK_SET);
-                               zfile_fread (&b, 1, 1, t->handle);
-                               if (b == 2) // MODE2?
-                                       zfile_fseek (t->handle, t->offset + (uae_u64)sector * ssize + 24, SEEK_SET);
+                               do_read (cdu, t, &b, sector, 15, 1);
+                               // 2 = MODE2
+                               do_read (cdu, t, data, sector, b == 2 ? 24 : 16, 2048);
                        } else {
-                               zfile_fseek (t->handle, t->offset + (uae_u64)sector * ssize + 16, SEEK_SET);
+                               do_read (cdu, t, data, sector, 16, 2048);
                        }
-                       zfile_fread (data, 1, 2048, t->handle);
                        data += 2048;
                        sector++;
                }
@@ -1098,6 +1127,94 @@ end:
        return cdu->tracks;
 }
 
+static int parsechd (struct cdunit *cdu, struct zfile *zcue, const TCHAR *img)
+{
+       chd_error err;
+       struct cdrom_file *cdf;
+       struct zfile *f = zfile_dup (zcue);
+       if (!f)
+               return 0;
+       chd_file *cf = new chd_file();
+       err = cf->open(f, false, NULL);
+       if (err != CHDERR_NONE) {
+               write_log (_T("CHD '%s' err=%d\n"), zfile_getname (zcue), err);
+               zfile_fclose (f);
+               return 0;
+       }
+       if (!(cdf = cdrom_open (cf))) {
+               write_log (_T("Couldn't open CHD '%s' as CD\n"), zfile_getname (zcue));
+               cf->close ();
+               zfile_fclose (f);
+               return 0;
+       }
+       cdu->chd_f = cf;
+       cdu->chd_cdf = cdf;
+       
+       const cdrom_toc *stoc = cdrom_get_toc (cdf);
+       cdu->tracks = stoc->numtrks;
+       uae_u32 hunkcnt = cf->hunk_count ();
+       uae_u32 hunksize = cf->hunk_bytes ();
+       uae_u32 cbytes;
+       chd_codec_type compr;
+
+       for (int i = 0; i <cdu->tracks; i++) {
+               int size;
+               const cdrom_track_info *strack = &stoc->tracks[i];
+               struct cdtoc *dtrack = &cdu->toc[i];
+               dtrack->address = strack->physframeofs;
+               dtrack->offset = strack->chdframeofs;
+               dtrack->adr = cdrom_get_adr_control (cdf, i) >> 4;
+               dtrack->ctrl = cdrom_get_adr_control (cdf, i) & 15;
+               switch (strack->trktype)
+               {
+                       case CD_TRACK_MODE1:
+                       case CD_TRACK_MODE2_FORM1:
+                               size = 2048;
+                       break;
+                       case CD_TRACK_MODE1_RAW:
+                       case CD_TRACK_MODE2_RAW:
+                       case CD_TRACK_AUDIO:
+                       default:
+                               size = 2352;
+                       break;
+                       case CD_TRACK_MODE2:
+                       case CD_TRACK_MODE2_FORM_MIX:
+                               size = 2336;
+                       break;
+                       case CD_TRACK_MODE2_FORM2:
+                               size = 2324;
+                       break;
+               }
+               dtrack->suboffset = size;
+               dtrack->subcode = strack->subtype == CD_SUB_NONE ? 0 : strack->subtype == CD_SUB_RAW ? 1 : 2;
+               dtrack->chdtrack = strack;
+               dtrack->size = size;
+               dtrack->enctype = ENC_CHD;
+               dtrack->fname = my_strdup (zfile_getname (zcue));
+               dtrack->filesize = cf->logical_bytes ();
+               dtrack->track = i + 1;
+               dtrack[1].address = dtrack->address + strack->frames;
+               if (cf->hunk_info(dtrack->offset * CD_FRAME_SIZE / hunksize, compr, cbytes) == CHDERR_NONE) {
+                       TCHAR tmp[100];
+                       uae_u32 c = (uae_u32)compr;
+                       for (int j = 0; j < 4; j++) {
+                               uae_u8 b = c >> ((3 - j) * 8);
+                               if (c < 10) {
+                                       b += '0';
+                               }
+                               if (b < ' ' || b >= 127)
+                                               b = '.';
+                               tmp[j] = b;
+                       }
+                       tmp[4] = 0;
+                       dtrack->extrainfo = my_strdup (tmp);
+               }
+
+       }
+       return cdu->tracks;
+}
+
+
 static int parseccd (struct cdunit *cdu, struct zfile *zcue, const TCHAR *img)
 {
        int mode;
@@ -1503,6 +1620,8 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img)
                        parseccd (cdu, zcue, img);
                else if (!_tcsicmp (ext, _T("mds")))
                        parsemds (cdu, zcue, img);
+               else if (!_tcsicmp (ext, _T("chd")))
+                       parsechd (cdu, zcue, img);
 
                if (oldcurdir[0])
                        my_setcurrentdir (oldcurdir, NULL);
@@ -1518,6 +1637,7 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img)
                        t->handle = zcue;
                        t->size = (siz % 2048) == 0 ? 2048 : 2352;
                        t->filesize = siz;
+                       t->track = 1;
                        write_log (_T("CD: plain CD image mounted!\n"));
                        cdu->toc[1].address = t->address + (int)(t->filesize / t->size);
                        zcue = NULL;
@@ -1536,9 +1656,13 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img)
                        write_log (_T("    "));
                write_log (_T("%7d %02d:%02d:%02d"),
                        t->address, (msf >> 16) & 0xff, (msf >> 8) & 0xff, (msf >> 0) & 0xff);
-               if (i < cdu->tracks)
-                       write_log (_T(" %s %x %10lld %10lld %s"), (t->ctrl & 4) ? _T("DATA    ") : (t->subcode ? _T("CDA+SUB") : _T("CDA     ")),
-                               t->ctrl, t->offset, t->filesize, t->handle == NULL ? _T("[FILE ERROR]") : _T(""));
+               if (i < cdu->tracks) {
+                       write_log (_T(" %s %x %10lld %10lld %s%s"),
+                               (t->ctrl & 4) ? _T("DATA    ") : (t->subcode ? _T("CDA+SUB") : _T("CDA     ")),
+                               t->ctrl, t->offset, t->filesize,
+                               t->extrainfo ? t->extrainfo : _T(""),
+                               t->handle == NULL && t->enctype != ENC_CHD ? _T("[FILE ERROR]") : _T(""));
+               }
                write_log (_T("\n"));
                if (i < cdu->tracks)
                        write_log (_T(" - %s\n"), t->fname);
@@ -1610,7 +1734,11 @@ static void unload_image (struct cdunit *cdu)
                xfree (t->fname);
                xfree (t->data);
                xfree (t->subdata);
+               xfree (t->extrainfo);
        }
+       cdrom_close (cdu->chd_cdf);
+       if (cdu->chd_f)
+               cdu->chd_f->close();
        memset (cdu->toc, 0, sizeof cdu->toc);
        cdu->tracks = 0;
        cdu->cdsize = 0;
index dd1b33c768fed07f8cdba59714b7d40d35fcf0af..d7230c3c2af7ede53723d62d7f30b07c4184db9e 100644 (file)
@@ -64,7 +64,7 @@
 
 static int fmv_mask;
 static uae_u8 *rom;
-static int rom_size = 262144;
+static int fmv_rom_size = 262144;
 static uaecptr fmv_start = 0x00200000;
 static int fmv_size = 1048576;
 
@@ -328,7 +328,7 @@ static uae_u32 REGPARAM2 fmv_wgeti (uaecptr addr)
        addr -= fmv_start & fmv_mask;
        addr &= fmv_mask;
        m = rom + addr;
-       if (addr < rom_size)
+       if (addr < fmv_rom_size)
                return do_get_mem_word ((uae_u16 *)m);
 #ifdef FMV_DEBUG
        write_log (_T("fmv_wgeti %08X %08X PC=%08X\n"), addr, v, M68K_GETPC);
@@ -346,7 +346,7 @@ static uae_u32 REGPARAM2 fmv_lgeti (uaecptr addr)
        addr -= fmv_start & fmv_mask;
        addr &= fmv_mask;
        m = rom + addr;
-       if (addr < rom_size)
+       if (addr < fmv_rom_size)
                return do_get_mem_long ((uae_u32 *)m);
 #ifdef FMV_DEBUG
        write_log (_T("fmv_lgeti %08X %08X PC=%08X\n"), addr, v, M68K_GETPC);
index 07840360cc6064ceeef79411c6360732081477d1..d8254914dd26a2d1ac81968392cae001bd911215 100644 (file)
--- a/cdtv.cpp
+++ b/cdtv.cpp
@@ -1656,11 +1656,9 @@ uae_u8 cdtv_battram_read (int addr)
        return v;
 }
 
-int cdtv_add_scsi_unit(int ch, TCHAR *path, int blocksize, int readonly,
-       TCHAR *devname, int sectors, int surfaces, int reserved,
-       int bootpri, TCHAR *filesys)
+int cdtv_add_scsi_unit (int ch, struct uaedev_config_info *ci)
 {
-       return addscsi (ch, path, blocksize, readonly, devname, sectors, surfaces, reserved, bootpri, filesys, 1);
+       return addscsi (ch, NULL, ci, 1);
 }
 
 void cdtv_free (void)
@@ -1772,7 +1770,7 @@ void cdtv_check_banks (void)
 
 #ifdef SAVESTATE
 
-uae_u8 *save_dmac (int *len, uae_u8 *dstptr)
+uae_u8 *save_cdtv_dmac (int *len, uae_u8 *dstptr)
 {
        uae_u8 *dstbak, *dst;
        
@@ -1798,7 +1796,7 @@ uae_u8 *save_dmac (int *len, uae_u8 *dstptr)
 
 }
 
-uae_u8 *restore_dmac (uae_u8 *src)
+uae_u8 *restore_cdtv_dmac (uae_u8 *src)
 {
        restore_u32 ();
        restore_u32 ();
index f43250609297c3690404c9f01fba0dfa739687d5..09e4acea39ade732258a6b0032753421a6bd95e5 100644 (file)
@@ -152,7 +152,7 @@ static const TCHAR *filtermode2[] = { _T("1x"), _T("2x"), _T("3x"), _T("4x"), 0
 #endif
 static const TCHAR *cartsmode[] = { _T("none"), _T("hrtmon"), 0 };
 static const TCHAR *idemode[] = { _T("none"), _T("a600/a1200"), _T("a4000"), 0 };
-static const TCHAR *rtctype[] = { _T("none"), _T("MSM6242B"), _T("RP5C01A"), 0 };
+static const TCHAR *rtctype[] = { _T("none"), _T("MSM6242B"), _T("RP5C01A"), _T("MSM6242B_A2000"), 0 };
 static const TCHAR *ciaatodmode[] = { _T("vblank"), _T("50hz"), _T("60hz"), 0 };
 static const TCHAR *ksmirrortype[] = { _T("none"), _T("e0"), _T("a8+e0"), 0 };
 static const TCHAR *cscompa[] = {
@@ -170,7 +170,7 @@ static const TCHAR *maxvert[] = { _T("nointerlace"), _T("interlace"), 0 };
 static const TCHAR *abspointers[] = { _T("none"), _T("mousehack"), _T("tablet"), 0 };
 static const TCHAR *magiccursors[] = { _T("both"), _T("native"), _T("host"), 0 };
 static const TCHAR *autoscale[] = { _T("none"), _T("auto"), _T("standard"), _T("max"), _T("scale"), _T("resize"), _T("center"), _T("manual"), _T("integer"), _T("integer_auto"), 0 };
-static const TCHAR *joyportmodes[] = { _T(""), _T("mouse"), _T("djoy"), _T("gamepad"), _T("ajoy"), _T("cdtvjoy"), _T("cd32joy"), _T("lightpen"), 0 };
+static const TCHAR *joyportmodes[] = { _T(""), _T("mouse"), _T("mousenowheel"), _T("djoy"), _T("gamepad"), _T("ajoy"), _T("cdtvjoy"), _T("cd32joy"), _T("lightpen"), 0 };
 static const TCHAR *joyaf[] = { _T("none"), _T("normal"), _T("toggle"), 0 };
 static const TCHAR *epsonprinter[] = { _T("none"), _T("ascii"), _T("epson_matrix_9pin"), _T("epson_matrix_24pin"), _T("epson_matrix_48pin"), 0 };
 static const TCHAR *aspects[] = { _T("none"), _T("vga"), _T("tv"), 0 };
@@ -202,6 +202,12 @@ static const TCHAR *obsolete[] = {
        _T("serial_hardware_dtrdsr"), _T("gfx_filter_upscale"),
        _T("gfx_correct_aspect"), _T("gfx_autoscale"), _T("parallel_sampler"), _T("parallel_ascii_emulation"),
        _T("avoid_vid"), _T("avoid_dga"), _T("z3chipmem_size"), _T("state_replay_buffer"), _T("state_replay"),
+       
+       _T("gfx_filter_vert_zoom"),_T("gfx_filter_horiz_zoom"),
+       _T("gfx_filter_vert_zoom_mult"), _T("gfx_filter_horiz_zoom_mult"),
+       _T("gfx_filter_vert_offset"), _T("gfx_filter_horiz_offset"),
+       _T("rtg_vert_zoom_multf"), _T("rtg_horiz_zoom_multf"),
+       
        NULL
 };
 
@@ -517,18 +523,19 @@ static void write_filesys_config (struct uae_prefs *p, struct zfile *f)
                _T("scsram"), _T("scide") }; /* scsram = smart card sram = pcmcia sram card */
 
        for (i = 0; i < p->mountitems; i++) {
-               struct uaedev_config_info *uci = &p->mountconfig[i];
+               struct uaedev_config_data *uci = &p->mountconfig[i];
+               struct uaedev_config_info *ci = &uci->ci;
                TCHAR *str;
-               int bp = uci->bootpri;
+               int bp = ci->bootpri;
 
-               if (!uci->autoboot)
+               if (!ci->autoboot)
                        bp = -128;
-               if (uci->donotmount)
+               if (ci->donotmount)
                        bp = -129;
-               str = cfgfile_put_multipath (&p->path_hardfile, uci->rootdir);
+               str = cfgfile_put_multipath (&p->path_hardfile, ci->rootdir);
                if (!uci->ishdf) {
-                       _stprintf (tmp, _T("%s,%s:%s:%s,%d"), uci->readonly ? _T("ro") : _T("rw"),
-                               uci->devname ? uci->devname : _T(""), uci->volname, str, bp);
+                       _stprintf (tmp, _T("%s,%s:%s:%s,%d"), ci->readonly ? _T("ro") : _T("rw"),
+                               ci->devname ? ci->devname : _T(""), ci->volname, str, bp);
                        cfgfile_write_str (f, _T("filesystem2"), tmp);
 #if 0
                        _stprintf (tmp2, _T("filesystem=%s,%s:%s"), uci->readonly ? _T("ro") : _T("rw"),
@@ -537,13 +544,17 @@ static void write_filesys_config (struct uae_prefs *p, struct zfile *f)
 #endif
                } else {
                        _stprintf (tmp, _T("%s,%s:%s,%d,%d,%d,%d,%d,%s,%s"),
-                               uci->readonly ? _T("ro") : _T("rw"),
-                               uci->devname ? uci->devname : _T(""), str,
-                               uci->sectors, uci->surfaces, uci->reserved, uci->blocksize,
-                               bp, uci->filesys ? uci->filesys : _T(""), hdcontrollers[uci->controller]);
-                       if (uci->cyls || (uci->pcyls && uci->pheads && uci->psecs)) {
+                               ci->readonly ? _T("ro") : _T("rw"),
+                               ci->devname ? ci->devname : _T(""), str,
+                               ci->sectors, ci->surfaces, ci->reserved, ci->blocksize,
+                               bp, ci->filesys ? ci->filesys : _T(""), hdcontrollers[ci->controller]);
+                       if (ci->highcyl) {
                                TCHAR *s = tmp + _tcslen (tmp);
-                               _stprintf (s, _T(",%d,%d/%d/%d"), uci->cyls, uci->pcyls, uci->pheads, uci->psecs);
+                               _stprintf (s, _T(",%d"), ci->highcyl);
+                               if (ci->pcyls && ci->pheads && ci->psecs) {
+                                       TCHAR *s = tmp + _tcslen (tmp);
+                                       _stprintf (s, _T(",%d/%d/%d"), ci->pcyls, ci->pheads, ci->psecs);
+                               }
                        }
                        cfgfile_write_str (f, _T("hardfile2"), tmp);
 #if 0
@@ -602,6 +613,17 @@ static void write_leds (struct zfile *f, const TCHAR *name, int mask)
        cfgfile_dwrite_str (f, name, tmp);
 }
 
+static void write_resolution (struct zfile *f, const TCHAR *ws, const TCHAR *hs, struct wh *wh)
+{
+       if (wh->width <= 0 || wh->height <= 0 || wh->special == WH_NATIVE) {
+               cfgfile_write_str (f, ws, _T("native"));
+               cfgfile_write_str (f, hs, _T("native"));
+       } else {
+               cfgfile_write (f, ws, _T("%d"), wh->width);
+               cfgfile_write (f, hs, _T("%d"), wh->height);
+       }
+}
+
 void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
 {
        struct strlist *sl;
@@ -845,14 +867,11 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
        cfgfile_write_str (f, _T("gfx_display_name_rtg"), target_get_display_name (p->gfx_apmode[APMODE_RTG].gfx_display, false));
 
        cfgfile_write (f, _T("gfx_framerate"), _T("%d"), p->gfx_framerate);
-       cfgfile_write (f, _T("gfx_width"), _T("%d"), p->gfx_size_win.width); /* compatibility with old versions */
-       cfgfile_write (f, _T("gfx_height"), _T("%d"), p->gfx_size_win.height); /* compatibility with old versions */
+       write_resolution (f, _T("gfx_width"), _T("gfx_height"), &p->gfx_size_win); /* compatibility with old versions */
        cfgfile_write (f, _T("gfx_top_windowed"), _T("%d"), p->gfx_size_win.x);
        cfgfile_write (f, _T("gfx_left_windowed"), _T("%d"), p->gfx_size_win.y);
-       cfgfile_write (f, _T("gfx_width_windowed"), _T("%d"), p->gfx_size_win.width);
-       cfgfile_write (f, _T("gfx_height_windowed"), _T("%d"), p->gfx_size_win.height);
-       cfgfile_write (f, _T("gfx_width_fullscreen"), _T("%d"), p->gfx_size_fs.width);
-       cfgfile_write (f, _T("gfx_height_fullscreen"), _T("%d"), p->gfx_size_fs.height);
+       write_resolution (f, _T("gfx_width_windowed"), _T("gfx_height_windowed"), &p->gfx_size_win);
+       write_resolution (f, _T("gfx_width_fullscreen"), _T("gfx_height_fullscreen"), &p->gfx_size_fs);
        cfgfile_write (f, _T("gfx_refreshrate"), _T("%d"), p->gfx_apmode[0].gfx_refreshrate);
        cfgfile_dwrite (f, _T("gfx_refreshrate_rtg"), _T("%d"), p->gfx_apmode[1].gfx_refreshrate);
        cfgfile_write_bool (f, _T("gfx_autoresolution"), p->gfx_autoresolution);
@@ -898,12 +917,12 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
                cfgfile_dwrite (f, _T("gfx_filter"), _T("no"));
        }
        cfgfile_dwrite_str (f, _T("gfx_filter_mode"), filtermode2[p->gfx_filter_filtermode]);
-       cfgfile_dwrite (f, _T("gfx_filter_vert_zoom"), _T("%d"), p->gfx_filter_vert_zoom);
-       cfgfile_dwrite (f, _T("gfx_filter_horiz_zoom"), _T("%d"), p->gfx_filter_horiz_zoom);
-       cfgfile_dwrite (f, _T("gfx_filter_vert_zoom_mult"), _T("%d"), p->gfx_filter_vert_zoom_mult);
-       cfgfile_dwrite (f, _T("gfx_filter_horiz_zoom_mult"), _T("%d"), p->gfx_filter_horiz_zoom_mult);
-       cfgfile_dwrite (f, _T("gfx_filter_vert_offset"), _T("%d"), p->gfx_filter_vert_offset);
-       cfgfile_dwrite (f, _T("gfx_filter_horiz_offset"), _T("%d"), p->gfx_filter_horiz_offset);
+       cfgfile_dwrite (f, _T("gfx_filter_vert_zoomf"), _T("%f"), p->gfx_filter_vert_zoom);
+       cfgfile_dwrite (f, _T("gfx_filter_horiz_zoomf"), _T("%f"), p->gfx_filter_horiz_zoom);
+       cfgfile_dwrite (f, _T("gfx_filter_vert_zoom_multf"), _T("%f"), p->gfx_filter_vert_zoom_mult);
+       cfgfile_dwrite (f, _T("gfx_filter_horiz_zoom_multf"), _T("%f"), p->gfx_filter_horiz_zoom_mult);
+       cfgfile_dwrite (f, _T("gfx_filter_vert_offsetf"), _T("%f"), p->gfx_filter_vert_offset);
+       cfgfile_dwrite (f, _T("gfx_filter_horiz_offsetf"), _T("%f"), p->gfx_filter_horiz_offset);
        cfgfile_dwrite (f, _T("gfx_filter_scanlines"), _T("%d"), p->gfx_filter_scanlines);
        cfgfile_dwrite (f, _T("gfx_filter_scanlinelevel"), _T("%d"), p->gfx_filter_scanlinelevel);
        cfgfile_dwrite (f, _T("gfx_filter_scanlineratio"), _T("%d"), p->gfx_filter_scanlineratio);
@@ -949,6 +968,9 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
        cfgfile_dwrite (f, _T("gfx_center_horizontal_size"), _T("%d"), p->gfx_xcenter_size);
        cfgfile_dwrite (f, _T("gfx_center_vertical_size"), _T("%d"), p->gfx_ycenter_size);
 
+       cfgfile_dwrite (f, _T("rtg_vert_zoom_multf"), _T("%.f"), p->rtg_vert_zoom_mult);
+       cfgfile_dwrite (f, _T("rtg_horiz_zoom_multf"), _T("%.f"), p->rtg_horiz_zoom_mult);
+
 #endif
 
        cfgfile_write_bool (f, _T("immediate_blits"), p->immediate_blits);
@@ -1184,6 +1206,15 @@ int cfgfile_doubleval (const TCHAR *option, const TCHAR *value, const TCHAR *nam
        return 1;
 }
 
+int cfgfile_floatval (const TCHAR *option, const TCHAR *value, const TCHAR *name, float *location)
+{
+       int base = 10;
+       TCHAR *endptr;
+       if (name != NULL && _tcscmp (option, name) != 0)
+               return 0;
+       *location = (float)_tcstod (value, &endptr);
+       return 1;
+}
 
 int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, unsigned int *location, int scale)
 {
@@ -1538,12 +1569,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                || cfgfile_intval (option, value, _T("sampler_buffer"), &p->sampler_buffer, 1)
 
                || cfgfile_intval (option, value, _T("gfx_framerate"), &p->gfx_framerate, 1)
-               || cfgfile_intval (option, value, _T("gfx_width_windowed"), &p->gfx_size_win.width, 1)
-               || cfgfile_intval (option, value, _T("gfx_height_windowed"), &p->gfx_size_win.height, 1)
                || cfgfile_intval (option, value, _T("gfx_top_windowed"), &p->gfx_size_win.x, 1)
                || cfgfile_intval (option, value, _T("gfx_left_windowed"), &p->gfx_size_win.y, 1)
-               || cfgfile_intval (option, value, _T("gfx_width_fullscreen"), &p->gfx_size_fs.width, 1)
-               || cfgfile_intval (option, value, _T("gfx_height_fullscreen"), &p->gfx_size_fs.height, 1)
                || cfgfile_intval (option, value, _T("gfx_refreshrate"), &p->gfx_apmode[APMODE_NATIVE].gfx_refreshrate, 1)
                || cfgfile_intval (option, value, _T("gfx_refreshrate_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_refreshrate, 1)
                || cfgfile_yesno (option, value, _T("gfx_autoresolution"), &p->gfx_autoresolution)
@@ -1558,12 +1585,12 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                || cfgfile_intval (option, value, _T("gfx_center_vertical_size"), &p->gfx_ycenter_size, 1)
 
 #ifdef GFXFILTER
-               || cfgfile_intval (option, value, _T("gfx_filter_vert_zoom"), &p->gfx_filter_vert_zoom, 1)
-               || cfgfile_intval (option, value, _T("gfx_filter_horiz_zoom"), &p->gfx_filter_horiz_zoom, 1)
-               || cfgfile_intval (option, value, _T("gfx_filter_vert_zoom_mult"), &p->gfx_filter_vert_zoom_mult, 1)
-               || cfgfile_intval (option, value, _T("gfx_filter_horiz_zoom_mult"), &p->gfx_filter_horiz_zoom_mult, 1)
-               || cfgfile_intval (option, value, _T("gfx_filter_vert_offset"), &p->gfx_filter_vert_offset, 1)
-               || cfgfile_intval (option, value, _T("gfx_filter_horiz_offset"), &p->gfx_filter_horiz_offset, 1)
+               || cfgfile_floatval (option, value, _T("gfx_filter_vert_zoomf"), &p->gfx_filter_vert_zoom)
+               || cfgfile_floatval (option, value, _T("gfx_filter_horiz_zoomf"), &p->gfx_filter_horiz_zoom)
+               || cfgfile_floatval (option, value, _T("gfx_filter_vert_zoom_multf"), &p->gfx_filter_vert_zoom_mult)
+               || cfgfile_floatval (option, value, _T("gfx_filter_horiz_zoom_multf"), &p->gfx_filter_horiz_zoom_mult)
+               || cfgfile_floatval (option, value, _T("gfx_filter_vert_offsetf"), &p->gfx_filter_vert_offset)
+               || cfgfile_floatval (option, value, _T("gfx_filter_horiz_offsetf"), &p->gfx_filter_horiz_offset)
                || cfgfile_intval (option, value, _T("gfx_filter_scanlines"), &p->gfx_filter_scanlines, 1)
                || cfgfile_intval (option, value, _T("gfx_filter_scanlinelevel"), &p->gfx_filter_scanlinelevel, 1)
                || cfgfile_intval (option, value, _T("gfx_filter_scanlineratio"), &p->gfx_filter_scanlineratio, 1)
@@ -1582,8 +1609,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                || cfgfile_string (option, value, _T("gfx_filter_mask"), p->gfx_filtermask, sizeof p->gfx_filtermask / sizeof (TCHAR))
                || cfgfile_intval (option, value, _T("filesys_max_size"), &p->filesys_limit, 1)
 
-               || cfgfile_intval (option, value, _T("rtg_vert_zoom_mult"), &p->rtg_vert_zoom_mult, 1)
-               || cfgfile_intval (option, value, _T("rtg_horiz_zoom_mult"), &p->rtg_horiz_zoom_mult, 1)
+               || cfgfile_floatval (option, value, _T("rtg_vert_zoom_multf"), &p->rtg_vert_zoom_mult)
+               || cfgfile_floatval (option, value, _T("rtg_horiz_zoom_multf"), &p->rtg_horiz_zoom_mult)
 #endif
                || cfgfile_intval (option, value, _T("floppy0sound"), &p->floppyslots[0].dfxclick, 1)
                || cfgfile_intval (option, value, _T("floppy1sound"), &p->floppyslots[1].dfxclick, 1)
@@ -1650,6 +1677,46 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                || cfgfile_strval (option, value, _T("absolute_mouse"), &p->input_tablet, abspointers, 0))
                return 1;
 
+       if (_tcscmp (option, _T("gfx_width_windowed")) == 0) {
+               if (!_tcscmp (value, _T("native"))) {
+                       p->gfx_size_win.width = 0;
+                       p->gfx_size_win.height = 0;
+               } else {
+                       cfgfile_intval (option, value, _T("gfx_width_windowed"), &p->gfx_size_win.width, 1);
+               }
+               return 1;
+       }
+       if (_tcscmp (option, _T("gfx_height_windowed")) == 0) {
+               if (!_tcscmp (value, _T("native"))) {
+                       p->gfx_size_win.width = 0;
+                       p->gfx_size_win.height = 0;
+               } else {
+                       cfgfile_intval (option, value, _T("gfx_height_windowed"), &p->gfx_size_win.height, 1);
+               }
+               return 1;
+       }
+       if (_tcscmp (option, _T("gfx_width_fullscreen")) == 0) {
+               if (!_tcscmp (value, _T("native"))) {
+                       p->gfx_size_fs.width = 0;
+                       p->gfx_size_fs.height = 0;
+                       p->gfx_size_fs.special = WH_NATIVE;
+               } else {
+                       cfgfile_intval (option, value, _T("gfx_width_fullscreen"), &p->gfx_size_fs.width, 1);
+                       p->gfx_size_fs.special = 0;
+               }
+               return 1;
+       }
+       if (_tcscmp (option, _T("gfx_height_fullscreen")) == 0) {
+               if (!_tcscmp (value, _T("native"))) {
+                       p->gfx_size_fs.width = 0;
+                       p->gfx_size_fs.height = 0;
+                       p->gfx_size_fs.special = WH_NATIVE;
+               } else {
+                       cfgfile_intval (option, value, _T("gfx_height_fullscreen"), &p->gfx_size_fs.height, 1);
+                       p->gfx_size_fs.special = 0;
+               }
+               return 1;
+       }
 
        if (cfgfile_intval (option, value, _T("gfx_display"), &p->gfx_apmode[APMODE_NATIVE].gfx_display, 1)) {
                p->gfx_apmode[APMODE_RTG].gfx_display = p->gfx_apmode[APMODE_NATIVE].gfx_display;
@@ -2235,33 +2302,27 @@ end:
        xfree (romtxt);
 }
 
-static struct uaedev_config_info *getuci (struct uae_prefs *p)
+static struct uaedev_config_data *getuci (struct uae_prefs *p)
 {
        if (p->mountitems < MOUNT_CONFIG_SIZE)
                return &p->mountconfig[p->mountitems++];
        return NULL;
 }
 
-struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index,
-       const TCHAR *devname, const TCHAR *volname, const TCHAR *rootdir, bool readonly,
-       int cyls, int secspertrack, int surfaces, int reserved,
-       int blocksize, int bootpri,
-       const TCHAR *filesysdir, int hdc, int flag,
-       int pcyls, int pheads, int psecs)
+struct uaedev_config_data *add_filesys_config (struct uae_prefs *p, int index, struct uaedev_config_info *ci, bool hdf)
 {
-       struct uaedev_config_info *uci;
+       struct uaedev_config_data *uci;
        int i;
-       TCHAR *s;
 
-       if (index < 0 && devname && _tcslen (devname) > 0) {
+       if (index < 0 && ci->devname && _tcslen (ci->devname) > 0) {
                for (i = 0; i < p->mountitems; i++) {
-                       if (p->mountconfig[i].devname && !_tcscmp (p->mountconfig[i].devname, devname))
+                       if (p->mountconfig[i].ci.devname && !_tcscmp (p->mountconfig[i].ci.devname, ci->devname))
                                return 0;
                }
        }
 
        if (index < 0) {
-               uci = getuci(p);
+               uci = getuci (p);
                uci->configoffset = -1;
        } else {
                uci = &p->mountconfig[index];
@@ -2269,55 +2330,39 @@ struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index,
        if (!uci)
                return 0;
 
-       uci->ishdf = volname == NULL ? 1 : 0;
-       _tcscpy (uci->devname, devname ? devname : _T(""));
-       _tcscpy (uci->volname, volname ? volname : _T(""));
-       _tcscpy (uci->rootdir, rootdir ? rootdir : _T(""));
-       validatedevicename (uci->devname);
-       validatevolumename (uci->volname);
-       uci->readonly = readonly;
-       uci->cyls = cyls;
-       uci->sectors = secspertrack;
-       uci->surfaces = surfaces;
-       uci->reserved = reserved;
-       uci->blocksize = blocksize;
-       uci->bootpri = bootpri;
-       uci->donotmount = 0;
-       uci->autoboot = 0;
-       if (!pcyls || !pheads || !psecs)
-               pcyls = pheads = psecs = 0;
-       uci->pcyls = pcyls;
-       uci->pheads = pheads;
-       uci->psecs = psecs;
-       if (bootpri < -128)
-               uci->donotmount = 1;
-       else if (bootpri >= -127)
-               uci->autoboot = 1;
-       uci->controller = hdc;
-       _tcscpy (uci->filesys, filesysdir ? filesysdir : _T(""));
-       if (!uci->devname[0]) {
+       memcpy (&uci->ci, ci, sizeof (struct uaedev_config_info));
+       uci->ishdf = hdf;
+       validatedevicename (uci->ci.devname);
+       validatevolumename (uci->ci.volname);
+       if (uci->ci.bootpri < -128)
+               uci->ci.donotmount = true;
+       else if (uci->ci.bootpri >= -127)
+               uci->ci.autoboot = true;
+       if (!uci->ci.devname[0]) {
                TCHAR base[32];
                TCHAR base2[32];
                int num = 0;
-               if (uci->rootdir[0] == 0 && !uci->ishdf)
+               if (uci->ci.rootdir[0] == 0 && !uci->ishdf)
                        _tcscpy (base, _T("RDH"));
                else
                        _tcscpy (base, _T("DH"));
                _tcscpy (base2, base);
                for (i = 0; i < p->mountitems; i++) {
                        _stprintf (base2, _T("%s%d"), base, num);
-                       if (!_tcscmp(base2, p->mountconfig[i].devname)) {
+                       if (!_tcsicmp(base2, p->mountconfig[i].ci.devname)) {
                                num++;
                                i = -1;
                                continue;
                        }
                }
-               _tcscpy (uci->devname, base2);
-               validatedevicename (uci->devname);
+               _tcscpy (uci->ci.devname, base2);
+               validatedevicename (uci->ci.devname);
+       }
+       if (!uci->ishdf) {
+               TCHAR *s = filesys_createvolname (uci->ci.volname, uci->ci.rootdir, _T("Harddrive"));
+               _tcscpy (uci->ci.volname, s);
+               xfree (s);
        }
-       s = filesys_createvolname (volname, rootdir, _T("Harddrive"));
-       _tcscpy (uci->volname, s);
-       xfree (s);
        return uci;
 }
 
@@ -2357,14 +2402,153 @@ static int get_filesys_controller (const TCHAR *hdc)
        return hdcv;
 }
 
+static bool parse_geo (const TCHAR *tname, struct uaedev_config_info *uci, struct hardfiledata *hfd, bool empty)
+{
+       struct zfile *f;
+       int found;
+       TCHAR buf[200];
+       
+       f = zfile_fopen (tname, _T("r"));
+       if (!f)
+               return false;
+       found = hfd == NULL && !empty ? 2 : 0;
+       if (found)
+               write_log (_T("Geometry file '%s' detected\n"), tname);
+       while (zfile_fgets (buf, sizeof buf / sizeof (TCHAR), f)) {
+               int v;
+               TCHAR *sep;
+               
+               my_trim (buf);
+               if (_tcslen (buf) == 0)
+                       continue;
+               if (buf[0] == '[' && buf[_tcslen (buf) - 1] == ']') {
+                       if (found > 1) {
+                               zfile_fclose (f);
+                               return true;
+                       }
+                       found = 0;
+                       buf[_tcslen (buf) - 1] = 0;
+                       my_trim (buf + 1);
+                       if (!_tcsicmp (buf + 1, _T("empty"))) {
+                               if (empty)
+                                       found = 1;
+                       } else if (!_tcsicmp (buf + 1, _T("default"))) {
+                               if (!empty)
+                                       found = 1;
+                       } else if (hfd) {
+                               uae_u64 size = _tstoi64 (buf + 1);
+                               if (size == hfd->virtsize)
+                                       found = 2;
+                       }
+                       if (found)
+                               write_log (_T("Geometry file '%s', entry '%s' detected\n"), tname, buf + 1);
+                       continue;
+               }
+               if (!found)
+                       continue;
+
+               sep =  _tcschr (buf, '=');
+               if (!sep)
+                       continue;
+               sep[0] = 0;
+
+               TCHAR *key = my_strdup_trim (buf);
+               TCHAR *val = my_strdup_trim (sep + 1);
+               if (val[0] == '0' && _totupper (val[1]) == 'X') {
+                       TCHAR *endptr;
+                       v = _tcstol (val, &endptr, 16);
+               } else {
+                       v = _tstol (val);
+               }
+               if (!_tcsicmp (key, _T("surfaces")))
+                       uci->surfaces = v;
+               if (!_tcsicmp (key, _T("sectorspertrack")) || !_tcsicmp (key, _T("blockspertrack")))
+                       uci->sectors = v;
+               if (!_tcsicmp (key, _T("sectorsperblock")))
+                       uci->sectorsperblock = v;
+               if (!_tcsicmp (key, _T("reserved")))
+                       uci->reserved = v;
+               if (!_tcsicmp (key, _T("lowcyl")))
+                       uci->lowcyl = v;
+               if (!_tcsicmp (key, _T("highcyl")) || !_tcsicmp (key, _T("cyl")))
+                       uci->highcyl = v;
+               if (!_tcsicmp (key, _T("blocksize")) || !_tcsicmp (key, _T("sectorsize")))
+                       uci->blocksize = v;
+               if (!_tcsicmp (key, _T("buffers")))
+                       uci->buffers = v;
+               if (!_tcsicmp (key, _T("maxtransfer")))
+                       uci->maxtransfer = v;
+               if (!_tcsicmp (key, _T("interleave")))
+                       uci->interleave = v;
+               if (!_tcsicmp (key, _T("dostype")))
+                       uci->dostype = v;
+               if (!_tcsicmp (key, _T("bufmemtype")))
+                       uci->bufmemtype = v;
+               if (!_tcsicmp (key, _T("stacksize")))
+                       uci->stacksize = v;
+               if (!_tcsicmp (key, _T("mask")))
+                       uci->mask = v;
+               if (!_tcsicmp (key, _T("unit")))
+                       uci->unit = v;
+               if (!_tcsicmp (key, _T("controller")))
+                       uci->controller = get_filesys_controller (val);
+               if (!_tcsicmp (key, _T("flags")))
+                       uci->flags = v;
+               if (!_tcsicmp (key, _T("priority")))
+                       uci->priority = v;
+               if (!_tcsicmp (key, _T("bootpri"))) {
+                       uci->bootpri = v;
+                       uci->donotmount = false;
+                       if (uci->bootpri <= -128) {
+                               uci->bootpri = -128;
+                               uci->donotmount = true;
+                       }
+               }
+               if (!_tcsicmp (key, _T("filesystem")))
+                       _tcscpy (uci->filesys, val);
+               if (!_tcsicmp (key, _T("device")))
+                       _tcscpy (uci->devname, val);
+               xfree (val);
+               xfree (key);
+       }
+       zfile_fclose (f);
+       return false;
+}
+bool get_hd_geometry (struct uaedev_config_info *uci)
+{
+       TCHAR tname[MAX_DPATH];
+
+       fetch_configurationpath (tname, sizeof tname / sizeof (TCHAR));
+       _tcscat (tname, _T("default.geo"));
+       if (zfile_exists (tname)) {
+               struct hardfiledata hfd;
+               memset (&hfd, 0, sizeof hfd);
+               hfd.ci.readonly = true;
+               hfd.ci.blocksize = 512;
+               if (hdf_open (&hfd, uci->rootdir)) {
+                       parse_geo (tname, uci, &hfd, false);
+                       hdf_close (&hfd);
+               } else {
+                       parse_geo (tname, uci, NULL, true);
+               }
+       }
+       if (uci->rootdir[0]) {
+               _tcscpy (tname, uci->rootdir);
+               _tcscat (tname, _T(".geo"));
+               return parse_geo (tname, uci, NULL, false);
+       }
+       return false;
+}
+
 static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, bool hdf, TCHAR *value)
 {
-       int cyls, secs, heads, reserved, bs, bp, hdcv;
-       int pcyls, pheads, psecs;
-       bool ro;
-       TCHAR *dname = NULL, *aname = _T(""), *root = NULL, *fs = NULL, *hdc;
-       TCHAR *tmpp = _tcschr (value, ',');
+       struct uaedev_config_info uci;
+       TCHAR *tmpp = _tcschr (value, ','), *tmpp2;
        TCHAR *str = NULL;
+       TCHAR devname[MAX_DPATH], volname[MAX_DPATH];
+
+       devname[0] = volname[0] = 0;
+       uci_set_defaults (&uci, false);
 
        config_newfilesystem = 1;
        if (tmpp == 0)
@@ -2372,14 +2556,11 @@ static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, bool hdf, TCHA
 
        *tmpp++ = '\0';
        if (strcasecmp (value, _T("ro")) == 0)
-               ro = true;
+               uci.readonly = true;
        else if (strcasecmp (value, _T("rw")) == 0)
-               ro = false;
+               uci.readonly = false;
        else
                goto invalid_fs;
-       cyls = 0,secs = 0; heads = 0; reserved = 0; bs = 0; bp = 0;
-       fs = 0; hdc = 0; hdcv = 0;
-       pcyls = pheads = psecs = 0;
 
        value = tmpp;
        if (!hdf) {
@@ -2387,65 +2568,76 @@ static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, bool hdf, TCHA
                if (tmpp == 0)
                        goto empty_fs;
                *tmpp++ = 0;
-               dname = value;
-               aname = tmpp;
+               _tcscpy (devname, value);
+               tmpp2 = tmpp;
                tmpp = _tcschr (tmpp, ':');
                if (tmpp == 0)
                        goto empty_fs;
                *tmpp++ = 0;
-               root = tmpp;
+               _tcscpy (volname, tmpp2);
+               tmpp2 = tmpp;
                tmpp = _tcschr (tmpp, ',');
                if (tmpp == 0)
                        goto empty_fs;
                *tmpp++ = 0;
-               if (! getintval (&tmpp, &bp, 0))
+               _tcscpy (uci.rootdir, tmpp2);
+               _tcscpy (uci.volname, volname);
+               _tcscpy (uci.devname, devname);
+               if (! getintval (&tmpp, &uci.bootpri, 0))
                        goto empty_fs;
        } else {
                tmpp = _tcschr (value, ':');
                if (tmpp == 0)
                        goto invalid_fs;
                *tmpp++ = '\0';
-               dname = value;
-               root = tmpp;
+               _tcscpy (devname, value);
+               tmpp2 = tmpp;
                tmpp = _tcschr (tmpp, ',');
                if (tmpp == 0)
                        goto invalid_fs;
                *tmpp++ = 0;
-               aname = 0;
-               if (! getintval (&tmpp, &secs, ',')
-                       || ! getintval (&tmpp, &heads, ',')
-                       || ! getintval (&tmpp, &reserved, ',')
-                       || ! getintval (&tmpp, &bs, ','))
+               _tcscpy (uci.rootdir, tmpp2);
+               if (uci.rootdir[0] != ':')
+                       get_hd_geometry (&uci);
+               _tcscpy (uci.devname, devname);
+               if (! getintval (&tmpp, &uci.sectors, ',')
+                       || ! getintval (&tmpp, &uci.surfaces, ',')
+                       || ! getintval (&tmpp, &uci.reserved, ',')
+                       || ! getintval (&tmpp, &uci.blocksize, ','))
                        goto invalid_fs;
-               if (getintval2 (&tmpp, &bp, ',')) {
-                       fs = tmpp;
+               if (getintval2 (&tmpp, &uci.bootpri, ',')) {
+                       tmpp2 = tmpp;
                        tmpp = _tcschr (tmpp, ',');
                        if (tmpp != 0) {
                                *tmpp++ = 0;
+                               _tcscpy (uci.filesys, tmpp2);
                                TCHAR *tmpp2 = _tcschr (tmpp, ',');
                                if (tmpp2)
                                        *tmpp2++ = 0;
-                               hdcv = get_filesys_controller (tmpp);
+                               uci.controller = get_filesys_controller (tmpp);
                                if (tmpp2) {
-                                       if (getintval2 (&tmpp2, &cyls, ',')) {
-                                               getintval (&tmpp2, &pcyls, '/');
-                                               getintval (&tmpp2, &pheads, '/');
-                                               getintval2 (&tmpp2, &psecs, '/');
+                                       if (getintval2 (&tmpp2, &uci.highcyl, ',')) {
+                                               getintval (&tmpp2, &uci.pcyls, '/');
+                                               getintval (&tmpp2, &uci.pheads, '/');
+                                               getintval2 (&tmpp2, &uci.psecs, '/');
                                        }
                                }
                        }
                }
        }
 empty_fs:
-       if (root) {
-               if (_tcslen (root) > 3 && root[0] == 'H' && root[1] == 'D' && root[2] == '_') {
-                       root += 2;
-                       *root = ':';
+       uci.autoboot = uci.bootpri >= -127; 
+       uci.donotmount = uci.bootpri == -129; 
+       if (uci.rootdir[0]) {
+               if (_tcslen (uci.rootdir) > 3 && uci.rootdir[0] == 'H' && uci.rootdir[1] == 'D' && uci.rootdir[2] == '_') {
+                       memmove (uci.rootdir, uci.rootdir + 2, (_tcslen (uci.rootdir + 2) + 1) * sizeof (TCHAR));
+                       uci.rootdir[0] = ':';
                }
-               str = cfgfile_subst_path_load (UNEXPANDED, &p->path_hardfile, root, false);
+               str = cfgfile_subst_path_load (UNEXPANDED, &p->path_hardfile, uci.rootdir, false);
+               _tcscpy (uci.rootdir, str);
        }
 #ifdef FILESYS
-       add_filesys_config (p, nr, dname, aname, str, ro, cyls, secs, heads, reserved, bs, bp, fs, hdcv, 0, pcyls, pheads, psecs);
+       add_filesys_config (p, nr, &uci, hdf);
 #endif
        xfree (str);
        return 1;
@@ -2482,7 +2674,7 @@ static int cfgfile_parse_filesys (struct uae_prefs *p, const TCHAR *option, TCHA
                        }
                        return 1;
                } else if (!_tcsncmp (option, tmp, _tcslen (tmp)) && option[_tcslen (tmp)] == '_') {
-                       struct uaedev_config_info *uci = &currprefs.mountconfig[i];
+                       struct uaedev_config_info *uci = &currprefs.mountconfig[i].ci;
                        if (uci->devname) {
                                const TCHAR *s = &option[_tcslen (tmp) + 1];
                                if (!_tcscmp (s, _T("bootpri"))) {
@@ -2507,11 +2699,12 @@ static int cfgfile_parse_filesys (struct uae_prefs *p, const TCHAR *option, TCHA
        if (_tcscmp (option, _T("filesystem")) == 0
                || _tcscmp (option, _T("hardfile")) == 0)
        {
-               int secs, heads, reserved, bs;
-               bool ro;
-               TCHAR *aname, *root;
+               struct uaedev_config_info uci;
                TCHAR *tmpp = _tcschr (value, ',');
                TCHAR *str;
+               bool hdf;
+
+               uci_set_defaults (&uci, false);
 
                if (config_newfilesystem)
                        return 1;
@@ -2523,35 +2716,35 @@ static int cfgfile_parse_filesys (struct uae_prefs *p, const TCHAR *option, TCHA
                if (_tcscmp (value, _T("1")) == 0 || strcasecmp (value, _T("ro")) == 0
                        || strcasecmp (value, _T("readonly")) == 0
                        || strcasecmp (value, _T("read-only")) == 0)
-                       ro = true;
+                       uci.readonly = true;
                else if (_tcscmp (value, _T("0")) == 0 || strcasecmp (value, _T("rw")) == 0
                        || strcasecmp (value, _T("readwrite")) == 0
                        || strcasecmp (value, _T("read-write")) == 0)
-                       ro = false;
+                       uci.readonly = false;
                else
                        goto invalid_fs;
-               secs = 0; heads = 0; reserved = 0; bs = 0;
 
                value = tmpp;
                if (_tcscmp (option, _T("filesystem")) == 0) {
+                       hdf = false;
                        tmpp = _tcschr (value, ':');
                        if (tmpp == 0)
                                goto invalid_fs;
                        *tmpp++ = '\0';
-                       aname = value;
-                       root = tmpp;
+                       _tcscpy (uci.volname, value);
+                       _tcscpy (uci.rootdir, tmpp);
                } else {
-                       if (! getintval (&value, &secs, ',')
-                               || ! getintval (&value, &heads, ',')
-                               || ! getintval (&value, &reserved, ',')
-                               || ! getintval (&value, &bs, ','))
+                       hdf = true;
+                       if (! getintval (&value, &uci.sectors, ',')
+                               || ! getintval (&value, &uci.surfaces, ',')
+                               || ! getintval (&value, &uci.reserved, ',')
+                               || ! getintval (&value, &uci.blocksize, ','))
                                goto invalid_fs;
-                       root = value;
-                       aname = 0;
+                       _tcscpy (uci.rootdir, value);
                }
-               str = cfgfile_subst_path_load (UNEXPANDED, &p->path_hardfile, root, true);
+               str = cfgfile_subst_path_load (UNEXPANDED, &p->path_hardfile, uci.rootdir, true);
 #ifdef FILESYS
-               add_filesys_config (p, -1, NULL, aname, str, ro, 0, secs, heads, reserved, bs, 0, NULL, 0, 0, 0, 0, 0);
+               add_filesys_config (p, -1, &uci, hdf);
 #endif
                xfree (str);
                return 1;
@@ -2938,7 +3131,10 @@ static void calcformula (struct uae_prefs *prefs, TCHAR *in)
                return;
        }
        if (calc (out, &val)) {
-               _stprintf (in, _T("%d"), (int)val);
+               if (val - (int)val != 0.0f)
+                       _stprintf (in, _T("%f"), val);
+               else
+                       _stprintf (in, _T("%d"), (int)val);
                updatestore = true;
                return;
        }
@@ -3532,9 +3728,11 @@ bad:
 
 static void parse_filesys_spec (struct uae_prefs *p, bool readonly, const TCHAR *spec)
 {
+       struct uaedev_config_info uci;
        TCHAR buf[256];
        TCHAR *s2;
 
+       uci_set_defaults (&uci, false);
        _tcsncpy (buf, spec, 255); buf[255] = 0;
        s2 = _tcschr (buf, ':');
        if (s2) {
@@ -3548,7 +3746,10 @@ static void parse_filesys_spec (struct uae_prefs *p, bool readonly, const TCHAR
                }
 #endif
 #ifdef FILESYS
-               add_filesys_config (p, -1, NULL, buf, s2, readonly, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+               _tcscpy (uci.volname, buf);
+               _tcscpy (uci.rootdir, s2);
+               uci.readonly = readonly;
+               add_filesys_config (p, -1, &uci, false);
 #endif
        } else {
                write_log (_T("Usage: [-m | -M] VOLNAME:mount_point\n"));
@@ -3557,9 +3758,11 @@ static void parse_filesys_spec (struct uae_prefs *p, bool readonly, const TCHAR
 
 static void parse_hardfile_spec (struct uae_prefs *p, const TCHAR *spec)
 {
+       struct uaedev_config_info uci;
        TCHAR *x0 = my_strdup (spec);
        TCHAR *x1, *x2, *x3, *x4;
 
+       uci_set_defaults (&uci, false);
        x1 = _tcschr (x0, ':');
        if (x1 == NULL)
                goto argh;
@@ -3577,7 +3780,8 @@ static void parse_hardfile_spec (struct uae_prefs *p, const TCHAR *spec)
                goto argh;
        *x4++ = '\0';
 #ifdef FILESYS
-       add_filesys_config (p, -1, NULL, NULL, x4, 0, 0, _tstoi (x0), _tstoi (x1), _tstoi (x2), _tstoi (x3), 0, 0, 0, 0, 0, 0, 0);
+       _tcscpy (uci.rootdir, x4);
+       //add_filesys_config (p, -1, NULL, NULL, x4, 0, 0, _tstoi (x0), _tstoi (x1), _tstoi (x2), _tstoi (x3), 0, 0, 0, 0, 0, 0, 0);
 #endif
        free (x0);
        return;
@@ -4351,8 +4555,8 @@ void default_prefs (struct uae_prefs *p, int type)
        p->gfx_filter = 0;
        p->gfx_filtershader[0] = 0;
        p->gfx_filtermask[0] = 0;
-       p->gfx_filter_horiz_zoom_mult = 1000;
-       p->gfx_filter_vert_zoom_mult = 1000;
+       p->gfx_filter_horiz_zoom_mult = 1.0;
+       p->gfx_filter_vert_zoom_mult = 1.0;
        p->gfx_filter_bilinear = 0;
        p->gfx_filter_filtermode = 0;
        p->gfx_filter_scanlineratio = (1 << 4) | 1;
@@ -4361,8 +4565,8 @@ void default_prefs (struct uae_prefs *p, int type)
        p->gfx_filter_keep_autoscale_aspect = false;
        p->gfx_filteroverlay_overscan = 0;
 
-       p->rtg_horiz_zoom_mult = 1000;
-       p->rtg_vert_zoom_mult = 1000;
+       p->rtg_horiz_zoom_mult = 1.0;
+       p->rtg_vert_zoom_mult = 1.0;
 
        _tcscpy (p->floppyslots[0].df, _T("df0.adf"));
        _tcscpy (p->floppyslots[1].df, _T("df1.adf"));
@@ -4670,12 +4874,15 @@ static int bip_a3000 (struct uae_prefs *p, int config, int compa, int romcheck)
        p->chipmem_size = 0x200000;
        p->cpu_model = 68030;
        p->fpu_model = 68882;
+       if (compa == 0)
+               p->mmu_model = 68030;
+       else
+               p->cachesize = 8192;
        p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
        p->cpu_compatible = p->address_space_24 = 0;
        p->m68k_speed = -1;
        p->immediate_blits = 0;
        p->produce_sound = 2;
-       p->cachesize = 8192;
        p->floppyslots[0].dfxtype = DRV_35_HD;
        p->floppy_speed = 0;
        p->cpu_idle = 150;
diff --git a/cia.cpp b/cia.cpp
index 1560552caa62f5db4820174c60ca26c31edcb000..0a0bc5f7df7ef00409df54710de3f6c949d28cd6 100644 (file)
--- a/cia.cpp
+++ b/cia.cpp
@@ -1685,7 +1685,7 @@ static uae_u8 getclockreg (int addr, struct tm *ct)
 {
        uae_u8 v = 0;
 
-       if (currprefs.cs_rtc == 1) { /* MSM6242B */
+       if (currprefs.cs_rtc == 1 || currprefs.cs_rtc == 3) { /* MSM6242B */
                switch (addr) {
                case 0x0: v = ct->tm_sec % 10; break;
                case 0x1: v = ct->tm_sec / 10; break;
@@ -1788,8 +1788,8 @@ static void write_battclock (void)
 void rtc_hardreset (void)
 {
        rtc_delayed_write = 0;
-       if (currprefs.cs_rtc == 1) { /* MSM6242B */
-               clock_bank.name = _T("Battery backed up clock (MSM6242B)");
+       if (currprefs.cs_rtc == 1 || currprefs.cs_rtc == 3) { /* MSM6242B */
+               clock_bank.name = currprefs.cs_rtc == 1 ? _T("Battery backed up clock (MSM6242B)") : _T("Battery backed up clock A2000 (MSM6242B)");
                clock_control_d = 0x1;
                clock_control_e = 0;
                clock_control_f = 0x4; /* 24/12 */
@@ -1882,7 +1882,7 @@ static void REGPARAM2 clock_bput (uaecptr addr, uae_u32 value)
                return;
        addr >>= 2;
        value &= 0x0f;
-       if (currprefs.cs_rtc == 1) { /* MSM6242B */
+       if (currprefs.cs_rtc == 1 || currprefs.cs_rtc == 3) { /* MSM6242B */
 #if CLOCK_DEBUG
                write_log (_T("CLOCK W %X: %X\n"), addr, value);
 #endif
index ded4dddb6af90ff94ba2ea4341cf37e190b79cb3..a81f8e1860a5e2da3afe113a97c4999234bacdcf 100644 (file)
@@ -18,6 +18,7 @@ static uaecptr beginio;
 
 void consolehook_config (struct uae_prefs *p)
 {
+       struct uaedev_config_info ci = { 0 };
        int roms[] = { 15, 31, 16, 46, -1 };
 
        default_prefs (p, 0);
@@ -49,7 +50,11 @@ void consolehook_config (struct uae_prefs *p)
        //p->win32_automount_drives = 2;
        //p->win32_automount_cddrives = 2;
 
-       add_filesys_config (p, -1, _T("DH0"), _T("CLIBOOT"), _T("."), 1, 0, 0, 0, 0, 0, 15, NULL, 0, 0, 0, 0, 0);
+       _tcscpy (ci.rootdir, _T("."));
+       _tcscpy (ci.volname, _T("CLIBOOT"));
+       _tcscpy (ci.devname, _T("DH0"));
+       ci.bootpri = 15;
+       add_filesys_config (p, -1, &ci, false);
 }
 
 static void *console_thread (void *v)
index c5db06063612e7a18a9ca4334e5744bda2c002b9..a65db594c4c9e0ae1ea0b14a06aba7e87d9c8ee1 100644 (file)
@@ -23,8 +23,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define DEBUG 0
-#define USETAG 0
 
 #include "sysconfig.h"
 #include "sysdeps.h"
 #include "options.h"
 #include "memory.h"
 #include "newcpu.h"
-#include "debug.h"
 #include "cpummu.h"
 
-static void REGPARAM3 mmu_flush_atc(uaecptr addr, bool super, bool global) REGPARAM;
-static void REGPARAM3 mmu_flush_atc_all(bool global) REGPARAM;
-
 #define DBG_MMU_VERBOSE        1
 #define DBG_MMU_SANITY 1
+#if 0
+#define write_log printf
+#endif
 
 #ifdef FULLMMU
 
-mmu_atc_l1_array atc_l1[2];
-mmu_atc_l1_array *current_atc;
-static struct mmu_atc_line atc_l2[2][ATC_L2_SIZE];
-
-# ifdef ATC_STATS
-static unsigned int mmu_atc_hits[ATC_L2_SIZE];
-# endif
 
+uae_u32 mmu_is_super;
+uae_u32 mmu_tagmask, mmu_pagemask;
+struct mmu_atc_line mmu_atc_array[ATC_TYPE][ATC_WAYS][ATC_SLOTS];
+int mmu060_state;
+bool mmu_pagesize_8k;
 
 static void mmu_dump_ttr(const TCHAR * label, uae_u32 ttr)
 {
@@ -60,14 +55,17 @@ static void mmu_dump_ttr(const TCHAR * label, uae_u32 ttr)
        from_addr = ttr & MMU_TTR_LOGICAL_BASE;
        to_addr = (ttr & MMU_TTR_LOGICAL_MASK) << 8;
 
-       D(bug(_T("%s: [%08lx] %08lx - %08lx enabled=%d supervisor=%d wp=%d cm=%02d\n"),
+       
+#if MMUDEBUG > 0
+       write_log(_T("%s: [%08lx] %08lx - %08lx enabled=%d supervisor=%d wp=%d cm=%02d\n"),
                        label, ttr,
                        from_addr, to_addr,
                        ttr & MMU_TTR_BIT_ENABLED ? 1 : 0,
                        (ttr & (MMU_TTR_BIT_SFIELD_ENABLED | MMU_TTR_BIT_SFIELD_SUPER)) >> MMU_TTR_SFIELD_SHIFT,
                        ttr & MMU_TTR_BIT_WRITE_PROTECT ? 1 : 0,
                        (ttr & MMU_TTR_CACHE_MASK) >> MMU_TTR_CACHE_SHIFT
-                 ));
+                 );
+#endif
 }
 
 void mmu_make_transparent_region(uaecptr baseaddr, uae_u32 size, int datamode)
@@ -87,49 +85,14 @@ void mmu_make_transparent_region(uaecptr baseaddr, uae_u32 size, int datamode)
        *ttr |= ((baseaddr + size - 1) & MMU_TTR_LOGICAL_BASE) >> 8;
        *ttr |= MMU_TTR_BIT_ENABLED;
 
-       D(bug(_T("MMU: map transparent mapping of %08x\n"), *ttr));
-}
-
-/* check if an address matches a ttr */
-static int mmu_do_match_ttr(uae_u32 ttr, uaecptr addr, bool super)
-{
-       if (ttr & MMU_TTR_BIT_ENABLED)  {       /* TTR enabled */
-               uae_u8 msb, mask;
-
-               msb = ((addr ^ ttr) & MMU_TTR_LOGICAL_BASE) >> 24;
-               mask = (ttr & MMU_TTR_LOGICAL_MASK) >> 16;
-
-               if (!(msb & ~mask)) {
-
-                       if ((ttr & MMU_TTR_BIT_SFIELD_ENABLED) == 0) {
-                               if (((ttr & MMU_TTR_BIT_SFIELD_SUPER) == 0) != (super == 0)) {
-                                       return TTR_NO_MATCH;
-                               }
-                       }
-
-                       return (ttr & MMU_TTR_BIT_WRITE_PROTECT) ? TTR_NO_WRITE : TTR_OK_MATCH;
-               }
-       }
-       return TTR_NO_MATCH;
+#if MMUDEBUG > 0
+       write_log(_T("MMU: map transparent mapping of %08x\n"), *ttr);
+#endif
 }
 
-static inline int mmu_match_ttr(uaecptr addr, bool super, bool data)
-{
-       int res;
 
-       if (data) {
-               res = mmu_do_match_ttr(regs.dtt0, addr, super);
-               if (res == TTR_NO_MATCH)
-                       res = mmu_do_match_ttr(regs.dtt1, addr, super);
-       } else {
-               res = mmu_do_match_ttr(regs.itt0, addr, super);
-               if (res == TTR_NO_MATCH)
-                       res = mmu_do_match_ttr(regs.itt1, addr, super);
-       }
-       return res;
-}
 
-#if DEBUG
+#if 0
 /* {{{ mmu_dump_table */
 static void mmu_dump_table(const char * label, uaecptr root_ptr)
 {
@@ -145,7 +108,7 @@ static void mmu_dump_table(const char * label, uaecptr root_ptr)
        uaecptr ptr_des_addr, page_addr,
                root_log, ptr_log, page_log;
 
-       D(bug(_T("%s: root=%lx\n"), label, root_ptr));
+       write_log(_T("%s: root=%lx\n", label, root_ptr);
 
        for (root_idx = 0; root_idx < ROOT_TABLE_SIZE; root_idx++) {
                root_des = phys_get_long(root_ptr + root_idx);
@@ -153,11 +116,11 @@ static void mmu_dump_table(const char * label, uaecptr root_ptr)
                if ((root_des & 2) == 0)
                        continue;       /* invalid */
 
-               D(bug(_T("ROOT: %03d U=%d W=%d UDT=%02d\n"), root_idx,
+               write_log(_T("ROOT: %03d U=%d W=%d UDT=%02d\n", root_idx,
                                root_des & 8 ? 1 : 0,
                                root_des & 4 ? 1 : 0,
                                root_des & 3
-                         ));
+                         );
 
                root_log = root_idx << ROOT_INDEX_SHIFT;
 
@@ -177,7 +140,7 @@ static void mmu_dump_table(const char * label, uaecptr root_ptr)
                        if ((ptr_des & 2) == 0)
                                continue; /* invalid */
 
-                       page_addr = ptr_des & (regs.mmu_pagesize_8k ? MMU_PTR_PAGE_ADDR_MASK_8 : MMU_PTR_PAGE_ADDR_MASK_4);
+                       page_addr = ptr_des & (mmu_pagesize_8k ? MMU_PTR_PAGE_ADDR_MASK_8 : MMU_PTR_PAGE_ADDR_MASK_4);
 
                        n_pages_used = -1;
                        for (page_idx = 0; page_idx < PAGE_TABLE_SIZE; page_idx++) {
@@ -208,31 +171,31 @@ static void mmu_dump_table(const char * label, uaecptr root_ptr)
                        if (n_pages_used == -1)
                                continue;
 
-                       D(bug(_T(" PTR: %03d U=%d W=%d UDT=%02d\n"), ptr_idx,
+                       write_log(_T(" PTR: %03d U=%d W=%d UDT=%02d\n", ptr_idx,
                                ptr_des & 8 ? 1 : 0,
                                ptr_des & 4 ? 1 : 0,
                                ptr_des & 3
-                         ));
+                         );
 
 
                        for (page_idx = 0; page_idx <= n_pages_used; page_idx++) {
                                page_des = page_info[page_idx].match;
 
                                if ((page_des & MMU_PDT_MASK) == 2) {
-                                       D(bug(_T("  PAGE: %03d-%03d log=%08lx INDIRECT --> addr=%08lx\n"),
+                                       write_log(_T("  PAGE: %03d-%03d log=%08lx INDIRECT --> addr=%08lx\n",
                                                        page_info[page_idx].start_idx,
                                                        page_info[page_idx].start_idx + page_info[page_idx].n_pages - 1,
                                                        page_info[page_idx].log,
                                                        page_des & MMU_PAGE_INDIRECT_MASK
-                                                 ));
+                                                 );
 
                                } else {
-                                       D(bug(_T("  PAGE: %03d-%03d log=%08lx addr=%08lx UR=%02d G=%d U1/0=%d S=%d CM=%d M=%d U=%d W=%d\n"),
+                                       write_log(_T("  PAGE: %03d-%03d log=%08lx addr=%08lx UR=%02d G=%d U1/0=%d S=%d CM=%d M=%d U=%d W=%d\n",
                                                        page_info[page_idx].start_idx,
                                                        page_info[page_idx].start_idx + page_info[page_idx].n_pages - 1,
                                                        page_info[page_idx].log,
-                                                       page_des & (regs.mmu_pagesize_8k ? MMU_PAGE_ADDR_MASK_8 : MMU_PAGE_ADDR_MASK_4),
-                                                       (page_des & (regs.mmu_pagesize_8k ? MMU_PAGE_UR_MASK_8 : MMU_PAGE_UR_MASK_4)) >> MMU_PAGE_UR_SHIFT,
+                                                       page_des & (mmu_pagesize_8k ? MMU_PAGE_ADDR_MASK_8 : MMU_PAGE_ADDR_MASK_4),
+                                                       (page_des & (mmu_pagesize_8k ? MMU_PAGE_UR_MASK_8 : MMU_PAGE_UR_MASK_4)) >> MMU_PAGE_UR_SHIFT,
                                                        page_des & MMU_DES_GLOBAL ? 1 : 0,
                                                        (page_des & MMU_TTR_UX_MASK) >> MMU_TTR_UX_SHIFT,
                                                        page_des & MMU_DES_SUPER ? 1 : 0,
@@ -240,7 +203,7 @@ static void mmu_dump_table(const char * label, uaecptr root_ptr)
                                                        page_des & MMU_DES_MODIFIED ? 1 : 0,
                                                        page_des & MMU_DES_USED ? 1 : 0,
                                                        page_des & MMU_DES_WP ? 1 : 0
-                                                 ));
+                                                 );
                                }
                        }
                }
@@ -253,119 +216,122 @@ static void mmu_dump_table(const char * label, uaecptr root_ptr)
 /* {{{ mmu_dump_atc */
 void mmu_dump_atc(void)
 {
-       int i, j;
-       for (i = 0; i < 2; i++) {
-               for (j = 0; j < ATC_L2_SIZE; j++) {
-                       if (atc_l2[i][j].tag == 0x8000)
-                               continue;
-                       D(bug(_T("ATC[%02d] G=%d TT=%d M=%d WP=%d VD=%d VI=%d tag=%08x --> phys=%08x\n"),
-                               j, atc_l2[i][j].global, atc_l2[i][j].tt, atc_l2[i][j].modified,
-                               atc_l2[i][j].write_protect, atc_l2[i][j].valid_data, atc_l2[i][j].valid_inst,
-                               atc_l2[i][j].tag, atc_l2[i][j].phys));
-               }
-       }
+
 }
 /* }}} */
 
 /* {{{ mmu_dump_tables */
 void mmu_dump_tables(void)
 {
-       D(bug(_T("URP: %08x   SRP: %08x  MMUSR: %x  TC: %x\n"), regs.urp, regs.srp, regs.mmusr, regs.tcr));
-       mmu_dump_ttr(_T("DTT0"), regs.dtt0);
-       mmu_dump_ttr(_T("DTT1"), regs.dtt1);
-       mmu_dump_ttr(_T("ITT0"), regs.itt0);
-       mmu_dump_ttr(_T("ITT1"), regs.itt1);
+       write_log(_T("URP: %08x   SRP: %08x  MMUSR: %x  TC: %x\n"), regs.urp, regs.srp, regs.mmusr, regs.tcr);
+       mmu_dump_ttr(L"DTT0", regs.dtt0);
+       mmu_dump_ttr(L"DTT1", regs.dtt1);
+       mmu_dump_ttr(L"ITT0", regs.itt0);
+       mmu_dump_ttr(L"ITT1", regs.itt1);
        mmu_dump_atc();
-#if DEBUG
-       mmu_dump_table("SRP", regs.srp);
+#if MMUDEBUG
+       // mmu_dump_table("SRP", regs.srp);
 #endif
 }
 /* }}} */
 
-static uaecptr REGPARAM2 mmu_lookup_pagetable(uaecptr addr, bool super, bool write);
+static uaecptr REGPARAM2 mmu_lookup_pagetable(uaecptr addr, bool super, bool write, uae_u32 *status);
 
 static ALWAYS_INLINE int mmu_get_fc(bool super, bool data)
 {
        return (super ? 4 : 0) | (data ? 1 : 2);
 }
 
-static void mmu_bus_error(uaecptr addr, int fc, bool write, int size)
+static void mmu_bus_error(uaecptr addr, int fc, bool write, int size, uae_u32 status)
 {
-       uae_u16 ssw = 0;
-
-       ssw |= fc & MMU_SSW_TM;                         /* Copy TM */
-       switch (size) {
-       case sz_byte:
-               ssw |= MMU_SSW_SIZE_B;
-               break;
-       case sz_word:
-               ssw |= MMU_SSW_SIZE_W;
-               break;
-       case sz_long:
-               ssw |= MMU_SSW_SIZE_L;
-               break;
-       }
+       if (currprefs.mmu_model == 68040) {
+               uae_u16 ssw = 0;
+
+               ssw |= fc & MMU_SSW_TM;                         /* Copy TM */
+               switch (size) {
+               case sz_byte:
+                       ssw |= MMU_SSW_SIZE_B;
+                       break;
+               case sz_word:
+                       ssw |= MMU_SSW_SIZE_W;
+                       break;
+               case sz_long:
+                       ssw |= MMU_SSW_SIZE_L;
+                       break;
+               }
 
-       regs.wb3_status = write ? 0x80 | ssw : 0;
-       if (!write)
-               ssw |= MMU_SSW_RW;
+               regs.wb3_status = write ? 0x80 | ssw : 0;
+               if (!write)
+                       ssw |= MMU_SSW_RW;
 
-       regs.mmu_fault_addr = addr;
-       regs.mmu_ssw = ssw | MMU_SSW_ATC;
+               regs.mmu_ssw = ssw | MMU_SSW_ATC;
 
-       D(bug(_T("BUS ERROR: fc=%d w=%d log=%08x ssw=%04x PC=%08x\n"), fc, write, addr, ssw, m68k_getpc()));
+#if MMUDEBUG > 2
+               write_log(_T("040 BUS ERROR: fc=%d w=%d logical=%08x ssw=%04x PC=%08x\n"), fc, write, addr, ssw, m68k_getpc());
+#endif
+       } else {
+               uae_u32 fslw = 0;
+
+               fslw |= write ? MMU_FSLW_W : MMU_FSLW_R;
+               switch (size) {
+               case sz_byte:
+                       fslw |= MMU_FSLW_SIZE_B;
+                       break;
+               case sz_word:
+                       fslw |= MMU_FSLW_SIZE_W;
+                       break;
+               case sz_long:
+                       fslw |= MMU_FSLW_SIZE_L;
+                       break;
+               case 16: // MOVE16
+                       addr &= ~15;
+                       fslw |= MMU_FSLW_SIZE_D;
+                       break;
+               }
+               if (mmu060_state == 0) {
+                       fslw |= MMU_FSLW_IO; // opword fetch
+               } else if ((fc & 2)) {
+                       fslw |= MMU_FSLW_IO | MMU_FSLW_MA; // extension word
+               }
+               fslw |= status;
+               regs.mmu_fslw = fslw;
+
+#if MMUDEBUG > 2
+               write_log(_T("060 BUS ERROR: fc=%d w=%d logical=%08x ssw=%08x PC=%08x\n"), fc, write, addr, fslw, m68k_getpc());
+#endif
+
+       }
 
-       //write_log(_T("BUS ERROR: fc=%d w=%d log=%08x ssw=%04x PC=%08x\n"), fc, write, addr, ssw, m68k_getpc());
-       //activate_debugger();
+       regs.mmu_fault_addr = addr;
 
        THROW(2);
 }
 
+void mmu_bus_error_ttr_write_fault(uaecptr addr, bool super, bool data, uae_u32 val, int size)
+{
+       uae_u32 status = 0;
+
+       if (currprefs.mmu_model == 68060) {
+               status |= MMU_FSLW_TTR;
+       }
+       regs.wb3_data = val;
+       mmu_bus_error(addr, mmu_get_fc (super, data), true, size, status);
+}
+
+
 /*
  * Update the atc line for a given address by doing a mmu lookup.
  */
-static uaecptr mmu_fill_atc_l2(uaecptr addr, bool super, bool data, bool write, struct mmu_atc_line *l)
+static uaecptr mmu_fill_atc(uaecptr addr, bool super, bool data, bool write, struct mmu_atc_line *l, uae_u32 *status)
 {
-       int res;
        uae_u32 desc;
 
-       l->tag = ATC_TAG(addr);
-       l->hw = l->bus_fault = 0;
-
-       /* check ttr0 */
-       res = mmu_match_ttr(addr, super, data);
-       if (res != TTR_NO_MATCH) {
-               l->tt = 1;
-               if (data) {
-                       l->valid_data = 1;
-                       l->valid_inst = mmu_match_ttr(addr, super, 0) == res;
-               } else {
-                       l->valid_inst = 1;
-                       l->valid_data = mmu_match_ttr(addr, super, 1) == res;
-               }
-               l->global = 1;
-               l->modified = 1;
-               l->write_protect = (res == TTR_NO_WRITE);
-               l->phys = 0;
-
-               return 0;
-       }
-
-       l->tt = 0;
-       if (!regs.mmu_enabled) {
-               l->valid_data = l->valid_inst = 1;
-               l->global = 1;
-               l->modified = 1;
-               l->write_protect = 0;
-               l->phys = 0;
-               return 0;
-       }
-
+       *status = 0;
        SAVE_EXCEPTION;
        TRY(prb) {
-               desc = mmu_lookup_pagetable(addr, super, write);
-#if DEBUG > 2
-               D(bug(_T("translate: %x,%u,%u,%u -> %x\n"), addr, super, write, data, desc));
+               desc = mmu_lookup_pagetable(addr, super, write, status);
+#if MMUDEBUG > 2
+               write_log(_T("translate: %x,%u,%u,%u -> %x\n"), addr, super, write, data, desc);
 #endif
                RESTORE_EXCEPTION;
        }
@@ -373,19 +339,22 @@ static uaecptr mmu_fill_atc_l2(uaecptr addr, bool super, bool data, bool write,
                RESTORE_EXCEPTION;
                /* bus error during table search */
                desc = 0;
-               goto fail;
-       }
-
-       if ((desc & 1) == 0 || (!super && desc & MMU_MMUSR_S)) {
-       fail:
-               l->valid_data = l->valid_inst = 0;
+               *status = MMU_FSLW_TWE;
+               // goto fail;
+       } ENDTRY
+       if ((desc & 1) && (!super && desc & MMU_MMUSR_S)) {
+               *status |= MMU_FSLW_SP;
+               l->valid = 0;
+               l->global = 0;
+       } else if ((desc & 1) == 0) {
+               l->valid = 0;
                l->global = 0;
        } else {
-               l->valid_data = l->valid_inst = 1;
-               if (regs.mmu_pagesize_8k)
-                       l->phys = (desc & ~0x1fff) - (addr & ~0x1fff);
+               l->valid = 1;
+               if (mmu_pagesize_8k)
+                       l->phys = (desc & ~0x1fff);
                else
-                       l->phys = (desc & ~0xfff) - (addr & ~0xfff);
+                       l->phys = (desc & ~0xfff);
                l->global = (desc & MMU_MMUSR_G) != 0;
                l->modified = (desc & MMU_MMUSR_M) != 0;
                l->write_protect = (desc & MMU_MMUSR_W) != 0;
@@ -394,63 +363,50 @@ static uaecptr mmu_fill_atc_l2(uaecptr addr, bool super, bool data, bool write,
        return desc;
 }
 
-static ALWAYS_INLINE bool mmu_fill_atc_l1(uaecptr addr, bool super, bool data, bool write, struct mmu_atc_line *l1)
+static ALWAYS_INLINE bool mmu_fill_atc_try(uaecptr addr, bool super, bool data, bool write, struct mmu_atc_line *l1, uae_u32 *status)
 {
-       int idx = ATC_L2_INDEX(addr);
-       int tag = ATC_TAG(addr);
-       struct mmu_atc_line *l = &atc_l2[super ? 1 : 0][idx];
-
-       if (l->tag != tag) {
-       restart:
-               mmu_fill_atc_l2(addr, super, data, write, l);
-       }
-       if (!(data ? l->valid_data : l->valid_inst)) {
-               D(bug(_T("MMU: non-resident page (%x,%x,%x)!\n"), addr, regs.pc, regs.instruction_pc));
+       mmu_fill_atc(addr,super,data,write,l1, status);
+       if (!(l1->valid)) {
+#if MMUDEBUG > 1
+               write_log(_T("MMU: non-resident page (%x,%x)!\n"), addr, regs.pc);
+#endif
                goto fail;
        }
        if (write) {
-               if (l->write_protect) {
-                       D(bug(_T("MMU: write protected (via %s) %lx\n"), l->tt ? "ttr" : "atc", addr));
+               if (l1->write_protect) {
+                       *status |= MMU_FSLW_WP;
+#if MMUDEBUG > 1
+                       write_log(_T("MMU: write protected %lx by atc \n"), addr);
+#endif
+                       mmu_dump_atc();
                        goto fail;
                }
-               if (!l->modified)
-                       goto restart;
-       }
-       *l1 = *l;
-#if 0
-       uaecptr phys_addr = addr + l1->phys;
-       if ((phys_addr & 0xfff00000) == 0x00f00000) {
-               l1->hw = 1;
-               goto fail;
-       }
-       if ((phys_addr & 0xfff00000) == 0xfff00000) {
-               l1->hw = 1;
-               l1->phys -= 0xff000000;
-               goto fail;
-       }
 
-       if (!test_ram_boundary(phys_addr, 1, super, write)) {
-               l1->bus_fault = 1;
-               goto fail;
        }
-#endif
        return true;
 
 fail:
-       l1->tag = ~l1->tag;
        return false;
 }
 
 uaecptr REGPARAM2 mmu_translate(uaecptr addr, bool super, bool data, bool write)
 {
        struct mmu_atc_line *l;
+       uae_u32 status;
+
+       // this should return a miss but choose a valid line
+       mmu_user_lookup(addr, super, data, write, &l);
 
-       l = &atc_l2[super ? 1 : 0][ATC_L2_INDEX(addr)];
-       mmu_fill_atc_l2(addr, super, data, write, l);
-       if (!(data ? l->valid_data : l->valid_inst))
+       mmu_fill_atc(addr, super, data, write, l, &status);
+       if (!l->valid) {
+#if MMUDEBUG > 0
+               write_log(_T("[MMU] mmu_translate error"));
+#endif
                THROW(2);
+       }
+
+    return l->phys | (addr & (mmu_pagesize_8k?0x00001fff:0x00000fff));
 
-       return addr + l->phys;
 }
 
 /*
@@ -458,7 +414,7 @@ uaecptr REGPARAM2 mmu_translate(uaecptr addr, bool super, bool data, bool write)
  * the page descriptors accordingly. Returns the found descriptor
  * or produces a bus error.
  */
-static uaecptr REGPARAM2 mmu_lookup_pagetable(uaecptr addr, bool super, bool write)
+static uaecptr REGPARAM2 mmu_lookup_pagetable(uaecptr addr, bool super, bool write, uae_u32 *status)
 {
        uae_u32 desc, desc_addr, wp;
        int i;
@@ -471,7 +427,11 @@ static uaecptr REGPARAM2 mmu_lookup_pagetable(uaecptr addr, bool super, bool wri
        desc_addr = (desc & MMU_ROOT_PTR_ADDR_MASK) | i;
        desc = phys_get_long(desc_addr);
        if ((desc & 2) == 0) {
-               D(bug(_T("MMU: invalid root descriptor for %lx\n"), addr));
+#if MMUDEBUG > 1
+               write_log(_T("MMU: invalid root descriptor %s for %x desc at %x desc=%x %s at %d\n"), super ? _T("srp"):_T("urp"),
+                               addr,desc_addr,desc,__FILE__,__LINE__);
+#endif
+               *status |= MMU_FSLW_PTA;
                return 0;
        }
 
@@ -484,7 +444,11 @@ static uaecptr REGPARAM2 mmu_lookup_pagetable(uaecptr addr, bool super, bool wri
        desc_addr = (desc & MMU_ROOT_PTR_ADDR_MASK) | i;
        desc = phys_get_long(desc_addr);
        if ((desc & 2) == 0) {
-               D(bug(_T("MMU: invalid ptr descriptor for %lx\n"), addr));
+#if MMUDEBUG > 1
+               write_log(_T("MMU: invalid ptr descriptor %s for %x desc at %x desc=%x %s at %d\n"), super ? _T("srp"):_T("urp"), 
+                               addr,desc_addr,desc,__FILE__,__LINE__);
+#endif
+               *status |= MMU_FSLW_PTB;
                return 0;
        }
        wp |= desc;
@@ -492,12 +456,12 @@ static uaecptr REGPARAM2 mmu_lookup_pagetable(uaecptr addr, bool super, bool wri
                phys_put_long(desc_addr, desc | MMU_DES_USED);
 
        /* fetch page table descriptor */
-       if (regs.mmu_pagesize_8k) {
+       if (mmu_pagesize_8k) {
                i = (addr >> 11) & 0x7c;
-               desc_addr = (desc & MMU_PTR_PAGE_ADDR_MASK_8) | i;
+               desc_addr = (desc & MMU_PTR_PAGE_ADDR_MASK_8) + i;
        } else {
                i = (addr >> 10) & 0xfc;
-               desc_addr = (desc & MMU_PTR_PAGE_ADDR_MASK_4) | i;
+               desc_addr = (desc & MMU_PTR_PAGE_ADDR_MASK_4) + i;
        }
 
        desc = phys_get_long(desc_addr);
@@ -507,7 +471,13 @@ static uaecptr REGPARAM2 mmu_lookup_pagetable(uaecptr addr, bool super, bool wri
                desc = phys_get_long(desc_addr);
        }
        if ((desc & 1) == 0) {
-               D(bug(_T("MMU: invalid page descriptor log=%08lx desc=%08lx @%08lx\n"), addr, desc, desc_addr));
+#if MMUDEBUG > 1
+               write_log(_T("MMU: invalid page descriptor log=%0lx desc=%08x @%08x %s at %d\n"), addr, desc, desc_addr,__FILE__,__LINE__);
+#endif
+               if ((desc & 3) == 2)
+                       *status |= MMU_FSLW_IL;
+               else
+                       *status |= MMU_FSLW_PF;
                return desc;
        }
 
@@ -545,9 +515,10 @@ uae_u16 REGPARAM2 mmu_get_word_unaligned(uaecptr addr, bool data)
        CATCH(prb) {
                RESTORE_EXCEPTION;
                regs.mmu_fault_addr = addr;
+               regs.mmu_fslw |= MMU_FSLW_MA;
                regs.mmu_ssw |= MMU_SSW_MA;
                THROW_AGAIN(prb);
-       }
+       } ENDTRY
        return res;
 }
 
@@ -567,7 +538,7 @@ uae_u32 REGPARAM2 mmu_get_long_unaligned(uaecptr addr, bool data)
                        regs.mmu_fault_addr = addr;
                        regs.mmu_ssw |= MMU_SSW_MA;
                        THROW_AGAIN(prb);
-               }
+               } ENDTRY
        } else {
                res = (uae_u32)mmu_get_byte(addr, data, sz_long) << 8;
                SAVE_EXCEPTION;
@@ -580,9 +551,10 @@ uae_u32 REGPARAM2 mmu_get_long_unaligned(uaecptr addr, bool data)
                CATCH(prb) {
                        RESTORE_EXCEPTION;
                        regs.mmu_fault_addr = addr;
+                       regs.mmu_fslw |= MMU_FSLW_MA;
                        regs.mmu_ssw |= MMU_SSW_MA;
                        THROW_AGAIN(prb);
-               }
+               } ENDTRY
        }
        return res;
 }
@@ -590,57 +562,33 @@ uae_u32 REGPARAM2 mmu_get_long_unaligned(uaecptr addr, bool data)
 uae_u8 REGPARAM2 mmu_get_byte_slow(uaecptr addr, bool super, bool data,
                                                 int size, struct mmu_atc_line *cl)
 {
-       uae_u32 tag = ATC_TAG(addr);
-
-       if (USETAG && cl->tag == (uae_u16)~tag) {
-       redo:
-               if (cl->hw)
-                       return HWget_b(cl->phys + addr);
-               mmu_bus_error(addr, mmu_get_fc(super, data), 0, size);
+       uae_u32 status;
+       if (!mmu_fill_atc_try(addr, super, data, 0, cl, &status)) {
+               mmu_bus_error(addr, mmu_get_fc(super, data), 0, size, status);
                return 0;
        }
-
-       if (!mmu_fill_atc_l1(addr, super, data, 0, cl))
-               goto redo;
-
        return phys_get_byte(mmu_get_real_address(addr, cl));
 }
 
 uae_u16 REGPARAM2 mmu_get_word_slow(uaecptr addr, bool super, bool data,
                                                  int size, struct mmu_atc_line *cl)
 {
-       uae_u32 tag = ATC_TAG(addr);
-
-       if (USETAG && cl->tag == (uae_u16)~tag) {
-       redo:
-               if (cl->hw)
-                       return HWget_w(cl->phys + addr);
-               mmu_bus_error(addr, mmu_get_fc(super, data), 0, size);
+       uae_u32 status;
+       if (!mmu_fill_atc_try(addr, super, data, 0, cl, &status)) {
+               mmu_bus_error(addr, mmu_get_fc(super, data), 0, size, status);
                return 0;
        }
-
-       if (!mmu_fill_atc_l1(addr, super, data, 0, cl))
-               goto redo;
-
        return phys_get_word(mmu_get_real_address(addr, cl));
 }
 
 uae_u32 REGPARAM2 mmu_get_long_slow(uaecptr addr, bool super, bool data,
                                                  int size, struct mmu_atc_line *cl)
 {
-       uae_u32 tag = ATC_TAG(addr);
-
-       if (USETAG && cl->tag == (uae_u16)~tag) {
-       redo:
-               if (cl->hw)
-                       return HWget_l(cl->phys + addr);
-               mmu_bus_error(addr, mmu_get_fc(super, data), 0, size);
+       uae_u32 status;
+       if (!mmu_fill_atc_try(addr, super, data, 0, cl, &status)) {
+               mmu_bus_error(addr, mmu_get_fc(super, data), 0, size, status);
                return 0;
        }
-
-       if (!mmu_fill_atc_l1(addr, super, data, 0, cl))
-               goto redo;
-
        return phys_get_long(mmu_get_real_address(addr, cl));
 }
 
@@ -664,10 +612,11 @@ void REGPARAM2 mmu_put_long_unaligned(uaecptr addr, uae_u32 val, bool data)
                regs.wb3_data = val;
                if (regs.mmu_fault_addr != addr) {
                        regs.mmu_fault_addr = addr;
+                       regs.mmu_fslw |= MMU_FSLW_MA;
                        regs.mmu_ssw |= MMU_SSW_MA;
                }
                THROW_AGAIN(prb);
-       }
+       } ENDTRY
 }
 
 void REGPARAM2 mmu_put_word_unaligned(uaecptr addr, uae_u16 val, bool data)
@@ -683,75 +632,46 @@ void REGPARAM2 mmu_put_word_unaligned(uaecptr addr, uae_u16 val, bool data)
                regs.wb3_data = val;
                if (regs.mmu_fault_addr != addr) {
                        regs.mmu_fault_addr = addr;
+                       regs.mmu_fslw |= MMU_FSLW_MA;
                        regs.mmu_ssw |= MMU_SSW_MA;
                }
                THROW_AGAIN(prb);
-       }
+       } ENDTRY
 }
 
 void REGPARAM2 mmu_put_byte_slow(uaecptr addr, uae_u8 val, bool super, bool data,
                                                                 int size, struct mmu_atc_line *cl)
 {
-       uae_u32 tag = ATC_TAG(addr);
-
-       if (USETAG && cl->tag == (uae_u16)~tag) {
-       redo:
-               if (cl->hw) {
-                       HWput_b(cl->phys + addr, val);
-                       return;
-               }
+       uae_u32 status;
+       if (!mmu_fill_atc_try(addr, super, data, 1, cl, &status)) {
                regs.wb3_data = val;
-               mmu_bus_error(addr, mmu_get_fc(super, data), 1, size);
+               mmu_bus_error(addr, mmu_get_fc(super, data), 1, size, status);
                return;
        }
-
-       if (!mmu_fill_atc_l1(addr, super, data, 1, cl))
-               goto redo;
-
        phys_put_byte(mmu_get_real_address(addr, cl), val);
 }
 
 void REGPARAM2 mmu_put_word_slow(uaecptr addr, uae_u16 val, bool super, bool data,
                                                                 int size, struct mmu_atc_line *cl)
 {
-       uae_u32 tag = ATC_TAG(addr);
-
-       if (USETAG && cl->tag == (uae_u16)~tag) {
-       redo:
-               if (cl->hw) {
-                       HWput_w(cl->phys + addr, val);
-                       return;
-               }
+       uae_u32 status;
+       if (!mmu_fill_atc_try(addr, super, data, 1, cl, &status)) {
                regs.wb3_data = val;
-               mmu_bus_error(addr, mmu_get_fc(super, data), 1, size);
+               mmu_bus_error(addr, mmu_get_fc(super, data), 1, size, status);
                return;
        }
-
-       if (!mmu_fill_atc_l1(addr, super, data, 1, cl))
-               goto redo;
-
        phys_put_word(mmu_get_real_address(addr, cl), val);
 }
 
 void REGPARAM2 mmu_put_long_slow(uaecptr addr, uae_u32 val, bool super, bool data,
                                                                 int size, struct mmu_atc_line *cl)
 {
-       uae_u32 tag = ATC_TAG(addr);
-
-       if (USETAG && cl->tag == (uae_u16)~tag) {
-       redo:
-               if (cl->hw) {
-                       HWput_l(cl->phys + addr, val);
-                       return;
-               }
+       uae_u32 status;
+       if (!mmu_fill_atc_try(addr, super, data, 1, cl, &status)) {
                regs.wb3_data = val;
-               mmu_bus_error(addr, mmu_get_fc(super, data), 1, size);
+               mmu_bus_error(addr, mmu_get_fc(super, data), 1, size, status);
                return;
        }
-
-       if (!mmu_fill_atc_l1(addr, super, data, 1, cl))
-               goto redo;
-
        phys_put_long(mmu_get_real_address(addr, cl), val);
 }
 
@@ -774,9 +694,10 @@ uae_u32 REGPARAM2 sfc_get_long(uaecptr addr)
                CATCH(prb) {
                        RESTORE_EXCEPTION;
                        regs.mmu_fault_addr = addr;
+                       regs.mmu_fslw |= MMU_FSLW_MA;
                        regs.mmu_ssw |= MMU_SSW_MA;
                        THROW_AGAIN(prb);
-               }
+               } ENDTRY
        } else {
                res = (uae_u32)mmu_get_user_byte(addr, super, data, sz_long) << 8;
                SAVE_EXCEPTION;
@@ -789,9 +710,10 @@ uae_u32 REGPARAM2 sfc_get_long(uaecptr addr)
                CATCH(prb) {
                        RESTORE_EXCEPTION;
                        regs.mmu_fault_addr = addr;
+                       regs.mmu_fslw |= MMU_FSLW_MA;
                        regs.mmu_ssw |= MMU_SSW_MA;
                        THROW_AGAIN(prb);
-               }
+               } ENDTRY
        }
        return res;
 }
@@ -814,9 +736,10 @@ uae_u16 REGPARAM2 sfc_get_word(uaecptr addr)
        CATCH(prb) {
                RESTORE_EXCEPTION;
                regs.mmu_fault_addr = addr;
+               regs.mmu_fslw |= MMU_FSLW_MA;
                regs.mmu_ssw |= MMU_SSW_MA;
                THROW_AGAIN(prb);
-       }
+       } ENDTRY
        return res;
 }
 
@@ -853,10 +776,11 @@ void REGPARAM2 dfc_put_long(uaecptr addr, uae_u32 val)
                regs.wb3_data = val;
                if (regs.mmu_fault_addr != addr) {
                        regs.mmu_fault_addr = addr;
+                       regs.mmu_fslw |= MMU_FSLW_MA;
                        regs.mmu_ssw |= MMU_SSW_MA;
                }
                THROW_AGAIN(prb);
-       }
+       } ENDTRY
 }
 
 void REGPARAM2 dfc_put_word(uaecptr addr, uae_u16 val)
@@ -879,10 +803,11 @@ void REGPARAM2 dfc_put_word(uaecptr addr, uae_u16 val)
                regs.wb3_data = val;
                if (regs.mmu_fault_addr != addr) {
                        regs.mmu_fault_addr = addr;
+                       regs.mmu_fslw |= MMU_FSLW_MA;
                        regs.mmu_ssw |= MMU_SSW_MA;
                }
                THROW_AGAIN(prb);
-       }
+       } ENDTRY
 }
 
 void REGPARAM2 dfc_put_byte(uaecptr addr, uae_u8 val)
@@ -899,14 +824,14 @@ void REGPARAM2 dfc_put_byte(uaecptr addr, uae_u8 val)
                RESTORE_EXCEPTION;
                regs.wb3_data = val;
                THROW_AGAIN(prb);
-       }
+       } ENDTRY
 }
 
 void REGPARAM2 mmu_op_real(uae_u32 opcode, uae_u16 extra)
 {
        bool super = (regs.dfc & 4) != 0;
        DUNUSED(extra);
-       if ((opcode & 0xFE0) == 0x0500) {
+       if ((opcode & 0xFE0) == 0x0500) { // PFLUSH
                bool glob;
                int regno;
                //D(didflush = 0);
@@ -916,18 +841,22 @@ void REGPARAM2 mmu_op_real(uae_u32 opcode, uae_u16 extra)
                glob = (opcode & 8) != 0;
 
                if (opcode & 16) {
-                       D(bug(_T("pflusha(%u,%u)\n"), glob, regs.dfc));
+#if MMUDEBUG > 1
+                       write_log(_T("pflusha(%u,%u)\n"), glob, regs.dfc);
+#endif
                        mmu_flush_atc_all(glob);
                } else {
                        addr = m68k_areg(regs, regno);
-                       D(bug(_T("pflush(%u,%u,%x)\n"), glob, regs.dfc, addr));
+#if MMUDEBUG > 1
+                       write_log(_T("pflush(%u,%u,%x)\n"), glob, regs.dfc, addr);
+#endif
                        mmu_flush_atc(addr, super, glob);
                }
                flush_internals();
 #ifdef USE_JIT
                flush_icache(0);
 #endif
-       } else if ((opcode & 0x0FD8) == 0x548) {
+       } else if ((opcode & 0x0FD8) == 0x0548) { // PTEST (68040)
                bool write;
                int regno;
                uae_u32 addr;
@@ -935,7 +864,9 @@ void REGPARAM2 mmu_op_real(uae_u32 opcode, uae_u16 extra)
                regno = opcode & 7;
                write = (opcode & 32) == 0;
                addr = m68k_areg(regs, regno);
-               D(bug(_T("PTEST%c (A%d) %08x DFC=%d\n"), write ? 'W' : 'R', regno, addr, regs.dfc));
+#if MMUDEBUG > 1
+               write_log(_T("PTEST%c (A%d) %08x DFC=%d\n"), write ? 'W' : 'R', regno, addr, regs.dfc);
+#endif
                mmu_flush_atc(addr, super, true);
                SAVE_EXCEPTION;
                TRY(prb) {
@@ -943,107 +874,182 @@ void REGPARAM2 mmu_op_real(uae_u32 opcode, uae_u16 extra)
                        uae_u32 desc;
                        bool data = (regs.dfc & 3) != 2;
 
-                       l = &atc_l2[super ? 1 : 0][ATC_L2_INDEX(addr)];
-                       desc = mmu_fill_atc_l2(addr, super, data, write, l);
-                       if (!(data ? l->valid_data : l->valid_inst))
-                               regs.mmusr = MMU_MMUSR_B;
-                       else if (l->tt)
+                       if (mmu_match_ttr(addr,super,data)!=TTR_NO_MATCH) 
                                regs.mmusr = MMU_MMUSR_T | MMU_MMUSR_R;
                        else {
-                               regs.mmusr = desc & (~0xfff|MMU_MMUSR_G|MMU_MMUSR_Ux|MMU_MMUSR_S|
-                                                                        MMU_MMUSR_CM|MMU_MMUSR_M|MMU_MMUSR_W);
-                               regs.mmusr |= MMU_MMUSR_R;
+                               uae_u32 status;
+                               mmu_user_lookup(addr, super, data, write, &l);
+                               desc = mmu_fill_atc(addr, super, data, write, l, &status);
+                               if (!(l->valid))
+                                       regs.mmusr = MMU_MMUSR_B;
+                               else {
+                                       regs.mmusr = desc & (~0xfff|MMU_MMUSR_G|MMU_MMUSR_Ux|MMU_MMUSR_S|
+                                                                                MMU_MMUSR_CM|MMU_MMUSR_M|MMU_MMUSR_W);
+                                       regs.mmusr |= MMU_MMUSR_R;
+                               }
                        }
                }
                CATCH(prb) {
                        regs.mmusr = MMU_MMUSR_B;
-               }
+               } ENDTRY
                RESTORE_EXCEPTION;
-               D(bug(_T("PTEST result: mmusr %08x\n"), regs.mmusr));
-       } else
+#if MMUDEBUG > 1
+               write_log(_T("PTEST result: mmusr %08x\n"), regs.mmusr);
+#endif
+       } else if ((opcode & 0xFFB8) == 0xF588) { // PLPA (68060)
+               int write = (opcode & 0x40) == 0;
+               int regno = opcode & 7;
+               uae_u32 addr = m68k_areg (regs, regno);
+               bool data = (regs.dfc & 3) != 2;
+
+#if MMUDEBUG > 1
+               write_log(_T("PLPA%c param: %08x\n"), write ? 'W' : 'R', addr);
+#endif
+               if (mmu_match_ttr(addr,super,data)==TTR_NO_MATCH) {
+                       m68k_areg (regs, regno) = mmu_translate (addr, super, data, write != 0);
+               }
+#if MMUDEBUG > 1
+               write_log(_T("PLPA%c result: %08x\n"), write ? 'W' : 'R', m68k_areg (regs, regno));
+#endif
+       } else {
                op_illg (opcode);
+       }
 }
 
-static void REGPARAM2 mmu_flush_atc(uaecptr addr, bool super, bool global)
+// fixme : global parameter?
+void REGPARAM2 mmu_flush_atc(uaecptr addr, bool super, bool global)
 {
-       struct mmu_atc_line *l;
-       int i, j;
-
-       l = atc_l1[super ? 1 : 0][0][0];
-       i = ATC_L1_INDEX(addr);
-       for (j = 0; j < 4; j++) {
-               if (global || !l[i].global)
-                       l[i].tag = 0x8000;
-               l += ATC_L1_SIZE;
-       }
-       if (regs.mmu_pagesize_8k) {
-               i = ATC_L1_INDEX(addr) ^ 1;
-               for (j = 0; j < 4; j++) {
-                       if (global || !l[i].global)
-                               l[i].tag = 0x8000;
-                       l += ATC_L1_SIZE;
+       int way,type,index;
+
+       uaecptr tag = (mmu_is_super | (addr >> 1)) & mmu_tagmask;
+       if (mmu_pagesize_8k)
+               index=(addr & 0x0001E000)>>13;
+       else
+               index=(addr & 0x0000F000)>>12;
+       for (type=0;type<ATC_TYPE;type++)
+       for (way=0;way<ATC_WAYS;way++) {
+               if (!global && mmu_atc_array[type][way][index].global)
+                       continue;
+               // if we have this 
+               if ((tag == mmu_atc_array[type][way][index].tag) && (mmu_atc_array[type][way][index].valid)) {
+                       mmu_atc_array[type][way][index].valid=false;
                }
-       }
-       l = atc_l2[super ? 1 : 0];
-       i = ATC_L2_INDEX(addr);
-       if (global || !l[i].global)
-               l[i].tag = 0x8000;
-       if (regs.mmu_pagesize_8k) {
-               i ^= 1;
-               if (global || !l[i].global)
-                       l[i].tag = 0x8000;
-       }
+       }       
 }
 
-static void REGPARAM2 mmu_flush_atc_all(bool global)
+void REGPARAM2 mmu_flush_atc_all(bool global)
 {
-       struct mmu_atc_line *l;
-       unsigned int i;
-
-       l = atc_l1[0][0][0];
-       for (i = 0; i < sizeof(atc_l1) / sizeof(*l); l++, i++) {
-               if (global || !l->global)
-                       l->tag = 0x8000;
-       }
-
-       l = atc_l2[0];
-       for (i = 0; i < sizeof(atc_l2) / sizeof(*l); l++, i++) {
-               if (global || !l->global)
-                       l->tag = 0x8000;
+       unsigned int way,slot,type;
+       for (type=0;type<ATC_TYPE;type++) 
+       for (way=0;way<ATC_WAYS;way++) 
+       for (slot=0;slot<ATC_SLOTS;slot++) {
+               if (!global && mmu_atc_array[type][way][slot].global)
+                       continue;
+               mmu_atc_array[type][way][slot].valid=false;
        }
 }
 
 void REGPARAM2 mmu_reset(void)
 {
        mmu_flush_atc_all(true);
-#if 0
-       regs.urp = regs.srp = 0;
-       regs.itt0 = regs.itt1 = 0;
-       regs.dtt0 = regs.dtt1 = 0;
-       regs.mmusr = 0;
-#endif
 }
 
 
 void REGPARAM2 mmu_set_tc(uae_u16 tc)
 {
-#if 0
-       if (regs.tcr == tc)
-               return;
-       regs.tcr = tc;
-#endif
-       regs.mmu_enabled = tc & 0x8000 ? 1 : 0;
-       regs.mmu_pagesize_8k = tc & 0x4000 ? 1 : 0;
+       regs.mmu_enabled = (tc & 0x8000) != 0;
+       mmu_pagesize_8k = (tc & 0x4000) != 0;
+       mmu_tagmask = mmu_pagesize_8k ? 0xFFFF0000 : 0xFFFF8000;
+       mmu_pagemask = mmu_pagesize_8k ? 0x00001FFF : 0x00000FFF;
+       regs.mmu_page_size = mmu_pagesize_8k ? 8192 : 4096;
+
        mmu_flush_atc_all(true);
 
-       write_log(_T("MMU: enabled=%d page8k=%d\n"), regs.mmu_enabled, regs.mmu_pagesize_8k);
+       write_log(_T("%d MMU: enabled=%d page8k=%d\n"), currprefs.mmu_model, regs.mmu_enabled, mmu_pagesize_8k);
 }
 
 void REGPARAM2 mmu_set_super(bool super)
 {
-       current_atc = &atc_l1[super ? 1 : 0];
+       mmu_is_super = super ? 0x80000000 : 0;
+}
+
+void m68k_do_rte_mmu040 (uaecptr a7)
+{
+       uae_u16 ssr = get_word_mmu040 (a7 + 8 + 4);
+       if (ssr & MMU_SSW_CT) {
+               uaecptr src_a7 = a7 + 8 - 8;
+               uaecptr dst_a7 = a7 + 8 + 52;
+               put_word_mmu040 (dst_a7 + 0, get_word_mmu040 (src_a7 + 0));
+               put_long_mmu040 (dst_a7 + 2, get_long_mmu040 (src_a7 + 2));
+               // skip this word
+               put_long_mmu040 (dst_a7 + 8, get_long_mmu040 (src_a7 + 8));
+       }
 }
 
+void flush_mmu040 (uaecptr addr, int n)
+{
+}
+void m68k_do_rts_mmu040 (void)
+{
+       m68k_setpc (get_long_mmu040 (m68k_areg (regs, 7)));
+       m68k_areg (regs, 7) += 4;
+}
+void m68k_do_bsr_mmu040 (uaecptr oldpc, uae_s32 offset)
+{
+       put_long_mmu040 (m68k_areg (regs, 7) - 4, oldpc);
+       m68k_areg (regs, 7) -= 4;
+       m68k_incpci (offset);
+}
+
+void flush_mmu060 (uaecptr addr, int n)
+{
+}
+void m68k_do_rts_mmu060 (void)
+{
+       m68k_setpc (get_long_mmu060 (m68k_areg (regs, 7)));
+       m68k_areg (regs, 7) += 4;
+}
+void m68k_do_bsr_mmu060 (uaecptr oldpc, uae_s32 offset)
+{
+       put_long_mmu060 (m68k_areg (regs, 7) - 4, oldpc);
+       m68k_areg (regs, 7) -= 4;
+       m68k_incpci (offset);
+}
+
+#ifndef __cplusplus
+jmp_buf __exbuf;
+int     __exvalue;
+#define MAX_TRY_STACK 256
+static int s_try_stack_size=0;
+static jmp_buf s_try_stack[MAX_TRY_STACK];
+jmp_buf* __poptry(void) {
+       if (s_try_stack_size>0) {
+        s_try_stack_size--;
+        if (s_try_stack_size == 0)
+            return NULL;
+        memcpy(&__exbuf,&s_try_stack[s_try_stack_size-1],sizeof(jmp_buf));
+        // fprintf(stderr,"pop jmpbuf=%08x\n",s_try_stack[s_try_stack_size][0]);
+        return &s_try_stack[s_try_stack_size-1];
+    }
+       else {
+               fprintf(stderr,"try stack underflow...\n");
+           // return (NULL);
+               abort();
+       }
+}
+void __pushtry(jmp_buf* j) {
+       if (s_try_stack_size<MAX_TRY_STACK) {
+               // fprintf(stderr,"push jmpbuf=%08x\n",(*j)[0]);
+               memcpy(&s_try_stack[s_try_stack_size],j,sizeof(jmp_buf));
+               s_try_stack_size++;
+       } else {
+               fprintf(stderr,"try stack overflow...\n");
+               abort();
+       }
+}
+int __is_catched(void) {return (s_try_stack_size>0); }
+#endif
+
 #else
 
 void mmu_op(uae_u32 opcode, uae_u16 /*extra*/)
@@ -1059,6 +1065,7 @@ void mmu_op(uae_u32 opcode, uae_u16 /*extra*/)
 
 #endif
 
+
 /*
 vim:ts=4:sw=4:
 */
diff --git a/cpummu30.cpp b/cpummu30.cpp
new file mode 100644 (file)
index 0000000..584cc25
--- /dev/null
@@ -0,0 +1,2099 @@
+/* Emulation of MC68030 MMU
+ * This code has been written for Previous - a NeXT Computer emulator
+ *
+ * This file is distributed under the GNU General Public License, version 2
+ * or at your option any later version. Read the file gpl.txt for details.
+ *
+ *
+ * Written by Andreas Grabher
+ *
+ * Many thanks go to Thomas Huth and the Hatari community for helping
+ * to test and debug this code!
+ *
+ *
+ * Release notes:
+ * 01-09-2012: First release
+ * 29-09-2012: Improved function code handling
+ * 16-11-2012: Improved exception handling
+ *
+ *
+ * - Check if read-modify-write operations are correctly detected for
+ *   handling transparent access (see TT matching functions)
+ * - If possible, test mmu030_table_search with all kinds of translations
+ *   (early termination, invalid descriptors, bus errors, indirect
+ *   descriptors, PTEST in different levels, etc).
+ * - Check which bits of an ATC entry should be set and which should be
+ *   un-set, if an invalid translation occurs.
+ * - Handle cache inhibit bit when accessing ATC entries
+ */
+
+
+#include "sysconfig.h"
+#include "sysdeps.h"
+
+#include "options.h"
+#include "memory.h"
+#include "newcpu.h"
+#include "cpummu030.h"
+
+#define MMU030_OP_DBG_MSG 0
+#define MMU030_ATC_DBG_MSG 0
+#define MMU030_REG_DBG_MSG 0
+
+static int bBusErrorReadWrite;
+static int atcindextable[32];
+
+int mmu030_idx;
+
+uae_u32 mm030_stageb_address;
+bool mmu030_retry;
+int mmu030_opcode;
+int mmu030_opcode_stageb;
+uae_u16 mmu030_state[3];
+uae_u32 mmu030_data_buffer;
+uae_u32 mmu030_disp_store[2];
+struct mmu030_access mmu030_ad[MAX_MMU030_ACCESS];
+
+/* for debugging messages */
+char table_letter[4] = {'A','B','C','D'};
+
+uae_u64 srp_030, crp_030;
+uae_u32 tt0_030, tt1_030, tc_030;
+uae_u16 mmusr_030;
+
+/* ATC struct */
+#define ATC030_NUM_ENTRIES  22
+
+typedef struct {
+    struct {
+        uaecptr addr;
+        bool modified;
+        bool write_protect;
+        bool cache_inhibit;
+        bool bus_error;
+    } physical;
+    
+    struct {
+        uaecptr addr;
+        uae_u32 fc;
+        bool valid;
+    } logical;
+    /* history bit */
+    int mru;
+} MMU030_ATC_LINE;
+
+
+/* MMU struct for 68030 */
+struct {
+    
+    /* Translation tables */
+    struct {
+        struct {
+            uae_u32 mask;
+            uae_u8 shift;
+        } table[4];
+        
+        struct {
+            uae_u32 mask;
+                       uae_u32 imask;
+            uae_u8 size;
+        } page;
+        
+        uae_u8 init_shift;
+        uae_u8 last_table;
+    } translation;
+    
+    /* Transparent translation */
+    struct {
+        TT_info tt0;
+        TT_info tt1;
+    } transparent;
+    
+    /* Address translation cache */
+    MMU030_ATC_LINE atc[ATC030_NUM_ENTRIES];
+    
+    /* Condition */
+    bool enabled;
+    uae_u16 status;
+} mmu030;
+
+
+
+/* MMU Status Register
+ *
+ * ---x ---x x-xx x---
+ * reserved (all 0)
+ *
+ * x--- ---- ---- ----
+ * bus error
+ *
+ * -x-- ---- ---- ----
+ * limit violation
+ *
+ * --x- ---- ---- ----
+ * supervisor only
+ *
+ * ---- x--- ---- ----
+ * write protected
+ *
+ * ---- -x-- ---- ----
+ * invalid
+ *
+ * ---- --x- ---- ----
+ * modified
+ *
+ * ---- ---- -x-- ----
+ * transparent access
+ *
+ * ---- ---- ---- -xxx
+ * number of levels (number of tables accessed during search)
+ *
+ */
+
+#define MMUSR_BUS_ERROR         0x8000
+#define MMUSR_LIMIT_VIOLATION   0x4000
+#define MMUSR_SUPER_VIOLATION   0x2000
+#define MMUSR_WRITE_PROTECTED   0x0800
+#define MMUSR_INVALID           0x0400
+#define MMUSR_MODIFIED          0x0200
+#define MMUSR_TRANSP_ACCESS     0x0040
+#define MMUSR_NUM_LEVELS_MASK   0x0007
+
+
+
+/* -- MMU instructions -- */
+
+void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
+{
+       int preg = (next >> 10) & 31;
+       int rw = (next >> 9) & 1;
+       int fd = (next >> 8) & 1;
+    
+#if MMU030_OP_DBG_MSG
+    switch (preg) {
+        case 0x10:
+            write_log(_T("PMOVE: %s TC %08X\n"), rw?"read":"write",
+                      rw?tc_030:x_get_long(extra));
+            break;
+        case 0x12:
+            write_log(_T("PMOVE: %s SRP %08X%08X\n"), rw?"read":"write",
+                      rw?(uae_u32)(srp_030>>32)&0xFFFFFFFF:x_get_long(extra),
+                      rw?(uae_u32)srp_030&0xFFFFFFFF:x_get_long(extra+4));
+            break;
+        case 0x13:
+            write_log(_T("PMOVE: %s CRP %08X%08X\n"), rw?"read":"write",
+                      rw?(uae_u32)(crp_030>>32)&0xFFFFFFFF:x_get_long(extra),
+                      rw?(uae_u32)crp_030&0xFFFFFFFF:x_get_long(extra+4));
+            break;
+        case 0x18:
+            write_log(_T("PMOVE: %s MMUSR %04X\n"), rw?"read":"write",
+                      rw?mmusr_030:x_get_word(extra));
+            break;
+        case 0x02:
+            write_log(_T("PMOVE: %s TT0 %08X\n"), rw?"read":"write",
+                      rw?tt0_030:x_get_long(extra));
+            break;
+        case 0x03:
+            write_log(_T("PMOVE: %s TT1 %08X\n"), rw?"read":"write",
+                      rw?tt1_030:x_get_long(extra));
+            break;
+        default:
+            break;
+    }
+    if (!fd && !rw && !(preg==0x18)) {
+        write_log(_T("PMOVE: flush ATC\n"));
+    }
+#endif
+    
+       switch (preg)
+       {
+        case 0x10: // TC
+            if (rw)
+                x_put_long (extra, tc_030);
+            else {
+                tc_030 = x_get_long (extra);
+                mmu030_decode_tc(tc_030);
+            }
+            break;
+        case 0x12: // SRP
+            if (rw) {
+                x_put_long (extra, srp_030 >> 32);
+                x_put_long (extra + 4, srp_030);
+            } else {
+                srp_030 = (uae_u64)x_get_long (extra) << 32;
+                srp_030 |= x_get_long (extra + 4);
+                mmu030_decode_rp(srp_030);
+            }
+            break;
+        case 0x13: // CRP
+            if (rw) {
+                x_put_long (extra, crp_030 >> 32);
+                x_put_long (extra + 4, crp_030);
+            } else {
+                crp_030 = (uae_u64)x_get_long (extra) << 32;
+                crp_030 |= x_get_long (extra + 4);
+                mmu030_decode_rp(crp_030);
+            }
+            break;
+        case 0x18: // MMUSR
+            if (rw)
+                x_put_word (extra, mmusr_030);
+            else
+                mmusr_030 = x_get_word (extra);
+            break;
+        case 0x02: // TT0
+            if (rw)
+                x_put_long (extra, tt0_030);
+            else {
+                tt0_030 = x_get_long (extra);
+                mmu030.transparent.tt0 = mmu030_decode_tt(tt0_030);
+            }
+            break;
+        case 0x03: // TT1
+            if (rw)
+                x_put_long (extra, tt1_030);
+            else {
+                tt1_030 = x_get_long (extra);
+                mmu030.transparent.tt1 = mmu030_decode_tt(tt1_030);
+            }
+            break;
+        default:
+            write_log (_T("Bad PMOVE at %08x\n"),m68k_getpc());
+            op_illg (opcode);
+            return;
+       }
+    
+    if (!fd && !rw && !(preg==0x18)) {
+        mmu030_flush_atc_all();
+    }
+}
+
+void mmu_op30_ptest (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
+{
+    mmu030.status = mmusr_030 = 0;
+    
+    int level = (next&0x1C00)>>10;
+    int rw = (next >> 9) & 1;
+    int a = (next >> 8) & 1;
+    int areg = (next&0xE0)>>5;
+    uae_u32 fc = mmu_op30_helper_get_fc(next);
+        
+    bool write = rw ? false : true;
+
+    uae_u32 ret = 0;
+    
+    /* Check this - datasheet says:
+     * "When the instruction specifies an address translation cache search
+     *  with an address register operand, the MC68030 takes an F-line
+     *  unimplemented instruction exception."
+     */
+    if (!level && a) { /* correct ? */
+        write_log(_T("PTEST: Bad instruction causing F-line unimplemented instruction exception!\n"));
+        Exception(11); /* F-line unimplemented instruction exception */
+        return;
+    }
+        
+#if MMU030_OP_DBG_MSG
+    write_log(_T("PTEST%c: addr = %08X, fc = %i, level = %i, "),
+              rw?'R':'W', extra, fc, level);
+    if (a) {
+        write_log(_T("return descriptor to register A%i\n"), areg);
+    } else {
+        write_log(_T("do not return descriptor\n"));
+    }
+#endif
+    
+    if (!level) {
+        mmu030_ptest_atc_search(extra, fc, write);
+    } else {
+        ret = mmu030_ptest_table_search(extra, fc, write, level);
+        if (a) {
+            m68k_areg (regs, areg) = ret;
+        }
+    }
+    mmusr_030 = mmu030.status;
+    
+#if MMU030_OP_DBG_MSG
+    write_log(_T("PTEST status: %04X, B = %i, L = %i, S = %i, W = %i, I = %i, M = %i, T = %i, N = %i\n"),
+              mmusr_030, (mmusr_030&MMUSR_BUS_ERROR)?1:0, (mmusr_030&MMUSR_LIMIT_VIOLATION)?1:0,
+              (mmusr_030&MMUSR_SUPER_VIOLATION)?1:0, (mmusr_030&MMUSR_WRITE_PROTECTED)?1:0,
+              (mmusr_030&MMUSR_INVALID)?1:0, (mmusr_030&MMUSR_MODIFIED)?1:0,
+              (mmusr_030&MMUSR_TRANSP_ACCESS)?1:0, mmusr_030&MMUSR_NUM_LEVELS_MASK);
+#endif
+}
+
+void mmu_op30_pload (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
+{
+    int rw = (next >> 9) & 1;
+    uae_u32 fc = mmu_op30_helper_get_fc(next);
+    
+    bool write = rw ? false : true;
+
+#if MMU030_OP_DBG_MSG
+    write_log (_T("PLOAD%c: Create ATC entry for %08X, FC = %i\n"), write?'W':'R', extra, fc);
+#endif
+
+    mmu030_flush_atc_page(extra);
+    mmu030_table_search(extra, fc, write, 0);
+}
+
+void mmu_op30_pflush (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
+{
+    uae_u16 mode = (next&0x1C00)>>10;
+    uae_u32 fc_mask = (uae_u32)(next&0x00E0)>>5;
+    uae_u32 fc_base = mmu_op30_helper_get_fc(next);
+    
+#if MMU030_OP_DBG_MSG
+    switch (mode) {
+        case 0x1:
+            write_log(_T("PFLUSH: Flush all entries\n"));
+            break;
+        case 0x4:
+            write_log(_T("PFLUSH: Flush by function code only\n"));
+            write_log(_T("PFLUSH: function code: base = %08X, mask = %08X\n"), fc_base, fc_mask);
+            break;
+        case 0x6:
+            write_log(_T("PFLUSH: Flush by function code and effective address\n"));
+            write_log(_T("PFLUSH: function code: base = %08X, mask = %08X\n"), fc_base, fc_mask);
+            write_log(_T("PFLUSH: effective address = %08X\n"), extra);
+            break;
+        default:
+            break;
+    }
+#endif
+    
+    switch (mode) {
+        case 0x1:
+            mmu030_flush_atc_all();
+            break;
+        case 0x4:
+            mmu030_flush_atc_fc(fc_base, fc_mask);
+            break;
+        case 0x6:
+            mmu030_flush_atc_page_fc(extra, fc_base, fc_mask);
+            break;
+            
+        default:
+            write_log(_T("PFLUSH ERROR: bad mode! (%i)\n"),mode);
+            break;
+    }
+}
+
+/* -- Helper function for MMU instructions -- */
+uae_u32 mmu_op30_helper_get_fc(uae_u16 next) {
+    switch (next&0x0018) {
+        case 0x0010:
+            return (next&0x7);
+        case 0x0008:
+            return (m68k_dreg(regs, next&0x7)&0x7);
+        case 0x0000:
+            if (next&1) {
+                return (regs.dfc&0x7);
+            } else {
+                return (regs.sfc&0x7);
+            }
+        default:
+            write_log(_T("MMU_OP30 ERROR: bad fc source! (%04X)\n"),next&0x0018);
+            return 0;
+    }
+}
+
+
+/* -- ATC flushing functions -- */
+
+/* This function flushes ATC entries depending on their function code */
+void mmu030_flush_atc_fc(uae_u32 fc_base, uae_u32 fc_mask) {
+    int i;
+    for (i=0; i<ATC030_NUM_ENTRIES; i++) {
+        if (((fc_base&fc_mask)==(mmu030.atc[i].logical.fc&fc_mask)) &&
+            mmu030.atc[i].logical.valid) {
+            mmu030.atc[i].logical.valid = false;
+#if MMU030_OP_DBG_MSG
+            write_log(_T("ATC: Flushing %08X\n"), mmu030.atc[i].physical.addr);
+#endif
+               }
+    }
+}
+
+/* This function flushes ATC entries depending on their logical address
+ * and their function code */
+void mmu030_flush_atc_page_fc(uaecptr logical_addr, uae_u32 fc_base, uae_u32 fc_mask) {
+    int i;
+    for (i=0; i<ATC030_NUM_ENTRIES; i++) {
+        if (((fc_base&fc_mask)==(mmu030.atc[i].logical.fc&fc_mask)) &&
+            (mmu030.atc[i].logical.addr == logical_addr) &&
+            mmu030.atc[i].logical.valid) {
+            mmu030.atc[i].logical.valid = false;
+#if MMU030_OP_DBG_MSG
+            write_log(_T("ATC: Flushing %08X\n"), mmu030.atc[i].physical.addr);
+#endif
+               }
+    }
+}
+
+/* This function flushes ATC entries depending on their logical address */
+void mmu030_flush_atc_page(uaecptr logical_addr) {
+    int i;
+    for (i=0; i<ATC030_NUM_ENTRIES; i++) {
+        if ((mmu030.atc[i].logical.addr == logical_addr) &&
+            mmu030.atc[i].logical.valid) {
+            mmu030.atc[i].logical.valid = false;
+#if MMU030_OP_DBG_MSG
+            write_log(_T("ATC: Flushing %08X\n"), mmu030.atc[i].physical.addr);
+#endif
+               }
+    }
+}
+
+/* This function flushes all ATC entries */
+void mmu030_flush_atc_all(void) {
+#if MMU030_OP_DBG_MSG
+       write_log(_T("ATC: Flushing all entries\n"));
+#endif
+       int i;
+    for (i=0; i<ATC030_NUM_ENTRIES; i++) {
+        mmu030.atc[i].logical.valid = false;
+    }
+}
+
+
+/* Transparent Translation Registers (TT0 and TT1)
+ *
+ * ---- ---- ---- ---- -xxx x--- x--- x---
+ * reserved, must be 0
+ *
+ * ---- ---- ---- ---- ---- ---- ---- -xxx
+ * function code mask (FC bits to be ignored)
+ *
+ * ---- ---- ---- ---- ---- ---- -xxx ----
+ * function code base (FC value for transparent block)
+ *
+ * ---- ---- ---- ---- ---- ---x ---- ----
+ * 0 = r/w field used, 1 = read and write is transparently translated
+ *
+ * ---- ---- ---- ---- ---- --x- ---- ----
+ * r/w field: 0 = write ..., 1 = read access transparent
+ *
+ * ---- ---- ---- ---- ---- -x-- ---- ----
+ * cache inhibit: 0 = caching allowed, 1 = caching inhibited
+ *
+ * ---- ---- ---- ---- x--- ---- ---- ----
+ * 0 = transparent translation enabled disabled, 1 = enabled
+ *
+ * ---- ---- xxxx xxxx ---- ---- ---- ----
+ * logical address mask
+ *
+ * xxxx xxxx ---- ---- ---- ---- ---- ----
+ * logical address base
+ *
+ */
+
+
+#define TT_FC_MASK      0x00000007
+#define TT_FC_BASE      0x00000070
+#define TT_RWM          0x00000100
+#define TT_RW           0x00000200
+#define TT_CI           0x00000400
+#define TT_ENABLE       0x00008000
+
+#define TT_ADDR_MASK    0x00FF0000
+#define TT_ADDR_BASE    0xFF000000
+
+/* TT comparision results */
+#define TT_NO_MATCH    0x1
+#define TT_OK_MATCH    0x2
+#define TT_NO_READ  0x4
+#define TT_NO_WRITE    0x8
+
+TT_info mmu030_decode_tt(uae_u32 TT) {
+    
+    TT_info ret;
+
+    ret.fc_mask = ~((TT&TT_FC_MASK)|0xFFFFFFF8);
+    ret.fc_base = (TT&TT_FC_BASE)>>4;
+    ret.addr_base = TT & TT_ADDR_BASE;
+    ret.addr_mask = ~(((TT&TT_ADDR_MASK)<<8)|0x00FFFFFF);
+    
+    if ((TT&TT_ENABLE) && !(TT&TT_RWM)) {
+        write_log(_T("MMU Warning: Transparent translation of read-modify-write cycle is not correctly handled!\n"));
+    }
+    
+#if MMU030_REG_DBG_MSG /* enable or disable debugging messages */
+    write_log(_T("\n"));
+    write_log(_T("TRANSPARENT TRANSLATION: %08X\n"), TT);
+    write_log(_T("\n"));
+    
+    write_log(_T("TT: transparent translation "));
+    if (TT&TT_ENABLE) {
+        write_log(_T("enabled\n"));
+    } else {
+        write_log(_T("disabled\n"));
+        return ret;
+    }
+
+    write_log(_T("TT: caching %s\n"), (TT&TT_CI) ? _T("inhibited") : _T("enabled"));
+    write_log(_T("TT: read-modify-write "));
+    if (TT&TT_RWM) {
+        write_log(_T("enabled\n"));
+    } else {
+        write_log(_T("disabled (%s only)\n"), (TT&TT_RW) ? _T("read") : _T("write"));
+    }
+    write_log(_T("\n"));
+    write_log(_T("TT: function code base: %08X\n"), ret.fc_base);
+    write_log(_T("TT: function code mask: %08X\n"), ret.fc_mask);
+    write_log(_T("\n"));
+    write_log(_T("TT: address base: %08X\n"), ret.addr_base);
+    write_log(_T("TT: address mask: %08X\n"), ret.addr_mask);
+    write_log(_T("\n"));
+#endif
+    
+    return ret;
+}
+
+/* This function compares the address with both transparent
+ * translation registers and returns the result */
+int mmu030_match_ttr(uaecptr addr, uae_u32 fc, bool write)
+{
+    int tt0, tt1;
+
+    bool cache_inhibit = false; /* TODO: pass to memory access function */
+    
+    tt0 = mmu030_do_match_ttr(tt0_030, mmu030.transparent.tt0, addr, fc, write);
+    if (tt0&TT_OK_MATCH) {
+        cache_inhibit = (tt0_030&TT_CI) ? true : false;
+    }
+    tt1 = mmu030_do_match_ttr(tt1_030, mmu030.transparent.tt1, addr, fc, write);
+    if (tt1&TT_OK_MATCH) {
+        if (!cache_inhibit) {
+            cache_inhibit = (tt1_030&TT_CI) ? true : false;
+        }
+    }
+    
+    return (tt0|tt1);
+}
+
+/* This function checks if an address matches a transparent
+ * translation register */
+
+/* FIXME:
+ * If !(tt&TT_RMW) neither the read nor the write portion
+ * of a read-modify-write cycle is transparently translated! */
+
+int mmu030_do_match_ttr(uae_u32 tt, TT_info comp, uaecptr addr, uae_u32 fc, bool write)
+{
+       if (tt & TT_ENABLE)     {       /* transparent translation enabled */
+        
+        /* Compare actual function code with function code base using mask */
+        if ((comp.fc_base&comp.fc_mask)==(fc&comp.fc_mask)) {
+            
+            /* Compare actual address with address base using mask */
+            if ((comp.addr_base&comp.addr_mask)==(addr&comp.addr_mask)) {
+                
+                if (tt&TT_RWM) {  /* r/w field disabled */
+                    return TT_OK_MATCH;
+                } else {
+                    if (tt&TT_RW) { /* read access transparent */
+                        return write ? TT_NO_WRITE : TT_OK_MATCH;
+                    } else {        /* write access transparent */
+                        return write ? TT_OK_MATCH : TT_NO_READ; /* TODO: check this! */
+                    }
+                }
+            }
+               }
+       }
+       return TT_NO_MATCH;
+}
+
+
+
+/* Translation Control Register:
+ *
+ * x--- ---- ---- ---- ---- ---- ---- ----
+ * translation: 1 = enable, 0 = disable
+ *
+ * ---- --x- ---- ---- ---- ---- ---- ----
+ * supervisor root: 1 = enable, 0 = disable
+ *
+ * ---- ---x ---- ---- ---- ---- ---- ----
+ * function code lookup: 1 = enable, 0 = disable
+ *
+ * ---- ---- xxxx ---- ---- ---- ---- ----
+ * page size:
+ * 1000 = 256 bytes
+ * 1001 = 512 bytes
+ * 1010 =  1 kB
+ * 1011 =  2 kB
+ * 1100 =  4 kB
+ * 1101 =  8 kB
+ * 1110 = 16 kB
+ * 1111 = 32 kB
+ *
+ * ---- ---- ---- xxxx ---- ---- ---- ----
+ * initial shift
+ *
+ * ---- ---- ---- ---- xxxx ---- ---- ----
+ * number of bits for table index A
+ *
+ * ---- ---- ---- ---- ---- xxxx ---- ----
+ * number of bits for table index B
+ *
+ * ---- ---- ---- ---- ---- ---- xxxx ----
+ * number of bits for table index C
+ *
+ * ---- ---- ---- ---- ---- ----- ---- xxxx
+ * number of bits for table index D
+ *
+ */
+
+
+#define TC_ENABLE_TRANSLATION   0x80000000
+#define TC_ENABLE_SUPERVISOR    0x02000000
+#define TC_ENABLE_FCL           0x01000000
+
+#define TC_PS_MASK              0x00F00000
+#define TC_IS_MASK              0x000F0000
+
+#define TC_TIA_MASK             0x0000F000
+#define TC_TIB_MASK             0x00000F00
+#define TC_TIC_MASK             0x000000F0
+#define TC_TID_MASK             0x0000000F
+
+
+void mmu030_decode_tc(uae_u32 TC) {
+        
+    /* Set MMU condition */    
+    if (TC & TC_ENABLE_TRANSLATION) {
+        mmu030.enabled = true;
+    } else {
+               if (mmu030.enabled)
+                       write_log(_T("MMU disabled\n"));
+        mmu030.enabled = false;
+        return;
+    }
+    
+    /* Note: 0 = Table A, 1 = Table B, 2 = Table C, 3 = Table D */
+    int i, j;
+    uae_u8 TI_bits[4] = {0,0,0,0};
+
+    /* Reset variables before extracting new values from TC */
+    for (i = 0; i < 4; i++) {
+        mmu030.translation.table[i].mask = 0;
+        mmu030.translation.table[i].shift = 0;
+    }
+    
+    
+    /* Extract initial shift and page size values from TC register */
+    mmu030.translation.page.size = (TC & TC_PS_MASK) >> 20;
+    mmu030.translation.init_shift = (TC & TC_IS_MASK) >> 16;
+       regs.mmu_page_size = 1 << mmu030.translation.page.size;
+
+    
+       write_log(_T("68030 MMU enabled. Page size = %d\n"), regs.mmu_page_size);
+
+       if (mmu030.translation.page.size<8) {
+        write_log(_T("MMU Configuration Exception: Bad value in TC register! (bad page size: %i byte)\n"),
+                  1<<mmu030.translation.page.size);
+        Exception(56); /* MMU Configuration Exception */
+        return;
+    }
+       mmu030.translation.page.mask = regs.mmu_page_size - 1;
+       mmu030.translation.page.imask = ~mmu030.translation.page.mask;
+    
+    /* Calculate masks and shifts for later extracting table indices
+     * from logical addresses using: index = (addr&mask)>>shift */
+    
+    /* Get number of bits for each table index */
+    for (i = 0; i < 4; i++) {
+        j = (3-i)*4;
+        TI_bits[i] = (TC >> j) & 0xF;
+    }
+
+    /* Calculate masks and shifts for each table */
+    mmu030.translation.last_table = 0;
+    uae_u8 shift = 32 - mmu030.translation.init_shift;
+    for (i = 0; (i < 4) && TI_bits[i]; i++) {
+        /* Get the shift */
+        shift -= TI_bits[i];
+        mmu030.translation.table[i].shift = shift;
+        /* Build the mask */
+        for (j = 0; j < TI_bits[i]; j++) {
+            mmu030.translation.table[i].mask |= (1<<(mmu030.translation.table[i].shift + j));
+        }
+        /* Update until reaching the last table */
+        mmu030.translation.last_table = i;
+    }
+    
+#if MMU030_REG_DBG_MSG
+    /* At least one table has to be defined using at least
+     * 1 bit for the index. At least 2 bits are necessary 
+     * if there is no second table. If these conditions are
+     * not met, it will automatically lead to a sum <32
+     * and cause an exception (see below). */
+    if (!TI_bits[0]) {
+        write_log(_T("MMU Configuration Exception: Bad value in TC register! (no first table index defined)\n"));
+    } else if ((TI_bits[0]<2) && !TI_bits[1]) {
+        write_log(_T("MMU Configuration Exception: Bad value in TC register! (no second table index defined and)\n"));
+        write_log(_T("MMU Configuration Exception: Bad value in TC register! (only 1 bit for first table index)\n"));
+    }
+#endif
+    
+    /* TI fields are summed up until a zero field is reached (see above
+     * loop). The sum of all TI field values plus page size and initial
+     * shift has to be 32: IS + PS + TIA + TIB + TIC + TID = 32 */
+    if ((shift-mmu030.translation.page.size)!=0) {
+        write_log(_T("MMU Configuration Exception: Bad value in TC register! (bad sum)\n"));
+        Exception(56); /* MMU Configuration Exception */
+        return;
+    }
+    
+#if MMU030_REG_DBG_MSG /* enable or disable debugging output */
+    write_log(_T("\n"));
+    write_log(_T("TRANSLATION CONTROL: %08X\n"), TC);
+    write_log(_T("\n"));
+    write_log(_T("TC: translation %s\n"), (TC&TC_ENABLE_TRANSLATION ? _T("enabled") : _T("disabled")));
+    write_log(_T("TC: supervisor root pointer %s\n"), (TC&TC_ENABLE_SUPERVISOR ? _T("enabled") : _T("disabled")));
+    write_log(_T("TC: function code lookup %s\n"), (TC&TC_ENABLE_FCL ? _T("enabled") : _T("disabled")));
+    write_log(_T("\n"));
+    
+    write_log(_T("TC: Initial Shift: %i\n"), mmu030.translation.init_shift);
+    write_log(_T("TC: Page Size: %i byte\n"), (1<<mmu030.translation.page.size));
+    write_log(_T("\n"));
+    
+    for (i = 0; i <= mmu030.translation.last_table; i++) {
+        write_log(_T("TC: Table %c: mask = %08X, shift = %i\n"), table_letter[i], mmu030.translation.table[i].mask, mmu030.translation.table[i].shift);
+    }
+
+    write_log(_T("TC: Page:    mask = %08X\n"), mmu030.translation.page.mask);
+    write_log(_T("\n"));
+
+    write_log(_T("TC: Last Table: %c\n"), table_letter[mmu030.translation.last_table]);
+    write_log(_T("\n"));
+#endif
+}
+
+
+
+/* Root Pointer Registers (SRP and CRP)
+ *
+ * ---- ---- ---- ---- xxxx xxxx xxxx xx-- ---- ---- ---- ---- ---- ---- ---- xxxx
+ * reserved, must be 0
+ *
+ * ---- ---- ---- ---- ---- ---- ---- ---- xxxx xxxx xxxx xxxx xxxx xxxx xxxx ----
+ * table A address
+ *
+ * ---- ---- ---- ---- ---- ---- ---- --xx ---- ---- ---- ---- ---- ---- ---- ----
+ * descriptor type
+ *
+ * -xxx xxxx xxxx xxxx ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
+ * limit
+ *
+ * x--- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
+ * 0 = upper limit, 1 = lower limit
+ *
+ */
+
+
+#define RP_ADDR_MASK    (UVAL64(0x00000000FFFFFFF0))
+#define RP_DESCR_MASK   (UVAL64(0x0000000300000000))
+#define RP_LIMIT_MASK   (UVAL64(0x7FFF000000000000))
+#define RP_LOWER_MASK   (UVAL64(0x8000000000000000))
+
+#define RP_ZERO_BITS 0x0000FFFC /* These bits in upper longword of RP must be 0 */
+
+void mmu030_decode_rp(uae_u64 RP) {
+    
+    uae_u8 descriptor_type = (RP & RP_DESCR_MASK) >> 32;
+    if (!descriptor_type) { /* If descriptor type is invalid */
+        write_log(_T("MMU Configuration Exception: Root Pointer is invalid!\n"));
+        Exception(56); /* MMU Configuration Exception */
+    }
+
+#if MMU030_REG_DBG_MSG /* enable or disable debugging output */
+    uae_u32 table_limit = (RP & RP_LIMIT_MASK) >> 48;
+    uae_u32 first_addr = (RP & RP_ADDR_MASK);
+    
+    write_log(_T("\n"));
+    write_log(_T("ROOT POINTER: %08X%08X\n"), (uae_u32)(RP>>32)&0xFFFFFFFF, (uae_u32)(RP&0xFFFFFFFF));
+    write_log(_T("\n"));
+    
+    write_log(_T("RP: descriptor type = %i "), descriptor_type);
+    switch (descriptor_type) {
+        case 0:
+            write_log(_T("(invalid descriptor)\n"));
+            break;
+        case 1:
+            write_log(_T("(early termination page descriptor)\n"));
+            break;
+        case 2:
+            write_log(_T("(valid 4 byte descriptor)\n"));
+            break;
+        case 3:
+            write_log(_T("(valid 8 byte descriptor)\n"));
+            break;
+    }
+    
+    write_log(_T("RP: %s limit = %i\n"), (RP&RP_LOWER_MASK) ? _T("lower") : _T("upper"), table_limit);
+    
+    write_log(_T("RP: first table address = %08X\n"), first_addr);
+    write_log(_T("\n"));
+#endif
+}
+
+
+
+/* Descriptors */
+
+#define DESCR_TYPE_MASK         0x00000003
+
+#define DESCR_TYPE_INVALID      0 /* all tables */
+
+#define DESCR_TYPE_EARLY_TERM   1 /* all but lowest level table */
+#define DESCR_TYPE_PAGE         1 /* only lowest level table */
+#define DESCR_TYPE_VALID4       2 /* all but lowest level table */
+#define DESCR_TYPE_INDIRECT4    2 /* only lowest level table */
+#define DESCR_TYPE_VALID8       3 /* all but lowest level table */
+#define DESCR_TYPE_INDIRECT8    3 /* only lowest level table */
+
+#define DESCR_TYPE_VALID_MASK       0x2 /* all but lowest level table */
+#define DESCR_TYPE_INDIRECT_MASK    0x2 /* only lowest level table */
+
+
+/* Short format (4 byte):
+ *
+ * ---- ---- ---- ---- ---- ---- ---- --xx
+ * descriptor type:
+ * 0 = invalid
+ * 1 = page descriptor (early termination)
+ * 2 = valid (4 byte)
+ * 3 = valid (8 byte)
+ *
+ *
+ * table descriptor:
+ * ---- ---- ---- ---- ---- ---- ---- -x--
+ * write protect
+ *
+ * ---- ---- ---- ---- ---- ---- ---- x---
+ * update
+ *
+ * xxxx xxxx xxxx xxxx xxxx xxxx xxxx ----
+ * table address
+ *
+ *
+ * (early termination) page descriptor:
+ * ---- ---- ---- ---- ---- ---- ---- -x--
+ * write protect
+ *
+ * ---- ---- ---- ---- ---- ---- ---- x---
+ * update
+ *
+ * ---- ---- ---- ---- ---- ---- ---x ----
+ * modified
+ *
+ * ---- ---- ---- ---- ---- ---- -x-- ----
+ * cache inhibit
+ *
+ * ---- ---- ---- ---- ---- ---- x-x- ----
+ * reserved (must be 0)
+ *
+ * xxxx xxxx xxxx xxxx xxxx xxxx ---- ----
+ * page address
+ *
+ *
+ * indirect descriptor:
+ * xxxx xxxx xxxx xxxx xxxx xxxx xxxx xx--
+ * descriptor address
+ *
+ */
+
+#define DESCR_WP       0x00000004
+#define DESCR_U        0x00000008
+#define DESCR_M        0x00000010 /* only last level table */
+#define DESCR_CI       0x00000040 /* only last level table */
+
+#define DESCR_TD_ADDR_MASK 0xFFFFFFF0
+#define DESCR_PD_ADDR_MASK 0xFFFFFF00
+#define DESCR_ID_ADDR_MASK 0xFFFFFFFC
+
+
+/* Long format (8 byte):
+ *
+ * ---- ---- ---- ---- ---- ---- ---- --xx | ---- ---- ---- ---- ---- ---- ---- ----
+ * descriptor type:
+ * 0 = invalid
+ * 1 = page descriptor (early termination)
+ * 2 = valid (4 byte)
+ * 3 = valid (8 byte)
+ *
+ *
+ * table desctriptor:
+ * ---- ---- ---- ---- ---- ---- ---- -x-- | ---- ---- ---- ---- ---- ---- ---- ----
+ * write protect
+ *
+ * ---- ---- ---- ---- ---- ---- ---- x--- | ---- ---- ---- ---- ---- ---- ---- ----
+ * update
+ *
+ * ---- ---- ---- ---- ---- ---- xxxx ---- | ---- ---- ---- ---- ---- ---- ---- ----
+ * reserved (must be 0)
+ *
+ * ---- ---- ---- ---- ---- ---x ---- ---- | ---- ---- ---- ---- ---- ---- ---- ----
+ * supervisor
+ *
+ * ---- ---- ---- ---- xxxx xxx- ---- ---- | ---- ---- ---- ---- ---- ---- ---- ----
+ * reserved (must be 1111 110)
+ *
+ * -xxx xxxx xxxx xxxx ---- ---- ---- ---- | ---- ---- ---- ---- ---- ---- ---- ----
+ * limit
+ *
+ * x--- ---- ---- ---- ---- ---- ---- ---- | ---- ---- ---- ---- ---- ---- ---- ----
+ * 0 = upper limit, 1 = lower limit
+ *
+ * ---- ---- ---- ---- ---- ---- ---- ---- | xxxx xxxx xxxx xxxx xxxx xxxx xxxx ----
+ * table address
+ *
+ *
+ * (early termination) page descriptor:
+ * ---- ---- ---- ---- ---- ---- ---- -x-- | ---- ---- ---- ---- ---- ---- ---- ----
+ * write protect
+ *
+ * ---- ---- ---- ---- ---- ---- ---- x--- | ---- ---- ---- ---- ---- ---- ---- ----
+ * update
+ *
+ * ---- ---- ---- ---- ---- ---- ---x ---- | ---- ---- ---- ---- ---- ---- ---- ----
+ * modified
+ *
+ * ---- ---- ---- ---- ---- ---- -x-- ---- | ---- ---- ---- ---- ---- ---- ---- ----
+ * cache inhibit
+ *
+ * ---- ---- ---- ---- ---- ---x ---- ---- | ---- ---- ---- ---- ---- ---- ---- ----
+ * supervisor
+ *
+ * ---- ---- ---- ---- ---- ---- x-x- ---- | ---- ---- ---- ---- ---- ---- ---- ----
+ * reserved (must be 0)
+ *
+ * ---- ---- ---- ---- xxxx xxx- ---- ---- | ---- ---- ---- ---- ---- ---- ---- ----
+ * reserved (must be 1111 110)
+ *
+ * -xxx xxxx xxxx xxxx ---- ---- ---- ---- | ---- ---- ---- ---- ---- ---- ---- ----
+ * limit (only used with early termination page decriptor)
+ *
+ * x--- ---- ---- ---- ---- ---- ---- ---- | ---- ---- ---- ---- ---- ---- ---- ----
+ * 0 = upper limit, 1 = lower limit (only used with early termination page descriptor)
+ *
+ * ---- ---- ---- ---- ---- ---- ---- ---- | xxxx xxxx xxxx xxxx xxxx xxxx ---- ----
+ * page address
+ *
+ *
+ * indirect descriptor:
+ * ---- ---- ---- ---- ---- ---- ---- ---- | xxxx xxxx xxxx xxxx xxxx xxxx xxxx xx--
+ * descriptor address
+ *
+ */
+
+/* only for long descriptors */
+#define DESCR_S        0x00000100
+
+#define DESCR_LIMIT_MASK   0x7FFF0000
+#define DESCR_LOWER_MASK   0x80000000
+
+
+
+/* This functions searches through the translation tables. It can be used 
+ * for PTEST (levels 1 to 7). Using level 0 creates an ATC entry. */
+
+uae_u32 mmu030_table_search(uaecptr addr, uae_u32 fc, bool write, int level) {
+        /* During table walk up to 7 different descriptors are used:
+         * root pointer, descriptors fetched from function code lookup table,
+         * tables A, B, C and D and one indirect descriptor */
+        uae_u32 descr[2];
+        uae_u32 descr_type;
+        uaecptr descr_addr[7];
+        uaecptr table_addr = 0;
+        uaecptr page_addr = 0;
+        uaecptr indirect_addr = 0;
+        uae_u32 table_index = 0;
+        uae_u32 limit = 0;
+        uae_u32 unused_fields_mask = 0;
+        bool super = (fc&4) ? true : false;
+        bool write_protect = false;
+        bool cache_inhibit = false;
+        bool descr_modified = false;
+        
+        mmu030.status = 0; /* Reset status */
+        
+        /* Initial values for condition variables.
+         * Note: Root pointer is long descriptor. */
+        int t = 0;
+        int addr_position = 1;
+        int next_size = 0;
+        int descr_size = 8;
+        int descr_num = 0;
+        bool early_termination = false;
+        
+        int i;
+    
+    TRY(prb) {
+        /* Use super user root pointer if enabled in TC register and access is in
+         * super user mode, else use cpu root pointer. */
+        if ((tc_030&TC_ENABLE_SUPERVISOR) && super) {
+            descr[0] = (srp_030>>32)&0xFFFFFFFF;
+            descr[1] = srp_030&0xFFFFFFFF;
+#if MMU030_REG_DBG_MSG
+            write_log(_T("Supervisor Root Pointer: %08X%08X\n"),descr[0],descr[1]);
+#endif // MMU030_REG_DBG_MSG
+        } else {
+            descr[0] = (crp_030>>32)&0xFFFFFFFF;
+            descr[1] = crp_030&0xFFFFFFFF;
+#if MMU030_REG_DBG_MSG
+            write_log(_T("CPU Root Pointer: %08X%08X\n"),descr[0],descr[1]);
+#endif
+               }
+                
+        if (descr[0]&RP_ZERO_BITS) {
+#if MMU030_REG_DBG_MSG
+                       write_log(_T("MMU Warning: Root pointer reserved bits are non-zero! %08X\n"), descr[0]);
+#endif
+                       descr[0] &= (~RP_ZERO_BITS);
+        }
+        
+        /* Check descriptor type of root pointer */
+        descr_type = descr[0]&DESCR_TYPE_MASK;
+        switch (descr_type) {
+            case DESCR_TYPE_INVALID:
+                write_log(_T("Fatal error: Root pointer is invalid descriptor!\n"));
+                mmu030.status |= MMUSR_INVALID;
+                goto stop_search;
+            case DESCR_TYPE_EARLY_TERM:
+                write_log(_T("Root pointer is early termination page descriptor.\n"));
+                early_termination = true;
+                goto handle_page_descriptor;
+            case DESCR_TYPE_VALID4:
+                next_size = 4;
+                break;
+            case DESCR_TYPE_VALID8:
+                next_size = 8;
+                break;
+        }
+        
+        /* If function code lookup is enabled in TC register use function code as
+         * index for top level table, limit check not required */
+        
+        if (tc_030&TC_ENABLE_FCL) {
+            write_log(_T("Function code lookup enabled, FC = %i\n"), fc);
+            
+            addr_position = (descr_size==4) ? 0 : 1;
+            table_addr = descr[addr_position]&DESCR_TD_ADDR_MASK;
+            table_index = fc; /* table index is function code */
+            write_log(_T("Table FCL at %08X: index = %i, "),table_addr,table_index);
+            
+            /* Fetch next descriptor */
+            descr_num++;
+            descr_addr[descr_num] = table_addr+(table_index*next_size);
+            
+            if (next_size==4) {
+                descr[0] = phys_get_long(descr_addr[descr_num]);
+#if MMU030_REG_DBG_MSG
+                write_log(_T("Next descriptor: %08X\n"),descr[0]);
+#endif
+            } else {
+                descr[0] = phys_get_long(descr_addr[descr_num]);
+                descr[1] = phys_get_long(descr_addr[descr_num]+4);
+#if MMU030_REG_DBG_MSG
+                write_log(_T("Next descriptor: %08X%08X\n"),descr[0],descr[1]);
+#endif
+            }
+            
+            descr_size = next_size;
+            
+            /* Check descriptor type */
+            descr_type = descr[0]&DESCR_TYPE_MASK;
+            switch (descr_type) {
+                case DESCR_TYPE_INVALID:
+                    write_log(_T("Invalid descriptor!\n"));
+                    /* stop table walk */
+                    mmu030.status |= MMUSR_INVALID;
+                    goto stop_search;
+                case DESCR_TYPE_EARLY_TERM:
+#if MMU030_REG_DBG_MSG
+                    write_log(_T("Early termination page descriptor!\n"));
+#endif
+                                       early_termination = true;
+                    goto handle_page_descriptor;
+                case DESCR_TYPE_VALID4:
+                    next_size = 4;
+                    break;
+                case DESCR_TYPE_VALID8:
+                    next_size = 8;
+                    break;
+            }
+        }
+        
+        
+        /* Upper level tables */
+        do {
+            if (descr_num) { /* if not root pointer */
+                /* Set the updated bit */
+                if (!level && !(descr[0]&DESCR_U) && !(mmu030.status&MMUSR_SUPER_VIOLATION)) {
+                    descr[0] |= DESCR_U;
+                    phys_put_long(descr_addr[descr_num], descr[0]);
+                }
+                /* Update status bits */
+                if (descr_size==8) {
+                    if (descr[0]&DESCR_S)
+                        mmu030.status |= super ? 0 : MMUSR_SUPER_VIOLATION;
+                }
+                if (descr[0]&DESCR_WP) {
+                    mmu030.status |= (descr[0]&DESCR_WP) ? MMUSR_WRITE_PROTECTED : 0;
+                    write_protect = true;
+                }
+                
+                /* Check if ptest level is reached */
+                if (level && (level==descr_num)) {
+                    goto stop_search;
+                }
+            }
+            
+            addr_position = (descr_size==4) ? 0 : 1;
+            table_addr = descr[addr_position]&DESCR_TD_ADDR_MASK;
+            table_index = (addr&mmu030.translation.table[t].mask)>>mmu030.translation.table[t].shift;
+#if MMU030_REG_DBG_MSG
+            write_log(_T("Table %c at %08X: index = %i, "),table_letter[t],table_addr,table_index);
+#endif // MMU030_REG_DBG_MSG
+            t++; /* Proceed to the next table */
+            
+            /* Perform limit check */
+            if (descr_size==8) {
+                limit = (descr[0]&DESCR_LIMIT_MASK)>>16;
+                if ((descr[0]&DESCR_LOWER_MASK) && (table_index<limit)) {
+                    mmu030.status |= (MMUSR_LIMIT_VIOLATION|MMUSR_INVALID);
+                    write_log(_T("limit violation (lower limit %i)\n"),limit);
+                    goto stop_search;
+                }
+                if (!(descr[0]&DESCR_LOWER_MASK) && (table_index>limit)) {
+                    mmu030.status |= (MMUSR_LIMIT_VIOLATION|MMUSR_INVALID);
+                    write_log(_T("limit violation (upper limit %i)\n"),limit);
+                    goto stop_search;
+                }
+            }
+            
+            /* Fetch next descriptor */
+            descr_num++;
+            descr_addr[descr_num] = table_addr+(table_index*next_size);
+            
+            if (next_size==4) {
+                descr[0] = phys_get_long(descr_addr[descr_num]);
+#if MMU030_REG_DBG_MSG
+                write_log(_T("Next descriptor: %08X\n"),descr[0]);
+#endif
+            } else {
+                descr[0] = phys_get_long(descr_addr[descr_num]);
+                descr[1] = phys_get_long(descr_addr[descr_num]+4);
+#if MMU030_REG_DBG_MSG
+                write_log(_T("Next descriptor: %08X%08X\n"),descr[0],descr[1]);
+#endif
+            }
+            
+            descr_size = next_size;
+            
+            /* Check descriptor type */
+            descr_type = descr[0]&DESCR_TYPE_MASK;
+            switch (descr_type) {
+                case DESCR_TYPE_INVALID:
+#if MMU030_REG_DBG_MSG
+                    write_log(_T("Invalid descriptor!\n"));
+#endif
+                                       /* stop table walk */
+                    mmu030.status |= MMUSR_INVALID;
+                    goto stop_search;
+                case DESCR_TYPE_EARLY_TERM:
+                    /* go to last level table handling code */
+                    if (t<=mmu030.translation.last_table) {
+#if MMU030_REG_DBG_MSG
+                        write_log(_T("Early termination page descriptor!\n"));
+#endif
+                                               early_termination = true;
+                    }
+                    goto handle_page_descriptor;
+                case DESCR_TYPE_VALID4:
+                    next_size = 4;
+                    break;
+                case DESCR_TYPE_VALID8:
+                    next_size = 8;
+                    break;
+            }
+        } while (t<=mmu030.translation.last_table);
+        
+        
+        /* Handle indirect descriptor */
+        
+        /* Check if ptest level is reached */
+        if (level && (level==descr_num)) {
+            goto stop_search;
+        }
+        
+        addr_position = (descr_size==4) ? 0 : 1;
+        indirect_addr = descr[addr_position]&DESCR_ID_ADDR_MASK;
+#if MMU030_REG_DBG_MSG
+        write_log(_T("Page indirect descriptor at %08X: "),indirect_addr);
+#endif
+
+        /* Fetch indirect descriptor */
+        descr_num++;
+        descr_addr[descr_num] = indirect_addr;
+        
+        if (next_size==4) {
+            descr[0] = phys_get_long(descr_addr[descr_num]);
+#if MMU030_REG_DBG_MSG
+            write_log(_T("descr = %08X\n"),descr[0]);
+#endif
+               } else {
+            descr[0] = phys_get_long(descr_addr[descr_num]);
+            descr[1] = phys_get_long(descr_addr[descr_num]+4);
+#if MMU030_REG_DBG_MSG
+            write_log(_T("descr = %08X%08X"),descr[0],descr[1]);
+#endif
+               }
+        
+        descr_size = next_size;
+        
+        /* Check descriptor type, only page descriptor is valid */
+        descr_type = descr[0]&DESCR_TYPE_MASK;
+        if (descr_type!=DESCR_TYPE_PAGE) {
+            mmu030.status |= MMUSR_INVALID;
+            goto stop_search;
+        }
+        
+    handle_page_descriptor:
+        
+        if (descr_num) { /* if not root pointer */
+            if (!level && !(mmu030.status&MMUSR_SUPER_VIOLATION)) {
+                /* set modified bit */
+                if (!(descr[0]&DESCR_M) && write && !(mmu030.status&MMUSR_WRITE_PROTECTED)) {
+                    descr[0] |= DESCR_M;
+                    descr_modified = true;
+                }
+                /* set updated bit */
+                if (!(descr[0]&DESCR_U)) {
+                    descr[0] |= DESCR_U;
+                    descr_modified = true;
+                }
+                /* write modified descriptor if neccessary */
+                if (descr_modified) {
+                    phys_put_long(descr_addr[descr_num], descr[0]);
+                }
+            }
+            
+            if ((descr_size==8) && (descr[0]&DESCR_S)) {
+                mmu030.status |= super ? 0 : MMUSR_SUPER_VIOLATION;
+            }
+            
+            /* check if caching is inhibited */
+            cache_inhibit = descr[0]&DESCR_CI ? true : false;
+            
+            /* check write protection */
+            if (descr[0]&DESCR_WP) {
+                mmu030.status |= (descr[0]&DESCR_WP) ? MMUSR_WRITE_PROTECTED : 0;
+                write_protect = true;
+            }
+            /* TODO: check if this is handled at correct point (maybe before updating descr?) */
+            mmu030.status |= (descr[0]&DESCR_M) ? MMUSR_MODIFIED : 0;
+        }
+        
+        /* Check limit using next index field of logical address.
+         * Limit is only checked on early termination. If we are
+         * still at root pointer level, only check limit, if FCL
+         * is disabled. */
+        if (early_termination) {
+            if (descr_num || !(tc_030&TC_ENABLE_FCL)) {
+                if (descr_size==8) {
+                    table_index = (addr&mmu030.translation.table[t].mask)>>mmu030.translation.table[t].shift;
+                    limit = (descr[0]&DESCR_LIMIT_MASK)>>16;
+                    if ((descr[0]&DESCR_LOWER_MASK) && (table_index<limit)) {
+                        mmu030.status |= (MMUSR_LIMIT_VIOLATION|MMUSR_INVALID);
+                        write_log(_T("Limit violation (lower limit %i)\n"),limit);
+                        goto stop_search;
+                    }
+                    if (!(descr[0]&DESCR_LOWER_MASK) && (table_index>limit)) {
+                        mmu030.status |= (MMUSR_LIMIT_VIOLATION|MMUSR_INVALID);
+                        write_log(_T("Limit violation (upper limit %i)\n"),limit);
+                        goto stop_search;
+                    }
+                }
+            }
+            /* Get all unused bits of the logical address table index field.
+             * they are added to the page address */
+            /* TODO: They should be added via "unsigned addition". How to? */
+            do {
+                unused_fields_mask |= mmu030.translation.table[t].mask;
+                t++;
+            } while (t<=mmu030.translation.last_table);
+            page_addr = addr&unused_fields_mask;
+#if MMU030_REG_DBG_MSG
+            write_log(_T("Logical address unused bits: %08X (mask = %08X)\n"),
+                      page_addr,unused_fields_mask);
+#endif
+               }
+
+        /* Get page address */
+        addr_position = (descr_size==4) ? 0 : 1;
+        page_addr += (descr[addr_position]&DESCR_PD_ADDR_MASK);
+#if MMU030_REG_DBG_MSG
+        write_log(_T("Page at %08X\n"),page_addr);
+#endif // MMU030_REG_DBG_MSG
+        
+    stop_search:
+        ; /* Make compiler happy */
+    } CATCH(prb) {
+        /* We jump to this place, if a bus error occured during table search.
+         * bBusErrorReadWrite is set in m68000.c, M68000_BusError: read = 1 */
+        if (bBusErrorReadWrite) {
+            descr_num--;
+        }
+        mmu030.status |= (MMUSR_BUS_ERROR|MMUSR_INVALID);
+        write_log(_T("MMU: Bus error while %s descriptor!\n"),
+                  bBusErrorReadWrite?_T("reading"):_T("writing"));
+    } ENDTRY
+    
+    /* check if we have to handle ptest */
+    if (level) {
+        if (mmu030.status&MMUSR_INVALID) {
+            /* these bits are undefined, if the I bit is set: */
+            mmu030.status &= ~(MMUSR_WRITE_PROTECTED|MMUSR_MODIFIED|MMUSR_SUPER_VIOLATION);
+        }
+        mmu030.status = (mmu030.status&~MMUSR_NUM_LEVELS_MASK) | descr_num;
+
+        /* If root pointer is page descriptor (descr_num 0), return 0 */
+        return descr_num ? descr_addr[descr_num] : 0;
+    }
+    
+    /* Find an ATC entry to replace */
+    /* Search for invalid entry */
+    for (i=0; i<ATC030_NUM_ENTRIES; i++) {
+        if (!mmu030.atc[i].logical.valid) {
+            break;
+        }
+    }
+    /* If there are no invalid entries, replace first entry
+     * with history bit not set */
+    if (i == ATC030_NUM_ENTRIES) {
+        for (i=0; i<ATC030_NUM_ENTRIES; i++) {
+            if (!mmu030.atc[i].mru) {
+                break;
+            }
+        }
+#if MMU030_REG_DBG_MSG
+        write_log(_T("ATC is full. Replacing entry %i\n"), i);
+#endif
+       }
+    mmu030_atc_handle_history_bit(i);
+    
+    /* Create ATC entry */
+    mmu030.atc[i].logical.addr = addr & mmu030.translation.page.imask; /* delete page index bits */
+    mmu030.atc[i].logical.fc = fc;
+    mmu030.atc[i].logical.valid = true;
+    mmu030.atc[i].physical.addr = page_addr & mmu030.translation.page.imask; /* delete page index bits */
+    if ((mmu030.status&MMUSR_INVALID) || (mmu030.status&MMUSR_SUPER_VIOLATION)) {
+        mmu030.atc[i].physical.bus_error = true;
+    } else {
+        mmu030.atc[i].physical.bus_error = false;
+    }
+    if (write && !(mmu030.status&MMUSR_SUPER_VIOLATION) && !(mmu030.status&MMUSR_LIMIT_VIOLATION)) {
+        mmu030.atc[i].physical.modified = true;
+    } else {
+        mmu030.atc[i].physical.modified = false;
+    }
+    mmu030.atc[i].physical.cache_inhibit = cache_inhibit;
+    mmu030.atc[i].physical.write_protect = write_protect;
+
+#if MMU030_ATC_DBG_MSG    
+    write_log(_T("ATC create entry(%i): logical = %08X, physical = %08X, FC = %i\n"), i,
+              mmu030.atc[i].logical.addr, mmu030.atc[i].physical.addr,
+              mmu030.atc[i].logical.fc);
+    write_log(_T("ATC create entry(%i): B = %i, CI = %i, WP = %i, M = %i\n"), i,
+              mmu030.atc[i].physical.bus_error?1:0,
+              mmu030.atc[i].physical.cache_inhibit?1:0,
+              mmu030.atc[i].physical.write_protect?1:0,
+              mmu030.atc[i].physical.modified?1:0);
+#endif // MMU030_ATC_DBG_MSG
+    
+    return 0;
+}
+
+/* This function is used for PTEST level 0. */
+void mmu030_ptest_atc_search(uaecptr logical_addr, uae_u32 fc, bool write) {
+    int i;
+    mmu030.status = 0;
+        
+    if (mmu030_match_ttr(logical_addr, fc, write)&TT_OK_MATCH) {
+        mmu030.status |= MMUSR_TRANSP_ACCESS;
+        return;
+    }
+    
+    for (i = 0; i < ATC030_NUM_ENTRIES; i++) {
+        if ((mmu030.atc[i].logical.fc == fc) &&
+            (mmu030.atc[i].logical.addr == logical_addr) &&
+            mmu030.atc[i].logical.valid) {
+            break;
+        }
+    }
+    
+    if (i==ATC030_NUM_ENTRIES) {
+        mmu030.status |= MMUSR_INVALID;
+        return;
+    }
+    
+    mmu030.status |= mmu030.atc[i].physical.bus_error ? (MMUSR_BUS_ERROR|MMUSR_INVALID) : 0;
+    mmu030.status |= mmu030.atc[i].physical.write_protect ? MMUSR_WRITE_PROTECTED : 0;
+    mmu030.status |= mmu030.atc[i].physical.modified ? MMUSR_MODIFIED : 0;
+    if (mmu030.status&MMUSR_INVALID) {
+        mmu030.status &= ~(MMUSR_WRITE_PROTECTED|MMUSR_MODIFIED);
+    }
+}
+
+/* This function is used for PTEST level 1 - 7. */
+uae_u32 mmu030_ptest_table_search(uaecptr logical_addr, uae_u32 fc, bool write, int level) {
+    if (mmu030_match_ttr(logical_addr, fc, write)&TT_OK_MATCH) {
+        return 0;
+    } else {
+        return mmu030_table_search(logical_addr, fc, write, level);
+    }
+}
+
+
+/* Address Translation Cache
+ *
+ * The ATC uses a pseudo-least-recently-used algorithm to keep track of
+ * least recently used entries. They are replaced if the cache is full.
+ * An internal history-bit (MRU-bit) is used to identify these entries.
+ * If an entry is accessed, its history-bit is set to 1. If after that
+ * there are no more entries with zero-bits, all other history-bits are
+ * set to 0. When no more invalid entries are in the ATC, the first entry
+ * with a zero-bit is replaced.
+ *
+ *
+ * Logical Portion (28 bit):
+ * oooo ---- xxxx xxxx xxxx xxxx xxxx xxxx
+ * logical address (most significant 24 bit)
+ *
+ * oooo -xxx ---- ---- ---- ---- ---- ----
+ * function code
+ *
+ * oooo x--- ---- ---- ---- ---- ---- ----
+ * valid
+ *
+ *
+ * Physical Portion (28 bit):
+ * oooo ---- xxxx xxxx xxxx xxxx xxxx xxxx
+ * physical address
+ *
+ * oooo ---x ---- ---- ---- ---- ---- ----
+ * modified
+ *
+ * oooo --x- ---- ---- ---- ---- ---- ----
+ * write protect
+ *
+ * oooo -x-- ---- ---- ---- ---- ---- ----
+ * cache inhibit
+ *
+ * oooo x--- ---- ---- ---- ---- ---- ----
+ * bus error
+ *
+ */
+
+#define ATC030_MASK         0x0FFFFFFF
+#define ATC030_ADDR_MASK    0x00FFFFFF /* after masking shift 8 (<< 8) */
+
+#define ATC030_LOG_FC   0x07000000
+#define ATC030_LOG_V    0x08000000
+
+#define ATC030_PHYS_M   0x01000000
+#define ATC030_PHYS_WP  0x02000000
+#define ATC030_PHYS_CI  0x04000000
+#define ATC030_PHYS_BE  0x08000000
+
+void mmu030_page_fault(uaecptr addr, bool read, int size, uae_u32 fc) {
+       regs.mmu_fault_addr = addr;
+       regs.mmu_ssw = (fc & 1) ? MMU030_SSW_DF | (MMU030_SSW_DF << 1) : (MMU030_SSW_FB | MMU030_SSW_RB);
+       regs.mmu_ssw |= read ? MMU030_SSW_RW : 0;
+       regs.mmu_ssw |= size;
+       regs.mmu_ssw |= fc;
+    bBusErrorReadWrite = read; 
+       mm030_stageb_address = addr;
+#if 1
+       write_log(_T("MMU: page fault (logical addr=%08X SSW=%04x read=%d size=%d fc=%d pc=%08x)\n"),
+               addr, regs.mmu_ssw, read, (size & MMU030_SSW_SIZE_B) ? 1 : (size & MMU030_SSW_SIZE_W) ? 2 : 4, fc, regs.instruction_pc);
+#endif
+       THROW(2);
+}
+
+void mmu030_put_long_atc(uaecptr addr, uae_u32 val, int l, uae_u32 fc) {
+    uae_u32 page_index = addr & mmu030.translation.page.mask;
+    uae_u32 addr_mask = mmu030.translation.page.imask;
+    
+    uae_u32 physical_addr = mmu030.atc[l].physical.addr&addr_mask;
+#if MMU030_ATC_DBG_MSG
+    write_log(_T("ATC match(%i): page addr = %08X, index = %08X (lput %08X)\n"),
+              l, physical_addr, page_index, val);
+#endif
+    physical_addr += page_index;
+    
+    if (mmu030.atc[l].physical.bus_error || mmu030.atc[l].physical.write_protect) {
+        mmu030_page_fault(addr, 0, MMU030_SSW_SIZE_L, fc);
+        return;
+    }
+
+    phys_put_long(physical_addr, val);
+}
+
+void mmu030_put_word_atc(uaecptr addr, uae_u16 val, int l, uae_u32 fc) {
+    uae_u32 page_index = addr & mmu030.translation.page.mask;
+    uae_u32 addr_mask = mmu030.translation.page.imask;
+    
+    uae_u32 physical_addr = mmu030.atc[l].physical.addr&addr_mask;
+#if MMU030_ATC_DBG_MSG
+    write_log(_T("ATC match(%i): page addr = %08X, index = %08X (wput %04X)\n"),
+              l, physical_addr, page_index, val);
+#endif
+    physical_addr += page_index;
+    
+    if (mmu030.atc[l].physical.bus_error || mmu030.atc[l].physical.write_protect) {
+        mmu030_page_fault(addr, 0, MMU030_SSW_SIZE_W, fc);
+        return;
+    }
+
+    phys_put_word(physical_addr, val);
+}
+
+void mmu030_put_byte_atc(uaecptr addr, uae_u8 val, int l, uae_u32 fc) {
+    uae_u32 page_index = addr & mmu030.translation.page.mask;
+    uae_u32 addr_mask = mmu030.translation.page.imask;
+    
+    uae_u32 physical_addr = mmu030.atc[l].physical.addr&addr_mask;
+#if MMU030_ATC_DBG_MSG
+    write_log(_T("ATC match(%i): page addr = %08X, index = %08X (bput %02X)\n"),
+              l, physical_addr, page_index, val);
+#endif
+    physical_addr += page_index;
+    
+    if (mmu030.atc[l].physical.bus_error || mmu030.atc[l].physical.write_protect) {
+        mmu030_page_fault(addr, 0, MMU030_SSW_SIZE_B, fc);
+        return;
+    }
+
+    phys_put_byte(physical_addr, val);
+}
+
+uae_u32 mmu030_get_long_atc(uaecptr addr, int l, uae_u32 fc) {
+    uae_u32 page_index = addr & mmu030.translation.page.mask;
+    uae_u32 addr_mask = mmu030.translation.page.imask;
+    
+    uae_u32 physical_addr = mmu030.atc[l].physical.addr&addr_mask;
+#if MMU030_ATC_DBG_MSG
+    write_log(_T("ATC match(%i): page addr = %08X, index = %08X (lget %08X)\n"), l,
+              physical_addr, page_index, phys_get_long(physical_addr+page_index));
+#endif
+    physical_addr += page_index;
+    
+    if (mmu030.atc[l].physical.bus_error) {
+        mmu030_page_fault(addr, 1, MMU030_SSW_SIZE_L, fc);
+        return 0;
+    }
+
+    return phys_get_long(physical_addr);
+}
+
+uae_u16 mmu030_get_word_atc(uaecptr addr, int l, uae_u32 fc) {
+    uae_u32 page_index = addr & mmu030.translation.page.mask;
+    uae_u32 addr_mask = mmu030.translation.page.imask;
+    
+    uae_u32 physical_addr = mmu030.atc[l].physical.addr&addr_mask;
+#if MMU030_ATC_DBG_MSG
+    write_log(_T("ATC match(%i): page addr = %08X, index = %08X (wget %04X)\n"), l,
+              physical_addr, page_index, phys_get_word(physical_addr+page_index));
+#endif
+    physical_addr += page_index;
+    
+    if (mmu030.atc[l].physical.bus_error) {
+        mmu030_page_fault(addr, 1, MMU030_SSW_SIZE_W, fc);
+        return 0;
+    }
+    
+    return phys_get_word(physical_addr);
+}
+
+uae_u8 mmu030_get_byte_atc(uaecptr addr, int l, uae_u32 fc) {
+    uae_u32 page_index = addr & mmu030.translation.page.mask;
+    uae_u32 addr_mask = mmu030.translation.page.imask;
+    
+    uae_u32 physical_addr = mmu030.atc[l].physical.addr&addr_mask;
+#if MMU030_ATC_DBG_MSG
+    write_log(_T("ATC match(%i): page addr = %08X, index = %08X (bget %02X)\n"), l,
+              physical_addr, page_index, phys_get_byte(physical_addr+page_index));
+#endif
+    physical_addr += page_index;
+    
+    if (mmu030.atc[l].physical.bus_error) {
+        mmu030_page_fault(addr, 1, MMU030_SSW_SIZE_B, fc);
+        return 0;
+    }
+
+    return phys_get_byte(physical_addr);
+}
+
+/* This function checks if a certain logical address is in the ATC 
+ * by comparing the logical address and function code to the values
+ * stored in the ATC entries. If a matching entry is found it sets
+ * the history bit and returns the cache index of the entry. */
+int mmu030_logical_is_in_atc(uaecptr addr, uae_u32 fc, bool write) {
+    uaecptr physical_addr = 0;
+    uaecptr logical_addr = 0;
+    uae_u32 addr_mask = mmu030.translation.page.imask;
+    uae_u32 page_index = addr & mmu030.translation.page.mask;
+       uae_u32 maddr = addr & addr_mask;
+    int offset = (maddr >> mmu030.translation.page.size) & 0x1f;
+
+    int i, index;
+       index = atcindextable[offset];
+    for (i=0; i<ATC030_NUM_ENTRIES; i++) {
+        logical_addr = mmu030.atc[index].logical.addr;
+        /* If actual address matches address in ATC */
+        if (maddr==(logical_addr&addr_mask) &&
+            (mmu030.atc[index].logical.fc==fc) &&
+            mmu030.atc[index].logical.valid) {
+            /* If M bit is set or access is read, return true
+             * else invalidate entry */
+                               if (mmu030.atc[index].physical.modified || !write) {
+                                       /* Maintain history bit */
+                                       mmu030_atc_handle_history_bit(index);
+                                       atcindextable[offset] = index;
+                                       return index;
+                               } else {
+                                       mmu030.atc[index].logical.valid = false;
+                               }
+               }
+               index++;
+               if (index >= ATC030_NUM_ENTRIES)
+                       index = 0;
+    }
+    return -1;
+}
+
+void mmu030_atc_handle_history_bit(int entry_num) {
+    int j;
+    mmu030.atc[entry_num].mru = 1;
+    for (j=0; j<ATC030_NUM_ENTRIES; j++) {
+        if (!mmu030.atc[j].mru)
+            break;
+    }
+    /* If there are no more zero-bits, reset all */
+    if (j==ATC030_NUM_ENTRIES) {
+        for (j=0; j<ATC030_NUM_ENTRIES; j++) {
+            mmu030.atc[j].mru = 0;
+        }
+        mmu030.atc[entry_num].mru = 1;
+#if MMU030_ATC_DBG_MSG
+        write_log(_T("ATC: No more history zero-bits. Reset all.\n"));
+#endif
+       }
+}
+
+
+/* Memory access functions:
+ * If the address matches one of the transparent translation registers
+ * use it directly as physical address, else check ATC for the
+ * logical address. If the logical address is not resident in the ATC
+ * create a new ATC entry and then look up the physical address. 
+ */
+
+void mmu030_put_long(uaecptr addr, uae_u32 val, uae_u32 fc, int size) {
+    
+       //                                        addr,super,write
+       if ((!mmu030.enabled) || (mmu030_match_ttr(addr,fc,true)&TT_OK_MATCH) || (fc==7)) {
+               phys_put_long(addr,val);
+               return;
+    }
+
+    int atc_line_num = mmu030_logical_is_in_atc(addr, fc, true);
+
+    if (atc_line_num>=0) {
+        mmu030_put_long_atc(addr, val, atc_line_num, fc);
+    } else {
+        mmu030_table_search(addr,fc,true,0);
+        mmu030_put_long_atc(addr, val, mmu030_logical_is_in_atc(addr,fc,true), fc);
+    }
+}
+
+void mmu030_put_word(uaecptr addr, uae_u16 val, uae_u32 fc, int size) {
+    
+       //                                        addr,super,write
+       if ((!mmu030.enabled) || (mmu030_match_ttr(addr,fc,true)&TT_OK_MATCH) || (fc==7)) {
+               phys_put_word(addr,val);
+               return;
+    }
+    
+    int atc_line_num = mmu030_logical_is_in_atc(addr, fc, true);
+    
+    if (atc_line_num>=0) {
+        mmu030_put_word_atc(addr, val, atc_line_num, fc);
+    } else {
+        mmu030_table_search(addr, fc, true, 0);
+        mmu030_put_word_atc(addr, val, mmu030_logical_is_in_atc(addr,fc,true), fc);
+    }
+}
+
+void mmu030_put_byte(uaecptr addr, uae_u8 val, uae_u32 fc, int size) {
+    
+       //                                        addr,super,write
+       if ((!mmu030.enabled) || (mmu030_match_ttr(addr, fc, true)&TT_OK_MATCH) || (fc==7)) {
+               phys_put_byte(addr,val);
+               return;
+    }
+    
+    int atc_line_num = mmu030_logical_is_in_atc(addr, fc, true);
+
+    if (atc_line_num>=0) {
+        mmu030_put_byte_atc(addr, val, atc_line_num, fc);
+    } else {
+        mmu030_table_search(addr, fc, true, 0);
+        mmu030_put_byte_atc(addr, val, mmu030_logical_is_in_atc(addr,fc,true), fc);
+    }
+}
+
+uae_u32 mmu030_get_long(uaecptr addr, uae_u32 fc, int size) {
+    
+       //                                        addr,super,write
+       if ((!mmu030.enabled) || (mmu030_match_ttr(addr,fc,false)&TT_OK_MATCH) || (fc==7)) {
+               return phys_get_long(addr);
+    }
+    
+    int atc_line_num = mmu030_logical_is_in_atc(addr, fc, false);
+
+    if (atc_line_num>=0) {
+        return mmu030_get_long_atc(addr, atc_line_num, fc);
+    } else {
+        mmu030_table_search(addr, fc, false, 0);
+        return mmu030_get_long_atc(addr, mmu030_logical_is_in_atc(addr,fc,false), fc);
+    }
+}
+
+uae_u16 mmu030_get_word(uaecptr addr, uae_u32 fc, int size) {
+    
+       //                                        addr,super,write
+       if ((!mmu030.enabled) || (mmu030_match_ttr(addr,fc,false)&TT_OK_MATCH) || (fc==7)) {
+               return phys_get_word(addr);
+    }
+    
+    int atc_line_num = mmu030_logical_is_in_atc(addr, fc, false);
+
+    if (atc_line_num>=0) {
+        return mmu030_get_word_atc(addr, atc_line_num, fc);
+    } else {
+        mmu030_table_search(addr, fc, false, 0);
+        return mmu030_get_word_atc(addr, mmu030_logical_is_in_atc(addr,fc,false), fc);
+    }
+}
+
+uae_u8 mmu030_get_byte(uaecptr addr, uae_u32 fc, int size) {
+    
+       //                                        addr,super,write
+       if ((!mmu030.enabled) || (mmu030_match_ttr(addr,fc,false)&TT_OK_MATCH) || (fc==7)) {
+               return phys_get_byte(addr);
+    }
+    
+    int atc_line_num = mmu030_logical_is_in_atc(addr, fc, false);
+
+    if (atc_line_num>=0) {
+        return mmu030_get_byte_atc(addr, atc_line_num, fc);
+    } else {
+        mmu030_table_search(addr, fc, false, 0);
+        return mmu030_get_byte_atc(addr, mmu030_logical_is_in_atc(addr,fc,false), fc);
+    }
+}
+
+
+uae_u16 REGPARAM2 mmu030_get_word_unaligned(uaecptr addr, uae_u32 fc)
+{
+       uae_u16 res;
+    
+       res = (uae_u16)mmu030_get_byte(addr, fc, sz_word) << 8;
+       SAVE_EXCEPTION;
+       TRY(prb) {
+               res |= mmu030_get_byte(addr + 1, fc, sz_word);
+               RESTORE_EXCEPTION;
+       }
+       CATCH(prb) {
+               RESTORE_EXCEPTION;
+               THROW_AGAIN(prb);
+       } ENDTRY
+       return res;
+}
+
+uae_u32 REGPARAM2 mmu030_get_long_unaligned(uaecptr addr, uae_u32 fc)
+{
+       uae_u32 res;
+    
+       if (likely(!(addr & 1))) {
+               res = (uae_u32)mmu030_get_word(addr, fc, sz_long) << 16;
+               SAVE_EXCEPTION;
+               TRY(prb) {
+                       res |= mmu030_get_word(addr + 2, fc, sz_long);
+                       RESTORE_EXCEPTION;
+               }
+               CATCH(prb) {
+                       RESTORE_EXCEPTION;
+                       THROW_AGAIN(prb);
+               } ENDTRY
+       } else {
+               res = (uae_u32)mmu030_get_byte(addr, fc, sz_long) << 8;
+               SAVE_EXCEPTION;
+               TRY(prb) {
+                       res = (res | mmu030_get_byte(addr + 1, fc, sz_long)) << 8;
+                       res = (res | mmu030_get_byte(addr + 2, fc, sz_long)) << 8;
+                       res |= mmu030_get_byte(addr + 3, fc, sz_long);
+                       RESTORE_EXCEPTION;
+               }
+               CATCH(prb) {
+                       RESTORE_EXCEPTION;
+                       THROW_AGAIN(prb);
+               } ENDTRY
+       }
+       return res;
+}
+
+
+void REGPARAM2 mmu030_put_long_unaligned(uaecptr addr, uae_u32 val, uae_u32 fc)
+{
+       SAVE_EXCEPTION;
+       TRY(prb) {
+               if (likely(!(addr & 1))) {
+                       mmu030_put_word(addr, val >> 16, fc, sz_long);
+                       mmu030_put_word(addr + 2, val, fc, sz_long);
+               } else {
+                       mmu030_put_byte(addr, val >> 24, fc, sz_long);
+                       mmu030_put_byte(addr + 1, val >> 16, fc, sz_long);
+                       mmu030_put_byte(addr + 2, val >> 8, fc, sz_long);
+                       mmu030_put_byte(addr + 3, val, fc, sz_long);
+               }
+               RESTORE_EXCEPTION;
+       }
+       CATCH(prb) {
+               RESTORE_EXCEPTION;
+               regs.wb3_data = val;
+               THROW_AGAIN(prb);
+       } ENDTRY
+}
+
+void REGPARAM2 mmu030_put_word_unaligned(uaecptr addr, uae_u16 val, uae_u32 fc)
+{
+       SAVE_EXCEPTION;
+       TRY(prb) {
+               mmu030_put_byte(addr, val >> 8, fc, sz_word);
+               mmu030_put_byte(addr + 1, val, fc, sz_word);
+               RESTORE_EXCEPTION;
+       }
+       CATCH(prb) {
+               RESTORE_EXCEPTION;
+               regs.wb3_data = val;
+               THROW_AGAIN(prb);
+       } ENDTRY
+}
+
+
+/* Used by debugger */
+static uaecptr mmu030_get_addr_atc(uaecptr addr, int l, uae_u32 fc, bool write) {
+    uae_u32 page_index = addr & mmu030.translation.page.mask;
+    uae_u32 addr_mask = mmu030.translation.page.imask;
+    
+    uae_u32 physical_addr = mmu030.atc[l].physical.addr&addr_mask;
+    physical_addr += page_index;
+    
+    if (mmu030.atc[l].physical.bus_error) {
+        mmu030_page_fault(addr, write == 0, MMU030_SSW_SIZE_B, fc);
+        return 0;
+    }
+
+    return physical_addr;
+}
+uaecptr mmu030_translate(uaecptr addr, bool super, bool data, bool write)
+{
+       int fc = (super ? 4 : 0) | (data ? 1 : 2);
+       if ((!mmu030.enabled) || (mmu030_match_ttr(addr,fc,write)&TT_OK_MATCH) || (fc==7)) {
+               return addr;
+    }
+    int atc_line_num = mmu030_logical_is_in_atc(addr, fc, write);
+
+    if (atc_line_num>=0) {
+        return mmu030_get_addr_atc(addr, atc_line_num, fc, write);
+    } else {
+        mmu030_table_search(addr, fc, false, 0);
+        return mmu030_get_addr_atc(addr, mmu030_logical_is_in_atc(addr,fc,write), fc, write);
+    }
+
+}
+
+/* MMU Reset */
+void mmu030_reset(int hardreset)
+{
+    /* A CPU reset causes the E-bits of TC and TT registers to be zeroed. */
+    mmu030.enabled = false;
+       regs.mmu_page_size = 0;
+       tc_030 &= ~TC_ENABLE_TRANSLATION;
+       tt0_030 &= ~TT_ENABLE;
+       tt1_030 &= ~TT_ENABLE;
+       if (hardreset) {
+               srp_030 = crp_030 = 0;
+               tt0_030 = tt1_030 = tc_030 = 0;
+        mmusr_030 = 0;
+        mmu030_flush_atc_all();
+       }
+}
+
+
+void m68k_do_rte_mmu030 (uaecptr a7)
+{
+       // Restore access error exception state
+
+       uae_u16 format = get_word_mmu030 (a7 + 6);
+       uae_u16 frame = format >> 12;
+       uae_u16 ssw = get_word_mmu030 (a7 + 10);
+
+       // Internal register, our opcode storage area
+       mmu030_opcode = get_long_mmu030 (a7 + 0x14);
+       // Misc state data
+       mmu030_state[0] = get_word_mmu030 (a7 + 0x30);
+       mmu030_state[1] = get_word_mmu030 (a7 + 0x32);
+       mmu030_state[2] = get_word_mmu030 (a7 + 0x34);
+       mmu030_disp_store[0] = get_long_mmu030 (a7 + 0x1c);
+       mmu030_disp_store[1] = get_long_mmu030 (a7 + 0x1c + 4);
+
+       if (frame == 0xb) {
+               uae_u16 idxsize = get_word_mmu030 (a7 + 0x36);
+               for (int i = 0; i < idxsize + 1; i++) {
+                       mmu030_ad[i].done = i < idxsize;
+                       mmu030_ad[i].val = get_long_mmu030 (a7 + 0x5c - (i + 1) * 4);
+               }
+               mmu030_ad[idxsize + 1].done = false;
+               // did we have data fault but DF bit cleared?
+               if (ssw & (MMU030_SSW_DF << 1) && !(ssw & MMU030_SSW_DF)) {
+                       // DF not set: mark access as done
+                       if (mmu030_state[1] & MMU030_STATEFLAG1_MOVEM1) {
+                               // if movem, skip next move
+                               mmu030_state[1] |= MMU030_STATEFLAG1_MOVEM2;
+                       } else {
+                               mmu030_ad[idxsize].done = true;
+                               if (ssw & MMU030_SSW_RW) {
+                                       // Read and no DF: use value in data input buffer
+                                       mmu030_data_buffer = get_long_mmu030 (a7 + 0x2c);
+                                       mmu030_ad[idxsize].val = mmu030_data_buffer;
+                               }
+                       }
+               }
+               // did we have ins fault and RB bit cleared?
+               if ((ssw & MMU030_SSW_FB) && !(ssw & MMU030_SSW_RB)) {
+                       uae_u16 stageb = get_word_mmu030 (a7 + 0x0e);
+                       if (mmu030_opcode == -1) {
+                               mmu030_opcode_stageb = stageb;
+                               write_log (_T("Software fixed stage B! opcode = %04x\n"), stageb);
+                       } else {
+                               mmu030_ad[idxsize].done = true;
+                               mmu030_ad[idxsize].val = stageb;
+                               write_log (_T("Software fixed stage B! opcode = %04X, opword = %04x\n"), mmu030_opcode, stageb);
+                       }
+               }
+               m68k_areg (regs, 7) += 92;
+       } else {
+               m68k_areg (regs, 7) += 32;
+       }
+       // Rerun "mmu030_opcode" using restored state.
+       mmu030_retry = true;
+}
+
+void flush_mmu030 (uaecptr addr, int n)
+{
+}
+
+void m68k_do_rts_mmu030 (void)
+{
+       m68k_setpc (get_long_mmu030_state (m68k_areg (regs, 7)));
+       m68k_areg (regs, 7) += 4;
+}
+
+void m68k_do_bsr_mmu030 (uaecptr oldpc, uae_s32 offset)
+{
+       put_long_mmu030_state (m68k_areg (regs, 7) - 4, oldpc);
+       m68k_areg (regs, 7) -= 4;
+       m68k_incpci (offset);
+}
+
+uae_u32 REGPARAM2 get_disp_ea_020_mmu030 (uae_u32 base, int idx)
+{
+       uae_u16 dp;
+       int reg;
+       uae_u32 v;
+       int oldidx;
+       int pcadd = 0;
+
+       // we need to do this hack here because in worst case we don't have enough
+       // stack frame space to store two very large 020 addressing mode access state
+       // + whatever the instruction itself does.
+
+       if (mmu030_state[1] & (1 << idx)) {
+               m68k_incpci (((mmu030_state[2] >> (idx * 4)) & 15) * 2);
+               return mmu030_disp_store[idx];
+       }
+
+       oldidx = mmu030_idx;
+       dp = next_iword_mmu030_state ();
+       pcadd += 1;
+       
+       reg = (dp >> 12) & 15;
+       uae_s32 regd = regs.regs[reg];
+       if ((dp & 0x800) == 0)
+               regd = (uae_s32)(uae_s16)regd;
+       regd <<= (dp >> 9) & 3;
+       if (dp & 0x100) {
+               uae_s32 outer = 0;
+               if (dp & 0x80)
+                       base = 0;
+               if (dp & 0x40)
+                       regd = 0;
+
+               if ((dp & 0x30) == 0x20) {
+                       base += (uae_s32)(uae_s16) next_iword_mmu030_state ();
+                       pcadd += 1;
+               }
+               if ((dp & 0x30) == 0x30) {
+                       base += next_ilong_mmu030_state ();
+                       pcadd += 2;
+               }
+
+               if ((dp & 0x3) == 0x2) {
+                       outer = (uae_s32)(uae_s16) next_iword_mmu030_state ();
+                       pcadd += 1;
+               }
+               if ((dp & 0x3) == 0x3) {
+                       outer = next_ilong_mmu030_state ();
+                       pcadd += 2;
+               }
+
+               if ((dp & 0x4) == 0) {
+                       base += regd;
+               }
+               if (dp & 0x3) {
+                       base = get_long_mmu030_state (base);
+               }
+               if (dp & 0x4) {
+                       base += regd;
+               }
+               v = base + outer;
+       } else {
+               v = base + (uae_s32)((uae_s8)dp) + regd;
+       }
+
+       mmu030_state[1] |= 1 << idx;
+       mmu030_state[2] |= pcadd << (idx * 4);
+       mmu030_disp_store[idx] = v;
+       mmu030_idx = oldidx;
+       mmu030_ad[mmu030_idx].done = false;
+
+       return v;
+}
index e59d8e388840e7b9675e095e93c01d03d99d2999..a1256a44e73e9b624f7b02dd943e9d0e070e60cb 100644 (file)
@@ -144,6 +144,8 @@ static bool vsync_rendered, frame_rendered, frame_shown;
 static int vsynctimeperline;
 static int jitcount = 0;
 static int frameskiptime;
+static bool genlockhtoggle;
+static bool genlockvtoggle;
 
 #define LOF_TOGGLES_NEEDED 4
 #define NLACE_CNT_NEEDED 50
@@ -480,16 +482,6 @@ void alloc_cycle_blitter (int hpos, uaecptr *ptr, int chnum)
        alloc_cycle (hpos, CYCLE_BLITTER);
 }
 
-static void hsyncdelay (void)
-{
-#if 0
-       static int prevhpos;
-       while (current_hpos () == prevhpos)
-               do_cycles(CYCLE_UNIT);
-       prevhpos = current_hpos();
-#endif
-}
-
 static void update_mirrors (void)
 {
        aga_mode = (currprefs.chipset_mask & CSMASK_AGA) != 0;
@@ -619,7 +611,7 @@ static void decide_diw (int hpos)
 
                if (lhdiw >= diw_hstrt && last_hdiw < diw_hstrt && hdiwstate == DIW_waiting_start) {
                        if (thisline_decision.diwfirstword < 0)
-                               thisline_decision.diwfirstword = diwfirstword < 0 ? 0 : diwfirstword;
+                               thisline_decision.diwfirstword = diwfirstword < 0 ? PIXEL_XPOS(0) : diwfirstword;
                        hdiwstate = DIW_waiting_stop;
                }
                if (lhdiw >= diw_hstop && last_hdiw < diw_hstop && hdiwstate == DIW_waiting_stop) {
@@ -2632,7 +2624,7 @@ static void finish_decisions (void)
        if (hdiwstate == DIW_waiting_stop) {
                thisline_decision.diwlastword = max_diwlastword;
                if (thisline_decision.diwfirstword < 0)
-                       thisline_decision.diwfirstword = 0;
+                       thisline_decision.diwfirstword = min_diwlastword;
        }
 
        if (thisline_decision.diwfirstword != line_decisions[next_lineno].diwfirstword)
@@ -2724,7 +2716,7 @@ static void reset_decisions (void)
        thisline_decision.diwfirstword = -1;
        thisline_decision.diwlastword = -1;
        if (hdiwstate == DIW_waiting_stop) {
-               thisline_decision.diwfirstword = 0;
+               thisline_decision.diwfirstword = min_diwlastword;
                if (thisline_decision.diwfirstword != line_decisions[next_lineno].diwfirstword)
                        MARK_LINE_CHANGED;
        }
@@ -3159,7 +3151,7 @@ void init_hz (bool fullinit)
                reset_drawing ();
        }
 
-       maxvpos_total = (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 2047 : 511;
+       maxvpos_total = (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? (MAXVPOS_LINES_ECS - 1) : (MAXVPOS_LINES_OCS - 1);
        if (maxvpos_total > MAXVPOS)
                maxvpos_total = MAXVPOS;
 #ifdef PICASSO96
@@ -3221,11 +3213,11 @@ static void calcdiw (void)
        diwfirstword = coord_diw_to_window_x (hstrt);
        diwlastword = coord_diw_to_window_x (hstop);
        if (diwfirstword >= diwlastword) {
-               diwfirstword = 0;
+               diwfirstword = min_diwlastword;
                diwlastword = max_diwlastword;
        }
-       if (diwfirstword < 0)
-               diwfirstword = 0;
+       if (diwfirstword < min_diwlastword)
+               diwfirstword = min_diwlastword;
 
        plffirstline = vstrt;
        plflastline = vstop;
@@ -3343,12 +3335,24 @@ STATIC_INLINE int GETHPOS (void)
        return islightpentriggered () ? hpos_lpen : (issyncstopped () ? hpos_previous : current_hpos ());
 }
 
+// fake changing hpos when rom genlock test runs and genlock is connected
+static bool hsyncdelay (void)
+{
+       if (!currprefs.genlock)
+               return false;
+       if (currprefs.cpu_cycle_exact || currprefs.m68k_speed >= 0)
+               return false;
+       if (bplcon0 == (0x0100 | 0x0002)) {
+               return true;
+       }
+       return false;
+}
 
 // DFF006 = 0.W must be valid result but better do this only in 68000 modes (whdload black screen!)
 
 #define HPOS_OFFSET (currprefs.cpu_model < 68020 ? 3 : 0)
 
-STATIC_INLINE uae_u16 VPOSR (void)
+static uae_u16 VPOSR (void)
 {
        unsigned int csbit = 0;
        uae_u16 vp = GETVPOS ();
@@ -3379,12 +3383,11 @@ STATIC_INLINE uae_u16 VPOSR (void)
        vp = vp | (lof_store ? 0x8000 : 0) | csbit;
        if (currprefs.chipset_mask & CSMASK_ECS_AGNUS)
                vp |= lol ? 0x80 : 0;
+       hsyncdelay ();
 #if 0
        if (M68K_GETPC < 0x00f00000 || M68K_GETPC >= 0x10000000)
                write_log (_T("VPOSR %04x at %08x\n"), vp, M68K_GETPC);
 #endif
-       if (currprefs.cpu_model >= 68020)
-               hsyncdelay ();
        return vp;
 }
 
@@ -3423,8 +3426,9 @@ static void VHPOSW (uae_u16 v)
        vpos |= v;
 }
 
-STATIC_INLINE uae_u16 VHPOSR (void)
+static uae_u16 VHPOSR (void)
 {
+       static uae_u16 oldhp;
        uae_u16 vp = GETVPOS ();
        uae_u16 hp = GETHPOS ();
 
@@ -3442,9 +3446,15 @@ STATIC_INLINE uae_u16 VHPOSR (void)
        }
 
        vp <<= 8;
+
+       if (hsyncdelay ()) {
+               // fake continuously changing hpos in fastest possible modes
+               hp = oldhp % maxhpos;
+               oldhp++;
+       }
+
        vp |= hp;
-       if (currprefs.cpu_model >= 68020)
-               hsyncdelay ();
+
 #if 0
        if (M68K_GETPC < 0x00f00000 || M68K_GETPC >= 0x10000000)
                write_log (_T("VPOS %04x %04x at %08x\n"), VPOSR (), vp, M68K_GETPC);
@@ -3605,8 +3615,9 @@ static void DMACON (int hpos, uae_u16 v)
        if ((dmacon & DMA_BLITPRI) > (oldcon & DMA_BLITPRI) && bltstate != BLT_done)
                set_special (SPCFLAG_BLTNASTY);
 
-       if (dmaen (DMA_BLITTER) && bltstate == BLT_init)
-               bltstate = BLT_work;
+       if (dmaen (DMA_BLITTER) && bltstate == BLT_init) {
+               blitter_check_start ();
+       }
 
        if ((dmacon & (DMA_BLITPRI | DMA_BLITTER | DMA_MASTER)) != (DMA_BLITPRI | DMA_BLITTER | DMA_MASTER))
                unset_special (SPCFLAG_BLTNASTY);
@@ -5657,7 +5668,7 @@ static bool framewait (void)
                        // this delay can safely overshoot frame time by 1-2 ms, following code will compensate for it.
                        for (;;) {
                                curr_time = read_processor_time ();
-                               if ((int)vsyncwaittime  - (int)curr_time <= 0)
+                               if ((int)vsyncwaittime  - (int)curr_time <= 0 || (int)vsyncwaittime  - (int)curr_time > 2 * vsynctimebase)
                                        break;
                                rtg_vsynccheck ();
                                sleep_millis_main (1);
@@ -5731,7 +5742,6 @@ static struct mavg_data fps_mavg, idle_mavg;
 
 void fpscounter_reset (void)
 {
-       timeframes = 0;
        mavg_clear (&fps_mavg);
        mavg_clear (&idle_mavg);
        bogusframe = 2;
@@ -5788,7 +5798,15 @@ static void vsync_handler_pre (void)
        if (bogusframe > 0)
                bogusframe--;
 
-       handle_events ();
+       while (handle_events ()) {
+               // we are paused, do all config checks but don't do any emulation
+               if (vsync_handle_check ()) {
+                       redraw_frame ();
+                       render_screen (true);
+                       show_screen ();
+               }
+               config_check_vsync ();
+       }
 
 #ifdef PICASSO96
        if (isvsync_rtg () >= 0)
@@ -5867,8 +5885,13 @@ static void vsync_handler_post (void)
 #endif
        DISK_vsync ();
 
-       if (bplcon0 & 4)
+       if ((bplcon0 & 2) && currprefs.genlock) {
+               genlockvtoggle = !genlockvtoggle;
+               //lof_store = genlockvtoggle ? 1 : 0;
+       }
+       if (bplcon0 & 4) {
                lof_store = lof_store ? 0 : 1;
+       }
        lof_current = lof_store;
        if (lof_togglecnt_lace >= LOF_TOGGLES_NEEDED) {
                interlace_changed = notice_interlace_seen (true);
@@ -6231,8 +6254,12 @@ static void hsync_handler_post (bool onvsync)
        }
 #endif
 
-       bool ciasyncs = !(bplcon0 & 2) || ((bplcon0 & 2) && currprefs.genlock);
-       CIA_hsync_posthandler (ciasyncs);
+       // genlock active = TOD pulses only every other line/field
+       genlockhtoggle = !genlockhtoggle;
+       bool ciahsyncs = !(bplcon0 & 2) || ((bplcon0 & 2) && currprefs.genlock && genlockhtoggle);
+       bool ciavsyncs = !(bplcon0 & 2) || ((bplcon0 & 2) && currprefs.genlock && genlockvtoggle);
+
+       CIA_hsync_posthandler (ciahsyncs);
        if (currprefs.cs_ciaatod > 0) {
 #if 0
                static uae_s32 oldtick;
@@ -6250,12 +6277,12 @@ static void hsync_handler_post (bool onvsync)
                static int cia_hsync;
                cia_hsync -= 256;
                if (cia_hsync <= 0) {
-                       CIA_vsync_posthandler (1);
+                       CIA_vsync_posthandler (true);
                        cia_hsync += ((MAXVPOS_PAL * MAXHPOS_PAL * 50 * 256) / (maxhpos * (currprefs.cs_ciaatod == 2 ? 60 : 50)));
                }
 #endif
        } else if (currprefs.cs_ciaatod == 0 && onvsync) {
-               CIA_vsync_posthandler (ciasyncs);
+               CIA_vsync_posthandler (ciavsyncs);
        }
 
        if (vpos == equ_vblank_endline + 1) {
@@ -6594,7 +6621,7 @@ void custom_reset (bool hardreset, bool keyboardreset)
 
        target_reset ();
        reset_all_systems ();
-       write_log (_T("Reset at %08X\n"), M68K_GETPC);
+       write_log (_T("Reset at %08X. Chipset mask = %08X\n"), M68K_GETPC, currprefs.chipset_mask);
        memory_map_dump ();
 
        lightpen_active = -1;
@@ -7235,17 +7262,17 @@ static int REGPARAM2 custom_wput_1 (int hpos, uaecptr addr, uae_u32 value, int n
 #ifndef CUSTOM_SIMPLE
        case 0x1DC: BEAMCON0 (value); break;
 #ifdef ECS_DENISE
-       case 0x1C0: if (htotal != value) { htotal = value; varsync (); } break;
-       case 0x1C2: if (hsstop != value) { hsstop = value; varsync (); } break;
-       case 0x1C4: if (hbstrt != value) { hbstrt = value; varsync (); } break;
-       case 0x1C6: if (hbstop != value) { hbstop = value; varsync (); } break;
-       case 0x1C8: if (vtotal != value) { vtotal = value; varsync (); } break;
-       case 0x1CA: if (vsstop != value) { vsstop = value; varsync (); } break;
-       case 0x1CC: if (vbstrt < value || vbstrt > value + 1) { vbstrt = value; varsync (); } break;
-       case 0x1CE: if (vbstop < value || vbstop > value + 1) { vbstop = value; varsync (); } break;
-       case 0x1DE: if (hsstrt != value) { hsstrt = value; varsync (); } break;
-       case 0x1E0: if (vsstrt != value) { vsstrt = value; varsync (); } break;
-       case 0x1E2: if (hcenter != value) { hcenter = value; varsync (); } break;
+       case 0x1C0: if (htotal != value) { htotal = value & (MAXHPOS_ROWS - 1); varsync (); } break;
+       case 0x1C2: if (hsstop != value) { hsstop = value & (MAXHPOS_ROWS - 1); varsync (); } break;
+       case 0x1C4: if (hbstrt != value) { hbstrt = value & (MAXHPOS_ROWS - 1); varsync (); } break;
+       case 0x1C6: if (hbstop != value) { hbstop = value & (MAXHPOS_ROWS - 1); varsync (); } break;
+       case 0x1C8: if (vtotal != value) { vtotal = value & (MAXVPOS_LINES_ECS - 1); varsync (); } break;
+       case 0x1CA: if (vsstop != value) { vsstop = value & (MAXVPOS_LINES_ECS - 1); varsync (); } break;
+       case 0x1CC: if (vbstrt < value || vbstrt > (value & (MAXVPOS_LINES_ECS - 1)) + 1) { vbstrt = value & (MAXVPOS_LINES_ECS - 1); varsync (); } break;
+       case 0x1CE: if (vbstop < value || vbstop > (value & (MAXVPOS_LINES_ECS - 1)) + 1) { vbstop = value & (MAXVPOS_LINES_ECS - 1); varsync (); } break;
+       case 0x1DE: if (hsstrt != value) { hsstrt = value & (MAXHPOS_ROWS - 1); varsync (); } break;
+       case 0x1E0: if (vsstrt != value) { vsstrt = value & (MAXVPOS_LINES_ECS - 1); varsync (); } break;
+       case 0x1E2: if (hcenter != value) { hcenter = value & (MAXHPOS_ROWS - 1); varsync (); } break;
 #endif
 #endif
 
index b46b88376db765932eb0cd2c0d8977c6cf2e9b52..cd3416f33963d36f91da34c09de93071e8a24309 100644 (file)
--- a/debug.cpp
+++ b/debug.cpp
@@ -36,6 +36,8 @@
 #include "rommgr.h"
 #include "inputrecord.h"
 #include "calc.h"
+#include "cpummu.h"
+#include "cpummu030.h"
 
 int debugger_active;
 static uaecptr skipaddr_start, skipaddr_end;
@@ -53,6 +55,7 @@ int debug_dma = 0;
 int debug_sprite_mask = 0xff;
 int debug_illegal = 0;
 uae_u64 debug_illegal_mask;
+static int debug_mmu_mode;
 
 static uaecptr processptr;
 static uae_char *processname;
@@ -177,6 +180,94 @@ static int debug_out (const TCHAR *format, ...)
        return 1;
 }
 
+uae_u32 get_byte_debug (uaecptr addr)
+{
+       uae_u32 v = 0xff;
+       if (debug_mmu_mode) {
+               flagtype olds = regs.s;
+               regs.s = (debug_mmu_mode & 4) != 0;
+               TRY(p) {
+                       if (currprefs.mmu_model == 68030) {
+                               v = mmu030_get_byte (addr, debug_mmu_mode, sz_byte);
+                       } else {
+                               v = mmu_get_byte (addr, (debug_mmu_mode & 1) ? true : false, sz_byte);
+                       }
+               } CATCH(p) {
+               }
+               regs.s = olds;
+       } else {
+               v = get_byte (addr);
+       }
+       return v;
+}
+uae_u32 get_word_debug (uaecptr addr)
+{
+       uae_u32 v = 0xffff;
+       if (debug_mmu_mode) {
+               flagtype olds = regs.s;
+               regs.s = (debug_mmu_mode & 4) != 0;
+               TRY(p) {
+                       if (currprefs.mmu_model == 68030) {
+                               v = mmu030_get_word (addr, debug_mmu_mode, sz_word);
+                       } else {
+                               v = mmu_get_word (addr, (debug_mmu_mode & 1) ? true : false, sz_word);
+                       }
+               } CATCH(p) {
+               }
+               regs.s = olds;
+       } else {
+               v = get_word (addr);
+       }
+       return v;
+}
+uae_u32 get_long_debug (uaecptr addr)
+{
+       uae_u32 v = 0xffffffff;
+       if (debug_mmu_mode) {
+               flagtype olds = regs.s;
+               regs.s = (debug_mmu_mode & 4) != 0;
+               TRY(p) {
+                       if (currprefs.mmu_model == 68030) {
+                               v = mmu030_get_long (addr, debug_mmu_mode, sz_long);
+                       } else {
+                               v = mmu_get_long (addr, (debug_mmu_mode & 1) ? true : false, sz_long);
+                       }
+               } CATCH(p) {
+               }
+               regs.s = olds;
+       } else {
+               v = get_long (addr);
+       }
+       return v;
+}
+
+int safe_addr (uaecptr addr, int size)
+{
+       if (debug_mmu_mode) {
+               flagtype olds = regs.s;
+               regs.s = (debug_mmu_mode & 4) != 0;
+               TRY(p) {
+                       if (currprefs.mmu_model >= 68040)
+                               addr = mmu_translate (addr, regs.s != 0, (debug_mmu_mode & 1), false);
+                       else
+                               addr = mmu030_translate (addr, regs.s != 0, (debug_mmu_mode & 1), false);
+               } CATCH(p) {
+                       return 0;
+               }
+               regs.s = olds;
+       }
+       addrbank *ab = &get_mem_bank (addr);
+       if (!ab)
+               return 0;
+       if (ab->flags & ABFLAG_SAFE)
+               return 1;
+       if (!ab->check (addr, size))
+               return 0;
+       if (ab->flags & (ABFLAG_RAM | ABFLAG_ROM | ABFLAG_ROMIN | ABFLAG_SAFE))
+               return 1;
+       return 0;
+}
+
 static bool iscancel (int counter)
 {
        static int cnt;
@@ -680,20 +771,6 @@ static uaecptr nextaddr (uaecptr addr, uaecptr last, uaecptr *end)
        return addr;
 }
 
-int safe_addr (uaecptr addr, int size)
-{
-       addrbank *ab = &get_mem_bank (addr);
-       if (!ab)
-               return 0;
-       if (ab->flags & ABFLAG_SAFE)
-               return 1;
-       if (!ab->check (addr, size))
-               return 0;
-       if (ab->flags & (ABFLAG_RAM | ABFLAG_ROM | ABFLAG_ROMIN | ABFLAG_SAFE))
-               return 1;
-       return 0;
-}
-
 uaecptr dumpmem2 (uaecptr addr, TCHAR *out, int osize)
 {
        int i, cols = 8;
@@ -706,8 +783,8 @@ uaecptr dumpmem2 (uaecptr addr, TCHAR *out, int osize)
                uae_u8 b1, b2;
                b1 = b2 = 0;
                if (safe_addr (addr, 1)) {
-                       b1 = get_byte (addr + 0);
-                       b2 = get_byte (addr + 1);
+                       b1 = get_byte_debug (addr + 0);
+                       b2 = get_byte_debug (addr + 1);
                        _stprintf (out + 9 + i * 5, _T("%02X%02X "), b1, b2);
                        out[9 + cols * 5 + 1 + i * 2 + 0] = b1 >= 32 && b1 < 127 ? b1 : '.';
                        out[9 + cols * 5 + 1 + i * 2 + 1] = b2 >= 32 && b2 < 127 ? b2 : '.';
@@ -800,12 +877,12 @@ static void dump_vectors (uaecptr addr)
        while (int_labels[i].name || trap_labels[j].name) {
                if (int_labels[i].name) {
                        console_out_f (_T("$%08X %02d: %12s $%08X  "), int_labels[i].adr + addr, int_labels[i].adr / 4,
-                               int_labels[i].name, get_long (int_labels[i].adr + addr));
+                               int_labels[i].name, get_long_debug (int_labels[i].adr + addr));
                        i++;
                }
                if (trap_labels[j].name) {
                        console_out_f (_T("$%08X %02d: %12s $%08X"), trap_labels[j].adr + addr, trap_labels[j].adr / 4,
-                               trap_labels[j].name, get_long (trap_labels[j].adr + addr));
+                               trap_labels[j].name, get_long_debug (trap_labels[j].adr + addr));
                        j++;
                }
                console_out (_T("\n"));
@@ -1335,9 +1412,9 @@ static void listcheater(int mode, int size)
                uae_u16 b;
 
                if (size) {
-                       b = get_byte (ts->addr);
+                       b = get_byte_debug (ts->addr);
                } else {
-                       b = get_word (ts->addr);
+                       b = get_word_debug (ts->addr);
                }
                if (mode)
                        console_out_f (_T("%08X=%04X "), ts->addr, b);
@@ -1398,7 +1475,7 @@ static void deepcheatsearch (TCHAR **c)
                addr = 0xffffffff;
                while ((addr = nextaddr (addr, 0, &end)) != 0xffffffff) {
                        for (i = addr; i < end; i++)
-                               *p1++ = get_byte (i);
+                               *p1++ = get_byte_debug (i);
                        addr = end - 1;
                }
                console_out (_T("Deep trainer first pass complete.\n"));
@@ -1423,11 +1500,11 @@ static void deepcheatsearch (TCHAR **c)
                int addrmask ;
 
                if (size == 1) {
-                       b = (uae_s8)get_byte (addr);
+                       b = (uae_s8)get_byte_debug (addr);
                        b2 = (uae_s8)p1[addrcnt];
                        addrmask = 1 << (addrcnt & 7);
                } else {
-                       b = (uae_s16)get_word (addr);
+                       b = (uae_s16)get_word_debug (addr);
                        b2 = (uae_s16)((p1[addrcnt] << 8) | p1[addrcnt + 1]);
                        addrmask = 3 << (addrcnt & 7);
                }
@@ -1543,7 +1620,7 @@ static void cheatsearch (TCHAR **c)
                if (addr + size < end) {
                        for (i = 0; i < size; i++) {
                                int shift = (size - i - 1) * 8;
-                               if (get_byte (addr + i) != ((val >> shift) & 0xff))
+                               if (get_byte_debug (addr + i) != ((val >> shift) & 0xff))
                                        break;
                        }
                        if (i == size) {
@@ -2617,17 +2694,17 @@ static TCHAR *BSTR2CSTR (uae_u8 *bstr)
 static void print_task_info (uaecptr node)
 {
        TCHAR *s;
-       int process = get_byte (node + 8) == 13 ? 1 : 0;
+       int process = get_byte_debug (node + 8) == 13 ? 1 : 0;
 
        console_out_f (_T("%08X: "), node);
-       s = au ((char*)get_real_address (get_long (node + 10)));
+       s = au ((char*)get_real_address (get_long_debug (node + 10)));
        console_out_f (process ? _T(" PROCESS '%s'\n") : _T(" TASK    '%s'\n"), s);
        xfree (s);
        if (process) {
-               uaecptr cli = BPTR2APTR (get_long (node + 172));
-               int tasknum = get_long (node + 140);
+               uaecptr cli = BPTR2APTR (get_long_debug (node + 172));
+               int tasknum = get_long_debug (node + 140);
                if (cli && tasknum) {
-                       uae_u8 *command_bstr = get_real_address (BPTR2APTR (get_long (cli + 16)));
+                       uae_u8 *command_bstr = get_real_address (BPTR2APTR (get_long_debug (cli + 16)));
                        TCHAR *command = BSTR2CSTR (command_bstr);
                        console_out_f (_T(" [%d, '%s']\n"), tasknum, command);
                        xfree (command);
@@ -2639,45 +2716,45 @@ static void print_task_info (uaecptr node)
 
 static void show_exec_tasks (void)
 {
-       uaecptr execbase = get_long (4);
-       uaecptr taskready = get_long (execbase + 406);
-       uaecptr taskwait = get_long (execbase + 420);
+       uaecptr execbase = get_long_debug (4);
+       uaecptr taskready = get_long_debug (execbase + 406);
+       uaecptr taskwait = get_long_debug (execbase + 420);
        uaecptr node, end;
        console_out_f (_T("Execbase at 0x%08X\n"), execbase);
        console_out (_T("Current:\n"));
-       node = get_long (execbase + 276);
+       node = get_long_debug (execbase + 276);
        print_task_info (node);
        console_out_f (_T("Ready:\n"));
-       node = get_long (taskready);
-       end = get_long (taskready + 4);
+       node = get_long_debug (taskready);
+       end = get_long_debug (taskready + 4);
        while (node) {
                print_task_info (node);
-               node = get_long (node);
+               node = get_long_debug (node);
        }
        console_out (_T("Waiting:\n"));
-       node = get_long (taskwait);
-       end = get_long (taskwait + 4);
+       node = get_long_debug (taskwait);
+       end = get_long_debug (taskwait + 4);
        while (node) {
                print_task_info (node);
-               node = get_long (node);
+               node = get_long_debug (node);
        }
 }
 
 static uaecptr get_base (const uae_char *name)
 {
-       uaecptr v = get_long (4);
+       uaecptr v = get_long_debug (4);
        addrbank *b = &get_mem_bank(v);
 
        if (!b || !b->check (v, 400) || b->flags != ABFLAG_RAM)
                return 0;
        v += 378; // liblist
-       while (v = get_long (v)) {
+       while (v = get_long_debug (v)) {
                uae_u32 v2;
                uae_u8 *p;
                b = &get_mem_bank (v);
                if (!b || !b->check (v, 32) || b->flags != ABFLAG_RAM)
                        goto fail;
-               v2 = get_long (v + 10); // name
+               v2 = get_long_debug (v + 10); // name
                b = &get_mem_bank (v2);
                if (!b || !b->check (v2, 20))
                        goto fail;
@@ -2701,29 +2778,29 @@ static TCHAR *getfrombstr(uaecptr pp)
 
 static void show_exec_lists (TCHAR t)
 {
-       uaecptr execbase = get_long (4);
+       uaecptr execbase = get_long_debug (4);
        uaecptr list = 0, node;
 
        if (_totupper (t) == 'O') { // doslist
                uaecptr dosbase = get_base ("dos.library");
                if (dosbase) {
-                       uaecptr rootnode = get_long (dosbase + 34);
-                       uaecptr dosinfo = get_long (rootnode + 24) << 2;
+                       uaecptr rootnode = get_long_debug (dosbase + 34);
+                       uaecptr dosinfo = get_long_debug (rootnode + 24) << 2;
                        console_out_f (_T("ROOTNODE: %08x DOSINFO: %08x\n"), rootnode, dosinfo);
-                       uaecptr doslist = get_long (dosinfo + 4) << 2;
+                       uaecptr doslist = get_long_debug (dosinfo + 4) << 2;
                        while (doslist) {
-                               int type = get_long (doslist + 4);
-                               uaecptr msgport = get_long (doslist + 8);
-                               TCHAR *name = getfrombstr (get_long (doslist + 40));
+                               int type = get_long_debug (doslist + 4);
+                               uaecptr msgport = get_long_debug (doslist + 8);
+                               TCHAR *name = getfrombstr (get_long_debug (doslist + 40));
                                console_out_f (_T("%08x: %d %08x '%s'\n"), doslist, type, msgport, name);
                                if (type == 0) {
                                        console_out_f (_T(" - H=%08x Stack=%5d Pri=%2d Start=%08x Seg=%08x GV=%08x\n"),
-                                               get_long (doslist + 16) << 2, get_long (doslist + 20),
-                                               get_long (doslist + 24), get_long (doslist + 28),
-                                               get_long (doslist + 32) << 2, get_long (doslist + 36));
+                                               get_long_debug (doslist + 16) << 2, get_long_debug (doslist + 20),
+                                               get_long_debug (doslist + 24), get_long_debug (doslist + 28),
+                                               get_long_debug (doslist + 32) << 2, get_long_debug (doslist + 36));
                                }
                                xfree (name);
-                               doslist = get_long (doslist) << 2;
+                               doslist = get_long_debug (doslist) << 2;
                        }
                } else {
                        console_out_f (_T("can't find dos.library\n"));
@@ -2736,33 +2813,33 @@ static void show_exec_lists (TCHAR t)
                for (int i = 0; i < 16; i++) {
                        console_out_f (_T("%2d %d: %08x\n"), i + 1, it2[i], list);
                        if (it[i]) {
-                               console_out_f (_T("  [H] %08x\n"), get_long (list));
-                               node = get_long (list + 8);
+                               console_out_f (_T("  [H] %08x\n"), get_long_debug (list));
+                               node = get_long_debug (list + 8);
                                if (node) {
-                                       uae_u8 *addr = get_real_address (get_long (node + 10));
+                                       uae_u8 *addr = get_real_address (get_long_debug (node + 10));
                                        TCHAR *name = addr ? au ((char*)addr) : au("<null>");
-                                       console_out_f (_T("      %08x (C=%08X D=%08X) '%s'\n"), node, get_long (list + 4), get_long (list), name);
+                                       console_out_f (_T("      %08x (C=%08X D=%08X) '%s'\n"), node, get_long_debug (list + 4), get_long_debug (list), name);
                                        xfree (name);
                                }
                        } else {
                                int cnt = 0;
-                               node = get_long (list);
-                               node = get_long (node);
-                               while (get_long (node)) {
-                                       uae_u8 *addr = get_real_address (get_long (node + 10));
+                               node = get_long_debug (list);
+                               node = get_long_debug (node);
+                               while (get_long_debug (node)) {
+                                       uae_u8 *addr = get_real_address (get_long_debug (node + 10));
                                        TCHAR *name = addr ? au ((char*)addr) : au("<null>");
-                                       console_out_f (_T("  [S] %08x (C=%08x D=%08X) '%s'\n"), node, get_long (node + 18), get_long (node + 14), name);
+                                       console_out_f (_T("  [S] %08x (C=%08x D=%08X) '%s'\n"), node, get_long_debug (node + 18), get_long_debug (node + 14), name);
                                        if (i == 4 - 1 || i == 14 - 1) {
                                                if (!_tcsicmp (name, _T("cia-a")) || !_tcsicmp (name, _T("cia-b"))) {
                                                        static const TCHAR *ciai[] = { _T("A"), _T("B"), _T("ALRM"), _T("SP"), _T("FLG") };
                                                        uaecptr cia = node + 22;
                                                        for (int j = 0; j < 5; j++) {
-                                                               uaecptr ciap = get_long (cia);
+                                                               uaecptr ciap = get_long_debug (cia);
                                                                console_out_f (_T("        %5s: %08x"), ciai[j], ciap);
                                                                if (ciap) {
-                                                                       uae_u8 *addr2 = get_real_address (get_long (ciap + 10));
+                                                                       uae_u8 *addr2 = get_real_address (get_long_debug (ciap + 10));
                                                                        TCHAR *name2 = addr ? au ((char*)addr2) : au("<null>");
-                                                                       console_out_f (_T(" (C=%08x D=%08X) '%s'"), get_long (ciap + 18), get_long (ciap + 14), name2);
+                                                                       console_out_f (_T(" (C=%08x D=%08X) '%s'"), get_long_debug (ciap + 18), get_long_debug (ciap + 14), name2);
                                                                        xfree (name2);
                                                                }
                                                                console_out_f (_T("\n"));
@@ -2771,7 +2848,7 @@ static void show_exec_lists (TCHAR t)
                                                }
                                        }
                                        xfree (name);
-                                       node = get_long (node);
+                                       node = get_long_debug (node);
                                        cnt++;
                                }
                                if (!cnt)
@@ -2796,12 +2873,12 @@ static void show_exec_lists (TCHAR t)
        }
        if (list == 0)
                return;
-       node = get_long (list);
-       while (get_long (node)) {
-               TCHAR *name = au ((char*)get_real_address (get_long (node + 10)));
+       node = get_long_debug (list);
+       while (get_long_debug (node)) {
+               TCHAR *name = au ((char*)get_real_address (get_long_debug (node + 10)));
                console_out_f (_T("%08x %s\n"), node, name);
                xfree (name);
-               node = get_long (node);
+               node = get_long_debug (node);
        }
 }
 
@@ -2951,7 +3028,7 @@ static void savemem (TCHAR **cc)
                return;
        }
        while (len > 0) {
-               b = get_byte (src);
+               b = get_byte_debug (src);
                src++;
                len--;
                if (fwrite (&b, 1, 1, fp) != 1) {
@@ -3031,7 +3108,7 @@ static void searchmem (TCHAR **cc)
                if (addr == endaddr)
                        break;
                for (i = 0; i < sslen; i++) {
-                       uae_u8 b = get_byte (addr + i);
+                       uae_u8 b = get_byte_debug (addr + i);
                        if (stringmode) {
                                if (tolower (b) != ss[i])
                                        break;
@@ -3166,11 +3243,11 @@ static void debug_sprite (TCHAR **inptr)
                sh10 = 0;
                saddr = addr;
                width = size * 16;
-               w1 = get_word (addr);
-               w2 = get_word (addr + size * 2);
+               w1 = get_word_debug (addr);
+               w2 = get_word_debug (addr + size * 2);
                console_out_f (_T("    %06X "), addr);
                for (i = 0; i < size * 2; i++)
-                       console_out_f (_T("%04X "), get_word (addr + i * 2));
+                       console_out_f (_T("%04X "), get_word_debug (addr + i * 2));
                console_out_f (_T("\n"));
 
                ypos = w1 >> 8;
@@ -3208,33 +3285,33 @@ static void debug_sprite (TCHAR **inptr)
                        if (addr2)
                                addr2 += size * 4;
                        if (size == 1) {
-                               w1 = get_word (addr);
-                               w2 = get_word (addr + 2);
+                               w1 = get_word_debug (addr);
+                               w2 = get_word_debug (addr + 2);
                                if (addr2) {
-                                       ww1 = get_word (addr2);
-                                       ww2 = get_word (addr2 + 2);
+                                       ww1 = get_word_debug (addr2);
+                                       ww2 = get_word_debug (addr2 + 2);
                                }
                        } else if (size == 2) {
-                               w1 = get_long (addr);
-                               w2 = get_long (addr + 4);
+                               w1 = get_long_debug (addr);
+                               w2 = get_long_debug (addr + 4);
                                if (addr2) {
-                                       ww1 = get_long (addr2);
-                                       ww2 = get_long (addr2 + 4);
+                                       ww1 = get_long_debug (addr2);
+                                       ww2 = get_long_debug (addr2 + 4);
                                }
                        } else if (size == 4) {
-                               w1 = get_long (addr + 0);
-                               w2 = get_long (addr + 8);
+                               w1 = get_long_debug (addr + 0);
+                               w2 = get_long_debug (addr + 8);
                                w1 <<= 32;
                                w2 <<= 32;
-                               w1 |= get_long (addr + 4);
-                               w2 |= get_long (addr + 12);
+                               w1 |= get_long_debug (addr + 4);
+                               w2 |= get_long_debug (addr + 12);
                                if (addr2) {
-                                       ww1 = get_long (addr2 + 0);
-                                       ww2 = get_long (addr2 + 8);
+                                       ww1 = get_long_debug (addr2 + 0);
+                                       ww2 = get_long_debug (addr2 + 8);
                                        ww1 <<= 32;
                                        ww2 <<= 32;
-                                       ww1 |= get_long (addr2 + 4);
-                                       ww2 |= get_long (addr2 + 12);
+                                       ww1 |= get_long_debug (addr2 + 4);
+                                       ww2 |= get_long_debug (addr2 + 12);
                                }
                        }
                        width = size * 16;
@@ -3267,7 +3344,7 @@ static void debug_sprite (TCHAR **inptr)
                console_out_f (_T("Attach: %d. AGA SSCAN/SH10 bit: %d\n"), attach, sh10);
 
                addr += size * 4;
-               if (get_word (addr) == 0 && get_word (addr + size * 4) == 0)
+               if (get_word_debug (addr) == 0 && get_word_debug (addr + size * 4) == 0)
                        break;
                max--;
                if (max <= 0)
@@ -3334,9 +3411,9 @@ static void find_ea (TCHAR **inptr)
                if ((addr & 1) == 0 && addr + 6 <= end) {
                        sea = 0xffffffff;
                        dea = 0xffffffff;
-                       m68k_disasm_ea (NULL, addr, NULL, 1, &sea, &dea);
+                       m68k_disasm_ea (addr, NULL, 1, &sea, &dea);
                        if (ea == sea || ea == dea) {
-                               m68k_disasm (stdout, addr, NULL, 1);
+                               m68k_disasm (addr, NULL, 1);
                                hits++;
                                if (hits > 100) {
                                        console_out_f (_T("Too many hits. End addr = %08X\n"), addr);
@@ -3438,7 +3515,7 @@ static BOOL debug_line (TCHAR *input)
                                if (more_params(&inptr))
                                        m68k_modify (&inptr);
                                else
-                                       m68k_dumpstate (stdout, &nextpc);
+                                       m68k_dumpstate (&nextpc);
                        }
                        break;
                case 'D': deepcheatsearch (&inptr); break;
@@ -3499,7 +3576,7 @@ static BOOL debug_line (TCHAR *input)
                                                count = readhex (&inptr);
                                        else
                                                count = 10;
-                                       m68k_disasm (stdout, daddr, &nxdis, count);
+                                       m68k_disasm (daddr, &nxdis, count);
                                }
                        }
                        break;
@@ -3605,9 +3682,9 @@ static BOOL debug_line (TCHAR *input)
                                        if (history[temp].pc == addr || addr == 0) {
                                                m68k_setpc (history[temp].pc);
                                                if (badly)
-                                                       m68k_dumpstate (stdout, NULL);
+                                                       m68k_dumpstate (NULL);
                                                else
-                                                       m68k_disasm (stdout, history[temp].pc, NULL, 1);
+                                                       m68k_disasm (history[temp].pc, NULL, 1);
                                                if (addr && history[temp].pc == addr)
                                                        break;
                                        }
@@ -3659,6 +3736,17 @@ static BOOL debug_line (TCHAR *input)
                                        break;
                                }
 #endif
+                               if (*inptr == 'm' && inptr[1] == 'u') {
+                                       if (currprefs.mmu_model) {
+                                               inptr += 2;
+                                               if (more_params (&inptr))
+                                                       debug_mmu_mode = readint (&inptr);
+                                               else
+                                                       debug_mmu_mode = 0;
+                                               console_out_f (_T("MMU translation function code = %d\n"), debug_mmu_mode);
+                                       }
+                                       break;
+                               }
                                if (more_params (&inptr)) {
                                        maddr = readhex (&inptr);
                                } else {
@@ -3703,7 +3791,7 @@ static BOOL debug_line (TCHAR *input)
                                return true;
                        break;
                case 'U':
-                       if (currprefs.cpu_model && more_params (&inptr)) {
+                       if (currprefs.mmu_model && more_params (&inptr)) {
                                int i;
                                uaecptr addrl = readhex (&inptr);
                                uaecptr addrp;
@@ -3713,10 +3801,16 @@ static BOOL debug_line (TCHAR *input)
                                        bool data = (i & 1) != 0;
                                        console_out_f (_T("S%dD%d="), super, data);
                                        TRY(prb) {
-                                               addrp = mmu_translate (addrl, super, data, false);
+                                               if (currprefs.mmu_model >= 68040)
+                                                       addrp = mmu_translate (addrl, super, data, false);
+                                               else
+                                                       addrp = mmu030_translate (addrl, super, data, false);
                                                console_out_f (_T("%08X"), addrp);
                                                TRY(prb2) {
-                                                       addrp = mmu_translate (addrl, super, data, true);
+                                                       if (currprefs.mmu_model >= 68040)
+                                                               addrp = mmu_translate (addrl, super, data, true);
+                                                       else
+                                                               addrp = mmu030_translate (addrl, super, data, true);
                                                        console_out_f (_T(" RW"));
                                                } CATCH(prb2) {
                                                        console_out_f (_T(" RO"));
@@ -3744,7 +3838,7 @@ static void debug_1 (void)
 {
        TCHAR input[MAX_LINEWIDTH];
 
-       m68k_dumpstate (stdout, &nextpc);
+       m68k_dumpstate (&nextpc);
        nxdis = nextpc; nxmem = 0;
        debugger_active = 1;
 
@@ -3817,7 +3911,7 @@ void debug (void)
                        int bp = 0;
 
                        pc = munge24 (m68k_getpc ());
-                       opcode = currprefs.cpu_model < 68020 && (currprefs.cpu_compatible || currprefs.cpu_cycle_exact) ? regs.ir : get_word (pc);
+                       opcode = currprefs.cpu_model < 68020 && (currprefs.cpu_compatible || currprefs.cpu_cycle_exact) ? regs.ir : get_word_debug (pc);
 
                        for (i = 0; i < BREAKPOINT_TOTAL; i++) {
                                if (!bpnodes[i].enabled)
@@ -3833,31 +3927,31 @@ void debug (void)
                                if (skipaddr_start == pc)
                                        bp = 1;
                                if ((processptr || processname) && notinrom()) {
-                                       uaecptr execbase = get_long (4);
-                                       uaecptr activetask = get_long (execbase + 276);
-                                       int process = get_byte (activetask + 8) == 13 ? 1 : 0;
-                                       char *name = (char*)get_real_address (get_long (activetask + 10));
+                                       uaecptr execbase = get_long_debug (4);
+                                       uaecptr activetask = get_long_debug (execbase + 276);
+                                       int process = get_byte_debug (activetask + 8) == 13 ? 1 : 0;
+                                       char *name = (char*)get_real_address (get_long_debug (activetask + 10));
                                        if (process) {
-                                               uaecptr cli = BPTR2APTR(get_long (activetask + 172));
+                                               uaecptr cli = BPTR2APTR(get_long_debug (activetask + 172));
                                                uaecptr seglist = 0;
 
                                                uae_char *command = NULL;
                                                if (cli) {
                                                        if (processname)
-                                                               command = (char*)get_real_address (BPTR2APTR(get_long (cli + 16)));
-                                                       seglist = BPTR2APTR(get_long (cli + 60));
+                                                               command = (char*)get_real_address (BPTR2APTR(get_long_debug (cli + 16)));
+                                                       seglist = BPTR2APTR(get_long_debug (cli + 60));
                                                } else {
-                                                       seglist = BPTR2APTR(get_long (activetask + 128));
-                                                       seglist = BPTR2APTR(get_long (seglist + 12));
+                                                       seglist = BPTR2APTR(get_long_debug (activetask + 128));
+                                                       seglist = BPTR2APTR(get_long_debug (seglist + 12));
                                                }
                                                if (activetask == processptr || (processname && (!stricmp (name, processname) || (command && command[0] && !strnicmp (command + 1, processname, command[0]) && processname[command[0]] == 0)))) {
                                                        while (seglist) {
-                                                               uae_u32 size = get_long (seglist - 4) - 4;
+                                                               uae_u32 size = get_long_debug (seglist - 4) - 4;
                                                                if (pc >= (seglist + 4) && pc < (seglist + size)) {
                                                                        bp = 1;
                                                                        break;
                                                                }
-                                                               seglist = BPTR2APTR(get_long (seglist));
+                                                               seglist = BPTR2APTR(get_long_debug (seglist));
                                                        }
                                                }
                                        }
@@ -3949,7 +4043,7 @@ const TCHAR *debuginfo (int mode)
        static TCHAR txt[100];
        uae_u32 pc = M68K_GETPC;
        _stprintf (txt, _T("PC=%08X INS=%04X %04X %04X"),
-               pc, get_word (pc), get_word (pc + 2), get_word (pc + 4));
+               pc, get_word_debug (pc), get_word_debug (pc + 2), get_word_debug (pc + 4));
        return txt;
 }
 
@@ -4040,7 +4134,7 @@ void mmu_do_hit (void)
                put_word (m68k_areg (regs, 7), 0x7002);
        }
        m68k_areg (regs, 7) -= 4;
-       put_long (m68k_areg (regs, 7), get_long (p - 4));
+       put_long (m68k_areg (regs, 7), get_long_debug (p - 4));
        m68k_areg (regs, 7) -= 2;
        put_word (m68k_areg (regs, 7), mmur.sr);
 #ifdef JIT
@@ -4137,13 +4231,13 @@ static int mmu_hit (uaecptr addr, int size, int rwi, uae_u32 *v)
                                                switch (size)
                                                {
                                                case 4:
-                                                       *v = get_long (maddr);
+                                                       *v = get_long_debug (maddr);
                                                        break;
                                                case 2:
-                                                       *v = get_word (maddr);
+                                                       *v = get_word_debug (maddr);
                                                        break;
                                                case 1:
-                                                       *v = get_byte (maddr);
+                                                       *v = get_byte_debug (maddr);
                                                        break;
                                                }
                                        }
@@ -4200,12 +4294,12 @@ static void mmu_free(void)
 
 static int getmmubank(struct mmudata *snptr, uaecptr p)
 {
-       snptr->flags = get_long (p);
+       snptr->flags = get_long_debug (p);
        if (snptr->flags == 0xffffffff)
                return 1;
-       snptr->addr = get_long (p + 4);
-       snptr->len = get_long (p + 8);
-       snptr->remap = get_long (p + 12);
+       snptr->addr = get_long_debug (p + 4);
+       snptr->len = get_long_debug (p + 8);
+       snptr->remap = get_long_debug (p + 12);
        snptr->p_addr = p;
        return 0;
 }
@@ -4244,21 +4338,21 @@ int mmu_init(int mode, uaecptr parm, uaecptr parm2)
 
        p = parm;
        mmu_struct = p;
-       if (get_long (p) != 1) {
-               console_out_f (_T("MMU: version mismatch %d <> %d\n"), get_long (p), 1);
+       if (get_long_debug (p) != 1) {
+               console_out_f (_T("MMU: version mismatch %d <> %d\n"), get_long_debug (p), 1);
                return 0;
        }
        p += 4;
-       mmu_logging = get_long (p) & 1;
+       mmu_logging = get_long_debug (p) & 1;
        p += 4;
-       mmu_callback = get_long (p);
+       mmu_callback = get_long_debug (p);
        p += 4;
-       mmu_regs = get_long (p);
+       mmu_regs = get_long_debug (p);
        p += 4;
 
        if (mode == 3) {
                int off;
-               uaecptr addr = get_long (parm2 + 4);
+               uaecptr addr = get_long_debug (parm2 + 4);
                if (!mmu_enabled)
                        return 0;
                off = addr >> MMU_PAGE_SHIFT;
@@ -4279,12 +4373,12 @@ int mmu_init(int mode, uaecptr parm, uaecptr parm2)
        mmu_slots = 1 << ((currprefs.address_space_24 ? 24 : 32) - MMU_PAGE_SHIFT);
        mmunl = xcalloc (struct mmunode*, mmu_slots);
        size = 1;
-       p2 = get_long (p);
-       while (get_long (p2) != 0xffffffff) {
+       p2 = get_long_debug (p);
+       while (get_long_debug (p2) != 0xffffffff) {
                p2 += 16;
                size++;
        }
-       p = banks = get_long (p);
+       p = banks = get_long_debug (p);
        snptr = mmubanks = xmalloc (struct mmudata, size);
        for (;;) {
                int off;
@@ -4315,10 +4409,12 @@ void debug_parser (const TCHAR *cmd, TCHAR *out, uae_u32 outsize)
 {
        TCHAR empty[2] = { 0 };
        TCHAR *input = my_strdup (cmd);
-       if (out == NULL || outsize == 0)
+       if (out == NULL && outsize == 0) {
                setconsolemode (empty, 1);
-       else
+       } else if (out != NULL && outsize > 0) {
+               out[0] = 0;
                setconsolemode (out, outsize);
+       }
        debug_line (input);
        setconsolemode (NULL, 0);
        xfree (input);
index 4e7c7e5256d78669d241bbaf7051e1295cfe08b9..5cbb05ad0b65b4a48eaae7a7951bfe59b5eaf262 100644 (file)
--- a/disk.cpp
+++ b/disk.cpp
@@ -262,30 +262,30 @@ static int dirhash (const uae_char *name)
 
 static void disk_date (uae_u8 *p)
 {
-       time_t t;
-       struct tm *today;
-       int year, days, minutes, ticks;
-       TCHAR tmp[10];
-
-       time (&t);
-       today = localtime( &t );
-       _tcsftime (tmp, sizeof tmp / sizeof (TCHAR), _T("%Y"), today);
-       year = _tstoi (tmp);
-       _tcsftime (tmp, sizeof tmp / sizeof (TCHAR), _T("%j"), today);
-       days = _tstoi (tmp) - 1;
-       _tcsftime (tmp, sizeof tmp / sizeof (TCHAR), _T("%H"), today);
-       minutes = _tstoi (tmp) * 60;
-       _tcsftime (tmp, sizeof tmp / sizeof (TCHAR), _T("%M"), today);
-       minutes += _tstoi (tmp);
-       _tcsftime (tmp, sizeof tmp / sizeof (TCHAR), _T("%S"), today);
-       ticks = _tstoi (tmp) * 50;
-       while (year > 1978) {
-               if ( !(year % 100) ? !(year % 400) : !(year % 4) ) days++;
-               days += 365;
-               year--;
+       static int pdays, pmins, pticks;
+       int days, mins, ticks;
+       struct timeval tv;
+       struct mytimeval mtv;
+
+       gettimeofday (&tv, NULL);
+       tv.tv_sec -= _timezone;
+       mtv.tv_sec = tv.tv_sec;
+       mtv.tv_usec = tv.tv_usec;
+       timeval_to_amiga (&mtv, &days, &mins, &ticks);
+       if (days == pdays && mins == pmins && ticks == pticks) {
+               ticks++;
+               if (ticks >= 50 * 60) {
+                       ticks = 0;
+                       mins++;
+                       if (mins >= 24 * 60)
+                               days++;
+               }
        }
+       pdays = days;
+       pmins = mins;
+       pticks = ticks;
        p[0] = days >> 24; p[1] = days >> 16; p[2] = days >> 8; p[3] = days >> 0;
-       p[4] = minutes >> 24; p[5] = minutes >> 16; p[6] = minutes >> 8; p[7] = minutes >> 0;
+       p[4] = mins >> 24; p[5] = mins >> 16; p[6] = mins >> 8; p[7] = mins >> 0;
        p[8] = ticks >> 24; p[9] = ticks >> 16; p[10] = ticks >> 8; p[11] = ticks >> 0;
 }
 
@@ -297,27 +297,43 @@ static void createbootblock (uae_u8 *sector, int bootable)
                memcpy (sector, bootblock_ofs, sizeof bootblock_ofs);
 }
 
-static void createrootblock (uae_u8 *sector, char *disk_name)
+static void createrootblock (uae_u8 *sector, const TCHAR *disk_name)
 {
+       char *dn = ua (disk_name);
+       char *dn2 = dn;
+       dn2[30] = 0;
+       if (dn2[0] == 0)
+               dn2 = "empty";
        memset (sector, 0, FS_FLOPPY_BLOCKSIZE);
        sector[0+3] = 2;
        sector[12+3] = 0x48;
        sector[312] = sector[313] = sector[314] = sector[315] = (uae_u8)0xff;
        sector[316+2] = 881 >> 8; sector[316+3] = 881 & 255;
-       sector[432] = strlen (disk_name);
-       strcpy ((char*)sector + 433, disk_name);
+       sector[432] = strlen (dn2);
+       strcpy ((char*)sector + 433, dn2);
        sector[508 + 3] = 1;
        disk_date (sector + 420);
        memcpy (sector + 472, sector + 420, 3 * 4);
        memcpy (sector + 484, sector + 420, 3 * 4);
+       xfree (dn);
 }
 
-static int getblock (uae_u8 *bitmap)
+static int getblock (uae_u8 *bitmap, int *prev)
 {
-       int i = 0;
+       int i = *prev;
+       while (bitmap[i] != 0xff) {
+               if (bitmap[i] == 0) {
+                       bitmap[i] = 1;
+                       *prev = i;
+                       return i;
+               }
+               i++;
+       }
+       i = 0;
        while (bitmap[i] != 0xff) {
                if (bitmap[i] == 0) {
                        bitmap[i] = 1;
+                       *prev = i;
                        return i;
                }
                i++;
@@ -333,9 +349,9 @@ static void pl (uae_u8 *sector, int offset, uae_u32 v)
        sector[offset + 3] = v >> 0;
 }
 
-static int createdirheaderblock (uae_u8 *sector, int parent, const char *filename, uae_u8 *bitmap)
+static int createdirheaderblock (uae_u8 *sector, int parent, const char *filename, uae_u8 *bitmap, int *prevblock)
 {
-       int block = getblock (bitmap);
+       int block = getblock (bitmap, prevblock);
 
        memset (sector, 0, FS_FLOPPY_BLOCKSIZE);
        pl (sector, 0, 2);
@@ -348,12 +364,12 @@ static int createdirheaderblock (uae_u8 *sector, int parent, const char *filenam
        return block;
 }
 
-static int createfileheaderblock (struct zfile *z,uae_u8 *sector, int parent, const char *filename, struct zfile *src, uae_u8 *bitmap)
+static int createfileheaderblock (struct zfile *z,uae_u8 *sector, int parent, const char *filename, struct zfile *src, uae_u8 *bitmap, int *prevblock)
 {
        uae_u8 sector2[FS_FLOPPY_BLOCKSIZE];
        uae_u8 sector3[FS_FLOPPY_BLOCKSIZE];
-       int block = getblock (bitmap);
-       int datablock = getblock (bitmap);
+       int block = getblock (bitmap, prevblock);
+       int datablock = getblock (bitmap, prevblock);
        int datasec = 1;
        int extensions;
        int extensionblock, extensioncounter, headerextension = 1;
@@ -383,7 +399,7 @@ static int createfileheaderblock (struct zfile *z,uae_u8 *sector, int parent, co
                int extensionblock2 = extensionblock;
                if (extensioncounter == FS_EXTENSION_BLOCKS) {
                        extensioncounter = 0;
-                       extensionblock = getblock (bitmap);
+                       extensionblock = getblock (bitmap, prevblock);
                        if (datasec > FS_EXTENSION_BLOCKS + 1) {
                                pl (sector3, 8, FS_EXTENSION_BLOCKS);
                                pl (sector3, FS_FLOPPY_BLOCKSIZE - 8, extensionblock);
@@ -406,7 +422,7 @@ static int createfileheaderblock (struct zfile *z,uae_u8 *sector, int parent, co
                zfile_fread (sector2 + 24, size > FS_OFS_DATABLOCKSIZE ? FS_OFS_DATABLOCKSIZE : size, 1, src);
                size -= FS_OFS_DATABLOCKSIZE;
                datablock = 0;
-               if (size > 0) datablock = getblock (bitmap);
+               if (size > 0) datablock = getblock (bitmap, prevblock);
                pl (sector2, 16, datablock);
                disk_checksum(sector2, sector2 + 20);
                writeimageblock (z, sector2, datablock2 * FS_FLOPPY_BLOCKSIZE);
@@ -428,15 +444,25 @@ static int createfileheaderblock (struct zfile *z,uae_u8 *sector, int parent, co
 
 static void createbitmapblock (uae_u8 *sector, uae_u8 *bitmap)
 {
-       uae_u8 mask;
        int i, j;
        memset (sector, 0, FS_FLOPPY_BLOCKSIZE);
-       for (i = FS_FLOPPY_RESERVED; i < FS_FLOPPY_TOTALBLOCKS; i += 8) {
-               mask = 0;
-               for (j = 0; j < 8; j++) {
-                       if (bitmap[i + j]) mask |= 1 << j;
+       i = 0;
+       for (;;) {
+               uae_u32 mask = 0;
+               for (j = 0; j < 32; j++) {
+                       if (bitmap[2 + i * 32 + j] == 0xff)
+                               break;
+                       if (!bitmap[2 + i * 32 + j])
+                               mask |= 1 << j;
                }
-               sector[4 + i / 8] = mask;
+               sector[4 + i * 4 + 0] = mask >> 24;
+               sector[4 + i * 4 + 1] = mask >> 16;
+               sector[4 + i * 4 + 2] = mask >>  8;
+               sector[4 + i * 4 + 3] = mask >>  0;
+               if (bitmap[2 + i * 32 + j] == 0xff)
+                       break;
+               i++;
+
        }
        disk_checksum(sector, sector + 0);
 }
@@ -455,6 +481,7 @@ static int createimagefromexe (struct zfile *src, struct zfile *dst)
        char *fname2 = "startup-sequence";
        char *dirname1 = "s";
        struct zfile *ss;
+       int prevblock;
 
        memset (bitmap, 0, sizeof bitmap);
        zfile_fseek (src, 0, SEEK_END);
@@ -470,19 +497,21 @@ static int createimagefromexe (struct zfile *src, struct zfile *dst)
        bitmap[881] = 1;
        bitmap[0] = 1;
        bitmap[1] = 1;
+       bitmap[1760] = -1;
+       prevblock = 880;
 
-       dblock1 = createdirheaderblock (sector2, 880, dirname1, bitmap);
+       dblock1 = createdirheaderblock (sector2, 880, dirname1, bitmap, &prevblock);
        ss = zfile_fopen_empty (src, fname1b, strlen (fname1));
        zfile_fwrite (fname1, strlen(fname1), 1, ss);
-       fblock1 = createfileheaderblock (dst, sector1,  dblock1, fname2, ss, bitmap);
+       fblock1 = createfileheaderblock (dst, sector1,  dblock1, fname2, ss, bitmap, &prevblock);
        zfile_fclose (ss);
        pl (sector2, 24 + dirhash (fname2) * 4, fblock1);
        disk_checksum(sector2, sector2 + 20);
        writeimageblock (dst, sector2, dblock1 * FS_FLOPPY_BLOCKSIZE);
 
-       fblock1 = createfileheaderblock (dst, sector1, 880, fname1, src, bitmap);
+       fblock1 = createfileheaderblock (dst, sector1, 880, fname1, src, bitmap, &prevblock);
 
-       createrootblock (sector1, "empty");
+       createrootblock (sector1, zfile_getfilename (src));
        pl (sector1, 24 + dirhash (fname1) * 4, fblock1);
        pl (sector1, 24 + dirhash (dirname1) * 4, dblock1);
        disk_checksum(sector1, sector1 + 20);
@@ -497,6 +526,11 @@ static int createimagefromexe (struct zfile *src, struct zfile *dst)
        return 1;
 }
 
+static bool isfloppysound (drive *drv)
+{
+       return drv->useturbo == 0;
+}
+
 static int get_floppy_speed (void)
 {
        int m = currprefs.floppy_speed;
@@ -654,12 +688,12 @@ static void reset_drive (int num)
 }
 
 /* code for track display */
-static void update_drive_gui (int num)
+static void update_drive_gui (int num, bool force)
 {
        drive *drv = floppy + num;
        bool writ = dskdmaen == DSKDMA_WRITE && drv->state && !((selected | disabled) & (1 << num));
 
-       if (drv->state == gui_data.drive_motor[num]
+       if (!force && drv->state == gui_data.drive_motor[num]
                && drv->cyl == gui_data.drive_track[num]
                && side == gui_data.drive_side
                && drv->crc32 == gui_data.crc32[num]
@@ -1138,9 +1172,10 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
        drv->mfmpos %= drv->tracklen;
        drv->prevtracklen = 0;
 #ifdef DRIVESOUND
-       driveclick_insert (drv - floppy, 0);
+       if (isfloppysound (drv))
+               driveclick_insert (drv - floppy, 0);
 #endif
-       update_drive_gui (drv - floppy);
+       update_drive_gui (drv - floppy, false);
        return 1;
 }
 
@@ -1203,7 +1238,8 @@ static void drive_step (drive * drv, int step_direction)
                if (drv->cyl) {
                        drv->cyl--;
 #ifdef DRIVESOUND
-                       driveclick_click (drv - floppy, drv->cyl);
+                       if (isfloppysound (drv))
+                               driveclick_click (drv - floppy, drv->cyl);
 #endif
                }
                /*      else
@@ -1222,7 +1258,8 @@ static void drive_step (drive * drv, int step_direction)
                if (drv->cyl >= maxtrack)
                        write_log (_T("program tried to step over track %d\n"), maxtrack);
 #ifdef DRIVESOUND
-               driveclick_click (drv - floppy, drv->cyl);
+               if (isfloppysound (drv))
+                       driveclick_click (drv - floppy, drv->cyl);
 #endif
        }
        rand_shifter (drv);
@@ -1264,7 +1301,8 @@ static void drive_motor (drive * drv, bool off)
                drv->dskready_up_time = DSKREADY_UP_TIME;
                rand_shifter (drv);
 #ifdef DRIVESOUND
-               driveclick_motor (drv - floppy, drv->dskready_down_time == 0 ? 2 : 1);
+               if (isfloppysound (drv))
+                       driveclick_motor (drv - floppy, drv->dskready_down_time == 0 ? 2 : 1);
 #endif
                if (disk_debug_logging > 1)
                        write_log (_T(" ->motor on"));
@@ -2142,7 +2180,8 @@ static void drive_write_data (drive * drv)
 static void drive_eject (drive * drv)
 {
 #ifdef DRIVESOUND
-       driveclick_insert (drv - floppy, 1);
+       if (isfloppysound (drv))
+               driveclick_insert (drv - floppy, 1);
 #endif
        gui_disk_image_change (drv - floppy, NULL, drv->wrprot);
        drive_image_free (drv);
@@ -2395,7 +2434,7 @@ void disk_eject (int num)
        drive_eject (floppy + num);
        *currprefs.floppyslots[num].df = *changed_prefs.floppyslots[num].df = 0;
        floppy[num].newname[0] = 0;
-       update_drive_gui (num);
+       update_drive_gui (num, true);
 }
 
 int DISK_history_add (const TCHAR *name, int idx, int type, int donotcheck)
@@ -2535,7 +2574,7 @@ void DISK_vsync (void)
                                drive_insert (drv, &currprefs, i, drv->newname, false);
                                if (disk_debug_logging > 0)
                                        write_log (_T("delayed insert, drive %d, image '%s'\n"), i, drv->newname);
-                               update_drive_gui (i);
+                               update_drive_gui (i, false);
                        }
                }
        }
@@ -2655,7 +2694,7 @@ void DISK_select (uae_u8 data)
 
        for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
                floppy[dr].state = (!(selected & (1 << dr))) | !floppy[dr].motoroff;
-               update_drive_gui (dr);
+               update_drive_gui (dr, false);
        }
        prev_data = data;
        if (disk_debug_logging > 1)
@@ -3368,7 +3407,7 @@ void DSKLEN (uae_u16 v, int hpos)
        }
 
        for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++)
-               update_drive_gui (dr);
+               update_drive_gui (dr, false);
 
        /* Try to make floppy access from Kickstart faster.  */
        if (dskdmaen != DSKDMA_READ && dskdmaen != DSKDMA_WRITE)
@@ -3721,8 +3760,10 @@ void restore_disk_finish (void)
 {
        int cnt = 0;
        for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) {
-               if (currprefs.floppyslots[i].dfxtype >= 0)
+               if (currprefs.floppyslots[i].dfxtype >= 0) {
+                       update_drive_gui (i, true);
                        cnt++;
+               }
        }
        currprefs.nr_floppies = changed_prefs.nr_floppies = cnt;
        DISK_check_change ();
index 92011c4cbd2e7a574aec135362627965b035f03e..542a87305659aa4d8bcb5fb9ccc6e94755e22066 100644 (file)
@@ -344,14 +344,29 @@ extern int lof_store;
 
 static int gclow, gcloh, gclox, gcloy, gclorealh;
 
-void get_custom_topedge (int *x, int *y)
+void get_custom_topedge (int *xp, int *yp, bool max)
 {
-       if (isnativevidbuf ()) {
-               *x = visible_left_border + (DISPLAY_LEFT_SHIFT << currprefs.gfx_resolution);
-               *y = minfirstline << currprefs.gfx_vresolution;
+       
+       if (isnativevidbuf () && !max) {
+               int x, y;
+               x = visible_left_border + (DISPLAY_LEFT_SHIFT << currprefs.gfx_resolution);
+               y = minfirstline << currprefs.gfx_vresolution;
+#if 0
+               int dbl1, dbl2;
+               dbl2 = dbl1 = currprefs.gfx_vresolution;
+               if (doublescan > 0 && interlace_seen <= 0) {
+                       dbl1--;
+                       dbl2--;
+               }
+               x = -(visible_left_border + (DISPLAY_LEFT_SHIFT << currprefs.gfx_resolution));
+               y = -minfirstline << currprefs.gfx_vresolution;
+               y = xshift (y, dbl2);
+#endif
+               *xp = x;
+               *yp = y;
        } else {
-               *x = 0;
-               *y = 0;
+               *xp = 0;
+               *yp = 0;
        }
 }
 
@@ -653,6 +668,25 @@ static int src_pixel, ham_src_pixel;
 static int unpainted;
 static int seen_sprites;
 
+STATIC_INLINE xcolnr getbgc (bool blank)
+{
+#if 0
+       if (blank)
+               return xcolors[0x088];
+       else if (hposblank == 1)
+               return xcolors[0xf00];
+       else if (hposblank == 2)
+               return xcolors[0x0f0];
+       else if (hposblank == 3)
+               return xcolors[0x00f];
+       else if (brdblank)
+               return xcolors[0x880];
+       //return colors_for_drawing.acolors[0];
+       return xcolors[0xf0f];
+#endif
+       return (blank || hposblank || colors_for_drawing.borderblank) ? 0 : colors_for_drawing.acolors[0];
+}
+
 /* Initialize the variables necessary for drawing a line.
 * This involves setting up start/stop positions and display window
 * borders.  */
@@ -775,25 +809,6 @@ STATIC_INLINE uae_u32 merge_2pixel32 (uae_u32 p1, uae_u32 p2)
        return v;
 }
 
-STATIC_INLINE xcolnr getbgc (bool blank)
-{
-#if 0
-       if (blank)
-               return xcolors[0x088];
-       else if (hposblank == 1)
-               return xcolors[0xf00];
-       else if (hposblank == 2)
-               return xcolors[0x0f0];
-       else if (hposblank == 3)
-               return xcolors[0x00f];
-       else if (brdblank)
-               return xcolors[0x880];
-       //return colors_for_drawing.acolors[0];
-       return xcolors[0xf0f];
-#endif
-       return (blank || hposblank || colors_for_drawing.borderblank) ? 0 : colors_for_drawing.acolors[0];
-}
-
 STATIC_INLINE void fill_line_16 (uae_u8 *buf, int start, int stop, bool blank)
 {
        uae_u16 *b = (uae_u16 *)buf;
@@ -2843,7 +2858,7 @@ void redraw_frame (void)
        flush_screen (gfxvidinfo.inbuffer, 0, 0);
 }
 
-void vsync_handle_check (void)
+bool vsync_handle_check (void)
 {
        check_picasso ();
 
@@ -2865,6 +2880,7 @@ void vsync_handle_check (void)
        check_prefs_changed_cd ();
        check_prefs_changed_custom ();
        check_prefs_changed_cpu ();
+       return changed != 0;
 }
 
 void vsync_handle_redraw (int long_frame, int lof_changed, uae_u16 bplcon0p, uae_u16 bplcon3p)
@@ -3024,6 +3040,7 @@ bool notice_interlace_seen (bool lace)
 
 static void clearbuffer (struct vidbuffer *dst)
 {
+       return;
        if (!dst->bufmem_allocated)
                return;
        uae_u8 *p = dst->bufmem_allocated;
index 6682812a50630309131c3acb192a16ceef9abcce..7932aa2ff67431accf48989e3fca1b8b37d4175f 100644 (file)
@@ -32,9 +32,10 @@ FreeMem = -210
 PP_MAXSIZE = 4 * 96
 PP_FSSIZE = 400
 PP_FSPTR = 404
-PP_FSRES = 408
-PP_EXPLIB = 412
-PP_FSHDSTART = 416
+PP_ADDTOFSRES = 408
+PP_FSRES = 412
+PP_EXPLIB = 416
+PP_FSHDSTART = 420
 PP_TOTAL = (PP_FSHDSTART+140)
 
 NOTIFY_CLASS = $40000000
@@ -49,7 +50,9 @@ NRF_MAGIC = $80000000
 our_seglist:
        dc.l 0                                                                  ; 8 /* NextSeg */
 start:
-       dc.l 9                                          ;0 12
+       bra.s startjmp
+       dc.w 9                                          ;0 12
+startjmp:
        bra.w filesys_mainloop          ;1 16
        dc.l make_dev-start                     ;2 20
        dc.l filesys_init-start         ;3 24
@@ -605,7 +608,8 @@ r13
 r0     move.l d7,d0
        movem.l (sp)+,d1-d7/a1-a6
        rts
-ree    moveq #0,d7
+ree    sub.l a0,a0
+       moveq #0,d7
        bra.s r0
 
 fsres:
@@ -1021,9 +1025,12 @@ do_mount:
        move.l d0,32(a3)         ; dn_SegList
 
 dont_mount:
-       tst.l PP_FSPTR(a1)      ; filesystem?
-       beq.s nordbfs2
        move.l PP_FSPTR(a1),a0
+       tst.l PP_FSSIZE(a1)
+       beq.s nordbfs3
+       ; filesystem needs relocation?
+       move.l a0,d0
+       beq.s nordbfs2
        bsr.w relocate
        movem.l d0/a0-a1,-(sp)
        move.l PP_FSSIZE(a1),d0
@@ -1031,8 +1038,13 @@ dont_mount:
        move.l 4.w,a6
        jsr FreeMem(a6)
        movem.l (sp)+,d0/a0-a1
+       clr.l PP_FSSIZE(a1)
+       move.l a0,PP_FSPTR(a1)
        tst.l d0
        beq.s nordbfs2
+nordbfs3:
+       tst.l PP_ADDTOFSRES(a1)
+       beq.s nordbfs2
        bsr.w addfs
 nordbfs2:
 
index dd5750fac20a9adcd710cc89517a8f4fe63964f2..8f18ba0c7875c1ec703dba8d121d55747f5cf154 100644 (file)
@@ -82,7 +82,8 @@ int log_filesys = 0;
 
 static uae_sem_t test_sem;
 
-int bootrom_header, bootrom_items;
+static int bootrom_header;
+
 static uae_u32 dlg (uae_u32 a)
 {
        return (dbg (a + 0) << 24) | (dbg (a + 1) << 16) | (dbg (a + 2) << 8) | (dbg (a + 3) << 0);
@@ -174,6 +175,8 @@ typedef struct {
        uae_u8 *rdb_filesysstore;
        int rdb_filesyssize;
        TCHAR *filesysdir;
+       /* filesystem seglist */
+       uaecptr filesysseg;
 
        /* CDFS */
        bool cd_open;
@@ -203,7 +206,7 @@ int nr_directory_units (struct uae_prefs *p)
        int i, cnt = 0;
        if (p) {
                for (i = 0; i < p->mountitems; i++) {
-                       if (p->mountconfig[i].controller == 0)
+                       if (p->mountconfig[i].ci.controller == 0)
                                cnt++;
                }
        } else {
@@ -228,7 +231,7 @@ int is_hardfile (int unit_no)
                        return FILESYS_CD;
                return FILESYS_VIRTUAL;
        }
-       if (mountinfo.ui[unit_no].hf.secspertrack == 0) {
+       if (mountinfo.ui[unit_no].hf.ci.sectors == 0) {
                if (mountinfo.ui[unit_no].hf.flags & 1)
                        return FILESYS_HARDDRIVE;
                return FILESYS_HARDFILE_RDB;
@@ -268,7 +271,7 @@ static void close_filesys_unit (UnitInfo *uip)
        uip->cd_open = 0;
 }
 
-static uaedev_config_info *getuci (struct uaedev_config_info *uci, int nr)
+static uaedev_config_data *getuci (struct uaedev_config_data *uci, int nr)
 {
        return &uci[nr];
 }
@@ -287,7 +290,7 @@ static UnitInfo *getuip (struct uae_prefs *p, int index)
 int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo *mi)
 {
        UnitInfo *ui = getuip (p, index);
-       struct uaedev_config_info *uci = &p->mountconfig[index];
+       struct uaedev_config_data *uci = &p->mountconfig[index];
        UnitInfo uitmp;
 
        memset (mi, 0, sizeof (struct mountedinfo));
@@ -296,23 +299,23 @@ int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo *
                ui = &uitmp;
                if (!uci->ishdf) {
                        mi->ismounted = 1;
-                       if (uci->rootdir && _tcslen (uci->rootdir) == 0)
+                       if (uci->ci.rootdir && _tcslen (uci->ci.rootdir) == 0)
                                return FILESYS_VIRTUAL;
-                       if (my_existsfile (uci->rootdir)) {
+                       if (my_existsfile (uci->ci.rootdir)) {
                                mi->ismedia = 1;
                                return FILESYS_VIRTUAL;
                        }
-                       if (my_getvolumeinfo (uci->rootdir) < 0)
+                       if (my_getvolumeinfo (uci->ci.rootdir) < 0)
                                return -1;
                        mi->ismedia = true;
                        return FILESYS_VIRTUAL;
                } else {
-                       ui->hf.readonly = true;
-                       ui->hf.blocksize = uci->blocksize;
-                       if (!hdf_open (&ui->hf, uci->rootdir)) {
+                       ui->hf.ci.readonly = true;
+                       ui->hf.ci.blocksize = uci->ci.blocksize;
+                       if (!hdf_open (&ui->hf, uci->ci.rootdir)) {
                                mi->ismedia = false;
                                mi->ismounted = true;
-                               if (uci->reserved == 0 && uci->sectors == 0 && uci->surfaces == 0) {
+                               if (uci->ci.reserved == 0 && uci->ci.sectors == 0 && uci->ci.surfaces == 0) {
                                        if (ui->hf.flags & 1)
                                                return FILESYS_HARDDRIVE;
                                        return FILESYS_HARDFILE_RDB;
@@ -334,14 +337,14 @@ int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo *
                }
        }
        mi->size = ui->hf.virtsize;
-       if (uci->cyls) {
-               mi->nrcyls = uci->cyls;
+       if (uci->ci.highcyl) {
+               uci->ci.cyls = mi->nrcyls = uci->ci.highcyl;
        } else {
-               mi->nrcyls = (int)(uci->sectors * uci->surfaces ? (ui->hf.virtsize / uci->blocksize) / (uci->sectors * uci->surfaces) : 0);
+               uci->ci.cyls = mi->nrcyls = (int)(uci->ci.sectors * uci->ci.surfaces ? (ui->hf.virtsize / uci->ci.blocksize) / (uci->ci.sectors * uci->ci.surfaces) : 0);
        }
        if (!uci->ishdf)
                return FILESYS_VIRTUAL;
-       if (uci->reserved == 0 && uci->sectors == 0 && uci->surfaces == 0) {
+       if (uci->ci.reserved == 0 && uci->ci.sectors == 0 && uci->ci.surfaces == 0) {
                if (ui->hf.flags & 1)
                        return FILESYS_HARDDRIVE;
                return FILESYS_HARDFILE_RDB;
@@ -479,18 +482,36 @@ static int set_filesys_volume (const TCHAR *rootdir, int *flags, bool *readonly,
        return 1;
 }
 
-static int set_filesys_unit_1 (int nr,
-       const TCHAR *devname, const TCHAR *volname, const TCHAR *rootdir, bool readonly,
-       int cyls, int secspertrack, int surfaces, int reserved,
-       int blocksize, int bootpri, bool donotmount, bool autoboot,
-       const TCHAR *filesysdir, int hdc, int flags)
+void uci_set_defaults (struct uaedev_config_info *uci, bool rdb)
+{
+       memset (uci, 0, sizeof (struct uaedev_config_info));
+       if (!rdb) {
+               uci->sectors = 32;
+               uci->reserved = 2;
+               uci->surfaces = 1;
+       }
+       uci->blocksize = 512;
+       uci->autoboot = true;
+       uci->maxtransfer = 0x7fffffff;
+       uci->mask = 0xffffffff;
+       uci->bufmemtype = 1;
+       uci->buffers = 50;
+       uci->stacksize = 4000;
+       uci->priority = -129;
+       uci->sectorsperblock = 1;
+}
+
+static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci)
 {
        UnitInfo *ui;
        int i;
        bool emptydrive = false;
        bool iscd;
+       struct uaedev_config_info c;
+
+       memcpy (&c, ci, sizeof (struct uaedev_config_info));
 
-       if (hdc)
+       if (ci->controller)
                return -1;
        if (nr < 0) {
                for (nr = 0; nr < MAX_FILESYSTEM_UNITS; nr++) {
@@ -508,8 +529,8 @@ static int set_filesys_unit_1 (int nr,
        for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
                if (nr == i || !mountinfo.ui[i].open || mountinfo.ui[i].rootdir == NULL || is_hardfile (i) == FILESYS_CD)
                        continue;
-               if (rootdir && _tcslen (rootdir) > 0 && !_tcsicmp (mountinfo.ui[i].rootdir, rootdir)) {
-                       write_log (_T("directory/hardfile '%s' already added\n"), rootdir);
+               if (_tcslen (c.rootdir) > 0 && !_tcsicmp (mountinfo.ui[i].rootdir, c.rootdir)) {
+                       write_log (_T("directory/hardfile '%s' already added\n"), c.rootdir);
                        return -1;
                }
        }
@@ -521,76 +542,78 @@ static int set_filesys_unit_1 (int nr,
                ui->unit_type = UNIT_CDFS;
                emptydrive = 1;
                ui->volflags = MYVOLUMEINFO_CDFS | MYVOLUMEINFO_READONLY;
-               readonly = true;
-       } else if (volname != NULL) {
+               c.readonly = true;
+       } else if (c.volname[0]) {
                int flags = 0;
                emptydrive = 1;
-               if (rootdir) {
-                       if (set_filesys_volume (rootdir, &flags, &readonly, &emptydrive, &ui->zarchive) < 0)
+               if (c.rootdir[0]) {
+                       if (set_filesys_volume (c.rootdir, &flags, &c.readonly, &emptydrive, &ui->zarchive) < 0)
                                return -1;
                }
-               ui->volname = filesys_createvolname (volname, rootdir, _T("harddrive"));
+               ui->volname = filesys_createvolname (c.volname, c.rootdir, _T("harddrive"));
                ui->volflags = flags;
        } else {
                ui->unit_type = UNIT_FILESYSTEM;
-               ui->hf.secspertrack = secspertrack;
-               ui->hf.surfaces = surfaces;
-               ui->hf.reservedblocks = reserved;
-               ui->hf.blocksize = blocksize;
+               memcpy (&ui->hf.ci, &c, sizeof (struct uaedev_config_info));
                ui->hf.unitnum = nr;
                ui->volname = 0;
-               ui->hf.readonly = readonly;
-               if (!hdf_open (&ui->hf, rootdir) && !readonly) {
-                       write_log (_T("Attempting to open in read-only mode\n"));
-                       ui->hf.readonly = readonly = 1;
-                       hdf_open (&ui->hf, rootdir);
+               if (ui->hf.ci.rootdir[0]) {
+                       if (!hdf_open (&ui->hf) && !c.readonly) {
+                               write_log (_T("Attempting to open in read-only mode\n"));
+                               ui->hf.ci.readonly = c.readonly = true;
+                               hdf_open (&ui->hf);
+                       }
+               } else {
+                       // empty drive?
+                       ui->hf.drive_empty = 1;
                }
-               ui->hf.readonly = readonly;
                if (!ui->hf.drive_empty) {
                        if (ui->hf.handle_valid == 0) {
                                write_log (_T("Hardfile %s not found\n"), ui->hf.device_name);
                                goto err;
                        }
-                       if ((ui->hf.blocksize & (ui->hf.blocksize - 1)) != 0 || ui->hf.blocksize == 0) {
-                               write_log (_T("Hardfile %s bad blocksize\n"), ui->hf.device_name);
-                               goto err;
-                       }
-                       if ((ui->hf.secspertrack || ui->hf.surfaces || ui->hf.reservedblocks) &&
-                               (ui->hf.secspertrack < 1 || ui->hf.surfaces < 1 || ui->hf.surfaces > 1023 ||
-                               ui->hf.reservedblocks < 0 || ui->hf.reservedblocks > 1023) != 0) {
-                                       write_log (_T("Hardfile %s bad hardfile geometry\n"), ui->hf.device_name);
-                                       goto err;
-                       }
-                       if (ui->hf.blocksize > ui->hf.virtsize || ui->hf.virtsize == 0) {
+                       if (ui->hf.ci.blocksize > ui->hf.virtsize || ui->hf.virtsize == 0) {
                                write_log (_T("Hardfile %s too small\n"), ui->hf.device_name);
                                goto err;
                        }
-                       if (cyls) {
-                               ui->hf.nrcyls = cyls;
-                       } else {
-                               ui->hf.nrcyls = (int)(ui->hf.secspertrack * ui->hf.surfaces ? (ui->hf.virtsize / ui->hf.blocksize) / (ui->hf.secspertrack * ui->hf.surfaces) : 0);
-                       }
                }
+               if ((ui->hf.ci.blocksize & (ui->hf.ci.blocksize - 1)) != 0 || ui->hf.ci.blocksize == 0) {
+                       write_log (_T("Hardfile %s bad blocksize\n"), ui->hf.device_name);
+                       goto err;
+               }
+               if ((ui->hf.ci.sectors || ui->hf.ci.surfaces || ui->hf.ci.reserved) &&
+                       (ui->hf.ci.sectors < 1 || ui->hf.ci.surfaces < 1 || ui->hf.ci.surfaces > 1023 ||
+                       ui->hf.ci.reserved < 0 || ui->hf.ci.reserved > 1023) != 0) {
+                               write_log (_T("Hardfile %s bad hardfile geometry\n"), ui->hf.device_name);
+                               goto err;
+               }
+               if (!ui->hf.ci.highcyl) {
+                       ui->hf.ci.cyls = (int)(ui->hf.ci.sectors * ui->hf.ci.surfaces ? (ui->hf.virtsize / ui->hf.ci.blocksize) / (ui->hf.ci.sectors * ui->hf.ci.surfaces) : 0);
+               }
+               if (!ui->hf.ci.cyls)
+                       ui->hf.ci.cyls = ui->hf.ci.highcyl;
+               if (!ui->hf.ci.cyls)
+                       ui->hf.ci.cyls = 1;
        }
        ui->self = 0;
        ui->reset_state = FS_STARTUP;
        ui->wasisempty = emptydrive;
-       ui->canremove = emptydrive && (flags & MYVOLUMEINFO_REUSABLE);
-       ui->rootdir = my_strdup (rootdir);
-       ui->devname = my_strdup (devname);
+       ui->canremove = emptydrive && (ci->flags & MYVOLUMEINFO_REUSABLE);
+       ui->rootdir = my_strdup (c.rootdir);
+       ui->devname = my_strdup (c.devname);
        stripsemicolon(ui->devname);
-       if (filesysdir && filesysdir[0])
-               ui->filesysdir = my_strdup (filesysdir);
-       ui->readonly = readonly;
-       if (!autoboot)
-               bootpri = -128;
-       if (donotmount)
-               bootpri = -129;
-       if (bootpri < -129)
-               bootpri = -129;
-       if (bootpri > 127)
-               bootpri = 127;
-       ui->bootpri = bootpri;
+       if (c.filesys[0])
+               ui->filesysdir = my_strdup (c.filesys);
+       ui->readonly = c.readonly;
+       if (!c.autoboot)
+               c.bootpri = -128;
+       if (c.donotmount)
+               c.bootpri = -129;
+       if (c.bootpri < -129)
+               c.bootpri = -129;
+       if (c.bootpri > 127)
+               c.bootpri = 127;
+       ui->bootpri = c.bootpri;
        ui->open = 1;
 
        return nr;
@@ -600,37 +623,26 @@ err:
        return -1;
 }
 
-static int set_filesys_unit (int nr,
-       const TCHAR *devname, const TCHAR *volname, const TCHAR *rootdir, bool readonly,
-       int cyls, int secspertrack, int surfaces, int reserved,
-       int blocksize, int bootpri, bool donotmount, bool autoboot,
-       const TCHAR *filesysdir, int hdc, int flags)
+static int set_filesys_unit (int nr, struct uaedev_config_info *ci)
 {
        int ret;
 
-       ret = set_filesys_unit_1 (nr, devname, volname, rootdir, readonly,
-               cyls, secspertrack, surfaces, reserved, blocksize, bootpri, donotmount, autoboot,
-               filesysdir, hdc, flags);
+       ret = set_filesys_unit_1 (nr, ci);
        return ret;
 }
 
-static int add_filesys_unit (const TCHAR *devname, const TCHAR *volname, const TCHAR *rootdir, bool readonly,
-       int cyls, int secspertrack, int surfaces, int reserved,
-       int blocksize, int bootpri, bool donotmount, bool autoboot,
-       const TCHAR *filesysdir, int hdc, int flags)
+static int add_filesys_unit (struct uaedev_config_info *ci)
 {
        int ret;
 
        if (nr_units () >= MAX_FILESYSTEM_UNITS)
                return -1;
 
-       ret = set_filesys_unit_1 (-1, devname, volname, rootdir, readonly,
-               cyls, secspertrack, surfaces, reserved, blocksize,
-               bootpri, donotmount, autoboot, filesysdir, hdc, flags);
+       ret = set_filesys_unit_1 (-1, ci);
 #ifdef RETROPLATFORM
        if (ret >= 0) {
                rp_hd_device_enable (ret, true);
-               rp_harddrive_image_change (ret, readonly, rootdir);
+               rp_harddrive_image_change (ret, ci->readonly, ci->rootdir);
        }
 #endif
        return ret;
@@ -638,34 +650,34 @@ static int add_filesys_unit (const TCHAR *devname, const TCHAR *volname, const T
 
 int kill_filesys_unitconfig (struct uae_prefs *p, int nr)
 {
-       struct uaedev_config_info *uci;
+       struct uaedev_config_data *uci;
 
        if (nr < 0)
                return 0;
        uci = getuci (p->mountconfig, nr);
        hardfile_do_disk_change (uci, 0);
-       if (uci->configoffset >= 0 && uci->controller == 0)
-               filesys_media_change (uci->rootdir, 0, uci);
+       if (uci->configoffset >= 0 && uci->ci.controller == 0)
+               filesys_media_change (uci->ci.rootdir, 0, uci);
        while (nr < MOUNT_CONFIG_SIZE) {
-               memmove (&p->mountconfig[nr], &p->mountconfig[nr + 1], sizeof (struct uaedev_config_info));
+               memmove (&p->mountconfig[nr], &p->mountconfig[nr + 1], sizeof (struct uaedev_config_data));
                nr++;
        }
        p->mountitems--;
-       memset (&p->mountconfig[MOUNT_CONFIG_SIZE - 1], 0, sizeof (struct uaedev_config_info));
+       memset (&p->mountconfig[MOUNT_CONFIG_SIZE - 1], 0, sizeof (struct uaedev_config_data));
        return 1;
 }
 
 int move_filesys_unitconfig (struct uae_prefs *p, int nr, int to)
 {
-       struct uaedev_config_info *uci1, *uci2, tmpuci;
+       struct uaedev_config_data *uci1, *uci2, tmpuci;
 
        uci1 = getuci (p->mountconfig, nr);
        uci2 = getuci (p->mountconfig, to);
        if (nr == to)
                return 0;
-       memcpy (&tmpuci, uci1, sizeof (struct uaedev_config_info));
-       memcpy (uci1, uci2, sizeof (struct uaedev_config_info));
-       memcpy (uci2, &tmpuci, sizeof (struct uaedev_config_info));
+       memcpy (&tmpuci, uci1, sizeof (struct uaedev_config_data));
+       memcpy (uci1, uci2, sizeof (struct uaedev_config_data));
+       memcpy (uci2, &tmpuci, sizeof (struct uaedev_config_data));
        return 1;
 }
 
@@ -674,7 +686,7 @@ void filesys_addexternals (void);
 
 static void allocuci (struct uae_prefs *p, int nr, int idx)
 {
-       struct uaedev_config_info *uci = &p->mountconfig[nr];
+       struct uaedev_config_data *uci = &p->mountconfig[nr];
        if (idx >= 0) {
                UnitInfo *ui;
                uci->configoffset = idx;
@@ -693,11 +705,12 @@ static void initialize_mountinfo (void)
        cd_unit_offset = MAX_FILESYSTEM_UNITS;
 
        for (nr = 0; nr < currprefs.mountitems; nr++) {
-               struct uaedev_config_info *uci = &currprefs.mountconfig[nr];
-               if (uci->controller == HD_CONTROLLER_UAE) {
-                       int idx = set_filesys_unit_1 (-1, uci->devname, uci->ishdf ? NULL : uci->volname, uci->rootdir,
-                               uci->readonly, uci->cyls, uci->sectors, uci->surfaces, uci->reserved,
-                               uci->blocksize, uci->bootpri, uci->donotmount, uci->autoboot, uci->filesys, 0, MYVOLUMEINFO_REUSABLE);
+               struct uaedev_config_data *uci = &currprefs.mountconfig[nr];
+               if (uci->ci.controller == HD_CONTROLLER_UAE) {
+                       struct uaedev_config_info ci;
+                       memcpy (&ci, &uci->ci, sizeof (struct uaedev_config_info));
+                       ci.flags = MYVOLUMEINFO_REUSABLE;
+                       int idx = set_filesys_unit_1 (-1, &ci);
                        allocuci (&currprefs, nr, idx);
                }
        }
@@ -709,10 +722,15 @@ static void initialize_mountinfo (void)
                uae_u32 mask = scsi_get_cd_drive_mask ();
                for (int i = 0; i < 32; i++) {
                        if (mask & (1 << i)) {
-                               TCHAR cdname[30];
-                               _stprintf (cdname, _T("CD%d"), i);
+                               struct uaedev_config_info ci = { 0 };
+                               _stprintf (ci.devname, _T("CD%d"), i);
                                cd_unit_number++;
-                               int idx = set_filesys_unit_1 (i + cd_unit_offset, cdname, NULL, _T("/"), true, 0, 1, 1, 0, 2048, 0, false, false, NULL, 0, 0);
+                               _tcscpy (ci.rootdir, _T("/"));
+                               ci.readonly = true;
+                               ci.sectors = 1;
+                               ci.surfaces = 1;
+                               ci.blocksize = 2048;
+                               int idx = set_filesys_unit_1 (i + cd_unit_offset, &ci);
                                allocuci (&currprefs, nr, idx);
                                nr++;
                        }
@@ -720,34 +738,26 @@ static void initialize_mountinfo (void)
        }
 
        for (nr = 0; nr < currprefs.mountitems; nr++) {
-               struct uaedev_config_info *uci = &currprefs.mountconfig[nr];
+               struct uaedev_config_info *uci = &currprefs.mountconfig[nr].ci;
                if (uci->controller == HD_CONTROLLER_UAE)
                        continue;
                if (uci->controller <= HD_CONTROLLER_IDE3) {
-                       gayle_add_ide_unit (uci->controller - HD_CONTROLLER_IDE0, uci->rootdir, uci->blocksize, uci->readonly,
-                               uci->devname, uci->cyls, uci->sectors, uci->surfaces, uci->reserved,
-                               uci->bootpri, uci->filesys, uci->pcyls, uci->pheads, uci->psecs);
+                       gayle_add_ide_unit (uci->controller - HD_CONTROLLER_IDE0, uci);
                        allocuci (&currprefs, nr, -1);
                } else if (uci->controller <= HD_CONTROLLER_SCSI6) {
                        if (currprefs.cs_mbdmac > 0) {
 #ifdef A2091
-                               a3000_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci->rootdir, uci->blocksize, uci->readonly,
-                                       uci->devname, uci->sectors, uci->surfaces, uci->reserved,
-                                       uci->bootpri, uci->filesys);
+                               a3000_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci);
                                allocuci (&currprefs, nr, -1);
 #endif
                        } else if (currprefs.cs_a2091) {
 #ifdef A2091
-                               a2091_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci->rootdir, uci->blocksize, uci->readonly,
-                                       uci->devname, uci->sectors, uci->surfaces, uci->reserved,
-                                       uci->bootpri, uci->filesys);
+                               a2091_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci);
                                allocuci (&currprefs, nr, -1);
 #endif
                        } else if (currprefs.cs_cdtvscsi) {
 #ifdef CDTV
-                               cdtv_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci->rootdir, uci->blocksize, uci->readonly,
-                                       uci->devname, uci->sectors, uci->surfaces, uci->reserved,
-                                       uci->bootpri, uci->filesys);
+                               cdtv_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci);
                                allocuci (&currprefs, nr, -1);
 #endif
                        }
@@ -777,7 +787,7 @@ int sprintf_filesys_unit (TCHAR *buffer, int num)
        return 0;
 }
 
-void free_mountinfo (void)
+static void free_mountinfo (void)
 {
        int i;
        for (i = 0; i < MAX_FILESYSTEM_UNITS; i++)
@@ -1505,7 +1515,7 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode)
                        // insert
                        struct mytimeval ctime = { 0 };
                        bool emptydrive = false;
-                       struct uaedev_config_info *uci = NULL;
+                       struct uaedev_config_data *uci = NULL;
 
                        clear_exkeys (u);
                        xfree (u->ui.rootdir);
@@ -1555,13 +1565,13 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode)
                                if (u->mount_flags >= 0)
                                        ui->volflags = u->volflags = u->ui.volflags = u->mount_flags;
                                if (uci != NULL) {
-                                       _tcscpy (uci->volname, ui->volname);
-                                       _tcscpy (uci->rootdir, u->mount_rootdir);
+                                       _tcscpy (uci->ci.volname, ui->volname);
+                                       _tcscpy (uci->ci.rootdir, u->mount_rootdir);
                                }
                                if (u->mount_flags >= 0) {
                                        ui->readonly = u->ui.readonly = u->mount_readonly;
                                        if (uci != NULL)
-                                               uci->readonly = u->mount_readonly;
+                                               uci->ci.readonly = u->mount_readonly;
                                }
                                put_byte (u->volume + 44, 0);
                                put_byte (u->volume + 172 - 32, 1);
@@ -1581,7 +1591,7 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode)
        return 0;
 }
 
-int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_config_info *uci)
+int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_config_data *uci)
 {
        Unit *u;
        UnitInfo *ui;
@@ -1603,7 +1613,7 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf
                        if (ui->rootdir && !memcmp (ui->rootdir, rootdir, _tcslen (rootdir)) && _tcslen (rootdir) + 3 >= _tcslen (ui->rootdir)) {
                                if (filesys_isvolume (u) && inserted) {
                                        if (uci)
-                                               filesys_delayed_change (u, 50, rootdir, uci->volname, uci->readonly, 0);
+                                               filesys_delayed_change (u, 50, rootdir, uci->ci.volname, uci->ci.readonly, 0);
                                        return 0;
                                }
                                nr = u->unit;
@@ -1623,8 +1633,9 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf
        if (nr >= 0 && !inserted)
                return filesys_eject (nr);
        if (inserted) {
+               struct uaedev_config_info ci = { 0 };
                if (uci) {
-                       volptr = my_strdup (uci->volname);
+                       volptr = my_strdup (uci->ci.volname);
                } else {
                        volname[0] = 0;
                        target_get_volume_name (&mountinfo, rootdir, volname, MAX_DPATH, 1, 0);
@@ -1661,10 +1672,15 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf
                }
                /* nope, uh, need black magic now.. */
                if (uci)
-                       _tcscpy (devname, uci->devname);
+                       _tcscpy (devname, uci->ci.devname);
                else
                        _stprintf (devname, _T("RDH%d"), nr_units ());
-               nr = add_filesys_unit (devname, volptr, rootdir, 0, 0, 0, 0, 0, 0, 0, 0, 1, NULL, 0, MYVOLUMEINFO_REUSABLE);
+               _tcscpy (ci.devname, devname);
+               _tcscpy (ci.volname, volptr);
+               _tcscpy (ci.rootdir, rootdir);
+               ci.autoboot = true;
+               ci.flags = MYVOLUMEINFO_REUSABLE;
+               nr = add_filesys_unit (&ci);
                if (nr < 0)
                        return 0;
                if (inserted > 1)
@@ -1679,6 +1695,63 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf
        return 0;
 }
 
+int hardfile_media_change (struct hardfiledata *hfd, struct uaedev_config_info *ci, bool inserted, bool timer)
+{
+       if (!hfd)
+               return 0;
+       if (!timer)
+               hfd->reinsertdelay = 0;
+       if (hfd->reinsertdelay < 0) {
+               hfd->reinsertdelay = 0;
+               if (!hfd->isreinsert) {
+                       hdf_close (hfd);
+                       hardfile_send_disk_change (hfd, false);
+                       if (hfd->delayedci.rootdir[0]) {
+                               hfd->reinsertdelay = 50;
+                               hfd->isreinsert = true;
+                               write_log (_T("HARDFILE: delayed insert %d: '%s'\n"), hfd->unitnum, ci->rootdir ? ci->rootdir : _T("<none>"));
+                               return 0;
+                       } else {
+                               return 1;
+                       }
+               }
+               memcpy (&hfd->ci, &hfd->delayedci, sizeof (struct uaedev_config_info));
+               if (!hdf_open (hfd)) {
+                       write_log (_T("HARDFILE: '%s' failed to open\n"), hfd->ci.rootdir);
+                       return 0;
+               }
+               hardfile_send_disk_change (hfd, true);
+               return 1;
+       }
+
+       if (ci) {
+               memcpy (&hfd->delayedci, ci, sizeof (struct uaedev_config_info));
+               if (hfd && !hfd->drive_empty) {
+                       hfd->reinsertdelay = 50;
+                       hfd->isreinsert = false;
+                       write_log (_T("HARDFILE: delayed eject %d: '%s'\n"), hfd->unitnum, hfd->ci.rootdir ? hfd->ci.rootdir : _T("<none>"));
+                       return 0;
+               }
+               if (!hfd) {
+                       return 0;
+               }
+               hfd->reinsertdelay = 2;
+               hfd->isreinsert = true;
+       } else {
+               if (inserted) {
+                       hfd->reinsertdelay = 2;
+                       hfd->isreinsert = true;
+                       memcpy (&hfd->delayedci, &hfd->ci, sizeof (struct uaedev_config_info));
+               } else {
+                       hfd->reinsertdelay = 2;
+                       hfd->isreinsert = false;
+                       memcpy (&hfd->delayedci, &hfd->ci, sizeof (struct uaedev_config_info));
+                       hfd->delayedci.rootdir[0] = 0;
+               }
+       }
+       return 0;
+}
+
 int hardfile_remount (int nr)
 {
        /* this does work but every media reinsert duplicates the device.. */
@@ -5920,9 +5993,10 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *context)
 #define PP_MAXSIZE 4 * 96
 #define PP_FSSIZE 400
 #define PP_FSPTR 404
-#define PP_FSRES 408
-#define PP_EXPLIB 412
-#define PP_FSHDSTART 416
+#define PP_ADDTOFSRES 408
+#define PP_FSRES 412
+#define PP_EXPLIB 416
+#define PP_FSHDSTART 420
 
 static uae_u32 REGPARAM2 filesys_dev_bootfilesys (TrapContext *context)
 {
@@ -5950,14 +6024,26 @@ static uae_u32 REGPARAM2 filesys_dev_bootfilesys (TrapContext *context)
                        put_long (devicenode + 16, fshandlername);
                return 0;
        }
+
+       if (get_long (parmpacket + PP_FSPTR) && !get_long (parmpacket + PP_ADDTOFSRES)) {
+               uaecptr fsptr = get_long (parmpacket + PP_FSPTR);
+               uip->filesysseg = fsptr;
+               // filesystem but was not added to fs.resource
+               uae_u32 pf = get_long (parmpacket + PP_FSHDSTART + 8); // fse_PatchFlags
+               for (int i = 0; i < 32; i++) {
+                       if (pf & (1 << i))
+                               put_long (devicenode + 4 + i * 4, get_long (parmpacket + PP_FSHDSTART + 8 + 4 + i * 4));
+               }
+               put_long (devicenode + 4 + 7 * 4, fsptr >> 2); // seglist
+               return 1;
+       }
        dostype = get_long (parmpacket + 80);
        fsnode = get_long (fsres + 18);
        while (get_long (fsnode)) {
                dostype2 = get_long (fsnode + 14);
                if (dostype2 == dostype) {
-                       int i;
                        uae_u32 pf = get_long (fsnode + 22); // fse_PatchFlags
-                       for (i = 0; i < 32; i++) {
+                       for (int i = 0; i < 32; i++) {
                                if (pf & (1 << i))
                                        put_long (devicenode + 4 + i * 4, get_long (fsnode + 22 + 4 + i * 4));
                        }
@@ -6032,7 +6118,7 @@ static int legalrdbblock (UnitInfo *uip, int block)
 {
        if (block <= 0)
                return 0;
-       if (block >= uip->hf.virtsize / uip->hf.blocksize)
+       if (block >= uip->hf.virtsize / uip->hf.ci.blocksize)
                return 0;
        return 1;
 }
@@ -6150,7 +6236,7 @@ static void dump_partinfo (struct hardfiledata *hfd, uae_u8 *pp)
        lowcyl = rl (pp + 36);
        highcyl = rl (pp + 40);
 
-       write_log (_T("RDB: '%s' dostype=%08X (%s) Flags: %08X\n"), s, dostype, dostypes (dostype), flags);
+       write_log (_T("Partition '%s' Dostype=%08X (%s) Flags: %08X\n"), s, dostype, dostypes (dostype), flags);
        write_log (_T("BlockSize: %d, Surfaces: %d, SectorsPerBlock %d\n"),
                blocksize, surfaces, spb);
        write_log (_T("SectorsPerTrack: %d, Reserved: %d, LowCyl %d, HighCyl %d, Size %dM\n"),
@@ -6158,20 +6244,21 @@ static void dump_partinfo (struct hardfiledata *hfd, uae_u8 *pp)
        write_log (_T("Buffers: %d, BufMemType: %08x, MaxTransfer: %08x, Mask: %08x, BootPri: %d\n"),
                rl (pp + 44), rl (pp + 48), rl (pp + 52), rl (pp + 56), rl (pp + 60));
 
-       block = lowcyl * surfaces * spt;
-       if (hdf_read (hfd, buf, (uae_u64)blocksize * block, sizeof buf)) {
-               write_log (_T("First block %d dostype: %08X (%s)\n"), block, rl (buf), dostypes (rl (buf)));
+       if (hfd->drive_empty) {
+               write_log (_T("Empty drive\n"));
        } else {
-               write_log (_T("First block %d read failed!\n"), block);
-       }
-       xfree (s);
-
-       if ((uae_u64)highcyl * spt * surfaces * blocksize > hfd->virtsize) {
-               write_log (_T("RDB: WARNING: end of partition > size of disk! (%llu > %llu)\n"),
-                       (uae_u64)highcyl * spt * surfaces * blocksize, hfd->virtsize);
+               block = lowcyl * surfaces * spt;
+               if (hdf_read (hfd, buf, (uae_u64)blocksize * block, sizeof buf)) {
+                       write_log (_T("First block %d dostype: %08X (%s)\n"), block, rl (buf), dostypes (rl (buf)));
+               } else {
+                       write_log (_T("First block %d read failed!\n"), block);
+               }
+               xfree (s);
+               if ((uae_u64)highcyl * spt * surfaces * blocksize > hfd->virtsize) {
+                       write_log (_T("RDB: WARNING: end of partition > size of disk! (%llu > %llu)\n"),
+                               (uae_u64)highcyl * spt * surfaces * blocksize, hfd->virtsize);
+               }
        }
-
-
 }
 
 static void dump_rdb (UnitInfo *uip, struct hardfiledata *hfd, uae_u8 *bufrdb, uae_u8 *buf, int readblocksize)
@@ -6194,7 +6281,7 @@ static void dump_rdb (UnitInfo *uip, struct hardfiledata *hfd, uae_u8 *bufrdb, u
                        break;
                }
                memset (buf, 0, readblocksize);
-               hdf_read (hfd, buf, partblock * hfd->blocksize, readblocksize);
+               hdf_read (hfd, buf, partblock * hfd->ci.blocksize, readblocksize);
                if (!rdb_checksum ("PART", buf, partblock)) {
                        write_log (_T("RDB: checksum error PART block %d\n"), partblock);
                        break;
@@ -6215,7 +6302,7 @@ static void dump_rdb (UnitInfo *uip, struct hardfiledata *hfd, uae_u8 *bufrdb, u
                        break;
                }
                memset (buf, 0, readblocksize);
-               hdf_read (hfd, buf, fileblock * hfd->blocksize, readblocksize);
+               hdf_read (hfd, buf, fileblock * hfd->ci.blocksize, readblocksize);
                if (!rdb_checksum ("FSHD", buf, fileblock)) {
                        write_log (_T("RDB: checksum error FSHD block %d\n"), fileblock);
                        break;
@@ -6251,21 +6338,21 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
                write_log (_T("ignored, drive is empty\n"));
                return -2;
        }
-       if (hfd->blocksize == 0) {
+       if (hfd->ci.blocksize == 0) {
                rdbmnt
                write_log (_T("failed, blocksize == 0\n"));
                return -1;
        }
-       if (lastblock * hfd->blocksize > hfd->virtsize) {
+       if (lastblock * hfd->ci.blocksize > hfd->virtsize) {
                rdbmnt
-               write_log (_T("failed, too small (%d*%d > %llu)\n"), lastblock, hfd->blocksize, hfd->virtsize);
+               write_log (_T("failed, too small (%d*%d > %llu)\n"), lastblock, hfd->ci.blocksize, hfd->virtsize);
                return -2;
        }
        for (rdblock = 0; rdblock < lastblock; rdblock++) {
-               hdf_read_rdb (hfd, bufrdb, rdblock * hfd->blocksize, hfd->blocksize);
+               hdf_read_rdb (hfd, bufrdb, rdblock * hfd->ci.blocksize, hfd->ci.blocksize);
                if (rdb_checksum ("RDSK", bufrdb, rdblock))
                        break;
-               hdf_read_rdb (hfd, bufrdb, rdblock * hfd->blocksize, hfd->blocksize);
+               hdf_read_rdb (hfd, bufrdb, rdblock * hfd->ci.blocksize, hfd->ci.blocksize);
                if (!memcmp ("RDSK", bufrdb, 4)) {
                        bufrdb[0xdc] = 0;
                        bufrdb[0xdd] = 0;
@@ -6273,7 +6360,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
                        bufrdb[0xdf] = 0;
                        if (rdb_checksum ("RDSK", bufrdb, rdblock)) {
                                write_log (_T("Windows 95/98/ME trashed RDB detected, fixing..\n"));
-                               hdf_write (hfd, bufrdb, rdblock * hfd->blocksize, hfd->blocksize);
+                               hdf_write (hfd, bufrdb, rdblock * hfd->ci.blocksize, hfd->ci.blocksize);
                                break;
                        }
                }
@@ -6284,7 +6371,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
                return -2;
        }
        blocksize = rl (bufrdb + 16);
-       readblocksize = blocksize > hfd->blocksize ? blocksize : hfd->blocksize;
+       readblocksize = blocksize > hfd->ci.blocksize ? blocksize : hfd->ci.blocksize;
        badblock = rl (bufrdb + 24);
        if (badblock != -1) {
                rdbmnt
@@ -6297,9 +6384,9 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
                write_log (_T("RDB: driveinit is not yet supported. Contact the author.\n"));
                return -2;
        }
-       hfd->cylinders = rl (bufrdb + 64);
-       hfd->sectors = rl (bufrdb + 68);
-       hfd->heads = rl (bufrdb + 72);
+       hfd->rdbcylinders = rl (bufrdb + 64);
+       hfd->rdbsectors = rl (bufrdb + 68);
+       hfd->rdbheads = rl (bufrdb + 72);
 #if 0
        {
                int cyls, secs, heads;
@@ -6316,12 +6403,12 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
        buf = xmalloc (uae_u8, readblocksize);
 
        if (showdebug) {
-               if ((uae_u64)hfd->cylinders * hfd->sectors * hfd->heads * blocksize > hfd->virtsize)
+               if ((uae_u64)hfd->rdbcylinders * hfd->rdbsectors * hfd->rdbheads * blocksize > hfd->virtsize)
                        write_log (_T("RDB: WARNING: RDSK header disk size > disk size! (%llu > %llu)\n"),
-                               (uae_u64)hfd->cylinders * hfd->sectors * hfd->heads * blocksize, hfd->virtsize);
+                               (uae_u64)hfd->rdbcylinders * hfd->rdbsectors * hfd->rdbheads * blocksize, hfd->virtsize);
                write_log (_T("RDSK dump start\n"));
                write_log (_T("RDSK at %d, C=%d S=%d H=%d\n"),
-                       rdblock, hfd->cylinders, hfd->sectors, hfd->heads);
+                       rdblock, hfd->rdbcylinders, hfd->rdbsectors, hfd->rdbheads);
                dump_rdb (uip, hfd, bufrdb, buf, readblocksize);
                write_log (_T("RDSK dump end\n"));
        }
@@ -6336,7 +6423,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
                        goto error;
                }
                memset (buf, 0, readblocksize);
-               hdf_read (hfd, buf, partblock * hfd->blocksize, readblocksize);
+               hdf_read (hfd, buf, partblock * hfd->ci.blocksize, readblocksize);
                if (!rdb_checksum ("PART", buf, partblock)) {
                        err = -2;
                        goto error;
@@ -6408,7 +6495,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
                        goto error;
                }
                memset (buf, 0, readblocksize);
-               hdf_read (hfd, buf, fileblock * hfd->blocksize, readblocksize);
+               hdf_read (hfd, buf, fileblock * hfd->ci.blocksize, readblocksize);
                if (!rdb_checksum ("FSHD", buf, fileblock)) {
                        write_log (_T("RDB: checksum error in FSHD block %d\n"), fileblock);
                        goto error;
@@ -6442,7 +6529,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
                if (!legalrdbblock (uip, lsegblock))
                        goto error;
                memset (buf, 0, readblocksize);
-               hdf_read (hfd, buf, lsegblock * hfd->blocksize, readblocksize);
+               hdf_read (hfd, buf, lsegblock * hfd->ci.blocksize, readblocksize);
                if (!rdb_checksum ("LSEG", buf, lsegblock))
                        goto error;
                lsegblock = rl (buf + 16);
@@ -6457,6 +6544,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
        }
        write_log (_T("RDB: Filesystem loaded, %d bytes\n"), i * (blocksize - 20));
        put_long (parmpacket + PP_FSSIZE, i * (blocksize - 20)); /* RDB filesystem size hack */
+       put_long (parmpacket + PP_ADDTOFSRES, -1);
        uip->rdb_filesysstore = fsmem;
        uip->rdb_filesyssize = i * (blocksize - 20);
        xfree (buf);
@@ -6467,45 +6555,76 @@ error:
        return err;
 }
 
-static void addfakefilesys (uaecptr parmpacket, uae_u32 dostype)
+static void addfakefilesys (uaecptr parmpacket, uae_u32 dostype, int ver, int rev, struct uaedev_config_info *ci)
 {
        int i;
+       uae_u32 flags;
 
+       flags = 0x180;
        for (i = 0; i < 140; i++)
                put_byte (parmpacket + PP_FSHDSTART + i, 0);
        put_long (parmpacket + 80, dostype);
        put_long (parmpacket + PP_FSHDSTART, dostype);
-       put_long (parmpacket + PP_FSHDSTART + 8, 0x100 | (dostype == 0x444f5300 ? 0x0 : 0x80));
-       put_long (parmpacket + PP_FSHDSTART + 44, 0xffffffff);
+       if (ver >= 0 && rev >= 0)
+               put_long (parmpacket + PP_FSHDSTART + 4, (ver << 16) | rev);
+
+       put_long (parmpacket + PP_FSHDSTART + 12 + 4 * 4, ci->stacksize);
+       flags |= 0x10;
+
+       if (ci->priority != -129) {
+               put_long (parmpacket + PP_FSHDSTART + 12 + 5 * 4, ci->priority);
+               flags |= 0x20;
+       }
+       put_long (parmpacket + PP_FSHDSTART + 12 + 8 * 4, kickstart_version < 36 && dostype == 0x444f5300 ? 0 : -1); // globvec
+       put_long (parmpacket + PP_FSHDSTART + 8, flags); // patchflags
 }
 
-static int dofakefilesys (UnitInfo *uip, uaecptr parmpacket)
+static uaecptr getfakefilesysseg (UnitInfo *uip)
+{
+       if (uip->filesysdir && _tcslen (uip->filesysdir) > 0) {
+               for (int i = 0; &mountinfo.ui[i] != uip; i++) {
+                       UnitInfo *uip2 = &mountinfo.ui[i];
+                       if (!uip2->filesysdir)
+                               continue;
+                       if (_tcsicmp (uip2->filesysdir, uip->filesysdir) != 0)
+                               continue;
+                       if (uip2->filesysseg)
+                               return uip2->filesysseg;
+               }
+       }
+       return 0;
+}
+
+static int dofakefilesys (UnitInfo *uip, uaecptr parmpacket, struct uaedev_config_info *ci)
 {
        int i, size;
        TCHAR tmp[MAX_DPATH];
        uae_u8 buf[512];
        struct zfile *zf;
-       uae_u32 dostype, fsres, fsnode;
-
-       memset (buf, 0, 4);
-       hdf_read (&uip->hf, buf, 0, 512);
-       dostype = (buf[0] << 24) | (buf[1] << 16) |(buf[2] << 8) | buf[3];
-       if (dostype == 0)
+       int ver = -1, rev = -1;
+       uae_u32 dostype;
+       uaecptr seg;
+
+       // we already have custom filesystem loaded for earlier hardfile?
+       seg = getfakefilesysseg (uip);
+       if (seg) {
+               // yes, re-use it.
+               put_long (parmpacket + PP_FSSIZE, 0);
+               put_long (parmpacket + PP_FSPTR, seg);
+               put_long (parmpacket + PP_ADDTOFSRES, 0);
+               write_log (_T("HDF: faked RDB filesystem '%s' reused\n"), uip->filesysdir);
                return FILESYS_HARDFILE;
-       fsres = get_long (parmpacket + PP_FSRES);
-       fsnode = get_long (fsres + 18);
-       while (get_long (fsnode)) {
-               if (get_long (fsnode + 14) == dostype) {
-                       if (kickstart_version < 36) {
-                               addfakefilesys (parmpacket, dostype);
-                       } else if ((dostype & 0xffffff00) != 0x444f5300) {
-                               addfakefilesys (parmpacket, dostype);
-                       }
-                       return FILESYS_HARDFILE;
-               }
-               fsnode = get_long (fsnode);
        }
 
+       if (!ci->dostype) {
+               memset (buf, 0, 4);
+               hdf_read (&uip->hf, buf, 0, 512);
+               dostype = (buf[0] << 24) | (buf[1] << 16) |(buf[2] << 8) | buf[3];
+       } else {
+               dostype = ci->dostype;
+       }
+       if (dostype == 0)
+               return FILESYS_HARDFILE;
        tmp[0] = 0;
        if (uip->filesysdir && _tcslen (uip->filesysdir) > 0) {
                _tcscpy (tmp, uip->filesysdir);
@@ -6539,12 +6658,68 @@ static int dofakefilesys (UnitInfo *uip, uaecptr parmpacket)
                zfile_fseek (zf, 0, SEEK_SET);
                uip->rdb_filesysstore = xmalloc (uae_u8, size);
                zfile_fread (uip->rdb_filesysstore, size, 1, zf);
+               for (i = 0; i < size - 6; i++) {
+                       uae_u8 *p = uip->rdb_filesysstore + i;
+                       if (p[0] == 'V' && p[1] == 'E' && p[2] == 'R' && p[3] == ':' && p[4] == ' ') {
+                               uae_u8 *p2;
+                               p += 5;
+                               p2 = p;
+                               while (*p2 && p2 - uip->rdb_filesysstore < size)
+                                       p2++;
+                               if (p2[0] == 0) {
+                                       while (*p && (ver < 0 || rev < 0)) {
+                                               if (*p == ' ') {
+                                                       p++;
+                                                       ver = atol ((char*)p);
+                                                       if (ver < 0)
+                                                               ver = 0;
+                                                       while (*p) {
+                                                               if (*p == ' ')
+                                                                       break;
+                                                               if (*p == '.') {
+                                                                       p++;
+                                                                       rev = atol ((char*)p);
+                                                                       if (rev < 0)
+                                                                               rev = 0;
+                                                               } else {
+                                                                       p++;
+                                                               }
+                                                       }
+                                                       break;
+                                               } else {
+                                                       p++;
+                                               }
+                                       }
+                               }
+                               break;
+                       }
+               }
        }
        zfile_fclose (zf);
        uip->rdb_filesyssize = size;
+
+       uae_u32 fsres, fsnode;
+       int oldversion = -1;
+       int oldrevision = -1;
+       fsres = get_long (parmpacket + PP_FSRES);
+       fsnode = get_long (fsres + 18);
+       while (get_long (fsnode)) {
+               uae_u32 fsdostype = get_long (fsnode + 14);
+               if (fsdostype == dostype) {
+                       oldversion = get_word (fsnode + 18);
+                       oldrevision = get_word (fsnode + 20);
+                       write_log (_T("HDF: %08X (%s) in FileSystem.resource version %d.%d\n"), dostype, dostypes (dostype), oldversion, oldrevision);
+                       break;
+               }
+               fsnode = get_long (fsnode);
+       }
+       // DOS\0 is not in fs.resource
+       if (dostype == 0x444f5300 && oldversion < 0)
+               oldversion = 0;
        put_long (parmpacket + PP_FSSIZE, uip->rdb_filesyssize);
-       addfakefilesys (parmpacket, dostype);
-       write_log (_T("HDF: faked RDB filesystem %08X (%s) loaded\n"), dostype, dostypes (dostype));
+       put_long (parmpacket + PP_ADDTOFSRES, oldversion < 0 ? -1 : 0);
+       addfakefilesys (parmpacket, dostype, ver, rev, ci);
+       write_log (_T("HDF: faked RDB filesystem %08X (%s %d.%d) loaded. ADD2FS=%d\n"), dostype, dostypes (dostype), ver, rev, oldversion < 0 ? 1 : 0);
        return FILESYS_HARDFILE;
 }
 
@@ -6587,6 +6762,7 @@ static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *context)
        int iscd = (m68k_dreg (regs, 6) & 0x80000000) != 0 || uip[unit_no].unit_type == UNIT_CDFS;
        int type;
        uaecptr parmpacket = m68k_areg (regs, 0);
+       struct uaedev_config_info *ci = &uip[unit_no].hf.ci;
 
        if (iscd) {
                TCHAR *cdname = NULL;
@@ -6667,18 +6843,32 @@ static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *context)
                        put_long (parmpacket + 52, 0); /* lowCyl */
                        put_long (parmpacket + 56, 1); /* hiCyl */
                } else {
+                       uae_u8 buf[512] = { 0 };
+                       buf[36] = _tcslen (uip[unit_no].devname);
+                       for (int i = 0; i < buf[36]; i++)
+                               buf[37 + i] = uip[unit_no].devname[i];
                        put_long (parmpacket + 4, ROM_hardfile_resname);
-                       put_long (parmpacket + 20, uip[unit_no].hf.blocksize >> 2); /* longwords per block */
-                       put_long (parmpacket + 28, uip[unit_no].hf.surfaces); /* heads */
-                       put_long (parmpacket + 32, 1); /* sectors per block */
-                       put_long (parmpacket + 36, uip[unit_no].hf.secspertrack); /* sectors per track */
-                       put_long (parmpacket + 40, uip[unit_no].hf.reservedblocks); /* reserved blocks */
-                       put_long (parmpacket + 52, 0); /* lowCyl */
-                       put_long (parmpacket + 56, uip[unit_no].hf.nrcyls <= 0 ? 0 : uip[unit_no].hf.nrcyls - 1); /* hiCyl */
+                       put_long (parmpacket + 20, ci->blocksize >> 2); /* longwords per block */
+                       put_long (parmpacket + 28, ci->surfaces); /* heads */
+                       put_long (parmpacket + 32, ci->sectorsperblock); /* sectors per block */
+                       put_long (parmpacket + 36, ci->sectors); /* sectors per track */
+                       put_long (parmpacket + 40, ci->reserved); /* reserved blocks */
+                       put_long (parmpacket + 52, ci->lowcyl); /* lowCyl */
+                       put_long (parmpacket + 56, ci->highcyl <= 0 ? ci->cyls - 1 : ci->highcyl - 1); /* hiCyl */
+                       put_long (parmpacket + 48, ci->interleave); /* interleave */
+                       put_long (parmpacket + 60, ci->buffers); /* Number of buffers */
+                       put_long (parmpacket + 64, ci->bufmemtype); /* Buffer mem type */
+                       put_long (parmpacket + 68, ci->maxtransfer); /* largest transfer */
+                       put_long (parmpacket + 72, ci->mask); /* dma mask */
+                       if (ci->dostype) // forced dostype?
+                               put_long (parmpacket + 80, ci->dostype); /* dostype */
+                       for (int i = 0; i < 80; i++)
+                               buf[i + 128] = get_byte (parmpacket + 16 + i);
+                       dump_partinfo (&uip[unit_no].hf, buf);
                }
                if (type == FILESYS_HARDFILE)
-                       type = dofakefilesys (&uip[unit_no], parmpacket);
-               if (uip[unit_no].bootpri < -127)
+                       type = dofakefilesys (&uip[unit_no], parmpacket, ci);
+               if (uip[unit_no].bootpri < -127 || (type == FILESYS_HARDFILE && ci->rootdir[0] == 0))
                        m68k_dreg (regs, 7) = m68k_dreg (regs, 7) & ~1; /* do not boot */
                if (uip[unit_no].bootpri < -128)
                        return -1; /* do not mount */
@@ -6758,6 +6948,19 @@ void filesys_vsync (void)
                record_timeout (u);
        }
 
+       for (int i = 0; i < currprefs.mountitems; i++) {
+               struct hardfiledata *hfd = get_hardfile_data (currprefs.mountconfig[i].configoffset);
+               if (!hfd)
+                       continue;
+               if (hfd->reinsertdelay > 0) {
+                       hfd->reinsertdelay--;
+                       if (hfd->reinsertdelay == 0) {
+                               hfd->reinsertdelay = -1;
+                               hardfile_media_change (hfd, &hfd->delayedci, true, true);
+                       }
+               }
+       }
+
        if (heartbeat_count <= 0)
                return;
 
@@ -6834,21 +7037,18 @@ void filesys_install (void)
        org (loop);
 }
 
-extern unsigned char cdfs_rom[];
-extern unsigned int cdfs_rom_len;
-
 void filesys_install_code (void)
 {
-       uae_u32 a, b;
+       uae_u32 a, b, items;
 
        bootrom_header = 3 * 4;
        align(4);
        a = here ();
 #include "filesys_bootrom.cpp"
 
-       bootrom_items = dlg (a + 8);
+       items = dlg (a + 8) & 0xffff;
        /* The last offset comes from the code itself, look for it near the top. */
-       EXPANSION_bootcode = a + bootrom_header + bootrom_items * 4 - 4;
+       EXPANSION_bootcode = a + bootrom_header + items * 4 - 4;
        b = a + bootrom_header + 3 * 4 - 4;
        filesys_initcode = a + dlg (b) + bootrom_header - 4;
 }
@@ -6864,16 +7064,16 @@ static uae_u8 *restore_filesys_hardfile (UnitInfo *ui, uae_u8 *src)
 
        hfd->virtsize = restore_u64 ();
        hfd->offset = restore_u64 ();
-       hfd->nrcyls = restore_u32 ();
-       hfd->secspertrack = restore_u32 ();
-       hfd->surfaces = restore_u32 ();
-       hfd->reservedblocks = restore_u32 ();
-       hfd->blocksize = restore_u32 ();
-       hfd->readonly = restore_u32 ();
+       hfd->ci.highcyl = restore_u32 ();
+       hfd->ci.sectors = restore_u32 ();
+       hfd->ci.surfaces = restore_u32 ();
+       hfd->ci.reserved = restore_u32 ();
+       hfd->ci.blocksize = restore_u32 ();
+       hfd->ci.readonly = restore_u32 () != 0;
        hfd->flags = restore_u32 ();
-       hfd->cylinders = restore_u32 ();
-       hfd->sectors = restore_u32 ();
-       hfd->heads = restore_u32 ();
+       hfd->rdbcylinders = restore_u32 ();
+       hfd->rdbsectors = restore_u32 ();
+       hfd->rdbheads = restore_u32 ();
        s = restore_string ();
        _tcscpy (hfd->vendor_id, s);
        xfree (s);
@@ -6895,16 +7095,16 @@ static uae_u8 *save_filesys_hardfile (UnitInfo *ui, uae_u8 *dst)
 
        save_u64 (hfd->virtsize);
        save_u64 (hfd->offset);
-       save_u32 (hfd->nrcyls);
-       save_u32 (hfd->secspertrack);
-       save_u32 (hfd->surfaces);
-       save_u32 (hfd->reservedblocks);
-       save_u32 (hfd->blocksize);
-       save_u32 (hfd->readonly);
+       save_u32 (hfd->ci.highcyl);
+       save_u32 (hfd->ci.sectors);
+       save_u32 (hfd->ci.surfaces);
+       save_u32 (hfd->ci.reserved);
+       save_u32 (hfd->ci.blocksize);
+       save_u32 (hfd->ci.readonly);
        save_u32 (hfd->flags);
-       save_u32 (hfd->cylinders);
-       save_u32 (hfd->sectors);
-       save_u32 (hfd->heads);
+       save_u32 (hfd->rdbcylinders);
+       save_u32 (hfd->rdbsectors);
+       save_u32 (hfd->rdbheads);
        save_string (hfd->vendor_id);
        save_string (hfd->product_id);
        save_string (hfd->product_rev);
@@ -7476,13 +7676,15 @@ uae_u8 *restore_filesys (uae_u8 *src)
        int type, devno;
        UnitInfo *ui;
        TCHAR *devname = 0, *volname = 0, *rootdir = 0, *filesysdir = 0;
-       int bootpri;
-       bool readonly;
        uae_u32 startup;
+       struct uaedev_config_info *ci;
 
        if (restore_u32 () != 2)
                return src;
        devno = restore_u32 ();
+       ui = &mountinfo.ui[devno];
+       ci = &ui->hf.ci;
+       uci_set_defaults (ci, false);
        type = restore_u16 ();
        if (type == FILESYS_VIRTUAL) {
                rootdir = restore_path (SAVESTATE_PATH_VDIR);
@@ -7501,19 +7703,21 @@ uae_u8 *restore_filesys (uae_u8 *src)
        devname = restore_string ();
        volname = restore_string ();
        filesysdir = restore_path (SAVESTATE_PATH);
-       bootpri = restore_u8 ();
-       readonly = restore_u8 () != 0;
+       ci->bootpri = restore_u8 ();
+       ci->readonly = restore_u8 () != 0;
        startup = restore_u32 ();
        filesys_configdev = restore_u32 ();
-       ui = &mountinfo.ui[devno];
        if (type == FILESYS_HARDFILE || type == FILESYS_HARDFILE_RDB) {
                src = restore_filesys_hardfile (ui, src);
                xfree (volname);
                volname = NULL;
        }
-       if (set_filesys_unit (devno, devname, volname, rootdir, readonly,
-               ui->hf.cylinders, ui->hf.secspertrack, ui->hf.surfaces, ui->hf.reservedblocks, ui->hf.blocksize,
-               bootpri, false, true, filesysdir[0] ? filesysdir : NULL, 0, 0) < 0) {
+       _tcscpy (ci->rootdir, rootdir);
+       _tcscpy (ci->devname, devname);
+       _tcscpy (ci->volname, volname);
+       _tcscpy (ci->filesys, filesysdir);
+
+       if (set_filesys_unit (devno, ci) < 0) {
                        write_log (_T("filesys '%s' failed to restore\n"), rootdir);
                        goto end;
        }
index ec824ed214d9c55edb9e1d1e79e2342ac1e6de0c..c65f0759f94445b93f136e5c41cf4485aea76c64 100644 (file)
@@ -1,13 +1,13 @@
  db(0x00); db(0x00); db(0x00); db(0x10); db(0x00); db(0x00); db(0x00); db(0x00);
- db(0x00); db(0x00); db(0x00); db(0x09); db(0x60); db(0x00); db(0x0a); db(0xfe);
- db(0x00); db(0x00); db(0x08); db(0xac); db(0x00); db(0x00); db(0x00); db(0xe0);
+ db(0x60); db(0x02); db(0x00); db(0x09); db(0x60); db(0x00); db(0x0b); db(0x12);
+ db(0x00); db(0x00); db(0x08); db(0xae); db(0x00); db(0x00); db(0x00); db(0xe0);
  db(0x00); db(0x00); db(0x02); db(0x74); db(0x00); db(0x00); db(0x00); db(0x24);
  db(0x00); db(0x00); db(0x03); db(0x82); db(0x00); db(0x00); db(0x00); db(0x00);
- db(0x00); db(0x00); db(0x13); db(0x8c); db(0x43); db(0xfa); db(0x18); db(0x95);
+ db(0x00); db(0x00); db(0x13); db(0xa0); db(0x43); db(0xfa); db(0x18); db(0xa9);
  db(0x4e); db(0xae); db(0xff); db(0xa0); db(0x20); db(0x40); db(0x20); db(0x28);
  db(0x00); db(0x16); db(0x20); db(0x40); db(0x4e); db(0x90); db(0x4e); db(0x75);
  db(0x48); db(0xe7); db(0xe0); db(0xe2); db(0x30); db(0x3c); db(0xff); db(0x38);
- db(0x72); db(0x11); db(0x61); db(0x00); db(0x17); db(0x7e); db(0x4e); db(0x90);
+ db(0x72); db(0x11); db(0x61); db(0x00); db(0x17); db(0x92); db(0x4e); db(0x90);
  db(0x4a); db(0x80); db(0x67); db(0x4c); db(0x2c); db(0x78); db(0x00); db(0x04);
  db(0x0c); db(0x6e); db(0x00); db(0x25); db(0x00); db(0x14); db(0x65); db(0x40);
  db(0x70); db(0x14); db(0x24); db(0x00); db(0x72); db(0x01); db(0x4e); db(0xae);
  db(0x20); db(0x68); db(0x00); db(0x02); db(0x2f); db(0x08); db(0x4e); db(0x90);
  db(0x20); db(0x5f); db(0x58); db(0x8f); db(0x48); db(0xe7); db(0xff); db(0x7e);
  db(0x22); db(0x4e); db(0x20); db(0x08); db(0x30); db(0x7c); db(0xff); db(0xb8);
- db(0x4e); db(0xae); db(0xfe); db(0x5c); db(0x61); db(0x00); db(0x12); db(0xce);
- db(0x61); db(0x00); db(0x16); db(0x94); db(0x4c); db(0xdf); db(0x7e); db(0xff);
+ db(0x4e); db(0xae); db(0xfe); db(0x5c); db(0x61); db(0x00); db(0x12); db(0xe2);
+ db(0x61); db(0x00); db(0x16); db(0xa8); db(0x4c); db(0xdf); db(0x7e); db(0xff);
  db(0x4e); db(0x75); db(0x00); db(0x00); db(0x08); db(0x00); db(0x00); db(0x02);
  db(0x67); db(0x06); db(0x4e); db(0xb9); db(0x00); db(0xf0); db(0x00); db(0x00);
  db(0x4e); db(0xf9); db(0x00); db(0xf0); db(0x00); db(0x00); db(0x00); db(0x00);
  db(0x48); db(0xe7); db(0xff); db(0xfe); db(0x2c); db(0x78); db(0x00); db(0x04);
- db(0x30); db(0x3c); db(0xff); db(0xec); db(0x61); db(0x00); db(0x16); db(0xd4);
- db(0x2a); db(0x50); db(0x43); db(0xfa); db(0x17); db(0xf6); db(0x70); db(0x24);
+ db(0x30); db(0x3c); db(0xff); db(0xec); db(0x61); db(0x00); db(0x16); db(0xe8);
+ db(0x2a); db(0x50); db(0x43); db(0xfa); db(0x18); db(0x0a); db(0x70); db(0x24);
  db(0x7a); db(0x01); db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x4a); db(0x80);
- db(0x66); db(0x0c); db(0x43); db(0xfa); db(0x17); db(0xe6); db(0x70); db(0x00);
+ db(0x66); db(0x0c); db(0x43); db(0xfa); db(0x17); db(0xfa); db(0x70); db(0x00);
  db(0x7a); db(0x00); db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x28); db(0x40);
  db(0x4a); db(0xad); db(0x01); db(0x0c); db(0x67); db(0x00); db(0x00); db(0x5c);
- db(0x20); db(0x3c); db(0x00); db(0x00); db(0x02); db(0x2c); db(0x22); db(0x3c);
+ db(0x20); db(0x3c); db(0x00); db(0x00); db(0x02); db(0x30); db(0x22); db(0x3c);
  db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a);
- db(0x26); db(0x40); db(0x27); db(0x4c); db(0x01); db(0x9c); db(0x7c); db(0x00);
+ db(0x26); db(0x40); db(0x27); db(0x4c); db(0x01); db(0xa0); db(0x7c); db(0x00);
  db(0xbc); db(0x6d); db(0x01); db(0x0e); db(0x64); db(0x2c); db(0x2f); db(0x06);
  db(0x7e); db(0x01); db(0x4a); db(0x45); db(0x67); db(0x04); db(0x08); db(0xc7);
  db(0x00); db(0x02); db(0x2f); db(0x0b); db(0x20); db(0x4b); db(0x61); db(0x00);
- db(0x07); db(0x64); db(0x26); db(0x5f); db(0x0c); db(0x80); db(0xff); db(0xff);
+ db(0x07); db(0x66); db(0x26); db(0x5f); db(0x0c); db(0x80); db(0xff); db(0xff);
  db(0xff); db(0xfe); db(0x67); db(0x08); db(0x48); db(0x46); db(0x52); db(0x46);
  db(0x48); db(0x46); db(0x60); db(0xdc); db(0x2c); db(0x1f); db(0x52); db(0x46);
  db(0x60); db(0xce); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x22); db(0x4b);
- db(0x20); db(0x3c); db(0x00); db(0x00); db(0x02); db(0x2c); db(0x4e); db(0xae);
+ db(0x20); db(0x3c); db(0x00); db(0x00); db(0x02); db(0x30); db(0x4e); db(0xae);
  db(0xff); db(0x2e); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x22); db(0x4c);
  db(0x4e); db(0xae); db(0xfe); db(0x62); db(0x78); db(0x03); db(0x0c); db(0x6e);
  db(0x00); db(0x24); db(0x00); db(0x14); db(0x65); db(0x04); db(0x00); db(0x44);
  db(0x01); db(0x00); db(0x43); db(0xf9); db(0x00); db(0x21); db(0x00); db(0x00);
  db(0x4e); db(0xae); db(0xfd); db(0xea); db(0x4a); db(0x80); db(0x66); db(0x20);
- db(0x30); db(0x3c); db(0xff); db(0x80); db(0x61); db(0x00); db(0x16); db(0x24);
+ db(0x30); db(0x3c); db(0xff); db(0x80); db(0x61); db(0x00); db(0x16); db(0x38);
  db(0x4e); db(0x90); db(0x22); db(0x04); db(0x74); db(0xf6); db(0x20); db(0x7c);
  db(0x00); db(0x20); db(0x00); db(0x00); db(0x90); db(0x88); db(0x65); db(0x08);
  db(0x67); db(0x06); db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfd); db(0x96);
- db(0x30); db(0x3c); db(0xff); db(0x80); db(0x61); db(0x00); db(0x16); db(0x04);
+ db(0x30); db(0x3c); db(0xff); db(0x80); db(0x61); db(0x00); db(0x16); db(0x18);
  db(0x4e); db(0x90); db(0x20); db(0x49); db(0x20); db(0x01); db(0x67); db(0x0c);
- db(0x22); db(0x04); db(0x74); db(0xfb); db(0x43); db(0xfa); db(0x17); db(0x42);
- db(0x4e); db(0xae); db(0xfd); db(0x96); db(0x41); db(0xfa); db(0x16); db(0xb9);
+ db(0x22); db(0x04); db(0x74); db(0xfb); db(0x43); db(0xfa); db(0x17); db(0x56);
+ db(0x4e); db(0xae); db(0xfd); db(0x96); db(0x41); db(0xfa); db(0x16); db(0xcd);
  db(0x43); db(0xfa); db(0x00); db(0x54); db(0x70); db(0x0a); db(0x61); db(0x00);
- db(0x0c); db(0x62); db(0x22); db(0x40); db(0x72); db(0x01); db(0x30); db(0x3c);
- db(0xff); db(0x48); db(0x61); db(0x00); db(0x15); db(0xd6); db(0x4e); db(0x90);
+ db(0x0c); db(0x76); db(0x22); db(0x40); db(0x72); db(0x01); db(0x30); db(0x3c);
+ db(0xff); db(0x48); db(0x61); db(0x00); db(0x15); db(0xea); db(0x4e); db(0x90);
  db(0x4c); db(0xdf); db(0x7f); db(0xff); db(0x4e); db(0x75); db(0x48); db(0xe7);
  db(0x38); db(0x22); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x24); db(0x00);
  db(0x28); db(0x01); db(0x26); db(0x09); db(0x24); db(0x48); db(0x43); db(0xfa);
- db(0x16); db(0xb3); db(0x70); db(0x00); db(0x4e); db(0xae); db(0xfd); db(0xd8);
+ db(0x16); db(0xc7); db(0x70); db(0x00); db(0x4e); db(0xae); db(0xfd); db(0xd8);
  db(0x4a); db(0x80); db(0x67); db(0x14); db(0x2c); db(0x40); db(0x22); db(0x0a);
  db(0xe4); db(0x8b); db(0x4e); db(0xae); db(0xff); db(0x76); db(0x22); db(0x4e);
  db(0x2c); db(0x78); db(0x00); db(0x04); db(0x4e); db(0xae); db(0xfe); db(0x62);
  db(0x4c); db(0xdf); db(0x44); db(0x1c); db(0x4e); db(0x75); db(0x2c); db(0x78);
  db(0x00); db(0x04); db(0x70); db(0x00); db(0x08); db(0xc0); db(0x00); db(0x0d);
- db(0x4e); db(0xae); db(0xfe); db(0xc2); db(0x41); db(0xfa); db(0x16); db(0x64);
+ db(0x4e); db(0xae); db(0xfe); db(0xc2); db(0x41); db(0xfa); db(0x16); db(0x78);
  db(0x43); db(0xfa); db(0x00); db(0x16); db(0x70); db(0x0f); db(0x22); db(0x3c);
  db(0x00); db(0x00); db(0x1f); db(0x40); db(0x61); db(0x00); db(0xff); db(0xa8);
  db(0x60); db(0xdc); db(0x00); db(0x00); db(0x00); db(0x00); db(0x00); db(0x10);
  db(0x00); db(0x00); db(0x00); db(0x00); db(0x72); db(0x02); db(0x30); db(0x3c);
- db(0xff); db(0x48); db(0x61); db(0x00); db(0x15); db(0x5e); db(0x4e); db(0x90);
- db(0x22); db(0x00); db(0x6b); db(0x04); db(0x61); db(0x00); db(0x07); db(0xf0);
+ db(0xff); db(0x48); db(0x61); db(0x00); db(0x15); db(0x72); db(0x4e); db(0x90);
+ db(0x22); db(0x00); db(0x6b); db(0x04); db(0x61); db(0x00); db(0x08); db(0x04);
  db(0x70); db(0x00); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x00); db(0x20);
- db(0x30); db(0x3c); db(0xff); db(0x50); db(0x61); db(0x00); db(0x15); db(0x44);
+ db(0x30); db(0x3c); db(0xff); db(0x50); db(0x61); db(0x00); db(0x15); db(0x58);
  db(0x70); db(0x00); db(0x4e); db(0x90); db(0x4a); db(0x80); db(0x67); db(0x00);
  db(0x00); db(0xa2); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x30); db(0x3c);
- db(0xff); db(0x50); db(0x61); db(0x00); db(0x15); db(0x2e); db(0x70); db(0x02);
+ db(0xff); db(0x50); db(0x61); db(0x00); db(0x15); db(0x42); db(0x70); db(0x02);
  db(0x4e); db(0x90); db(0x0c); db(0x40); db(0x00); db(0x01); db(0x6d); db(0x00);
  db(0x00); db(0x7c); db(0x6e); db(0x06); db(0x4e); db(0xae); db(0xfe); db(0x92);
  db(0x60); db(0xe4); db(0x0c); db(0x40); db(0x00); db(0x02); db(0x6e); db(0x08);
  db(0x00); db(0x18); db(0x25); db(0x49); db(0x00); db(0x1a); db(0x20); db(0x69);
  db(0x00); db(0x10); db(0x22); db(0x4a); db(0x4e); db(0xae); db(0xfe); db(0x92);
  db(0x60); db(0x00); db(0xff); db(0x74); db(0x30); db(0x3c); db(0xff); db(0x50);
- db(0x61); db(0x00); db(0x14); db(0xa0); db(0x70); db(0x04); db(0x4e); db(0x90);
+ db(0x61); db(0x00); db(0x14); db(0xb4); db(0x70); db(0x04); db(0x4e); db(0x90);
  db(0x70); db(0x01); db(0x4c); db(0xdf); db(0x04); db(0x00); db(0x4e); db(0x75);
  db(0x48); db(0xe7); db(0xc0); db(0xe0); db(0x30); db(0x3c); db(0xff); db(0x38);
- db(0x72); db(0x12); db(0x61); db(0x00); db(0x14); db(0x86); db(0x4e); db(0x90);
+ db(0x72); db(0x12); db(0x61); db(0x00); db(0x14); db(0x9a); db(0x4e); db(0x90);
  db(0x24); db(0x40); db(0x70); db(0x16); db(0x22); db(0x3c); db(0x00); db(0x01);
  db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x22); db(0x40);
  db(0x13); db(0x7c); db(0x00); db(0x02); db(0x00); db(0x08); db(0x13); db(0x7c);
- db(0x00); db(0xf6); db(0x00); db(0x09); db(0x41); db(0xfa); db(0x15); db(0x13);
+ db(0x00); db(0xf6); db(0x00); db(0x09); db(0x41); db(0xfa); db(0x15); db(0x27);
  db(0x23); db(0x48); db(0x00); db(0x0a); db(0x41); db(0xfa); db(0x00); db(0x16);
  db(0x23); db(0x48); db(0x00); db(0x12); db(0x23); db(0x4a); db(0x00); db(0x0e);
  db(0x70); db(0x05); db(0x4e); db(0xae); db(0xff); db(0x58); db(0x4c); db(0xdf);
  db(0x4e); db(0x75); db(0x48); db(0xe7); db(0xc0); db(0xc0); db(0x61); db(0x00);
  db(0xfc); db(0xb0); db(0x70); db(0x1a); db(0x22); db(0x3c); db(0x00); db(0x01);
  db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x22); db(0x40);
- db(0x41); db(0xfa); db(0x14); db(0xe6); db(0x23); db(0x48); db(0x00); db(0x0a);
+ db(0x41); db(0xfa); db(0x14); db(0xfa); db(0x23); db(0x48); db(0x00); db(0x0a);
  db(0x41); db(0xfa); db(0xfe); db(0xd2); db(0x23); db(0x48); db(0x00); db(0x0e);
  db(0x41); db(0xfa); db(0xfe); db(0xca); db(0x23); db(0x48); db(0x00); db(0x12);
  db(0x33); db(0x7c); db(0x02); db(0x14); db(0x00); db(0x08); db(0x70); db(0x03);
  db(0x4e); db(0xae); db(0xff); db(0x58); db(0x61); db(0x00); db(0xff); db(0x72);
  db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x04); db(0x61); db(0x00);
- db(0x13); db(0xfa); db(0x4e); db(0x90); db(0x4a); db(0x80); db(0x67); db(0x04);
- db(0x61); db(0x00); db(0x0a); db(0xcc); db(0x4c); db(0xdf); db(0x03); db(0x03);
+ db(0x14); db(0x0e); db(0x4e); db(0x90); db(0x4a); db(0x80); db(0x67); db(0x04);
+ db(0x61); db(0x00); db(0x0a); db(0xe0); db(0x4c); db(0xdf); db(0x03); db(0x03);
  db(0x4e); db(0x75); db(0x48); db(0xe7); db(0xc0); db(0xf2); db(0x2c); db(0x78);
  db(0x00); db(0x04); db(0x24); db(0x48); db(0x26); db(0x49); db(0x20); db(0x3c);
  db(0x00); db(0x00); db(0x00); db(0xbe); db(0x22); db(0x3c); db(0x00); db(0x01);
  db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x20); db(0x40);
- db(0x70); db(0x00); db(0x43); db(0xeb); db(0x01); db(0xa0); db(0x11); db(0xb1);
+ db(0x70); db(0x00); db(0x43); db(0xeb); db(0x01); db(0xa4); db(0x11); db(0xb1);
  db(0x00); db(0x00); db(0x00); db(0x0e); db(0x52); db(0x40); db(0x0c); db(0x40);
  db(0x00); db(0x8c); db(0x66); db(0xf2); db(0x20); db(0x0a); db(0xe4); db(0x88);
  db(0x21); db(0x40); db(0x00); db(0x36); db(0x22); db(0x48); db(0x41); db(0xfa);
- db(0x14); db(0x68); db(0x23); db(0x48); db(0x00); db(0x0a); db(0x20); db(0x6b);
- db(0x01); db(0x98); db(0x41); db(0xe8); db(0x00); db(0x12); db(0x4e); db(0xae);
+ db(0x14); db(0x7c); db(0x23); db(0x48); db(0x00); db(0x0a); db(0x20); db(0x6b);
+ db(0x01); db(0x9c); db(0x41); db(0xe8); db(0x00); db(0x12); db(0x4e); db(0xae);
  db(0xff); db(0x10); db(0x4c); db(0xdf); db(0x4f); db(0x03); db(0x4e); db(0x75);
  db(0x48); db(0xe7); db(0x7f); db(0x7e); db(0x2c); db(0x78); db(0x00); db(0x04);
  db(0x24); db(0x48); db(0x0c); db(0x9a); db(0x00); db(0x00); db(0x03); db(0xf3);
  db(0x60); db(0xe4); db(0x0c); db(0x83); db(0x00); db(0x00); db(0x03); db(0xf2);
  db(0x66); db(0x14); db(0x52); db(0x86); db(0xbe); db(0x86); db(0x66); db(0x00);
  db(0xff); db(0x8a); db(0x7e); db(0x01); db(0x20); db(0x54); db(0x20); db(0x07);
- db(0x4c); db(0xdf); db(0x7e); db(0xfe); db(0x4e); db(0x75); db(0x7e); db(0x00);
- db(0x60); db(0xf4); db(0x48); db(0xe7); db(0x40); db(0xe2); db(0x2c); db(0x78);
- db(0x00); db(0x04); db(0x41); db(0xee); db(0x01); db(0x50); db(0x20); db(0x50);
- db(0x4a); db(0x90); db(0x67); db(0x1a); db(0x22); db(0x68); db(0x00); db(0x0a);
- db(0x45); db(0xfa); db(0x13); db(0xba); db(0x10); db(0x19); db(0x12); db(0x1a);
- db(0xb0); db(0x01); db(0x66); db(0x06); db(0x4a); db(0x00); db(0x67); db(0x42);
- db(0x60); db(0xf2); db(0x20); db(0x50); db(0x60); db(0xe2); db(0x70); db(0x20);
- db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae);
- db(0xff); db(0x3a); db(0x24); db(0x40); db(0x15); db(0x7c); db(0x00); db(0x08);
- db(0x00); db(0x08); db(0x41); db(0xfa); db(0x13); db(0x90); db(0x25); db(0x48);
- db(0x00); db(0x0a); db(0x41); db(0xfa); db(0x13); db(0x0c); db(0x25); db(0x48);
- db(0x00); db(0x0e); db(0x41); db(0xea); db(0x00); db(0x12); db(0x20); db(0x88);
- db(0x58); db(0x90); db(0x21); db(0x48); db(0x00); db(0x08); db(0x41); db(0xee);
- db(0x01); db(0x50); db(0x22); db(0x4a); db(0x4e); db(0xae); db(0xff); db(0x0a);
- db(0x20); db(0x4a); db(0x20); db(0x08); db(0x4c); db(0xdf); db(0x47); db(0x02);
- db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x01); db(0x02); db(0x2e); db(0x00);
- db(0x4a); db(0x2b); db(0x00); db(0x4c); db(0x67); db(0x7c); db(0x2c); db(0x6b);
- db(0x00); db(0xa0); db(0x0c); db(0x6e); db(0x00); db(0x25); db(0x00); db(0x14);
- db(0x65); db(0x3e); db(0x72); db(0x0e); db(0x4e); db(0xae); db(0xfd); db(0x66);
- db(0x02); db(0x80); db(0xff); db(0xff); db(0xff); db(0xfe); db(0x67); db(0x62);
- db(0x08); db(0x07); db(0x00); db(0x00); db(0x67); db(0x0a); db(0x41); db(0xeb);
- db(0x00); db(0x20); db(0x22); db(0x08); db(0x4e); db(0xae); db(0xfd); db(0x5a);
+ db(0x4c); db(0xdf); db(0x7e); db(0xfe); db(0x4e); db(0x75); db(0x91); db(0xc8);
+ db(0x7e); db(0x00); db(0x60); db(0xf2); db(0x48); db(0xe7); db(0x40); db(0xe2);
+ db(0x2c); db(0x78); db(0x00); db(0x04); db(0x41); db(0xee); db(0x01); db(0x50);
+ db(0x20); db(0x50); db(0x4a); db(0x90); db(0x67); db(0x1a); db(0x22); db(0x68);
+ db(0x00); db(0x0a); db(0x45); db(0xfa); db(0x13); db(0xcc); db(0x10); db(0x19);
+ db(0x12); db(0x1a); db(0xb0); db(0x01); db(0x66); db(0x06); db(0x4a); db(0x00);
+ db(0x67); db(0x42); db(0x60); db(0xf2); db(0x20); db(0x50); db(0x60); db(0xe2);
+ db(0x70); db(0x20); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01);
+ db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x24); db(0x40); db(0x15); db(0x7c);
+ db(0x00); db(0x08); db(0x00); db(0x08); db(0x41); db(0xfa); db(0x13); db(0xa2);
+ db(0x25); db(0x48); db(0x00); db(0x0a); db(0x41); db(0xfa); db(0x13); db(0x1e);
+ db(0x25); db(0x48); db(0x00); db(0x0e); db(0x41); db(0xea); db(0x00); db(0x12);
+ db(0x20); db(0x88); db(0x58); db(0x90); db(0x21); db(0x48); db(0x00); db(0x08);
+ db(0x41); db(0xee); db(0x01); db(0x50); db(0x22); db(0x4a); db(0x4e); db(0xae);
+ db(0xff); db(0x0a); db(0x20); db(0x4a); db(0x20); db(0x08); db(0x4c); db(0xdf);
+ db(0x47); db(0x02); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x01); db(0x02);
+ db(0x2e); db(0x00); db(0x4a); db(0x2b); db(0x00); db(0x4c); db(0x67); db(0x7c);
+ db(0x2c); db(0x6b); db(0x00); db(0xa0); db(0x0c); db(0x6e); db(0x00); db(0x25);
+ db(0x00); db(0x14); db(0x65); db(0x3e); db(0x72); db(0x0e); db(0x4e); db(0xae);
+ db(0xfd); db(0x66); db(0x02); db(0x80); db(0xff); db(0xff); db(0xff); db(0xfe);
+ db(0x67); db(0x62); db(0x08); db(0x07); db(0x00); db(0x00); db(0x67); db(0x0a);
+ db(0x41); db(0xeb); db(0x00); db(0x20); db(0x22); db(0x08); db(0x4e); db(0xae);
+ db(0xfd); db(0x5a); db(0x08); db(0x07); db(0x00); db(0x01); db(0x67); db(0x12);
+ db(0x4a); db(0x2b); db(0x00); db(0x9e); db(0x66); db(0x0c); db(0x50); db(0xeb);
+ db(0x00); db(0x9e); db(0x22); db(0x2b); db(0x00); db(0xb4); db(0x4e); db(0xae);
+ db(0xfd); db(0x5a); db(0x72); db(0x0e); db(0x4e); db(0xae); db(0xfd); db(0x6c);
+ db(0x60); db(0x32); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x4e); db(0xae);
+ db(0xff); db(0x7c); db(0x08); db(0x07); db(0x00); db(0x00); db(0x67); db(0x08);
+ db(0x41); db(0xeb); db(0x00); db(0x20); db(0x61); db(0x00); db(0x00); db(0xac);
  db(0x08); db(0x07); db(0x00); db(0x01); db(0x67); db(0x12); db(0x4a); db(0x2b);
  db(0x00); db(0x9e); db(0x66); db(0x0c); db(0x50); db(0xeb); db(0x00); db(0x9e);
- db(0x22); db(0x2b); db(0x00); db(0xb4); db(0x4e); db(0xae); db(0xfd); db(0x5a);
- db(0x72); db(0x0e); db(0x4e); db(0xae); db(0xfd); db(0x6c); db(0x60); db(0x32);
- db(0x2c); db(0x78); db(0x00); db(0x04); db(0x4e); db(0xae); db(0xff); db(0x7c);
- db(0x08); db(0x07); db(0x00); db(0x00); db(0x67); db(0x08); db(0x41); db(0xeb);
- db(0x00); db(0x20); db(0x61); db(0x00); db(0x00); db(0xac); db(0x08); db(0x07);
- db(0x00); db(0x01); db(0x67); db(0x12); db(0x4a); db(0x2b); db(0x00); db(0x9e);
- db(0x66); db(0x0c); db(0x50); db(0xeb); db(0x00); db(0x9e); db(0x20); db(0x6b);
- db(0x00); db(0xb4); db(0x61); db(0x00); db(0x00); db(0x94); db(0x4e); db(0xae);
- db(0xff); db(0x76); db(0x4c); db(0xdf); db(0x40); db(0x80); db(0x4e); db(0x75);
- db(0x48); db(0xe7); db(0x01); db(0x22); db(0x2e); db(0x00); db(0x2c); db(0x6b);
- db(0x00); db(0xa0); db(0x0c); db(0x6e); db(0x00); db(0x25); db(0x00); db(0x14);
- db(0x65); db(0x3e); db(0x72); db(0x0e); db(0x4e); db(0xae); db(0xfd); db(0x66);
- db(0x02); db(0x80); db(0xff); db(0xff); db(0xff); db(0xfe); db(0x67); db(0x62);
- db(0x08); db(0x07); db(0x00); db(0x00); db(0x67); db(0x0a); db(0x41); db(0xeb);
- db(0x00); db(0x20); db(0x22); db(0x08); db(0x4e); db(0xae); db(0xfd); db(0x60);
+ db(0x20); db(0x6b); db(0x00); db(0xb4); db(0x61); db(0x00); db(0x00); db(0x94);
+ db(0x4e); db(0xae); db(0xff); db(0x76); db(0x4c); db(0xdf); db(0x40); db(0x80);
+ db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x01); db(0x22); db(0x2e); db(0x00);
+ db(0x2c); db(0x6b); db(0x00); db(0xa0); db(0x0c); db(0x6e); db(0x00); db(0x25);
+ db(0x00); db(0x14); db(0x65); db(0x3e); db(0x72); db(0x0e); db(0x4e); db(0xae);
+ db(0xfd); db(0x66); db(0x02); db(0x80); db(0xff); db(0xff); db(0xff); db(0xfe);
+ db(0x67); db(0x62); db(0x08); db(0x07); db(0x00); db(0x00); db(0x67); db(0x0a);
+ db(0x41); db(0xeb); db(0x00); db(0x20); db(0x22); db(0x08); db(0x4e); db(0xae);
+ db(0xfd); db(0x60); db(0x08); db(0x07); db(0x00); db(0x01); db(0x67); db(0x12);
+ db(0x4a); db(0x2b); db(0x00); db(0x9e); db(0x67); db(0x0c); db(0x42); db(0x2b);
+ db(0x00); db(0x9e); db(0x22); db(0x2b); db(0x00); db(0xb4); db(0x4e); db(0xae);
+ db(0xfd); db(0x60); db(0x72); db(0x0e); db(0x4e); db(0xae); db(0xfd); db(0x6c);
+ db(0x60); db(0x32); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x4e); db(0xae);
+ db(0xff); db(0x7c); db(0x08); db(0x07); db(0x00); db(0x00); db(0x67); db(0x08);
+ db(0x41); db(0xeb); db(0x00); db(0x20); db(0x61); db(0x00); db(0x00); db(0x44);
  db(0x08); db(0x07); db(0x00); db(0x01); db(0x67); db(0x12); db(0x4a); db(0x2b);
  db(0x00); db(0x9e); db(0x67); db(0x0c); db(0x42); db(0x2b); db(0x00); db(0x9e);
- db(0x22); db(0x2b); db(0x00); db(0xb4); db(0x4e); db(0xae); db(0xfd); db(0x60);
- db(0x72); db(0x0e); db(0x4e); db(0xae); db(0xfd); db(0x6c); db(0x60); db(0x32);
- db(0x2c); db(0x78); db(0x00); db(0x04); db(0x4e); db(0xae); db(0xff); db(0x7c);
- db(0x08); db(0x07); db(0x00); db(0x00); db(0x67); db(0x08); db(0x41); db(0xeb);
- db(0x00); db(0x20); db(0x61); db(0x00); db(0x00); db(0x44); db(0x08); db(0x07);
- db(0x00); db(0x01); db(0x67); db(0x12); db(0x4a); db(0x2b); db(0x00); db(0x9e);
- db(0x67); db(0x0c); db(0x42); db(0x2b); db(0x00); db(0x9e); db(0x20); db(0x6b);
- db(0x00); db(0xb4); db(0x61); db(0x00); db(0x00); db(0x2c); db(0x4e); db(0xae);
- db(0xff); db(0x76); db(0x4c); db(0xdf); db(0x44); db(0x80); db(0x4e); db(0x75);
- db(0x22); db(0x48); db(0x20); db(0x6b); db(0x00); db(0xa0); db(0x20); db(0x68);
- db(0x00); db(0x22); db(0x20); db(0x68); db(0x00); db(0x18); db(0xd1); db(0xc8);
- db(0xd1); db(0xc8); db(0x22); db(0xa8); db(0x00); db(0x04); db(0x20); db(0x09);
- db(0xe4); db(0x88); db(0x21); db(0x40); db(0x00); db(0x04); db(0x4e); db(0x75);
- db(0x24); db(0x48); db(0x20); db(0x6b); db(0x00); db(0xa0); db(0x20); db(0x68);
- db(0x00); db(0x22); db(0x20); db(0x68); db(0x00); db(0x18); db(0xd1); db(0xc8);
- db(0xd1); db(0xc8); db(0x22); db(0x68); db(0x00); db(0x04); db(0xd3); db(0xc9);
- db(0xd3); db(0xc9); db(0xb3); db(0xca); db(0x66); db(0x06); db(0x21); db(0x52);
- db(0x00); db(0x04); db(0x60); db(0x18); db(0x20); db(0x09); db(0x67); db(0x0e);
- db(0x20); db(0x11); db(0xd0); db(0x80); db(0xd0); db(0x80); db(0xb5); db(0xc0);
- db(0x67); db(0x04); db(0x22); db(0x40); db(0x60); db(0xee); db(0x20); db(0x09);
- db(0x67); db(0x02); db(0x22); db(0x92); db(0x4e); db(0x75); db(0x48); db(0xe7);
- db(0x20); db(0x22); db(0x74); db(0x16); db(0x9f); db(0xc2); db(0x24); db(0x4f);
- db(0x32); db(0x02); db(0x42); db(0x32); db(0x10); db(0xff); db(0x53); db(0x41);
- db(0x66); db(0xf8); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x72); db(0x0f);
- db(0x4a); db(0x80); db(0x67); db(0x02); db(0x72); db(0x10); db(0x15); db(0x41);
- db(0x00); db(0x04); db(0x35); db(0x7c); db(0x08); db(0x00); db(0x00); db(0x08);
- db(0x22); db(0x6b); db(0x00); db(0xa4); db(0x33); db(0x7c); db(0x00); db(0x0b);
- db(0x00); db(0x1c); db(0x23); db(0x7c); db(0x00); db(0x00); db(0x00); db(0x16);
- db(0x00); db(0x24); db(0x23); db(0x4a); db(0x00); db(0x28); db(0x13); db(0x7c);
- db(0x00); db(0x01); db(0x00); db(0x1e); db(0x22); db(0x6b); db(0x00); db(0xa8);
- db(0x33); db(0x7c); db(0x00); db(0x0a); db(0x00); db(0x1c); db(0x13); db(0x7c);
- db(0x00); db(0x01); db(0x00); db(0x1e); db(0x4e); db(0xae); db(0xfe); db(0x38);
- db(0x22); db(0x6b); db(0x00); db(0xa8); db(0x25); db(0x69); db(0x00); db(0x20);
- db(0x00); db(0x0e); db(0x25); db(0x69); db(0x00); db(0x24); db(0x00); db(0x12);
- db(0x22); db(0x6b); db(0x00); db(0xa4); db(0x4e); db(0xae); db(0xfe); db(0x38);
- db(0xdf); db(0xc2); db(0x4c); db(0xdf); db(0x44); db(0x04); db(0x4e); db(0x75);
- db(0x4a); db(0x00); db(0x67); db(0x26); db(0x4a); db(0x2b); db(0x00); db(0x4c);
- db(0x66); db(0x36); db(0x70); db(0x00); db(0x4a); db(0x33); db(0x00); db(0x4d);
- db(0x67); db(0x04); db(0x52); db(0x00); db(0x60); db(0xf6); db(0x17); db(0x40);
- db(0x00); db(0x4c); db(0x67); db(0x24); db(0x20); db(0x01); db(0x61); db(0x00);
- db(0xfd); db(0xf2); db(0x70); db(0x01); db(0x61); db(0x00); db(0xff); db(0x60);
- db(0x60); db(0x16); db(0x4a); db(0x2b); db(0x00); db(0x4c); db(0x67); db(0x10);
- db(0x42); db(0x2b); db(0x00); db(0x4c); db(0x20); db(0x01); db(0x61); db(0x00);
- db(0xfe); db(0x68); db(0x70); db(0x00); db(0x61); db(0x00); db(0xff); db(0x48);
- db(0x4e); db(0x75); db(0x4a); db(0xac); db(0x00); db(0x14); db(0x67); db(0x0a);
- db(0x70); db(0x00); db(0x72); db(0x01); db(0x61); db(0x00); db(0xff); db(0xb2);
- db(0x4e); db(0x75); db(0x70); db(0x01); db(0x72); db(0x03); db(0x61); db(0x00);
- db(0xff); db(0xa8); db(0x4e); db(0x75); db(0x10); db(0x2b); db(0x00); db(0xac);
- db(0x6b); db(0x0a); db(0x70); db(0x01); db(0x72); db(0x03); db(0x61); db(0x00);
- db(0xff); db(0x98); db(0x4e); db(0x75); db(0x72); db(0x01); db(0x0c); db(0x00);
- db(0x00); db(0xfe); db(0x66); db(0x02); db(0x72); db(0x03); db(0x70); db(0x00);
- db(0x61); db(0x00); db(0xff); db(0x86); db(0x4e); db(0x75); db(0x20); db(0x6c);
- db(0x00); db(0x24); db(0x4a); db(0x90); db(0x67); db(0x0c); db(0x4a); db(0xa8);
- db(0x00); db(0x08); db(0x66); db(0x0a); db(0x4a); db(0xa8); db(0x00); db(0x0c);
- db(0x66); db(0x04); db(0x70); db(0x01); db(0x4e); db(0x75); db(0x48); db(0xe7);
- db(0x3f); db(0x3e); db(0x2a); db(0x48); db(0x24); db(0x6c); db(0x00); db(0x18);
- db(0x2e); db(0x15); db(0x7a); db(0x00); db(0x4a); db(0x87); db(0x67); db(0x70);
- db(0x20); db(0x0a); db(0x67); db(0x6c); db(0x7c); db(0x00); db(0x22); db(0x2d);
- db(0x00); db(0x08); db(0x67); db(0x12); db(0x24); db(0x2a); db(0x00); db(0x04);
- db(0x2c); db(0x6b); db(0x00); db(0xa0); db(0x4e); db(0xae); db(0xfc); db(0x34);
- db(0x4a); db(0x80); db(0x66); db(0x02); db(0x50); db(0xc6); db(0x22); db(0x2d);
- db(0x00); db(0x0c); db(0x67); db(0x1c); db(0x20); db(0x41); db(0x22); db(0x4a);
- db(0x2f); db(0x0a); db(0x45); db(0xec); db(0x00); db(0x20); db(0x48); db(0x7a);
- db(0x00); db(0x08); db(0x2f); db(0x28); db(0x00); db(0x08); db(0x4e); db(0x75);
- db(0x24); db(0x5f); db(0x4a); db(0x80); db(0x66); db(0x02); db(0x50); db(0xc6);
- db(0x4a); db(0x06); db(0x67); db(0x24); db(0x20); db(0x2a); db(0x00); db(0x04);
- db(0x90); db(0x8a); db(0x4a); db(0x92); db(0x66); db(0x0a); db(0x20); db(0x05);
- db(0x67); db(0x10); db(0x20); db(0x40); db(0x42); db(0x90); db(0x60); db(0x0a);
- db(0x20); db(0x52); db(0x22); db(0x4a); db(0x22); db(0xd8); db(0x59); db(0x80);
- db(0x6a); db(0xfa); db(0x53); db(0x95); db(0x53); db(0x87); db(0x60); db(0x94);
- db(0x2a); db(0x0a); db(0x24); db(0x52); db(0x53); db(0x87); db(0x60); db(0x8c);
- db(0x4c); db(0xdf); db(0x7c); db(0xfc); db(0x20); db(0x6c); db(0x00); db(0x24);
- db(0x4a); db(0x90); db(0x4e); db(0x75); db(0x61); db(0x00); db(0xfc); db(0x7c);
- db(0x21); db(0x40); db(0x01); db(0x98); db(0x2f); db(0x08); db(0x30); db(0x3c);
- db(0xff); db(0xec); db(0x61); db(0x00); db(0x0f); db(0x06); db(0x2a); db(0x50);
- db(0x30); db(0x3c); db(0xff); db(0x28); db(0x61); db(0x00); db(0x0e); db(0xfc);
- db(0x22); db(0x48); db(0x20); db(0x5f); db(0x42); db(0xa8); db(0x01); db(0x90);
- db(0x42); db(0xa8); db(0x01); db(0x94); db(0x4e); db(0x91); db(0x26); db(0x00);
- db(0x0c); db(0x43); db(0xff); db(0xfe); db(0x67); db(0x00); db(0xf9); db(0x16);
- db(0x20); db(0x28); db(0x01); db(0x90); db(0x67); db(0x14); db(0x6b); db(0x12);
- db(0x2f); db(0x08); db(0x72); db(0x01); db(0x2c); db(0x78); db(0x00); db(0x04);
- db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x20); db(0x5f); db(0x21); db(0x40);
- db(0x01); db(0x94); db(0x4a); db(0x83); db(0x6a); db(0x0e); db(0x22); db(0x48);
- db(0x30); db(0x3c); db(0xff); db(0x20); db(0x61); db(0x00); db(0x0e); db(0xbc);
- db(0x4e); db(0x90); db(0x60); db(0x26); db(0x2c); db(0x4c); db(0x2f); db(0x08);
- db(0x4e); db(0xae); db(0xff); db(0x70); db(0x20); db(0x5f); db(0x22); db(0x48);
- db(0x26); db(0x40); db(0x30); db(0x3c); db(0xff); db(0x20); db(0x61); db(0x00);
- db(0x0e); db(0xa2); db(0x4e); db(0x90); db(0x70); db(0x00); db(0x27); db(0x40);
- db(0x00); db(0x08); db(0x27); db(0x40); db(0x00); db(0x10); db(0x27); db(0x40);
- db(0x00); db(0x20); db(0x4a); db(0xa9); db(0x01); db(0x94); db(0x67); db(0x28);
- db(0x20); db(0x69); db(0x01); db(0x94); db(0x61); db(0x00); db(0xfa); db(0xf2);
- db(0x48); db(0xe7); db(0x80); db(0xc0); db(0x20); db(0x29); db(0x01); db(0x90);
- db(0x22); db(0x69); db(0x01); db(0x94); db(0x2c); db(0x78); db(0x00); db(0x04);
- db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x4c); db(0xdf); db(0x03); db(0x01);
- db(0x4a); db(0x80); db(0x67); db(0x04); db(0x61); db(0x00); db(0xfa); db(0x7c);
- db(0x4a); db(0x83); db(0x6b); db(0x00); db(0xf8); db(0x90); db(0x30); db(0x3c);
- db(0xff); db(0x18); db(0x61); db(0x00); db(0x0e); db(0x56); db(0x4e); db(0x90);
- db(0x20); db(0x03); db(0x16); db(0x29); db(0x00); db(0x4f); db(0x4a); db(0x80);
- db(0x66); db(0x1a); db(0x27); db(0x7c); db(0x00); db(0x00); db(0x17); db(0x70);
- db(0x00); db(0x14); db(0x41); db(0xfa); db(0xf6); db(0x78); db(0x20); db(0x08);
- db(0xe4); db(0x88); db(0x27); db(0x40); db(0x00); db(0x20); db(0x70); db(0xff);
- db(0x27); db(0x40); db(0x00); db(0x24); db(0x08); db(0x07); db(0x00); db(0x00);
- db(0x67); db(0x40); db(0x0c); db(0x03); db(0x00); db(0x80); db(0x67); db(0x3a);
- db(0x2c); db(0x78); db(0x00); db(0x04); db(0x70); db(0x14); db(0x22); db(0x3c);
- db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a);
- db(0x22); db(0x40); db(0x30); db(0x3c); db(0x10); db(0x00); db(0x80); db(0x03);
- db(0x33); db(0x40); db(0x00); db(0x08); db(0x23); db(0x6d); db(0x01); db(0x04);
- db(0x00); db(0x0a); db(0x23); db(0x4b); db(0x00); db(0x10); db(0x41); db(0xec);
- db(0x00); db(0x4a); db(0x4e); db(0xae); db(0xff); db(0x7c); db(0x4e); db(0xae);
- db(0xfe); db(0xf2); db(0x4e); db(0xae); db(0xff); db(0x76); db(0x70); db(0x00);
- db(0x4e); db(0x75); db(0x24); db(0x49); db(0x20); db(0x4b); db(0x72); db(0x00);
- db(0x22); db(0x41); db(0x08); db(0x07); db(0x00); db(0x01); db(0x67); db(0x08);
- db(0x08); db(0x07); db(0x00); db(0x02); db(0x67); db(0x02); db(0x72); db(0x01);
- db(0x70); db(0x80); db(0x2c); db(0x4c); db(0x4e); db(0xae); db(0xff); db(0x6a);
- db(0x08); db(0x07); db(0x00); db(0x01); db(0x67); db(0x5c); db(0x08); db(0x07);
- db(0x00); db(0x02); db(0x66); db(0x56); db(0x20); db(0x52); db(0x74); db(0x02);
- db(0x52); db(0x82); db(0x4a); db(0x30); db(0x28); db(0xfd); db(0x66); db(0xf8);
- db(0x2c); db(0x78); db(0x00); db(0x04); db(0x20); db(0x02); db(0x72); db(0x01);
- db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x4a); db(0x80); db(0x67); db(0x3a);
- db(0x20); db(0x52); db(0x24); db(0x40); db(0x22); db(0x4a); db(0x12); db(0xd8);
- db(0x66); db(0xfc); db(0x13); db(0x7c); db(0x00); db(0x3a); db(0xff); db(0xff);
- db(0x42); db(0x11); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x43); db(0xfa);
- db(0x0e); db(0x83); db(0x70); db(0x00); db(0x4e); db(0xae); db(0xfd); db(0xd8);
- db(0x2c); db(0x40); db(0x22); db(0x0a); db(0x4e); db(0xae); db(0xff); db(0x52);
- db(0x22); db(0x4e); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x4e); db(0xae);
- db(0xfe); db(0x62); db(0x22); db(0x4a); db(0x20); db(0x02); db(0x4e); db(0xae);
- db(0xff); db(0x2e); db(0x70); db(0x00); db(0x4e); db(0x75); db(0x48); db(0xe7);
- db(0x3f); db(0x3e); db(0x2c); db(0x01); db(0x7e); db(0x06); db(0x2c); db(0x78);
- db(0x00); db(0x04); db(0x43); db(0xfa); db(0x0e); db(0x7e); db(0x70); db(0x24);
- db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x4a); db(0x80); db(0x66); db(0x0e);
- db(0x08); db(0x87); db(0x00); db(0x02); db(0x43); db(0xfa); db(0x0e); db(0x6c);
- db(0x70); db(0x00); db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x28); db(0x40);
- db(0x20); db(0x3c); db(0x00); db(0x00); db(0x02); db(0x2c); db(0x22); db(0x3c);
- db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a);
- db(0x20); db(0x40); db(0x4a); db(0x80); db(0x67); db(0x2c); db(0x21); db(0x4c);
- db(0x01); db(0x9c); db(0x48); db(0xe7); db(0x00); db(0x8a); db(0x61); db(0x00);
- db(0xfe); db(0x04); db(0x4c); db(0xdf); db(0x51); db(0x00); db(0x0c); db(0x80);
- db(0xff); db(0xff); db(0xff); db(0xfe); db(0x67); db(0x08); db(0x48); db(0x46);
- db(0x52); db(0x46); db(0x48); db(0x46); db(0x60); db(0xe4); db(0x22); db(0x48);
- db(0x20); db(0x3c); db(0x00); db(0x00); db(0x02); db(0x2c); db(0x4e); db(0xae);
- db(0xff); db(0x2e); db(0x22); db(0x4c); db(0x4e); db(0xae); db(0xfe); db(0x62);
- db(0x4c); db(0xdf); db(0x7c); db(0xfc); db(0x4e); db(0x75); db(0x30); db(0x3c);
- db(0xff); db(0x58); db(0x61); db(0x00); db(0x0c); db(0xe6); db(0x70); db(0x03);
- db(0x4e); db(0x90); db(0x22); db(0x6b); db(0x00); db(0xa8); db(0x23); db(0x40);
- db(0x00); db(0x20); db(0x67); db(0x16); db(0x70); db(0x00); db(0x23); db(0x40);
- db(0x00); db(0x24); db(0x33); db(0x7c); db(0x00); db(0x0b); db(0x00); db(0x1c);
- db(0x13); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x1e); db(0x4e); db(0xae);
- db(0xfe); db(0x38); db(0x4e); db(0x75); db(0x2c); db(0x78); db(0x00); db(0x04);
- db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfe); db(0xda); db(0x20); db(0x40);
- db(0x4b); db(0xe8); db(0x00); db(0x5c); db(0x43); db(0xfa); db(0x0d); db(0xa5);
- db(0x70); db(0x00); db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x24); db(0x40);
- db(0x20); db(0x3c); db(0x00); db(0x00); db(0x00); db(0xb9); db(0x22); db(0x3c);
- db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a);
- db(0x26); db(0x40); db(0x7c); db(0x00); db(0x26); db(0x86); db(0x27); db(0x46);
- db(0x00); db(0x04); db(0x27); db(0x46); db(0x00); db(0x08); db(0x27); db(0x4a);
- db(0x00); db(0xa0); db(0x50); db(0xeb); db(0x00); db(0x9e); db(0x93); db(0xc9);
- db(0x4e); db(0xae); db(0xfe); db(0xda); db(0x27); db(0x40); db(0x00); db(0xb0);
- db(0x41); db(0xfa); db(0x0c); db(0x7e); db(0x70); db(0x00); db(0x72); db(0x00);
- db(0x61); db(0x00); db(0x02); db(0xae); db(0x27); db(0x40); db(0x00); db(0xa4);
- db(0x41); db(0xfa); db(0x0c); db(0x7b); db(0x70); db(0x00); db(0x72); db(0x00);
- db(0x61); db(0x00); db(0x02); db(0x9e); db(0x27); db(0x40); db(0x00); db(0xa8);
- db(0x7a); db(0x00); db(0x20); db(0x4d); db(0x4e); db(0xae); db(0xfe); db(0x80);
- db(0x20); db(0x4d); db(0x4e); db(0xae); db(0xfe); db(0x8c); db(0x28); db(0x40);
- db(0x26); db(0x2c); db(0x00); db(0x0a); db(0x30); db(0x3c); db(0xff); db(0x40);
- db(0x61); db(0x00); db(0x0c); db(0x38); db(0x70); db(0x00); db(0x4e); db(0x90);
- db(0x24); db(0x00); db(0x70); db(0x01); db(0x61); db(0x00); db(0xfa); db(0x04);
- db(0x08); db(0x02); db(0x00); db(0x01); db(0x67); db(0x06); db(0x70); db(0x01);
- db(0x61); db(0x00); db(0xfb); db(0x6c); db(0x60); db(0x00); db(0x01); db(0x2e);
- db(0x20); db(0x4d); db(0x4e); db(0xae); db(0xfe); db(0x8c); db(0x28); db(0x40);
- db(0x4a); db(0x80); db(0x66); db(0x10); db(0x70); db(0x00); db(0x12); db(0x2d);
- db(0x00); db(0x0f); db(0x03); db(0xc0); db(0x08); db(0xc0); db(0x00); db(0x0d);
- db(0x4e); db(0xae); db(0xfe); db(0xc2); db(0x4a); db(0x2b); db(0x00); db(0xad);
- db(0x67); db(0x08); db(0x61); db(0x00); db(0xff); db(0x0a); db(0x42); db(0x2b);
- db(0x00); db(0xad); db(0x4a); db(0x2b); db(0x00); db(0xac); db(0x67); db(0x24);
- db(0x30); db(0x3c); db(0xff); db(0x58); db(0x61); db(0x00); db(0x0b); db(0xe4);
- db(0x70); db(0x01); db(0x4e); db(0x90); db(0x4a); db(0x80); db(0x67); db(0x04);
- db(0x61); db(0x00); db(0xfb); db(0xfa); db(0x42); db(0x2b); db(0x00); db(0xac);
- db(0x30); db(0x3c); db(0xff); db(0x58); db(0x61); db(0x00); db(0x0b); db(0xcc);
- db(0x70); db(0x02); db(0x4e); db(0x90); db(0x20); db(0x0c); db(0x67); db(0x56);
- db(0x0c); db(0x6c); db(0x00); db(0x26); db(0x00); db(0x12); db(0x66); db(0x4e);
- db(0x0c); db(0xac); db(0x40); db(0x00); db(0x00); db(0x00); db(0x00); db(0x14);
- db(0x66); db(0x44); db(0x0c); db(0x6c); db(0x12); db(0x34); db(0x00); db(0x18);
- db(0x66); db(0x3c); db(0x20); db(0x6c); db(0x00); db(0x1a); db(0x20); db(0x28);
- db(0x00); db(0x0c); db(0x02); db(0x80); db(0x80); db(0x00); db(0x00); db(0x08);
- db(0x0c); db(0x80); db(0x80); db(0x00); db(0x00); db(0x08); db(0x66); db(0x1a);
- db(0x02); db(0xa8); db(0x7f); db(0xff); db(0xff); db(0xff); db(0x00); db(0x0c);
- db(0x20); db(0x68); db(0x00); db(0x10); db(0x22); db(0x4c); db(0x12); db(0xbc);
- db(0x00); db(0x08); db(0x4e); db(0xae); db(0xfe); db(0x92); db(0x60); db(0x00);
- db(0xff); db(0x60); db(0x22); db(0x4c); db(0x70); db(0x26); db(0x4e); db(0xae);
- db(0xff); db(0x2e); db(0x60); db(0x00); db(0xff); db(0x54); db(0x74); db(0xfe);
- db(0x20); db(0x0c); db(0x67); db(0x14); db(0x26); db(0x2c); db(0x00); db(0x0a);
- db(0x66); db(0x42); db(0x74); db(0xff); db(0x30); db(0x3c); db(0xff); db(0x50);
- db(0x61); db(0x00); db(0x0b); db(0x58); db(0x70); db(0x01); db(0x4e); db(0x90);
- db(0x45); db(0xeb); db(0x00); db(0x04); db(0x20); db(0x52); db(0x20); db(0x08);
- db(0x67); db(0x00); db(0xff); db(0x2e); db(0x22); db(0x50); db(0x20); db(0x40);
- db(0x20); db(0x28); db(0x00); db(0x04); db(0xb4); db(0x80); db(0x66); db(0x16);
- db(0x48); db(0xe7); db(0x00); db(0xc0); db(0x28); db(0x68); db(0x00); db(0x0a);
- db(0x61); db(0x4a); db(0x53); db(0x85); db(0x4c); db(0xdf); db(0x03); db(0x00);
- db(0x24); db(0x89); db(0x20); db(0x49); db(0x60); db(0xd8); db(0x24); db(0x48);
- db(0x20); db(0x49); db(0x60); db(0xd2); db(0x0c); db(0x85); db(0x00); db(0x00);
- db(0x00); db(0x14); db(0x65); db(0x00); db(0x00); db(0x0a); db(0x70); db(0x01);
- db(0x29); db(0x40); db(0x00); db(0x04); db(0x60); db(0x12); db(0x61); db(0x5e);
- db(0x30); db(0x3c); db(0xff); db(0x30); db(0x61); db(0x00); db(0x0b); db(0x04);
- db(0x4e); db(0x90); db(0x4a); db(0x80); db(0x67); db(0x0e); db(0x52); db(0x85);
- db(0x28); db(0xab); db(0x00); db(0x04); db(0x27); db(0x4c); db(0x00); db(0x04);
- db(0x60); db(0x00); db(0xfe); db(0xd6); db(0x28); db(0x43); db(0x61); db(0x04);
- db(0x60); db(0x00); db(0xfe); db(0xce); db(0x0c); db(0xac); db(0x00); db(0x00);
- db(0x00); db(0x1f); db(0x00); db(0x08); db(0x66); db(0x04); db(0x61); db(0x00);
- db(0xfa); db(0xe2); db(0x0c); db(0xac); db(0x00); db(0x00); db(0x04); db(0x09);
- db(0x00); db(0x08); db(0x66); db(0x14); db(0x61); db(0x00); db(0xfb); db(0x10);
- db(0x66); db(0x0e); db(0x30); db(0x3c); db(0xff); db(0x58); db(0x61); db(0x00);
- db(0x0a); db(0xc2); db(0x70); db(0x00); db(0x4e); db(0x90); db(0x60); db(0xec);
- db(0x22); db(0x54); db(0x20); db(0x6c); db(0x00); db(0x04); db(0x29); db(0x4d);
- db(0x00); db(0x04); db(0x4e); db(0xee); db(0xfe); db(0x92); db(0x2f); db(0x05);
- db(0x7a); db(0xfc); db(0x24); db(0x53); db(0x2e); db(0x0a); db(0x22); db(0x0a);
- db(0x67); db(0x00); db(0x00); db(0x0c); db(0x52); db(0x85); db(0x67); db(0x1e);
- db(0x22); db(0x4a); db(0x24); db(0x52); db(0x60); db(0xf0); db(0x52); db(0x85);
- db(0x67); db(0x3c); db(0x24); db(0x47); db(0x70); db(0x18); db(0x72); db(0x01);
- db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x52); db(0x46); db(0x24); db(0x40);
- db(0x24); db(0x87); db(0x2e); db(0x0a); db(0x60); db(0xe8); db(0x20); db(0x12);
- db(0x67); db(0x24); db(0x20); db(0x40); db(0x20); db(0x10); db(0x67); db(0x1e);
- db(0x20); db(0x40); db(0x20); db(0x10); db(0x67); db(0x18); db(0x70); db(0x00);
- db(0x22); db(0x80); db(0x22); db(0x4a); db(0x24); db(0x51); db(0x70); db(0x18);
- db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x06); db(0x86); db(0x00); db(0x01);
- db(0x00); db(0x00); db(0x20); db(0x0a); db(0x66); db(0xec); db(0x26); db(0x87);
- db(0x2a); db(0x1f); db(0x4e); db(0x75); db(0x20); db(0x88); db(0x58); db(0x90);
- db(0x42); db(0xa8); db(0x00); db(0x04); db(0x21); db(0x48); db(0x00); db(0x08);
- db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x20); db(0x22); db(0x2c); db(0x78);
- db(0x00); db(0x04); db(0x70); db(0xff); db(0x4e); db(0xae); db(0xfe); db(0xb6);
- db(0x91); db(0xc8); db(0x24); db(0x00); db(0x6b); db(0x32); db(0x70); db(0x22);
- db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae);
- db(0xff); db(0x3a); db(0x91); db(0xc8); db(0x24); db(0x40); db(0x4a); db(0x80);
- db(0x67); db(0x1e); db(0x15); db(0x7c); db(0x00); db(0x04); db(0x00); db(0x08);
- db(0x15); db(0x42); db(0x00); db(0x0f); db(0x93); db(0xc9); db(0x4e); db(0xae);
- db(0xfe); db(0xda); db(0x25); db(0x40); db(0x00); db(0x10); db(0x41); db(0xea);
- db(0x00); db(0x14); db(0x61); db(0x00); db(0xff); db(0xb0); db(0x20); db(0x4a);
- db(0x20); db(0x08); db(0x4c); db(0xdf); db(0x44); db(0x04); db(0x4e); db(0x75);
- db(0x48); db(0xe7); db(0x20); db(0x22); db(0x2c); db(0x78); db(0x00); db(0x04);
- db(0x4a); db(0x80); db(0x67); db(0x24); db(0x24); db(0x40); db(0x24); db(0x01);
- db(0x66); db(0x02); db(0x74); db(0x30); db(0x20); db(0x02); db(0x22); db(0x3c);
- db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a);
- db(0x20); db(0x40); db(0x11); db(0x7c); db(0x00); db(0x0a); db(0x00); db(0x08);
- db(0x31); db(0x42); db(0x00); db(0x12); db(0x21); db(0x4a); db(0x00); db(0x0e);
- db(0x4a); db(0x80); db(0x4c); db(0xdf); db(0x44); db(0x04); db(0x4e); db(0x75);
- db(0x48); db(0xe7); db(0x30); db(0x22); db(0x24); db(0x48); db(0x24); db(0x00);
- db(0x26); db(0x01); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x61); db(0x00);
- db(0xff); db(0x6a); db(0x22); db(0x03); db(0x61); db(0x00); db(0xff); db(0xb2);
- db(0x67); db(0x18); db(0x20); db(0x4a); db(0x22); db(0x40); db(0x24); db(0x40);
- db(0x20); db(0x02); db(0x72); db(0x00); db(0x4e); db(0xae); db(0xfe); db(0x44);
- db(0x22); db(0x00); db(0x70); db(0x00); db(0x4a); db(0x81); db(0x66); db(0x02);
- db(0x20); db(0x0a); db(0x4a); db(0x80); db(0x4c); db(0xdf); db(0x44); db(0x0c);
- db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x38); db(0x32); db(0x2c); db(0x78);
- db(0x00); db(0x04); db(0x28); db(0x00); db(0x24); db(0x08); db(0x26); db(0x09);
- db(0x20); db(0x3c); db(0x00); db(0x00); db(0x08); db(0x5c); db(0x22); db(0x3c);
- db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a);
- db(0x4a); db(0x80); db(0x67); db(0x00); db(0x00); db(0x34); db(0x24); db(0x40);
- db(0x15); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x08); db(0x15); db(0x44);
- db(0x00); db(0x09); db(0x25); db(0x42); db(0x00); db(0x0a); db(0x47); db(0xea);
- db(0x00); db(0x5c); db(0x25); db(0x4b); db(0x00); db(0x3a); db(0x47); db(0xeb);
- db(0x08); db(0x00); db(0x25); db(0x4b); db(0x00); db(0x3e); db(0x25); db(0x4b);
- db(0x00); db(0x36); db(0x22); db(0x4a); db(0x24); db(0x43); db(0x97); db(0xcb);
- db(0x24); db(0x09); db(0x4e); db(0xae); db(0xfe); db(0xe6); db(0x20); db(0x02);
- db(0x4c); db(0xdf); db(0x4c); db(0x1c); db(0x4e); db(0x75); db(0x41); db(0xfa);
- db(0x09); db(0xc0); db(0x43); db(0xfa); db(0x01); db(0x30); db(0x70); db(0x13);
- db(0x61); db(0x00); db(0xff); db(0x98); db(0x4e); db(0x75); db(0x22); db(0x6d);
- db(0x02); db(0x0c); db(0x33); db(0x7c); db(0x00); db(0x0a); db(0x00); db(0x1c);
+ db(0x20); db(0x6b); db(0x00); db(0xb4); db(0x61); db(0x00); db(0x00); db(0x2c);
+ db(0x4e); db(0xae); db(0xff); db(0x76); db(0x4c); db(0xdf); db(0x44); db(0x80);
+ db(0x4e); db(0x75); db(0x22); db(0x48); db(0x20); db(0x6b); db(0x00); db(0xa0);
+ db(0x20); db(0x68); db(0x00); db(0x22); db(0x20); db(0x68); db(0x00); db(0x18);
+ db(0xd1); db(0xc8); db(0xd1); db(0xc8); db(0x22); db(0xa8); db(0x00); db(0x04);
+ db(0x20); db(0x09); db(0xe4); db(0x88); db(0x21); db(0x40); db(0x00); db(0x04);
+ db(0x4e); db(0x75); db(0x24); db(0x48); db(0x20); db(0x6b); db(0x00); db(0xa0);
+ db(0x20); db(0x68); db(0x00); db(0x22); db(0x20); db(0x68); db(0x00); db(0x18);
+ db(0xd1); db(0xc8); db(0xd1); db(0xc8); db(0x22); db(0x68); db(0x00); db(0x04);
+ db(0xd3); db(0xc9); db(0xd3); db(0xc9); db(0xb3); db(0xca); db(0x66); db(0x06);
+ db(0x21); db(0x52); db(0x00); db(0x04); db(0x60); db(0x18); db(0x20); db(0x09);
+ db(0x67); db(0x0e); db(0x20); db(0x11); db(0xd0); db(0x80); db(0xd0); db(0x80);
+ db(0xb5); db(0xc0); db(0x67); db(0x04); db(0x22); db(0x40); db(0x60); db(0xee);
+ db(0x20); db(0x09); db(0x67); db(0x02); db(0x22); db(0x92); db(0x4e); db(0x75);
+ db(0x48); db(0xe7); db(0x20); db(0x22); db(0x74); db(0x16); db(0x9f); db(0xc2);
+ db(0x24); db(0x4f); db(0x32); db(0x02); db(0x42); db(0x32); db(0x10); db(0xff);
+ db(0x53); db(0x41); db(0x66); db(0xf8); db(0x2c); db(0x78); db(0x00); db(0x04);
+ db(0x72); db(0x0f); db(0x4a); db(0x80); db(0x67); db(0x02); db(0x72); db(0x10);
+ db(0x15); db(0x41); db(0x00); db(0x04); db(0x35); db(0x7c); db(0x08); db(0x00);
+ db(0x00); db(0x08); db(0x22); db(0x6b); db(0x00); db(0xa4); db(0x33); db(0x7c);
+ db(0x00); db(0x0b); db(0x00); db(0x1c); db(0x23); db(0x7c); db(0x00); db(0x00);
+ db(0x00); db(0x16); db(0x00); db(0x24); db(0x23); db(0x4a); db(0x00); db(0x28);
+ db(0x13); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x1e); db(0x22); db(0x6b);
+ db(0x00); db(0xa8); db(0x33); db(0x7c); db(0x00); db(0x0a); db(0x00); db(0x1c);
  db(0x13); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x1e); db(0x4e); db(0xae);
- db(0xfe); db(0x38); db(0x22); db(0x6d); db(0x02); db(0x0c); db(0x25); db(0x69);
+ db(0xfe); db(0x38); db(0x22); db(0x6b); db(0x00); db(0xa8); db(0x25); db(0x69);
  db(0x00); db(0x20); db(0x00); db(0x0e); db(0x25); db(0x69); db(0x00); db(0x24);
- db(0x00); db(0x12); db(0x22); db(0x6d); db(0x02); db(0x08); db(0x13); db(0x7c);
- db(0x00); db(0x01); db(0x00); db(0x1e); db(0x4e); db(0xae); db(0xfe); db(0x38);
- db(0x4e); db(0x75); db(0x42); db(0xaa); db(0x00); db(0x0e); db(0x42); db(0xaa);
- db(0x00); db(0x12); db(0x22); db(0x6d); db(0x02); db(0x08); db(0x13); db(0x7c);
- db(0x00); db(0x01); db(0x00); db(0x1e); db(0x4e); db(0xae); db(0xfe); db(0x38);
- db(0x4e); db(0x75); db(0x48); db(0xe7); db(0xf8); db(0xfe); db(0x2a); db(0x48);
- db(0x95); db(0xca); db(0x97); db(0xcb); db(0x99); db(0xcc); db(0x78); db(0x00);
- db(0x2c); db(0x6d); db(0x00); db(0x18); db(0x20); db(0x6d); db(0x00); db(0x14);
- db(0x20); db(0x28); db(0x00); db(0x3c); db(0x67); db(0x5c); db(0x20); db(0x40);
- db(0x41); db(0xe8); db(0x00); db(0x2c); db(0x28); db(0x48); db(0x4e); db(0xae);
- db(0xfc); db(0xe8); db(0x72); db(0xff); db(0x74); db(0xff); db(0xb2); db(0x80);
- db(0x67); db(0x48); db(0x26); db(0x00); db(0x2c); db(0x6d); db(0x00); db(0x14);
- db(0x41); db(0xed); db(0x00); db(0xc0); db(0x70); db(0x66); db(0x4e); db(0xae);
- db(0xff); db(0x7c); db(0x41); db(0xed); db(0x00); db(0xc0); db(0x38); db(0x28);
- db(0x00); db(0x64); db(0x2c); db(0x6d); db(0x00); db(0x18); db(0x91); db(0xc8);
- db(0x43); db(0xed); db(0x00); db(0x38); db(0x70); db(0x00); db(0x30); db(0x3c);
- db(0x00); db(0x58); db(0x22); db(0x3c); db(0x80); db(0x00); db(0x10); db(0x00);
- db(0x24); db(0x03); db(0x4e); db(0xae); db(0xfd); db(0x0c); db(0x72); db(0xff);
- db(0x74); db(0xff); db(0x4a); db(0x80); db(0x6b); db(0x0c); db(0x45); db(0xed);
- db(0x00); db(0x38); db(0x22); db(0x2a); db(0x00); db(0x32); db(0x24); db(0x2a);
- db(0x00); db(0x36); db(0x20); db(0x2c); db(0x00); db(0x1c); db(0xb8); db(0x6d);
- db(0x00); db(0x2c); db(0x66); db(0x12); db(0xb0); db(0xad); db(0x00); db(0x28);
- db(0x66); db(0x0c); db(0xb2); db(0xad); db(0x00); db(0x20); db(0x66); db(0x06);
- db(0xb4); db(0xad); db(0x00); db(0x24); db(0x67); db(0x40); db(0x2b); db(0x40);
- db(0x00); db(0x28); db(0x2b); db(0x41); db(0x00); db(0x20); db(0x2b); db(0x42);
- db(0x00); db(0x24); db(0x3b); db(0x44); db(0x00); db(0x2c); db(0x91); db(0xc8);
- db(0x43); db(0xed); db(0x00); db(0x90); db(0x70); db(0x00); db(0x30); db(0x3c);
- db(0x00); db(0x58); db(0x22); db(0x3c); db(0x80); db(0x00); db(0x00); db(0x00);
- db(0x24); db(0x03); db(0x4e); db(0xae); db(0xfd); db(0x0c); db(0x4a); db(0x80);
- db(0x6b); db(0x04); db(0x47); db(0xed); db(0x00); db(0x90); db(0x34); db(0x2d);
- db(0x00); db(0x2c); db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x01);
- db(0x61); db(0x00); db(0x07); db(0xf8); db(0x4e); db(0x90); db(0x4c); db(0xdf);
- db(0x7f); db(0x1f); db(0x4e); db(0x75); db(0x2c); db(0x78); db(0x00); db(0x04);
- db(0x3e); db(0x2e); db(0x00); db(0x14); db(0x70); db(0xff); db(0x4e); db(0xae);
- db(0xfe); db(0xb6); db(0x7c); db(0x00); db(0x01); db(0xc6); db(0x93); db(0xc9);
- db(0x4e); db(0xae); db(0xfe); db(0xda); db(0x28); db(0x40); db(0x70); db(0x14);
- db(0x22); db(0x4c); db(0x4e); db(0xae); db(0xfe); db(0xd4); db(0x70); db(0x00);
- db(0x30); db(0x3c); db(0x02); db(0x3c); db(0x22); db(0x3c); db(0x00); db(0x01);
- db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x2a); db(0x40);
- db(0x47); db(0xed); db(0x00); db(0x16); db(0x27); db(0x4e); db(0x00); db(0x10);
- db(0x27); db(0x4c); db(0x00); db(0x08); db(0x27); db(0x46); db(0x00); db(0x0c);
- db(0x70); db(0xff); db(0x37); db(0x40); db(0x00); db(0x00); db(0x30); db(0x3c);
- db(0xff); db(0x38); db(0x72); db(0x05); db(0x61); db(0x00); db(0x07); db(0x9c);
- db(0x20); db(0x0d); db(0x06); db(0x80); db(0x00); db(0x00); db(0x02); db(0x10);
- db(0x4e); db(0x90); db(0x43); db(0xed); db(0x00); db(0x00); db(0x13); db(0x7c);
- db(0x00); db(0x02); db(0x00); db(0x08); db(0x13); db(0x7c); db(0x00); db(0x05);
- db(0x00); db(0x09); db(0x41); db(0xfa); db(0x08); db(0x1c); db(0x23); db(0x48);
- db(0x00); db(0x0a); db(0x41); db(0xfa); db(0x02); db(0xf4); db(0x23); db(0x48);
- db(0x00); db(0x12); db(0x23); db(0x4d); db(0x00); db(0x0e); db(0x70); db(0x05);
- db(0x4e); db(0xae); db(0xff); db(0x58); db(0x20); db(0x06); db(0x4e); db(0xae);
- db(0xfe); db(0xc2); db(0x70); db(0x00); db(0x53); db(0xab); db(0x00); db(0x1c);
- db(0x6a); db(0x06); db(0x70); db(0x0a); db(0x27); db(0x40); db(0x00); db(0x1c);
- db(0x4a); db(0xab); db(0x00); db(0x14); db(0x66); db(0x16); db(0x4a); db(0xab);
- db(0x00); db(0x1c); db(0x66); db(0xe0); db(0x43); db(0xfa); db(0x08); db(0x49);
+ db(0x00); db(0x12); db(0x22); db(0x6b); db(0x00); db(0xa4); db(0x4e); db(0xae);
+ db(0xfe); db(0x38); db(0xdf); db(0xc2); db(0x4c); db(0xdf); db(0x44); db(0x04);
+ db(0x4e); db(0x75); db(0x4a); db(0x00); db(0x67); db(0x26); db(0x4a); db(0x2b);
+ db(0x00); db(0x4c); db(0x66); db(0x36); db(0x70); db(0x00); db(0x4a); db(0x33);
+ db(0x00); db(0x4d); db(0x67); db(0x04); db(0x52); db(0x00); db(0x60); db(0xf6);
+ db(0x17); db(0x40); db(0x00); db(0x4c); db(0x67); db(0x24); db(0x20); db(0x01);
+ db(0x61); db(0x00); db(0xfd); db(0xf2); db(0x70); db(0x01); db(0x61); db(0x00);
+ db(0xff); db(0x60); db(0x60); db(0x16); db(0x4a); db(0x2b); db(0x00); db(0x4c);
+ db(0x67); db(0x10); db(0x42); db(0x2b); db(0x00); db(0x4c); db(0x20); db(0x01);
+ db(0x61); db(0x00); db(0xfe); db(0x68); db(0x70); db(0x00); db(0x61); db(0x00);
+ db(0xff); db(0x48); db(0x4e); db(0x75); db(0x4a); db(0xac); db(0x00); db(0x14);
+ db(0x67); db(0x0a); db(0x70); db(0x00); db(0x72); db(0x01); db(0x61); db(0x00);
+ db(0xff); db(0xb2); db(0x4e); db(0x75); db(0x70); db(0x01); db(0x72); db(0x03);
+ db(0x61); db(0x00); db(0xff); db(0xa8); db(0x4e); db(0x75); db(0x10); db(0x2b);
+ db(0x00); db(0xac); db(0x6b); db(0x0a); db(0x70); db(0x01); db(0x72); db(0x03);
+ db(0x61); db(0x00); db(0xff); db(0x98); db(0x4e); db(0x75); db(0x72); db(0x01);
+ db(0x0c); db(0x00); db(0x00); db(0xfe); db(0x66); db(0x02); db(0x72); db(0x03);
+ db(0x70); db(0x00); db(0x61); db(0x00); db(0xff); db(0x86); db(0x4e); db(0x75);
+ db(0x20); db(0x6c); db(0x00); db(0x24); db(0x4a); db(0x90); db(0x67); db(0x0c);
+ db(0x4a); db(0xa8); db(0x00); db(0x08); db(0x66); db(0x0a); db(0x4a); db(0xa8);
+ db(0x00); db(0x0c); db(0x66); db(0x04); db(0x70); db(0x01); db(0x4e); db(0x75);
+ db(0x48); db(0xe7); db(0x3f); db(0x3e); db(0x2a); db(0x48); db(0x24); db(0x6c);
+ db(0x00); db(0x18); db(0x2e); db(0x15); db(0x7a); db(0x00); db(0x4a); db(0x87);
+ db(0x67); db(0x70); db(0x20); db(0x0a); db(0x67); db(0x6c); db(0x7c); db(0x00);
+ db(0x22); db(0x2d); db(0x00); db(0x08); db(0x67); db(0x12); db(0x24); db(0x2a);
+ db(0x00); db(0x04); db(0x2c); db(0x6b); db(0x00); db(0xa0); db(0x4e); db(0xae);
+ db(0xfc); db(0x34); db(0x4a); db(0x80); db(0x66); db(0x02); db(0x50); db(0xc6);
+ db(0x22); db(0x2d); db(0x00); db(0x0c); db(0x67); db(0x1c); db(0x20); db(0x41);
+ db(0x22); db(0x4a); db(0x2f); db(0x0a); db(0x45); db(0xec); db(0x00); db(0x20);
+ db(0x48); db(0x7a); db(0x00); db(0x08); db(0x2f); db(0x28); db(0x00); db(0x08);
+ db(0x4e); db(0x75); db(0x24); db(0x5f); db(0x4a); db(0x80); db(0x66); db(0x02);
+ db(0x50); db(0xc6); db(0x4a); db(0x06); db(0x67); db(0x24); db(0x20); db(0x2a);
+ db(0x00); db(0x04); db(0x90); db(0x8a); db(0x4a); db(0x92); db(0x66); db(0x0a);
+ db(0x20); db(0x05); db(0x67); db(0x10); db(0x20); db(0x40); db(0x42); db(0x90);
+ db(0x60); db(0x0a); db(0x20); db(0x52); db(0x22); db(0x4a); db(0x22); db(0xd8);
+ db(0x59); db(0x80); db(0x6a); db(0xfa); db(0x53); db(0x95); db(0x53); db(0x87);
+ db(0x60); db(0x94); db(0x2a); db(0x0a); db(0x24); db(0x52); db(0x53); db(0x87);
+ db(0x60); db(0x8c); db(0x4c); db(0xdf); db(0x7c); db(0xfc); db(0x20); db(0x6c);
+ db(0x00); db(0x24); db(0x4a); db(0x90); db(0x4e); db(0x75); db(0x61); db(0x00);
+ db(0xfc); db(0x7c); db(0x21); db(0x40); db(0x01); db(0x9c); db(0x2f); db(0x08);
+ db(0x30); db(0x3c); db(0xff); db(0xec); db(0x61); db(0x00); db(0x0f); db(0x18);
+ db(0x2a); db(0x50); db(0x30); db(0x3c); db(0xff); db(0x28); db(0x61); db(0x00);
+ db(0x0f); db(0x0e); db(0x22); db(0x48); db(0x20); db(0x5f); db(0x42); db(0xa8);
+ db(0x01); db(0x90); db(0x42); db(0xa8); db(0x01); db(0x94); db(0x4e); db(0x91);
+ db(0x26); db(0x00); db(0x0c); db(0x43); db(0xff); db(0xfe); db(0x67); db(0x00);
+ db(0xf9); db(0x14); db(0x20); db(0x28); db(0x01); db(0x90); db(0x67); db(0x14);
+ db(0x6b); db(0x12); db(0x2f); db(0x08); db(0x72); db(0x01); db(0x2c); db(0x78);
+ db(0x00); db(0x04); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x20); db(0x5f);
+ db(0x21); db(0x40); db(0x01); db(0x94); db(0x4a); db(0x83); db(0x6a); db(0x0e);
+ db(0x22); db(0x48); db(0x30); db(0x3c); db(0xff); db(0x20); db(0x61); db(0x00);
+ db(0x0e); db(0xce); db(0x4e); db(0x90); db(0x60); db(0x26); db(0x2c); db(0x4c);
+ db(0x2f); db(0x08); db(0x4e); db(0xae); db(0xff); db(0x70); db(0x20); db(0x5f);
+ db(0x22); db(0x48); db(0x26); db(0x40); db(0x30); db(0x3c); db(0xff); db(0x20);
+ db(0x61); db(0x00); db(0x0e); db(0xb4); db(0x4e); db(0x90); db(0x70); db(0x00);
+ db(0x27); db(0x40); db(0x00); db(0x08); db(0x27); db(0x40); db(0x00); db(0x10);
+ db(0x27); db(0x40); db(0x00); db(0x20); db(0x20); db(0x69); db(0x01); db(0x94);
+ db(0x4a); db(0xa9); db(0x01); db(0x90); db(0x67); db(0x2c); db(0x20); db(0x08);
+ db(0x67); db(0x32); db(0x61); db(0x00); db(0xfa); db(0xec); db(0x48); db(0xe7);
+ db(0x80); db(0xc0); db(0x20); db(0x29); db(0x01); db(0x90); db(0x22); db(0x69);
+ db(0x01); db(0x94); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x4e); db(0xae);
+ db(0xff); db(0x2e); db(0x4c); db(0xdf); db(0x03); db(0x01); db(0x42); db(0xa9);
+ db(0x01); db(0x90); db(0x23); db(0x48); db(0x01); db(0x94); db(0x4a); db(0x80);
+ db(0x67); db(0x0a); db(0x4a); db(0xa9); db(0x01); db(0x98); db(0x67); db(0x04);
+ db(0x61); db(0x00); db(0xfa); db(0x68); db(0x4a); db(0x83); db(0x6b); db(0x00);
+ db(0xf8); db(0x7c); db(0x30); db(0x3c); db(0xff); db(0x18); db(0x61); db(0x00);
+ db(0x0e); db(0x56); db(0x4e); db(0x90); db(0x20); db(0x03); db(0x16); db(0x29);
+ db(0x00); db(0x4f); db(0x4a); db(0x80); db(0x66); db(0x1a); db(0x27); db(0x7c);
+ db(0x00); db(0x00); db(0x17); db(0x70); db(0x00); db(0x14); db(0x41); db(0xfa);
+ db(0xf6); db(0x64); db(0x20); db(0x08); db(0xe4); db(0x88); db(0x27); db(0x40);
+ db(0x00); db(0x20); db(0x70); db(0xff); db(0x27); db(0x40); db(0x00); db(0x24);
+ db(0x08); db(0x07); db(0x00); db(0x00); db(0x67); db(0x40); db(0x0c); db(0x03);
+ db(0x00); db(0x80); db(0x67); db(0x3a); db(0x2c); db(0x78); db(0x00); db(0x04);
+ db(0x70); db(0x14); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01);
+ db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x22); db(0x40); db(0x30); db(0x3c);
+ db(0x10); db(0x00); db(0x80); db(0x03); db(0x33); db(0x40); db(0x00); db(0x08);
+ db(0x23); db(0x6d); db(0x01); db(0x04); db(0x00); db(0x0a); db(0x23); db(0x4b);
+ db(0x00); db(0x10); db(0x41); db(0xec); db(0x00); db(0x4a); db(0x4e); db(0xae);
+ db(0xff); db(0x7c); db(0x4e); db(0xae); db(0xfe); db(0xf2); db(0x4e); db(0xae);
+ db(0xff); db(0x76); db(0x70); db(0x00); db(0x4e); db(0x75); db(0x24); db(0x49);
+ db(0x20); db(0x4b); db(0x72); db(0x00); db(0x22); db(0x41); db(0x08); db(0x07);
+ db(0x00); db(0x01); db(0x67); db(0x08); db(0x08); db(0x07); db(0x00); db(0x02);
+ db(0x67); db(0x02); db(0x72); db(0x01); db(0x70); db(0x80); db(0x2c); db(0x4c);
+ db(0x4e); db(0xae); db(0xff); db(0x6a); db(0x08); db(0x07); db(0x00); db(0x01);
+ db(0x67); db(0x5c); db(0x08); db(0x07); db(0x00); db(0x02); db(0x66); db(0x56);
+ db(0x20); db(0x52); db(0x74); db(0x02); db(0x52); db(0x82); db(0x4a); db(0x30);
+ db(0x28); db(0xfd); db(0x66); db(0xf8); db(0x2c); db(0x78); db(0x00); db(0x04);
+ db(0x20); db(0x02); db(0x72); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a);
+ db(0x4a); db(0x80); db(0x67); db(0x3a); db(0x20); db(0x52); db(0x24); db(0x40);
+ db(0x22); db(0x4a); db(0x12); db(0xd8); db(0x66); db(0xfc); db(0x13); db(0x7c);
+ db(0x00); db(0x3a); db(0xff); db(0xff); db(0x42); db(0x11); db(0x2c); db(0x78);
+ db(0x00); db(0x04); db(0x43); db(0xfa); db(0x0e); db(0x83); db(0x70); db(0x00);
+ db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x2c); db(0x40); db(0x22); db(0x0a);
+ db(0x4e); db(0xae); db(0xff); db(0x52); db(0x22); db(0x4e); db(0x2c); db(0x78);
+ db(0x00); db(0x04); db(0x4e); db(0xae); db(0xfe); db(0x62); db(0x22); db(0x4a);
+ db(0x20); db(0x02); db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x70); db(0x00);
+ db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x3f); db(0x3e); db(0x2c); db(0x01);
+ db(0x7e); db(0x06); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x43); db(0xfa);
+ db(0x0e); db(0x7e); db(0x70); db(0x24); db(0x4e); db(0xae); db(0xfd); db(0xd8);
+ db(0x4a); db(0x80); db(0x66); db(0x0e); db(0x08); db(0x87); db(0x00); db(0x02);
+ db(0x43); db(0xfa); db(0x0e); db(0x6c); db(0x70); db(0x00); db(0x4e); db(0xae);
+ db(0xfd); db(0xd8); db(0x28); db(0x40); db(0x20); db(0x3c); db(0x00); db(0x00);
+ db(0x02); db(0x30); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01);
+ db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x20); db(0x40); db(0x4a); db(0x80);
+ db(0x67); db(0x2c); db(0x21); db(0x4c); db(0x01); db(0xa0); db(0x48); db(0xe7);
+ db(0x00); db(0x8a); db(0x61); db(0x00); db(0xfd); db(0xf2); db(0x4c); db(0xdf);
+ db(0x51); db(0x00); db(0x0c); db(0x80); db(0xff); db(0xff); db(0xff); db(0xfe);
+ db(0x67); db(0x08); db(0x48); db(0x46); db(0x52); db(0x46); db(0x48); db(0x46);
+ db(0x60); db(0xe4); db(0x22); db(0x48); db(0x20); db(0x3c); db(0x00); db(0x00);
+ db(0x02); db(0x30); db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x22); db(0x4c);
+ db(0x4e); db(0xae); db(0xfe); db(0x62); db(0x4c); db(0xdf); db(0x7c); db(0xfc);
+ db(0x4e); db(0x75); db(0x30); db(0x3c); db(0xff); db(0x58); db(0x61); db(0x00);
+ db(0x0c); db(0xe6); db(0x70); db(0x03); db(0x4e); db(0x90); db(0x22); db(0x6b);
+ db(0x00); db(0xa8); db(0x23); db(0x40); db(0x00); db(0x20); db(0x67); db(0x16);
+ db(0x70); db(0x00); db(0x23); db(0x40); db(0x00); db(0x24); db(0x33); db(0x7c);
+ db(0x00); db(0x0b); db(0x00); db(0x1c); db(0x13); db(0x7c); db(0x00); db(0x01);
+ db(0x00); db(0x1e); db(0x4e); db(0xae); db(0xfe); db(0x38); db(0x4e); db(0x75);
+ db(0x2c); db(0x78); db(0x00); db(0x04); db(0x93); db(0xc9); db(0x4e); db(0xae);
+ db(0xfe); db(0xda); db(0x20); db(0x40); db(0x4b); db(0xe8); db(0x00); db(0x5c);
+ db(0x43); db(0xfa); db(0x0d); db(0xa5); db(0x70); db(0x00); db(0x4e); db(0xae);
+ db(0xfd); db(0xd8); db(0x24); db(0x40); db(0x20); db(0x3c); db(0x00); db(0x00);
+ db(0x00); db(0xb9); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01);
+ db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x26); db(0x40); db(0x7c); db(0x00);
+ db(0x26); db(0x86); db(0x27); db(0x46); db(0x00); db(0x04); db(0x27); db(0x46);
+ db(0x00); db(0x08); db(0x27); db(0x4a); db(0x00); db(0xa0); db(0x50); db(0xeb);
+ db(0x00); db(0x9e); db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfe); db(0xda);
+ db(0x27); db(0x40); db(0x00); db(0xb0); db(0x41); db(0xfa); db(0x0c); db(0x7e);
+ db(0x70); db(0x00); db(0x72); db(0x00); db(0x61); db(0x00); db(0x02); db(0xae);
+ db(0x27); db(0x40); db(0x00); db(0xa4); db(0x41); db(0xfa); db(0x0c); db(0x7b);
+ db(0x70); db(0x00); db(0x72); db(0x00); db(0x61); db(0x00); db(0x02); db(0x9e);
+ db(0x27); db(0x40); db(0x00); db(0xa8); db(0x7a); db(0x00); db(0x20); db(0x4d);
+ db(0x4e); db(0xae); db(0xfe); db(0x80); db(0x20); db(0x4d); db(0x4e); db(0xae);
+ db(0xfe); db(0x8c); db(0x28); db(0x40); db(0x26); db(0x2c); db(0x00); db(0x0a);
+ db(0x30); db(0x3c); db(0xff); db(0x40); db(0x61); db(0x00); db(0x0c); db(0x38);
+ db(0x70); db(0x00); db(0x4e); db(0x90); db(0x24); db(0x00); db(0x70); db(0x01);
+ db(0x61); db(0x00); db(0xf9); db(0xf2); db(0x08); db(0x02); db(0x00); db(0x01);
+ db(0x67); db(0x06); db(0x70); db(0x01); db(0x61); db(0x00); db(0xfb); db(0x5a);
+ db(0x60); db(0x00); db(0x01); db(0x2e); db(0x20); db(0x4d); db(0x4e); db(0xae);
+ db(0xfe); db(0x8c); db(0x28); db(0x40); db(0x4a); db(0x80); db(0x66); db(0x10);
+ db(0x70); db(0x00); db(0x12); db(0x2d); db(0x00); db(0x0f); db(0x03); db(0xc0);
+ db(0x08); db(0xc0); db(0x00); db(0x0d); db(0x4e); db(0xae); db(0xfe); db(0xc2);
+ db(0x4a); db(0x2b); db(0x00); db(0xad); db(0x67); db(0x08); db(0x61); db(0x00);
+ db(0xff); db(0x0a); db(0x42); db(0x2b); db(0x00); db(0xad); db(0x4a); db(0x2b);
+ db(0x00); db(0xac); db(0x67); db(0x24); db(0x30); db(0x3c); db(0xff); db(0x58);
+ db(0x61); db(0x00); db(0x0b); db(0xe4); db(0x70); db(0x01); db(0x4e); db(0x90);
+ db(0x4a); db(0x80); db(0x67); db(0x04); db(0x61); db(0x00); db(0xfb); db(0xe8);
+ db(0x42); db(0x2b); db(0x00); db(0xac); db(0x30); db(0x3c); db(0xff); db(0x58);
+ db(0x61); db(0x00); db(0x0b); db(0xcc); db(0x70); db(0x02); db(0x4e); db(0x90);
+ db(0x20); db(0x0c); db(0x67); db(0x56); db(0x0c); db(0x6c); db(0x00); db(0x26);
+ db(0x00); db(0x12); db(0x66); db(0x4e); db(0x0c); db(0xac); db(0x40); db(0x00);
+ db(0x00); db(0x00); db(0x00); db(0x14); db(0x66); db(0x44); db(0x0c); db(0x6c);
+ db(0x12); db(0x34); db(0x00); db(0x18); db(0x66); db(0x3c); db(0x20); db(0x6c);
+ db(0x00); db(0x1a); db(0x20); db(0x28); db(0x00); db(0x0c); db(0x02); db(0x80);
+ db(0x80); db(0x00); db(0x00); db(0x08); db(0x0c); db(0x80); db(0x80); db(0x00);
+ db(0x00); db(0x08); db(0x66); db(0x1a); db(0x02); db(0xa8); db(0x7f); db(0xff);
+ db(0xff); db(0xff); db(0x00); db(0x0c); db(0x20); db(0x68); db(0x00); db(0x10);
+ db(0x22); db(0x4c); db(0x12); db(0xbc); db(0x00); db(0x08); db(0x4e); db(0xae);
+ db(0xfe); db(0x92); db(0x60); db(0x00); db(0xff); db(0x60); db(0x22); db(0x4c);
+ db(0x70); db(0x26); db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x60); db(0x00);
+ db(0xff); db(0x54); db(0x74); db(0xfe); db(0x20); db(0x0c); db(0x67); db(0x14);
+ db(0x26); db(0x2c); db(0x00); db(0x0a); db(0x66); db(0x42); db(0x74); db(0xff);
+ db(0x30); db(0x3c); db(0xff); db(0x50); db(0x61); db(0x00); db(0x0b); db(0x58);
+ db(0x70); db(0x01); db(0x4e); db(0x90); db(0x45); db(0xeb); db(0x00); db(0x04);
+ db(0x20); db(0x52); db(0x20); db(0x08); db(0x67); db(0x00); db(0xff); db(0x2e);
+ db(0x22); db(0x50); db(0x20); db(0x40); db(0x20); db(0x28); db(0x00); db(0x04);
+ db(0xb4); db(0x80); db(0x66); db(0x16); db(0x48); db(0xe7); db(0x00); db(0xc0);
+ db(0x28); db(0x68); db(0x00); db(0x0a); db(0x61); db(0x4a); db(0x53); db(0x85);
+ db(0x4c); db(0xdf); db(0x03); db(0x00); db(0x24); db(0x89); db(0x20); db(0x49);
+ db(0x60); db(0xd8); db(0x24); db(0x48); db(0x20); db(0x49); db(0x60); db(0xd2);
+ db(0x0c); db(0x85); db(0x00); db(0x00); db(0x00); db(0x14); db(0x65); db(0x00);
+ db(0x00); db(0x0a); db(0x70); db(0x01); db(0x29); db(0x40); db(0x00); db(0x04);
+ db(0x60); db(0x12); db(0x61); db(0x5e); db(0x30); db(0x3c); db(0xff); db(0x30);
+ db(0x61); db(0x00); db(0x0b); db(0x04); db(0x4e); db(0x90); db(0x4a); db(0x80);
+ db(0x67); db(0x0e); db(0x52); db(0x85); db(0x28); db(0xab); db(0x00); db(0x04);
+ db(0x27); db(0x4c); db(0x00); db(0x04); db(0x60); db(0x00); db(0xfe); db(0xd6);
+ db(0x28); db(0x43); db(0x61); db(0x04); db(0x60); db(0x00); db(0xfe); db(0xce);
+ db(0x0c); db(0xac); db(0x00); db(0x00); db(0x00); db(0x1f); db(0x00); db(0x08);
+ db(0x66); db(0x04); db(0x61); db(0x00); db(0xfa); db(0xd0); db(0x0c); db(0xac);
+ db(0x00); db(0x00); db(0x04); db(0x09); db(0x00); db(0x08); db(0x66); db(0x14);
+ db(0x61); db(0x00); db(0xfa); db(0xfe); db(0x66); db(0x0e); db(0x30); db(0x3c);
+ db(0xff); db(0x58); db(0x61); db(0x00); db(0x0a); db(0xc2); db(0x70); db(0x00);
+ db(0x4e); db(0x90); db(0x60); db(0xec); db(0x22); db(0x54); db(0x20); db(0x6c);
+ db(0x00); db(0x04); db(0x29); db(0x4d); db(0x00); db(0x04); db(0x4e); db(0xee);
+ db(0xfe); db(0x92); db(0x2f); db(0x05); db(0x7a); db(0xfc); db(0x24); db(0x53);
+ db(0x2e); db(0x0a); db(0x22); db(0x0a); db(0x67); db(0x00); db(0x00); db(0x0c);
+ db(0x52); db(0x85); db(0x67); db(0x1e); db(0x22); db(0x4a); db(0x24); db(0x52);
+ db(0x60); db(0xf0); db(0x52); db(0x85); db(0x67); db(0x3c); db(0x24); db(0x47);
+ db(0x70); db(0x18); db(0x72); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a);
+ db(0x52); db(0x46); db(0x24); db(0x40); db(0x24); db(0x87); db(0x2e); db(0x0a);
+ db(0x60); db(0xe8); db(0x20); db(0x12); db(0x67); db(0x24); db(0x20); db(0x40);
+ db(0x20); db(0x10); db(0x67); db(0x1e); db(0x20); db(0x40); db(0x20); db(0x10);
+ db(0x67); db(0x18); db(0x70); db(0x00); db(0x22); db(0x80); db(0x22); db(0x4a);
+ db(0x24); db(0x51); db(0x70); db(0x18); db(0x4e); db(0xae); db(0xff); db(0x2e);
+ db(0x06); db(0x86); db(0x00); db(0x01); db(0x00); db(0x00); db(0x20); db(0x0a);
+ db(0x66); db(0xec); db(0x26); db(0x87); db(0x2a); db(0x1f); db(0x4e); db(0x75);
+ db(0x20); db(0x88); db(0x58); db(0x90); db(0x42); db(0xa8); db(0x00); db(0x04);
+ db(0x21); db(0x48); db(0x00); db(0x08); db(0x4e); db(0x75); db(0x48); db(0xe7);
+ db(0x20); db(0x22); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x70); db(0xff);
+ db(0x4e); db(0xae); db(0xfe); db(0xb6); db(0x91); db(0xc8); db(0x24); db(0x00);
+ db(0x6b); db(0x32); db(0x70); db(0x22); db(0x22); db(0x3c); db(0x00); db(0x01);
+ db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x91); db(0xc8);
+ db(0x24); db(0x40); db(0x4a); db(0x80); db(0x67); db(0x1e); db(0x15); db(0x7c);
+ db(0x00); db(0x04); db(0x00); db(0x08); db(0x15); db(0x42); db(0x00); db(0x0f);
+ db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfe); db(0xda); db(0x25); db(0x40);
+ db(0x00); db(0x10); db(0x41); db(0xea); db(0x00); db(0x14); db(0x61); db(0x00);
+ db(0xff); db(0xb0); db(0x20); db(0x4a); db(0x20); db(0x08); db(0x4c); db(0xdf);
+ db(0x44); db(0x04); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x20); db(0x22);
+ db(0x2c); db(0x78); db(0x00); db(0x04); db(0x4a); db(0x80); db(0x67); db(0x24);
+ db(0x24); db(0x40); db(0x24); db(0x01); db(0x66); db(0x02); db(0x74); db(0x30);
+ db(0x20); db(0x02); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01);
+ db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x20); db(0x40); db(0x11); db(0x7c);
+ db(0x00); db(0x0a); db(0x00); db(0x08); db(0x31); db(0x42); db(0x00); db(0x12);
+ db(0x21); db(0x4a); db(0x00); db(0x0e); db(0x4a); db(0x80); db(0x4c); db(0xdf);
+ db(0x44); db(0x04); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x30); db(0x22);
+ db(0x24); db(0x48); db(0x24); db(0x00); db(0x26); db(0x01); db(0x2c); db(0x78);
+ db(0x00); db(0x04); db(0x61); db(0x00); db(0xff); db(0x6a); db(0x22); db(0x03);
+ db(0x61); db(0x00); db(0xff); db(0xb2); db(0x67); db(0x18); db(0x20); db(0x4a);
+ db(0x22); db(0x40); db(0x24); db(0x40); db(0x20); db(0x02); db(0x72); db(0x00);
+ db(0x4e); db(0xae); db(0xfe); db(0x44); db(0x22); db(0x00); db(0x70); db(0x00);
+ db(0x4a); db(0x81); db(0x66); db(0x02); db(0x20); db(0x0a); db(0x4a); db(0x80);
+ db(0x4c); db(0xdf); db(0x44); db(0x0c); db(0x4e); db(0x75); db(0x48); db(0xe7);
+ db(0x38); db(0x32); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x28); db(0x00);
+ db(0x24); db(0x08); db(0x26); db(0x09); db(0x20); db(0x3c); db(0x00); db(0x00);
+ db(0x08); db(0x5c); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01);
+ db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x4a); db(0x80); db(0x67); db(0x00);
+ db(0x00); db(0x34); db(0x24); db(0x40); db(0x15); db(0x7c); db(0x00); db(0x01);
+ db(0x00); db(0x08); db(0x15); db(0x44); db(0x00); db(0x09); db(0x25); db(0x42);
+ db(0x00); db(0x0a); db(0x47); db(0xea); db(0x00); db(0x5c); db(0x25); db(0x4b);
+ db(0x00); db(0x3a); db(0x47); db(0xeb); db(0x08); db(0x00); db(0x25); db(0x4b);
+ db(0x00); db(0x3e); db(0x25); db(0x4b); db(0x00); db(0x36); db(0x22); db(0x4a);
+ db(0x24); db(0x43); db(0x97); db(0xcb); db(0x24); db(0x09); db(0x4e); db(0xae);
+ db(0xfe); db(0xe6); db(0x20); db(0x02); db(0x4c); db(0xdf); db(0x4c); db(0x1c);
+ db(0x4e); db(0x75); db(0x41); db(0xfa); db(0x09); db(0xc0); db(0x43); db(0xfa);
+ db(0x01); db(0x30); db(0x70); db(0x13); db(0x61); db(0x00); db(0xff); db(0x98);
+ db(0x4e); db(0x75); db(0x22); db(0x6d); db(0x02); db(0x0c); db(0x33); db(0x7c);
+ db(0x00); db(0x0a); db(0x00); db(0x1c); db(0x13); db(0x7c); db(0x00); db(0x01);
+ db(0x00); db(0x1e); db(0x4e); db(0xae); db(0xfe); db(0x38); db(0x22); db(0x6d);
+ db(0x02); db(0x0c); db(0x25); db(0x69); db(0x00); db(0x20); db(0x00); db(0x0e);
+ db(0x25); db(0x69); db(0x00); db(0x24); db(0x00); db(0x12); db(0x22); db(0x6d);
+ db(0x02); db(0x08); db(0x13); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x1e);
+ db(0x4e); db(0xae); db(0xfe); db(0x38); db(0x4e); db(0x75); db(0x42); db(0xaa);
+ db(0x00); db(0x0e); db(0x42); db(0xaa); db(0x00); db(0x12); db(0x22); db(0x6d);
+ db(0x02); db(0x08); db(0x13); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x1e);
+ db(0x4e); db(0xae); db(0xfe); db(0x38); db(0x4e); db(0x75); db(0x48); db(0xe7);
+ db(0xf8); db(0xfe); db(0x2a); db(0x48); db(0x95); db(0xca); db(0x97); db(0xcb);
+ db(0x99); db(0xcc); db(0x78); db(0x00); db(0x2c); db(0x6d); db(0x00); db(0x18);
+ db(0x20); db(0x6d); db(0x00); db(0x14); db(0x20); db(0x28); db(0x00); db(0x3c);
+ db(0x67); db(0x5c); db(0x20); db(0x40); db(0x41); db(0xe8); db(0x00); db(0x2c);
+ db(0x28); db(0x48); db(0x4e); db(0xae); db(0xfc); db(0xe8); db(0x72); db(0xff);
+ db(0x74); db(0xff); db(0xb2); db(0x80); db(0x67); db(0x48); db(0x26); db(0x00);
+ db(0x2c); db(0x6d); db(0x00); db(0x14); db(0x41); db(0xed); db(0x00); db(0xc0);
+ db(0x70); db(0x66); db(0x4e); db(0xae); db(0xff); db(0x7c); db(0x41); db(0xed);
+ db(0x00); db(0xc0); db(0x38); db(0x28); db(0x00); db(0x64); db(0x2c); db(0x6d);
+ db(0x00); db(0x18); db(0x91); db(0xc8); db(0x43); db(0xed); db(0x00); db(0x38);
+ db(0x70); db(0x00); db(0x30); db(0x3c); db(0x00); db(0x58); db(0x22); db(0x3c);
+ db(0x80); db(0x00); db(0x10); db(0x00); db(0x24); db(0x03); db(0x4e); db(0xae);
+ db(0xfd); db(0x0c); db(0x72); db(0xff); db(0x74); db(0xff); db(0x4a); db(0x80);
+ db(0x6b); db(0x0c); db(0x45); db(0xed); db(0x00); db(0x38); db(0x22); db(0x2a);
+ db(0x00); db(0x32); db(0x24); db(0x2a); db(0x00); db(0x36); db(0x20); db(0x2c);
+ db(0x00); db(0x1c); db(0xb8); db(0x6d); db(0x00); db(0x2c); db(0x66); db(0x12);
+ db(0xb0); db(0xad); db(0x00); db(0x28); db(0x66); db(0x0c); db(0xb2); db(0xad);
+ db(0x00); db(0x20); db(0x66); db(0x06); db(0xb4); db(0xad); db(0x00); db(0x24);
+ db(0x67); db(0x40); db(0x2b); db(0x40); db(0x00); db(0x28); db(0x2b); db(0x41);
+ db(0x00); db(0x20); db(0x2b); db(0x42); db(0x00); db(0x24); db(0x3b); db(0x44);
+ db(0x00); db(0x2c); db(0x91); db(0xc8); db(0x43); db(0xed); db(0x00); db(0x90);
+ db(0x70); db(0x00); db(0x30); db(0x3c); db(0x00); db(0x58); db(0x22); db(0x3c);
+ db(0x80); db(0x00); db(0x00); db(0x00); db(0x24); db(0x03); db(0x4e); db(0xae);
+ db(0xfd); db(0x0c); db(0x4a); db(0x80); db(0x6b); db(0x04); db(0x47); db(0xed);
+ db(0x00); db(0x90); db(0x34); db(0x2d); db(0x00); db(0x2c); db(0x30); db(0x3c);
+ db(0xff); db(0x38); db(0x72); db(0x01); db(0x61); db(0x00); db(0x07); db(0xf8);
+ db(0x4e); db(0x90); db(0x4c); db(0xdf); db(0x7f); db(0x1f); db(0x4e); db(0x75);
+ db(0x2c); db(0x78); db(0x00); db(0x04); db(0x3e); db(0x2e); db(0x00); db(0x14);
+ db(0x70); db(0xff); db(0x4e); db(0xae); db(0xfe); db(0xb6); db(0x7c); db(0x00);
+ db(0x01); db(0xc6); db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfe); db(0xda);
+ db(0x28); db(0x40); db(0x70); db(0x14); db(0x22); db(0x4c); db(0x4e); db(0xae);
+ db(0xfe); db(0xd4); db(0x70); db(0x00); db(0x30); db(0x3c); db(0x02); db(0x3c);
+ db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae);
+ db(0xff); db(0x3a); db(0x2a); db(0x40); db(0x47); db(0xed); db(0x00); db(0x16);
+ db(0x27); db(0x4e); db(0x00); db(0x10); db(0x27); db(0x4c); db(0x00); db(0x08);
+ db(0x27); db(0x46); db(0x00); db(0x0c); db(0x70); db(0xff); db(0x37); db(0x40);
+ db(0x00); db(0x00); db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x05);
+ db(0x61); db(0x00); db(0x07); db(0x9c); db(0x20); db(0x0d); db(0x06); db(0x80);
+ db(0x00); db(0x00); db(0x02); db(0x10); db(0x4e); db(0x90); db(0x43); db(0xed);
+ db(0x00); db(0x00); db(0x13); db(0x7c); db(0x00); db(0x02); db(0x00); db(0x08);
+ db(0x13); db(0x7c); db(0x00); db(0x05); db(0x00); db(0x09); db(0x41); db(0xfa);
+ db(0x08); db(0x1c); db(0x23); db(0x48); db(0x00); db(0x0a); db(0x41); db(0xfa);
+ db(0x02); db(0xf4); db(0x23); db(0x48); db(0x00); db(0x12); db(0x23); db(0x4d);
+ db(0x00); db(0x0e); db(0x70); db(0x05); db(0x4e); db(0xae); db(0xff); db(0x58);
+ db(0x20); db(0x06); db(0x4e); db(0xae); db(0xfe); db(0xc2); db(0x70); db(0x00);
+ db(0x53); db(0xab); db(0x00); db(0x1c); db(0x6a); db(0x06); db(0x70); db(0x0a);
+ db(0x27); db(0x40); db(0x00); db(0x1c); db(0x4a); db(0xab); db(0x00); db(0x14);
+ db(0x66); db(0x16); db(0x4a); db(0xab); db(0x00); db(0x1c); db(0x66); db(0xe0);
+ db(0x43); db(0xfa); db(0x08); db(0x49); db(0x70); db(0x00); db(0x4e); db(0xae);
+ db(0xfd); db(0xd8); db(0x27); db(0x40); db(0x00); db(0x14); db(0x67); db(0xd0);
+ db(0x4a); db(0xab); db(0x00); db(0x18); db(0x66); db(0x18); db(0x4a); db(0xab);
+ db(0x00); db(0x1c); db(0x66); db(0xc4); db(0x43); db(0xfa); db(0x08); db(0x3f);
  db(0x70); db(0x00); db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x27); db(0x40);
- db(0x00); db(0x14); db(0x67); db(0xd0); db(0x4a); db(0xab); db(0x00); db(0x18);
- db(0x66); db(0x18); db(0x4a); db(0xab); db(0x00); db(0x1c); db(0x66); db(0xc4);
- db(0x43); db(0xfa); db(0x08); db(0x3f); db(0x70); db(0x00); db(0x4e); db(0xae);
- db(0xfd); db(0xd8); db(0x27); db(0x40); db(0x00); db(0x18); db(0x67); db(0x00);
- db(0xff); db(0xb4); db(0x4a); db(0xad); db(0x02); db(0x08); db(0x66); db(0x38);
- db(0x4a); db(0xab); db(0x00); db(0x1c); db(0x66); db(0xa6); db(0x4e); db(0xae);
- db(0xff); db(0x7c); db(0x41); db(0xee); db(0x01); db(0x5e); db(0x43); db(0xfa);
- db(0x07); db(0x10); db(0x4e); db(0xae); db(0xfe); db(0xec); db(0x24); db(0x00);
- db(0x4e); db(0xae); db(0xff); db(0x76); db(0x4a); db(0x82); db(0x67); db(0x8c);
- db(0x41); db(0xfa); db(0x06); db(0xfe); db(0x70); db(0x00); db(0x72); db(0x00);
- db(0x61); db(0x00); db(0xfd); db(0x2e); db(0x2b); db(0x40); db(0x02); db(0x08);
- db(0x67); db(0x00); db(0x02); db(0x32); db(0x60); db(0x00); db(0xff); db(0x76);
- db(0x4a); db(0xad); db(0x02); db(0x0c); db(0x66); db(0x48); db(0x4a); db(0xab);
- db(0x00); db(0x1c); db(0x66); db(0x00); db(0xff); db(0x68); db(0x4e); db(0xae);
- db(0xff); db(0x7c); db(0x41); db(0xee); db(0x01); db(0x5e); db(0x43); db(0xfa);
- db(0x06); db(0xdd); db(0x4e); db(0xae); db(0xfe); db(0xec); db(0x24); db(0x00);
- db(0x4e); db(0xae); db(0xff); db(0x76); db(0x4a); db(0x82); db(0x67); db(0x00);
- db(0xff); db(0x4c); db(0x41); db(0xfa); db(0x06); db(0xc9); db(0x70); db(0x00);
- db(0x72); db(0x00); db(0x61); db(0x00); db(0xfc); db(0xec); db(0x2b); db(0x40);
- db(0x02); db(0x0c); db(0x67); db(0x00); db(0x01); db(0xf0); db(0x30); db(0x3c);
- db(0xff); db(0x38); db(0x72); db(0x00); db(0x61); db(0x00); db(0x06); db(0x94);
- db(0x4e); db(0x90); db(0x60); db(0x00); db(0xff); db(0x28); db(0x0c); db(0x47);
- db(0x00); db(0x24); db(0x65); db(0x12); db(0x53); db(0xab); db(0x00); db(0x34);
- db(0x6a); db(0x0c); db(0x20); db(0x4b); db(0x61); db(0x00); db(0xfd); db(0xb4);
- db(0x70); db(0x32); db(0x27); db(0x40); db(0x00); db(0x34); db(0x22); db(0x6d);
- db(0x02); db(0x08); db(0x45); db(0xed); db(0x01); db(0x3c); db(0x33); db(0x7c);
- db(0x00); db(0x0b); db(0x00); db(0x1c); db(0x23); db(0x7c); db(0x00); db(0x00);
- db(0x00); db(0x16); db(0x00); db(0x24); db(0x23); db(0x4a); db(0x00); db(0x28);
- db(0x10); db(0x2d); db(0x02); db(0x10); db(0x0c); db(0x47); db(0x00); db(0x27);
- db(0x65); db(0x00); db(0x01); db(0x52); db(0x08); db(0x00); db(0x00); db(0x01);
- db(0x67); db(0x00); db(0x01); db(0x4a); db(0x41); db(0xed); db(0x01); db(0x68);
- db(0x25); db(0x48); db(0x00); db(0x0a); db(0x15); db(0x7c); db(0x00); db(0x13);
- db(0x00); db(0x04); db(0x15); db(0x7c); db(0x00); db(0x03); db(0x00); db(0x05);
- db(0x42); db(0x90); db(0x42); db(0xa8); db(0x00); db(0x04); db(0x42); db(0xa8);
- db(0x00); db(0x08); db(0x42); db(0x68); db(0x00); db(0x0c); db(0x42); db(0x6a);
- db(0x00); db(0x06); db(0x61); db(0x00); db(0x01); db(0x72); db(0x31); db(0x6d);
- db(0x02); db(0x1a); db(0x00); db(0x0e); db(0x42); db(0x68); db(0x00); db(0x10);
- db(0x31); db(0x6d); db(0x02); db(0x1c); db(0x00); db(0x12); db(0x42); db(0x68);
- db(0x00); db(0x14); db(0x31); db(0x6d); db(0x02); db(0x14); db(0x00); db(0x16);
- db(0x42); db(0x68); db(0x00); db(0x18); db(0x31); db(0x6d); db(0x02); db(0x16);
- db(0x00); db(0x1a); db(0x43); db(0xed); db(0x01); db(0x88); db(0x21); db(0x49);
- db(0x00); db(0x1c); db(0x22); db(0xfc); db(0x80); db(0x03); db(0xa0); db(0x06);
- db(0x30); db(0x2d); db(0x02); db(0x30); db(0x48); db(0xc0); db(0xe1); db(0x80);
- db(0x22); db(0xc0); db(0x22); db(0xfc); db(0x80); db(0x03); db(0xa0); db(0x07);
- db(0x22); db(0xed); db(0x02); db(0x32); db(0x70); db(0x00); db(0x30); db(0x2d);
- db(0x02); db(0x20); db(0x6b); db(0x08); db(0x22); db(0xfc); db(0x80); db(0x03);
- db(0xa0); db(0x09); db(0x22); db(0xc0); db(0x30); db(0x2d); db(0x02); db(0x22);
- db(0x6b); db(0x08); db(0x22); db(0xfc); db(0x80); db(0x03); db(0xa0); db(0x0a);
- db(0x22); db(0xc0); db(0x30); db(0x2d); db(0x02); db(0x18); db(0x6b); db(0x14);
- db(0x22); db(0xfc); db(0x80); db(0x03); db(0xa0); db(0x02); db(0x22); db(0xc0);
- db(0x30); db(0x2d); db(0x02); db(0x1e); db(0x22); db(0xfc); db(0x80); db(0x03);
- db(0xa0); db(0x01); db(0x22); db(0xc0); db(0x30); db(0x2d); db(0x02); db(0x24);
- db(0x6b); db(0x10); db(0x22); db(0xfc); db(0x80); db(0x03); db(0xa0); db(0x03);
- db(0x30); db(0x2d); db(0x02); db(0x2a); db(0x48); db(0xc0); db(0xe1); db(0x80);
- db(0x22); db(0xc0); db(0x30); db(0x2d); db(0x02); db(0x26); db(0x6b); db(0x10);
- db(0x22); db(0xfc); db(0x80); db(0x03); db(0xa0); db(0x04); db(0x30); db(0x2d);
- db(0x02); db(0x2c); db(0x48); db(0xc0); db(0xe1); db(0x80); db(0x22); db(0xc0);
- db(0x30); db(0x2d); db(0x02); db(0x28); db(0x6b); db(0x10); db(0x22); db(0xfc);
- db(0x80); db(0x03); db(0xa0); db(0x05); db(0x30); db(0x2d); db(0x02); db(0x2e);
- db(0x48); db(0xc0); db(0xe1); db(0x80); db(0x22); db(0xc0); db(0x70); db(0x00);
- db(0x30); db(0x2d); db(0x02); db(0x36); db(0x6b); db(0x08); db(0x22); db(0xfc);
- db(0x80); db(0x03); db(0xa0); db(0x08); db(0x22); db(0xc0); db(0x42); db(0x91);
- db(0x61); db(0x00); db(0xfc); db(0x68); db(0x36); db(0x3c); db(0x00); db(0x68);
- db(0x74); db(0x01); db(0x28); db(0x2d); db(0x02); db(0x32); db(0x20); db(0x04);
- db(0xc0); db(0x82); db(0x22); db(0x2b); db(0x00); db(0x04); db(0xc2); db(0x82);
- db(0xb2); db(0x80); db(0x67); db(0x22); db(0x42); db(0x92); db(0x35); db(0x7c);
- db(0x02); db(0x00); db(0x00); db(0x04); db(0x42); db(0xaa); db(0x00); db(0x0a);
- db(0x32); db(0x03); db(0x4a); db(0x00); db(0x66); db(0x04); db(0x08); db(0xc1);
- db(0x00); db(0x07); db(0x35); db(0x41); db(0x00); db(0x06); db(0x42); db(0x6a);
- db(0x00); db(0x08); db(0x61); db(0x00); db(0xfc); db(0x2e); db(0x52); db(0x43);
- db(0xd4); db(0x42); db(0x0c); db(0x42); db(0x00); db(0x08); db(0x66); db(0xc6);
- db(0x27); db(0x44); db(0x00); db(0x04); db(0x10); db(0x2d); db(0x02); db(0x10);
- db(0x08); db(0x00); db(0x00); db(0x00); db(0x67); db(0x00); db(0xfd); db(0x8e);
- db(0x42); db(0x92); db(0x35); db(0x7c); db(0x04); db(0x00); db(0x00); db(0x04);
- db(0x42); db(0x6a); db(0x00); db(0x06); db(0x61); db(0x00); db(0x00); db(0x38);
- db(0x20); db(0x6b); db(0x00); db(0x14); db(0x30); db(0x2d); db(0x02); db(0x38);
- db(0x32); db(0x28); db(0x00); db(0x30); db(0xd2); db(0x41); db(0x90); db(0x41);
- db(0x6a); db(0x02); db(0x70); db(0x00); db(0x35); db(0x40); db(0x00); db(0x0a);
- db(0x30); db(0x2d); db(0x02); db(0x3a); db(0x32); db(0x28); db(0x00); db(0x2e);
+ db(0x00); db(0x18); db(0x67); db(0x00); db(0xff); db(0xb4); db(0x4a); db(0xad);
+ db(0x02); db(0x08); db(0x66); db(0x38); db(0x4a); db(0xab); db(0x00); db(0x1c);
+ db(0x66); db(0xa6); db(0x4e); db(0xae); db(0xff); db(0x7c); db(0x41); db(0xee);
+ db(0x01); db(0x5e); db(0x43); db(0xfa); db(0x07); db(0x10); db(0x4e); db(0xae);
+ db(0xfe); db(0xec); db(0x24); db(0x00); db(0x4e); db(0xae); db(0xff); db(0x76);
+ db(0x4a); db(0x82); db(0x67); db(0x8c); db(0x41); db(0xfa); db(0x06); db(0xfe);
+ db(0x70); db(0x00); db(0x72); db(0x00); db(0x61); db(0x00); db(0xfd); db(0x2e);
+ db(0x2b); db(0x40); db(0x02); db(0x08); db(0x67); db(0x00); db(0x02); db(0x32);
+ db(0x60); db(0x00); db(0xff); db(0x76); db(0x4a); db(0xad); db(0x02); db(0x0c);
+ db(0x66); db(0x48); db(0x4a); db(0xab); db(0x00); db(0x1c); db(0x66); db(0x00);
+ db(0xff); db(0x68); db(0x4e); db(0xae); db(0xff); db(0x7c); db(0x41); db(0xee);
+ db(0x01); db(0x5e); db(0x43); db(0xfa); db(0x06); db(0xdd); db(0x4e); db(0xae);
+ db(0xfe); db(0xec); db(0x24); db(0x00); db(0x4e); db(0xae); db(0xff); db(0x76);
+ db(0x4a); db(0x82); db(0x67); db(0x00); db(0xff); db(0x4c); db(0x41); db(0xfa);
+ db(0x06); db(0xc9); db(0x70); db(0x00); db(0x72); db(0x00); db(0x61); db(0x00);
+ db(0xfc); db(0xec); db(0x2b); db(0x40); db(0x02); db(0x0c); db(0x67); db(0x00);
+ db(0x01); db(0xf0); db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x00);
+ db(0x61); db(0x00); db(0x06); db(0x94); db(0x4e); db(0x90); db(0x60); db(0x00);
+ db(0xff); db(0x28); db(0x0c); db(0x47); db(0x00); db(0x24); db(0x65); db(0x12);
+ db(0x53); db(0xab); db(0x00); db(0x34); db(0x6a); db(0x0c); db(0x20); db(0x4b);
+ db(0x61); db(0x00); db(0xfd); db(0xb4); db(0x70); db(0x32); db(0x27); db(0x40);
+ db(0x00); db(0x34); db(0x22); db(0x6d); db(0x02); db(0x08); db(0x45); db(0xed);
+ db(0x01); db(0x3c); db(0x33); db(0x7c); db(0x00); db(0x0b); db(0x00); db(0x1c);
+ db(0x23); db(0x7c); db(0x00); db(0x00); db(0x00); db(0x16); db(0x00); db(0x24);
+ db(0x23); db(0x4a); db(0x00); db(0x28); db(0x10); db(0x2d); db(0x02); db(0x10);
+ db(0x0c); db(0x47); db(0x00); db(0x27); db(0x65); db(0x00); db(0x01); db(0x52);
+ db(0x08); db(0x00); db(0x00); db(0x01); db(0x67); db(0x00); db(0x01); db(0x4a);
+ db(0x41); db(0xed); db(0x01); db(0x68); db(0x25); db(0x48); db(0x00); db(0x0a);
+ db(0x15); db(0x7c); db(0x00); db(0x13); db(0x00); db(0x04); db(0x15); db(0x7c);
+ db(0x00); db(0x03); db(0x00); db(0x05); db(0x42); db(0x90); db(0x42); db(0xa8);
+ db(0x00); db(0x04); db(0x42); db(0xa8); db(0x00); db(0x08); db(0x42); db(0x68);
+ db(0x00); db(0x0c); db(0x42); db(0x6a); db(0x00); db(0x06); db(0x61); db(0x00);
+ db(0x01); db(0x72); db(0x31); db(0x6d); db(0x02); db(0x1a); db(0x00); db(0x0e);
+ db(0x42); db(0x68); db(0x00); db(0x10); db(0x31); db(0x6d); db(0x02); db(0x1c);
+ db(0x00); db(0x12); db(0x42); db(0x68); db(0x00); db(0x14); db(0x31); db(0x6d);
+ db(0x02); db(0x14); db(0x00); db(0x16); db(0x42); db(0x68); db(0x00); db(0x18);
+ db(0x31); db(0x6d); db(0x02); db(0x16); db(0x00); db(0x1a); db(0x43); db(0xed);
+ db(0x01); db(0x88); db(0x21); db(0x49); db(0x00); db(0x1c); db(0x22); db(0xfc);
+ db(0x80); db(0x03); db(0xa0); db(0x06); db(0x30); db(0x2d); db(0x02); db(0x30);
+ db(0x48); db(0xc0); db(0xe1); db(0x80); db(0x22); db(0xc0); db(0x22); db(0xfc);
+ db(0x80); db(0x03); db(0xa0); db(0x07); db(0x22); db(0xed); db(0x02); db(0x32);
+ db(0x70); db(0x00); db(0x30); db(0x2d); db(0x02); db(0x20); db(0x6b); db(0x08);
+ db(0x22); db(0xfc); db(0x80); db(0x03); db(0xa0); db(0x09); db(0x22); db(0xc0);
+ db(0x30); db(0x2d); db(0x02); db(0x22); db(0x6b); db(0x08); db(0x22); db(0xfc);
+ db(0x80); db(0x03); db(0xa0); db(0x0a); db(0x22); db(0xc0); db(0x30); db(0x2d);
+ db(0x02); db(0x18); db(0x6b); db(0x14); db(0x22); db(0xfc); db(0x80); db(0x03);
+ db(0xa0); db(0x02); db(0x22); db(0xc0); db(0x30); db(0x2d); db(0x02); db(0x1e);
+ db(0x22); db(0xfc); db(0x80); db(0x03); db(0xa0); db(0x01); db(0x22); db(0xc0);
+ db(0x30); db(0x2d); db(0x02); db(0x24); db(0x6b); db(0x10); db(0x22); db(0xfc);
+ db(0x80); db(0x03); db(0xa0); db(0x03); db(0x30); db(0x2d); db(0x02); db(0x2a);
+ db(0x48); db(0xc0); db(0xe1); db(0x80); db(0x22); db(0xc0); db(0x30); db(0x2d);
+ db(0x02); db(0x26); db(0x6b); db(0x10); db(0x22); db(0xfc); db(0x80); db(0x03);
+ db(0xa0); db(0x04); db(0x30); db(0x2d); db(0x02); db(0x2c); db(0x48); db(0xc0);
+ db(0xe1); db(0x80); db(0x22); db(0xc0); db(0x30); db(0x2d); db(0x02); db(0x28);
+ db(0x6b); db(0x10); db(0x22); db(0xfc); db(0x80); db(0x03); db(0xa0); db(0x05);
+ db(0x30); db(0x2d); db(0x02); db(0x2e); db(0x48); db(0xc0); db(0xe1); db(0x80);
+ db(0x22); db(0xc0); db(0x70); db(0x00); db(0x30); db(0x2d); db(0x02); db(0x36);
+ db(0x6b); db(0x08); db(0x22); db(0xfc); db(0x80); db(0x03); db(0xa0); db(0x08);
+ db(0x22); db(0xc0); db(0x42); db(0x91); db(0x61); db(0x00); db(0xfc); db(0x68);
+ db(0x36); db(0x3c); db(0x00); db(0x68); db(0x74); db(0x01); db(0x28); db(0x2d);
+ db(0x02); db(0x32); db(0x20); db(0x04); db(0xc0); db(0x82); db(0x22); db(0x2b);
+ db(0x00); db(0x04); db(0xc2); db(0x82); db(0xb2); db(0x80); db(0x67); db(0x22);
+ db(0x42); db(0x92); db(0x35); db(0x7c); db(0x02); db(0x00); db(0x00); db(0x04);
+ db(0x42); db(0xaa); db(0x00); db(0x0a); db(0x32); db(0x03); db(0x4a); db(0x00);
+ db(0x66); db(0x04); db(0x08); db(0xc1); db(0x00); db(0x07); db(0x35); db(0x41);
+ db(0x00); db(0x06); db(0x42); db(0x6a); db(0x00); db(0x08); db(0x61); db(0x00);
+ db(0xfc); db(0x2e); db(0x52); db(0x43); db(0xd4); db(0x42); db(0x0c); db(0x42);
+ db(0x00); db(0x08); db(0x66); db(0xc6); db(0x27); db(0x44); db(0x00); db(0x04);
+ db(0x10); db(0x2d); db(0x02); db(0x10); db(0x08); db(0x00); db(0x00); db(0x00);
+ db(0x67); db(0x00); db(0xfd); db(0x8e); db(0x42); db(0x92); db(0x35); db(0x7c);
+ db(0x04); db(0x00); db(0x00); db(0x04); db(0x42); db(0x6a); db(0x00); db(0x06);
+ db(0x61); db(0x00); db(0x00); db(0x38); db(0x20); db(0x6b); db(0x00); db(0x14);
+ db(0x30); db(0x2d); db(0x02); db(0x38); db(0x32); db(0x28); db(0x00); db(0x30);
  db(0xd2); db(0x41); db(0x90); db(0x41); db(0x6a); db(0x02); db(0x70); db(0x00);
- db(0x35); db(0x40); db(0x00); db(0x0c); db(0x61); db(0x00); db(0xfb); db(0xa0);
- db(0x60); db(0x00); db(0xfd); db(0x4a); db(0x4e); db(0x75); db(0x22); db(0x2d);
- db(0x02); db(0x32); db(0x70); db(0x00); db(0x08); db(0x01); db(0x00); db(0x00);
- db(0x67); db(0x04); db(0x08); db(0xc0); db(0x00); db(0x0e); db(0x08); db(0x01);
- db(0x00); db(0x01); db(0x67); db(0x04); db(0x08); db(0xc0); db(0x00); db(0x0d);
- db(0x08); db(0x01); db(0x00); db(0x02); db(0x67); db(0x04); db(0x08); db(0xc0);
- db(0x00); db(0x0c); db(0x35); db(0x40); db(0x00); db(0x08); db(0x4e); db(0x75);
- db(0x4a); db(0xa9); db(0x02); db(0x08); db(0x67); db(0x14); db(0x4a); db(0xa9);
- db(0x02); db(0x0c); db(0x67); db(0x0e); db(0x30); db(0x29); db(0x02); db(0x12);
- db(0xb0); db(0x69); db(0x00); db(0x16); db(0x67); db(0x14); db(0x33); db(0x40);
- db(0x00); db(0x16); db(0x2c); db(0x69); db(0x00); db(0x26); db(0x20); db(0x29);
- db(0x00); db(0x22); db(0x22); db(0x69); db(0x00); db(0x1e); db(0x4e); db(0xae);
- db(0xfe); db(0xbc); db(0x53); db(0x69); db(0x00); db(0x46); db(0x6a); db(0x12);
- db(0x33); db(0x7c); db(0x00); db(0x32); db(0x00); db(0x46); db(0x30); db(0x3c);
- db(0xff); db(0x38); db(0x72); db(0x02); db(0x61); db(0x00); db(0x04); db(0x44);
- db(0x4e); db(0x90); db(0x41); db(0xf9); db(0x00); db(0xdf); db(0xf0); db(0x00);
- db(0x70); db(0x00); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x00); db(0x06);
- db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x11); db(0x61); db(0x00);
- db(0x04); db(0x2a); db(0x4e); db(0x90); db(0x08); db(0x00); db(0x00); db(0x00);
- db(0x67); db(0x42); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x20); db(0x3c);
- db(0x00); db(0x00); db(0x00); db(0x88); db(0x22); db(0x3c); db(0x00); db(0x01);
- db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x4a); db(0x80);
- db(0x67); db(0x00); db(0x00); db(0x40); db(0x2a); db(0x40); db(0x2b); db(0x4e);
- db(0x00); db(0x14); db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x0e);
- db(0x61); db(0x00); db(0x03); db(0xf8); db(0x20); db(0x0d); db(0x4e); db(0x90);
- db(0x41); db(0xfa); db(0x04); db(0x78); db(0x43); db(0xfa); db(0x01); db(0x12);
- db(0x70); db(0xf6); db(0x22); db(0x3c); db(0x00); db(0x00); db(0x27); db(0x10);
- db(0x61); db(0x00); db(0xee); db(0x14); db(0x70); db(0x00); db(0x4c); db(0xdf);
- db(0x60); db(0x00); db(0x4e); db(0x75); db(0x30); db(0x3c); db(0xff); db(0x38);
- db(0x72); db(0x0a); db(0x61); db(0x00); db(0x03); db(0xce); db(0x4e); db(0x90);
- db(0x4e); db(0x75); db(0x61); db(0xf0); db(0x20); db(0x0d); db(0x67); db(0x1c);
- db(0x2c); db(0x6d); db(0x00); db(0x14); db(0x20); db(0x2d); db(0x00); db(0x18);
- db(0x67); db(0x06); db(0x22); db(0x40); db(0x4e); db(0xae); db(0xfe); db(0x62);
- db(0x22); db(0x4d); db(0x20); db(0x3c); db(0x00); db(0x00); db(0x00); db(0x88);
- db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x70); db(0x00); db(0x4e); db(0x75);
- db(0x48); db(0xe7); db(0x38); db(0x3e); db(0x2c); db(0x6d); db(0x00); db(0x18);
- db(0x41); db(0xfa); db(0x04); db(0x06); db(0x22); db(0x08); db(0x24); db(0x3c);
- db(0x00); db(0x00); db(0x03); db(0xed); db(0x4e); db(0xae); db(0xff); db(0xe2);
- db(0x28); db(0x00); db(0x67); db(0x4c); db(0x45); db(0xed); db(0x00); db(0x68);
- db(0x42); db(0x92); db(0x34); db(0xaa); db(0x00); db(0x02); db(0x24); db(0x0a);
- db(0x54); db(0x82); db(0x76); db(0x02); db(0x22); db(0x04); db(0x4e); db(0xae);
- db(0xff); db(0xd6); db(0xb6); db(0x80); db(0x66); db(0x32); db(0x0c); db(0x92);
- db(0x50); db(0x4e); db(0x54); db(0x52); db(0x66); db(0xe4); db(0x24); db(0x0a);
- db(0x76); db(0x04); db(0x22); db(0x04); db(0x4e); db(0xae); db(0xff); db(0xd6);
- db(0x24); db(0x0a); db(0x76); db(0x20); db(0x22); db(0x04); db(0x4e); db(0xae);
- db(0xff); db(0xd6); db(0xb6); db(0x80); db(0x66); db(0x12); db(0x4a); db(0x6a);
- db(0x00); db(0x10); db(0x66); db(0xc4); db(0x30); db(0x3c); db(0xff); db(0x38);
- db(0x72); db(0x10); db(0x61); db(0x00); db(0x03); db(0x3e); db(0x4e); db(0x90);
- db(0x22); db(0x04); db(0x67); db(0x04); db(0x4e); db(0xae); db(0xff); db(0xdc);
- db(0x4c); db(0xdf); db(0x7c); db(0x1c); db(0x4e); db(0x75); db(0x2c); db(0x6d);
- db(0x00); db(0x18); db(0x41); db(0xfa); db(0x03); db(0x7e); db(0x22); db(0x08);
- db(0x74); db(0xfe); db(0x4e); db(0xae); db(0xff); db(0xac); db(0x22); db(0x00);
- db(0x67); db(0x34); db(0x4e); db(0xae); db(0xff); db(0xa6); db(0x2c); db(0x6d);
- db(0x00); db(0x14); db(0x45); db(0xed); db(0x00); db(0x38); db(0x70); db(0xff);
- db(0x4e); db(0xae); db(0xfe); db(0xb6); db(0x15); db(0x40); db(0x00); db(0x14);
- db(0x41); db(0xfa); db(0x03); db(0x6e); db(0x24); db(0x88); db(0x25); db(0x7c);
- db(0x00); db(0x00); db(0x00); db(0x12); db(0x00); db(0x0c); db(0x25); db(0x6d);
- db(0x00); db(0x08); db(0x00); db(0x10); db(0x2c); db(0x6d); db(0x00); db(0x18);
- db(0x22); db(0x0a); db(0x4e); db(0xae); db(0xfc); db(0x88); db(0x2c); db(0x6d);
- db(0x00); db(0x14); db(0x4e); db(0x75); db(0x00); db(0x00); db(0x00); db(0x10);
- db(0x00); db(0x00); db(0x00); db(0x00); db(0x30); db(0x3c); db(0xff); db(0x38);
- db(0x72); db(0x0d); db(0x61); db(0x00); db(0x02); db(0xce); db(0x4e); db(0x90);
- db(0x4a); db(0x80); db(0x67); db(0x00); db(0xfe); db(0xfe); db(0x2a); db(0x40);
- db(0x2c); db(0x6d); db(0x00); db(0x14); db(0x93); db(0xc9); db(0x4e); db(0xae);
- db(0xfe); db(0xda); db(0x2b); db(0x40); db(0x00); db(0x08); db(0x43); db(0xfa);
- db(0x03); db(0xab); db(0x70); db(0x00); db(0x4e); db(0xae); db(0xfd); db(0xd8);
- db(0x2b); db(0x40); db(0x00); db(0x18); db(0x67); db(0x00); db(0xfe); db(0xdc);
- db(0x2c); db(0x40); db(0x72); db(0x32); db(0x4e); db(0xae); db(0xff); db(0x3a);
- db(0x41); db(0xfa); db(0x02); db(0xd4); db(0x22); db(0x08); db(0x74); db(0xfe);
- db(0x4e); db(0xae); db(0xff); db(0xac); db(0x4a); db(0x80); db(0x67); db(0xea);
- db(0x22); db(0x00); db(0x4e); db(0xae); db(0xff); db(0xa6); db(0x72); db(0x32);
- db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x41); db(0xfa); db(0x02); db(0xbe);
+ db(0x35); db(0x40); db(0x00); db(0x0a); db(0x30); db(0x2d); db(0x02); db(0x3a);
+ db(0x32); db(0x28); db(0x00); db(0x2e); db(0xd2); db(0x41); db(0x90); db(0x41);
+ db(0x6a); db(0x02); db(0x70); db(0x00); db(0x35); db(0x40); db(0x00); db(0x0c);
+ db(0x61); db(0x00); db(0xfb); db(0xa0); db(0x60); db(0x00); db(0xfd); db(0x4a);
+ db(0x4e); db(0x75); db(0x22); db(0x2d); db(0x02); db(0x32); db(0x70); db(0x00);
+ db(0x08); db(0x01); db(0x00); db(0x00); db(0x67); db(0x04); db(0x08); db(0xc0);
+ db(0x00); db(0x0e); db(0x08); db(0x01); db(0x00); db(0x01); db(0x67); db(0x04);
+ db(0x08); db(0xc0); db(0x00); db(0x0d); db(0x08); db(0x01); db(0x00); db(0x02);
+ db(0x67); db(0x04); db(0x08); db(0xc0); db(0x00); db(0x0c); db(0x35); db(0x40);
+ db(0x00); db(0x08); db(0x4e); db(0x75); db(0x4a); db(0xa9); db(0x02); db(0x08);
+ db(0x67); db(0x14); db(0x4a); db(0xa9); db(0x02); db(0x0c); db(0x67); db(0x0e);
+ db(0x30); db(0x29); db(0x02); db(0x12); db(0xb0); db(0x69); db(0x00); db(0x16);
+ db(0x67); db(0x14); db(0x33); db(0x40); db(0x00); db(0x16); db(0x2c); db(0x69);
+ db(0x00); db(0x26); db(0x20); db(0x29); db(0x00); db(0x22); db(0x22); db(0x69);
+ db(0x00); db(0x1e); db(0x4e); db(0xae); db(0xfe); db(0xbc); db(0x53); db(0x69);
+ db(0x00); db(0x46); db(0x6a); db(0x12); db(0x33); db(0x7c); db(0x00); db(0x32);
+ db(0x00); db(0x46); db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x02);
+ db(0x61); db(0x00); db(0x04); db(0x44); db(0x4e); db(0x90); db(0x41); db(0xf9);
+ db(0x00); db(0xdf); db(0xf0); db(0x00); db(0x70); db(0x00); db(0x4e); db(0x75);
+ db(0x48); db(0xe7); db(0x00); db(0x06); db(0x30); db(0x3c); db(0xff); db(0x38);
+ db(0x72); db(0x11); db(0x61); db(0x00); db(0x04); db(0x2a); db(0x4e); db(0x90);
+ db(0x08); db(0x00); db(0x00); db(0x00); db(0x67); db(0x42); db(0x2c); db(0x78);
+ db(0x00); db(0x04); db(0x20); db(0x3c); db(0x00); db(0x00); db(0x00); db(0x88);
+ db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae);
+ db(0xff); db(0x3a); db(0x4a); db(0x80); db(0x67); db(0x00); db(0x00); db(0x40);
+ db(0x2a); db(0x40); db(0x2b); db(0x4e); db(0x00); db(0x14); db(0x30); db(0x3c);
+ db(0xff); db(0x38); db(0x72); db(0x0e); db(0x61); db(0x00); db(0x03); db(0xf8);
+ db(0x20); db(0x0d); db(0x4e); db(0x90); db(0x41); db(0xfa); db(0x04); db(0x78);
+ db(0x43); db(0xfa); db(0x01); db(0x12); db(0x70); db(0xf6); db(0x22); db(0x3c);
+ db(0x00); db(0x00); db(0x27); db(0x10); db(0x61); db(0x00); db(0xee); db(0x00);
+ db(0x70); db(0x00); db(0x4c); db(0xdf); db(0x60); db(0x00); db(0x4e); db(0x75);
+ db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x0a); db(0x61); db(0x00);
+ db(0x03); db(0xce); db(0x4e); db(0x90); db(0x4e); db(0x75); db(0x61); db(0xf0);
+ db(0x20); db(0x0d); db(0x67); db(0x1c); db(0x2c); db(0x6d); db(0x00); db(0x14);
+ db(0x20); db(0x2d); db(0x00); db(0x18); db(0x67); db(0x06); db(0x22); db(0x40);
+ db(0x4e); db(0xae); db(0xfe); db(0x62); db(0x22); db(0x4d); db(0x20); db(0x3c);
+ db(0x00); db(0x00); db(0x00); db(0x88); db(0x4e); db(0xae); db(0xff); db(0x2e);
+ db(0x70); db(0x00); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x38); db(0x3e);
+ db(0x2c); db(0x6d); db(0x00); db(0x18); db(0x41); db(0xfa); db(0x04); db(0x06);
+ db(0x22); db(0x08); db(0x24); db(0x3c); db(0x00); db(0x00); db(0x03); db(0xed);
+ db(0x4e); db(0xae); db(0xff); db(0xe2); db(0x28); db(0x00); db(0x67); db(0x4c);
+ db(0x45); db(0xed); db(0x00); db(0x68); db(0x42); db(0x92); db(0x34); db(0xaa);
+ db(0x00); db(0x02); db(0x24); db(0x0a); db(0x54); db(0x82); db(0x76); db(0x02);
+ db(0x22); db(0x04); db(0x4e); db(0xae); db(0xff); db(0xd6); db(0xb6); db(0x80);
+ db(0x66); db(0x32); db(0x0c); db(0x92); db(0x50); db(0x4e); db(0x54); db(0x52);
+ db(0x66); db(0xe4); db(0x24); db(0x0a); db(0x76); db(0x04); db(0x22); db(0x04);
+ db(0x4e); db(0xae); db(0xff); db(0xd6); db(0x24); db(0x0a); db(0x76); db(0x20);
+ db(0x22); db(0x04); db(0x4e); db(0xae); db(0xff); db(0xd6); db(0xb6); db(0x80);
+ db(0x66); db(0x12); db(0x4a); db(0x6a); db(0x00); db(0x10); db(0x66); db(0xc4);
+ db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x10); db(0x61); db(0x00);
+ db(0x03); db(0x3e); db(0x4e); db(0x90); db(0x22); db(0x04); db(0x67); db(0x04);
+ db(0x4e); db(0xae); db(0xff); db(0xdc); db(0x4c); db(0xdf); db(0x7c); db(0x1c);
+ db(0x4e); db(0x75); db(0x2c); db(0x6d); db(0x00); db(0x18); db(0x41); db(0xfa);
+ db(0x03); db(0x7e); db(0x22); db(0x08); db(0x74); db(0xfe); db(0x4e); db(0xae);
+ db(0xff); db(0xac); db(0x22); db(0x00); db(0x67); db(0x34); db(0x4e); db(0xae);
+ db(0xff); db(0xa6); db(0x2c); db(0x6d); db(0x00); db(0x14); db(0x45); db(0xed);
+ db(0x00); db(0x38); db(0x70); db(0xff); db(0x4e); db(0xae); db(0xfe); db(0xb6);
+ db(0x15); db(0x40); db(0x00); db(0x14); db(0x41); db(0xfa); db(0x03); db(0x6e);
+ db(0x24); db(0x88); db(0x25); db(0x7c); db(0x00); db(0x00); db(0x00); db(0x12);
+ db(0x00); db(0x0c); db(0x25); db(0x6d); db(0x00); db(0x08); db(0x00); db(0x10);
+ db(0x2c); db(0x6d); db(0x00); db(0x18); db(0x22); db(0x0a); db(0x4e); db(0xae);
+ db(0xfc); db(0x88); db(0x2c); db(0x6d); db(0x00); db(0x14); db(0x4e); db(0x75);
+ db(0x00); db(0x00); db(0x00); db(0x10); db(0x00); db(0x00); db(0x00); db(0x00);
+ db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x0d); db(0x61); db(0x00);
+ db(0x02); db(0xce); db(0x4e); db(0x90); db(0x4a); db(0x80); db(0x67); db(0x00);
+ db(0xfe); db(0xfe); db(0x2a); db(0x40); db(0x2c); db(0x6d); db(0x00); db(0x14);
+ db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfe); db(0xda); db(0x2b); db(0x40);
+ db(0x00); db(0x08); db(0x43); db(0xfa); db(0x03); db(0xab); db(0x70); db(0x00);
+ db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x2b); db(0x40); db(0x00); db(0x18);
+ db(0x67); db(0x00); db(0xfe); db(0xdc); db(0x2c); db(0x40); db(0x72); db(0x32);
+ db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x41); db(0xfa); db(0x02); db(0xd4);
  db(0x22); db(0x08); db(0x74); db(0xfe); db(0x4e); db(0xae); db(0xff); db(0xac);
- db(0x4a); db(0x80); db(0x67); db(0x00); db(0xfe); db(0xa6); db(0x22); db(0x00);
- db(0x4e); db(0xae); db(0xff); db(0xa6); db(0x2c); db(0x6d); db(0x00); db(0x14);
- db(0x61); db(0x00); db(0xf8); db(0x20); db(0x72); db(0x00); db(0x32); db(0x3c);
- db(0x00); db(0x34); db(0x61); db(0x00); db(0xf8); db(0x64); db(0x28); db(0x40);
- db(0x4a); db(0x80); db(0x67); db(0x00); db(0xfe); db(0x86); db(0x70); db(0x00);
- db(0x08); db(0xc0); db(0x00); db(0x0d); db(0x4e); db(0xae); db(0xfe); db(0xc2);
- db(0x72); db(0x00); db(0x20); db(0x2d); db(0x00); db(0x0c); db(0x41); db(0xfa);
- db(0x02); db(0x97); db(0x22); db(0x4c); db(0x4e); db(0xae); db(0xfe); db(0x44);
- db(0x4a); db(0x80); db(0x66); db(0xe2); db(0x20); db(0x6c); db(0x00); db(0x14);
- db(0x0c); db(0x68); db(0x00); db(0x25); db(0x00); db(0x14); db(0x64); db(0x0c);
- db(0x61); db(0x00); db(0xfe); db(0x4a); db(0x70); db(0x00); db(0x4e); db(0xae);
- db(0xfe); db(0xc2); db(0x60); db(0xf8); db(0x61); db(0x00); db(0xfe); db(0xe8);
- db(0x41); db(0xed); db(0x00); db(0x1c); db(0x29); db(0x48); db(0x00); db(0x28);
- db(0x70); db(0x01); db(0x29); db(0x40); db(0x00); db(0x24); db(0x39); db(0x7c);
- db(0x00); db(0x0c); db(0x00); db(0x1c); db(0x2b); db(0x4d); db(0x00); db(0x2c);
- db(0x41); db(0xfa); db(0x01); db(0x60); db(0x2b); db(0x48); db(0x00); db(0x24);
- db(0x22); db(0x4c); db(0x4e); db(0xae); db(0xfe); db(0x38); db(0x30); db(0x3c);
- db(0xff); db(0x38); db(0x72); db(0x0f); db(0x61); db(0x00); db(0x01); db(0xe4);
- db(0x4e); db(0x90); db(0x4a); db(0xad); db(0x00); db(0x00); db(0x66); db(0x1c);
- db(0x70); db(0x00); db(0x74); db(0x00); db(0x14); db(0x2d); db(0x00); db(0x4c);
- db(0x05); db(0xc0); db(0x08); db(0xc0); db(0x00); db(0x0d); db(0x4e); db(0xae);
- db(0xfe); db(0xc2); db(0x05); db(0x00); db(0x67); db(0x06); db(0x61); db(0x00);
- db(0xfe); db(0x20); db(0x60); db(0xe4); db(0x20); db(0x2d); db(0x00); db(0x00);
- db(0x67); db(0x00); db(0x00); db(0x76); db(0x72); db(0x01); db(0x4e); db(0xae);
- db(0xff); db(0x3a); db(0x2b); db(0x40); db(0x00); db(0x04); db(0x30); db(0x3c);
- db(0xff); db(0x38); db(0x72); db(0x0c); db(0x61); db(0x00); db(0x01); db(0xa4);
- db(0x4e); db(0x90); db(0x4a); db(0x80); db(0x67); db(0x40); db(0x4a); db(0xad);
- db(0x00); db(0x04); db(0x67); db(0x3a); db(0x39); db(0x7c); db(0x00); db(0x03);
- db(0x00); db(0x1c); db(0x42); db(0x2c); db(0x00); db(0x1f); db(0x42); db(0xac);
- db(0x00); db(0x20); db(0x29); db(0x6d); db(0x00); db(0x00); db(0x00); db(0x24);
- db(0x29); db(0x6d); db(0x00); db(0x04); db(0x00); db(0x28); db(0x42); db(0xac);
- db(0x00); db(0x2c); db(0x42); db(0xac); db(0x00); db(0x30); db(0x22); db(0x4c);
- db(0x4e); db(0xae); db(0xfe); db(0x38); db(0x2b); db(0x6c); db(0x00); db(0x30);
- db(0x00); db(0x10); db(0x39); db(0x7c); db(0x00); db(0x04); db(0x00); db(0x1c);
- db(0x22); db(0x4c); db(0x4e); db(0xae); db(0xfe); db(0x38); db(0x20); db(0x2d);
- db(0x00); db(0x00); db(0x42); db(0xad); db(0x00); db(0x00); db(0x22); db(0x2d);
- db(0x00); db(0x04); db(0x67); db(0x00); db(0xff); db(0x74); db(0x22); db(0x41);
- db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x60); db(0x00); db(0xff); db(0x6a);
- db(0x39); db(0x7c); db(0x00); db(0x02); db(0x00); db(0x1c); db(0x41); db(0xed);
- db(0x00); db(0x30); db(0x42); db(0x90); db(0x42); db(0xa8); db(0x00); db(0x04);
- db(0x42); db(0x2c); db(0x00); db(0x1f); db(0x42); db(0xac); db(0x00); db(0x2c);
- db(0x42); db(0xac); db(0x00); db(0x30); db(0x29); db(0x48); db(0x00); db(0x28);
- db(0x70); db(0x08); db(0x29); db(0x40); db(0x00); db(0x24); db(0x22); db(0x4c);
- db(0x4e); db(0xae); db(0xfe); db(0x38); db(0x0c); db(0xad); db(0x46); db(0x4f);
- db(0x52); db(0x4d); db(0x00); db(0x30); db(0x66); db(0x52); db(0x20); db(0x2d);
- db(0x00); db(0x34); db(0x67); db(0x4c); db(0x6b); db(0x4a); db(0x2b); db(0x6c);
- db(0x00); db(0x30); db(0x00); db(0x10); db(0x50); db(0x80); db(0x24); db(0x00);
- db(0x72); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x4a); db(0x80);
- db(0x67); db(0x36); db(0x24); db(0x40); db(0x20); db(0x4a); db(0x20); db(0xed);
- db(0x00); db(0x30); db(0x20); db(0xed); db(0x00); db(0x34); db(0x29); db(0x48);
- db(0x00); db(0x28); db(0x20); db(0x02); db(0x51); db(0x80); db(0x29); db(0x40);
+ db(0x4a); db(0x80); db(0x67); db(0xea); db(0x22); db(0x00); db(0x4e); db(0xae);
+ db(0xff); db(0xa6); db(0x72); db(0x32); db(0x4e); db(0xae); db(0xff); db(0x3a);
+ db(0x41); db(0xfa); db(0x02); db(0xbe); db(0x22); db(0x08); db(0x74); db(0xfe);
+ db(0x4e); db(0xae); db(0xff); db(0xac); db(0x4a); db(0x80); db(0x67); db(0x00);
+ db(0xfe); db(0xa6); db(0x22); db(0x00); db(0x4e); db(0xae); db(0xff); db(0xa6);
+ db(0x2c); db(0x6d); db(0x00); db(0x14); db(0x61); db(0x00); db(0xf8); db(0x20);
+ db(0x72); db(0x00); db(0x32); db(0x3c); db(0x00); db(0x34); db(0x61); db(0x00);
+ db(0xf8); db(0x64); db(0x28); db(0x40); db(0x4a); db(0x80); db(0x67); db(0x00);
+ db(0xfe); db(0x86); db(0x70); db(0x00); db(0x08); db(0xc0); db(0x00); db(0x0d);
+ db(0x4e); db(0xae); db(0xfe); db(0xc2); db(0x72); db(0x00); db(0x20); db(0x2d);
+ db(0x00); db(0x0c); db(0x41); db(0xfa); db(0x02); db(0x97); db(0x22); db(0x4c);
+ db(0x4e); db(0xae); db(0xfe); db(0x44); db(0x4a); db(0x80); db(0x66); db(0xe2);
+ db(0x20); db(0x6c); db(0x00); db(0x14); db(0x0c); db(0x68); db(0x00); db(0x25);
+ db(0x00); db(0x14); db(0x64); db(0x0c); db(0x61); db(0x00); db(0xfe); db(0x4a);
+ db(0x70); db(0x00); db(0x4e); db(0xae); db(0xfe); db(0xc2); db(0x60); db(0xf8);
+ db(0x61); db(0x00); db(0xfe); db(0xe8); db(0x41); db(0xed); db(0x00); db(0x1c);
+ db(0x29); db(0x48); db(0x00); db(0x28); db(0x70); db(0x01); db(0x29); db(0x40);
+ db(0x00); db(0x24); db(0x39); db(0x7c); db(0x00); db(0x0c); db(0x00); db(0x1c);
+ db(0x2b); db(0x4d); db(0x00); db(0x2c); db(0x41); db(0xfa); db(0x01); db(0x60);
+ db(0x2b); db(0x48); db(0x00); db(0x24); db(0x22); db(0x4c); db(0x4e); db(0xae);
+ db(0xfe); db(0x38); db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x0f);
+ db(0x61); db(0x00); db(0x01); db(0xe4); db(0x4e); db(0x90); db(0x4a); db(0xad);
+ db(0x00); db(0x00); db(0x66); db(0x1c); db(0x70); db(0x00); db(0x74); db(0x00);
+ db(0x14); db(0x2d); db(0x00); db(0x4c); db(0x05); db(0xc0); db(0x08); db(0xc0);
+ db(0x00); db(0x0d); db(0x4e); db(0xae); db(0xfe); db(0xc2); db(0x05); db(0x00);
+ db(0x67); db(0x06); db(0x61); db(0x00); db(0xfe); db(0x20); db(0x60); db(0xe4);
+ db(0x20); db(0x2d); db(0x00); db(0x00); db(0x67); db(0x00); db(0x00); db(0x76);
+ db(0x72); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x2b); db(0x40);
+ db(0x00); db(0x04); db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x0c);
+ db(0x61); db(0x00); db(0x01); db(0xa4); db(0x4e); db(0x90); db(0x4a); db(0x80);
+ db(0x67); db(0x40); db(0x4a); db(0xad); db(0x00); db(0x04); db(0x67); db(0x3a);
+ db(0x39); db(0x7c); db(0x00); db(0x03); db(0x00); db(0x1c); db(0x42); db(0x2c);
+ db(0x00); db(0x1f); db(0x42); db(0xac); db(0x00); db(0x20); db(0x29); db(0x6d);
+ db(0x00); db(0x00); db(0x00); db(0x24); db(0x29); db(0x6d); db(0x00); db(0x04);
+ db(0x00); db(0x28); db(0x42); db(0xac); db(0x00); db(0x2c); db(0x42); db(0xac);
+ db(0x00); db(0x30); db(0x22); db(0x4c); db(0x4e); db(0xae); db(0xfe); db(0x38);
+ db(0x2b); db(0x6c); db(0x00); db(0x30); db(0x00); db(0x10); db(0x39); db(0x7c);
+ db(0x00); db(0x04); db(0x00); db(0x1c); db(0x22); db(0x4c); db(0x4e); db(0xae);
+ db(0xfe); db(0x38); db(0x20); db(0x2d); db(0x00); db(0x00); db(0x42); db(0xad);
+ db(0x00); db(0x00); db(0x22); db(0x2d); db(0x00); db(0x04); db(0x67); db(0x00);
+ db(0xff); db(0x74); db(0x22); db(0x41); db(0x4e); db(0xae); db(0xff); db(0x2e);
+ db(0x60); db(0x00); db(0xff); db(0x6a); db(0x39); db(0x7c); db(0x00); db(0x02);
+ db(0x00); db(0x1c); db(0x41); db(0xed); db(0x00); db(0x30); db(0x42); db(0x90);
+ db(0x42); db(0xa8); db(0x00); db(0x04); db(0x42); db(0x2c); db(0x00); db(0x1f);
+ db(0x42); db(0xac); db(0x00); db(0x2c); db(0x42); db(0xac); db(0x00); db(0x30);
+ db(0x29); db(0x48); db(0x00); db(0x28); db(0x70); db(0x08); db(0x29); db(0x40);
  db(0x00); db(0x24); db(0x22); db(0x4c); db(0x4e); db(0xae); db(0xfe); db(0x38);
- db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x0b); db(0x61); db(0x00);
- db(0x00); db(0xca); db(0x20); db(0x2c); db(0x00); db(0x20); db(0x4e); db(0x90);
- db(0x22); db(0x4a); db(0x20); db(0x02); db(0x4e); db(0xae); db(0xff); db(0x2e);
- db(0x4a); db(0xac); db(0x00); db(0x20); db(0x67); db(0x00); db(0xfe); db(0xda);
- db(0x41); db(0xed); db(0x00); db(0x30); db(0x29); db(0x48); db(0x00); db(0x28);
- db(0x70); db(0x01); db(0x29); db(0x40); db(0x00); db(0x24); db(0x42); db(0xac);
- db(0x00); db(0x20); db(0x22); db(0x4c); db(0x4e); db(0xae); db(0xfe); db(0x38);
- db(0x60); db(0xde); db(0x41); db(0xe8); db(0xff); db(0xe4); db(0x20); db(0x29);
- db(0x00); db(0x08); db(0xb0); db(0xa8); db(0x00); db(0x10); db(0x67); db(0x1a);
- db(0x21); db(0x40); db(0x00); db(0x10); db(0x2f); db(0x0e); db(0x2c); db(0x68);
- db(0x00); db(0x14); db(0x22); db(0x68); db(0x00); db(0x08); db(0x70); db(0x00);
- db(0x08); db(0xc0); db(0x00); db(0x0d); db(0x4e); db(0xae); db(0xfe); db(0xbc);
- db(0x2c); db(0x5f); db(0x70); db(0x00); db(0x4e); db(0x75); db(0x2c); db(0x78);
- db(0x00); db(0x04); db(0x74); db(0xff); db(0x30); db(0x3c); db(0xff); db(0x38);
- db(0x72); db(0x11); db(0x61); db(0x00); db(0x00); db(0x5e); db(0x4e); db(0x90);
- db(0x08); db(0x00); db(0x00); db(0x01); db(0x67); db(0x38); db(0x74); db(0x00);
- db(0x4e); db(0xae); db(0xff); db(0x7c); db(0x41); db(0xee); db(0x01); db(0x5e);
- db(0x43); db(0xfa); db(0x00); db(0x70); db(0x4e); db(0xae); db(0xfe); db(0xec);
- db(0x4a); db(0x80); db(0x67); db(0x1e); db(0x20); db(0x40); db(0x43); db(0xfa);
- db(0x00); db(0x22); db(0x24); db(0x68); db(0xff); db(0xe4); db(0x21); db(0x49);
- db(0xff); db(0xe4); db(0x22); db(0x48); db(0x30); db(0x3c); db(0xff); db(0x38);
- db(0x72); db(0x65); db(0x61); db(0x00); db(0x00); db(0x26); db(0x4e); db(0x90);
- db(0x74); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x76); db(0x20); db(0x02);
- db(0x4e); db(0x75); db(0x59); db(0x8f); db(0x48); db(0xe7); db(0xc0); db(0x80);
- db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x66); db(0x61); db(0x00);
- db(0x00); db(0x0a); db(0x4e); db(0x90); db(0x4c); db(0xdf); db(0x01); db(0x03);
- db(0x4e); db(0x75); db(0x41); db(0xfa); db(0xe8); db(0x30); db(0x02); db(0x80);
- db(0x00); db(0x00); db(0xff); db(0xff); db(0xd1); db(0xc0); db(0x4e); db(0x75);
- db(0x69); db(0x6e); db(0x70); db(0x75); db(0x74); db(0x2e); db(0x64); db(0x65);
- db(0x76); db(0x69); db(0x63); db(0x65); db(0x00); db(0x74); db(0x69); db(0x6d);
- db(0x65); db(0x72); db(0x2e); db(0x64); db(0x65); db(0x76); db(0x69); db(0x63);
- db(0x65); db(0x00); db(0x63); db(0x6f); db(0x6e); db(0x73); db(0x6f); db(0x6c);
- db(0x65); db(0x2e); db(0x64); db(0x65); db(0x76); db(0x69); db(0x63); db(0x65);
- db(0x00); db(0x44); db(0x45); db(0x56); db(0x53); db(0x00); db(0x44); db(0x45);
- db(0x56); db(0x53); db(0x3a); db(0x00); db(0x44); db(0x45); db(0x56); db(0x53);
- db(0x3a); db(0x63); db(0x6c); db(0x69); db(0x70); db(0x62); db(0x6f); db(0x61);
- db(0x72); db(0x64); db(0x2e); db(0x64); db(0x65); db(0x76); db(0x69); db(0x63);
- db(0x65); db(0x00); db(0x52); db(0x41); db(0x4d); db(0x3a); db(0x00); db(0x63);
- db(0x6c); db(0x69); db(0x70); db(0x62); db(0x6f); db(0x61); db(0x72); db(0x64);
- db(0x2e); db(0x64); db(0x65); db(0x76); db(0x69); db(0x63); db(0x65); db(0x00);
- db(0x52); db(0x41); db(0x4d); db(0x3a); db(0x45); db(0x6e); db(0x76); db(0x2f);
- db(0x53); db(0x79); db(0x73); db(0x2f); db(0x50); db(0x6f); db(0x69); db(0x6e);
- db(0x74); db(0x65); db(0x72); db(0x2e); db(0x70); db(0x72); db(0x65); db(0x66);
- db(0x73); db(0x00); db(0x55); db(0x41); db(0x45); db(0x20); db(0x63); db(0x6c);
- db(0x69); db(0x70); db(0x62); db(0x6f); db(0x61); db(0x72); db(0x64); db(0x20);
- db(0x73); db(0x68); db(0x61); db(0x72); db(0x69); db(0x6e); db(0x67); db(0x00);
- db(0x55); db(0x41); db(0x45); db(0x20); db(0x6d); db(0x6f); db(0x75); db(0x73);
- db(0x65); db(0x20); db(0x64); db(0x72); db(0x69); db(0x76); db(0x65); db(0x72);
- db(0x00); db(0x55); db(0x41); db(0x45); db(0x20); db(0x68); db(0x65); db(0x61);
- db(0x72); db(0x74); db(0x20); db(0x62); db(0x65); db(0x61); db(0x74); db(0x00);
- db(0x55); db(0x41); db(0x45); db(0x20); db(0x66); db(0x69); db(0x6c); db(0x65);
- db(0x73); db(0x79); db(0x73); db(0x74); db(0x65); db(0x6d); db(0x00); db(0x55);
- db(0x41); db(0x45); db(0x20); db(0x66); db(0x73); db(0x20); db(0x61); db(0x75);
- db(0x74); db(0x6f); db(0x6d); db(0x6f); db(0x75); db(0x6e); db(0x74); db(0x65);
- db(0x72); db(0x00); db(0x55); db(0x41); db(0x45); db(0x20); db(0x66); db(0x73);
- db(0x20); db(0x61); db(0x75); db(0x74); db(0x6f); db(0x6d); db(0x6f); db(0x75);
- db(0x6e); db(0x74); db(0x20); db(0x70); db(0x72); db(0x6f); db(0x63); db(0x65);
- db(0x73); db(0x73); db(0x00); db(0x64); db(0x6f); db(0x73); db(0x2e); db(0x6c);
- db(0x69); db(0x62); db(0x72); db(0x61); db(0x72); db(0x79); db(0x00); db(0x69);
- db(0x6e); db(0x74); db(0x75); db(0x69); db(0x74); db(0x69); db(0x6f); db(0x6e);
- db(0x2e); db(0x6c); db(0x69); db(0x62); db(0x72); db(0x61); db(0x72); db(0x79);
- db(0x00); db(0x67); db(0x72); db(0x61); db(0x70); db(0x68); db(0x69); db(0x63);
- db(0x73); db(0x2e); db(0x6c); db(0x69); db(0x62); db(0x72); db(0x61); db(0x72);
- db(0x79); db(0x00); db(0x65); db(0x78); db(0x70); db(0x61); db(0x6e); db(0x73);
- db(0x69); db(0x6f); db(0x6e); db(0x2e); db(0x6c); db(0x69); db(0x62); db(0x72);
- db(0x61); db(0x72); db(0x79); db(0x00); db(0x46); db(0x69); db(0x6c); db(0x65);
- db(0x53); db(0x79); db(0x73); db(0x74); db(0x65); db(0x6d); db(0x2e); db(0x72);
- db(0x65); db(0x73); db(0x6f); db(0x75); db(0x72); db(0x63); db(0x65); db(0x00);
- db(0x6d); db(0x65); db(0x67); db(0x61); db(0x63); db(0x68); db(0x69); db(0x70);
- db(0x20); db(0x6d); db(0x65); db(0x6d); db(0x6f); db(0x72); db(0x79); db(0x00);
- db(0x00); db(0x00); db(0x03); db(0xf2);
+ db(0x0c); db(0xad); db(0x46); db(0x4f); db(0x52); db(0x4d); db(0x00); db(0x30);
+ db(0x66); db(0x52); db(0x20); db(0x2d); db(0x00); db(0x34); db(0x67); db(0x4c);
+ db(0x6b); db(0x4a); db(0x2b); db(0x6c); db(0x00); db(0x30); db(0x00); db(0x10);
+ db(0x50); db(0x80); db(0x24); db(0x00); db(0x72); db(0x01); db(0x4e); db(0xae);
+ db(0xff); db(0x3a); db(0x4a); db(0x80); db(0x67); db(0x36); db(0x24); db(0x40);
+ db(0x20); db(0x4a); db(0x20); db(0xed); db(0x00); db(0x30); db(0x20); db(0xed);
+ db(0x00); db(0x34); db(0x29); db(0x48); db(0x00); db(0x28); db(0x20); db(0x02);
+ db(0x51); db(0x80); db(0x29); db(0x40); db(0x00); db(0x24); db(0x22); db(0x4c);
+ db(0x4e); db(0xae); db(0xfe); db(0x38); db(0x30); db(0x3c); db(0xff); db(0x38);
+ db(0x72); db(0x0b); db(0x61); db(0x00); db(0x00); db(0xca); db(0x20); db(0x2c);
+ db(0x00); db(0x20); db(0x4e); db(0x90); db(0x22); db(0x4a); db(0x20); db(0x02);
+ db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x4a); db(0xac); db(0x00); db(0x20);
+ db(0x67); db(0x00); db(0xfe); db(0xda); db(0x41); db(0xed); db(0x00); db(0x30);
+ db(0x29); db(0x48); db(0x00); db(0x28); db(0x70); db(0x01); db(0x29); db(0x40);
+ db(0x00); db(0x24); db(0x42); db(0xac); db(0x00); db(0x20); db(0x22); db(0x4c);
+ db(0x4e); db(0xae); db(0xfe); db(0x38); db(0x60); db(0xde); db(0x41); db(0xe8);
+ db(0xff); db(0xe4); db(0x20); db(0x29); db(0x00); db(0x08); db(0xb0); db(0xa8);
+ db(0x00); db(0x10); db(0x67); db(0x1a); db(0x21); db(0x40); db(0x00); db(0x10);
+ db(0x2f); db(0x0e); db(0x2c); db(0x68); db(0x00); db(0x14); db(0x22); db(0x68);
+ db(0x00); db(0x08); db(0x70); db(0x00); db(0x08); db(0xc0); db(0x00); db(0x0d);
+ db(0x4e); db(0xae); db(0xfe); db(0xbc); db(0x2c); db(0x5f); db(0x70); db(0x00);
+ db(0x4e); db(0x75); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x74); db(0xff);
+ db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x11); db(0x61); db(0x00);
+ db(0x00); db(0x5e); db(0x4e); db(0x90); db(0x08); db(0x00); db(0x00); db(0x01);
+ db(0x67); db(0x38); db(0x74); db(0x00); db(0x4e); db(0xae); db(0xff); db(0x7c);
+ db(0x41); db(0xee); db(0x01); db(0x5e); db(0x43); db(0xfa); db(0x00); db(0x70);
+ db(0x4e); db(0xae); db(0xfe); db(0xec); db(0x4a); db(0x80); db(0x67); db(0x1e);
+ db(0x20); db(0x40); db(0x43); db(0xfa); db(0x00); db(0x22); db(0x24); db(0x68);
+ db(0xff); db(0xe4); db(0x21); db(0x49); db(0xff); db(0xe4); db(0x22); db(0x48);
+ db(0x30); db(0x3c); db(0xff); db(0x38); db(0x72); db(0x65); db(0x61); db(0x00);
+ db(0x00); db(0x26); db(0x4e); db(0x90); db(0x74); db(0x01); db(0x4e); db(0xae);
+ db(0xff); db(0x76); db(0x20); db(0x02); db(0x4e); db(0x75); db(0x59); db(0x8f);
+ db(0x48); db(0xe7); db(0xc0); db(0x80); db(0x30); db(0x3c); db(0xff); db(0x38);
+ db(0x72); db(0x66); db(0x61); db(0x00); db(0x00); db(0x0a); db(0x4e); db(0x90);
+ db(0x4c); db(0xdf); db(0x01); db(0x03); db(0x4e); db(0x75); db(0x41); db(0xfa);
+ db(0xe8); db(0x1c); db(0x02); db(0x80); db(0x00); db(0x00); db(0xff); db(0xff);
+ db(0xd1); db(0xc0); db(0x4e); db(0x75); db(0x69); db(0x6e); db(0x70); db(0x75);
+ db(0x74); db(0x2e); db(0x64); db(0x65); db(0x76); db(0x69); db(0x63); db(0x65);
+ db(0x00); db(0x74); db(0x69); db(0x6d); db(0x65); db(0x72); db(0x2e); db(0x64);
+ db(0x65); db(0x76); db(0x69); db(0x63); db(0x65); db(0x00); db(0x63); db(0x6f);
+ db(0x6e); db(0x73); db(0x6f); db(0x6c); db(0x65); db(0x2e); db(0x64); db(0x65);
+ db(0x76); db(0x69); db(0x63); db(0x65); db(0x00); db(0x44); db(0x45); db(0x56);
+ db(0x53); db(0x00); db(0x44); db(0x45); db(0x56); db(0x53); db(0x3a); db(0x00);
+ db(0x44); db(0x45); db(0x56); db(0x53); db(0x3a); db(0x63); db(0x6c); db(0x69);
+ db(0x70); db(0x62); db(0x6f); db(0x61); db(0x72); db(0x64); db(0x2e); db(0x64);
+ db(0x65); db(0x76); db(0x69); db(0x63); db(0x65); db(0x00); db(0x52); db(0x41);
+ db(0x4d); db(0x3a); db(0x00); db(0x63); db(0x6c); db(0x69); db(0x70); db(0x62);
+ db(0x6f); db(0x61); db(0x72); db(0x64); db(0x2e); db(0x64); db(0x65); db(0x76);
+ db(0x69); db(0x63); db(0x65); db(0x00); db(0x52); db(0x41); db(0x4d); db(0x3a);
+ db(0x45); db(0x6e); db(0x76); db(0x2f); db(0x53); db(0x79); db(0x73); db(0x2f);
+ db(0x50); db(0x6f); db(0x69); db(0x6e); db(0x74); db(0x65); db(0x72); db(0x2e);
+ db(0x70); db(0x72); db(0x65); db(0x66); db(0x73); db(0x00); db(0x55); db(0x41);
+ db(0x45); db(0x20); db(0x63); db(0x6c); db(0x69); db(0x70); db(0x62); db(0x6f);
+ db(0x61); db(0x72); db(0x64); db(0x20); db(0x73); db(0x68); db(0x61); db(0x72);
+ db(0x69); db(0x6e); db(0x67); db(0x00); db(0x55); db(0x41); db(0x45); db(0x20);
+ db(0x6d); db(0x6f); db(0x75); db(0x73); db(0x65); db(0x20); db(0x64); db(0x72);
+ db(0x69); db(0x76); db(0x65); db(0x72); db(0x00); db(0x55); db(0x41); db(0x45);
+ db(0x20); db(0x68); db(0x65); db(0x61); db(0x72); db(0x74); db(0x20); db(0x62);
+ db(0x65); db(0x61); db(0x74); db(0x00); db(0x55); db(0x41); db(0x45); db(0x20);
+ db(0x66); db(0x69); db(0x6c); db(0x65); db(0x73); db(0x79); db(0x73); db(0x74);
+ db(0x65); db(0x6d); db(0x00); db(0x55); db(0x41); db(0x45); db(0x20); db(0x66);
+ db(0x73); db(0x20); db(0x61); db(0x75); db(0x74); db(0x6f); db(0x6d); db(0x6f);
+ db(0x75); db(0x6e); db(0x74); db(0x65); db(0x72); db(0x00); db(0x55); db(0x41);
+ db(0x45); db(0x20); db(0x66); db(0x73); db(0x20); db(0x61); db(0x75); db(0x74);
+ db(0x6f); db(0x6d); db(0x6f); db(0x75); db(0x6e); db(0x74); db(0x20); db(0x70);
+ db(0x72); db(0x6f); db(0x63); db(0x65); db(0x73); db(0x73); db(0x00); db(0x64);
+ db(0x6f); db(0x73); db(0x2e); db(0x6c); db(0x69); db(0x62); db(0x72); db(0x61);
+ db(0x72); db(0x79); db(0x00); db(0x69); db(0x6e); db(0x74); db(0x75); db(0x69);
+ db(0x74); db(0x69); db(0x6f); db(0x6e); db(0x2e); db(0x6c); db(0x69); db(0x62);
+ db(0x72); db(0x61); db(0x72); db(0x79); db(0x00); db(0x67); db(0x72); db(0x61);
+ db(0x70); db(0x68); db(0x69); db(0x63); db(0x73); db(0x2e); db(0x6c); db(0x69);
+ db(0x62); db(0x72); db(0x61); db(0x72); db(0x79); db(0x00); db(0x65); db(0x78);
+ db(0x70); db(0x61); db(0x6e); db(0x73); db(0x69); db(0x6f); db(0x6e); db(0x2e);
+ db(0x6c); db(0x69); db(0x62); db(0x72); db(0x61); db(0x72); db(0x79); db(0x00);
+ db(0x46); db(0x69); db(0x6c); db(0x65); db(0x53); db(0x79); db(0x73); db(0x74);
+ db(0x65); db(0x6d); db(0x2e); db(0x72); db(0x65); db(0x73); db(0x6f); db(0x75);
+ db(0x72); db(0x63); db(0x65); db(0x00); db(0x6d); db(0x65); db(0x67); db(0x61);
+ db(0x63); db(0x68); db(0x69); db(0x70); db(0x20); db(0x6d); db(0x65); db(0x6d);
+ db(0x6f); db(0x72); db(0x79); db(0x00); db(0x00); db(0x00); db(0x03); db(0xf2);
 
diff --git a/fpp.cpp b/fpp.cpp
index 845f7e757a58aa0b069a18f4d5a78ac97c3653bd..edb66e68fa50324e8ca76a7dad361bcdbbb43b52 100644 (file)
--- a/fpp.cpp
+++ b/fpp.cpp
@@ -25,6 +25,8 @@
 #include "savestate.h"
 #include "cpu_prefetch.h"
 #include "cpummu.h"
+#include "cpummu030.h"
+#include "debug.h"
 
 #define DEBUG_FPP 0
 
@@ -119,7 +121,7 @@ static __inline__ void native_set_fpucw (uae_u32 m68k_cw)
        static int ex = 0;
        // RN, RZ, RM, RP
        static unsigned int fp87_round[4] = { _RC_NEAR, _RC_CHOP, _RC_DOWN, _RC_UP };
-       // X, S, D, U
+       // Extend X, Single S, Double D, Undefined
        static unsigned int fp87_prec[4] = { _PC_64 , _PC_24 , _PC_53, 0 };
        
 #if 0
@@ -164,6 +166,29 @@ typedef uae_s64 tointtype;
 typedef uae_s32 tointtype;
 #endif
 
+static void fpu_format_error (void)
+{
+       uaecptr newpc;
+       regs.t0 = regs.t1 = 0;
+       MakeSR ();
+       if (!regs.s) {
+               regs.usp = m68k_areg (regs, 7);
+               m68k_areg (regs, 7) = regs.isp;
+       }
+       regs.s = 1;
+       m68k_areg (regs, 7) -= 2;
+       x_put_long (m68k_areg (regs, 7), 0x0000 + 14 * 4);
+       m68k_areg (regs, 7) -= 4;
+       x_put_long (m68k_areg (regs, 7), m68k_getpc ());
+       m68k_areg (regs, 7) -= 2;
+       x_put_long (m68k_areg (regs, 7), regs.sr);
+       newpc = x_get_long (regs.vbr + 14 * 4);
+       m68k_setpc (newpc);
+#ifdef JIT
+       set_special (SPCFLAG_END_COMPILE);
+#endif
+}
+
 static void fpu_op_illg (uae_u32 opcode, int pcoffset)
 {
        if ((currprefs.cpu_model == 68060 && (currprefs.fpu_model == 0 || (regs.pcr & 2)))
@@ -184,11 +209,11 @@ static void fpu_op_illg (uae_u32 opcode, int pcoffset)
                        m68k_areg (regs, 7) -= 4;
                        x_put_long (m68k_areg (regs, 7), oldpc);
                        m68k_areg (regs, 7) -= 2;
-                       x_put_word (m68k_areg (regs, 7), 0x4000 + 11 * 4);
+                       x_put_long (m68k_areg (regs, 7), 0x4000 + 11 * 4);
                        m68k_areg (regs, 7) -= 4;
                        x_put_long (m68k_areg (regs, 7), newpc);
                        m68k_areg (regs, 7) -= 2;
-                       x_put_word (m68k_areg (regs, 7), regs.sr);
+                       x_put_long (m68k_areg (regs, 7), regs.sr);
                        write_log (_T("68040/060 FPU disabled exception PC=%x\n"), newpc);
                        newpc = x_get_long (regs.vbr + 11 * 4);
                        m68k_setpc (newpc);
@@ -230,6 +255,18 @@ static int get_fpu_version (void)
        return v;
 }
 
+static void fpu_null (void)
+{
+       regs.fpu_state = 0;
+       regs.fpcr = 0;
+       regs.fpsr = 0;
+       regs.fpiar = 0;
+       regs.fpsr_highbyte = 0;
+       regs.fp_result = 0;
+       for (int i = 0; i < 8; i++)
+               regs.fp[i] = 0;
+}
+
 #define fp_round_to_minus_infinity(x) fp_floor(x)
 #define fp_round_to_plus_infinity(x) fp_ceil(x)
 #define fp_round_to_zero(x)    ((x) >= 0.0 ? floor(x) : ceil(x))
@@ -411,8 +448,6 @@ STATIC_INLINE void from_pack (fptype src, uae_u32 * wrd1, uae_u32 * wrd2, uae_u3
 
 STATIC_INLINE int get_fp_value (uae_u32 opcode, uae_u16 extra, fptype *src)
 {
-       uaecptr tmppc;
-       uae_u16 tmp;
        int size, mode, reg;
        uae_u32 ad = 0;
        static const int sz1[8] = { 4, 4, 12, 12, 2, 8, 1, 0 };
@@ -428,21 +463,22 @@ STATIC_INLINE int get_fp_value (uae_u32 opcode, uae_u16 extra, fptype *src)
 
        switch (mode) {
                case 0:
-                       switch (size) {
-               case 6:
-                       *src = (fptype) (uae_s8) m68k_dreg (regs, reg);
-                       break;
-               case 4:
-                       *src = (fptype) (uae_s16) m68k_dreg (regs, reg);
-                       break;
-               case 0:
-                       *src = (fptype) (uae_s32) m68k_dreg (regs, reg);
-                       break;
-               case 1:
-                       *src = to_single (m68k_dreg (regs, reg));
-                       break;
-               default:
-                       return 0;
+                       switch (size)
+                       {
+                               case 6:
+                                       *src = (fptype) (uae_s8) m68k_dreg (regs, reg);
+                                       break;
+                               case 4:
+                                       *src = (fptype) (uae_s16) m68k_dreg (regs, reg);
+                                       break;
+                               case 0:
+                                       *src = (fptype) (uae_s32) m68k_dreg (regs, reg);
+                                       break;
+                               case 1:
+                                       *src = to_single (m68k_dreg (regs, reg));
+                                       break;
+                               default:
+                                       return 0;
                        }
                        return 1;
                case 1:
@@ -462,75 +498,78 @@ STATIC_INLINE int get_fp_value (uae_u32 opcode, uae_u16 extra, fptype *src)
                        ad = m68k_areg (regs, reg) + (uae_s32) (uae_s16) x_next_iword ();
                        break;
                case 6:
-                       ad = x_get_disp_ea_020 (m68k_areg (regs, reg), x_next_iword ());
+                       ad = x_cp_get_disp_ea_020 (m68k_areg (regs, reg), 0);
                        break;
                case 7:
-                       switch (reg) {
+                       switch (reg)
+                       {
+                               case 0:
+                                       ad = (uae_s32) (uae_s16) x_next_iword ();
+                                       break;
+                               case 1:
+                                       ad = x_next_ilong ();
+                                       break;
+                               case 2:
+                                       ad = m68k_getpc ();
+                                       ad += (uae_s32) (uae_s16) x_next_iword ();
+                                       break;
+                               case 3:
+                                       ad = x_cp_get_disp_ea_020 (m68k_getpc (), 0);
+                                       break;
+                               case 4:
+                                       ad = m68k_getpc ();
+                                       m68k_setpc (ad + sz2[size]);
+                                       if (size == 6)
+                                               ad++;
+                                       break;
+                               default:
+                                       return 0;
+                       }
+       }
+       switch (size)
+       {
                case 0:
-                       ad = (uae_s32) (uae_s16) x_next_iword ();
+                       *src = (fptype) (uae_s32) x_cp_get_long (ad);
                        break;
                case 1:
-                       ad = x_next_ilong ();
+                       *src = to_single (x_cp_get_long (ad));
                        break;
                case 2:
-                       ad = m68k_getpc ();
-                       ad += (uae_s32) (uae_s16) x_next_iword ();
+                       {
+                               uae_u32 wrd1, wrd2, wrd3;
+                               wrd1 = x_cp_get_long (ad);
+                               ad += 4;
+                               wrd2 = x_cp_get_long (ad);
+                               ad += 4;
+                               wrd3 = x_cp_get_long (ad);
+                               *src = to_exten (wrd1, wrd2, wrd3);
+                       }
                        break;
                case 3:
-                       tmppc = m68k_getpc ();
-                       tmp = x_next_iword ();
-                       ad = x_get_disp_ea_020 (tmppc, tmp);
+                       {
+                               uae_u32 wrd1, wrd2, wrd3;
+                               wrd1 = x_cp_get_long (ad);
+                               ad += 4;
+                               wrd2 = x_cp_get_long (ad);
+                               ad += 4;
+                               wrd3 = x_cp_get_long (ad);
+                               *src = to_pack (wrd1, wrd2, wrd3);
+                       }
                        break;
                case 4:
-                       ad = m68k_getpc ();
-                       m68k_setpc (ad + sz2[size]);
-                       if (size == 6)
-                               ad++;
+                       *src = (fptype) (uae_s16) x_cp_get_word (ad);
                        break;
-               default:
-                       return 0;
+               case 5:
+                       {
+                               uae_u32 wrd1, wrd2;
+                               wrd1 = x_cp_get_long (ad);
+                               ad += 4;
+                               wrd2 = x_cp_get_long (ad);
+                               *src = to_double (wrd1, wrd2);
                        }
-       }
-       switch (size) {
-               case 0:
-                       *src = (fptype) (uae_s32) x_get_long (ad);
-                       break;
-               case 1:
-                       *src = to_single (x_get_long (ad));
                        break;
-               case 2:{
-                       uae_u32 wrd1, wrd2, wrd3;
-                       wrd1 = x_get_long (ad);
-                       ad += 4;
-                       wrd2 = x_get_long (ad);
-                       ad += 4;
-                       wrd3 = x_get_long (ad);
-                       *src = to_exten (wrd1, wrd2, wrd3);
-                          }
-                          break;
-               case 3:{
-                       uae_u32 wrd1, wrd2, wrd3;
-                       wrd1 = x_get_long (ad);
-                       ad += 4;
-                       wrd2 = x_get_long (ad);
-                       ad += 4;
-                       wrd3 = x_get_long (ad);
-                       *src = to_pack (wrd1, wrd2, wrd3);
-                          }
-                          break;
-               case 4:
-                       *src = (fptype) (uae_s16) x_get_word (ad);
-                       break;
-               case 5:{
-                       uae_u32 wrd1, wrd2;
-                       wrd1 = x_get_long (ad);
-                       ad += 4;
-                       wrd2 = x_get_long (ad);
-                       *src = to_double (wrd1, wrd2);
-                          }
-                          break;
                case 6:
-                       *src = (fptype) (uae_s8) x_get_byte (ad);
+                       *src = (fptype) (uae_s8) x_cp_get_byte (ad);
                        break;
                default:
                        return 0;
@@ -540,8 +579,6 @@ STATIC_INLINE int get_fp_value (uae_u32 opcode, uae_u16 extra, fptype *src)
 
 STATIC_INLINE int put_fp_value (fptype value, uae_u32 opcode, uae_u16 extra)
 {
-       uae_u16 tmp;
-       uaecptr tmppc;
        int size, mode, reg;
        uae_u32 ad;
        static int sz1[8] = { 4, 4, 12, 12, 2, 8, 1, 0 };
@@ -559,25 +596,27 @@ STATIC_INLINE int put_fp_value (fptype value, uae_u32 opcode, uae_u16 extra)
        mode = (opcode >> 3) & 7;
        size = (extra >> 10) & 7;
        ad = -1;
-       switch (mode) {
-               case 0:
-                       switch (size) {
-               case 6:
-                       m68k_dreg (regs, reg) = (uae_u32)(((toint (value, -128.0, 127.0) & 0xff)
-                               | (m68k_dreg (regs, reg) & ~0xff)));
-                       break;
-               case 4:
-                       m68k_dreg (regs, reg) = (uae_u32)(((toint (value, -32768.0, 32767.0) & 0xffff)
-                               | (m68k_dreg (regs, reg) & ~0xffff)));
-                       break;
+       switch (mode)
+       {
                case 0:
-                       m68k_dreg (regs, reg) = (uae_u32)toint (value, -2147483648.0, 2147483647.0);
-                       break;
-               case 1:
-                       m68k_dreg (regs, reg) = from_single (value);
-                       break;
-               default:
-                       return 0;
+                       switch (size)
+                       {
+                               case 6:
+                                       m68k_dreg (regs, reg) = (uae_u32)(((toint (value, -128.0, 127.0) & 0xff)
+                                               | (m68k_dreg (regs, reg) & ~0xff)));
+                                       break;
+                               case 4:
+                                       m68k_dreg (regs, reg) = (uae_u32)(((toint (value, -32768.0, 32767.0) & 0xffff)
+                                               | (m68k_dreg (regs, reg) & ~0xffff)));
+                                       break;
+                               case 0:
+                                       m68k_dreg (regs, reg) = (uae_u32)toint (value, -2147483648.0, 2147483647.0);
+                                       break;
+                               case 1:
+                                       m68k_dreg (regs, reg) = from_single (value);
+                                       break;
+                               default:
+                                       return 0;
                        }
                        return 1;
                case 1:
@@ -597,75 +636,76 @@ STATIC_INLINE int put_fp_value (fptype value, uae_u32 opcode, uae_u16 extra)
                        ad = m68k_areg (regs, reg) + (uae_s32) (uae_s16) x_next_iword ();
                        break;
                case 6:
-                       ad = x_get_disp_ea_020 (m68k_areg (regs, reg), x_next_iword ());
+                       ad = x_cp_get_disp_ea_020 (m68k_areg (regs, reg), 0);
                        break;
                case 7:
-                       switch (reg) {
-               case 0:
-                       ad = (uae_s32) (uae_s16) x_next_iword ();
-                       break;
-               case 1:
-                       ad = x_next_ilong ();
-                       break;
-               case 2:
-                       ad = m68k_getpc ();
-                       ad += (uae_s32) (uae_s16) x_next_iword ();
-                       break;
-               case 3:
-                       tmppc = m68k_getpc ();
-                       tmp = x_next_iword ();
-                       ad = x_get_disp_ea_020 (tmppc, tmp);
-                       break;
-               case 4:
-                       ad = m68k_getpc ();
-                       m68k_setpc (ad + sz2[size]);
-                       break;
-               default:
-                       return 0;
+                       switch (reg)
+                       {
+                               case 0:
+                                       ad = (uae_s32) (uae_s16) x_next_iword ();
+                                       break;
+                               case 1:
+                                       ad = x_next_ilong ();
+                                       break;
+                               case 2:
+                                       ad = m68k_getpc ();
+                                       ad += (uae_s32) (uae_s16) x_next_iword ();
+                                       break;
+                               case 3:
+                                       ad = x_cp_get_disp_ea_020 (m68k_getpc (), 0);
+                                       break;
+                               case 4:
+                                       ad = m68k_getpc ();
+                                       m68k_setpc (ad + sz2[size]);
+                                       break;
+                               default:
+                                       return 0;
                        }
        }
-       switch (size) {
+       switch (size)
+       {
                case 0:
-                       x_put_long (ad, (uae_u32)toint (value, -2147483648.0, 2147483647.0));
+                       x_cp_put_long (ad, (uae_u32)toint (value, -2147483648.0, 2147483647.0));
                        break;
                case 1:
-                       x_put_long (ad, from_single (value));
+                       x_cp_put_long (ad, from_single (value));
                        break;
                case 2:
                        {
                                uae_u32 wrd1, wrd2, wrd3;
                                from_exten (value, &wrd1, &wrd2, &wrd3);
-                               x_put_long (ad, wrd1);
+                               x_cp_put_long (ad, wrd1);
                                ad += 4;
-                               x_put_long (ad, wrd2);
+                               x_cp_put_long (ad, wrd2);
                                ad += 4;
-                               x_put_long (ad, wrd3);
+                               x_cp_put_long (ad, wrd3);
                        }
                        break;
                case 3:
                        {
                                uae_u32 wrd1, wrd2, wrd3;
                                from_pack (value, &wrd1, &wrd2, &wrd3);
-                               x_put_long (ad, wrd1);
+                               x_cp_put_long (ad, wrd1);
                                ad += 4;
-                               x_put_long (ad, wrd2);
+                               x_cp_put_long (ad, wrd2);
                                ad += 4;
-                               x_put_long (ad, wrd3);
+                               x_cp_put_long (ad, wrd3);
                        }
                        break;
                case 4:
-                       x_put_word (ad, (uae_s16) toint (value, -32768.0, 32767.0));
+                       x_cp_put_word (ad, (uae_s16) toint (value, -32768.0, 32767.0));
+                       break;
+               case 5:
+                       {
+                               uae_u32 wrd1, wrd2;
+                               from_double (value, &wrd1, &wrd2);
+                               x_cp_put_long (ad, wrd1);
+                               ad += 4;
+                               x_cp_put_long (ad, wrd2);
+                       }
                        break;
-               case 5:{
-                       uae_u32 wrd1, wrd2;
-                       from_double (value, &wrd1, &wrd2);
-                       x_put_long (ad, wrd1);
-                       ad += 4;
-                       x_put_long (ad, wrd2);
-                          }
-                          break;
                case 6:
-                       x_put_byte (ad, (uae_s8)toint (value, -128.0, 127.0));
+                       x_cp_put_byte (ad, (uae_s8)toint (value, -128.0, 127.0));
                        break;
                default:
                        return 0;
@@ -675,14 +715,13 @@ STATIC_INLINE int put_fp_value (fptype value, uae_u32 opcode, uae_u16 extra)
 
 STATIC_INLINE int get_fp_ad (uae_u32 opcode, uae_u32 * ad)
 {
-       uae_u16 tmp;
-       uaecptr tmppc;
        int mode;
        int reg;
 
        mode = (opcode >> 3) & 7;
        reg = opcode & 7;
-       switch (mode) {
+       switch (mode)
+       {
                case 0:
                case 1:
                        return 0;
@@ -699,27 +738,26 @@ STATIC_INLINE int get_fp_ad (uae_u32 opcode, uae_u32 * ad)
                        *ad = m68k_areg (regs, reg) + (uae_s32) (uae_s16) x_next_iword ();
                        break;
                case 6:
-                       *ad = x_get_disp_ea_020 (m68k_areg (regs, reg), x_next_iword ());
+                       *ad = x_cp_get_disp_ea_020 (m68k_areg (regs, reg), 0);
                        break;
                case 7:
-                       switch (reg) {
-               case 0:
-                       *ad = (uae_s32) (uae_s16) x_next_iword ();
-                       break;
-               case 1:
-                       *ad = x_next_ilong ();
-                       break;
-               case 2:
-                       *ad = m68k_getpc ();
-                       *ad += (uae_s32) (uae_s16) x_next_iword ();
-                       break;
-               case 3:
-                       tmppc = m68k_getpc ();
-                       tmp = x_next_iword ();
-                       *ad = x_get_disp_ea_020 (tmppc, tmp);
-                       break;
-               default:
-                       return 0;
+                       switch (reg)
+                       {
+                               case 0:
+                                       *ad = (uae_s32) (uae_s16) x_next_iword ();
+                                       break;
+                               case 1:
+                                       *ad = x_next_ilong ();
+                                       break;
+                               case 2:
+                                       *ad = m68k_getpc ();
+                                       *ad += (uae_s32) (uae_s16) x_next_iword ();
+                                       break;
+                               case 3:
+                                       *ad = x_cp_get_disp_ea_020 (m68k_getpc (), 0);
+                                       break;
+                               default:
+                                       return 0;
                        }
        }
        return 1;
@@ -738,7 +776,8 @@ STATIC_INLINE int fpp_cond (int condition)
        if (NotANumber)
                N=Z=0;
 
-       switch (condition) {
+       switch (condition)
+       {
                case 0x00:
                        return 0;
                case 0x01:
@@ -858,7 +897,7 @@ void fpuop_scc (uae_u32 opcode, uae_u16 extra)
                        m68k_setpc (m68k_getpc () - 4);
                        op_illg (opcode);
                } else
-                       x_put_byte (ad, cc ? 0xff : 0x00);
+                       x_cp_put_byte (ad, cc ? 0xff : 0x00);
        }
 }
 
@@ -910,7 +949,7 @@ void fpuop_save (uae_u32 opcode)
 {
        uae_u32 ad;
        int incr = (opcode & 0x38) == 0x20 ? -1 : 1;
-       int fpu_version = get_fpu_version();
+       int fpu_version = get_fpu_version ();
        uaecptr pc = m68k_getpc () - 2;
        int i;
 
@@ -926,59 +965,87 @@ void fpuop_save (uae_u32 opcode)
                return;
        }
 
-//     if (regs.fpcr == 0 && regs.fpsr == 0 && regs.fpiar == 0 &&
-//             regs.fp[0] == 
-
        regs.fpiar = pc;
 
        if (currprefs.fpu_model == 68060) {
-               /* 12 byte 68060 IDLE frame.  */
+               /* 12 byte 68060 NULL/IDLE frame.  */
+               uae_u32 frame_id = regs.fpu_state == 0 ? 0x00000000 : 0x00006000;
                if (incr < 0) {
                        ad -= 4;
-                       x_put_long (ad, 0x00000000);
+                       x_cp_put_long (ad, 0x00000000);
                        ad -= 4;
-                       x_put_long (ad, 0x00000000);
+                       x_cp_put_long (ad, 0x00000000);
                        ad -= 4;
-                       x_put_long (ad, 0x00006000);
+                       x_cp_put_long (ad, frame_id);
                } else {
-                       x_put_long (ad, 0x00006000);
+                       x_cp_put_long (ad, frame_id);
                        ad += 4;
-                       x_put_long (ad, 0x00000000);
+                       x_cp_put_long (ad, 0x00000000);
                        ad += 4;
-                       x_put_long (ad, 0x00000000);
+                       x_cp_put_long (ad, 0x00000000);
                        ad += 4;
                }
        } else if (currprefs.fpu_model == 68040) {
-               /* 4 byte 68040 IDLE frame.  */
+               /* 4 byte 68040 NULL/IDLE frame.  */
+               uae_u32 frame_id = regs.fpu_state == 0 ? 0 : fpu_version << 24;
                if (incr < 0) {
                        ad -= 4;
-                       x_put_long (ad, fpu_version << 24);
+                       x_cp_put_long (ad, frame_id);
                } else {
-                       x_put_long (ad, fpu_version << 24);
+                       x_cp_put_long (ad, frame_id);
                        ad += 4;
                }
        } else { /* 68881/68882 */
-               int idle_size = currprefs.fpu_model == 68882 ? 0x38 : 0x18;
-               if (incr < 0) {
-                       ad -= 4;
-                       x_put_long (ad, 0x70000000);
-                       for (i = 0; i < (idle_size - 1) / 4; i++) {
+               int frame_size = regs.fpu_state == 0 ? 0 : currprefs.fpu_model == 68882 ? 0x3c : 0x1c;
+               uae_u32 frame_id = regs.fpu_state == 0 ? 0x18 << 16 : (fpu_version << 24) | ((frame_size - 4) << 16);
+               
+               if (currprefs.mmu_model) {
+                       if (incr < 0) {
+                               for (i = 0; i < (frame_size / 4) - 1; i++) {
+                                       ad -= 4;
+                                       if (mmu030_state[0] == i) {
+                                               x_put_long (ad, i == 0 ? 0x70000000 : 0x00000000);
+                                               mmu030_state[0]++;
+                                       }
+                               }
                                ad -= 4;
-                               x_put_long (ad, 0x00000000);
+                               if (mmu030_state[0] == (frame_size / 4) - 1 || (mmu030_state[0] == 0 && frame_size == 0)) {
+                                       x_put_long (ad, frame_id);
+                                       mmu030_state[0]++;
+                               }
+                       } else {
+                               if (mmu030_state[0] == 0) {
+                                       x_put_long (ad, frame_id);
+                                       mmu030_state[0]++;
+                               }
+                               ad += 4;
+                               for (i = 0; i < (frame_size / 4) - 1; i++) {
+                                       if (mmu030_state[0] == i + 1) {
+                                               x_put_long (ad, i == (frame_size / 4) - 2 ? 0x70000000 : 0x00000000);
+                                               mmu030_state[0]++;
+                                       }
+                                       ad += 4;
+                               }
                        }
-                       ad -= 4;
-                       x_put_long (ad, (fpu_version << 24) | (idle_size << 16));
                } else {
-                       x_put_long (ad, (fpu_version << 24) | (idle_size << 16));
-                       ad += 4;
-                       for (i = 0; i < (idle_size - 1) / 4; i++) {
-                               x_put_long (ad, 0x00000000);
+                       if (incr < 0) {
+                               for (i = 0; i < (frame_size / 4) - 1; i++) {
+                                       ad -= 4;
+                                       x_cp_put_long (ad, i == 0 ? 0x70000000 : 0x00000000);
+                               }
+                               ad -= 4;
+                               x_cp_put_long (ad, frame_id);
+                       } else {
+                               x_cp_put_long (ad, frame_id);
                                ad += 4;
+                               for (i = 0; i < (frame_size / 4) - 1; i++) {
+                                       x_cp_put_long (ad, i == (frame_size / 4) - 2 ? 0x70000000 : 0x00000000);
+                                       ad += 4;
+                               }
                        }
-                       x_put_long (ad, 0x70000000);
-                       ad += 4;
                }
        }
+
        if ((opcode & 0x38) == 0x18)
                m68k_areg (regs, opcode & 7) = ad;
        if ((opcode & 0x38) == 0x20)
@@ -987,6 +1054,7 @@ void fpuop_save (uae_u32 opcode)
 
 void fpuop_restore (uae_u32 opcode)
 {
+       int fpu_version = get_fpu_version ();
        uaecptr pc = m68k_getpc () - 2;
        uae_u32 ad;
        uae_u32 d;
@@ -1005,79 +1073,223 @@ void fpuop_restore (uae_u32 opcode)
        }
 
        regs.fpiar = pc;
+       uae_u32 pad = ad;
+       if (incr < 0) {
+               ad -= 4;
+               d = x_cp_get_long (ad);
+       } else {
+               d = x_cp_get_long (ad);
+               ad += 4;
+       }
 
        if (currprefs.fpu_model == 68060) {
-               /* all 68060 FPU frames are 12 bytes */
-               if (incr < 0) {
-                       ad -= 4;
-                       d = x_get_long (ad);
-                       ad -= 8;
+               if ((d & 0x0000ff00) != 0) {
+                       regs.fpu_state = 1;
                } else {
-                       d = x_get_long (ad);
-                       ad += 4;
+                       fpu_null ();
+               }
+               if (incr < 0)
+                       ad -= 8;
+               else
                        ad += 8;
+       } else {
+               if ((d & 0xff000000) != 0) {
+                       regs.fpu_state = 1;
+                       if (incr < 0)
+                               ad -= (d >> 16) & 0xff;
+                       else
+                               ad += (d >> 16) & 0xff;
+               } else {
+                       fpu_null ();
                }
+       }
 
-       } else if (currprefs.fpu_model == 68040) {
-               /* 68040 */
+       if ((opcode & 0x38) == 0x18)
+               m68k_areg (regs, opcode & 7) = ad;
+       if ((opcode & 0x38) == 0x20)
+               m68k_areg (regs, opcode & 7) = ad;
+}
+
+static void fround (int reg)
+{
+       regs.fp[reg] = (float)regs.fp[reg];
+}
+
+static uaecptr fmovem2mem (uaecptr ad, uae_u32 list, int incr)
+{
+       int reg;
+       // 68030 MMU state saving is annoying!
+       if (currprefs.mmu_model) {
+               int idx = 0;
                if (incr < 0) {
-                       /* @@@ This may be wrong.  */
-                       ad -= 4;
-                       d = x_get_long (ad);
-                       if ((d & 0xff000000) != 0) { /* Not a NULL frame? */
-                               if ((d & 0x00ff0000) == 0) { /* IDLE */
-                               } else if ((d & 0x00ff0000) == 0x00300000) { /* UNIMP */
-                                       ad -= 44;
-                               } else if ((d & 0x00ff0000) == 0x00600000) { /* BUSY */
-                                       ad -= 92;
+                       for (reg = 7; reg >= 0; reg--) {
+                               uae_u32 wrd1, wrd2, wrd3;
+                               if (list & 0x80) {
+                                       from_exten (regs.fp[reg], &wrd1, &wrd2, &wrd3);
+                                       ad -= 4;
+                                       if (mmu030_state[0] == idx * 3 + 0) {
+                                               x_put_long (ad, wrd3);
+                                               mmu030_state[0]++;
+                                       }
+                                       ad -= 4;
+                                       if (mmu030_state[0] == idx * 3 + 1) {
+                                               x_put_long (ad, wrd2);
+                                               mmu030_state[0]++;
+                                       }
+                                       ad -= 4;
+                                       if (mmu030_state[0] == idx * 3 + 2) {
+                                               x_put_long (ad, wrd1);
+                                               mmu030_state[0]++;
+                                       }
+                                       idx++;
                                }
+                               list <<= 1;
                        }
                } else {
-                       d = x_get_long (ad);
-                       ad += 4;
-                       if ((d & 0xff000000) != 0) { /* Not a NULL frame? */
-                               if ((d & 0x00ff0000) == 0) { /* IDLE */
-                               } else if ((d & 0x00ff0000) == 0x00300000) { /* UNIMP */
-                                       ad += 44;
-                               } else if ((d & 0x00ff0000) == 0x00600000) { /* BUSY */
-                                       ad += 92;
+                       for (reg = 0; reg <= 7; reg++) {
+                               uae_u32 wrd1, wrd2, wrd3;
+                               if (list & 0x80) {
+                                       from_exten (regs.fp[reg], &wrd1, &wrd2, &wrd3);
+                                       if (mmu030_state[0] == idx * 3 + 0) {
+                                               x_put_long (ad, wrd1);
+                                               mmu030_state[0]++;
+                                       }
+                                       ad += 4;
+                                       if (mmu030_state[0] == idx * 3 + 1) {
+                                               x_put_long (ad, wrd2);
+                                               mmu030_state[0]++;
+                                       }
+                                       ad += 4;
+                                       if (mmu030_state[0] == idx * 3 + 2) {
+                                               x_put_long (ad, wrd3);
+                                               mmu030_state[0]++;
+                                       }
+                                       ad += 4;
+                                       idx++;
                                }
+                               list <<= 1;
                        }
                }
-       } else { /* 68881/68882 */
+       } else {
                if (incr < 0) {
-                       ad -= 4;
-                       d = x_get_long (ad);
-                       if ((d & 0xff000000) != 0) {
-                               if ((d & 0x00ff0000) == 0x00180000)
-                                       ad -= 6 * 4;
-                               else if ((d & 0x00ff0000) == 0x00380000)
-                                       ad -= 14 * 4;
-                               else if ((d & 0x00ff0000) == 0x00b40000)
-                                       ad -= 45 * 4;
+                       for (reg = 7; reg >= 0; reg--) {
+                               uae_u32 wrd1, wrd2, wrd3;
+                               if (list & 0x80) {
+                                       from_exten (regs.fp[reg], &wrd1, &wrd2, &wrd3);
+                                       ad -= 4;
+                                       x_cp_put_long (ad, wrd3);
+                                       ad -= 4;
+                                       x_cp_put_long (ad, wrd2);
+                                       ad -= 4;
+                                       x_cp_put_long (ad, wrd1);
+                               }
+                               list <<= 1;
                        }
                } else {
-                       d = x_get_long (ad);
-                       ad += 4;
-                       if ((d & 0xff000000) != 0) {
-                               if ((d & 0x00ff0000) == 0x00180000)
-                                       ad += 6 * 4;
-                               else if ((d & 0x00ff0000) == 0x00380000)
-                                       ad += 14 * 4;
-                               else if ((d & 0x00ff0000) == 0x00b40000)
-                                       ad += 45 * 4;
+                       for (reg = 0; reg <= 7; reg++) {
+                               uae_u32 wrd1, wrd2, wrd3;
+                               if (list & 0x80) {
+                                       from_exten (regs.fp[reg], &wrd1, &wrd2, &wrd3);
+                                       x_cp_put_long (ad, wrd1);
+                                       ad += 4;
+                                       x_cp_put_long (ad, wrd2);
+                                       ad += 4;
+                                       x_cp_put_long (ad, wrd3);
+                                       ad += 4;
+                               }
+                                       list <<= 1;
                        }
                }
        }
-       if ((opcode & 0x38) == 0x18)
-               m68k_areg (regs, opcode & 7) = ad;
-       if ((opcode & 0x38) == 0x20)
-               m68k_areg (regs, opcode & 7) = ad;
+       return ad;
 }
 
-static void fround (int reg)
+static uaecptr fmovem2fpp (uaecptr ad, uae_u32 list, int incr)
 {
-       regs.fp[reg] = (float)regs.fp[reg];
+       int reg;
+       if (currprefs.mmu_model) {
+               int idx = 0;
+               if (incr < 0) {
+                       for (reg = 7; reg >= 0; reg--) {
+                               uae_u32 wrd1, wrd2, wrd3;
+                               if (list & 0x80) {
+                                       ad -= 4;
+                                       if (mmu030_state[0] == idx * 3 + 0) {
+                                               wrd3 = x_get_long (ad);
+                                               mmu030_state[0]++;
+                                       }
+                                       ad -= 4;
+                                       if (mmu030_state[0] == idx * 3 + 1) {
+                                               wrd2 = x_get_long (ad);
+                                               mmu030_state[0]++;
+                                       }
+                                       ad -= 4;
+                                       if (mmu030_state[0] == idx * 3 + 2) {
+                                               wrd1 = x_get_long (ad);
+                                               mmu030_state[0]++;
+                                       }
+                                       regs.fp[reg] = to_exten(wrd1, wrd2, wrd3);
+                                       idx++;
+                               }
+                               list <<= 1;
+                       }
+               } else {
+                       for (reg = 0; reg <= 7; reg++) {
+                               uae_u32 wrd1, wrd2, wrd3;
+                               if (list & 0x80) {
+                                       if (mmu030_state[0] == idx * 3 + 0) {
+                                               wrd1 = x_get_long (ad);
+                                               mmu030_state[0]++;
+                                       }
+                                       ad += 4;
+                                       if (mmu030_state[0] == idx * 3 + 1) {
+                                               wrd2 = x_get_long (ad);
+                                               mmu030_state[0]++;
+                                       }
+                                       ad += 4;
+                                       if (mmu030_state[0] == idx * 3 + 2) {
+                                               wrd3 = x_get_long (ad);
+                                               mmu030_state[0]++;
+                                       }
+                                       ad += 4;
+                                       regs.fp[reg] = to_exten(wrd1, wrd2, wrd3);
+                                       idx++;
+                               }
+                               list <<= 1;
+                       }
+               }
+       } else {
+               if (incr < 0) {
+                       for (reg = 7; reg >= 0; reg--) {
+                               uae_u32 wrd1, wrd2, wrd3;
+                               if (list & 0x80) {
+                                       ad -= 4;
+                                       wrd3 = x_cp_get_long (ad);
+                                       ad -= 4;
+                                       wrd2 = x_cp_get_long (ad);
+                                       ad -= 4;
+                                       wrd1 = x_cp_get_long (ad);
+                                       regs.fp[reg] = to_exten(wrd1, wrd2, wrd3);
+                               }
+                               list <<= 1;
+                       }
+               } else {
+                       for (reg = 0; reg <= 7; reg++) {
+                               uae_u32 wrd1, wrd2, wrd3;
+                               if (list & 0x80) {
+                                       wrd1 = x_cp_get_long (ad);
+                                       ad += 4;
+                                       wrd2 = x_cp_get_long (ad);
+                                       ad += 4;
+                                       wrd3 = x_cp_get_long (ad);
+                                       ad += 4;
+                                       regs.fp[reg] = to_exten(wrd1, wrd2, wrd3);
+                               }
+                               list <<= 1;
+                       }
+               }
+       }
+       return ad;
 }
 
 static void fpuop_arithmetic2 (uae_u32 opcode, uae_u16 extra)
@@ -1093,8 +1305,8 @@ static void fpuop_arithmetic2 (uae_u32 opcode, uae_u16 extra)
        if (fault_if_no_fpu (opcode, 4))
                return;
 
-       switch ((extra >> 13) & 0x7) {
-
+       switch ((extra >> 13) & 0x7)
+       {
                case 3:
                        if (put_fp_value (regs.fp[(extra >> 7) & 7], opcode, extra) == 0) {
                                m68k_setpc (pc);
@@ -1171,15 +1383,15 @@ static void fpuop_arithmetic2 (uae_u32 opcode, uae_u16 extra)
                                }
                                ad -= incr;
                                if (extra & 0x1000) {
-                                       x_put_long (ad, regs.fpcr & 0xffff);
+                                       x_cp_put_long (ad, regs.fpcr & 0xffff);
                                        ad += 4;
                                }
                                if (extra & 0x0800) {
-                                       x_put_long (ad, get_fpsr());
+                                       x_cp_put_long (ad, get_fpsr());
                                        ad += 4;
                                }
                                if (extra & 0x0400) {
-                                       x_put_long (ad, regs.fpiar);
+                                       x_cp_put_long (ad, regs.fpiar);
                                        ad += 4;
                                }
                                ad -= incr;
@@ -1207,16 +1419,16 @@ static void fpuop_arithmetic2 (uae_u32 opcode, uae_u16 extra)
                                        ad = ad - incr;
                                }
                                if (extra & 0x1000) {
-                                       regs.fpcr = x_get_long (ad);
+                                       regs.fpcr = x_cp_get_long (ad);
                                        native_set_fpucw (regs.fpcr);
                                        ad += 4;
                                }
                                if (extra & 0x0800) {
-                                       set_fpsr(x_get_long (ad));
+                                       set_fpsr(x_cp_get_long (ad));
                                        ad += 4;
                                }
                                if (extra & 0x0400) {
-                                       regs.fpiar = x_get_long (ad);
+                                       regs.fpiar = x_cp_get_long (ad);
                                        ad += 4;
                                }
                                if ((opcode & 0x38) == 0x18)
@@ -1238,53 +1450,26 @@ static void fpuop_arithmetic2 (uae_u32 opcode, uae_u16 extra)
                                                op_illg (opcode);
                                                return;
                                        }
-                                       switch ((extra >> 11) & 3) {
-               case 0: /* static pred */
-                       list = extra & 0xff;
-                       incr = -1;
-                       break;
-               case 1: /* dynamic pred */
-                       list = m68k_dreg (regs, (extra >> 4) & 3) & 0xff;
-                       incr = -1;
-                       break;
-               case 2: /* static postinc */
-                       list = extra & 0xff;
-                       incr = 1;
-                       break;
-               case 3: /* dynamic postinc */
-                       list = m68k_dreg (regs, (extra >> 4) & 3) & 0xff;
-                       incr = 1;
-                       break;
-                                       }
-                                       if (incr < 0) {
-                                               for (reg = 7; reg >= 0; reg--) {
-                                                       uae_u32 wrd1, wrd2, wrd3;
-                                                       if (list & 0x80) {
-                                                               from_exten (regs.fp[reg], &wrd1, &wrd2, &wrd3);
-                                                               ad -= 4;
-                                                               x_put_long (ad, wrd3);
-                                                               ad -= 4;
-                                                               x_put_long (ad, wrd2);
-                                                               ad -= 4;
-                                                               x_put_long (ad, wrd1);
-                                                       }
-                                                       list <<= 1;
-                                               }
-                                       } else {
-                                               for (reg = 0; reg <= 7; reg++) {
-                                                       uae_u32 wrd1, wrd2, wrd3;
-                                                       if (list & 0x80) {
-                                                               from_exten (regs.fp[reg], &wrd1, &wrd2, &wrd3);
-                                                               x_put_long (ad, wrd1);
-                                                               ad += 4;
-                                                               x_put_long (ad, wrd2);
-                                                               ad += 4;
-                                                               x_put_long (ad, wrd3);
-                                                               ad += 4;
-                                                       }
-                                                       list <<= 1;
-                                               }
+                                       switch ((extra >> 11) & 3)
+                                       {
+                                               case 0: /* static pred */
+                                                       list = extra & 0xff;
+                                                       incr = -1;
+                                                       break;
+                                               case 1: /* dynamic pred */
+                                                       list = m68k_dreg (regs, (extra >> 4) & 3) & 0xff;
+                                                       incr = -1;
+                                                       break;
+                                               case 2: /* static postinc */
+                                                       list = extra & 0xff;
+                                                       incr = 1;
+                                                       break;
+                                               case 3: /* dynamic postinc */
+                                                       list = m68k_dreg (regs, (extra >> 4) & 3) & 0xff;
+                                                       incr = 1;
+                                                       break;
                                        }
+                                       ad = fmovem2mem (ad, list, incr);
                                        if ((opcode & 0x38) == 0x18)
                                                m68k_areg (regs, opcode & 7) = ad;
                                        if ((opcode & 0x38) == 0x20)
@@ -1296,53 +1481,26 @@ static void fpuop_arithmetic2 (uae_u32 opcode, uae_u16 extra)
                                                op_illg (opcode);
                                                return;
                                        }
-                                       switch ((extra >> 11) & 3) {
-               case 0: /* static pred */
-                       list = extra & 0xff;
-                       incr = -1;
-                       break;
-               case 1: /* dynamic pred */
-                       list = m68k_dreg (regs, (extra >> 4) & 3) & 0xff;
-                       incr = -1;
-                       break;
-               case 2: /* static postinc */
-                       list = extra & 0xff;
-                       incr = 1;
-                       break;
-               case 3: /* dynamic postinc */
-                       list = m68k_dreg (regs, (extra >> 4) & 3) & 0xff;
-                       incr = 1;
-                       break;
-                                       }
-                                       if (incr < 0) {
-                                               for (reg = 7; reg >= 0; reg--) {
-                                                       uae_u32 wrd1, wrd2, wrd3;
-                                                       if (list & 0x80) {
-                                                               ad -= 4;
-                                                               wrd3 = x_get_long (ad);
-                                                               ad -= 4;
-                                                               wrd2 = x_get_long (ad);
-                                                               ad -= 4;
-                                                               wrd1 = x_get_long (ad);
-                                                               regs.fp[reg] = to_exten(wrd1, wrd2, wrd3);
-                                                       }
-                                                       list <<= 1;
-                                               }
-                                       } else {
-                                               for (reg = 0; reg <= 7; reg++) {
-                                                       uae_u32 wrd1, wrd2, wrd3;
-                                                       if (list & 0x80) {
-                                                               wrd1 = x_get_long (ad);
-                                                               ad += 4;
-                                                               wrd2 = x_get_long (ad);
-                                                               ad += 4;
-                                                               wrd3 = x_get_long (ad);
-                                                               ad += 4;
-                                                               regs.fp[reg] = to_exten(wrd1, wrd2, wrd3);
-                                                       }
-                                                       list <<= 1;
-                                               }
+                                       switch ((extra >> 11) & 3)
+                                       {
+                                               case 0: /* static pred */
+                                                       list = extra & 0xff;
+                                                       incr = -1;
+                                                       break;
+                                               case 1: /* dynamic pred */
+                                                       list = m68k_dreg (regs, (extra >> 4) & 3) & 0xff;
+                                                       incr = -1;
+                                                       break;
+                                               case 2: /* static postinc */
+                                                       list = extra & 0xff;
+                                                       incr = 1;
+                                                       break;
+                                               case 3: /* dynamic postinc */
+                                                       list = m68k_dreg (regs, (extra >> 4) & 3) & 0xff;
+                                                       incr = 1;
+                                                       break;
                                        }
+                                       ad = fmovem2fpp (ad, list, incr);
                                        if ((opcode & 0x38) == 0x18)
                                                m68k_areg (regs, opcode & 7) = ad;
                                        if ((opcode & 0x38) == 0x20)
@@ -1355,77 +1513,78 @@ static void fpuop_arithmetic2 (uae_u32 opcode, uae_u16 extra)
                case 2: /* Extremely common */
                        reg = (extra >> 7) & 7;
                        if ((extra & 0xfc00) == 0x5c00) {
-                               switch (extra & 0x7f) {
-               case 0x00:
-                       regs.fp[reg] = *fp_pi;
-                       break;
-               case 0x0b:
-                       regs.fp[reg] = *fp_l10_2;
-                       break;
-               case 0x0c:
-                       regs.fp[reg] = *fp_exp_1;
-                       break;
-               case 0x0d:
-                       regs.fp[reg] = *fp_l2_e;
-                       break;
-               case 0x0e:
-                       regs.fp[reg] = *fp_l10_e;
-                       break;
-               case 0x0f:
-                       regs.fp[reg] = 0.0;
-                       break;
-               case 0x30:
-                       regs.fp[reg] = *fp_ln_2;
-                       break;
-               case 0x31:
-                       regs.fp[reg] = *fp_ln_10;
-                       break;
-               case 0x32:
-                       regs.fp[reg] = (fptype)fp_1e0;
-                       break;
-               case 0x33:
-                       regs.fp[reg] = (fptype)fp_1e1;
-                       break;
-               case 0x34:
-                       regs.fp[reg] = (fptype)fp_1e2;
-                       break;
-               case 0x35:
-                       regs.fp[reg] = (fptype)fp_1e4;
-                       break;
-               case 0x36:
-                       regs.fp[reg] = (fptype)fp_1e8;
-                       break;
-               case 0x37:
-                       regs.fp[reg] = *fp_1e16;
-                       break;
-               case 0x38:
-                       regs.fp[reg] = *fp_1e32;
-                       break;
-               case 0x39:
-                       regs.fp[reg] = *fp_1e64;
-                       break;
-               case 0x3a:
-                       regs.fp[reg] = *fp_1e128;
-                       break;
-               case 0x3b:
-                       regs.fp[reg] = *fp_1e256;
-                       break;
-               case 0x3c:
-                       regs.fp[reg] = *fp_1e512;
-                       break;
-               case 0x3d:
-                       regs.fp[reg] = *fp_1e1024;
-                       break;
-               case 0x3e:
-                       regs.fp[reg] = *fp_1e2048;
-                       break;
-               case 0x3f:
-                       regs.fp[reg] = *fp_1e4096;
-                       break;
-               default:
-                       m68k_setpc (pc);
-                       op_illg (opcode);
-                       return;
+                               switch (extra & 0x7f)
+                               {
+                                       case 0x00:
+                                               regs.fp[reg] = *fp_pi;
+                                               break;
+                                       case 0x0b:
+                                               regs.fp[reg] = *fp_l10_2;
+                                               break;
+                                       case 0x0c:
+                                               regs.fp[reg] = *fp_exp_1;
+                                               break;
+                                       case 0x0d:
+                                               regs.fp[reg] = *fp_l2_e;
+                                               break;
+                                       case 0x0e:
+                                               regs.fp[reg] = *fp_l10_e;
+                                               break;
+                                       case 0x0f:
+                                               regs.fp[reg] = 0.0;
+                                               break;
+                                       case 0x30:
+                                               regs.fp[reg] = *fp_ln_2;
+                                               break;
+                                       case 0x31:
+                                               regs.fp[reg] = *fp_ln_10;
+                                               break;
+                                       case 0x32:
+                                               regs.fp[reg] = (fptype)fp_1e0;
+                                               break;
+                                       case 0x33:
+                                               regs.fp[reg] = (fptype)fp_1e1;
+                                               break;
+                                       case 0x34:
+                                               regs.fp[reg] = (fptype)fp_1e2;
+                                               break;
+                                       case 0x35:
+                                               regs.fp[reg] = (fptype)fp_1e4;
+                                               break;
+                                       case 0x36:
+                                               regs.fp[reg] = (fptype)fp_1e8;
+                                               break;
+                                       case 0x37:
+                                               regs.fp[reg] = *fp_1e16;
+                                               break;
+                                       case 0x38:
+                                               regs.fp[reg] = *fp_1e32;
+                                               break;
+                                       case 0x39:
+                                               regs.fp[reg] = *fp_1e64;
+                                               break;
+                                       case 0x3a:
+                                               regs.fp[reg] = *fp_1e128;
+                                               break;
+                                       case 0x3b:
+                                               regs.fp[reg] = *fp_1e256;
+                                               break;
+                                       case 0x3c:
+                                               regs.fp[reg] = *fp_1e512;
+                                               break;
+                                       case 0x3d:
+                                               regs.fp[reg] = *fp_1e1024;
+                                               break;
+                                       case 0x3e:
+                                               regs.fp[reg] = *fp_1e2048;
+                                               break;
+                                       case 0x3f:
+                                               regs.fp[reg] = *fp_1e4096;
+                                               break;
+                                       default:
+                                               m68k_setpc (pc);
+                                               op_illg (opcode);
+                                               return;
                                }
                                MAKE_FPSR (regs.fp[reg]);
                                return;
@@ -1438,238 +1597,240 @@ static void fpuop_arithmetic2 (uae_u32 opcode, uae_u16 extra)
 
                        regs.fpiar =  pc;
 
-                       switch (extra & 0x7f) {
-
-               case 0x00: /* FMOVE */
-               case 0x40: /* Explicit rounding. This is just a quick fix. */
-               case 0x44: /* Same for all other cases that have three choices */
-                       regs.fp[reg] = src;        /* Brian King was here. */
-                       /*<ea> to register needs FPSR updated. See Motorola 68K Manual. */
-                       if ((extra & 0x44) == 0x40)
-                               fround (reg);
-                       break;
-               case 0x01: /* FINT */
-                       /* need to take the current rounding mode into account */
-#if defined(X86_MSVC_ASSEMBLY)
+                       switch (extra & 0x7f)
                        {
-                               fptype tmp_fp;
+                               case 0x00: /* FMOVE */
+                               case 0x40: /* Explicit rounding. This is just a quick fix. */
+                               case 0x44: /* Same for all other cases that have three choices */
+                                       regs.fp[reg] = src;        /* Brian King was here. */
+                                       /*<ea> to register needs FPSR updated. See Motorola 68K Manual. */
+                                       if ((extra & 0x44) == 0x40)
+                                               fround (reg);
+                                       break;
+                               case 0x01: /* FINT */
+                                       /* need to take the current rounding mode into account */
+#if defined(X86_MSVC_ASSEMBLY)
+                                       {
+                                               fptype tmp_fp;
 
-                               __asm {
-                                       fld  LDPTR src
-                                       frndint
-                                       fstp LDPTR tmp_fp
-                               }
-                               regs.fp[reg] = tmp_fp;
-                       }
+                                               __asm {
+                                                       fld  LDPTR src
+                                                       frndint
+                                                       fstp LDPTR tmp_fp
+                                               }
+                                               regs.fp[reg] = tmp_fp;
+                                       }
 #else /* no X86_MSVC */
-                       switch ((regs.fpcr >> 4) & 3) {
-               case 0: /* to nearest */
-                       regs.fp[reg] = floor (src + 0.5);
-                       break;
-               case 1: /* to zero */
-                       if (src >= 0.0)
-                               regs.fp[reg] = floor (src);
-                       else
-                               regs.fp[reg] = ceil (src);
-                       break;
-               case 2: /* down */
-                       regs.fp[reg] = floor (src);
-                       break;
-               case 3: /* up */
-                       regs.fp[reg] = ceil (src);
-                       break;
-               default: /* never reached */
-                       regs.fp[reg] = src;
-                       }
+                                       switch ((regs.fpcr >> 4) & 3) {
+                               case 0: /* to nearest */
+                                       regs.fp[reg] = floor (src + 0.5);
+                                       break;
+                               case 1: /* to zero */
+                                       if (src >= 0.0)
+                                               regs.fp[reg] = floor (src);
+                                       else
+                                               regs.fp[reg] = ceil (src);
+                                       break;
+                               case 2: /* down */
+                                       regs.fp[reg] = floor (src);
+                                       break;
+                               case 3: /* up */
+                                       regs.fp[reg] = ceil (src);
+                                       break;
+                               default: /* never reached */
+                                       regs.fp[reg] = src;
+                                       }
 #endif /* X86_MSVC */
-                       break;
-               case 0x02: /* FSINH */
-                       regs.fp[reg] = sinh (src);
-                       break;
-               case 0x03: /* FINTRZ */
-                       regs.fp[reg] = fp_round_to_zero (src);
-                       break;
-               case 0x04: /* FSQRT */
-               case 0x41:
-               case 0x45:
-                       regs.fp[reg] = sqrt (src);
-                       if ((extra & 0x44) == 0x40)
-                               fround (reg);
-                       break;
-               case 0x06: /* FLOGNP1 */
-                       regs.fp[reg] = log (src + 1.0);
-                       break;
-               case 0x08: /* FETOXM1 */
-                       regs.fp[reg] = exp (src) - 1.0;
-                       break;
-               case 0x09: /* FTANH */
-                       regs.fp[reg] = tanh (src);
-                       break;
-               case 0x0a: /* FATAN */
-                       regs.fp[reg] = atan (src);
-                       break;
-               case 0x0c: /* FASIN */
-                       regs.fp[reg] = asin (src);
-                       break;
-               case 0x0d: /* FATANH */
+                                       break;
+                               case 0x02: /* FSINH */
+                                       regs.fp[reg] = sinh (src);
+                                       break;
+                               case 0x03: /* FINTRZ */
+                                       regs.fp[reg] = fp_round_to_zero (src);
+                                       break;
+                               case 0x04: /* FSQRT */
+                               case 0x41:
+                               case 0x45:
+                                       regs.fp[reg] = sqrt (src);
+                                       if ((extra & 0x44) == 0x40)
+                                               fround (reg);
+                                       break;
+                               case 0x06: /* FLOGNP1 */
+                                       regs.fp[reg] = log (src + 1.0);
+                                       break;
+                               case 0x08: /* FETOXM1 */
+                                       regs.fp[reg] = exp (src) - 1.0;
+                                       break;
+                               case 0x09: /* FTANH */
+                                       regs.fp[reg] = tanh (src);
+                                       break;
+                               case 0x0a: /* FATAN */
+                                       regs.fp[reg] = atan (src);
+                                       break;
+                               case 0x0c: /* FASIN */
+                                       regs.fp[reg] = asin (src);
+                                       break;
+                               case 0x0d: /* FATANH */
 #if 1  /* The BeBox doesn't have atanh, and it isn't in the HPUX libm either */
-                       regs.fp[reg] = 0.5 * log ((1 + src) / (1 - src));
+                                       regs.fp[reg] = 0.5 * log ((1 + src) / (1 - src));
 #else
-                       regs.fp[reg] = atanh (src);
+                                       regs.fp[reg] = atanh (src);
 #endif
-                       break;
-               case 0x0e: /* FSIN */
-                       regs.fp[reg] = sin (src);
-                       break;
-               case 0x0f: /* FTAN */
-                       regs.fp[reg] = tan (src);
-                       break;
-               case 0x10: /* FETOX */
-                       regs.fp[reg] = exp (src);
-                       break;
-               case 0x11: /* FTWOTOX */
-                       regs.fp[reg] = pow (2.0, src);
-                       break;
-               case 0x12: /* FTENTOX */
-                       regs.fp[reg] = pow (10.0, src);
-                       break;
-               case 0x14: /* FLOGN */
-                       regs.fp[reg] = log (src);
-                       break;
-               case 0x15: /* FLOG10 */
-                       regs.fp[reg] = log10 (src);
-                       break;
-               case 0x16: /* FLOG2 */
-                       regs.fp[reg] = *fp_l2_e * log (src);
-                       break;
-               case 0x18: /* FABS */
-               case 0x58:
-               case 0x5c:
-                       regs.fp[reg] = src < 0 ? -src : src;
-                       if ((extra & 0x44) == 0x40)
-                               fround (reg);
-                       break;
-               case 0x19: /* FCOSH */
-                       regs.fp[reg] = cosh (src);
-                       break;
-               case 0x1a: /* FNEG */
-               case 0x5a:
-               case 0x5e:
-                       regs.fp[reg] = -src;
-                       if ((extra & 0x44) == 0x40)
-                               fround (reg);
-                       break;
-               case 0x1c: /* FACOS */
-                       regs.fp[reg] = acos (src);
-                       break;
-               case 0x1d: /* FCOS */
-                       regs.fp[reg] = cos (src);
-                       break;
-               case 0x1e: /* FGETEXP */
-                       {
-                               if (src == 0) {
-                                       regs.fp[reg] = 0;
-                               } else {
-                                       int expon;
-                                       frexp (src, &expon);
-                                       regs.fp[reg] = (double) (expon - 1);
-                               }
-                       }
-                       break;
-               case 0x1f: /* FGETMAN */
-                       {
-                               if (src == 0) {
-                                       regs.fp[reg] = 0;
-                               } else {
-                                       int expon;
-                                       regs.fp[reg] = frexp (src, &expon) * 2.0;
-                               }
-                       }
-                       break;
-               case 0x20: /* FDIV */
-               case 0x60:
-               case 0x64:
-                       regs.fp[reg] /= src;
-                       if ((extra & 0x44) == 0x40)
-                               fround (reg);
-                       break;
-               case 0x21: /* FMOD */
-                       {
-                               fptype quot = fp_round_to_zero(regs.fp[reg] / src);
-                               regs.fp[reg] = regs.fp[reg] - quot * src;
-                       }
-                       break;
-               case 0x22: /* FADD */
-               case 0x62:
-               case 0x66:
-                       regs.fp[reg] += src;
-                       if ((extra & 0x44) == 0x40)
-                               fround (reg);
-                       break;
-               case 0x23: /* FMUL */
-               case 0x63:
-               case 0x67:
-                       regs.fp[reg] *= src;
-                       if ((extra & 0x44) == 0x40)
-                               fround (reg);
-                       break;
-               case 0x24: /* FSGLDIV */
-                       regs.fp[reg] /= src;
-                       break;
-               case 0x25: /* FREM */
-                       {
-                               fptype quot = fp_round_to_nearest(regs.fp[reg] / src);
-                               regs.fp[reg] = regs.fp[reg] - quot * src;
-                       }
-                       break;
-               case 0x26: /* FSCALE */
-                       if (src != 0) {
+                                       break;
+                               case 0x0e: /* FSIN */
+                                       regs.fp[reg] = sin (src);
+                                       break;
+                               case 0x0f: /* FTAN */
+                                       regs.fp[reg] = tan (src);
+                                       break;
+                               case 0x10: /* FETOX */
+                                       regs.fp[reg] = exp (src);
+                                       break;
+                               case 0x11: /* FTWOTOX */
+                                       regs.fp[reg] = pow (2.0, src);
+                                       break;
+                               case 0x12: /* FTENTOX */
+                                       regs.fp[reg] = pow (10.0, src);
+                                       break;
+                               case 0x14: /* FLOGN */
+                                       regs.fp[reg] = log (src);
+                                       break;
+                               case 0x15: /* FLOG10 */
+                                       regs.fp[reg] = log10 (src);
+                                       break;
+                               case 0x16: /* FLOG2 */
+                                       regs.fp[reg] = *fp_l2_e * log (src);
+                                       break;
+                               case 0x18: /* FABS */
+                               case 0x58:
+                               case 0x5c:
+                                       regs.fp[reg] = src < 0 ? -src : src;
+                                       if ((extra & 0x44) == 0x40)
+                                               fround (reg);
+                                       break;
+                               case 0x19: /* FCOSH */
+                                       regs.fp[reg] = cosh (src);
+                                       break;
+                               case 0x1a: /* FNEG */
+                               case 0x5a:
+                               case 0x5e:
+                                       regs.fp[reg] = -src;
+                                       if ((extra & 0x44) == 0x40)
+                                               fround (reg);
+                                       break;
+                               case 0x1c: /* FACOS */
+                                       regs.fp[reg] = acos (src);
+                                       break;
+                               case 0x1d: /* FCOS */
+                                       regs.fp[reg] = cos (src);
+                                       break;
+                               case 0x1e: /* FGETEXP */
+                                       {
+                                               if (src == 0) {
+                                                       regs.fp[reg] = 0;
+                                               } else {
+                                                       int expon;
+                                                       frexp (src, &expon);
+                                                       regs.fp[reg] = (double) (expon - 1);
+                                               }
+                                       }
+                                       break;
+                               case 0x1f: /* FGETMAN */
+                                       {
+                                               if (src == 0) {
+                                                       regs.fp[reg] = 0;
+                                               } else {
+                                                       int expon;
+                                                       regs.fp[reg] = frexp (src, &expon) * 2.0;
+                                               }
+                                       }
+                                       break;
+                               case 0x20: /* FDIV */
+                               case 0x60:
+                               case 0x64:
+                                       regs.fp[reg] /= src;
+                                       if ((extra & 0x44) == 0x40)
+                                               fround (reg);
+                                       break;
+                               case 0x21: /* FMOD */
+                                       {
+                                               fptype quot = fp_round_to_zero(regs.fp[reg] / src);
+                                               regs.fp[reg] = regs.fp[reg] - quot * src;
+                                       }
+                                       break;
+                               case 0x22: /* FADD */
+                               case 0x62:
+                               case 0x66:
+                                       regs.fp[reg] += src;
+                                       if ((extra & 0x44) == 0x40)
+                                               fround (reg);
+                                       break;
+                               case 0x23: /* FMUL */
+                               case 0x63:
+                               case 0x67:
+                                       regs.fp[reg] *= src;
+                                       if ((extra & 0x44) == 0x40)
+                                               fround (reg);
+                                       break;
+                               case 0x24: /* FSGLDIV */
+                                       regs.fp[reg] /= src;
+                                       break;
+                               case 0x25: /* FREM */
+                                       {
+                                               fptype quot = fp_round_to_nearest(regs.fp[reg] / src);
+                                               regs.fp[reg] = regs.fp[reg] - quot * src;
+                                       }
+                                       break;
+                               case 0x26: /* FSCALE */
+                                       if (src != 0) {
 #ifdef ldexp
-                               regs.fp[reg] = ldexp (regs.fp[reg], (int) src);
+                                               regs.fp[reg] = ldexp (regs.fp[reg], (int) src);
 #else
-                               regs.fp[reg] *= exp (*fp_ln_2 * (int) src);
+                                               regs.fp[reg] *= exp (*fp_ln_2 * (int) src);
 #endif
-                       }
-                       break;
-               case 0x27: /* FSGLMUL */
-                       regs.fp[reg] *= src;
-                       break;
-               case 0x28: /* FSUB */
-               case 0x68:
-               case 0x6c:
-                       regs.fp[reg] -= src;
-                       if ((extra & 0x44) == 0x40)
-                               fround (reg);
-                       break;
-               case 0x30: /* FSINCOS */
-               case 0x31:
-               case 0x32:
-               case 0x33:
-               case 0x34:
-               case 0x35:
-               case 0x36:
-               case 0x37:
-                       regs.fp[extra & 7] = cos (src);
-                       regs.fp[reg] = sin (src);
-                       break;
-               case 0x38: /* FCMP */
-                       {
-                               fptype tmp = regs.fp[reg] - src;
-                               regs.fpsr = 0;
-                               MAKE_FPSR (tmp);
-                       }
-                       return;
-               case 0x3a: /* FTST */
-                       regs.fpsr = 0;
-                       MAKE_FPSR (src);
-                       return;
-               default:
-                       m68k_setpc (pc);
-                       op_illg (opcode);
-                       return;
+                                       }
+                                       break;
+                               case 0x27: /* FSGLMUL */
+                                       regs.fp[reg] *= src;
+                                       break;
+                               case 0x28: /* FSUB */
+                               case 0x68:
+                               case 0x6c:
+                                       regs.fp[reg] -= src;
+                                       if ((extra & 0x44) == 0x40)
+                                               fround (reg);
+                                       break;
+                               case 0x30: /* FSINCOS */
+                               case 0x31:
+                               case 0x32:
+                               case 0x33:
+                               case 0x34:
+                               case 0x35:
+                               case 0x36:
+                               case 0x37:
+                                       regs.fp[extra & 7] = cos (src);
+                                       regs.fp[reg] = sin (src);
+                                       break;
+                               case 0x38: /* FCMP */
+                                       {
+                                               fptype tmp = regs.fp[reg] - src;
+                                               regs.fpsr = 0;
+                                               MAKE_FPSR (tmp);
+                                       }
+                                       return;
+                               case 0x3a: /* FTST */
+                                       regs.fpsr = 0;
+                                       MAKE_FPSR (src);
+                                       return;
+                               default:
+                                       m68k_setpc (pc);
+                                       op_illg (opcode);
+                                       return;
                        }
                        MAKE_FPSR (regs.fp[reg]);
                        return;
+               default:
+               break;
        }
        m68k_setpc (pc);
        op_illg (opcode);
@@ -1678,6 +1839,7 @@ static void fpuop_arithmetic2 (uae_u32 opcode, uae_u16 extra)
 void fpuop_arithmetic (uae_u32 opcode, uae_u16 extra)
 {
        regs.fpsr_highbyte = 0;
+       regs.fpu_state = 1;
        fpuop_arithmetic2 (opcode, extra);
        if (regs.fpsr_highbyte) {
                regs.fpsr &= 0xffff00ff;
@@ -1718,9 +1880,10 @@ uae_u8 *restore_fpu (uae_u8 *src)
        regs.fpsr = restore_u32 ();
        regs.fpiar = restore_u32 ();
        if (flags & 0x80000000) {
-               restore_u32();
-               restore_u32();
+               restore_u32 ();
+               restore_u32 ();
        }
+       regs.fpu_state = (flags & 1) ? 0 : 1;
        write_log (_T("FPU: %d\n"), currprefs.fpu_model);
        return src;
 }
@@ -1738,7 +1901,7 @@ uae_u8 *save_fpu (int *len, uae_u8 *dstptr)
        else
                dstbak = dst = xmalloc (uae_u8, 4+4+8*10+4+4+4+4+4);
        save_u32 (currprefs.fpu_model);
-       save_u32 (0x80000000);
+       save_u32 (0x80000000 | (regs.fpu_state == 0 ? 1 : 0));
        for (i = 0; i < 8; i++) {
                uae_u32 w1, w2, w3;
                from_exten (regs.fp[i], &w1, &w2, &w3);
index 63a015ab251c6cdc687e9f3e25740463320a7523..17be285918f1bfc33e5e7c552c88aa65ecd73cd3 100644 (file)
--- a/gayle.cpp
+++ b/gayle.cpp
@@ -186,6 +186,7 @@ struct ide_hdf
        int type;
        int blocksize;
        int maxtransferstate;
+       bool atapi;
 };
 
 #define TOTAL_IDE 3
@@ -454,6 +455,7 @@ static void ide_identify_drive (void)
        int v;
        uae_u8 *buf = ide->secbuf;
        TCHAR tmp[100];
+       bool atapi = ide->atapi;
 
        if (ide->hdhfd.size == 0) {
                ide_fail ();
@@ -464,7 +466,7 @@ static void ide_identify_drive (void)
                write_log (_T("IDE%d identify drive\n"), ide->num);
        ide_data_ready ();
        ide->data_size *= -1;
-       pw (0, 1 << 6);
+       pw (0, atapi ? 0x85c0 : 1 << 6);
        pw (1, ide->hdhfd.cyls_def);
        pw (2, 0xc837);
        pw (3, ide->hdhfd.heads_def);
@@ -506,7 +508,7 @@ static void ide_identify_drive (void)
        pw (68, 120);
        pw (80, (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)); /* ATA-1 to ATA-6 */
        pw (81, 0x1c); /* ATA revision */
-       pw (82, (1 << 14)); /* NOP command supported */
+       pw (82, (1 << 14) | (atapi ? 0x10 | 4 : 0)); /* NOP, ATAPI: PACKET and Removable media features supported */
        pw (83, (1 << 14) | (1 << 13) | (1 << 12) | (ide->lba48 ? (1 << 10) : 0)); /* cache flushes, LBA 48 supported */
        pw (84, 1 << 14);
        pw (85, 1 << 14);
@@ -526,13 +528,19 @@ static void ide_identify_drive (void)
 static void ide_execute_drive_diagnostics (bool irq)
 {
        ide->regs->ide_error = 1;
-       ide->regs->ide_sector = ide->regs->ide_nsector = 1;
-       ide->regs->ide_select = 0;
-       ide->regs->ide_lcyl = ide->regs->ide_hcyl = 0;
+       if (ide->atapi) {
+               ide->regs->ide_sector = ide->regs->ide_nsector = 1;
+               ide->regs->ide_lcyl = 0x14;
+               ide->regs->ide_hcyl = 0xeb;
+       } else {
+               ide->regs->ide_sector = ide->regs->ide_nsector = 1;
+               ide->regs->ide_select = 0;
+               ide->regs->ide_lcyl = ide->regs->ide_hcyl = 0;
+       }
        if (irq)
                ide_interrupt ();
        else
-               ide->status = ~IDE_STATUS_BSY;
+               ide->status &= ~IDE_STATUS_BSY;
 }
 
 static void ide_initialize_drive_parameters (void)
@@ -734,6 +742,16 @@ static void ide_write_sectors (int flags)
        ide->data_size = nsec * ide->blocksize;
 }
 
+static void atapi_packet (void)
+{
+       ide->regs->ide_error = 1; /* C/D = 1 */
+       ide->status = IDE_STATUS_DRQ;
+       ide->data_size = (ide->regs->ide_hcyl << 8) | ide->regs->ide_lcyl;
+       if (ide->data_size == 65535)
+               ide->data_size = 65534;
+
+}
+
 static void ide_do_command (uae_u8 cmd)
 {
        int lba48 = ide->lba48;
@@ -743,6 +761,16 @@ static void ide_do_command (uae_u8 cmd)
        ide->status &= ~ (IDE_STATUS_DRDY | IDE_STATUS_DRQ | IDE_STATUS_ERR);
        ide->regs->ide_error = 0;
 
+       if (ide->atapi) {
+               if (cmd == 0x08) { /* device reset */
+                       ide_execute_drive_diagnostics (false);
+               } else if (cmd == 0xa1) { /* identify packet device */
+                       ide_identify_drive ();
+               } else if (cmd == 0xa0) { /* packet */
+                       atapi_packet ();
+               }
+       }
+
        if (cmd == 0x10) { /* recalibrate */
                ide_recalibrate ();
        } else if (cmd == 0xec) { /* identify drive */
@@ -752,7 +780,10 @@ static void ide_do_command (uae_u8 cmd)
        } else if (cmd == 0x91) { /* initialize drive parameters */
                ide_initialize_drive_parameters ();
        } else if (cmd == 0xc6) { /* set multiple mode */
-               ide_set_multiple_mode ();
+               if (ide->atapi)
+                       ide_fail ();
+               else
+                       ide_set_multiple_mode ();
        } else if (cmd == 0x20 || cmd == 0x21) { /* read sectors */
                ide_read_sectors (0);
        } else if (cmd == 0x24 && lba48) { /* read sectors ext */
@@ -771,8 +802,6 @@ static void ide_do_command (uae_u8 cmd)
                ide_write_sectors (1|2);
        } else if (cmd == 0x50) { /* format track (nop) */
                ide_interrupt ();
-       } else if (cmd == 0xa1) { /* ATAPI identify (IDE HD is not ATAPI) */
-               ide_fail ();
        } else if (cmd == 0xef) { /* set features  */
                ide_set_features ();
        } else if (cmd == 0x00) { /* nop */
@@ -911,9 +940,7 @@ static int get_gayle_ide_reg (uaecptr addr)
                        addr &= ~0x400;
                }
        }
-       ide = idedrive[ide2];
-       if (ide->regs->ide_drv)
-               ide = idedrive[ide2 + 1];
+       ide = idedrive[ide2 + (ide->regs->ide_drv ? 1 : 0)];
        return addr;
 }
 
@@ -1540,18 +1567,17 @@ static void alloc_ide_mem (struct ide_hdf **ide, int max)
        }
 }
 
-static struct ide_hdf *add_ide_unit (int ch, const TCHAR *path, int blocksize, int readonly,
-       const TCHAR *devname, int cyls, int sectors, int surfaces, int reserved,
-       int bootpri, const TCHAR *filesys,
-       int pcyls, int pheads, int psecs)
+static struct ide_hdf *add_ide_unit (int ch, struct uaedev_config_info *ci)
 {
        struct ide_hdf *ide;
 
        alloc_ide_mem (idedrive, TOTAL_IDE * 2);
        ide = idedrive[ch];
-       if (!hdf_hd_open (&ide->hdhfd, path, blocksize, readonly, devname, cyls, sectors, surfaces, reserved, bootpri, filesys, pcyls, pheads, psecs))
+       if (ci)
+               memcpy (&ide->hdhfd.hfd.ci, ci, sizeof (struct uaedev_config_info));
+       if (!hdf_hd_open (&ide->hdhfd))
                return NULL;
-       ide->blocksize = blocksize;
+       ide->blocksize = ide->hdhfd.hfd.ci.blocksize;
        ide->lba48 = ide->hdhfd.size >= 128 * (uae_u64)0x40000000 ? 1 : 0;
        ide->status = 0;
        ide->data_offset = 0;
@@ -1881,7 +1907,7 @@ static void checkflush (int addr)
        }
        if (pcmcia_write_min >= 0) {
                if (abs (pcmcia_write_min - addr) >= 512 || abs (pcmcia_write_max - addr) >= 512) {
-                       int blocksize = pcmcia_sram->hfd.blocksize;
+                       int blocksize = pcmcia_sram->hfd.ci.blocksize;
                        int mask = ~(blocksize - 1);
                        int start = pcmcia_write_min & mask;
                        int end = (pcmcia_write_max + blocksize - 1) & mask;
@@ -1938,16 +1964,19 @@ static int initpcmcia (const TCHAR *path, int readonly, int type, int reset)
                pcmcia_sram = xcalloc (struct hd_hardfiledata, 1);
        if (!pcmcia_sram->hfd.handle_valid)
                reset = 1;
+       _tcscpy (pcmcia_sram->hfd.ci.rootdir, path);
+       pcmcia_sram->hfd.ci.readonly = readonly != 0;
+       pcmcia_sram->hfd.ci.blocksize = 512;
 
        if (type == PCMCIA_SRAM) {
                if (reset) {
                        if (path)
-                               hdf_hd_open (pcmcia_sram, path, 512, readonly, NULL, 0, 0, 0, 0, 0, NULL, 0, 0, 0);
+                               hdf_hd_open (pcmcia_sram);
                } else {
                        pcmcia_sram->hfd.drive_empty = 0;
                }
 
-               if (pcmcia_sram->hfd.readonly)
+               if (pcmcia_sram->hfd.ci.readonly)
                        readonly = 1;
                pcmcia_common_size = 0;
                pcmcia_readonly = readonly;
@@ -1974,8 +2003,13 @@ static int initpcmcia (const TCHAR *path, int readonly, int type, int reset)
        } else if (type == PCMCIA_IDE) {
 
                if (reset) {
-                       if (path)
-                               add_ide_unit (PCMCIA_IDE_ID * 2, path, 512, readonly, NULL, 0, 0, 0, 0, 0, NULL, 0, 0, 0);
+                       if (path) {
+                               struct uaedev_config_info ci = { 0 };
+                               _tcscpy (ci.rootdir , path);
+                               ci.blocksize = 512;
+                               ci.readonly = readonly != 0;
+                               add_ide_unit (PCMCIA_IDE_ID * 2, &ci);
+                       }
                }
 
                pcmcia_common_size = 0;
@@ -2253,21 +2287,19 @@ static void dumphdf (struct hardfiledata *hfd)
 }
 #endif
 
-int gayle_add_ide_unit (int ch, const TCHAR *path, int blocksize, int readonly, const TCHAR *devname,
-       int cyls, int sectors, int surfaces, int reserved, int bootpri, const TCHAR *filesys,
-       int pcyls, int pheads, int psecs)
+int gayle_add_ide_unit (int ch, struct uaedev_config_info *ci)
 {
        struct ide_hdf *ide;
 
        if (ch >= 2 * 2)
                return -1;
-       ide = add_ide_unit (ch, path, blocksize, readonly, devname, cyls, sectors, surfaces, reserved, bootpri, filesys, pcyls, pheads, psecs);
+       ide = add_ide_unit (ch, ci);
        if (ide == NULL)
                return 0;
        write_log (_T("GAYLE_IDE%d '%s', LCHS=%d/%d/%d. PCHS=%d/%d/%d %uM. LBA48=%d\n"),
-               ch, path,
+               ch, ide->hdhfd.hfd.ci.rootdir,
                ide->hdhfd.cyls, ide->hdhfd.heads, ide->hdhfd.secspertrack,
-               pcyls, pheads, psecs,
+               ide->hdhfd.hfd.ci.pcyls, ide->hdhfd.hfd.ci.pheads, ide->hdhfd.hfd.ci.psecs,
                (int)(ide->hdhfd.size / (1024 * 1024)), ide->lba48);
        ide->type = IDE_GAYLE;
        //dumphdf (&ide->hdhfd.hfd);
@@ -2314,6 +2346,10 @@ static void initide (void)
                ideregs[i].ide_lcyl = ideregs[i].ide_hcyl = ideregs[i].ide_devcon = ideregs[i].ide_feat = 0;
                idedrive[i * 2 + 0]->regs = &ideregs[i];
                idedrive[i * 2 + 1]->regs = &ideregs[i];
+               ide = idedrive[i * 2 + 0];
+               ide_execute_drive_diagnostics (false);
+               ide = idedrive[i * 2 + 1];
+               ide_execute_drive_diagnostics (false);
        }
        ide_splitter = 0;
        if (idedrive[2]->hdhfd.size) {
@@ -2397,9 +2433,9 @@ uae_u8 *save_ide (int num, int *len, uae_u8 *dstptr)
                dstbak = dst = xmalloc (uae_u8, 1000);
        save_u32 (num);
        save_u64 (ide->hdhfd.size);
-       save_string (ide->hdhfd.path);
-       save_u32 (ide->hdhfd.hfd.blocksize);
-       save_u32 (ide->hdhfd.hfd.readonly);
+       save_string (ide->hdhfd.hfd.ci.rootdir);
+       save_u32 (ide->hdhfd.hfd.ci.blocksize);
+       save_u32 (ide->hdhfd.hfd.ci.readonly);
        save_u8 (ide->multiple_mode);
        save_u32 (ide->hdhfd.cyls);
        save_u32 (ide->hdhfd.heads);
@@ -2418,10 +2454,10 @@ uae_u8 *save_ide (int num, int *len, uae_u8 *dstptr)
        save_u8 (ide->regs->ide_error);
        save_u8 (ide->regs->ide_devcon);
        save_u64 (ide->hdhfd.hfd.virtual_size);
-       save_u32 (ide->hdhfd.hfd.secspertrack);
-       save_u32 (ide->hdhfd.hfd.heads);
-       save_u32 (ide->hdhfd.hfd.reservedblocks);
-       save_u32 (ide->hdhfd.bootpri);
+       save_u32 (ide->hdhfd.hfd.ci.sectors);
+       save_u32 (ide->hdhfd.hfd.ci.surfaces);
+       save_u32 (ide->hdhfd.hfd.ci.reserved);
+       save_u32 (ide->hdhfd.hfd.ci.bootpri);
        *len = dst - dstbak;
        return dstbak;
 }
@@ -2438,6 +2474,7 @@ uae_u8 *restore_ide (uae_u8 *src)
        ide = idedrive[num];
        size = restore_u64 ();
        path = restore_string ();
+       _tcscpy (ide->hdhfd.hfd.ci.rootdir, path);
        blocksize = restore_u32 ();
        readonly = restore_u32 ();
        ide->multiple_mode = restore_u8 ();
@@ -2458,15 +2495,14 @@ uae_u8 *restore_ide (uae_u8 *src)
        ide->regs->ide_error = restore_u8 ();
        ide->regs->ide_devcon = restore_u8 ();
        ide->hdhfd.hfd.virtual_size = restore_u64 ();
-       ide->hdhfd.hfd.secspertrack = restore_u32 ();
-       ide->hdhfd.hfd.heads = restore_u32 ();
-       ide->hdhfd.hfd.reservedblocks = restore_u32 ();
-       ide->hdhfd.bootpri = restore_u32 ();
+       ide->hdhfd.hfd.ci.sectors = restore_u32 ();
+       ide->hdhfd.hfd.ci.surfaces = restore_u32 ();
+       ide->hdhfd.hfd.ci.reserved = restore_u32 ();
+       ide->hdhfd.hfd.ci.bootpri = restore_u32 ();
        if (ide->hdhfd.hfd.virtual_size)
-               gayle_add_ide_unit (num, path, blocksize, readonly, ide->hdhfd.hfd.device_name,
-               0, ide->hdhfd.hfd.secspertrack, ide->hdhfd.hfd.heads, ide->hdhfd.hfd.reservedblocks, ide->hdhfd.bootpri, NULL, 0, 0, 0);
+               gayle_add_ide_unit (num, NULL);
        else
-               gayle_add_ide_unit (num, path, blocksize, readonly, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+               gayle_add_ide_unit (num, NULL);
        xfree (path);
        return src;
 }
index 0e0af874f8633334f16eb3dce456d474d73cd2de..2858dac1fd6a682d00b1a77050fae11a63f18525 100644 (file)
@@ -39,6 +39,7 @@ static int using_tracer;
 static int cpu_level;
 static int count_read, count_write, count_cycles, count_ncycles;
 static int count_read_ea, count_write_ea, count_cycles_ea;
+static const char *mmu_postfix;
 
 static int optimized_flags;
 
@@ -62,7 +63,10 @@ static int *opcode_next_clev;
 static int *opcode_last_postfix;
 static unsigned long *counts;
 static int generate_stbl;
-static int fixupcnt;
+static int mmufixupcnt;
+static int mmufixupstate;
+static int mmudisp020cnt;
+
 
 #define GENA_GETV_NO_FETCH     0
 #define GENA_GETV_FETCH                1
@@ -76,6 +80,8 @@ static char *srcw, *dstw;
 static char *srcb, *dstb;
 static char *prefetch_long, *prefetch_word;
 static char *srcli, *srcwi, *srcbi, *nextl, *nextw, *nextb;
+static char *srcld, *dstld;
+static char *srcwd, *dstwd;
 static char *do_cycles, *disp000, *disp020;
 
 static void read_counts (void)
@@ -468,7 +474,7 @@ static void sync_m68k_pc (void)
 
 static void gen_set_fault_pc (void)
 {
-       if (!using_mmu)
+       if (using_mmu != 68040)
                return;
        sync_m68k_pc ();
        printf ("\tregs.instruction_pc = m68k_getpci ();\n");
@@ -487,6 +493,27 @@ static void syncmovepc (int getv, int flags)
 #endif
 }
 
+
+static void addmmufixup (char *reg)
+{
+       if (!using_mmu)
+               return;
+       if (using_mmu == 68040 && (mmufixupstate || mmufixupcnt > 0))
+               return;
+       printf ("\tmmufixup[%d].reg = %s;\n", mmufixupcnt, reg);
+       printf ("\tmmufixup[%d].value = m68k_areg (regs, %s);\n", mmufixupcnt, reg);
+       mmufixupstate |= 1 << mmufixupcnt;
+       mmufixupcnt++;
+}
+
+static void clearmmufixup (int cnt)
+{
+       if (mmufixupstate & (1 << cnt)) {
+               printf ("\tmmufixup[%d].reg = -1;\n", cnt);
+               mmufixupstate &= ~(1 << cnt);
+       }
+}
+
 /* getv == 1: fetch data; getv != 0: check for odd address. If movem != 0,
 * the calling routine handles Apdi and Aipi modes.
 * gb-- movem == 2 means the same thing but for a MOVE16 instruction */
@@ -498,7 +525,7 @@ static void syncmovepc (int getv, int flags)
 * side effect in case a bus fault is generated by any memory access.
 * XJ - 2006/11/13 */
 
-static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem, int flags, int fixup)
+static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem, int flags)
 {
        char namea[100];
        int m68k_pc_offset_last = m68k_pc_offset;
@@ -594,7 +621,7 @@ static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int g
                        start_brace ();
                        /* This would ordinarily be done in gen_nextiword, which we bypass.  */
                        insn_n_cycles += 4;
-                       printf ("\t%sa = %s (m68k_areg (regs, %s), %s ());\n", name, disp020, reg, nextw);
+                       printf ("\t%sa = %s (m68k_areg (regs, %s), %d);\n", name, disp020, reg, mmudisp020cnt++);
                } else {
                        if (!(flags & GF_AD8R)) {
                                addcycles000 (2);
@@ -620,7 +647,7 @@ static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int g
                        /* This would ordinarily be done in gen_nextiword, which we bypass.  */
                        insn_n_cycles += 4;
                        printf ("\ttmppc = m68k_getpc ();\n");
-                       printf ("\t%sa = %s (tmppc, %s ());\n", name, disp020, nextw);
+                       printf ("\t%sa = %s (tmppc, %d);\n", name, disp020, mmudisp020cnt++);
                } else {
                        printf ("\ttmppc = m68k_getpc () + %d;\n", m68k_pc_offset);
                        if (!(flags & GF_PC8R)) {
@@ -740,9 +767,9 @@ static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int g
                } else if (using_mmu) {
                        if (flags & GF_FC) {
                                switch (size) {
-                               case sz_byte: insn_n_cycles += 4; printf ("\tuae_s8 %s = sfc_get_byte (%sa);\n", name, name); break;
-                               case sz_word: insn_n_cycles += 4; printf ("\tuae_s16 %s = sfc_get_word (%sa);\n", name, name); break;
-                               case sz_long: insn_n_cycles += 8; printf ("\tuae_s32 %s = sfc_get_long (%sa);\n", name, name); break;
+                               case sz_byte: insn_n_cycles += 4; printf ("\tuae_s8 %s = sfc%s_get_byte (%sa);\n", name, mmu_postfix, name); break;
+                               case sz_word: insn_n_cycles += 4; printf ("\tuae_s16 %s = sfc%s_get_word (%sa);\n", name, mmu_postfix, name); break;
+                               case sz_long: insn_n_cycles += 8; printf ("\tuae_s32 %s = sfc%s_get_long (%sa);\n", name, mmu_postfix, name); break;
                                default: abort ();
                                }
                        } else {
@@ -768,10 +795,7 @@ static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int g
        if (!movem)
                switch (mode) {
                case Aipi:
-                       if (fixup == 1) {
-                               printf ("\tmmufixup[%d].reg = %s;\n", fixupcnt, reg);
-                               printf ("\tmmufixup[%d].value = m68k_areg (regs, %s);\n", fixupcnt, reg);
-                       }
+                       addmmufixup (reg);
                        switch (size) {
                        case sz_byte:
                                printf ("\tm68k_areg (regs, %s) += areg_byteinc[%s];\n", reg, reg);
@@ -787,10 +811,7 @@ static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int g
                        }
                        break;
                case Apdi:
-                       if (fixup == 1) {
-                               printf ("\tmmufixup[%d].reg = %s;\n", fixupcnt, reg);
-                               printf ("\tmmufixup[%d].value = m68k_areg (regs, %s);\n", fixupcnt, reg);
-                       }
+                       addmmufixup (reg);
                        printf ("\tm68k_areg (regs, %s) = %sa;\n", reg, name);
                        break;
                default:
@@ -798,35 +819,15 @@ static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int g
        }
 }
 
-static void genamode_fixup (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem, int flags, int fixup)
-{
-       if (fixup != 2) {
-               genamode2 (mode, reg, size, name, getv, movem, flags, fixup);
-       } else {
-               if (!movem) {
-                       switch (mode)
-                       {
-                       case Aipi:
-                       case Apdi:
-                               printf ("\tmmufixup[0].reg = -1;\n", fixupcnt);
-                               break;
-                       }
-               }
-       }
-}
 
 static void genamode (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem, int flags)
 {
-       genamode2 (mode, reg, size, name, getv, movem, flags, 0);
-}
-static void genamode_pre (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem, int flags)
-{
-       genamode_fixup (mode, reg, size, name, getv, movem, flags, using_mmu ? 1 : 0);
-}
-static void genamode_post (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem, int flags)
-{
-       if (using_mmu)
-               genamode_fixup (mode, reg, size, name, getv, movem, flags, 2);
+       int oldfixup = mmufixupstate;
+       genamode2 (mode, reg, size, name, getv, movem, flags);
+       if (using_mmu == 68040 && (oldfixup & 1)) {
+               // we have fixup already active = this genamode call is destination mode and we can now clear previous source fixup.
+               clearmmufixup (0);
+       }
 }
 
 static void genastore_2 (char *from, amodes mode, char *reg, wordsizes size, char *to, int store_dir, int flags)
@@ -919,7 +920,7 @@ static void genastore_2 (char *from, amodes mode, char *reg, wordsizes size, cha
                        case sz_byte:
                                insn_n_cycles += 4;
                                if (flags & GF_FC)
-                                       printf ("\tdfc_put_byte (%sa, %s);\n", to, from);
+                                       printf ("\tdfc%s_put_byte (%sa, %s);\n", mmu_postfix, to, from);
                                else
                                        printf ("\t%s (%sa, %s);\n", dstb, to, from);
                                break;
@@ -928,7 +929,7 @@ static void genastore_2 (char *from, amodes mode, char *reg, wordsizes size, cha
                                if (cpu_level < 2 && (mode == PC16 || mode == PC8r))
                                        abort ();
                                if (flags & GF_FC)
-                                       printf ("\tdfc_put_word (%sa, %s);\n", to, from);
+                                       printf ("\tdfc%s_put_word (%sa, %s);\n", mmu_postfix, to, from);
                                else
                                        printf ("\t%s (%sa, %s);\n", dstw, to, from);
                                break;
@@ -937,7 +938,7 @@ static void genastore_2 (char *from, amodes mode, char *reg, wordsizes size, cha
                                if (cpu_level < 2 && (mode == PC16 || mode == PC8r))
                                        abort ();
                                if (flags & GF_FC)
-                                       printf ("\tdfc_put_long (%sa, %s);\n", to, from);
+                                       printf ("\tdfc%s_put_long (%sa, %s);\n", mmu_postfix, to, from);
                                else
                                        printf ("\t%s (%sa, %s);\n", dstl, to, from);
                                break;
@@ -995,29 +996,80 @@ static void genastore_fc (char *from, amodes mode, char *reg, wordsizes size, ch
        genastore_2 (from, mode, reg, size, to, 1, GF_FC);
 }
 
+/* 68030 MMU does not restore register state if it bus faults.
+ * (also there wouldn't be enough space in stack frame to store all registers)
+ */
+static void movem_mmu030 (const char *code, int size, bool put, bool aipi, bool apdi)
+{
+       char *index;
+       int dphase, aphase;
+       if (apdi) {
+               dphase = 1; aphase = 0;
+               index = "movem_index2";
+       } else {
+               dphase = 0; aphase = 1;
+               index = "movem_index1";
+       }
+       printf ("\tmmu030_state[1] |= MMU030_STATEFLAG1_MOVEM1;\n");
+       printf ("\tint movem_cnt = 0;\n");
+       for (int i = 0; i < 2; i++) {
+               char reg;
+               if (i == dphase)
+                       reg = 'd';
+               else
+                       reg = 'a';
+               printf ("\twhile (%cmask) {\n", reg);
+               if (apdi)
+                       printf ("\t\tsrca -= %d;\n", size);
+               printf ("\t\tif (mmu030_state[0] == movem_cnt) {\n");
+               printf ("\t\t\tif (mmu030_state[1] & MMU030_STATEFLAG1_MOVEM2) {\n");
+               printf ("\t\t\t\tmmu030_state[1] &= ~MMU030_STATEFLAG1_MOVEM2;\n");
+               if (!put)
+                       printf ("\t\t\t\tm68k_%creg (regs, %s[%cmask]) = %smmu030_data_buffer;\n", reg, index, reg, size == 2 ? "(uae_s32)(uae_s16)" : "");
+               printf ("\t\t\t} else {\n");
+               if (put)
+                       printf ("\t\t\t\t%s, m68k_%creg (regs, %s[%cmask]));\n", code, reg, index, reg);
+               else
+                       printf ("\t\t\t\tm68k_%creg (regs, %s[%cmask]) = %s;\n", reg, index, reg, code);
+               printf ("\t\t\t}\n");
+               printf ("\t\t\tmmu030_state[0]++;\n");
+               printf ("\t\t}\n");
+               if (!apdi)
+                       printf ("\t\tsrca += %d;\n", size);
+               printf ("\t\tmovem_cnt++;\n");
+               printf ("\t\t%cmask = movem_next[%cmask];\n", reg, reg);
+               printf ("\t}\n");
+       }
+       if (aipi || apdi)
+               printf ("\tm68k_areg (regs, dstreg) = srca;\n");
+}
+
 static void genmovemel (uae_u16 opcode)
 {
        char getcode[100];
        int size = table68k[opcode].size == sz_long ? 4 : 2;
 
        if (table68k[opcode].size == sz_long) {
-               sprintf (getcode, "%s (srca)", srcl);
+               sprintf (getcode, "%s (srca)", srcld);
        } else {
-               sprintf (getcode, "(uae_s32)(uae_s16)%s (srca)", srcw);
+               sprintf (getcode, "(uae_s32)(uae_s16)%s (srca)", srcwd);
        }
        count_read += table68k[opcode].size == sz_long ? 2 : 1;
        printf ("\tuae_u16 mask = %s;\n", gen_nextiword (0));
        printf ("\tuae_u32 dmask = mask & 0xff, amask = (mask >> 8) & 0xff;\n");
        genamode (table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1, 0);
        start_brace ();
-       printf ("\twhile (dmask) { m68k_dreg (regs, movem_index1[dmask]) = %s; srca += %d; dmask = movem_next[dmask]; }\n",
-               getcode, size);
-       printf ("\twhile (amask) { m68k_areg (regs, movem_index1[amask]) = %s; srca += %d; amask = movem_next[amask]; }\n",
-               getcode, size);
-
-       if (table68k[opcode].dmode == Aipi) {
-               printf ("\tm68k_areg (regs, dstreg) = srca;\n");
-               count_read++;
+       if (using_mmu == 68030) {
+               movem_mmu030 (getcode, size, false, table68k[opcode].dmode == Aipi, false);
+       } else {
+               printf ("\twhile (dmask) { m68k_dreg (regs, movem_index1[dmask]) = %s; srca += %d; dmask = movem_next[dmask]; }\n",
+                       getcode, size);
+               printf ("\twhile (amask) { m68k_areg (regs, movem_index1[amask]) = %s; srca += %d; amask = movem_next[amask]; }\n",
+                       getcode, size);
+               if (table68k[opcode].dmode == Aipi) {
+                       printf ("\tm68k_areg (regs, dstreg) = srca;\n");
+                       count_read++;
+               }
        }
        count_ncycles++;
        fill_prefetch_next ();
@@ -1058,35 +1110,43 @@ static void genmovemle (uae_u16 opcode)
        int size = table68k[opcode].size == sz_long ? 4 : 2;
 
        if (table68k[opcode].size == sz_long) {
-               sprintf (putcode, "%s (srca", dstl);
+               sprintf (putcode, "%s (srca", dstld);
        } else {
-               sprintf (putcode, "%s (srca", dstw);
+               sprintf (putcode, "%s (srca", dstwd);
        }
        count_write += table68k[opcode].size == sz_long ? 2 : 1;
 
        printf ("\tuae_u16 mask = %s;\n", gen_nextiword (0));
        genamode (table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1, 0);
        start_brace ();
-       if (table68k[opcode].dmode == Apdi) {
-               printf ("\tuae_u16 amask = mask & 0xff, dmask = (mask >> 8) & 0xff;\n");
-               if (!using_mmu)
-                       printf ("\tint type = get_cpu_model () >= 68020;\n");
-               printf ("\twhile (amask) {\n");
-               printf ("\t\tsrca -= %d;\n", size);
-               if (!using_mmu)
-                       printf ("\t\tif (type) m68k_areg (regs, dstreg) = srca;\n");
-               printf ("\t\t%s, m68k_areg (regs, movem_index2[amask]));\n", putcode);
-               printf ("\t\tamask = movem_next[amask];\n");
-               printf ("\t}\n");
-               printf ("\twhile (dmask) { srca -= %d; %s, m68k_dreg (regs, movem_index2[dmask])); dmask = movem_next[dmask]; }\n",
-                       size, putcode);
-               printf ("\tm68k_areg (regs, dstreg) = srca;\n");
+       if (using_mmu == 68030) {
+               if (table68k[opcode].dmode == Apdi)
+                       printf ("\tuae_u16 amask = mask & 0xff, dmask = (mask >> 8) & 0xff;\n");
+               else
+                       printf ("\tuae_u16 dmask = mask & 0xff, amask = (mask >> 8) & 0xff;\n");
+               movem_mmu030 (putcode, size, true, false, table68k[opcode].dmode == Apdi);
        } else {
-               printf ("\tuae_u16 dmask = mask & 0xff, amask = (mask >> 8) & 0xff;\n");
-               printf ("\twhile (dmask) { %s, m68k_dreg (regs, movem_index1[dmask])); srca += %d; dmask = movem_next[dmask]; }\n",
-                       putcode, size);
-               printf ("\twhile (amask) { %s, m68k_areg (regs, movem_index1[amask])); srca += %d; amask = movem_next[amask]; }\n",
-                       putcode, size);
+               if (table68k[opcode].dmode == Apdi) {
+                       printf ("\tuae_u16 amask = mask & 0xff, dmask = (mask >> 8) & 0xff;\n");
+                       if (!using_mmu)
+                               printf ("\tint type = get_cpu_model () >= 68020;\n");
+                       printf ("\twhile (amask) {\n");
+                       printf ("\t\tsrca -= %d;\n", size);
+                       if (!using_mmu)
+                               printf ("\t\tif (type) m68k_areg (regs, dstreg) = srca;\n");
+                       printf ("\t\t%s, m68k_areg (regs, movem_index2[amask]));\n", putcode);
+                       printf ("\t\tamask = movem_next[amask];\n");
+                       printf ("\t}\n");
+                       printf ("\twhile (dmask) { srca -= %d; %s, m68k_dreg (regs, movem_index2[dmask])); dmask = movem_next[dmask]; }\n",
+                               size, putcode);
+                       printf ("\tm68k_areg (regs, dstreg) = srca;\n");
+               } else {
+                       printf ("\tuae_u16 dmask = mask & 0xff, amask = (mask >> 8) & 0xff;\n");
+                       printf ("\twhile (dmask) { %s, m68k_dreg (regs, movem_index1[dmask])); srca += %d; dmask = movem_next[dmask]; }\n",
+                               putcode, size);
+                       printf ("\twhile (amask) { %s, m68k_areg (regs, movem_index1[amask])); srca += %d; amask = movem_next[amask]; }\n",
+                               putcode, size);
+               }
        }
        count_ncycles++;
        fill_prefetch_next ();
@@ -1449,6 +1509,9 @@ static void gen_opcode (unsigned long int opcode)
 
        insn_n_cycles = using_prefetch ? 0 : 4;
        ir2irc = 0;
+       mmufixupcnt = 0;
+       mmufixupstate = 0;
+       mmudisp020cnt = 0;
        
        prefetch_long = NULL;
        srcli = NULL;
@@ -1458,6 +1521,8 @@ static void gen_opcode (unsigned long int opcode)
        nextw = NULL;
        nextl = NULL;
        do_cycles = "do_cycles";
+       srcwd = srcld = NULL;
+       dstwd = dstld = NULL;
 
        if (using_indirect) {
                // tracer
@@ -1540,22 +1605,58 @@ static void gen_opcode (unsigned long int opcode)
                        srcb = "get_byte_ce020";
                        dstb = "put_byte_ce020";
                }
-       } else if (using_mmu) {
+       } else if (using_mmu == 68030) {
+               // 68030 MMU
+               disp020 = "get_disp_ea_020_mmu030";
+               prefetch_long = "get_ilong_mmu030_state";
+               prefetch_word = "get_iword_mmu030_state";
+               nextw = "next_iword_mmu030_state";
+               nextl = "next_ilong_mmu030_state";
+               srcli = "get_ilong_mmu030_state";
+               srcwi = "get_iword_mmu030_state";
+               srcbi = "get_ibyte_mmu030_state";
+               srcl = "get_long_mmu030_state";
+               dstl = "put_long_mmu030_state";
+               srcw = "get_word_mmu030_state";
+               dstw = "put_word_mmu030_state";
+               srcb = "get_byte_mmu030_state";
+               dstb = "put_byte_mmu030_state";
+               srcld = "get_long_mmu030";
+               srcwd = "get_word_mmu030";
+               dstld = "put_long_mmu030";
+               dstwd = "put_word_mmu030";
+       } else if (using_mmu == 68040) {
                // 68040 MMU
                disp020 = "x_get_disp_ea_020";
-               prefetch_long = "get_ilong_mmu";
-               prefetch_word = "get_iword_mmu";
-               nextw = "next_iword_mmu";
-               nextl = "next_ilong_mmu";
-               srcli = "get_ilong_mmu";
-               srcwi = "get_iword_muu";
-               srcbi = "get_ibyte_mmu";
-               srcl = "get_long_mmu";
-               dstl = "put_long_mmu";
-               srcw = "get_word_mmu";
-               dstw = "put_word_mmu";
-               srcb = "get_byte_mmu";
-               dstb = "put_byte_mmu";
+               prefetch_long = "get_ilong_mmu040";
+               prefetch_word = "get_iword_mmu040";
+               nextw = "next_iword_mmu040";
+               nextl = "next_ilong_mmu040";
+               srcli = "get_ilong_mmu040";
+               srcwi = "get_iword_mmu040";
+               srcbi = "get_ibyte_mmu040";
+               srcl = "get_long_mmu040";
+               dstl = "put_long_mmu040";
+               srcw = "get_word_mmu040";
+               dstw = "put_word_mmu040";
+               srcb = "get_byte_mmu040";
+               dstb = "put_byte_mmu040";
+       } else if (using_mmu) {
+               // 68060 MMU
+               disp020 = "x_get_disp_ea_020";
+               prefetch_long = "get_ilong_mmu060";
+               prefetch_word = "get_iword_mmu060";
+               nextw = "next_iword_mmu060";
+               nextl = "next_ilong_mmu060";
+               srcli = "get_ilong_mmu060";
+               srcwi = "get_iword_mmu060";
+               srcbi = "get_ibyte_mmu060";
+               srcl = "get_long_mmu060";
+               dstl = "put_long_mmu060";
+               srcw = "get_word_mmu060";
+               dstw = "put_word_mmu060";
+               srcb = "get_byte_mmu060";
+               dstb = "put_byte_mmu060";
        } else if (using_ce) {
                // 68000 ce
                prefetch_word = "get_word_ce000_prefetch";
@@ -1593,6 +1694,14 @@ static void gen_opcode (unsigned long int opcode)
                srcb = "get_byte";
                dstb = "put_byte";
        }
+       if (!dstld)
+               dstld = dstl;
+       if (!dstwd)
+               dstwd = dstw;
+       if (!srcld)
+               srcld = srcl;
+       if (!srcwd)
+               srcwd = srcw;
 
        insn_n_cycles020 = 0;
 
@@ -1712,9 +1821,8 @@ static void gen_opcode (unsigned long int opcode)
        case i_SUBX:
                if (!isreg (curi->smode))
                        addcycles000 (2);
-               genamode_pre (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
+               genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
                genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, GF_AA);
-               genamode_post (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
                fill_prefetch_next ();
                if (curi->size == sz_long && isreg (curi->smode))
                        addcycles000 (4);
@@ -1727,9 +1835,8 @@ static void gen_opcode (unsigned long int opcode)
        case i_SBCD:
                if (!isreg (curi->smode))
                        addcycles000 (2);
-               genamode_pre (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
+               genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
                genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, GF_AA);
-               genamode_post (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
                fill_prefetch_next ();
                start_brace ();
                printf ("\tuae_u16 newv_lo = (dst & 0xF) - (src & 0xF) - (GET_XFLG () ? 1 : 0);\n");
@@ -1798,9 +1905,8 @@ static void gen_opcode (unsigned long int opcode)
        case i_ADDX:
                if (!isreg (curi->smode))
                        addcycles000 (2);
-               genamode_pre (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
+               genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
                genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, GF_AA);
-               genamode_post (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
                fill_prefetch_next ();
                if (curi->size == sz_long && isreg (curi->smode))
                        addcycles000 (4);
@@ -1813,9 +1919,8 @@ static void gen_opcode (unsigned long int opcode)
        case i_ABCD:
                if (!isreg (curi->smode))
                        addcycles000 (2);
-               genamode_pre (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
+               genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
                genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, GF_AA);
-               genamode_post (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
                fill_prefetch_next ();
                start_brace ();
                printf ("\tuae_u16 newv_lo = (src & 0xF) + (dst & 0xF) + (GET_XFLG () ? 1 : 0);\n");
@@ -1943,9 +2048,8 @@ static void gen_opcode (unsigned long int opcode)
                break;
        case i_CMPM:
                // confirmed
-               genamode_pre (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
+               genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
                genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, GF_AA);
-               genamode_post (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
                fill_prefetch_next ();
                start_brace ();
                genflags (flag_cmp, curi->size, "newv", "src", "dst");
@@ -1973,11 +2077,11 @@ static void gen_opcode (unsigned long int opcode)
                genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
                printf ("\tuaecptr memp = m68k_areg (regs, dstreg) + (uae_s32)(uae_s16)%s;\n", gen_nextiword (0));
                if (curi->size == sz_word) {
-                       printf ("\t%s (memp, src >> 8); %s (memp + 2, src);\n", dstb, dstb);
+                       printf ("\t%s (memp, src >> 8);\n\t%s (memp + 2, src);\n", dstb, dstb);
                        count_write += 2;
                } else {
-                       printf ("\t%s (memp, src >> 24); %s (memp + 2, src >> 16);\n", dstb, dstb);
-                       printf ("\t%s (memp + 4, src >> 8); %s (memp + 6, src);\n", dstb, dstb);
+                       printf ("\t%s (memp, src >> 24);\n\t%s (memp + 2, src >> 16);\n", dstb, dstb);
+                       printf ("\t%s (memp + 4, src >> 8);\n\t%s (memp + 6, src);\n", dstb, dstb);
                        count_write += 4;
                }
                fill_prefetch_next ();
@@ -2009,10 +2113,9 @@ static void gen_opcode (unsigned long int opcode)
                        */
                        int prefetch_done = 0, flags;
                        int dualprefetch = curi->dmode == absl && (curi->smode != Dreg && curi->smode != Areg && curi->smode != imm);
-                       genamode_pre (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_MOVE);
+                       genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_MOVE);
                        flags = 1 | (dualprefetch ? GF_NOREFILL : 0);
-                       genamode2 (curi->dmode, "dstreg", curi->size, "dst", 2, 0, flags | GF_MOVE, 0);
-                       genamode_post (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
+                       genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0, flags | GF_MOVE);
                        if (curi->mnemo == i_MOVEA && curi->size == sz_word)
                                printf ("\tsrc = (uae_s32)(uae_s16)src;\n");
                        if (curi->dmode == Apdi) {
@@ -2179,9 +2282,9 @@ static void gen_opcode (unsigned long int opcode)
                    printf ("\tuae_u16 newsr; uae_u32 newpc;\n");
                        printf ("\tfor (;;) {\n");
                        printf ("\t\tuaecptr a = m68k_areg (regs, 7);\n");
-                       printf ("\t\tuae_s16 sr = %s (a);\n", srcw);
-                       printf ("\t\tuae_s32 pc = %s (a + 2);\n", srcl);
-                       printf ("\t\tuae_s16 format = %s (a + 2 + 4);\n", srcw);
+                       printf ("\t\tuae_u16 sr = %s (a);\n", srcw);
+                       printf ("\t\tuae_u32 pc = %s (a + 2);\n", srcl);
+                       printf ("\t\tuae_u16 format = %s (a + 2 + 4);\n", srcw);
                        printf ("\t\tint frame = format >> 12;\n");
                        printf ("\t\tint offset = 8;\n");
                        printf ("\t\tnewsr = sr; newpc = pc;\n");
@@ -2189,12 +2292,20 @@ static void gen_opcode (unsigned long int opcode)
                    printf ("\t\telse if (frame == 0x1) { m68k_areg (regs, 7) += offset; }\n");
                    printf ("\t\telse if (frame == 0x2) { m68k_areg (regs, 7) += offset + 4; break; }\n");
                    printf ("\t\telse if (frame == 0x4) { m68k_areg (regs, 7) += offset + 8; break; }\n");
-                       if (using_mmu)
-                       printf ("\t\telse if (frame == 0x7) { m68k_do_rte_mmu (a); m68k_areg (regs, 7) += offset + 52; break; }\n");
                    printf ("\t\telse if (frame == 0x8) { m68k_areg (regs, 7) += offset + 50; break; }\n");
-                   printf ("\t\telse if (frame == 0x9) { m68k_areg (regs, 7) += offset + 12; break; }\n");
-                   printf ("\t\telse if (frame == 0xa) { m68k_areg (regs, 7) += offset + 24; break; }\n");
-                   printf ("\t\telse if (frame == 0xb) { m68k_areg (regs, 7) += offset + 84; break; }\n");
+                       if (using_mmu == 68040) {
+                       printf ("\t\telse if (frame == 0x7) { m68k_do_rte_mmu040 (a); m68k_areg (regs, 7) += offset + 52; break; }\n");
+                       } else {
+                       printf ("\t\telse if (frame == 0x7) { m68k_areg (regs, 7) += offset + 52; break; }\n");
+                       }
+                       printf ("\t\telse if (frame == 0x9) { m68k_areg (regs, 7) += offset + 12; break; }\n");
+                       if (using_mmu == 68030) {
+                               printf ("\t\telse if (frame == 0xa) { m68k_do_rte_mmu030 (a); break; }\n");
+                           printf ("\t\telse if (frame == 0xb) { m68k_do_rte_mmu030 (a); break; }\n");
+                       } else {
+                               printf ("\t\telse if (frame == 0xa) { m68k_areg (regs, 7) += offset + 24; break; }\n");
+                           printf ("\t\telse if (frame == 0xb) { m68k_areg (regs, 7) += offset + 84; break; }\n");
+                       }
                    printf ("\t\telse { m68k_areg (regs, 7) += offset; Exception (14); goto %s; }\n", endlabelstr);
                    printf ("\t\tregs.sr = newsr; MakeFromSR ();\n}\n");
                    pop_braces (old_brace_level);
@@ -2238,6 +2349,7 @@ static void gen_opcode (unsigned long int opcode)
        case i_LINK:
                // ce confirmed
                if (using_mmu) {
+                       addmmufixup ("srcreg");
                        genamode (curi->dmode, "dstreg", curi->size, "offs", GENA_GETV_FETCH, GENA_MOVEM_DO_INC, 0);
                        genamode (Apdi, "7", sz_long, "old", GENA_GETV_FETCH_ALIGN, GENA_MOVEM_DO_INC, 0);
                        genamode (curi->smode, "srcreg", sz_long, "src", GENA_GETV_FETCH, GENA_MOVEM_DO_INC, 0);
@@ -2258,7 +2370,7 @@ static void gen_opcode (unsigned long int opcode)
                // ce confirmed
                if (using_mmu) {
                        genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
-                       printf ("\tuae_s32 old = get_long_mmu (src);\n");
+                       printf ("\tuae_s32 old = %s (src);\n", srcl);
                        printf ("\tm68k_areg (regs, 7) = src + 4;\n");
                        printf ("\tm68k_areg (regs, srcreg) = old;\n");
                } else {
@@ -2278,7 +2390,7 @@ static void gen_opcode (unsigned long int opcode)
                else if (using_ce)
                        printf ("\tm68k_do_rts_ce ();\n");
                else if (using_mmu)
-                       printf ("\tm68k_do_rts_mmu ();\n");
+                       printf ("\tm68k_do_rts_mmu%s ();\n", mmu_postfix);
                else
                        printf ("\tm68k_do_rts ();\n");
            printf ("\tif (m68k_getpc () & 1) {\n");
@@ -2302,9 +2414,8 @@ static void gen_opcode (unsigned long int opcode)
        case i_RTR:
                printf ("\tuaecptr oldpc = m68k_getpc ();\n");
                printf ("\tMakeSR ();\n");
-               genamode_pre (Aipi, "7", sz_word, "sr", 1, 0, 0);
+               genamode (Aipi, "7", sz_word, "sr", 1, 0, 0);
                genamode (Aipi, "7", sz_long, "pc", 1, 0, 0);
-               genamode_post (Aipi, "7", sz_word, "sr", 1, 0, 0);
                printf ("\tregs.sr &= 0xFF00; sr &= 0xFF;\n");
                printf ("\tregs.sr |= sr;\n");
                setpc ("pc");
@@ -2395,7 +2506,7 @@ static void gen_opcode (unsigned long int opcode)
                } else if (using_ce) {
                        printf ("\tm68k_do_bsr_ce (m68k_getpc () + %d, s);\n", m68k_pc_offset);
                } else if (using_mmu) {
-                       printf ("\tm68k_do_bsr_mmu (m68k_getpc () + %d, s);\n", m68k_pc_offset);
+                       printf ("\tm68k_do_bsr_mmu%s (m68k_getpc () + %d, s);\n", mmu_postfix, m68k_pc_offset);
                } else {
                        printf ("\tm68k_do_bsr (m68k_getpc () + %d, s);\n", m68k_pc_offset);
                }
@@ -3151,6 +3262,8 @@ static void gen_opcode (unsigned long int opcode)
                        genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
                        if (cpu_level == 5 && curi->size > 0) {
                                printf ("\tif ((dsta & %d) && currprefs.cpu_compatible && get_cpu_model () == 68060) {\n", curi->size == 1 ? 1 : 3);
+                               if (curi->dmode == Aipi || curi->dmode == Apdi)
+                                       printf ("\t\tm68k_areg (regs, dstreg) %c= %d;\n", curi->dmode == Aipi ? '-' : '+', 1 << curi->size);
                                printf ("\t\top_unimpl ();\n");
                                printf ("\t\tgoto %s;\n", endlabelstr);
                                printf ("\t}\n");
@@ -3248,9 +3361,12 @@ static void gen_opcode (unsigned long int opcode)
                                printf ("\t} else {\n");
                                genastore ("src", Dreg, "(extra >> 12) & 7", curi->size, "");
                                printf ("\t}\n");
+                               if (using_mmu == 68040)
+                                       sync_m68k_pc ();
                                pop_braces (old_brace_level);
                        }
-                       sync_m68k_pc ();
+                       if (using_mmu != 68040)
+                               sync_m68k_pc ();
                }
                break;
        case i_BKPT:            /* only needed for hardware emulators */
@@ -3380,10 +3496,12 @@ static void gen_opcode (unsigned long int opcode)
                        printf ("\tm68k_dreg (regs, dstreg) = (m68k_dreg (regs, dstreg) & 0xffffff00) | ((val >> 4) & 0xf0) | (val & 0xf);\n");
                } else {
                        printf ("\tuae_u16 val;\n");
+                       addmmufixup ("srcreg");
                        printf ("\tm68k_areg (regs, srcreg) -= areg_byteinc[srcreg];\n");
                        printf ("\tval = (uae_u16)%s (m68k_areg (regs, srcreg));\n", srcb);
                        printf ("\tm68k_areg (regs, srcreg) -= areg_byteinc[srcreg];\n");
                        printf ("\tval = (val | ((uae_u16)%s (m68k_areg (regs, srcreg)) << 8)) + %s;\n", srcb, gen_nextiword (0));
+                       addmmufixup ("dstreg");
                        printf ("\tm68k_areg (regs, dstreg) -= areg_byteinc[dstreg];\n");
                        gen_set_fault_pc ();
                        printf ("\t%s (m68k_areg (regs, dstreg),((val >> 4) & 0xf0) | (val & 0xf));\n", dstb);
@@ -3396,9 +3514,11 @@ static void gen_opcode (unsigned long int opcode)
                        printf ("\tm68k_dreg (regs, dstreg) = (m68k_dreg (regs, dstreg) & 0xffff0000) | (val & 0xffff);\n");
                } else {
                        printf ("\tuae_u16 val;\n");
+                       addmmufixup ("srcreg");
                        printf ("\tm68k_areg (regs, srcreg) -= areg_byteinc[srcreg];\n");
                        printf ("\tval = (uae_u16)%s (m68k_areg (regs, srcreg));\n", srcb);
                        printf ("\tval = (((val << 4) & 0xf00) | (val & 0xf)) + %s;\n", gen_nextiword (0));
+                       addmmufixup ("dstreg");
                        if (cpu_level >= 2) {
                                printf ("\tm68k_areg (regs, dstreg) -= 2 * areg_byteinc[dstreg];\n");
                                printf ("\t%s (m68k_areg (regs, dstreg) + areg_byteinc[dstreg], val);\n", dstb);
@@ -3485,7 +3605,7 @@ static void gen_opcode (unsigned long int opcode)
        case i_CPUSHP:
        case i_CPUSHA:
                if (using_mmu)
-                       printf ("\tflush_mmu(m68k_areg (regs, opcode & 3), (opcode >> 6) & 3);\n");
+                       printf ("\tflush_mmu%s(m68k_areg (regs, opcode & 3), (opcode >> 6) & 3);\n", mmu_postfix);
                printf ("\tif (opcode & 0x80)\n");
                printf ("\t\tflush_icache(m68k_areg (regs, opcode & 3), (opcode >> 6) & 3);\n");
                break;
@@ -3494,36 +3614,46 @@ static void gen_opcode (unsigned long int opcode)
                {
                        if ((opcode & 0xfff8) == 0xf620) {
                                /* MOVE16 (Ax)+,(Ay)+ */
-                               printf ("\tuae_u32 v1, v2, v3, v4;\n");
+                               printf ("\tuae_u32 v[4];\n");
                                printf ("\tuaecptr mems = m68k_areg (regs, srcreg) & ~15, memd;\n");
                                printf ("\tdstreg = (%s >> 12) & 7;\n", gen_nextiword (0));
                                printf ("\tmemd = m68k_areg (regs, dstreg) & ~15;\n");
-                               printf ("\tv1 = %s (mems);\n", srcl);
-                               printf ("\tv2 = %s (mems + 4);\n", srcl);
-                               printf ("\tv3 = %s (mems + 8);\n", srcl);
-                               printf ("\tv4 = %s (mems + 12);\n", srcl);
-                               printf ("\t%s (memd , v1);\n", dstl);
-                               printf ("\t%s (memd + 4, v2);\n", dstl);
-                               printf ("\t%s (memd + 8, v3);\n", dstl);
-                               printf ("\t%s (memd + 12, v4);\n", dstl);
+                               if (using_mmu == 68060) {
+                                       printf ("\tget_move16_mmu060 (mems, v);\n");
+                                       printf ("\tput_move16_mmu060 (memd, v);\n");
+                               } else {
+                                       printf ("\tv[0] = %s (mems);\n", srcl);
+                                       printf ("\tv[1] = %s (mems + 4);\n", srcl);
+                                       printf ("\tv[2] = %s (mems + 8);\n", srcl);
+                                       printf ("\tv[3] = %s (mems + 12);\n", srcl);
+                                       printf ("\t%s (memd , v[0]);\n", dstl);
+                                       printf ("\t%s (memd + 4, v[1]);\n", dstl);
+                                       printf ("\t%s (memd + 8, v[2]);\n", dstl);
+                                       printf ("\t%s (memd + 12, v[3]);\n", dstl);
+                               }
                                printf ("\tif (srcreg != dstreg)\n");
                                printf ("\t\tm68k_areg (regs, srcreg) += 16;\n");
                                printf ("\tm68k_areg (regs, dstreg) += 16;\n");
                        } else {
                                /* Other variants */
-                               printf ("\tuae_u32 v1, v2, v3, v4;\n");
+                               printf ("\tuae_u32 v[4];\n");
                                genamode (curi->smode, "srcreg", curi->size, "mems", 0, 2, 0);
                                genamode (curi->dmode, "dstreg", curi->size, "memd", 0, 2, 0);
                                printf ("\tmemsa &= ~15;\n");
                                printf ("\tmemda &= ~15;\n");
-                               printf ("\tv1 = %s (memsa);\n", srcl);
-                               printf ("\tv2 = %s (memsa + 4);\n", srcl);
-                               printf ("\tv3 = %s (memsa + 8);\n", srcl);
-                               printf ("\tv4 = %s (memsa + 12);\n", srcl);
-                               printf ("\t%s (memda , v1);\n", dstl);
-                               printf ("\t%s (memda + 4, v2);\n", dstl);
-                               printf ("\t%s (memda + 8, v3);\n", dstl);
-                               printf ("\t%s (memda + 12, v4);\n", dstl);
+                               if (using_mmu == 68060) {
+                                       printf ("\tget_move16_mmu060 (memsa, v);\n");
+                                       printf ("\tput_move16_mmu060 (memda, v);\n");
+                               } else {
+                                       printf ("\tv[0] = %s (memsa);\n", srcl);
+                                       printf ("\tv[1] = %s (memsa + 4);\n", srcl);
+                                       printf ("\tv[2] = %s (memsa + 8);\n", srcl);
+                                       printf ("\tv[3] = %s (memsa + 12);\n", srcl);
+                                       printf ("\t%s (memda , v[0]);\n", dstl);
+                                       printf ("\t%s (memda + 4, v[1]);\n", dstl);
+                                       printf ("\t%s (memda + 8, v[2]);\n", dstl);
+                                       printf ("\t%s (memda + 12, v[3]);\n", dstl);
+                               }
                                if ((opcode & 0xfff8) == 0xf600)
                                        printf ("\tm68k_areg (regs, srcreg) += 16;\n");
                                else if ((opcode & 0xfff8) == 0xf608)
@@ -3545,7 +3675,7 @@ static void gen_opcode (unsigned long int opcode)
                break;
        case i_MMUOP030:
                printf ("\tuaecptr pc = m68k_getpc ();\n");
-               printf ("\tuae_u16 extra = x_get_word (pc + 2);\n");
+               printf ("\tuae_u16 extra = %s (2);\n", prefetch_word);
                m68k_pc_offset += 2;
                sync_m68k_pc ();
                if (curi->smode == Areg || curi->smode == Dreg)
@@ -3574,7 +3704,7 @@ static void gen_opcode (unsigned long int opcode)
        did_prefetch = 0;
 }
 
-static void generate_includes (FILE * f)
+static void generate_includes (FILE * f, int id)
 {
        fprintf (f, "#include \"sysconfig.h\"\n");
        fprintf (f, "#include \"sysdeps.h\"\n");
@@ -3585,8 +3715,10 @@ static void generate_includes (FILE * f)
        fprintf (f, "#include \"newcpu.h\"\n");
        fprintf (f, "#include \"cpu_prefetch.h\"\n");
        fprintf (f, "#include \"cputbl.h\"\n");
-       fprintf (f, "#include \"cpummu.h\"\n");
-
+       if (id == 31 || id == 33)
+               fprintf (f, "#include \"cpummu.h\"\n");
+       else if (id == 32)
+               fprintf (f, "#include \"cpummu030.h\"\n");
 
        fprintf (f, "#define CPUFUNC(x) x##_ff\n"
                "#define SET_CFLG_ALWAYS(x) SET_CFLG(x)\n"
@@ -3813,6 +3945,8 @@ static void generate_one_opcode (int rp, char *extra)
        gen_opcode (opcode);
        if (need_endlabel)
                printf ("%s: ;\n", endlabelstr);
+       clearmmufixup (0);
+       clearmmufixup (1);
        returncycles ("", insn_n_cycles);
        printf ("}");
        if (using_ce || using_prefetch) {
@@ -3893,21 +4027,21 @@ static void generate_cpu (int id, int mode)
        }
 
        postfix = id;
-       if (id == 0 || id == 11 || id == 12 || id == 20 || id == 21 || id == 22 || id == 31) {
+       if (id == 0 || id == 11 || id == 12 || id == 20 || id == 21 || id == 22 || id == 31 || id == 32 || id == 33) {
                if (generate_stbl)
                        fprintf (stblfile, "#ifdef CPUEMU_%d%s\n", postfix, extraup);
                postfix2 = postfix;
                sprintf (fname, "cpuemu_%d%s.cpp", postfix, extra);
                freopen (fname, "wb", stdout);
-               generate_includes (stdout);
+               generate_includes (stdout, id);
        }
 
-       using_mmu = 0;
        using_prefetch = 0;
        using_prefetch_020 = 0;
        using_ce = 0;
        using_ce020 = 0;
        using_mmu = 0;
+       mmu_postfix = "";
 
        if (id == 11 || id == 12) { // 11 = 68000 prefetch, 12 = 68000 cycle-exact
                cpu_level = 0;
@@ -3937,11 +4071,25 @@ static void generate_cpu (int id, int mode)
                        for (rp = 0; rp < nr_cpuop_funcs; rp++)
                                opcode_next_clev[rp] = cpu_level;
                }
-       } else if (id >= 31 && id < 40) { // 31 = 68040 MMU
+       } else if (id == 31) { // 31 = 68040 MMU
+               mmu_postfix = "040";
                cpu_level = 4;
-               using_mmu = 1;
-               if (id == 31)
-                       read_counts ();
+               using_mmu = 68040;
+               read_counts ();
+               for (rp = 0; rp < nr_cpuop_funcs; rp++)
+                       opcode_next_clev[rp] = cpu_level;
+       } else if (id == 32) { // 32 = 68030 MMU
+               mmu_postfix = "030";
+               cpu_level = 3;
+               using_mmu = 68030;
+               read_counts ();
+               for (rp = 0; rp < nr_cpuop_funcs; rp++)
+                       opcode_next_clev[rp] = cpu_level;
+       } else if (id == 33) { // 33 = 68060 MMU
+               mmu_postfix = "060";
+               cpu_level = 5;
+               using_mmu = 68060;
+               read_counts ();
                for (rp = 0; rp < nr_cpuop_funcs; rp++)
                        opcode_next_clev[rp] = cpu_level;
        } else {
@@ -3984,14 +4132,14 @@ int main (int argc, char **argv)
        headerfile = fopen ("cputbl.h", "wb");
 
        stblfile = fopen ("cpustbl.cpp", "wb");
-       generate_includes (stblfile);
+       generate_includes (stblfile, 0);
 
        using_prefetch = 0;
        using_indirect = 0;
        using_exception_3 = 1;
        using_ce = 0;
 
-       for (i = 0; i < 32; i++) {
+       for (i = 0; i <= 33; i++) {
                if ((i >= 6 && i < 11) || (i > 12 && i < 20) || (i > 24 && i < 31))
                        continue;
                generate_stbl = 1;
index 3415d052da64df869459ac30520705c2885a0800..350dcfd52dd2a5ceb4ea02b2a80bed6cbe138c8c 100644 (file)
@@ -7,6 +7,8 @@
 *           2002 Toni Wilen (scsi emulation, 64-bit support)
 */
 
+#define USE_CHD 1
+
 #include "sysconfig.h"
 #include "sysdeps.h"
 
 #include "execio.h"
 #include "zfile.h"
 
+#if USE_CHD
+#include "archivers/chd/chdtypes.h"
+#include "archivers/chd/chd.h"
+#endif
+
 #undef DEBUGME
 #define hf_log
 #define hf_log2
@@ -63,8 +70,9 @@ struct hardfileprivdata {
        uaecptr changeint;
 };
 
-#define VHD_DYNAMIC 3
-#define VHD_FIXED 2
+#define HFD_VHD_DYNAMIC 3
+#define HFD_VHD_FIXED 2
+#define HFD_CHD 1
 
 STATIC_INLINE uae_u32 gl (uae_u8 *p)
 {
@@ -102,19 +110,19 @@ static void getchs2 (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head,
        int sectors = 63;
 
        /* do we have RDB values? */
-       if (hfd->cylinders) {
-               *cyl = hfd->cylinders;
-               *tracksec = hfd->sectors;
-               *head = hfd->heads;
-               *cylsec = hfd->sectors * hfd->heads;
+       if (hfd->rdbcylinders) {
+               *cyl = hfd->rdbcylinders;
+               *tracksec = hfd->rdbsectors;
+               *head = hfd->rdbheads;
+               *cylsec = hfd->rdbsectors * hfd->rdbheads;
                return;
        }
        /* what about HDF settings? */
-       if (hfd->surfaces && hfd->secspertrack) {
-               *head = hfd->surfaces;
-               *tracksec = hfd->secspertrack;
+       if (hfd->ci.surfaces && hfd->ci.sectors) {
+               *head = hfd->ci.surfaces;
+               *tracksec = hfd->ci.sectors;
                *cylsec = (*head) * (*tracksec);
-               *cyl = (unsigned int)(hfd->virtsize / hfd->blocksize) / ((*tracksec) * (*head));
+               *cyl = (unsigned int)(hfd->virtsize / hfd->ci.blocksize) / ((*tracksec) * (*head));
                return;
        }
        /* no, lets guess something.. */
@@ -128,7 +136,7 @@ static void getchs2 (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head,
                heads = 128;
        else
                heads = 255;
-       *cyl = (unsigned int)(hfd->virtsize / hfd->blocksize) / (sectors * heads);
+       *cyl = (unsigned int)(hfd->virtsize / hfd->ci.blocksize) / (sectors * heads);
        *cylsec = sectors * heads;
        *tracksec = sectors;
        *head = heads;
@@ -276,10 +284,10 @@ static void rdb_crc (uae_u8 *p)
        pl (p, 2, sum);
 }
 
-static void create_virtual_rdb (struct hardfiledata *hfd, uae_u32 dostype, int bootpri, const TCHAR *filesys)
+static void create_virtual_rdb (struct hardfiledata *hfd)
 {
        uae_u8 *rdb, *part, *denv;
-       int cyl = hfd->heads * hfd->secspertrack;
+       int cyl = hfd->ci.surfaces * hfd->ci.sectors;
        int cyls = 262144 / (cyl * 512);
        int size = cyl * cyls * 512;
 
@@ -303,10 +311,10 @@ static void create_virtual_rdb (struct hardfiledata *hfd, uae_u32 dostype, int b
        pl(rdb, 13, -1); // reserved
        pl(rdb, 14, -1); // reserved
        pl(rdb, 15, -1); // reserved
-       pl(rdb, 16, hfd->nrcyls);
-       pl(rdb, 17, hfd->secspertrack);
-       pl(rdb, 18, hfd->heads);
-       pl(rdb, 19, 0); // interleave
+       pl(rdb, 16, hfd->ci.highcyl);
+       pl(rdb, 17, hfd->ci.sectors);
+       pl(rdb, 18, hfd->ci.surfaces);
+       pl(rdb, 19, hfd->ci.interleave); // interleave
        pl(rdb, 20, 0); // park
        pl(rdb, 21, -1); // res
        pl(rdb, 22, -1); // res
@@ -322,7 +330,7 @@ static void create_virtual_rdb (struct hardfiledata *hfd, uae_u32 dostype, int b
        pl(rdb, 32, 0); // rdbblockslo
        pl(rdb, 33, cyl * cyls); // rdbblockshi
        pl(rdb, 34, cyls); // locyl
-       pl(rdb, 35, hfd->nrcyls + cyls); // hicyl
+       pl(rdb, 35, hfd->ci.highcyl + cyls); // hicyl
        pl(rdb, 36, cyl); // cylblocks
        pl(rdb, 37, 0); // autopark
        pl(rdb, 38, 2); // highrdskblock
@@ -348,20 +356,20 @@ static void create_virtual_rdb (struct hardfiledata *hfd, uae_u32 dostype, int b
        pl(denv, 0, 80);
        pl(denv, 1, 512 / 4);
        pl(denv, 2, 0); // secorg
-       pl(denv, 3, hfd->heads);
-       pl(denv, 4, hfd->blocksize / 512);
-       pl(denv, 5, hfd->secspertrack);
-       pl(denv, 6, hfd->reservedblocks);
+       pl(denv, 3, hfd->ci.surfaces);
+       pl(denv, 4, hfd->ci.blocksize / 512);
+       pl(denv, 5, hfd->ci.sectors);
+       pl(denv, 6, hfd->ci.reserved);
        pl(denv, 7, 0); // prealloc
-       pl(denv, 8, 0); // interleave
+       pl(denv, 8, hfd->ci.interleave); // interleave
        pl(denv, 9, cyls); // lowcyl
-       pl(denv, 10, hfd->nrcyls + cyls - 1);
-       pl(denv, 11, 50);
-       pl(denv, 12, 0);
-       pl(denv, 13, 0x00ffffff);
-       pl(denv, 14, 0x7ffffffe);
-       pl(denv, 15, bootpri);
-       pl(denv, 16, dostype);
+       pl(denv, 10, hfd->ci.highcyl + cyls - 1);
+       pl(denv, 11, hfd->ci.buffers);
+       pl(denv, 12, hfd->ci.bufmemtype);
+       pl(denv, 13, hfd->ci.maxtransfer);
+       pl(denv, 14, hfd->ci.mask);
+       pl(denv, 15, hfd->ci.bootpri);
+       pl(denv, 16, hfd->ci.dostype);
        rdb_crc (part);
 
        hfd->virtsize += size;
@@ -373,48 +381,35 @@ void hdf_hd_close (struct hd_hardfiledata *hfd)
        if (!hfd)
                return;
        hdf_close (&hfd->hfd);
-       xfree (hfd->path);
 }
 
-int hdf_hd_open (struct hd_hardfiledata *hfd, const TCHAR *path, int blocksize, int readonly,
-       const TCHAR *devname, int cyls, int sectors, int surfaces, int reserved,
-       int bootpri, const TCHAR *filesys,
-       int pcyls, int pheads, int psecs)
+int hdf_hd_open (struct hd_hardfiledata *hfd)
 {
-       memset (hfd, 0, sizeof (struct hd_hardfiledata));
-       hfd->bootpri = bootpri;
-       hfd->hfd.blocksize = blocksize;
-       hfd->hfd.readonly = readonly;
-       if (!hdf_open (&hfd->hfd, path))
+       struct uaedev_config_info *ci = &hfd->hfd.ci;
+       if (!hdf_open (&hfd->hfd))
                return 0;
-       hfd->path = my_strdup(path);
-       hfd->hfd.cylinders = cyls;
-       hfd->hfd.heads = surfaces;
-       hfd->hfd.reservedblocks = reserved;
-       hfd->hfd.secspertrack = sectors;
-       if (devname)
-               _tcscpy (hfd->hfd.device_name, devname);
-       if (pcyls && pheads && psecs) {
-               hfd->cyls = pcyls;
-               hfd->heads = pheads;
-               hfd->secspertrack = psecs;
-       } else if (cyls && surfaces && sectors) {
-               hfd->cyls = cyls;
-               hfd->heads = surfaces;
-               hfd->secspertrack = sectors;
+       if (ci->pcyls && ci->pheads && ci->psecs) {
+               hfd->cyls = ci->pcyls;
+               hfd->heads = ci->pheads;
+               hfd->secspertrack = ci->psecs;
+       } else if (ci->highcyl && ci->surfaces && ci->sectors) {
+               hfd->cyls = ci->highcyl;
+               hfd->heads = ci->surfaces;
+               hfd->secspertrack = ci->sectors;
        } else {
                getchshd (&hfd->hfd, &hfd->cyls, &hfd->heads, &hfd->secspertrack);
        }
        hfd->cyls_def = hfd->cyls;
        hfd->secspertrack_def = hfd->secspertrack;
        hfd->heads_def = hfd->heads;
-       if (hfd->hfd.heads && hfd->hfd.secspertrack) {
+       if (ci->surfaces && ci->sectors) {
                uae_u8 buf[512] = { 0 };
                hdf_read (&hfd->hfd, buf, 0, 512);
                if (buf[0] != 0 && memcmp (buf, _T("RDSK"), 4)) {
-                       hfd->hfd.nrcyls = (hfd->hfd.virtsize / blocksize) / (sectors * surfaces);
-                       create_virtual_rdb (&hfd->hfd, rl (buf), hfd->bootpri, filesys);
-                       while (hfd->hfd.nrcyls * surfaces * sectors > hfd->cyls_def * hfd->secspertrack_def * hfd->heads_def) {
+                       ci->highcyl = (hfd->hfd.virtsize / ci->blocksize) / (ci->sectors * ci->surfaces);
+                       ci->dostype = rl (buf);
+                       create_virtual_rdb (&hfd->hfd);
+                       while (ci->highcyl * ci->surfaces * ci->sectors > hfd->cyls_def * hfd->secspertrack_def * hfd->heads_def) {
                                hfd->cyls_def++;
                        }
                }
@@ -462,8 +457,36 @@ int hdf_open (struct hardfiledata *hfd, const TCHAR *pname)
        uae_u8 tmp[512], tmp2[512];
        uae_u32 v;
 
+       if ((!pname || pname[0] == 0) && hfd->ci.rootdir[0] == 0)
+               return 0;
        hfd->adide = 0;
        hfd->byteswap = 0;
+       hfd->hfd_type = 0;
+       if (!pname)
+               pname = hfd->ci.rootdir;
+#if USE_CHD
+       TCHAR nametmp[MAX_DPATH];
+       _tcscpy (nametmp, pname);
+       TCHAR *ext = _tcsrchr (nametmp, '.');
+       if (ext && !_tcsicmp (ext, _T(".chd"))) {
+               struct zfile *zf = zfile_fopen (nametmp, _T("rb"));
+               if (zf) {
+                       int err;
+                       chd_file *cf = new chd_file();
+                       err = cf->open(zf, false, NULL);
+                       if (err != CHDERR_NONE) {
+                               zfile_fclose (zf);
+                               goto nonvhd;
+                       }
+                       hfd->chd_handle = cf;
+                       hfd->ci.readonly = true;
+                       hfd->hfd_type = HFD_CHD;
+                       hfd->handle_valid = -1;
+                       hfd->virtsize = cf->logical_bytes ();
+                       goto nonvhd;
+               }
+       }
+#endif
        if (!hdf_open_target (hfd, pname))
                return 0;
        if (hdf_read_target (hfd, tmp, 0, 512) != 512)
@@ -474,8 +497,8 @@ int hdf_open (struct hardfiledata *hfd, const TCHAR *pname)
        v = gl (tmp + 8 + 4); // version
        if ((v >> 16) != 1)
                goto nonvhd;
-       hfd->vhd_type = gl (tmp + 8 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 8 + 8 + 4);
-       if (hfd->vhd_type != VHD_FIXED && hfd->vhd_type != VHD_DYNAMIC)
+       hfd->hfd_type = gl (tmp + 8 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 8 + 8 + 4);
+       if (hfd->hfd_type != HFD_VHD_FIXED && hfd->hfd_type != HFD_VHD_DYNAMIC)
                goto nonvhd;
        v = gl (tmp + 8 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 8 + 8 + 4 + 4);
        if (v == 0)
@@ -489,7 +512,7 @@ int hdf_open (struct hardfiledata *hfd, const TCHAR *pname)
        hfd->vhd_footerblock = hfd->physsize - 512;
        hfd->virtsize = (uae_u64)(gl (tmp + 8 + 4 + 4 + 8 + 4 + 4 +4 + 4 + 8)) << 32;
        hfd->virtsize |= gl (tmp + 8 + 4 + 4 + 8 + 4 + 4 +4 + 4 + 8 + 4);
-       if (hfd->vhd_type == VHD_DYNAMIC) {
+       if (hfd->hfd_type == HFD_VHD_DYNAMIC) {
                uae_u32 size;
                hfd->vhd_bamoffset = gl (tmp + 8 + 4 + 4 + 4);
                if (hfd->vhd_bamoffset == 0 || hfd->vhd_bamoffset >= hfd->physsize)
@@ -514,23 +537,31 @@ int hdf_open (struct hardfiledata *hfd, const TCHAR *pname)
                hfd->vhd_bitmapsize = ((hfd->vhd_blocksize / (8 * 512)) + 511) & ~511;
        }
        write_log (_T("HDF is VHD %s image, virtual size=%dK\n"),
-               hfd->vhd_type == 2 ? _T("fixed") : _T("dynamic"),
+               hfd->hfd_type == HFD_VHD_FIXED ? _T("fixed") : _T("dynamic"),
                hfd->virtsize / 1024);
        hdf_init_cache (hfd);
        return 1;
 nonvhd:
-       hfd->vhd_type = 0;
        return 1;
 end:
        hdf_close_target (hfd);
        return 0;
 }
+int hdf_open (struct hardfiledata *hfd)
+{
+       return hdf_open (hfd, NULL);
+}
 
 void hdf_close (struct hardfiledata *hfd)
 {
        hdf_flush_cache (hfd);
        hdf_close_target (hfd);
-       hfd->vhd_type = 0;
+       if (hfd->chd_handle) {
+               chd_file *cf = (chd_file*)hfd->chd_handle;
+               cf->close();
+               hfd->chd_handle = NULL;
+       }
+       hfd->hfd_type = 0;
        xfree (hfd->vhd_header);
        hfd->vhd_header = NULL;
        xfree (hfd->vhd_sectormap);
@@ -723,7 +754,7 @@ int vhd_create (const TCHAR *name, uae_u64 size, uae_u32 dostype)
 
        memset (&hfd, 0, sizeof hfd);
        hfd.virtsize = hfd.physsize = size;
-       hfd.blocksize = 512;
+       hfd.ci.blocksize = 512;
        strcpy ((char*)b, "conectix"); // cookie
        b[0x0b] = 2; // features
        b[0x0d] = 1; // version
@@ -755,7 +786,7 @@ int vhd_create (const TCHAR *name, uae_u64 size, uae_u32 dostype)
        // sectors per track
        b[0x3b] = tracksec;
        // disk type
-       b[0x3c + 3] = VHD_DYNAMIC;
+       b[0x3c + 3] = HFD_VHD_DYNAMIC;
        get_guid_target (b + 0x44);
        crc = vhd_checksum (b, -1);
        b[0x40] = crc >> 24;
@@ -830,20 +861,27 @@ end:
 
 static int hdf_read2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
 {
-       if (hfd->vhd_type == VHD_DYNAMIC)
+       if (hfd->hfd_type == HFD_VHD_DYNAMIC)
                return vhd_read (hfd, buffer, offset, len);
-       else if (hfd->vhd_type == VHD_FIXED)
+       else if (hfd->hfd_type == HFD_VHD_FIXED)
                return hdf_read_target (hfd, buffer, offset + 512, len);
-       else
+       else if (hfd->hfd_type == HFD_CHD) {
+               chd_file *cf = (chd_file*)hfd->chd_handle;
+               if (cf->read_bytes(offset, buffer, len) == CHDERR_NONE)
+                       return len;
+               return 0;
+       } else
                return hdf_read_target (hfd, buffer, offset, len);
 }
 
 static int hdf_write2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
 {
-       if (hfd->vhd_type == VHD_DYNAMIC)
+       if (hfd->hfd_type == HFD_VHD_DYNAMIC)
                return vhd_write (hfd, buffer, offset, len);
-       else if (hfd->vhd_type == VHD_FIXED)
+       else if (hfd->hfd_type == HFD_VHD_FIXED)
                return hdf_write_target (hfd, buffer, offset + 512, len);
+       else if (hfd->hfd_type == HFD_CHD)
+               return 0;
        else
                return hdf_write_target (hfd, buffer, offset, len);
 }
@@ -1028,7 +1066,7 @@ static uae_u64 cmd_readx (struct hardfiledata *hfd, uae_u8 *dataptr, uae_u64 off
 {
        gui_flicker_led (LED_HD, hfd->unitnum, 1);
        hf_log3 (_T("cmd_read: %p %04x-%08x (%d) %08x (%d)\n"),
-               dataptr, (uae_u32)(offset >> 32), (uae_u32)offset, (uae_u32)(offset / hfd->blocksize), (uae_u32)len, (uae_u32)(len / hfd->blocksize));
+               dataptr, (uae_u32)(offset >> 32), (uae_u32)offset, (uae_u32)(offset / hfd->ci.blocksize), (uae_u32)len, (uae_u32)(len / hfd->ci.blocksize));
        return hdf_read (hfd, dataptr, offset, len);
 }
 static uae_u64 cmd_read (struct hardfiledata *hfd, uaecptr dataptr, uae_u64 offset, uae_u64 len)
@@ -1042,7 +1080,7 @@ static uae_u64 cmd_writex (struct hardfiledata *hfd, uae_u8 *dataptr, uae_u64 of
 {
        gui_flicker_led (LED_HD, hfd->unitnum, 2);
        hf_log3 (_T("cmd_write: %p %04x-%08x (%d) %08x (%d)\n"),
-               dataptr, (uae_u32)(offset >> 32), (uae_u32)offset, (uae_u32)(offset / hfd->blocksize), (uae_u32)len, (uae_u32)(len / hfd->blocksize));
+               dataptr, (uae_u32)(offset >> 32), (uae_u32)offset, (uae_u32)(offset / hfd->ci.blocksize), (uae_u32)len, (uae_u32)(len / hfd->ci.blocksize));
        return hdf_write (hfd, dataptr, offset, len);
 }
 
@@ -1077,12 +1115,21 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u
        int lr = 0, ls = 0;
        int scsi_len = -1;
        int status = 0;
-       int i;
+       int i, lun;
        char *ss;
 
        *reply_len = *sense_len = 0;
        memset (r, 0, 256);
        memset (s, 0, 256);
+       lun = cmdbuf[1] >> 5;
+       if (lun) {
+               status = 2; /* CHECK CONDITION */
+               s[0] = 0x70;
+               s[2] = 5; /* ILLEGAL REQUEST */
+               s[12] = 0x25; /* INVALID LUN */
+               ls = 12;
+               goto err;
+       }
        switch (cmdbuf[0])
        {
        case 0x00: /* TEST UNIT READY */
@@ -1090,82 +1137,89 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u
                        goto nodisk;
                scsi_len = 0;
                break;
+       case 0x03: /* REQUEST SENSE */
+               scsi_len = cmdbuf[4] > MAX_SCSI_SENSE ? MAX_SCSI_SENSE : cmdbuf[4];
+               memcpy (r, hfd->scsi_sense, scsi_len);
+               memset (hfd->scsi_sense, 0, MAX_SCSI_SENSE);
+               break;
        case 0x08: /* READ (6) */
                if (nodisk (hfd))
                        goto nodisk;
                offset = ((cmdbuf[1] & 31) << 16) | (cmdbuf[2] << 8) | cmdbuf[3];
-               offset *= hfd->blocksize;
+               offset *= hfd->ci.blocksize;
                len = cmdbuf[4];
                if (!len)
                        len = 256;
-               len *= hfd->blocksize;
+               len *= hfd->ci.blocksize;
                if (checkbounds(hfd, offset, len))
                        scsi_len = (uae_u32)cmd_readx (hfd, scsi_data, offset, len);
                break;
        case 0x0a: /* WRITE (6) */
                if (nodisk (hfd))
                        goto nodisk;
-               if (hfd->readonly || hfd->dangerous)
+               if (hfd->ci.readonly || hfd->dangerous)
                        goto readprot;
                offset = ((cmdbuf[1] & 31) << 16) | (cmdbuf[2] << 8) | cmdbuf[3];
-               offset *= hfd->blocksize;
+               offset *= hfd->ci.blocksize;
                len = cmdbuf[4];
                if (!len)
                        len = 256;
-               len *= hfd->blocksize;
+               len *= hfd->ci.blocksize;
                if (checkbounds(hfd, offset, len))
                        scsi_len = (uae_u32)cmd_writex (hfd, scsi_data, offset, len);
                break;
        case 0x12: /* INQUIRY */
-               if ((cmdbuf[1] & 1) || cmdbuf[2] != 0)
-                       goto err;
-               len = cmdbuf[4];
-               if (cmdbuf[1] >> 5)
-                       goto err;//r[0] = 0x7f; /* no lun supported */
-               if (hfd->drive_empty)
-                       r[1] |= 0x80; // removable..
-               r[2] = 2; /* supports SCSI-2 */
-               r[3] = 2; /* response data format */
-               r[4] = 32; /* additional length */
-               r[7] = 0x20; /* 16 bit bus */
-               scsi_len = lr = len < 36 ? (uae_u32)len : 36;
-               if (hdhfd) {
-                       r[2] = hdhfd->ansi_version;
-                       r[3] = hdhfd->ansi_version >= 2 ? 2 : 0;
-               }
-               ss = ua (hfd->vendor_id);
-               i = 0; /* vendor id */
-               while (i < 8 && ss[i]) {
-                       r[8 + i] = ss[i];
-                       i++;
-               }
-               while (i < 8) {
-                       r[8 + i] = 32;
-                       i++;
-               }
-               xfree (ss);
-               ss = ua (hfd->product_id);
-               i = 0; /* product id */
-               while (i < 16 && ss[i]) {
-                       r[16 + i] = ss[i];
-                       i++;
-               }
-               while (i < 16) {
-                       r[16 + i] = 32;
-                       i++;
-               }
-               xfree (ss);
-               ss = ua (hfd->product_rev);
-               i = 0; /* product revision */
-               while (i < 4 && ss[i]) {
-                       r[32 + i] = ss[i];
-                       i++;
-               }
-               while (i < 4) {
-                       r[32 + i] = 32;
-                       i++;
+               {
+                       if ((cmdbuf[1] & 1) || cmdbuf[2] != 0)
+                               goto err;
+                       int alen = (cmdbuf[3] << 8) | cmdbuf[4];
+                       if (hfd->drive_empty) {
+                               r[1] |= 0x80; // removable..
+                               r[0] |= 0x20; // not present
+                       }
+                       r[2] = 2; /* supports SCSI-2 */
+                       r[3] = 2; /* response data format */
+                       r[4] = 32; /* additional length */
+                       r[7] = 0x20; /* 16 bit bus */
+                       scsi_len = lr = alen < 36 ? alen : 36;
+                       if (hdhfd) {
+                               r[2] = hdhfd->ansi_version;
+                               r[3] = hdhfd->ansi_version >= 2 ? 2 : 0;
+                       }
+                       ss = ua (hfd->vendor_id);
+                       i = 0; /* vendor id */
+                       while (i < 8 && ss[i]) {
+                               r[8 + i] = ss[i];
+                               i++;
+                       }
+                       while (i < 8) {
+                               r[8 + i] = 32;
+                               i++;
+                       }
+                       xfree (ss);
+                       ss = ua (hfd->product_id);
+                       i = 0; /* product id */
+                       while (i < 16 && ss[i]) {
+                               r[16 + i] = ss[i];
+                               i++;
+                       }
+                       while (i < 16) {
+                               r[16 + i] = 32;
+                               i++;
+                       }
+                       xfree (ss);
+                       ss = ua (hfd->product_rev);
+                       i = 0; /* product revision */
+                       while (i < 4 && ss[i]) {
+                               r[32 + i] = ss[i];
+                               i++;
+                       }
+                       while (i < 4) {
+                               r[32 + i] = 32;
+                               i++;
+                       }
+                       xfree (ss);
                }
-               xfree (ss);
                break;
        case 0x1a: /* MODE SENSE(6) */
                {
@@ -1173,6 +1227,7 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u
                        int pc = cmdbuf[2] >> 6;
                        int pcode = cmdbuf[2] & 0x3f;
                        int dbd = cmdbuf[1] & 8;
+                       int alen = cmdbuf[4];
                        int cyl, cylsec, head, tracksec;
                        if (nodisk (hfd))
                                goto nodisk;
@@ -1192,42 +1247,54 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u
                        p[3] = 0;
                        p += 4;
                        if (!dbd) {
-                               uae_u32 blocks = (uae_u32)(hfd->virtsize / hfd->blocksize);
-                               p[-1] = 8;
-                               wl(p + 0, blocks);
-                               wl(p + 4, hfd->blocksize);
-                               p += 8;
+                               if (alen >= r[0] + 1 + 8) {
+                                       uae_u32 blocks = (uae_u32)(hfd->virtsize / hfd->ci.blocksize);
+                                       p[-1] = 8;
+                                       wl(p + 0, blocks);
+                                       wl(p + 4, hfd->ci.blocksize);
+                                       p += 8;
+                               }
                        }
                        if (pcode == 0) {
-                               p[0] = 0;
-                               p[1] = 0;
-                               p[2] = 0x20;
-                               p[3] = 0;
-                               r[0] += 4;
+                               if (alen >= r[0] + 1 + r[3] + 4) {
+                                       p[0] = 0;
+                                       p[1] = 3;
+                                       p[2] = 0x20;
+                                       p[3] = 0;
+                                       r[0] += p[1];
+                               }
                        } else if (pcode == 3) {
-                               p[0] = 3;
-                               p[1] = 24;
-                               p[3] = 1;
-                               p[10] = tracksec >> 8;
-                               p[11] = tracksec;
-                               p[12] = hfd->blocksize >> 8;
-                               p[13] = hfd->blocksize;
-                               p[15] = 1; // interleave
-                               p[20] = 0x80;
-                               r[0] += p[1];
+                               // format parameters
+                               if (alen >= r[0] + 1 + r[3] + 24) {
+                                       p[0] = 3;
+                                       p[1] = 24;
+                                       p[3] = 1;
+                                       p[10] = tracksec >> 8;
+                                       p[11] = tracksec;
+                                       p[12] = hfd->ci.blocksize >> 8;
+                                       p[13] = hfd->ci.blocksize;
+                                       p[15] = 1; // interleave
+                                       p[20] = 0x80;
+                                       r[0] += p[1];
+                               }
                        } else if (pcode == 4) {
-                               p[0] = 4;
-                               wl(p + 1, cyl);
-                               p[1] = 24;
-                               p[5] = head;
-                               wl(p + 13, cyl);
-                               ww(p + 20, 5400);
-                               r[0] += p[1];
+                               // rigid drive geometry
+                               if (alen >= r[0] + 1 + r[3] + 16) {
+                                       p[0] = 4;
+                                       wl(p + 1, cyl);
+                                       p[1] = 24;
+                                       p[5] = head;
+                                       wl(p + 13, cyl);
+                                       ww(p + 20, 5400);
+                                       r[0] += p[1];
+                               }
                        } else {
                                goto err;
                        }
                        r[0] += r[3];
                        scsi_len = lr = r[0] + 1;
+                       if (scsi_len > alen)
+                               scsi_len = alen;
                        break;
                }
                break;
@@ -1241,7 +1308,7 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u
                        int cyl, cylsec, head, tracksec;
                        if (nodisk (hfd))
                                goto nodisk;
-                       blocks = (uae_u32)(hfd->virtsize / hfd->blocksize - 1);
+                       blocks = (uae_u32)(hfd->virtsize / hfd->ci.blocksize - 1);
                        if (hdhfd) {
                                cyl = hdhfd->cyls;
                                head = hdhfd->heads;
@@ -1261,7 +1328,7 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u
                                blocks = lba;
                        }
                        wl (r, blocks);
-                       wl (r + 4, hfd->blocksize);
+                       wl (r + 4, hfd->ci.blocksize);
                        scsi_len = lr = 8;
                }
                break;
@@ -1269,21 +1336,21 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u
                if (nodisk (hfd))
                        goto nodisk;
                offset = rl (cmdbuf + 2);
-               offset *= hfd->blocksize;
+               offset *= hfd->ci.blocksize;
                len = rl (cmdbuf + 7 - 2) & 0xffff;
-               len *= hfd->blocksize;
+               len *= hfd->ci.blocksize;
                if (checkbounds (hfd, offset, len))
                        scsi_len = (uae_u32)cmd_readx (hfd, scsi_data, offset, len);
                break;
        case 0x2a: /* WRITE (10) */
                if (nodisk (hfd))
                        goto nodisk;
-               if (hfd->readonly || hfd->dangerous)
+               if (hfd->ci.readonly || hfd->dangerous)
                        goto readprot;
                offset = rl (cmdbuf + 2);
-               offset *= hfd->blocksize;
+               offset *= hfd->ci.blocksize;
                len = rl (cmdbuf + 7 - 2) & 0xffff;
-               len *= hfd->blocksize;
+               len *= hfd->ci.blocksize;
                if (checkbounds (hfd, offset, len))
                        scsi_len = (uae_u32)cmd_writex (hfd, scsi_data, offset, len);
                break;
@@ -1294,19 +1361,19 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u
                        if (nodisk (hfd))
                                goto nodisk;
                        offset = rl (cmdbuf + 2);
-                       offset *= hfd->blocksize;
+                       offset *= hfd->ci.blocksize;
                        len = rl (cmdbuf + 7 - 2) & 0xffff;
-                       len *= hfd->blocksize;
+                       len *= hfd->ci.blocksize;
                        if (checkbounds (hfd, offset, len)) {
-                               uae_u8 *vb = xmalloc (hfd->blocksize);
+                               uae_u8 *vb = xmalloc (hfd->ci.blocksize);
                                while (len > 0) {
-                                       int len = cmd_readx (hfd, vb, offset, hfd->blocksize);
+                                       int len = cmd_readx (hfd, vb, offset, hfd->ci.blocksize);
                                        if (bytchk) {
-                                               if (memcmp (vb, scsi_data, hfd->blocksize))
+                                               if (memcmp (vb, scsi_data, hfd->ci.blocksize))
                                                        goto miscompare;
-                                               scsi_data += hfd->blocksize;
+                                               scsi_data += hfd->ci.blocksize;
                                        }
-                                       offset += hfd->blocksize;
+                                       offset += hfd->ci.blocksize;
                                }
                                xfree (vb);
                        }
@@ -1322,21 +1389,21 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u
                if (nodisk (hfd))
                        goto nodisk;
                offset = rl (cmdbuf + 2);
-               offset *= hfd->blocksize;
+               offset *= hfd->ci.blocksize;
                len = rl (cmdbuf + 6);
-               len *= hfd->blocksize;
+               len *= hfd->ci.blocksize;
                if (checkbounds(hfd, offset, len))
                        scsi_len = (uae_u32)cmd_readx (hfd, scsi_data, offset, len);
                break;
        case 0xaa: /* WRITE (12) */
                if (nodisk (hfd))
                        goto nodisk;
-               if (hfd->readonly || hfd->dangerous)
+               if (hfd->ci.readonly || hfd->dangerous)
                        goto readprot;
                offset = rl (cmdbuf + 2);
-               offset *= hfd->blocksize;
+               offset *= hfd->ci.blocksize;
                len = rl (cmdbuf + 6);
-               len *= hfd->blocksize;
+               len *= hfd->ci.blocksize;
                if (checkbounds(hfd, offset, len))
                        scsi_len = (uae_u32)cmd_writex (hfd, scsi_data, offset, len);
                break;
@@ -1387,6 +1454,10 @@ miscompare:
        *data_len = scsi_len;
        *reply_len = lr;
        *sense_len = ls;
+       if (ls > 0) {
+               memset (hfd->scsi_sense, 0, MAX_SCSI_SENSE);
+               memcpy (hfd->scsi_sense, s, ls);
+       }
        return status;
 }
 
@@ -1459,39 +1530,45 @@ static int handle_scsi (uaecptr request, struct hardfiledata *hfd)
        return ret;
 }
 
-void hardfile_do_disk_change (struct uaedev_config_info *uci, int insert)
+
+void hardfile_send_disk_change (struct hardfiledata *hfd, bool insert)
 {
-       int fsid = uci->configoffset;
-       int j;
        int newstate = insert ? 0 : 1;
-       struct hardfiledata *hfd;
 
-       if (uci->controller == HD_CONTROLLER_PCMCIA_SRAM) {
-               gayle_modify_pcmcia_sram_unit (uci->rootdir, uci->readonly, insert);
-               return;
-       } else if (uci->controller == HD_CONTROLLER_PCMCIA_IDE) {
-               gayle_modify_pcmcia_ide_unit (uci->rootdir, uci->readonly, insert);
-               return;
-       }
-       hfd = get_hardfile_data (fsid);
-       if (!hfd)
-               return;
        uae_sem_wait (&change_sem);
-       hardfpd[fsid].changenum++;
-       write_log (_T("uaehf.device:%d media status=%d changenum=%d\n"), fsid, insert, hardfpd[fsid].changenum);
+       hardfpd[hfd->unitnum].changenum++;
+       write_log (_T("uaehf.device:%d media status=%d changenum=%d\n"), hfd->unitnum, insert, hardfpd[hfd->unitnum].changenum);
        hfd->drive_empty = newstate;
-       j = 0;
+       int j = 0;
        while (j < MAX_ASYNC_REQUESTS) {
-               if (hardfpd[fsid].d_request_type[j] == ASYNC_REQUEST_CHANGEINT) {
-                       uae_Cause (hardfpd[fsid].d_request_data[j]);
+               if (hardfpd[hfd->unitnum].d_request_type[j] == ASYNC_REQUEST_CHANGEINT) {
+                       uae_Cause (hardfpd[hfd->unitnum].d_request_data[j]);
                }
                j++;
        }
-       if (hardfpd[fsid].changeint)
-               uae_Cause (hardfpd[fsid].changeint);
+       if (hardfpd[hfd->unitnum].changeint)
+               uae_Cause (hardfpd[hfd->unitnum].changeint);
        uae_sem_post (&change_sem);
 }
 
+void hardfile_do_disk_change (struct uaedev_config_data *uci, bool insert)
+{
+       int fsid = uci->configoffset;
+       struct hardfiledata *hfd;
+
+       if (uci->ci.controller == HD_CONTROLLER_PCMCIA_SRAM) {
+               gayle_modify_pcmcia_sram_unit (uci->ci.rootdir, uci->ci.readonly, insert);
+               return;
+       } else if (uci->ci.controller == HD_CONTROLLER_PCMCIA_IDE) {
+               gayle_modify_pcmcia_ide_unit (uci->ci.rootdir, uci->ci.readonly, insert);
+               return;
+       }
+       hfd = get_hardfile_data (fsid);
+       if (!hfd)
+               return;
+       hardfile_send_disk_change (hfd, insert);
+}
+
 static int add_async_request (struct hardfileprivdata *hfpd, uaecptr request, int type, uae_u32 data)
 {
        int i;
@@ -1599,7 +1676,7 @@ static uae_u32 REGPARAM2 hardfile_open (TrapContext *context)
                /* Check unit number */
                if (unit >= 0) {
                        struct hardfiledata *hfd = get_hardfile_data (unit);
-                       if (hfd && hfd->handle_valid && start_thread (context, unit)) {
+                       if (hfd && (hfd->handle_valid || hfd->drive_empty) && start_thread (context, unit)) {
                                put_word (hfpd->base + 32, get_word (hfpd->base + 32) + 1);
                                put_long (ioreq + 24, unit); /* io_Unit */
                                put_byte (ioreq + 31, 0); /* io_Error */
@@ -1658,7 +1735,7 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata
        int unit = get_long (request + 24);
        uae_u32 error = 0, len;
        int async = 0;
-       int bmask = hfd->blocksize - 1;
+       int bmask = hfd->ci.blocksize - 1;
 
        cmd = get_word (request + 28); /* io_Command */
        dataptr = get_long (request + 40);
@@ -1670,11 +1747,11 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata
                offset = get_long (request + 44);
                len = get_long (request + 36); /* io_Length */
                if (offset & bmask) {
-                       unaligned (cmd, offset, len, hfd->blocksize);
+                       unaligned (cmd, offset, len, hfd->ci.blocksize);
                        goto bad_command;
                }
                if (len & bmask) {
-                       unaligned (cmd, offset, len, hfd->blocksize);
+                       unaligned (cmd, offset, len, hfd->ci.blocksize);
                        goto bad_len;
                }
                if (len + offset > hfd->virtsize) {
@@ -1691,11 +1768,11 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata
                offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
                len = get_long (request + 36); /* io_Length */
                if (offset64 & bmask) {
-                       unaligned (cmd, offset64, len, hfd->blocksize);
+                       unaligned (cmd, offset64, len, hfd->ci.blocksize);
                        goto bad_command;
                }
                if (len & bmask) {
-                       unaligned (cmd, offset64, len, hfd->blocksize);
+                       unaligned (cmd, offset64, len, hfd->ci.blocksize);
                        goto bad_len;
                }
                if (len + offset64 > hfd->virtsize) {
@@ -1709,17 +1786,17 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata
        case CMD_FORMAT: /* Format */
                if (nodisk (hfd))
                        goto no_disk;
-               if (hfd->readonly || hfd->dangerous) {
+               if (hfd->ci.readonly || hfd->dangerous) {
                        error = 28; /* write protect */
                } else {
                        offset = get_long (request + 44);
                        len = get_long (request + 36); /* io_Length */
                        if (offset & bmask) {
-                               unaligned (cmd, offset, len, hfd->blocksize);
+                               unaligned (cmd, offset, len, hfd->ci.blocksize);
                                goto bad_command;
                        }
                        if (len & bmask) {
-                               unaligned (cmd, offset, len, hfd->blocksize);
+                               unaligned (cmd, offset, len, hfd->ci.blocksize);
                                goto bad_len;
                        }
                        if (len + offset > hfd->virtsize) {
@@ -1736,17 +1813,17 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata
        case NSCMD_TD_FORMAT64:
                if (nodisk (hfd))
                        goto no_disk;
-               if (hfd->readonly || hfd->dangerous) {
+               if (hfd->ci.readonly || hfd->dangerous) {
                        error = 28; /* write protect */
                } else {
                        offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
                        len = get_long (request + 36); /* io_Length */
                        if (offset64 & bmask) {
-                               unaligned (cmd, offset64, len, hfd->blocksize);
+                               unaligned (cmd, offset64, len, hfd->ci.blocksize);
                                goto bad_command;
                        }
                        if (len & bmask) {
-                               unaligned (cmd, offset64, len, hfd->blocksize);
+                               unaligned (cmd, offset64, len, hfd->ci.blocksize);
                                goto bad_len;
                        }
                        if (len + offset64 > hfd->virtsize) {
@@ -1762,6 +1839,7 @@ bad_command:
                break;
 bad_len:
                error = IOERR_BADLENGTH;
+               break;
 no_disk:
                error = 29; /* no disk */
                break;
@@ -1792,8 +1870,8 @@ no_disk:
                        int cyl, cylsec, head, tracksec;
                        uae_u64 size;
                        getchsx (hfd, &cyl, &cylsec, &head, &tracksec);
-                       put_long (dataptr + 0, hfd->blocksize);
-                       size = hfd->virtsize / hfd->blocksize;
+                       put_long (dataptr + 0, hfd->ci.blocksize);
+                       size = hfd->virtsize / hfd->ci.blocksize;
                        if (size > 0x00ffffffff)
                                size = 0xffffffff;
                        put_long (dataptr + 4, (uae_u32)size);
@@ -1808,7 +1886,7 @@ no_disk:
                break;
 
        case CMD_PROTSTATUS:
-               if (hfd->readonly || hfd->dangerous)
+               if (hfd->ci.readonly || hfd->dangerous)
                        actual = -1;
                else
                        actual = 0;
@@ -1845,7 +1923,7 @@ no_disk:
                break;
 
        case HD_SCSICMD: /* SCSI */
-               if (hfd->nrcyls == 0) {
+               if (!hfd->ci.sectors && !hfd->ci.surfaces && !hfd->ci.reserved) {
                        error = handle_scsi (request, hfd);
                } else { /* we don't want users trashing their "partition" hardfiles with hdtoolbox */
                        error = IOERR_NOCMD;
@@ -1853,6 +1931,25 @@ no_disk:
                }
                break;
 
+       case CD_EJECT:
+               if (hfd->ci.sectors && hfd->ci.surfaces) {
+                       int len = get_long (request + 36);
+                       if (len) {
+                               if (hfd->drive_empty) {
+                                       hardfile_media_change (hfd, NULL, true, false);
+                               } else {
+                                       hardfile_media_change (hfd, NULL, false, false);
+                               }
+                       } else {
+                               if (hfd->drive_empty) {
+                                       hardfile_media_change (hfd, NULL, true, false);
+                               }
+                       }
+               } else {
+                       error = IOERR_NOCMD;
+               }
+               break;
+
        default:
                /* Command not understood. */
                error = IOERR_NOCMD;
@@ -2001,7 +2098,7 @@ void hardfile_install (void)
        uae_sem_init (&change_sem, 0, 1);
 
        ROM_hardfile_resname = ds (_T("uaehf.device"));
-       ROM_hardfile_resid = ds (_T("UAE hardfile.device 0.2"));
+       ROM_hardfile_resid = ds (_T("UAE hardfile.device 0.3"));
 
        nscmd_cmd = here ();
        dw (NSCMD_DEVICEQUERY);
index 4143c48bade1f5a6266043f3b16c72b3007ad012..a2225999def032bd10c9e093c80d945c4a502427 100644 (file)
@@ -22,17 +22,10 @@ extern uae_u8 wdregs[32];
 extern struct scsi_data *scsis[8];
 
 #define WD33C93 _T("WD33C93")
-#define SCSIID (scsis[wdregs[WD_DESTINATION_ID] & 7])
-
-extern int a2091_add_scsi_unit (int ch, const TCHAR *path, int blocksize, int readonly,
-                      const TCHAR *devname, int sectors, int surfaces, int reserved,
-                      int bootpri, const TCHAR *filesys);
-extern int a3000_add_scsi_unit (int ch, const TCHAR *path, int blocksize, int readonly,
-                      const TCHAR *devname, int sectors, int surfaces, int reserved,
-                      int bootpri, const TCHAR *filesys);
-
-extern int addscsi (int ch, const TCHAR *path, int blocksize, int readonly,
-                      const TCHAR *devname, int sectors, int surfaces, int reserved,
-                      int bootpri, const TCHAR *filesys, int scsi_level);
+
+extern int a2091_add_scsi_unit (int ch, struct uaedev_config_info *ci);
+extern int a3000_add_scsi_unit (int ch, struct uaedev_config_info *ci);
+
+extern int addscsi (int ch, struct hd_hardfiledata *hfd, struct uaedev_config_info *ci, int scsi_level);
 
 #endif
index 12981544f54379fb7c0a3c6a0a2eec03652aedf0..6638e56be84f026ea16f1eba775ee6b74978ec45 100644 (file)
@@ -67,7 +67,7 @@ extern TCHAR *validatevolumename (TCHAR *s);
 
 int filesys_insert (int nr, TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags);
 int filesys_eject (int nr);
-int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_config_info *uci);
+int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_config_data *uci);
 
 extern TCHAR *filesys_createvolname (const TCHAR *volname, const TCHAR *rootdir, const TCHAR *def);
 extern int target_get_volume_name (struct uaedev_mount_info *mtinf, const TCHAR *volumepath, TCHAR *volumename, int size, bool inserted, bool fullcheck);
index ba3fe1dcd75e812832d3f73e9511cae792e17efe..1f59d79a86beb8eaa0294d5c320575401b522774 100644 (file)
@@ -41,6 +41,7 @@ extern int blitter_need (int hpos);
 extern void blitter_done_notify (int hpos);
 extern void blitter_slowdown (int, int, int, int);
 extern int blitter_channel_state (void);
+extern void blitter_check_start (void);
 
 typedef void blitter_func(uaecptr, uaecptr, uaecptr, uaecptr, struct bltinfo *);
 
index 635eae1257e1ae63f772c59d137a495b8febda86..c63bf69ef95e1f59616f6ce99e23be24647cef2a 100644 (file)
@@ -14,9 +14,8 @@ uae_u8 cdtv_battram_read (int addr);
 extern void cdtv_loadcardmem (uae_u8*, int);
 extern void cdtv_savecardmem (uae_u8*, int);
 
-int cdtv_add_scsi_unit (int ch, TCHAR *path, int blocksize, int readonly,
-                      TCHAR *devname, int sectors, int surfaces, int reserved,
-                      int bootpri, TCHAR *filesys);
+extern int cdtv_add_scsi_unit (int ch, struct uaedev_config_info *ci);
+
 
 extern void cdtv_getdmadata (uae_u32*);
 
index baef88a019d69121752dd02dfa8388d23eed3903..0e5d25b44f8d0caf80449bc1efd781c61d4ad2df 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+
 #ifndef CPUMMU_H
 #define CPUMMU_H
 
+#include "mmu_common.h"
+
 #ifndef FULLMMU
 #define FULLMMU
 #endif
 #define bug
 #endif
 
-struct m68k_exception {
-       int prb;
-       m68k_exception (int exc) : prb (exc) {}
-       operator int() { return prb; }
-};
-#define SAVE_EXCEPTION
-#define RESTORE_EXCEPTION
-#define TRY(var) try
-#define CATCH(var) catch(m68k_exception var)
-#define THROW(n) throw m68k_exception(n)
-#define THROW_AGAIN(var) throw
-#define VOLATILE
-#define ALWAYS_INLINE __inline
-
-#define likely(x) x
-#define unlikely(x) x
 static __inline void flush_internals (void) { }
 
-typedef uae_u8 flagtype;
+extern int mmu060_state;
+extern bool mmu_pagesize_8k;
+
+//typedef uae_u8 flagtype;
+
+//static m68k_exception except;
 
 struct xttrx {
     uae_u32 log_addr_base : 8;
@@ -156,22 +148,6 @@ extern void mmu_dump_tables(void);
 #define MMU_MMUSR_T                                            (1 << 1)
 #define MMU_MMUSR_R                                            (1 << 0)
 
-/* special status word (access error stack frame) */
-#define MMU_SSW_TM             0x0007
-#define MMU_SSW_TT             0x0018
-#define MMU_SSW_SIZE   0x0060
-#define MMU_SSW_SIZE_B 0x0020
-#define MMU_SSW_SIZE_W 0x0040
-#define MMU_SSW_SIZE_L 0x0000
-#define MMU_SSW_RW             0x0100
-#define MMU_SSW_LK             0x0200
-#define MMU_SSW_ATC            0x0400
-#define MMU_SSW_MA             0x0800
-#define MMU_SSW_CM     0x1000
-#define MMU_SSW_CT     0x2000
-#define MMU_SSW_CU     0x4000
-#define MMU_SSW_CP     0x8000
-
 #define TTR_I0 4
 #define TTR_I1 5
 #define TTR_D0 6
@@ -182,74 +158,140 @@ extern void mmu_dump_tables(void);
 #define TTR_OK_MATCH   2
 
 struct mmu_atc_line {
-       uae_u16 tag;
-       unsigned tt : 1;
-       unsigned valid_data : 1;
-       unsigned valid_inst : 1;
+       uaecptr tag; // tag is 16 or 17 bits S+logical
+       unsigned valid : 1;
        unsigned global : 1;
        unsigned modified : 1;
        unsigned write_protect : 1;
-       unsigned hw : 1;
-       unsigned bus_fault : 1;
-       uaecptr phys;
+       uaecptr phys; // phys base address
 };
 
 /*
- * We don't need to store the whole logical address in the atc cache, as part of
- * it is encoded as index into the cache. 14 bits of the address are stored in
- * the tag, this means at least 6 bits must go into the index. The upper two
- * bits of the tag define the type of data in the atc line:
- * - 00: a normal memory address
- * - 11: invalid memory address or hardware access
- *       (generated via ~ATC_TAG(addr) in the slow path)
- * - 10: empty atc line
- */
-
-#define ATC_TAG_SHIFT          18
-#define ATC_TAG(addr)          ((uae_u32)(addr) >> ATC_TAG_SHIFT)
-
-
-#define ATC_L1_SIZE_LOG                8
-#define ATC_L1_SIZE                    (1 << ATC_L1_SIZE_LOG)
-
-#define ATC_L1_INDEX(addr)     (((addr) >> 12) % ATC_L1_SIZE)
-
-/*
- * first level atc cache
- * indexed by [super][data][rw][idx]
+ * 68040 ATC is a 4 way 16 slot associative address translation cache
+ * the 68040 has a DATA and an INSTRUCTION ATC.
+ * an ATC lookup may result in : a hit, a miss and a modified state.
+ * the 68060 can disable ATC allocation
+ * we must take care of 8k and 4k page size, index position is relative to page size
  */
 
-typedef struct mmu_atc_line mmu_atc_l1_array[2][2][ATC_L1_SIZE];
-extern mmu_atc_l1_array atc_l1[2];
-extern mmu_atc_l1_array *current_atc;
-
-#define ATC_L2_SIZE_LOG                12
-#define ATC_L2_SIZE                    (1 << ATC_L2_SIZE_LOG)
+#define ATC_WAYS 4
+#define ATC_SLOTS 16
+#define ATC_TYPE 2
 
-#define ATC_L2_INDEX(addr)     ((((addr) >> 12) ^ ((addr) >> (32 - ATC_L2_SIZE_LOG))) % ATC_L2_SIZE)
+extern uae_u32 mmu_is_super;
+extern uae_u32 mmu_tagmask, mmu_pagemask;
+extern struct mmu_atc_line mmu_atc_array[ATC_TYPE][ATC_WAYS][ATC_SLOTS];
 
 /*
- * lookup address in the level 1 atc cache,
- * the data and write arguments are constant in the common,
- * thus allows gcc to generate a constant offset.
+ * mmu access is a 4 step process:
+ * if mmu is not enabled just read physical
+ * check transparent region, if transparent, read physical
+ * check ATC (address translation cache), read immediatly if HIT
+ * read from mmu with the long path (and allocate ATC entry if needed)
  */
 static ALWAYS_INLINE bool mmu_lookup(uaecptr addr, bool data, bool write,
                                                                          struct mmu_atc_line **cl)
 {
-       addr >>= 12;
-       *cl = &(*current_atc)[data ? 1 : 0][write ? 1 : 0][addr % ATC_L1_SIZE];
-       return (*cl)->tag == addr >> (ATC_TAG_SHIFT - 12);
+       int way,index;
+       static int way_miss=0;
+
+       uae_u32 tag = (mmu_is_super | (addr >> 1)) & mmu_tagmask;
+       if (mmu_pagesize_8k)
+               index=(addr & 0x0001E000)>>13;
+       else
+               index=(addr & 0x0000F000)>>12;
+       for (way=0;way<ATC_WAYS;way++) {
+               // if we have this 
+               if ((tag == mmu_atc_array[data][way][index].tag) && (mmu_atc_array[data][way][index].valid)) {
+                       *cl=&mmu_atc_array[data][way][index];
+                       // if first write to this take slow path (but modify this slot)
+                       if ((!mmu_atc_array[data][way][index].modified & write) || (mmu_atc_array[data][way][index].write_protect & write))
+                               return false; 
+                       return true;
+               }
+       }
+       // we select a random way to void
+       *cl=&mmu_atc_array[data][way_miss%ATC_WAYS][index];
+       (*cl)->tag = tag;
+       way_miss++;
+       return false;
 }
 
 /*
- * similiar to mmu_user_lookup, but for the use of the moves instruction
  */
 static ALWAYS_INLINE bool mmu_user_lookup(uaecptr addr, bool super, bool data,
                                                                                   bool write, struct mmu_atc_line **cl)
 {
-       addr >>= 12;
-       *cl = &atc_l1[super ? 1 : 0][data ? 1 : 0][write ? 1 : 0][addr % ATC_L1_SIZE];
-       return (*cl)->tag == addr >> (ATC_TAG_SHIFT - 12);
+       int way,index;
+       static int way_miss=0;
+
+       uae_u32 tag = ((super ? 0x80000000 : 0x00000000) | (addr >> 1)) & mmu_tagmask;
+       if (mmu_pagesize_8k)
+               index=(addr & 0x0001E000)>>13;
+       else
+               index=(addr & 0x0000F000)>>12;
+       for (way=0;way<ATC_WAYS;way++) {
+               // if we have this 
+               if ((tag == mmu_atc_array[data][way][index].tag) && (mmu_atc_array[data][way][index].valid)) {
+                       *cl=&mmu_atc_array[data][way][index];
+                       // if first write to this take slow path (but modify this slot)
+                       if ((!mmu_atc_array[data][way][index].modified & write) || (mmu_atc_array[data][way][index].write_protect & write))
+                               return false; 
+                       return true;
+               }
+       }
+       // we select a random way to void
+       *cl=&mmu_atc_array[data][way_miss%ATC_WAYS][index];
+       (*cl)->tag = tag;
+       way_miss++;
+       return false;
+}
+
+/* check if an address matches a ttr */
+STATIC_INLINE int mmu_do_match_ttr(uae_u32 ttr, uaecptr addr, bool super)
+{
+       if (ttr & MMU_TTR_BIT_ENABLED)  {       /* TTR enabled */
+               uae_u8 msb, mask;
+
+               msb = ((addr ^ ttr) & MMU_TTR_LOGICAL_BASE) >> 24;
+               mask = (ttr & MMU_TTR_LOGICAL_MASK) >> 16;
+
+               if (!(msb & ~mask)) {
+
+                       if ((ttr & MMU_TTR_BIT_SFIELD_ENABLED) == 0) {
+                               if (((ttr & MMU_TTR_BIT_SFIELD_SUPER) == 0) != (super == 0)) {
+                                       return TTR_NO_MATCH;
+                               }
+                       }
+
+                       return (ttr & MMU_TTR_BIT_WRITE_PROTECT) ? TTR_NO_WRITE : TTR_OK_MATCH;
+               }
+       }
+       return TTR_NO_MATCH;
+}
+
+STATIC_INLINE int mmu_match_ttr(uaecptr addr, bool super, bool data)
+{
+       int res;
+
+       if (data) {
+               res = mmu_do_match_ttr(regs.dtt0, addr, super);
+               if (res == TTR_NO_MATCH)
+                       res = mmu_do_match_ttr(regs.dtt1, addr, super);
+       } else {
+               res = mmu_do_match_ttr(regs.itt0, addr, super);
+               if (res == TTR_NO_MATCH)
+                       res = mmu_do_match_ttr(regs.itt1, addr, super);
+       }
+       return res;
+}
+extern void mmu_bus_error_ttr_write_fault(uaecptr addr, bool super, bool data, uae_u32 val, int size);
+STATIC_INLINE int mmu_match_ttr_write(uaecptr addr, bool super, bool data, uae_u32 val,int size)
+{
+       int res = mmu_match_ttr(addr, super, data);
+       if (res == TTR_NO_WRITE)
+               mmu_bus_error_ttr_write_fault(addr, super, data, val, size);
+       return res;
 }
 
 extern uae_u16 REGPARAM3 mmu_get_word_unaligned(uaecptr addr, bool data) REGPARAM;
@@ -286,51 +328,55 @@ extern void REGPARAM3 dfc_put_long(uaecptr addr, uae_u32 val) REGPARAM;
 extern void REGPARAM3 dfc_put_word(uaecptr addr, uae_u16 val) REGPARAM;
 extern void REGPARAM3 dfc_put_byte(uaecptr addr, uae_u8 val) REGPARAM;
 
+#define sfc040_get_long sfc_get_long
+#define sfc040_get_word sfc_get_word
+#define sfc040_get_byte sfc_get_byte
+#define dfc040_put_long dfc_put_long
+#define dfc040_put_word dfc_put_word
+#define dfc040_put_byte dfc_put_byte
+
+#define sfc060_get_long sfc_get_long
+#define sfc060_get_word sfc_get_word
+#define sfc060_get_byte sfc_get_byte
+#define dfc060_put_long dfc_put_long
+#define dfc060_put_word dfc_put_word
+#define dfc060_put_byte dfc_put_byte
+
+extern void REGPARAM3 mmu_flush_atc(uaecptr addr, bool super, bool global) REGPARAM;
+extern void REGPARAM3 mmu_flush_atc_all(bool global) REGPARAM;
 extern void REGPARAM3 mmu_op_real(uae_u32 opcode, uae_u16 extra) REGPARAM;
 
 extern void REGPARAM3 mmu_reset(void) REGPARAM;
 extern void REGPARAM3 mmu_set_tc(uae_u16 tc) REGPARAM;
 extern void REGPARAM3 mmu_set_super(bool super) REGPARAM;
 
-static ALWAYS_INLINE bool is_unaligned(uaecptr addr, int size)
-{
-    return unlikely((addr & (size - 1)) && (addr ^ (addr + size - 1)) & 0x1000);
-}
-
 static ALWAYS_INLINE uaecptr mmu_get_real_address(uaecptr addr, struct mmu_atc_line *cl)
 {
-    return cl->phys + addr;
+    return cl->phys | (addr & mmu_pagemask);
 }
 
-static ALWAYS_INLINE void phys_put_long(uaecptr addr, uae_u32 l)
-{
-    longput(addr, l);
-}
-static ALWAYS_INLINE void phys_put_word(uaecptr addr, uae_u32 w)
-{
-    wordput(addr, w);
-}
-static ALWAYS_INLINE void phys_put_byte(uaecptr addr, uae_u32 b)
-{
-    byteput(addr, b);
-}
-static ALWAYS_INLINE uae_u32 phys_get_long(uaecptr addr)
-{
-    return longget (addr);
-}
-static ALWAYS_INLINE uae_u32 phys_get_word(uaecptr addr)
-{
-    return wordget (addr);
-}
-static ALWAYS_INLINE uae_u32 phys_get_byte(uaecptr addr)
+static ALWAYS_INLINE void mmu060_get_move16(uaecptr addr, uae_u32 *v, bool data, int size)
 {
-    return byteget (addr);
+       struct mmu_atc_line *cl;
+       for (int i = 0; i < 4; i++) {
+               uaecptr addr2 = addr + i * 4;
+               //                                       addr,super,data
+               if ((!regs.mmu_enabled) || (mmu_match_ttr(addr2,regs.s != 0,data)!=TTR_NO_MATCH))
+                       v[i] = phys_get_long(addr2);
+               else if (likely(mmu_lookup(addr2, data, false, &cl)))
+                       v[i] = phys_get_long(mmu_get_real_address(addr2, cl));
+               else
+                       v[i] = mmu_get_long_slow(addr2, regs.s != 0, data, size, cl);
+       }
 }
 
 static ALWAYS_INLINE uae_u32 mmu_get_long(uaecptr addr, bool data, int size)
 {
        struct mmu_atc_line *cl;
 
+       //                                       addr,super,data
+       if ((!regs.mmu_enabled) || (mmu_match_ttr(addr,regs.s != 0,data)!=TTR_NO_MATCH))
+               return phys_get_long(addr);
        if (likely(mmu_lookup(addr, data, false, &cl)))
                return phys_get_long(mmu_get_real_address(addr, cl));
        return mmu_get_long_slow(addr, regs.s != 0, data, size, cl);
@@ -340,6 +386,9 @@ static ALWAYS_INLINE uae_u16 mmu_get_word(uaecptr addr, bool data, int size)
 {
        struct mmu_atc_line *cl;
 
+       //                                       addr,super,data
+       if ((!regs.mmu_enabled) || (mmu_match_ttr(addr,regs.s != 0,data)!=TTR_NO_MATCH))
+               return phys_get_word(addr);
        if (likely(mmu_lookup(addr, data, false, &cl)))
                return phys_get_word(mmu_get_real_address(addr, cl));
        return mmu_get_word_slow(addr, regs.s != 0, data, size, cl);
@@ -349,26 +398,53 @@ static ALWAYS_INLINE uae_u8 mmu_get_byte(uaecptr addr, bool data, int size)
 {
        struct mmu_atc_line *cl;
 
+       //                                       addr,super,data
+       if ((!regs.mmu_enabled) || (mmu_match_ttr(addr,regs.s != 0,data)!=TTR_NO_MATCH))
+               return phys_get_byte(addr);
        if (likely(mmu_lookup(addr, data, false, &cl)))
                return phys_get_byte(mmu_get_real_address(addr, cl));
        return mmu_get_byte_slow(addr, regs.s != 0, data, size, cl);
 }
 
-
 static ALWAYS_INLINE void mmu_put_long(uaecptr addr, uae_u32 val, bool data, int size)
 {
        struct mmu_atc_line *cl;
 
+       //                                        addr,super,data
+       if ((!regs.mmu_enabled) || mmu_match_ttr_write(addr,regs.s != 0,data,val,size)==TTR_OK_MATCH) {
+               phys_put_long(addr,val);
+               return;
+       }
        if (likely(mmu_lookup(addr, data, true, &cl)))
                phys_put_long(mmu_get_real_address(addr, cl), val);
        else
                mmu_put_long_slow(addr, val, regs.s != 0, data, size, cl);
 }
 
+static ALWAYS_INLINE void mmu060_put_move16(uaecptr addr, uae_u32 *val, bool data, int size)
+{
+       struct mmu_atc_line *cl;
+       for (int i = 0; i < 4; i++) {
+               uaecptr addr2 = addr + i * 4;
+               //                                        addr,super,data
+               if ((!regs.mmu_enabled) || (mmu_match_ttr_write(addr2,regs.s != 0,data,val[i],size)==TTR_OK_MATCH))
+                       phys_put_long(addr2,val[i]);
+               else if (likely(mmu_lookup(addr2, data, true, &cl)))
+                       phys_put_long(mmu_get_real_address(addr2, cl), val[i]);
+               else
+                       mmu_put_long_slow(addr2, val[i], regs.s != 0, data, size, cl);
+       }
+}
+
 static ALWAYS_INLINE void mmu_put_word(uaecptr addr, uae_u16 val, bool data, int size)
 {
        struct mmu_atc_line *cl;
 
+       //                                        addr,super,data
+       if ((!regs.mmu_enabled) || (mmu_match_ttr_write(addr,regs.s != 0,data,val,size)==TTR_OK_MATCH)) {
+               phys_put_word(addr,val);
+               return;
+       }
        if (likely(mmu_lookup(addr, data, true, &cl)))
                phys_put_word(mmu_get_real_address(addr, cl), val);
        else
@@ -379,6 +455,11 @@ static ALWAYS_INLINE void mmu_put_byte(uaecptr addr, uae_u8 val, bool data, int
 {
        struct mmu_atc_line *cl;
 
+       //                                        addr,super,data
+       if ((!regs.mmu_enabled) || (mmu_match_ttr_write(addr,regs.s != 0,data,val,size)==TTR_OK_MATCH)) {
+               phys_put_byte(addr,val);
+               return;
+       }
        if (likely(mmu_lookup(addr, data, true, &cl)))
                phys_put_byte(mmu_get_real_address(addr, cl), val);
        else
@@ -389,6 +470,9 @@ static ALWAYS_INLINE uae_u32 mmu_get_user_long(uaecptr addr, bool super, bool da
 {
        struct mmu_atc_line *cl;
 
+       //                                       addr,super,data
+       if ((!regs.mmu_enabled) || (mmu_match_ttr(addr,super,data)!=TTR_NO_MATCH))
+               return phys_get_long(addr);
        if (likely(mmu_user_lookup(addr, super, data, false, &cl)))
                return phys_get_long(mmu_get_real_address(addr, cl));
        return mmu_get_long_slow(addr, super, data, size, cl);
@@ -398,6 +482,9 @@ static ALWAYS_INLINE uae_u16 mmu_get_user_word(uaecptr addr, bool super, bool da
 {
        struct mmu_atc_line *cl;
 
+       //                                       addr,super,data
+       if ((!regs.mmu_enabled) || (mmu_match_ttr(addr,super,data)!=TTR_NO_MATCH))
+               return phys_get_word(addr);
        if (likely(mmu_user_lookup(addr, super, data, false, &cl)))
                return phys_get_word(mmu_get_real_address(addr, cl));
        return mmu_get_word_slow(addr, super, data, size, cl);
@@ -407,6 +494,9 @@ static ALWAYS_INLINE uae_u8 mmu_get_user_byte(uaecptr addr, bool super, bool dat
 {
        struct mmu_atc_line *cl;
 
+       //                                       addr,super,data
+       if ((!regs.mmu_enabled) || (mmu_match_ttr(addr,super,data)!=TTR_NO_MATCH))
+               return phys_get_byte(addr);
        if (likely(mmu_user_lookup(addr, super, data, false, &cl)))
                return phys_get_byte(mmu_get_real_address(addr, cl));
        return mmu_get_byte_slow(addr, super, data, size, cl);
@@ -416,6 +506,11 @@ static ALWAYS_INLINE void mmu_put_user_long(uaecptr addr, uae_u32 val, bool supe
 {
        struct mmu_atc_line *cl;
 
+       //                                        addr,super,data
+       if ((!regs.mmu_enabled) || (mmu_match_ttr(addr,super,data)==TTR_OK_MATCH)) {
+               phys_put_long(addr,val);
+               return;
+       }
        if (likely(mmu_user_lookup(addr, super, data, true, &cl)))
                phys_put_long(mmu_get_real_address(addr, cl), val);
        else
@@ -426,6 +521,11 @@ static ALWAYS_INLINE void mmu_put_user_word(uaecptr addr, uae_u16 val, bool supe
 {
        struct mmu_atc_line *cl;
 
+       //                                        addr,super,data
+       if ((!regs.mmu_enabled) || (mmu_match_ttr(addr,super,data)==TTR_OK_MATCH)) {
+               phys_put_word(addr,val);
+               return;
+       }
        if (likely(mmu_user_lookup(addr, super, data, true, &cl)))
                phys_put_word(mmu_get_real_address(addr, cl), val);
        else
@@ -436,6 +536,11 @@ static ALWAYS_INLINE void mmu_put_user_byte(uaecptr addr, uae_u8 val, bool super
 {
        struct mmu_atc_line *cl;
 
+       //                                        addr,super,data
+       if ((!regs.mmu_enabled) || (mmu_match_ttr(addr,super,data)==TTR_OK_MATCH)) {
+               phys_put_byte(addr,val);
+               return;
+       }
        if (likely(mmu_user_lookup(addr, super, data, true, &cl)))
                phys_put_byte(mmu_get_real_address(addr, cl), val);
        else
@@ -468,118 +573,245 @@ static ALWAYS_INLINE uae_u32 HWget_b(uaecptr addr)
     return get_byte (addr);
 }
 
-static ALWAYS_INLINE uae_u32 uae_mmu_get_ilong(uaecptr addr)
+static ALWAYS_INLINE uae_u32 uae_mmu040_get_ilong(uaecptr addr)
+{
+       if (unlikely(is_unaligned(addr, 4)))
+               return mmu_get_long_unaligned(addr, false);
+       return mmu_get_long(addr, false, sz_long);
+}
+static ALWAYS_INLINE uae_u16 uae_mmu040_get_iword(uaecptr addr)
+{
+       if (unlikely(is_unaligned(addr, 2)))
+               return mmu_get_word_unaligned(addr, false);
+       return mmu_get_word(addr, false, sz_word);
+}
+static ALWAYS_INLINE uae_u16 uae_mmu040_get_ibyte(uaecptr addr)
+{
+       return mmu_get_byte(addr, false, sz_byte);
+}
+static ALWAYS_INLINE uae_u32 uae_mmu040_get_long(uaecptr addr)
+{
+       if (unlikely(is_unaligned(addr, 4)))
+               return mmu_get_long_unaligned(addr, true);
+       return mmu_get_long(addr, true, sz_long);
+}
+static ALWAYS_INLINE uae_u16 uae_mmu040_get_word(uaecptr addr)
+{
+       if (unlikely(is_unaligned(addr, 2)))
+               return mmu_get_word_unaligned(addr, true);
+       return mmu_get_word(addr, true, sz_word);
+}
+static ALWAYS_INLINE uae_u8 uae_mmu040_get_byte(uaecptr addr)
+{
+       return mmu_get_byte(addr, true, sz_byte);
+}
+
+static ALWAYS_INLINE void uae_mmu040_put_word(uaecptr addr, uae_u16 val)
+{
+       if (unlikely(is_unaligned(addr, 2)))
+               mmu_put_word_unaligned(addr, val, true);
+       else
+               mmu_put_word(addr, val, true, sz_word);
+}
+static ALWAYS_INLINE void uae_mmu040_put_byte(uaecptr addr, uae_u8 val)
+{
+       mmu_put_byte(addr, val, true, sz_byte);
+}
+static ALWAYS_INLINE void uae_mmu040_put_long(uaecptr addr, uae_u32 val)
+{
+       if (unlikely(is_unaligned(addr, 4)))
+               mmu_put_long_unaligned(addr, val, true);
+       else
+               mmu_put_long(addr, val, true, sz_long);
+}
+
+
+static ALWAYS_INLINE uae_u32 uae_mmu060_get_ilong(uaecptr addr)
 {
        if (unlikely(is_unaligned(addr, 4)))
                return mmu_get_long_unaligned(addr, false);
        return mmu_get_long(addr, false, sz_long);
 }
-static ALWAYS_INLINE uae_u16 uae_mmu_get_iword(uaecptr addr)
+static ALWAYS_INLINE uae_u16 uae_mmu060_get_iword(uaecptr addr)
 {
        if (unlikely(is_unaligned(addr, 2)))
                return mmu_get_word_unaligned(addr, false);
        return mmu_get_word(addr, false, sz_word);
 }
-static ALWAYS_INLINE uae_u16 uae_mmu_get_ibyte(uaecptr addr)
+static ALWAYS_INLINE uae_u16 uae_mmu060_get_ibyte(uaecptr addr)
 {
        return mmu_get_byte(addr, false, sz_byte);
 }
-static ALWAYS_INLINE uae_u32 uae_mmu_get_long(uaecptr addr)
+static ALWAYS_INLINE uae_u32 uae_mmu060_get_long(uaecptr addr)
 {
        if (unlikely(is_unaligned(addr, 4)))
                return mmu_get_long_unaligned(addr, true);
        return mmu_get_long(addr, true, sz_long);
 }
-static ALWAYS_INLINE uae_u16 uae_mmu_get_word(uaecptr addr)
+static ALWAYS_INLINE uae_u16 uae_mmu060_get_word(uaecptr addr)
 {
        if (unlikely(is_unaligned(addr, 2)))
                return mmu_get_word_unaligned(addr, true);
        return mmu_get_word(addr, true, sz_word);
 }
-static ALWAYS_INLINE uae_u8 uae_mmu_get_byte(uaecptr addr)
+static ALWAYS_INLINE uae_u8 uae_mmu060_get_byte(uaecptr addr)
 {
        return mmu_get_byte(addr, true, sz_byte);
 }
-static ALWAYS_INLINE void uae_mmu_put_long(uaecptr addr, uae_u32 val)
+static ALWAYS_INLINE void uae_mmu060_get_move16(uaecptr addr, uae_u32 *val)
+{
+       // move16 is always aligned
+       mmu060_get_move16(addr, val, true, 16);
+}
+
+static ALWAYS_INLINE void uae_mmu060_put_long(uaecptr addr, uae_u32 val)
 {
        if (unlikely(is_unaligned(addr, 4)))
                mmu_put_long_unaligned(addr, val, true);
        else
                mmu_put_long(addr, val, true, sz_long);
 }
-static ALWAYS_INLINE void uae_mmu_put_word(uaecptr addr, uae_u16 val)
+static ALWAYS_INLINE void uae_mmu060_put_word(uaecptr addr, uae_u16 val)
 {
        if (unlikely(is_unaligned(addr, 2)))
                mmu_put_word_unaligned(addr, val, true);
        else
                mmu_put_word(addr, val, true, sz_word);
 }
-static ALWAYS_INLINE void uae_mmu_put_byte(uaecptr addr, uae_u8 val)
+static ALWAYS_INLINE void uae_mmu060_put_byte(uaecptr addr, uae_u8 val)
 {
        mmu_put_byte(addr, val, true, sz_byte);
 }
+static ALWAYS_INLINE void uae_mmu060_put_move16(uaecptr addr, uae_u32 *val)
+{
+       // move16 is always aligned
+       mmu060_put_move16(addr, val, true, 16);
+}
+
 
-STATIC_INLINE void put_byte_mmu (uaecptr addr, uae_u32 v)
+STATIC_INLINE void put_byte_mmu040 (uaecptr addr, uae_u32 v)
 {
-    uae_mmu_put_byte (addr, v);
+    uae_mmu040_put_byte (addr, v);
 }
-STATIC_INLINE void put_word_mmu (uaecptr addr, uae_u32 v)
+STATIC_INLINE void put_word_mmu040 (uaecptr addr, uae_u32 v)
 {
-    uae_mmu_put_word (addr, v);
+    uae_mmu040_put_word (addr, v);
 }
-STATIC_INLINE void put_long_mmu (uaecptr addr, uae_u32 v)
+STATIC_INLINE void put_long_mmu040 (uaecptr addr, uae_u32 v)
 {
-    uae_mmu_put_long (addr, v);
+    uae_mmu040_put_long (addr, v);
 }
-STATIC_INLINE uae_u32 get_byte_mmu (uaecptr addr)
+STATIC_INLINE uae_u32 get_byte_mmu040 (uaecptr addr)
 {
-    return uae_mmu_get_byte (addr);
+    return uae_mmu040_get_byte (addr);
 }
-STATIC_INLINE uae_u32 get_word_mmu (uaecptr addr)
+STATIC_INLINE uae_u32 get_word_mmu040 (uaecptr addr)
 {
-    return uae_mmu_get_word (addr);
+    return uae_mmu040_get_word (addr);
 }
-STATIC_INLINE uae_u32 get_long_mmu (uaecptr addr)
+STATIC_INLINE uae_u32 get_long_mmu040 (uaecptr addr)
 {
-    return uae_mmu_get_long (addr);
+    return uae_mmu040_get_long (addr);
 }
-STATIC_INLINE uae_u32 get_ibyte_mmu (int o)
+
+STATIC_INLINE void put_byte_mmu060 (uaecptr addr, uae_u32 v)
+{
+    uae_mmu060_put_byte (addr, v);
+}
+STATIC_INLINE void put_word_mmu060 (uaecptr addr, uae_u32 v)
+{
+    uae_mmu060_put_word (addr, v);
+}
+STATIC_INLINE void put_long_mmu060 (uaecptr addr, uae_u32 v)
+{
+    uae_mmu060_put_long (addr, v);
+}
+STATIC_INLINE uae_u32 get_byte_mmu060 (uaecptr addr)
+{
+    return uae_mmu060_get_byte (addr);
+}
+STATIC_INLINE uae_u32 get_word_mmu060 (uaecptr addr)
+{
+    return uae_mmu060_get_word (addr);
+}
+STATIC_INLINE uae_u32 get_long_mmu060 (uaecptr addr)
+{
+    return uae_mmu060_get_long (addr);
+}
+
+STATIC_INLINE void get_move16_mmu060 (uaecptr addr, uae_u32 *v)
+{
+    return uae_mmu060_get_move16 (addr, v);
+}
+STATIC_INLINE void put_move16_mmu060 (uaecptr addr, uae_u32 *v)
+{
+    return uae_mmu060_put_move16 (addr, v);
+}
+
+STATIC_INLINE uae_u32 get_ibyte_mmu040 (int o)
 {
     uae_u32 pc = m68k_getpc () + o;
-    return uae_mmu_get_iword (pc);
+    return uae_mmu040_get_iword (pc);
 }
-STATIC_INLINE uae_u32 get_iword_mmu (int o)
+STATIC_INLINE uae_u32 get_iword_mmu040 (int o)
 {
     uae_u32 pc = m68k_getpc () + o;
-    return uae_mmu_get_iword (pc);
+    return uae_mmu040_get_iword (pc);
 }
-STATIC_INLINE uae_u32 get_ilong_mmu (int o)
+STATIC_INLINE uae_u32 get_ilong_mmu040 (int o)
 {
     uae_u32 pc = m68k_getpc () + o;
-    return uae_mmu_get_ilong (pc);
+    return uae_mmu040_get_ilong (pc);
 }
-STATIC_INLINE uae_u32 next_iword_mmu (void)
+STATIC_INLINE uae_u32 next_iword_mmu040 (void)
 {
     uae_u32 pc = m68k_getpc ();
     m68k_incpci (2);
-    return uae_mmu_get_iword (pc);
+    return uae_mmu040_get_iword (pc);
 }
-STATIC_INLINE uae_u32 next_ilong_mmu (void)
+STATIC_INLINE uae_u32 next_ilong_mmu040 (void)
 {
     uae_u32 pc = m68k_getpc ();
     m68k_incpci (4);
-    return uae_mmu_get_ilong (pc);
+    return uae_mmu040_get_ilong (pc);
 }
 
-extern void m68k_do_rts_mmu (void);
-extern void m68k_do_rte_mmu (uaecptr a7);
-extern void m68k_do_bsr_mmu (uaecptr oldpc, uae_s32 offset);
-
-struct mmufixup
+STATIC_INLINE uae_u32 get_ibyte_mmu060 (int o)
 {
-    int reg;
-    uae_u32 value;
-};
-extern struct mmufixup mmufixup[2];
+    uae_u32 pc = m68k_getpc () + o;
+    return uae_mmu060_get_iword (pc);
+}
+STATIC_INLINE uae_u32 get_iword_mmu060 (int o)
+{
+    uae_u32 pc = m68k_getpc () + o;
+    return uae_mmu060_get_iword (pc);
+}
+STATIC_INLINE uae_u32 get_ilong_mmu060 (int o)
+{
+    uae_u32 pc = m68k_getpc () + o;
+    return uae_mmu060_get_ilong (pc);
+}
+STATIC_INLINE uae_u32 next_iword_mmu060 (void)
+{
+    uae_u32 pc = m68k_getpc ();
+    m68k_incpci (2);
+    return uae_mmu060_get_iword (pc);
+}
+STATIC_INLINE uae_u32 next_ilong_mmu060 (void)
+{
+    uae_u32 pc = m68k_getpc ();
+    m68k_incpci (4);
+    return uae_mmu060_get_ilong (pc);
+}
+
+extern void flush_mmu040 (uaecptr, int);
+extern void m68k_do_rts_mmu040 (void);
+extern void m68k_do_rte_mmu040 (uaecptr a7);
+extern void m68k_do_bsr_mmu040 (uaecptr oldpc, uae_s32 offset);
+
+extern void flush_mmu060 (uaecptr, int);
+extern void m68k_do_rts_mmu060 (void);
+extern void m68k_do_rte_mmu060 (uaecptr a7);
+extern void m68k_do_bsr_mmu060 (uaecptr oldpc, uae_s32 offset);
 
 #endif /* CPUMMU_H */
diff --git a/include/cpummu030.h b/include/cpummu030.h
new file mode 100644 (file)
index 0000000..565e37d
--- /dev/null
@@ -0,0 +1,410 @@
+#ifndef CPUMMU030_H
+#define CPUMMU030_H
+
+#include "mmu_common.h"
+
+extern uae_u64 srp_030, crp_030;
+extern uae_u32 tt0_030, tt1_030, tc_030;
+extern uae_u16 mmusr_030;
+
+#define MAX_MMU030_ACCESS 10
+extern uae_u32 mm030_stageb_address;
+extern int mmu030_idx;
+extern bool mmu030_retry;
+extern int mmu030_opcode, mmu030_opcode_stageb;
+extern uae_u16 mmu030_state[3];
+extern uae_u32 mmu030_data_buffer;
+extern uae_u32 mmu030_disp_store[2];
+
+#define MMU030_STATEFLAG1_MOVEM1 0x4000
+#define MMU030_STATEFLAG1_MOVEM2 0x8000
+#define MMU030_STATEFLAG1_DISP0 0x0001
+#define MMU030_STATEFLAG1_DISP1 0x0002
+
+struct mmu030_access
+{
+       bool done;
+       uae_u32 val;
+};
+extern struct mmu030_access mmu030_ad[MAX_MMU030_ACCESS];
+
+uae_u32 REGPARAM3 get_disp_ea_020_mmu030 (uae_u32 base, int idx) REGPARAM;
+
+void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra);
+void mmu_op30_ptest (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra);
+void mmu_op30_pload (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra);
+void mmu_op30_pflush (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra);
+
+uae_u32 mmu_op30_helper_get_fc(uae_u16 next);
+
+void mmu030_ptest_atc_search(uaecptr logical_addr, uae_u32 fc, bool write);
+uae_u32 mmu030_ptest_table_search(uaecptr extra, uae_u32 fc, bool write, int level);
+uae_u32 mmu030_table_search(uaecptr addr, uae_u32 fc, bool write, int level);
+
+
+typedef struct {
+    uae_u32 addr_base;
+    uae_u32 addr_mask;
+    uae_u32 fc_base;
+    uae_u32 fc_mask;
+} TT_info;
+
+TT_info mmu030_decode_tt(uae_u32 TT);
+void mmu030_decode_tc(uae_u32 TC);
+void mmu030_decode_rp(uae_u64 RP);
+
+int mmu030_logical_is_in_atc(uaecptr addr, uae_u32 fc, bool write);
+void mmu030_atc_handle_history_bit(int entry_num);
+
+void mmu030_put_long_atc(uaecptr addr, uae_u32 val, int l, uae_u32 fc);
+void mmu030_put_word_atc(uaecptr addr, uae_u16 val, int l, uae_u32 fc);
+void mmu030_put_byte_atc(uaecptr addr, uae_u8 val, int l, uae_u32 fc);
+uae_u32 mmu030_get_long_atc(uaecptr addr, int l, uae_u32 fc);
+uae_u16 mmu030_get_word_atc(uaecptr addr, int l, uae_u32 fc);
+uae_u8 mmu030_get_byte_atc(uaecptr addr, int l, uae_u32 fc);
+
+void mmu030_flush_atc_fc(uae_u32 fc_base, uae_u32 fc_mask);
+void mmu030_flush_atc_page(uaecptr logical_addr);
+void mmu030_flush_atc_page_fc(uaecptr logical_addr, uae_u32 fc_base, uae_u32 fc_mask);
+void mmu030_flush_atc_all(void);
+void mmu030_reset(int hardreset);
+uaecptr mmu030_translate(uaecptr addr, bool super, bool data, bool write);
+
+int mmu030_match_ttr(uaecptr addr, uae_u32 fc, bool write);
+int mmu030_do_match_ttr(uae_u32 tt, TT_info masks, uaecptr addr, uae_u32 fc, bool write);
+
+void mmu030_put_long(uaecptr addr, uae_u32 val, uae_u32 fc, int size);
+void mmu030_put_word(uaecptr addr, uae_u16 val, uae_u32 fc, int size);
+void mmu030_put_byte(uaecptr addr, uae_u8  val, uae_u32 fc, int size);
+uae_u32 mmu030_get_long(uaecptr addr, uae_u32 fc, int size);
+uae_u16 mmu030_get_word(uaecptr addr, uae_u32 fc, int size);
+uae_u8  mmu030_get_byte(uaecptr addr, uae_u32 fc, int size);
+
+void mmu030_page_fault(uaecptr addr, bool read, int size);
+
+extern uae_u16 REGPARAM3 mmu030_get_word_unaligned(uaecptr addr, uae_u32 fc) REGPARAM;
+extern uae_u32 REGPARAM3 mmu030_get_long_unaligned(uaecptr addr, uae_u32 fc) REGPARAM;
+extern void REGPARAM3 mmu030_put_word_unaligned(uaecptr addr, uae_u16 val, uae_u32 fc) REGPARAM;
+extern void REGPARAM3 mmu030_put_long_unaligned(uaecptr addr, uae_u32 val, uae_u32 fc) REGPARAM;
+
+static ALWAYS_INLINE uae_u32 uae_mmu030_get_ilong(uaecptr addr)
+{
+    uae_u32 fc = (regs.s ? 4 : 0) | 2;
+
+       if (unlikely(is_unaligned(addr, 4)))
+               return mmu030_get_long_unaligned(addr, fc);
+       return mmu030_get_long(addr, fc, sz_long);
+}
+static ALWAYS_INLINE uae_u16 uae_mmu030_get_iword(uaecptr addr)
+{
+    uae_u32 fc = (regs.s ? 4 : 0) | 2;
+
+       if (unlikely(is_unaligned(addr, 2)))
+               return mmu030_get_word_unaligned(addr, fc);
+       return mmu030_get_word(addr, fc, sz_word);
+}
+static ALWAYS_INLINE uae_u16 uae_mmu030_get_ibyte(uaecptr addr)
+{
+    uae_u32 fc = (regs.s ? 4 : 0) | 2;
+
+       return mmu030_get_byte(addr, fc, sz_byte);
+}
+static ALWAYS_INLINE uae_u32 uae_mmu030_get_long(uaecptr addr)
+{
+    uae_u32 fc = (regs.s ? 4 : 0) | 1;
+
+       if (unlikely(is_unaligned(addr, 4)))
+               return mmu030_get_long_unaligned(addr, fc);
+       return mmu030_get_long(addr, fc, sz_long);
+}
+static ALWAYS_INLINE uae_u16 uae_mmu030_get_word(uaecptr addr)
+{
+    uae_u32 fc = (regs.s ? 4 : 0) | 1;
+
+       if (unlikely(is_unaligned(addr, 2)))
+               return mmu030_get_word_unaligned(addr, fc);
+       return mmu030_get_word(addr, fc, sz_word);
+}
+static ALWAYS_INLINE uae_u8 uae_mmu030_get_byte(uaecptr addr)
+{
+    uae_u32 fc = (regs.s ? 4 : 0) | 1;
+
+       return mmu030_get_byte(addr, fc, sz_byte);
+}
+static ALWAYS_INLINE void uae_mmu030_put_long(uaecptr addr, uae_u32 val)
+{
+    uae_u32 fc = (regs.s ? 4 : 0) | 1;
+    
+       if (unlikely(is_unaligned(addr, 4)))
+               mmu030_put_long_unaligned(addr, val, fc);
+       else
+               mmu030_put_long(addr, val, fc, sz_long);
+}
+static ALWAYS_INLINE void uae_mmu030_put_word(uaecptr addr, uae_u16 val)
+{
+    uae_u32 fc = (regs.s ? 4 : 0) | 1;
+
+       if (unlikely(is_unaligned(addr, 2)))
+               mmu030_put_word_unaligned(addr, val, fc);
+       else
+               mmu030_put_word(addr, val, fc, sz_word);
+}
+static ALWAYS_INLINE void uae_mmu030_put_byte(uaecptr addr, uae_u8 val)
+{
+    uae_u32 fc = (regs.s ? 4 : 0) | 1;
+
+       mmu030_put_byte(addr, val, fc, sz_byte);
+}
+
+static ALWAYS_INLINE uae_u32 sfc030_get_long(uaecptr addr)
+{
+    uae_u32 fc = regs.sfc&7;
+#if MMUDEBUG > 1
+       write_log(_T("sfc030_get_long: FC = %i\n"),fc);
+#endif
+       if (unlikely(is_unaligned(addr, 4)))
+               return mmu030_get_long_unaligned(addr, fc);
+       return mmu030_get_long(addr, fc, sz_long);
+}
+
+static ALWAYS_INLINE uae_u16 sfc030_get_word(uaecptr addr)
+{
+    uae_u32 fc = regs.sfc&7;
+#if MMUDEBUG > 1
+       write_log(_T("sfc030_get_word: FC = %i\n"),fc);
+#endif
+    if (unlikely(is_unaligned(addr, 2)))
+               return mmu030_get_word_unaligned(addr, fc);
+       return mmu030_get_word(addr, fc, sz_word);
+}
+
+static ALWAYS_INLINE uae_u8 sfc030_get_byte(uaecptr addr)
+{
+    uae_u32 fc = regs.sfc&7;
+#if MMUDEBUG > 1
+       write_log(_T("sfc030_get_byte: FC = %i\n"),fc);
+#endif
+       return mmu030_get_byte(addr, fc, sz_byte);
+}
+
+static ALWAYS_INLINE void dfc030_put_long(uaecptr addr, uae_u32 val)
+{
+    uae_u32 fc = regs.dfc&7;
+#if MMUDEBUG > 1
+       write_log(_T("dfc030_put_long: FC = %i\n"),fc);
+#endif
+    if (unlikely(is_unaligned(addr, 4)))
+               mmu030_put_long_unaligned(addr, val, fc);
+       else
+               mmu030_put_long(addr, val, fc, sz_long);
+}
+
+static ALWAYS_INLINE void dfc030_put_word(uaecptr addr, uae_u16 val)
+{
+    uae_u32 fc = regs.dfc&7;
+#if MMUDEBUG > 1
+       write_log(_T("dfc030_put_word: FC = %i\n"),fc);
+#endif
+       if (unlikely(is_unaligned(addr, 2)))
+               mmu030_put_word_unaligned(addr, val, fc);
+       else
+               mmu030_put_word(addr, val, fc, sz_word);
+}
+
+static ALWAYS_INLINE void dfc030_put_byte(uaecptr addr, uae_u8 val)
+{
+    uae_u32 fc = regs.dfc&7;
+#if MMUDEBUG > 1
+       write_log(_T("dfc030_put_byte: FC = %i\n"),fc);
+#endif
+       mmu030_put_byte(addr, val, fc, sz_byte);
+}
+
+#define ACCESS_CHECK_PUT \
+       if (!mmu030_ad[mmu030_idx].done) { \
+               mmu030_ad[mmu030_idx].val = v; \
+       } else if (mmu030_ad[mmu030_idx].done) { \
+               mmu030_idx++; \
+               return; \
+       }
+
+#define ACCESS_CHECK_GET \
+       if (mmu030_ad[mmu030_idx].done) { \
+               v = mmu030_ad[mmu030_idx].val; \
+               mmu030_idx++; \
+               return v; \
+       }
+
+#define ACCESS_CHECK_GET_PC(pc) \
+       if (mmu030_ad[mmu030_idx].done) { \
+               v = mmu030_ad[mmu030_idx].val; \
+               mmu030_idx++; \
+               m68k_incpci (pc); \
+               return v; \
+       }
+
+#define ACCESS_EXIT_PUT \
+       mmu030_ad[mmu030_idx].done = true; \
+       mmu030_idx++; \
+       mmu030_ad[mmu030_idx].done = false;
+
+#define ACCESS_EXIT_GET \
+       mmu030_ad[mmu030_idx].val = v; \
+       mmu030_ad[mmu030_idx].done = true; \
+       mmu030_idx++; \
+       mmu030_ad[mmu030_idx].done = false;
+
+STATIC_INLINE void put_byte_mmu030_state (uaecptr addr, uae_u32 v)
+{
+       ACCESS_CHECK_PUT
+    uae_mmu030_put_byte (addr, v);
+       ACCESS_EXIT_PUT
+}
+STATIC_INLINE void put_word_mmu030_state (uaecptr addr, uae_u32 v)
+{
+       ACCESS_CHECK_PUT
+    uae_mmu030_put_word (addr, v);
+       ACCESS_EXIT_PUT
+}
+STATIC_INLINE void put_long_mmu030_state (uaecptr addr, uae_u32 v)
+{
+       ACCESS_CHECK_PUT
+    uae_mmu030_put_long (addr, v);
+       ACCESS_EXIT_PUT
+}
+STATIC_INLINE uae_u32 get_byte_mmu030_state (uaecptr addr)
+{
+       uae_u32 v;
+       ACCESS_CHECK_GET
+    v = uae_mmu030_get_byte (addr);
+       ACCESS_EXIT_GET
+       return v;
+}
+STATIC_INLINE uae_u32 get_word_mmu030_state (uaecptr addr)
+{
+       uae_u32 v;
+       ACCESS_CHECK_GET
+       v = uae_mmu030_get_word (addr);
+       ACCESS_EXIT_GET
+       return v;
+}
+STATIC_INLINE uae_u32 get_long_mmu030_state (uaecptr addr)
+{
+       uae_u32 v;
+       ACCESS_CHECK_GET
+       v = uae_mmu030_get_long (addr);
+       ACCESS_EXIT_GET
+       return v;
+}
+STATIC_INLINE uae_u32 get_ibyte_mmu030_state (int o)
+{
+       uae_u32 v;
+    uae_u32 addr = m68k_getpc () + o;
+       ACCESS_CHECK_GET
+    v = uae_mmu030_get_iword (addr);
+       ACCESS_EXIT_GET
+       return v;
+}
+STATIC_INLINE uae_u32 get_iword_mmu030_state (int o)
+{
+       uae_u32 v;
+    uae_u32 addr = m68k_getpc () + o;
+       ACCESS_CHECK_GET
+    v = uae_mmu030_get_iword (addr);
+       ACCESS_EXIT_GET
+       return v;
+}
+STATIC_INLINE uae_u32 get_ilong_mmu030_state (int o)
+{
+       uae_u32 v;
+    uae_u32 addr = m68k_getpc () + o;
+       ACCESS_CHECK_GET
+    v = uae_mmu030_get_ilong (addr);
+       ACCESS_EXIT_GET
+       return v;
+}
+STATIC_INLINE uae_u32 next_iword_mmu030_state (void)
+{
+       uae_u32 v;
+    uae_u32 addr = m68k_getpc ();
+       ACCESS_CHECK_GET_PC(2);
+    v = uae_mmu030_get_iword (addr);
+    m68k_incpci (2);
+       ACCESS_EXIT_GET
+       return v;
+}
+STATIC_INLINE uae_u32 next_ilong_mmu030_state (void)
+{
+       uae_u32 v;
+    uae_u32 addr = m68k_getpc ();
+       ACCESS_CHECK_GET_PC(4);
+    v = uae_mmu030_get_ilong (addr);
+    m68k_incpci (4);
+       ACCESS_EXIT_GET
+       return v;
+}
+
+STATIC_INLINE uae_u32 get_byte_mmu030 (uaecptr addr)
+{
+       return uae_mmu030_get_byte (addr);
+}
+STATIC_INLINE uae_u32 get_word_mmu030 (uaecptr addr)
+{
+       return uae_mmu030_get_word (addr);
+}
+STATIC_INLINE uae_u32 get_long_mmu030 (uaecptr addr)
+{
+       return uae_mmu030_get_long (addr);
+}
+STATIC_INLINE void put_byte_mmu030 (uaecptr addr, uae_u32 v)
+{
+    uae_mmu030_put_byte (addr, v);
+}
+
+STATIC_INLINE void put_word_mmu030 (uaecptr addr, uae_u32 v)
+{
+    uae_mmu030_put_word (addr, v);
+}
+STATIC_INLINE void put_long_mmu030 (uaecptr addr, uae_u32 v)
+{
+    uae_mmu030_put_long (addr, v);
+}
+
+STATIC_INLINE uae_u32 get_ibyte_mmu030 (int o)
+{
+    uae_u32 pc = m68k_getpc () + o;
+    return uae_mmu030_get_iword (pc);
+}
+STATIC_INLINE uae_u32 get_iword_mmu030 (int o)
+{
+    uae_u32 pc = m68k_getpc () + o;
+    return uae_mmu030_get_iword (pc);
+}
+STATIC_INLINE uae_u32 get_ilong_mmu030 (int o)
+{
+    uae_u32 pc = m68k_getpc () + o;
+    return uae_mmu030_get_ilong (pc);
+}
+STATIC_INLINE uae_u32 next_iword_mmu030 (void)
+{
+       uae_u32 v;
+    uae_u32 pc = m68k_getpc ();
+    v = uae_mmu030_get_iword (pc);
+    m68k_incpci (2);
+       return v;
+}
+STATIC_INLINE uae_u32 next_ilong_mmu030 (void)
+{
+       uae_u32 v;
+    uae_u32 pc = m68k_getpc ();
+    v = uae_mmu030_get_ilong (pc);
+    m68k_incpci (4);
+       return v;
+}
+
+extern void m68k_do_rts_mmu030 (void);
+extern void m68k_do_rte_mmu030 (uaecptr a7);
+extern void flush_mmu030 (uaecptr, int);
+extern void m68k_do_bsr_mmu030 (uaecptr oldpc, uae_s32 offset);
+
+#endif
index 83a7d2aa0ec6b3f1bacdbe0ebf8da249dddb97b3..e6bb817c08fed5cc330aefbeced530543a771cf1 100644 (file)
 #define CHIPSET_CLOCK_PAL  3546895
 #define CHIPSET_CLOCK_NTSC 3579545
 
+#define MAXHPOS_ROWS 256
+#define MAXVPOS_LINES_ECS 2048
+#define MAXVPOS_LINES_OCS 512
+
 uae_u32 get_copper_address (int copno);
 
 extern int custom_init (void);
index 7d0e1caa910d4cfe974499b01958353f8582b6af..28ae99593f759fcb0e8eb7869a3ab37f26e58345 100644 (file)
@@ -75,6 +75,11 @@ void debug_bputpeek (uaecptr addr, uae_u32 v);
 void debug_wputpeek (uaecptr addr, uae_u32 v);
 void debug_lputpeek (uaecptr addr, uae_u32 v);
 
+uae_u32 get_byte_debug (uaecptr addr);
+uae_u32 get_word_debug (uaecptr addr);
+uae_u32 get_long_debug (uaecptr addr);
+
+
 enum debugtest_item { DEBUGTEST_BLITTER, DEBUGTEST_KEYBOARD, DEBUGTEST_FLOPPY, DEBUGTEST_MAX };
 void debugtest (enum debugtest_item, const TCHAR *, ...);
 
index 8dcfc3577c2197ef393d6108515aa7b6258ef5d8..94575316c81623d94a1761a780d7a9815ac5abee 100644 (file)
@@ -40,6 +40,7 @@ before it appears on-screen. (TW: display emulation now does this automatically)
 
 #define PIXEL_XPOS(HPOS) (((HPOS)*2 - DISPLAY_LEFT_SHIFT + DIW_DDF_OFFSET - 1) << lores_shift)
 
+#define min_diwlastword (0)
 #define max_diwlastword (PIXEL_XPOS(0x1d4 >> 1))
 
 extern int lores_factor, lores_shift, interlace_seen;
@@ -269,7 +270,7 @@ enum nln_how {
 
 extern void hsync_record_line_state (int lineno, enum nln_how, int changed);
 extern void vsync_handle_redraw (int long_frame, int lof_changed, uae_u16, uae_u16);
-extern void vsync_handle_check (void);
+extern bool vsync_handle_check (void);
 extern void init_hardware_for_drawing_frame (void);
 extern void reset_drawing (void);
 extern void drawing_init (void);
@@ -279,7 +280,7 @@ extern void frame_drawn (void);
 extern void redraw_frame (void);
 extern int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy, int *prealh);
 extern void set_custom_limits (int w, int h, int dx, int dy);
-extern void get_custom_topedge (int *x, int *y);
+extern void get_custom_topedge (int *x, int *y, bool max);
 extern void putpixel (uae_u8 *buf, int bpp, int x, xcolnr c8, int opaq);
 
 /* Finally, stuff that shouldn't really be shared.  */
@@ -289,7 +290,6 @@ extern int thisframe_first_drawn_line, thisframe_last_drawn_line;
 #define IHF_SCROLLLOCK 0
 #define IHF_QUIT_PROGRAM 1
 #define IHF_PICASSO 2
-#define IHF_SOUNDADJUST 3
 
 extern int inhibit_frame;
 
index 5fe16ad3a728eb2dde5fb302e470e6a63693601a..36ab02b970d59dd31963af89bb9275efe62db05d 100644 (file)
@@ -9,6 +9,7 @@
 struct hardfilehandle;
 
 #define MAX_HDF_CACHE_BLOCKS 128
+#define MAX_SCSI_SENSE 36
 struct hdf_cache
 {
        bool valid;
@@ -24,14 +25,9 @@ struct hardfiledata {
     uae_u64 virtsize; // virtual size
     uae_u64 physsize; // physical size (dynamic disk)
     uae_u64 offset;
-    int nrcyls;
-    int secspertrack;
-    int surfaces;
-    int reservedblocks;
-    int blocksize;
-    struct hardfilehandle *handle;
+       struct uaedev_config_info ci;
+       struct hardfilehandle *handle;
     int handle_valid;
-    int readonly;
     int dangerous;
     int flags;
     uae_u8 *cache;
@@ -42,36 +38,42 @@ struct hardfiledata {
     TCHAR product_rev[4 + 1];
     TCHAR device_name[256];
     /* geometry from possible RDSK block */
-    int cylinders;
-    int sectors;
-    int heads;
+    int rdbcylinders;
+    int rdbsectors;
+    int rdbheads;
     uae_u8 *virtual_rdb;
     uae_u64 virtual_size;
     int unitnum;
     int byteswap;
     int adide;
+    int hfd_type;
 
     uae_u8 *vhd_header;
     uae_u32 vhd_bamoffset;
     uae_u32 vhd_bamsize;
     uae_u32 vhd_blocksize;
-    uae_u32 vhd_type;
     uae_u8 *vhd_sectormap;
     uae_u64 vhd_sectormapblock;
     uae_u32 vhd_bitmapsize;
     uae_u64 vhd_footerblock;
 
+       void *chd_handle;
+
     int drive_empty;
     TCHAR *emptyname;
 
        struct hdf_cache bcache[MAX_HDF_CACHE_BLOCKS];
+       uae_u8 scsi_sense[MAX_SCSI_SENSE];
+
+       struct uaedev_config_info delayedci;
+       int reinsertdelay;
+       bool isreinsert;
 };
 
 #define HFD_FLAGS_REALDRIVE 1
 
 struct hd_hardfiledata {
     struct hardfiledata hfd;
-    int bootpri;
     uae_u64 size;
     int cyls;
     int heads;
@@ -79,7 +81,6 @@ struct hd_hardfiledata {
     int cyls_def;
     int secspertrack_def;
     int heads_def;
-    TCHAR *path;
     int ansi_version;
 };
 
@@ -111,7 +112,8 @@ extern struct uaedev_mount_info options_mountinfo;
 
 extern struct hardfiledata *get_hardfile_data (int nr);
 #define FILESYS_MAX_BLOCKSIZE 2048
-extern int hdf_open (struct hardfiledata *hfd, const TCHAR *name);
+extern int hdf_open (struct hardfiledata *hfd);
+extern int hdf_open (struct hardfiledata *hfd, const TCHAR *altname);
 extern int hdf_dup (struct hardfiledata *dhfd, const struct hardfiledata *shfd);
 extern void hdf_close (struct hardfiledata *hfd);
 extern int hdf_read_rdb (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
@@ -121,13 +123,12 @@ extern int hdf_getnumharddrives (void);
 extern TCHAR *hdf_getnameharddrive (int index, int flags, int *sectorsize, int *dangerousdrive);
 extern int isspecialdrive(const TCHAR *name);
 extern int get_native_path(uae_u32 lock, TCHAR *out);
-extern void hardfile_do_disk_change (struct uaedev_config_info *uci, int insert);
+extern void hardfile_do_disk_change (struct uaedev_config_data *uci, bool insert);
+extern void hardfile_send_disk_change (struct hardfiledata *hfd, bool insert);
+extern int hardfile_media_change (struct hardfiledata *hfd, struct uaedev_config_info *ci, bool inserted, bool timer);
 
 void hdf_hd_close(struct hd_hardfiledata *hfd);
-int hdf_hd_open(struct hd_hardfiledata *hfd, const TCHAR *path, int blocksize, int readonly,
-                      const TCHAR *devname, int cyls, int sectors, int surfaces, int reserved,
-                      int bootpri, const TCHAR *filesys,
-                          int pcyls, int pheads, int psectors);
+int hdf_hd_open(struct hd_hardfiledata *hfd);
 
 
 extern int vhd_create (const TCHAR *name, uae_u64 size, uae_u32);
index 234781ab8ea2ff6ef139f08b9cd6d6eb8d60bf31..ef80b4c2fc6682eb16dc36aba56cbacd30195947 100644 (file)
@@ -1,9 +1,7 @@
 
 extern void gayle_reset (int);
 extern void gayle_hsync (void);
-extern int gayle_add_ide_unit (int ch, const TCHAR *path, int blocksize, int readonly,
-                      const TCHAR *devname, int cyls, int sectors, int surfaces, int reserved,
-                      int bootpri, const TCHAR *filesys, int pcyls, int pheads, int psecs);
+extern int gayle_add_ide_unit (int ch, struct uaedev_config_info *ci);
 extern int gayle_modify_pcmcia_sram_unit (const TCHAR *path, int readonly, int insert);
 extern int gayle_modify_pcmcia_ide_unit (const TCHAR *path, int readonly, int insert);
 extern int gayle_add_pcmcia_sram_unit (const TCHAR *path, int readonly);
index 67985752019b54838f94c6ad0cf9d13be6c15cb3..7fc4fcc455a2535cafd5e5ab6bac57e61d0a535b 100644 (file)
@@ -7,7 +7,7 @@ typedef unsigned long u32;
 
 extern void S2X_refresh (void);
 extern void S2X_render (void);
-extern void S2X_init (int dw, int dh, int dd);
+extern bool S2X_init (int dw, int dh, int dd);
 extern void S2X_reset (void);
 extern void S2X_free (void);
 extern int S2X_getmult (void);
@@ -78,7 +78,7 @@ extern struct uae_filter uaefilters[];
 extern struct uae_filter *usedfilter;
 
 void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height, int aw, int ah, int scale, int temp_width, int temp_height);
-void getfilteroffset (int *dx, int *dy, int *mx, int *my);
+void getfilteroffset (float *dx, float *dy, float *mx, float *my);
 uae_u8 *getfilterbuffer (int *widthp, int *heightp, int *pitch, int *depth);
 uae_u8 *getfilterbuffer3d (int *widthp, int *heightp, int *pitch, int *depth);
 uae_u8 *getrtgbuffer (int *widthp, int *heightp, int *pitch, int *depth, uae_u8 *palette);
index b336df20b10ce216ffa6aaa8a8fa4fab4375949e..be46aa4659c22bc5cae4545c1bff68bbef66af8c 100644 (file)
@@ -55,7 +55,8 @@ struct gui_info
     uae_s8 hd;                                 /* harddrive */
     uae_s8 cd;                                 /* CD */
        uae_s8 md;                                      /* CD32 or CDTV internal storage */
-    int fps, idle;
+    bool cpu_halted;
+       int fps, idle;
        int fps_color;
     int sndbuf, sndbuf_status;
     TCHAR df[4][256];                  /* inserted image */
index 840be10b4ddc982d64772fc14ddb7eb2ebaca13a..9ff2dd87e7b3cdcd37806408e7d2ae8f751bf570 100644 (file)
@@ -154,7 +154,7 @@ extern int inputdevice_get_device_total (int type);
 extern int inputdevice_get_widget_num (int devnum);
 extern int inputdevice_get_widget_type (int devnum, int num, TCHAR *name);
 
-extern int input_get_default_mouse (struct uae_input_device *uid, int num, int port, int af, bool gp);
+extern int input_get_default_mouse (struct uae_input_device *uid, int num, int port, int af, bool gp, bool wheel);
 extern int input_get_default_lightpen (struct uae_input_device *uid, int num, int port, int af, bool gp);
 extern int input_get_default_joystick (struct uae_input_device *uid, int num, int port, int af, int mode, bool gp);
 extern int input_get_default_joystick_analog (struct uae_input_device *uid, int num, int port, int af, bool gp);
@@ -263,13 +263,14 @@ extern uae_u64 input_getqualifiers (void);
 extern void setsystime (void);
 
 #define JSEM_MODE_DEFAULT 0
-#define JSEM_MODE_MOUSE 1
-#define JSEM_MODE_JOYSTICK 2
-#define JSEM_MODE_GAMEPAD 3
-#define JSEM_MODE_JOYSTICK_ANALOG 4
-#define JSEM_MODE_MOUSE_CDTV 5
-#define JSEM_MODE_JOYSTICK_CD32 6
-#define JSEM_MODE_LIGHTPEN 7
+#define JSEM_MODE_WHEELMOUSE 1
+#define JSEM_MODE_MOUSE 2
+#define JSEM_MODE_JOYSTICK 3
+#define JSEM_MODE_GAMEPAD 4
+#define JSEM_MODE_JOYSTICK_ANALOG 5
+#define JSEM_MODE_MOUSE_CDTV 6
+#define JSEM_MODE_JOYSTICK_CD32 7
+#define JSEM_MODE_LIGHTPEN 8
 
 #define JSEM_KBDLAYOUT 0
 #define JSEM_JOYS 100
diff --git a/include/mmu_common.h b/include/mmu_common.h
new file mode 100644 (file)
index 0000000..2738f46
--- /dev/null
@@ -0,0 +1,136 @@
+
+#ifndef MMU_COMMON_H
+#define MMU_COMMON_H
+
+#define MMUDEBUG 1
+
+#ifdef _MSC_VER
+#define unlikely(x) x
+#define likely(x) x
+#endif
+
+#ifdef __cplusplus
+struct m68k_exception {
+       int prb;
+       m68k_exception (int exc) : prb (exc) {}
+       operator int() { return prb; }
+};
+#define SAVE_EXCEPTION
+#define RESTORE_EXCEPTION
+#define TRY(var) try
+#define CATCH(var) catch(m68k_exception var)
+#define THROW(n) throw m68k_exception(n)
+#define THROW_AGAIN(var) throw
+#define ENDTRY
+#else
+/* we are in plain C, just use a stack of long jumps */
+#include <setjmp.h>
+extern jmp_buf __exbuf;
+extern int     __exvalue;
+#define TRY(DUMMY)       __exvalue=setjmp(__exbuf);       \
+                  if (__exvalue==0) { __pushtry(&__exbuf);
+#define CATCH(x)  __poptry(); } else { fprintf(stderr,"Gotcha! %d %s in %d\n",__exvalue,__FILE__,__LINE__);
+#define ENDTRY    __poptry();}
+#define THROW(x) if (__is_catched()) {fprintf(stderr,"Longjumping %s in %d\n",__FILE__,__LINE__);longjmp(__exbuf,x);}
+#define THROW_AGAIN(var) if (__is_catched()) longjmp(*__poptry(),__exvalue)
+#define SAVE_EXCEPTION
+#define RESTORE_EXCEPTION
+jmp_buf* __poptry(void);
+void __pushtry(jmp_buf *j);
+int __is_catched(void);
+
+typedef  int m68k_exception;
+
+#endif
+
+/* special status word (access error stack frame) */
+/* 68060 */
+#define MMU_FSLW_MA            0x08000000
+#define MMU_FSLW_LK            0x02000000
+#define MMU_FSLW_R             0x01000000
+#define MMU_FSLW_W             0x00800000
+#define MMU_FSLW_SIZE_B        0x00000000
+#define MMU_FSLW_SIZE_W        0x00400000
+#define MMU_FSLW_SIZE_L        0x00200000
+#define MMU_FSLW_SIZE_D        0x00600000
+#define MMU_FSLW_TT            0x00180000
+#define MMU_FSLW_TM            0x00070000
+#define MMU_FSLW_IO            0x00008000
+#define MMU_FSLW_PBE   0x00004000
+#define MMU_FSLW_SBE   0x00002000
+#define MMU_FSLW_PTA   0x00001000
+#define MMU_FSLW_PTB   0x00000800
+#define MMU_FSLW_IL            0x00000400
+#define MMU_FSLW_PF            0x00000200
+#define MMU_FSLW_SP            0x00000100
+#define MMU_FSLW_WP            0x00000080
+#define MMU_FSLW_TWE   0x00000040
+#define MMU_FSLW_RE            0x00000020
+#define MMU_FSLW_WE            0x00000010
+#define MMU_FSLW_TTR   0x00000008
+#define MMU_FSLW_BPE   0x00000004
+#define MMU_FSLW_SEE   0x00000001
+/* 68040 */
+#define MMU_SSW_TM             0x0007
+#define MMU_SSW_TT             0x0018
+#define MMU_SSW_SIZE   0x0060
+#define MMU_SSW_SIZE_B 0x0020
+#define MMU_SSW_SIZE_W 0x0040
+#define MMU_SSW_SIZE_L 0x0000
+#define MMU_SSW_RW             0x0100
+#define MMU_SSW_LK             0x0200
+#define MMU_SSW_ATC            0x0400
+#define MMU_SSW_MA             0x0800
+#define MMU_SSW_CM     0x1000
+#define MMU_SSW_CT     0x2000
+#define MMU_SSW_CU     0x4000
+#define MMU_SSW_CP     0x8000
+/* 68030 */
+#define MMU030_SSW_FC       0x8000
+#define MMU030_SSW_FB       0x4000
+#define MMU030_SSW_RC       0x2000
+#define MMU030_SSW_RB       0x1000
+#define MMU030_SSW_DF       0x0100
+#define MMU030_SSW_RM       0x0080
+#define MMU030_SSW_RW       0x0040
+#define MMU030_SSW_SIZE_MASK    0x0030
+#define MMU030_SSW_SIZE_B       0x0010
+#define MMU030_SSW_SIZE_W       0x0020
+#define MMU030_SSW_SIZE_L       0x0000
+#define MMU030_SSW_FC_MASK      0x0007
+
+
+#define ALWAYS_INLINE __inline
+
+// take care of 2 kinds of alignement, bus size and page
+static inline bool is_unaligned(uaecptr addr, int size)
+{
+    return unlikely((addr & (size - 1)) && (addr ^ (addr + size - 1)) & regs.mmu_page_size);
+}
+
+static ALWAYS_INLINE void phys_put_long(uaecptr addr, uae_u32 l)
+{
+    longput(addr, l);
+}
+static ALWAYS_INLINE void phys_put_word(uaecptr addr, uae_u32 w)
+{
+    wordput(addr, w);
+}
+static ALWAYS_INLINE void phys_put_byte(uaecptr addr, uae_u32 b)
+{
+    byteput(addr, b);
+}
+static ALWAYS_INLINE uae_u32 phys_get_long(uaecptr addr)
+{
+    return longget (addr);
+}
+static ALWAYS_INLINE uae_u32 phys_get_word(uaecptr addr)
+{
+    return wordget (addr);
+}
+static ALWAYS_INLINE uae_u32 phys_get_byte(uaecptr addr)
+{
+    return byteget (addr);
+}
+
+#endif
index 835a1fb4f8c817eca2145d67d18996caf8399eb1..d6a6fc6eaa57d3f6249bd2518a39572a343c8a52 100644 (file)
@@ -118,6 +118,12 @@ struct cache040
        uae_u32 tag[CACHELINES040];
 };
 
+struct mmufixup
+{
+    int reg;
+    uae_u32 value;
+};
+extern struct mmufixup mmufixup[2];
 
 struct regstruct
 {
@@ -139,6 +145,7 @@ struct regstruct
        flagtype m;
        flagtype x;
        flagtype stopped;
+       int halted;
        int exception;
        int intmask;
        int ipl, ipl_pin;
@@ -148,9 +155,9 @@ struct regstruct
 #ifdef FPUEMU
        fptype fp[8];
        fptype fp_result;
-
        uae_u32 fpcr, fpsr, fpiar;
        uae_u32 fpsr_highbyte;
+       uae_u32 fpu_state;
 #endif
 #ifndef CPUEMU_68000_ONLY
        uae_u32 cacr, caar;
@@ -161,7 +168,7 @@ struct regstruct
        uae_u32 wb3_data;
        uae_u16 wb3_status;
        int mmu_enabled;
-       int mmu_pagesize_8k;
+       int mmu_page_size;
 #endif
 
        uae_u32 pcr;
@@ -349,25 +356,38 @@ extern uae_u32 (*x_next_ilong)(void);
 extern uae_u32 (*x_get_ilong)(int);
 extern uae_u32 (*x_get_iword)(int);
 extern uae_u32 (*x_get_ibyte)(int);
+
+extern uae_u32 (*x_cp_get_byte)(uaecptr addr);
+extern uae_u32 (*x_cp_get_word)(uaecptr addr);
+extern uae_u32 (*x_cp_get_long)(uaecptr addr);
+extern void (*x_cp_put_byte)(uaecptr addr, uae_u32 v);
+extern void (*x_cp_put_word)(uaecptr addr, uae_u32 v);
+extern void (*x_cp_put_long)(uaecptr addr, uae_u32 v);
+extern uae_u32 (*x_cp_next_iword)(void);
+extern uae_u32 (*x_cp_next_ilong)(void);
+
+extern uae_u32 (REGPARAM3 *x_cp_get_disp_ea_020)(uae_u32 base, int idx) REGPARAM;
+
 extern void (*x_do_cycles)(unsigned long);
 extern void (*x_do_cycles_pre)(unsigned long);
 extern void (*x_do_cycles_post)(unsigned long, uae_u32);
 
-extern uae_u32 REGPARAM3 x_get_disp_ea_020 (uae_u32 base, uae_u32 dp) REGPARAM;
-extern uae_u32 REGPARAM3 x_get_disp_ea_ce020 (uae_u32 base, uae_u32 dp) REGPARAM;
+extern uae_u32 REGPARAM3 x_get_disp_ea_020 (uae_u32 base, int idx) REGPARAM;
+extern uae_u32 REGPARAM3 x_get_disp_ea_ce020 (uae_u32 base, int idx) REGPARAM;
 extern uae_u32 REGPARAM3 x_get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset, int width) REGPARAM;
 extern void REGPARAM3 x_put_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32 offset, int width) REGPARAM;
 
 extern void m68k_setstopped (void);
 extern void m68k_resumestopped (void);
 
-extern uae_u32 REGPARAM3 get_disp_ea_020 (uae_u32 base, uae_u32 dp) REGPARAM;
+extern uae_u32 REGPARAM3 get_disp_ea_020 (uae_u32 base, int idx) REGPARAM;
 extern uae_u32 REGPARAM3 get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset, int width) REGPARAM;
 extern void REGPARAM3 put_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32 offset, int width) REGPARAM;
 
-extern void m68k_disasm_ea (void *f, uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr);
-extern void m68k_disasm (void *f, uaecptr addr, uaecptr *nextpc, int cnt);
+extern void m68k_disasm_ea (uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr);
+extern void m68k_disasm (uaecptr addr, uaecptr *nextpc, int cnt);
 extern void m68k_disasm_2 (TCHAR *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr, int safemode);
+extern void sm68k_disasm (TCHAR*, TCHAR*, uaecptr addr, uaecptr *nextpc);
 extern int get_cpu_model (void);
 
 extern void REGPARAM3 MakeSR (void) REGPARAM;
@@ -385,9 +405,7 @@ extern void m68k_mull (uae_u32, uae_u32, uae_u16);
 extern void init_m68k (void);
 extern void init_m68k_full (void);
 extern void m68k_go (int);
-extern void m68k_dumpstate (void *, uaecptr *);
-extern void m68k_disasm (void *, uaecptr, uaecptr *, int);
-extern void sm68k_disasm (TCHAR*, TCHAR*, uaecptr addr, uaecptr *nextpc);
+extern void m68k_dumpstate (uaecptr *);
 extern void m68k_reset (int);
 extern int getDivu68kCycles (uae_u32 dividend, uae_u16 divisor);
 extern int getDivs68kCycles (uae_s32 dividend, uae_s16 divisor);
@@ -415,6 +433,7 @@ extern void exception3i (uae_u32 opcode, uaecptr addr);
 extern void exception3 (uae_u32 opcode, uaecptr addr, int w, int i, uaecptr pc);
 extern void exception2 (uaecptr addr);
 extern void cpureset (void);
+extern void cpu_halt (int id);
 
 extern void fill_prefetch (void);
 
@@ -423,6 +442,7 @@ extern void fill_prefetch (void);
 /* 68060 */
 extern const struct cputbl op_smalltbl_0_ff[];
 extern const struct cputbl op_smalltbl_22_ff[]; // CE
+extern const struct cputbl op_smalltbl_33_ff[]; // MMU
 /* 68040 */
 extern const struct cputbl op_smalltbl_1_ff[];
 extern const struct cputbl op_smalltbl_23_ff[]; // CE
@@ -430,6 +450,7 @@ extern const struct cputbl op_smalltbl_31_ff[]; // MMU
 /* 68030 */
 extern const struct cputbl op_smalltbl_2_ff[];
 extern const struct cputbl op_smalltbl_24_ff[]; // CE
+extern const struct cputbl op_smalltbl_32_ff[]; // MMU
 /* 68020 */
 extern const struct cputbl op_smalltbl_3_ff[];
 extern const struct cputbl op_smalltbl_20_ff[]; // prefetch
index 664215892512de655634ab4b35d1eefa06d895f6..c69892c0206b2a17b979aaee4231580ccbc68c3b 100644 (file)
@@ -8,8 +8,8 @@
 */
 
 #define UAEMAJOR 2
-#define UAEMINOR 5
-#define UAESUBREV 1
+#define UAEMINOR 6
+#define UAESUBREV 0
 
 typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang;
 
@@ -100,9 +100,11 @@ struct floppyslot
        TCHAR dfxclickexternal[256];
 };
 
+#define WH_NATIVE 1
 struct wh {
        int x, y;
        int width, height;
+       int special;
 };
 
 #define MOUNT_CONFIG_SIZE 30
@@ -110,21 +112,40 @@ struct uaedev_config_info {
        TCHAR devname[MAX_DPATH];
        TCHAR volname[MAX_DPATH];
        TCHAR rootdir[MAX_DPATH];
-       bool ishdf;
        bool readonly;
        int bootpri;
        bool autoboot;
        bool donotmount;
        TCHAR filesys[MAX_DPATH];
-       int cyls; // zero if detected from size
+       int lowcyl;
+       int highcyl; // zero if detected from size
+       int cyls; // calculated/corrected highcyl
        int surfaces;
        int sectors;
        int reserved;
        int blocksize;
-       int configoffset;
        int controller;
        // zero if default
        int pcyls, pheads, psecs;
+       int flags;
+       int buffers;
+       int bufmemtype;
+       int stacksize;
+       int priority;
+       uae_u32 mask;
+       int maxtransfer;
+       uae_u32 dostype;
+       int unit;
+       int interleave;
+       int sectorsperblock;
+
+};
+
+struct uaedev_config_data
+{
+       struct uaedev_config_info ci;
+       int configoffset;
+       bool ishdf;
 };
 
 enum { CP_GENERIC = 1, CP_CDTV, CP_CD32, CP_A500, CP_A500P, CP_A600, CP_A1000,
@@ -293,9 +314,9 @@ struct uae_prefs {
        int gfx_filter_scanlines;
        int gfx_filter_scanlineratio;
        int gfx_filter_scanlinelevel;
-       int gfx_filter_horiz_zoom, gfx_filter_vert_zoom;
-       int gfx_filter_horiz_zoom_mult, gfx_filter_vert_zoom_mult;
-       int gfx_filter_horiz_offset, gfx_filter_vert_offset;
+       float gfx_filter_horiz_zoom, gfx_filter_vert_zoom;
+       float gfx_filter_horiz_zoom_mult, gfx_filter_vert_zoom_mult;
+       float gfx_filter_horiz_offset, gfx_filter_vert_offset;
        int gfx_filter_filtermode;
        int gfx_filter_bilinear;
        int gfx_filter_noise, gfx_filter_blur;
@@ -304,8 +325,8 @@ struct uae_prefs {
        int gfx_filter_autoscale;
        int gfx_filter_keep_autoscale_aspect;
 
-       int rtg_horiz_zoom_mult;
-       int rtg_vert_zoom_mult;
+       float rtg_horiz_zoom_mult;
+       float rtg_vert_zoom_mult;
 
        bool immediate_blits;
        int waiting_blits;
@@ -438,7 +459,7 @@ struct uae_prefs {
        bool native_code;
 
        int mountitems;
-       struct uaedev_config_info mountconfig[MOUNT_CONFIG_SIZE];
+       struct uaedev_config_data mountconfig[MOUNT_CONFIG_SIZE];
 
        int nr_floppies;
        struct floppyslot floppyslots[4];
@@ -471,7 +492,7 @@ struct uae_prefs {
        bool win32_iconified_nosound;
 
        bool win32_rtgmatchdepth;
-       bool win32_rtgscaleifsmall;
+       int win32_rtgscalemode;
        bool win32_rtgallowscaling;
        int win32_rtgscaleaspectratio;
        int win32_rtgvblankrate;
@@ -550,11 +571,9 @@ extern void cfgfile_target_write_str (struct zfile *f, const TCHAR *option, cons
 extern void cfgfile_target_dwrite_str (struct zfile *f, const TCHAR *option, const TCHAR *value);
 
 extern void cfgfile_backup (const TCHAR *path);
-extern struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index,
-       const TCHAR *devname, const TCHAR *volname, const TCHAR *rootdir, bool readonly,
-       int cyls, int secspertrack, int surfaces, int reserved,
-       int blocksize, int bootpri, const TCHAR *filesysdir, int hdc, int flags,
-       int pcyls, int pheads, int psecs);
+extern struct uaedev_config_data *add_filesys_config (struct uae_prefs *p, int index, struct uaedev_config_info*, bool hdf);
+extern bool get_hd_geometry (struct uaedev_config_info *);
+extern void uci_set_defaults (struct uaedev_config_info *uci, bool rdb);
 
 extern void default_prefs (struct uae_prefs *, int);
 extern void discard_prefs (struct uae_prefs *, int);
index cee78c865f0bce1e28c7c890eb33822725139cb1..3c1a3e608b7f72da8ea7f50f6b097117266f4723 100644 (file)
@@ -133,8 +133,13 @@ extern uae_u8 *restore_cdtv (uae_u8 *src);
 extern uae_u8 *save_cdtv (int *len, uae_u8*);
 extern void restore_cdtv_finish (void);
 
-extern uae_u8 *restore_dmac (uae_u8 *src);
-extern uae_u8 *save_dmac (int *len, uae_u8*);
+extern uae_u8 *restore_cdtv_dmac (uae_u8 *src);
+extern uae_u8 *save_cdtv_dmac (int *len, uae_u8*);
+extern uae_u8 *restore_scsi_dmac (uae_u8 *src);
+extern uae_u8 *save_scsi_dmac (int *len, uae_u8*);
+
+extern uae_u8 *save_scsi_hd (int num, int *len, uae_u8 *dstptr);
+extern uae_u8 *restore_scsi_hd (uae_u8 *src);
 
 extern uae_u8 *restore_filesys (uae_u8 *src);
 extern uae_u8 *save_filesys (int num, int *len);
index db47e179e86a6a0a43edbdb0287efa95c11d7e65..9e80cf020541e8b95d99d5a1541d20421fc34f8e 100644 (file)
@@ -3,7 +3,7 @@
 struct scsi_data
 {
     int id;
-    int len;
+    int cmd_len;
     uae_u8 *data;
     int data_len;
     int status;
@@ -25,14 +25,11 @@ extern struct scsi_data *scsi_alloc_native(int,int);
 extern void scsi_free(struct scsi_data*);
 extern void scsi_reset(void);
 
-extern void scsi_start_transfer(struct scsi_data*,int);
+extern void scsi_start_transfer(struct scsi_data*);
 extern int scsi_send_data(struct scsi_data*, uae_u8);
 extern int scsi_receive_data(struct scsi_data*, uae_u8*);
 extern void scsi_emulate_cmd(struct scsi_data *sd);
-extern int scsi_data_dir(struct scsi_data *sd);
-
 
 extern int scsi_emulate(struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u8 *cmdbuf, int scsi_cmd_len,
                uae_u8 *scsi_data, int *data_len, uae_u8 *r, int *reply_len, uae_u8 *s, int *sense_len);
-
-
+extern void scsi_emulate_analyze (struct scsi_data*);
\ No newline at end of file
index b49758c092c35129a53303d87e6100e5150d3767..6364a92830920c7e99de417b5a922529bf4ef23a 100644 (file)
@@ -20,7 +20,7 @@ extern uae_u32 p96_rgbx16[65536];
 extern int graphics_setup (void);
 extern int graphics_init (bool);
 extern void graphics_leave (void);
-extern void handle_events (void);
+extern bool handle_events (void);
 extern int handle_msgpump (void);
 extern void setup_brkhandler (void);
 extern int isfullscreen (void);
index 9e659d6341b6022f577c155bb4ebcb032de9df68..372de46fc0f8f3366d382cdb298ed73e8a922204 100644 (file)
@@ -52,8 +52,6 @@
 #include "dongle.h"
 #include "cdtv.h"
 
-extern int bootrom_header, bootrom_items;
-
 // 01 = host events
 // 02 = joystick
 // 04 = cia buttons
@@ -1417,7 +1415,7 @@ void inputdevice_tablet_info (int maxx, int maxy, int maxz, int maxax, int maxay
 }
 
 
-void getgfxoffset (int *dx, int *dy, int*,int*);
+void getgfxoffset (float *dx, float *dy, float*, float*);
 
 static void inputdevice_mh_abs (int x, int y, uae_u32 buttonbits)
 {
@@ -1577,7 +1575,7 @@ static void inputdevice_mh_abs_v36 (int x, int y)
 static void mousehack_helper (uae_u32 buttonmask)
 {
        int x, y;
-       int fdy, fdx, fmx, fmy;
+       float fdy, fdx, fmx, fmy;
 
        if (currprefs.input_magic_mouse == 0 && currprefs.input_tablet < TABLET_MOUSEHACK)
                return;
@@ -1595,17 +1593,17 @@ static void mousehack_helper (uae_u32 buttonmask)
        if (picasso_on) {
                x -= picasso96_state.XOffset;
                y -= picasso96_state.YOffset;
-               x = x * fmx / 1000;
-               y = y * fmy / 1000;
-               x -= fdx * fmx / 1000;
-               y -= fdy * fmy / 1000;
+               x = (int)(x * fmx);
+               y = (int)(y * fmy);
+               x -= (int)(fdx * fmx);
+               y -= (int)(fdy * fmy);
        } else
 #endif
        {
-               x = x * fmx / 1000;
-               y = y * fmy / 1000;
-               x -= fdx * fmx / 1000 - 1;
-               y -= fdy * fmy / 1000 - 2;
+               x = (int)(x * fmx);
+               y = (int)(y * fmy);
+               x -= (int)(fdx * fmx) - 1;
+               y -= (int)(fdy * fmy) - 2;
                if (x < 0)
                        x = 0;
                if (x >= gfxvidinfo.outbuffer->outwidth)
@@ -2307,6 +2305,8 @@ static int handle_custom_event (const TCHAR *custom)
                        config_changed = 0;
                } else if (!_tcsicmp (p, _T("do_config_check"))) {
                        config_changed = 1;
+               } else if (!_tcsnicmp (p, _T("dbg "), 4)) {
+                       debug_parser (p + 4, NULL, -1);
                } else {
                        cfgfile_parse_line (&changed_prefs, p, 0);
                }
@@ -4395,7 +4395,7 @@ void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index, int n
        if (newmode >= 0) {
                mode = newmode;
        } else if (mode == 0) {
-               mode = index == 0 ? JSEM_MODE_MOUSE : (prefs->cs_cd32cd ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK);
+               mode = index == 0 ? JSEM_MODE_WHEELMOUSE : (prefs->cs_cd32cd ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK);
        }
        prefs->jports[index].mode = mode;
        prefs->jports[index].id = -2;
@@ -4481,6 +4481,7 @@ static void setjoyinputs (struct uae_prefs *prefs, int port)
                case JSEM_MODE_JOYSTICK_ANALOG:
                        joyinputs[port] = port ? ip_analog2 : ip_analog1;
                break;
+               case JSEM_MODE_WHEELMOUSE:
                case JSEM_MODE_MOUSE:
                        joyinputs[port] = port ? ip_mouse2 : ip_mouse1;
                break;
@@ -4554,8 +4555,9 @@ static void compatibility_copy (struct uae_prefs *prefs, bool gameports)
                                {
                                        case JSEM_MODE_DEFAULT:
                                        case JSEM_MODE_MOUSE:
+                                       case JSEM_MODE_WHEELMOUSE:
                                        default:
-                                       joymodes[i] = JSEM_MODE_MOUSE;
+                                       joymodes[i] = JSEM_MODE_WHEELMOUSE;
                                        joyinputs[i] = i ? ip_mouse2 : ip_mouse1;
                                        break;
                                        case JSEM_MODE_LIGHTPEN:
@@ -4594,7 +4596,8 @@ static void compatibility_copy (struct uae_prefs *prefs, bool gameports)
                                                joyinputs[i] = i ? ip_analog2 : ip_analog1;
                                                break;
                                        case JSEM_MODE_MOUSE:
-                                               joymodes[i] = JSEM_MODE_MOUSE;
+                                       case JSEM_MODE_WHEELMOUSE:
+                                               joymodes[i] = JSEM_MODE_WHEELMOUSE;
                                                joyinputs[i] = i ? ip_mouse2 : ip_mouse1;
                                                break;
                                        case JSEM_MODE_LIGHTPEN:
@@ -4607,7 +4610,7 @@ static void compatibility_copy (struct uae_prefs *prefs, bool gameports)
                                                break;
                                }
                        } else if (prefs->jports[i].id >= 0) {
-                               joymodes[i] = i ? JSEM_MODE_JOYSTICK : JSEM_MODE_MOUSE;
+                               joymodes[i] = i ? JSEM_MODE_JOYSTICK : JSEM_MODE_WHEELMOUSE;
                                joyinputs[i] = i ? ip_joy2 : ip_mouse1;
                        }
                }
@@ -4637,9 +4640,10 @@ static void compatibility_copy (struct uae_prefs *prefs, bool gameports)
                                {
                                case JSEM_MODE_DEFAULT:
                                case JSEM_MODE_MOUSE:
+                               case JSEM_MODE_WHEELMOUSE:
                                default:
-                                       input_get_default_mouse (mice, joy, i, af, !gameports);
-                                       joymodes[i] = JSEM_MODE_MOUSE;
+                                       input_get_default_mouse (mice, joy, i, af, !gameports, mode != JSEM_MODE_MOUSE);
+                                       joymodes[i] = JSEM_MODE_WHEELMOUSE;
                                        break;
                                case JSEM_MODE_LIGHTPEN:
                                        input_get_default_lightpen (mice, joy, i, af, !gameports);
@@ -4683,8 +4687,9 @@ static void compatibility_copy (struct uae_prefs *prefs, bool gameports)
                                        joymodes[i] = JSEM_MODE_JOYSTICK_ANALOG;
                                        break;
                                case JSEM_MODE_MOUSE:
-                                       input_get_default_mouse (joysticks, joy, i, af, !gameports);
-                                       joymodes[i] = JSEM_MODE_MOUSE;
+                               case JSEM_MODE_WHEELMOUSE:
+                                       input_get_default_mouse (joysticks, joy, i, af, !gameports, mode == JSEM_MODE_WHEELMOUSE);
+                                       joymodes[i] = JSEM_MODE_WHEELMOUSE;
                                        break;
                                case JSEM_MODE_LIGHTPEN:
                                        input_get_default_lightpen (joysticks, joy, i, af, !gameports);
@@ -4774,8 +4779,9 @@ static void compatibility_copy (struct uae_prefs *prefs, bool gameports)
                                                }
                                                break;
                                        case JSEM_MODE_MOUSE:
+                                       case JSEM_MODE_WHEELMOUSE:
                                                setcompakb (kb, i ? ip_mouse2 : ip_mouse1, i, af);
-                                               joymodes[i] = JSEM_MODE_MOUSE;
+                                               joymodes[i] = JSEM_MODE_WHEELMOUSE;
                                                break;
                                        }
                                        used[joy] = 1;
@@ -6426,9 +6432,9 @@ void setmousestate (int mouse, int axis, int data, int isabs)
 {
        int i, v, diff;
        int *mouse_p, *oldm_p;
-       double d;
+       float d;
        struct uae_input_device *id = &mice[mouse];
-       static double fract[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
+       static float fract[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
 
        if (testmode) {
                inputdevice_testrecord (IDTYPE_MOUSE, mouse, IDEV_WIDGET_AXIS, axis, data, -1);
@@ -6458,7 +6464,7 @@ void setmousestate (int mouse, int axis, int data, int isabs)
                        return;
                *oldm_p = *mouse_p;
                *mouse_p += data;
-               d = (*mouse_p - *oldm_p) * currprefs.input_mouse_speed / 100.0;
+               d = (*mouse_p - *oldm_p) * currprefs.input_mouse_speed / 100.0f;
        } else {
                d = data - *oldm_p;
                *oldm_p = data;
index 0754e4a792f523a3e8163e2ddcf41827299dabb8..5014f5ceb48b51a34de7b981b4af5c3d65b87c7a 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -105,7 +105,7 @@ uae_u32 uaerandgetseed (void)
 void my_trim (TCHAR *s)
 {
        int len;
-       while (_tcscspn (s, _T("\t \r\n")) == 0)
+       while (_tcslen (s) > 0 && _tcscspn (s, _T("\t \r\n")) == 0)
                memmove (s, s + 1, (_tcslen (s + 1) + 1) * sizeof (TCHAR));
        len = _tcslen (s);
        while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0)
@@ -224,7 +224,7 @@ void fixup_cpu (struct uae_prefs *p)
                break;
        }
 
-       if (p->cpu_model != 68040)
+       if (p->cpu_model < 68030 || p->cachesize)
                p->mmu_model = 0;
 
        if (p->cachesize && p->cpu_cycle_exact)
index 3cffe164c249d5ddadfe2ad3844ac8e8dc898c4a..6afcd6df53d29be042fa2fef5c85761a52ab5c7a 100644 (file)
@@ -976,8 +976,9 @@ static void REGPARAM2 kickmem_lput (uaecptr addr, uae_u32 b)
                        return;
                } else
                        a1000_handle_kickstart (0);
-       } else if (currprefs.illegal_mem)
+       } else if (currprefs.illegal_mem) {
                write_log (_T("Illegal kickmem lput at %08x\n"), addr);
+       }
 }
 
 static void REGPARAM2 kickmem_wput (uaecptr addr, uae_u32 b)
@@ -994,8 +995,9 @@ static void REGPARAM2 kickmem_wput (uaecptr addr, uae_u32 b)
                        return;
                } else
                        a1000_handle_kickstart (0);
-       } else if (currprefs.illegal_mem)
+       } else if (currprefs.illegal_mem) {
                write_log (_T("Illegal kickmem wput at %08x\n"), addr);
+       }
 }
 
 static void REGPARAM2 kickmem_bput (uaecptr addr, uae_u32 b)
@@ -1010,8 +1012,9 @@ static void REGPARAM2 kickmem_bput (uaecptr addr, uae_u32 b)
                        return;
                } else
                        a1000_handle_kickstart (0);
-       } else if (currprefs.illegal_mem)
+       } else if (currprefs.illegal_mem) {
                write_log (_T("Illegal kickmem bput at %08x\n"), addr);
+       }
 }
 
 static void REGPARAM2 kickmem2_lput (uaecptr addr, uae_u32 l)
@@ -1229,7 +1232,7 @@ uae_u8 *REGPARAM2 default_xlate (uaecptr a)
                                write_log (_T("Your Amiga program just did something terribly stupid %08X PC=%08X\n"), a, M68K_GETPC);
                                if (debugging || DEBUG_STUPID)
                                        activate_debugger ();
-                               m68k_dumpstate (0, 0);
+                               m68k_dumpstate (0);
                                for (i = 0; i < 10; i++) {
                                        write_log (_T("%08X "), i >= 5 ? a3 : a2);
                                        for (j = 0; j < 16; j += 2) {
@@ -1241,11 +1244,11 @@ uae_u8 *REGPARAM2 default_xlate (uaecptr a)
                                memory_map_dump ();
                        }
                        be_cnt++;
-                       if (be_cnt > 1000) {
-                               uae_reset (0, 0);
+                       if (regs.s || be_cnt > 1000) {
+                               cpu_halt (3);
                                be_cnt = 0;
                        } else {
-                               regs.panic = 1;
+                               regs.panic = 4;
                                regs.panic_pc = m68k_getpc ();
                                regs.panic_addr = a;
                                set_special (SPCFLAG_BRK);
@@ -2132,7 +2135,7 @@ static void allocate_memory (void)
 
                memsize = allocated_chipmem = chipmem_full_size = currprefs.chipmem_size;
                chipmem_full_mask = chipmem_mask = allocated_chipmem - 1;
-               if (!canbang && memsize < 0x100000)
+               if (!currprefs.cachesize && memsize < 0x100000)
                        memsize = 0x100000;
                if (memsize > 0x100000 && memsize < 0x200000)
                        memsize = 0x200000;
@@ -2147,7 +2150,7 @@ static void allocate_memory (void)
                }
                currprefs.chipset_mask = changed_prefs.chipset_mask;
                chipmem_full_mask = allocated_chipmem - 1;
-               if ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) && !canbang) {
+               if ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) && !currprefs.cachesize) {
                        if (allocated_chipmem < 0x100000)
                                chipmem_full_mask = 0x100000 - 1;
                        if (allocated_chipmem > 0x100000 && allocated_chipmem < 0x200000)
@@ -2527,8 +2530,8 @@ void memory_reset (void)
 
        map_banks (&custom_bank, 0xC0, 0xE0 - 0xC0, 0);
        map_banks (&cia_bank, 0xA0, 32, 0);
-       if (!currprefs.cs_a1000ram)
-               /* D80000 - DDFFFF not mapped (A1000 = custom chips) */
+       if (!currprefs.cs_a1000ram && currprefs.cs_rtc != 3)
+               /* D80000 - DDFFFF not mapped (A1000 or A2000 = custom chips) */
                map_banks (&dummy_bank, 0xD8, 6, 0);
 
        /* map "nothing" to 0x200000 - 0x9FFFFF (0xBEFFFF if Gayle or Fat Gary) */
@@ -2566,7 +2569,9 @@ void memory_reset (void)
                if (currprefs.cs_ide < 0)
                        map_banks (&gayle_bank, 0xDD, 1, 0);
        }
-       if (currprefs.cs_rtc || currprefs.cs_cdtvram)
+       if (currprefs.cs_rtc == 3) // A2000 clock
+               map_banks (&clock_bank, 0xD8, 4, 0);
+       if (currprefs.cs_rtc == 1 || currprefs.cs_rtc == 2 || currprefs.cs_cdtvram)
                map_banks (&clock_bank, 0xDC, 1, 0);
        else if (currprefs.cs_ksmirror_a8 || currprefs.cs_ide > 0 || currprefs.cs_pcmcia)
                map_banks (&clock_bank, 0xDC, 1, 0); /* none clock */
@@ -2719,6 +2724,7 @@ void memory_init (void)
        a3000lmemory = a3000hmemory = 0;
        bogomemory = 0;
        cardmemory = 0;
+       allocated_custmem1 = allocated_custmem2 = 0;
        custmem1 = 0;
        custmem2 = 0;
 
index 85a2ef5034d9d879f3ece101cb122d6e37205291..aadbdc17566fd492065093dd3a47e5a8abaf0618 100644 (file)
@@ -22,6 +22,7 @@
 #include "custom.h"
 #include "newcpu.h"
 #include "cpummu.h"
+#include "cpummu030.h"
 #include "cpu_prefetch.h"
 #include "autoconf.h"
 #include "traps.h"
@@ -79,9 +80,9 @@ extern uae_u32 get_fpsr (void);
 #define MC68060_PCR   0x04300000
 #define MC68EC060_PCR 0x04310000
 
-static uae_u64 srp_030, crp_030;
-static uae_u32 tt0_030, tt1_030, tc_030;
-static uae_u16 mmusr_030;
+static uae_u64 fake_srp_030, fake_crp_030;
+static uae_u32 fake_tt0_030, fake_tt1_030, fake_tc_030;
+static uae_u16 fake_mmusr_030;
 
 static struct cache020 caches020[CACHELINES020];
 static struct cache030 icaches030[CACHELINES030];
@@ -175,6 +176,17 @@ uae_u32 (*x_get_byte)(uaecptr);
 void (*x_put_long)(uaecptr,uae_u32);
 void (*x_put_word)(uaecptr,uae_u32);
 void (*x_put_byte)(uaecptr,uae_u32);
+
+uae_u32 (*x_cp_next_iword)(void);
+uae_u32 (*x_cp_next_ilong)(void);
+uae_u32 (*x_cp_get_long)(uaecptr);
+uae_u32 (*x_cp_get_word)(uaecptr);
+uae_u32 (*x_cp_get_byte)(uaecptr);
+void (*x_cp_put_long)(uaecptr,uae_u32);
+void (*x_cp_put_word)(uaecptr,uae_u32);
+void (*x_cp_put_byte)(uaecptr,uae_u32);
+uae_u32 (REGPARAM3 *x_cp_get_disp_ea_020)(uae_u32 base, int idx) REGPARAM;
+
 void (*x_do_cycles)(unsigned long);
 void (*x_do_cycles_pre)(unsigned long);
 void (*x_do_cycles_post)(unsigned long, uae_u32);
@@ -672,19 +684,49 @@ static void do_cycles_ce_post (unsigned long cycles, uae_u32 v)
 static void set_x_funcs (void)
 {
        if (currprefs.mmu_model) {
-               x_prefetch = get_iword_mmu;
-               x_prefetch_long = get_ilong_mmu;
-               x_get_ilong = get_ilong_mmu;
-               x_get_iword = get_iword_mmu;
-               x_get_ibyte = get_ibyte_mmu;
-               x_next_iword = next_iword_mmu;
-               x_next_ilong = next_ilong_mmu;
-               x_put_long = put_long_mmu;
-               x_put_word = put_word_mmu;
-               x_put_byte = put_byte_mmu;
-               x_get_long = get_long_mmu;
-               x_get_word = get_word_mmu;
-               x_get_byte = get_byte_mmu;
+               if (currprefs.cpu_model == 68060) {
+                       x_prefetch = get_iword_mmu060;
+                       x_prefetch_long = get_ilong_mmu060;
+                       x_get_ilong = get_ilong_mmu060;
+                       x_get_iword = get_iword_mmu060;
+                       x_get_ibyte = get_ibyte_mmu060;
+                       x_next_iword = next_iword_mmu060;
+                       x_next_ilong = next_ilong_mmu060;
+                       x_put_long = put_long_mmu060;
+                       x_put_word = put_word_mmu060;
+                       x_put_byte = put_byte_mmu060;
+                       x_get_long = get_long_mmu060;
+                       x_get_word = get_word_mmu060;
+                       x_get_byte = get_byte_mmu060;
+               } else if (currprefs.cpu_model == 68040) {
+                       x_prefetch = get_iword_mmu040;
+                       x_prefetch_long = get_ilong_mmu040;
+                       x_get_ilong = get_ilong_mmu040;
+                       x_get_iword = get_iword_mmu040;
+                       x_get_ibyte = get_ibyte_mmu040;
+                       x_next_iword = next_iword_mmu040;
+                       x_next_ilong = next_ilong_mmu040;
+                       x_put_long = put_long_mmu040;
+                       x_put_word = put_word_mmu040;
+                       x_put_byte = put_byte_mmu040;
+                       x_get_long = get_long_mmu040;
+                       x_get_word = get_word_mmu040;
+                       x_get_byte = get_byte_mmu040;
+               } else {
+                       x_prefetch = get_iword_mmu030;
+                       x_prefetch_long = get_ilong_mmu030;
+                       x_get_ilong = get_ilong_mmu030;
+                       x_get_iword = get_iword_mmu030;
+                       x_get_ibyte = get_ibyte_mmu030;
+                       x_next_iword = next_iword_mmu030;
+                       x_next_ilong = next_ilong_mmu030;
+                       x_put_long = put_long_mmu030;
+                       x_put_word = put_word_mmu030;
+                       x_put_byte = put_byte_mmu030;
+                       x_get_long = get_long_mmu030;
+                       x_get_word = get_word_mmu030;
+                       x_get_byte = get_byte_mmu030;
+               }
                x_do_cycles = do_cycles;
                x_do_cycles_pre = do_cycles;
                x_do_cycles_post = do_cycles_post;
@@ -847,6 +889,28 @@ static void set_x_funcs (void)
                        x_do_cycles_post = cputracefunc2_x_do_cycles_post;
                }
        }
+
+       x_cp_put_long = x_put_long;
+       x_cp_put_word = x_put_word;
+       x_cp_put_byte = x_put_byte;
+       x_cp_get_long = x_get_long;
+       x_cp_get_word = x_get_word;
+       x_cp_get_byte = x_get_byte;
+       x_cp_next_iword = x_next_iword;
+       x_cp_next_ilong = x_next_ilong;
+       x_cp_get_disp_ea_020 = get_disp_ea_020;
+
+       if (currprefs.mmu_model == 68030) {
+               x_cp_put_long = put_long_mmu030_state;
+               x_cp_put_word = put_word_mmu030_state;
+               x_cp_put_byte = put_byte_mmu030_state;
+               x_cp_get_long = get_long_mmu030_state;
+               x_cp_get_word = get_word_mmu030_state;
+               x_cp_get_byte = get_byte_mmu030_state;
+               x_cp_next_iword = next_iword_mmu030_state;
+               x_cp_next_ilong = next_ilong_mmu030_state;
+               x_cp_get_disp_ea_020 = get_disp_ea_020_mmu030;
+       }
 }
 
 bool can_cpu_tracer (void)
@@ -981,7 +1045,7 @@ static void build_cpufunctbl (void)
                if (currprefs.cpu_cycle_exact)
                        tbl = op_smalltbl_22_ff;
                if (currprefs.mmu_model)
-                       tbl = op_smalltbl_31_ff;
+                       tbl = op_smalltbl_33_ff;
                break;
        case 68040:
                lvl = 4;
@@ -996,6 +1060,8 @@ static void build_cpufunctbl (void)
                tbl = op_smalltbl_2_ff;
                if (currprefs.cpu_cycle_exact)
                        tbl = op_smalltbl_24_ff;
+               if (currprefs.mmu_model)
+                       tbl = op_smalltbl_32_ff;
                break;
        case 68020:
                lvl = 2;
@@ -1099,11 +1165,6 @@ static void build_cpufunctbl (void)
        build_comp ();
 #endif
        set_cpu_caches ();
-       if (currprefs.mmu_model) {
-               mmu_reset ();
-               mmu_set_tc (regs.tcr);
-               mmu_set_super (regs.s != 0);
-       }
 }
 
 void fill_prefetch (void)
@@ -1301,14 +1362,14 @@ static long int m68kpc_offset;
 #define get_iword_1(o) get_word (regs.pc + (regs.pc_p - regs.pc_oldp) + (o))
 #define get_ilong_1(o) get_long (regs.pc + (regs.pc_p - regs.pc_oldp) + (o))
 
-static uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes size, TCHAR *buf, uae_u32 *eaddr, int safemode)
+static uaecptr ShowEA (void *f, uaecptr pc, uae_u16 opcode, int reg, amodes mode, wordsizes size, TCHAR *buf, uae_u32 *eaddr, int safemode)
 {
        uae_u16 dp;
        uae_s8 disp8;
        uae_s16 disp16;
        int r;
        uae_u32 dispreg;
-       uaecptr addr = 0;
+       uaecptr addr = pc;
        uae_s32 offset = 0;
        TCHAR buffer[80];
 
@@ -1334,7 +1395,7 @@ static uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes
        case Ad16:
                {
                        TCHAR offtxt[80];
-                       disp16 = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
+                       disp16 = get_word_debug (pc); pc += 2;
                        if (disp16 < 0)
                                _stprintf (offtxt, _T("-$%04x"), -disp16);
                        else
@@ -1344,7 +1405,7 @@ static uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes
                }
                break;
        case Ad8r:
-               dp = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
+               dp = get_word_debug (pc); pc += 2;
                disp8 = dp & 0xFF;
                r = (dp & 0x7000) >> 12;
                dispreg = dp & 0x8000 ? m68k_areg (regs, r) : m68k_dreg (regs, r);
@@ -1358,15 +1419,15 @@ static uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes
                        _stprintf (name, _T("A%d, "), reg);
                        if (dp & 0x80) { base = 0; name[0] = 0; }
                        if (dp & 0x40) dispreg = 0;
-                       if ((dp & 0x30) == 0x20) { disp = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; }
-                       if ((dp & 0x30) == 0x30) { disp = get_ilong_1 (m68kpc_offset); m68kpc_offset += 4; }
+                       if ((dp & 0x30) == 0x20) { disp = (uae_s32)(uae_s16)get_word_debug (pc); pc += 2; }
+                       if ((dp & 0x30) == 0x30) { disp = get_long_debug (pc); pc += 4; }
                        base += disp;
 
-                       if ((dp & 0x3) == 0x2) { outer = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; }
-                       if ((dp & 0x3) == 0x3) { outer = get_ilong_1 (m68kpc_offset); m68kpc_offset += 4; }
+                       if ((dp & 0x3) == 0x2) { outer = (uae_s32)(uae_s16)get_word_debug (pc); pc += 2; }
+                       if ((dp & 0x3) == 0x3) { outer = get_long_debug (pc); pc += 4; }
 
                        if (!(dp & 4)) base += dispreg;
-                       if ((dp & 3) && !safemode) base = get_long (base);
+                       if ((dp & 3) && !safemode) base = get_long_debug (base);
                        if (dp & 4) base += dispreg;
 
                        addr = base + outer;
@@ -1384,14 +1445,12 @@ static uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes
                }
                break;
        case PC16:
-               addr = m68k_getpc () + m68kpc_offset;
-               disp16 = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
+               disp16 = get_word_debug (pc); pc += 2;
                addr += (uae_s16)disp16;
                _stprintf (buffer, _T("(PC,$%04x) == $%08lx"), disp16 & 0xffff, (unsigned long)addr);
                break;
        case PC8r:
-               addr = m68k_getpc () + m68kpc_offset;
-               dp = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
+               dp = get_word_debug (pc); pc += 2;
                disp8 = dp & 0xFF;
                r = (dp & 0x7000) >> 12;
                dispreg = dp & 0x8000 ? m68k_areg (regs, r) : m68k_dreg (regs, r);
@@ -1405,15 +1464,15 @@ static uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes
                        _stprintf (name, _T("PC, "));
                        if (dp & 0x80) { base = 0; name[0] = 0; }
                        if (dp & 0x40) dispreg = 0;
-                       if ((dp & 0x30) == 0x20) { disp = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; }
-                       if ((dp & 0x30) == 0x30) { disp = get_ilong_1 (m68kpc_offset); m68kpc_offset += 4; }
+                       if ((dp & 0x30) == 0x20) { disp = (uae_s32)(uae_s16)get_word_debug (pc); pc += 2; }
+                       if ((dp & 0x30) == 0x30) { disp = get_long_debug (pc); pc += 4; }
                        base += disp;
 
-                       if ((dp & 0x3) == 0x2) { outer = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; }
-                       if ((dp & 0x3) == 0x3) { outer = get_ilong_1 (m68kpc_offset); m68kpc_offset += 4; }
+                       if ((dp & 0x3) == 0x2) { outer = (uae_s32)(uae_s16)get_word_debug (pc); pc += 2; }
+                       if ((dp & 0x3) == 0x3) { outer = get_long_debug (pc); pc += 4; }
 
                        if (!(dp & 4)) base += dispreg;
-                       if ((dp & 3) && !safemode) base = get_long (base);
+                       if ((dp & 3) && !safemode) base = get_long_debug (base);
                        if (dp & 4) base += dispreg;
 
                        addr = base + outer;
@@ -1430,52 +1489,56 @@ static uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes
                }
                break;
        case absw:
-               addr = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset);
+               addr = (uae_s32)(uae_s16)get_word_debug (pc);
                _stprintf (buffer, _T("$%08lx"), (unsigned long)addr);
-               m68kpc_offset += 2;
+               pc += 2;
                break;
        case absl:
-               addr = get_ilong_1 (m68kpc_offset);
+               addr = get_long_debug (pc);
                _stprintf (buffer, _T("$%08lx"), (unsigned long)addr);
-               m68kpc_offset += 4;
+               pc += 4;
                break;
        case imm:
                switch (size){
                case sz_byte:
-                       _stprintf (buffer, _T("#$%02x"), (unsigned int)(get_iword_1 (m68kpc_offset) & 0xff));
-                       m68kpc_offset += 2;
+                       _stprintf (buffer, _T("#$%02x"), (unsigned int)(get_word_debug (pc) & 0xff));
+                       pc += 2;
                        break;
                case sz_word:
-                       _stprintf (buffer, _T("#$%04x"), (unsigned int)(get_iword_1 (m68kpc_offset) & 0xffff));
-                       m68kpc_offset += 2;
+                       _stprintf (buffer, _T("#$%04x"), (unsigned int)(get_word_debug (pc) & 0xffff));
+                       pc += 2;
                        break;
                case sz_long:
-                       _stprintf (buffer, _T("#$%08lx"), (unsigned long)(get_ilong_1 (m68kpc_offset)));
-                       m68kpc_offset += 4;
+                       _stprintf (buffer, _T("#$%08lx"), (unsigned long)(get_long_debug (pc)));
+                       pc += 4;
                        break;
                default:
                        break;
                }
                break;
        case imm0:
-               offset = (uae_s32)(uae_s8)get_iword_1 (m68kpc_offset);
-               m68kpc_offset += 2;
+               offset = (uae_s32)(uae_s8)get_word_debug (pc);
                _stprintf (buffer, _T("#$%02x"), (unsigned int)(offset & 0xff));
+               addr = pc + 2 + offset;
+               pc += 2;
                break;
        case imm1:
-               offset = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset);
-               m68kpc_offset += 2;
+               offset = (uae_s32)(uae_s16)get_word_debug (pc);
                buffer[0] = 0;
                _stprintf (buffer, _T("#$%04x"), (unsigned int)(offset & 0xffff));
+               addr = pc + offset;
+               pc += 2;
                break;
        case imm2:
-               offset = (uae_s32)get_ilong_1 (m68kpc_offset);
-               m68kpc_offset += 4;
+               offset = (uae_s32)get_long_debug (pc);
                _stprintf (buffer, _T("#$%08lx"), (unsigned long)offset);
+               addr = pc + offset;
+               pc += 4;
                break;
        case immi:
                offset = (uae_s32)(uae_s8)(reg & 0xff);
                _stprintf (buffer, _T("#$%08lx"), (unsigned long)offset);
+               addr = pc + offset;
                break;
        default:
                break;
@@ -1486,7 +1549,7 @@ static uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes
                _tcscat (buf, buffer);
        if (eaddr)
                *eaddr = addr;
-       return offset;
+       return pc;
 }
 
 #if 0
@@ -1711,33 +1774,33 @@ uae_u32 REGPARAM2 x_get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset,
        mask = 0xffffffffu << (32 - width);
        switch ((offset + width + 7) >> 3) {
        case 1:
-               tmp = x_get_byte (src);
+               tmp = x_cp_get_byte (src);
                res = tmp << (24 + offset);
                bdata[0] = tmp & ~(mask >> (24 + offset));
                break;
        case 2:
-               tmp = x_get_word (src);
+               tmp = x_cp_get_word (src);
                res = tmp << (16 + offset);
                bdata[0] = tmp & ~(mask >> (16 + offset));
                break;
        case 3:
-               tmp = x_get_word (src);
+               tmp = x_cp_get_word (src);
                res = tmp << (16 + offset);
                bdata[0] = tmp & ~(mask >> (16 + offset));
-               tmp = x_get_byte (src + 2);
+               tmp = x_cp_get_byte (src + 2);
                res |= tmp << (8 + offset);
                bdata[1] = tmp & ~(mask >> (8 + offset));
                break;
        case 4:
-               tmp = x_get_long (src);
+               tmp = x_cp_get_long (src);
                res = tmp << offset;
                bdata[0] = tmp & ~(mask >> offset);
                break;
        case 5:
-               tmp = x_get_long (src);
+               tmp = x_cp_get_long (src);
                res = tmp << offset;
                bdata[0] = tmp & ~(mask >> offset);
-               tmp = x_get_byte (src + 4);
+               tmp = x_cp_get_byte (src + 4);
                res |= tmp >> (8 - offset);
                bdata[1] = tmp & ~(mask << (8 - offset));
                break;
@@ -1755,21 +1818,21 @@ void REGPARAM2 x_put_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s
        offset = (offset & 7) + width;
        switch ((offset + 7) >> 3) {
        case 1:
-               x_put_byte (dst, bdata[0] | (val << (8 - offset)));
+               x_cp_put_byte (dst, bdata[0] | (val << (8 - offset)));
                break;
        case 2:
-               x_put_word (dst, bdata[0] | (val << (16 - offset)));
+               x_cp_put_word (dst, bdata[0] | (val << (16 - offset)));
                break;
        case 3:
-               x_put_word (dst, bdata[0] | (val >> (offset - 16)));
-               x_put_byte (dst + 2, bdata[1] | (val << (24 - offset)));
+               x_cp_put_word (dst, bdata[0] | (val >> (offset - 16)));
+               x_cp_put_byte (dst + 2, bdata[1] | (val << (24 - offset)));
                break;
        case 4:
-               x_put_long (dst, bdata[0] | (val << (32 - offset)));
+               x_cp_put_long (dst, bdata[0] | (val << (32 - offset)));
                break;
        case 5:
-               x_put_long (dst, bdata[0] | (val >> (offset - 32)));
-               x_put_byte (dst + 4, bdata[1] | (val << (40 - offset)));
+               x_cp_put_long (dst, bdata[0] | (val >> (offset - 32)));
+               x_cp_put_byte (dst + 4, bdata[1] | (val << (40 - offset)));
                break;
        default:
                write_log (_T("x_put_bitfield() can't happen %d\n"), (offset + 7) >> 3);
@@ -1777,8 +1840,9 @@ void REGPARAM2 x_put_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s
        }
 }
 
-uae_u32 REGPARAM2 get_disp_ea_020 (uae_u32 base, uae_u32 dp)
+uae_u32 REGPARAM2 get_disp_ea_020 (uae_u32 base, int idx)
 {
+       uae_u16 dp = next_iword ();
        int reg = (dp >> 12) & 15;
        uae_s32 regd = regs.regs[reg];
        if ((dp & 0x800) == 0)
@@ -1812,8 +1876,9 @@ uae_u32 REGPARAM2 get_disp_ea_020 (uae_u32 base, uae_u32 dp)
        }
 }
 
-uae_u32 REGPARAM2 x_get_disp_ea_020 (uae_u32 base, uae_u32 dp)
+uae_u32 REGPARAM2 x_get_disp_ea_020 (uae_u32 base, int idx)
 {
+       uae_u16 dp = x_next_iword ();
        int reg = (dp >> 12) & 15;
        int cycles = 0;
        uae_u32 v;
@@ -1868,8 +1933,10 @@ uae_u32 REGPARAM2 x_get_disp_ea_020 (uae_u32 base, uae_u32 dp)
        return v;
 }
 
-uae_u32 REGPARAM2 x_get_disp_ea_ce020 (uae_u32 base, uae_u32 dp)
+
+uae_u32 REGPARAM2 x_get_disp_ea_ce020 (uae_u32 base, int idx)
 {
+       uae_u16 dp = next_iword_020ce ();
        int reg = (dp >> 12) & 15;
        int cycles = 0;
        uae_u32 v;
@@ -1890,7 +1957,7 @@ uae_u32 REGPARAM2 x_get_disp_ea_ce020 (uae_u32 base, uae_u32 dp)
                        cycles++;
                }
                if ((dp & 0x30) == 0x30) {
-                       base += x_next_ilong ();
+                       base += next_ilong_020ce ();
                        cycles++;
                }
 
@@ -2219,119 +2286,237 @@ static uae_u32 exception_pc (int nr)
        return regs.instruction_pc;
 }
 
-static void Exception_mmu (int nr)
+
+static void Exception_build_stack_frame (uae_u32 oldpc, uae_u32 currpc, uae_u32 ssw, int nr, int format)
+{
+    int i;
+   
+#if 0
+    if (nr < 24 || nr > 31) { // do not print debugging for interrupts
+        write_log(_T("Building exception stack frame (format %X)\n"), format);
+    }
+#endif
+
+    switch (format) {
+        case 0x0: // four word stack frame
+        case 0x1: // throwaway four word stack frame
+            break;
+        case 0x2: // six word stack frame
+            m68k_areg (regs, 7) -= 4;
+            x_put_long (m68k_areg (regs, 7), oldpc);
+            break;
+        case 0x7: // access error stack frame (68040)
+            for (i = 0 ; i < 7 ; i++) {
+                m68k_areg (regs, 7) -= 4;
+                x_put_long (m68k_areg (regs, 7), 0);
+            }
+            m68k_areg (regs, 7) -= 4;
+            x_put_long (m68k_areg (regs, 7), regs.wb3_data);
+            m68k_areg (regs, 7) -= 4;
+            x_put_long (m68k_areg (regs, 7), regs.mmu_fault_addr);
+            m68k_areg (regs, 7) -= 4;
+            x_put_long (m68k_areg (regs, 7), regs.mmu_fault_addr);
+            m68k_areg (regs, 7) -= 2;
+            x_put_word (m68k_areg (regs, 7), 0);
+            m68k_areg (regs, 7) -= 2;
+            x_put_word (m68k_areg (regs, 7), 0);
+            m68k_areg (regs, 7) -= 2;
+            x_put_word (m68k_areg (regs, 7), regs.wb3_status);
+            regs.wb3_status = 0;
+            m68k_areg (regs, 7) -= 2;
+                       x_put_word (m68k_areg (regs, 7), ssw);
+            m68k_areg (regs, 7) -= 4;
+            x_put_long (m68k_areg (regs, 7), regs.mmu_fault_addr);
+            break;
+        case 0x9: // coprocessor mid-instruction stack frame (68020, 68030)
+            m68k_areg (regs, 7) -= 4;
+            x_put_long (m68k_areg (regs, 7), 0);
+            m68k_areg (regs, 7) -= 4;
+            x_put_long (m68k_areg (regs, 7), 0);
+            m68k_areg (regs, 7) -= 4;
+            x_put_long (m68k_areg (regs, 7), oldpc);
+            break;
+        case 0x3: // floating point post-instruction stack frame (68040)
+        case 0x8: // bus and address error stack frame (68010)
+            write_log(_T("Exception stack frame format %X not implemented\n"), format);
+            return;
+        case 0x4: // floating point unimplemented stack frame (68LC040, 68EC040)
+                               // or 68060 bus access fault stack frame
+                       if (currprefs.cpu_model == 68040) {
+                               // this is actually created in fpp.c
+                               write_log(_T("Exception stack frame format %X not implemented\n"), format);
+                               return;
+                       }
+                       // 68060 bus fault
+                       m68k_areg (regs, 7) -= 4;
+                       x_put_long (m68k_areg (regs, 7), regs.mmu_fslw);
+                       m68k_areg (regs, 7) -= 4;
+                       x_put_long (m68k_areg (regs, 7), regs.mmu_fault_addr);
+                       break;
+               case 0xB: // long bus cycle fault stack frame (68020, 68030)
+                       // store state information to internal register space
+                       for (i = 0; i < mmu030_idx + 1; i++) {
+                               m68k_areg (regs, 7) -= 4;
+                               x_put_long (m68k_areg (regs, 7), mmu030_ad[i].val);
+                       }
+                       while (i < 9) {
+                               m68k_areg (regs, 7) -= 4;
+                               x_put_long (m68k_areg (regs, 7), 0);
+                               i++;
+                       }
+                        // version & internal information (We store index here)
+                       m68k_areg (regs, 7) -= 2;
+                       x_put_word (m68k_areg (regs, 7), mmu030_idx);
+                       // 3* internal registers
+                       m68k_areg (regs, 7) -= 2;
+                       x_put_word (m68k_areg (regs, 7), mmu030_state[2]);
+                       m68k_areg (regs, 7) -= 2;
+                       x_put_word (m68k_areg (regs, 7), mmu030_state[1]);
+                       m68k_areg (regs, 7) -= 2;
+                       x_put_word (m68k_areg (regs, 7), mmu030_state[0]);
+                       // data input buffer = fault address
+                       m68k_areg (regs, 7) -= 4;
+                       x_put_long (m68k_areg (regs, 7), regs.mmu_fault_addr);
+                       // 2xinternal
+                       m68k_areg (regs, 7) -= 2;
+                       x_put_word (m68k_areg (regs, 7), 0);
+                       m68k_areg (regs, 7) -= 2;
+                       x_put_word (m68k_areg (regs, 7), 0);
+                       // stage b address
+                       m68k_areg (regs, 7) -= 4;
+                       x_put_long (m68k_areg (regs, 7), mm030_stageb_address);
+                       // 2xinternal
+                       m68k_areg (regs, 7) -= 4;
+                       x_put_long (m68k_areg (regs, 7), mmu030_disp_store[1]);
+               /* fall through */
+               case 0xA: // short bus cycle fault stack frame (68020, 68030)
+                       m68k_areg (regs, 7) -= 4;
+                       x_put_long (m68k_areg (regs, 7), mmu030_disp_store[0]);
+                       m68k_areg (regs, 7) -= 4;
+                       x_put_long (m68k_areg (regs, 7), mmu030_ad[mmu030_idx].val);  // Data output buffer = value that was going to be written
+                       m68k_areg (regs, 7) -= 4;
+                       x_put_long (m68k_areg (regs, 7), mmu030_opcode);  // Internal register (opcode storage)
+                       m68k_areg (regs, 7) -= 4;
+                       x_put_long (m68k_areg (regs, 7), regs.mmu_fault_addr);
+                       m68k_areg (regs, 7) -= 2;
+                       x_put_word (m68k_areg (regs, 7), 0);  // Instr. pipe stage B
+                       m68k_areg (regs, 7) -= 2;
+                       x_put_word (m68k_areg (regs, 7), 0);  // Instr. pipe stage C
+                       m68k_areg (regs, 7) -= 2;
+                       x_put_word (m68k_areg (regs, 7), ssw);
+                       m68k_areg (regs, 7) -= 2;
+                       x_put_word (m68k_areg (regs, 7), 0);  // Internal register
+                       break;
+               default:
+            write_log(_T("Unknown exception stack frame format: %X\n"), format);
+            return;
+    }
+    m68k_areg (regs, 7) -= 2;
+    x_put_word (m68k_areg (regs, 7), (format<<12) | (nr * 4));
+    m68k_areg (regs, 7) -= 4;
+    x_put_long (m68k_areg (regs, 7), currpc);
+    m68k_areg (regs, 7) -= 2;
+    x_put_word (m68k_areg (regs, 7), regs.sr);
+}
+
+
+// 68030 MMU
+static void Exception_mmu030 (int nr, uaecptr oldpc)
+{
+    uae_u32 currpc = m68k_getpc(), newpc;
+    int sv = regs.s;
+    
+    exception_debug(nr);
+    MakeSR();
+    
+    if (!regs.s) {
+        regs.usp = m68k_areg(regs, 7);
+        m68k_areg(regs, 7) = regs.m ? regs.msp : regs.isp;
+        regs.s = 1;
+        mmu_set_super(1);
+    }
+#if 0
+    if (nr < 24 || nr > 31) { // do not print debugging for interrupts
+        write_log (_T("Exception_mmu030: Exception %i: %08x %08x %08x\n"),
+                   nr, currpc, oldpc, regs.mmu_fault_addr);
+    }
+#endif
+
+    if (regs.m && nr >= 24 && nr < 32) { /* M + Interrupt */
+        Exception_build_stack_frame(oldpc, currpc, regs.mmu_ssw, nr, 0x1);
+    } else if (nr ==5 || nr == 6 || nr == 7 || nr == 9 || nr == 56) {
+        Exception_build_stack_frame(oldpc, currpc, regs.mmu_ssw, nr, 0x2);
+    } else if (nr == 2 || nr == 3) {
+        Exception_build_stack_frame(oldpc, currpc, regs.mmu_ssw, nr,  0xB);
+    } else {
+        Exception_build_stack_frame(oldpc, currpc, regs.mmu_ssw, nr, 0x0);
+    }
+    
+    newpc = x_get_long (regs.vbr + 4 * nr);
+       if (newpc & 1) {
+               if (nr == 2 || nr == 3)
+                       uae_reset (1, 0);  /* there is nothing else we can do.. */
+               else
+                       exception3 (regs.ir, newpc);
+               return;
+       }
+       m68k_setpc (newpc);
+#ifdef JIT
+       set_special (SPCFLAG_END_COMPILE);
+#endif
+       fill_prefetch ();
+       exception_trace (nr);
+}
+
+// 68040/060 MMU
+static void Exception_mmu (int nr, uaecptr oldpc)
 {
-       uae_u32 newpc;
+       uae_u32 currpc = m68k_getpc (), newpc;
        int sv = regs.s;
-       int pc = exception_pc (nr);
-       int i;
 
        exception_debug (nr);
        MakeSR ();
 
        if (!regs.s) {
                regs.usp = m68k_areg (regs, 7);
-               if (currprefs.cpu_model >= 68020)
+               if (currprefs.cpu_model == 68060) {
+                       m68k_areg (regs, 7) = regs.isp;
+                       if (nr >= 24 && nr < 32)
+                               regs.m = 0;
+               } else if (currprefs.cpu_model >= 68020) {
                        m68k_areg (regs, 7) = regs.m ? regs.msp : regs.isp;
-               else
+               } else {
                        m68k_areg (regs, 7) = regs.isp;
+               }
                regs.s = 1;
                mmu_set_super (1);
        }
-       if (nr == 2) {
-//             write_log (_T("%08x %08x %08x\n"), currpc, oldpc, regs.mmu_fault_addr);
-//             if (currpc == 0x0013b5e2)
-//                     activate_debugger ();
-               // bus error
-               for (i = 0 ; i < 7 ; i++) {
-                       m68k_areg (regs, 7) -= 4;
-                       put_long_mmu (m68k_areg (regs, 7), 0);
-               }
-               m68k_areg (regs, 7) -= 4;
-               put_long_mmu (m68k_areg (regs, 7), regs.wb3_data);
-               m68k_areg (regs, 7) -= 4;
-               put_long_mmu (m68k_areg (regs, 7), regs.mmu_fault_addr);
-               m68k_areg (regs, 7) -= 4;
-               put_long_mmu (m68k_areg (regs, 7), regs.mmu_fault_addr);
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), 0);
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), 0);
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), regs.wb3_status);
-               regs.wb3_status = 0;
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), regs.mmu_ssw);
-               m68k_areg (regs, 7) -= 4;
-               put_long_mmu (m68k_areg (regs, 7), regs.mmu_fault_addr);
-
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), 0x7000 + nr * 4);
-               m68k_areg (regs, 7) -= 4;
-               put_long_mmu (m68k_areg (regs, 7), regs.instruction_pc);
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), regs.sr);
-               goto kludge_me_do;
-
-       } else if (nr == 3) {
-
-               // address error
+    
+    if (nr == 2) { // bus error
+        //write_log (_T("Exception_mmu %08x %08x %08x\n"), currpc, oldpc, regs.mmu_fault_addr);
+        if (currprefs.mmu_model == 68040)
+                       Exception_build_stack_frame(oldpc, currpc, regs.mmu_ssw, nr, 0x7);
+               else
+                       Exception_build_stack_frame(oldpc, currpc, regs.mmu_fslw, nr, 0x4);
+       } else if (nr == 3) { // address error
                uae_u16 ssw = (sv ? 4 : 0) | (last_instructionaccess_for_exception_3 ? 2 : 1);
                ssw |= last_writeaccess_for_exception_3 ? 0 : 0x40;
                ssw |= 0x20;
-               for (i = 0 ; i < 36; i++) {
-                       m68k_areg (regs, 7) -= 2;
-                       put_word_mmu (m68k_areg (regs, 7), 0);
-               }
-               m68k_areg (regs, 7) -= 4;
-               put_long_mmu (m68k_areg (regs, 7), last_fault_for_exception_3);
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), 0);
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), 0);
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), 0);
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), ssw);
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), 0xb000 + nr * 4);
-
+        Exception_build_stack_frame(oldpc, currpc, ssw, nr, 0xB);
+               write_log (_T("Exception %d (%x) at %x -> %x! %s at %d\n"), nr, oldpc, currpc, get_long (regs.vbr + 4*nr),__FILE__,__LINE__);
        } else if (nr ==5 || nr == 6 || nr == 7 || nr == 9) {
-
-               m68k_areg (regs, 7) -= 4;
-               put_long_mmu (m68k_areg (regs, 7), regs.instruction_pc);
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), 0x2000 + nr * 4);
-
+        Exception_build_stack_frame(oldpc, currpc, regs.mmu_ssw, nr, 0x2);
        } else if (regs.m && nr >= 24 && nr < 32) { /* M + Interrupt */
-
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), nr * 4);
-               m68k_areg (regs, 7) -= 4;
-               put_long_mmu (m68k_areg (regs, 7), regs.instruction_pc);
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), regs.sr);
-               regs.sr |= (1 << 13);
-               regs.msp = m68k_areg (regs, 7);
-               m68k_areg (regs, 7) = regs.isp;
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), 0x1000 + nr * 4);
-
+        Exception_build_stack_frame(oldpc, currpc, regs.mmu_ssw, nr, 0x1);
        } else {
-
-               m68k_areg (regs, 7) -= 2;
-               put_word_mmu (m68k_areg (regs, 7), nr * 4);
-
+        Exception_build_stack_frame(oldpc, currpc, regs.mmu_ssw, nr, 0x0);
        }
-       m68k_areg (regs, 7) -= 4;
-       put_long_mmu (m68k_areg (regs, 7), pc);
-       m68k_areg (regs, 7) -= 2;
-       put_word_mmu (m68k_areg (regs, 7), regs.sr);
-kludge_me_do:
-       newpc = get_long_mmu (regs.vbr + 4 * nr);
+    
+       newpc = x_get_long (regs.vbr + 4 * nr);
        if (newpc & 1) {
                if (nr == 2 || nr == 3)
-                       uae_reset (1, 0); /* there is nothing else we can do.. */
+                       uae_reset (1, 0);  /* there is nothing else we can do.. */
                else
                        exception3 (regs.ir, newpc);
                return;
@@ -2344,6 +2529,7 @@ kludge_me_do:
        exception_trace (nr);
 }
 
+
 static void Exception_normal (int nr)
 {
        uae_u32 currpc, newpc;
@@ -2357,10 +2543,15 @@ static void Exception_normal (int nr)
 
        if (!regs.s) {
                regs.usp = m68k_areg (regs, 7);
-               if (currprefs.cpu_model >= 68020)
+               if (currprefs.cpu_model == 68060) {
+                       m68k_areg (regs, 7) = regs.isp;
+                       if (nr >= 24 && nr < 32)
+                               regs.m = 0;
+               } else if (currprefs.cpu_model >= 68020) {
                        m68k_areg (regs, 7) = regs.m ? regs.msp : regs.isp;
-               else
+               } else {
                        m68k_areg (regs, 7) = regs.isp;
+               }
                regs.s = 1;
                if (currprefs.mmu_model)
                        mmu_set_super (regs.s != 0);
@@ -2547,10 +2738,14 @@ void REGPARAM2 Exception (int nr)
                Exception_ce000 (nr);
        else
 #endif
-               if (currprefs.mmu_model)
-                       Exception_mmu (nr);
-               else
+               if (currprefs.mmu_model) {
+                       if (currprefs.cpu_model == 68030)
+                               Exception_mmu030 (nr, m68k_getpc ());
+                       else
+                               Exception_mmu (nr, m68k_getpc ());
+               } else {
                        Exception_normal (nr);
+               }
 
        if (debug_illegal && !in_rom (M68K_GETPC)) {
                int v = nr;
@@ -3068,22 +3263,28 @@ void m68k_reset (int hardreset)
 
        mmufixup[0].reg = -1;
        mmufixup[1].reg = -1;
-       if (currprefs.mmu_model) {
+       if (currprefs.mmu_model >= 68040) {
                mmu_reset ();
                mmu_set_tc (regs.tcr);
                mmu_set_super (regs.s != 0);
+       } else if (currprefs.mmu_model == 68030) {
+               mmu030_reset (hardreset || regs.halted);
+       } else {
+               a3000_fakekick (0);
+               /* only (E)nable bit is zeroed when CPU is reset, A3000 SuperKickstart expects this */
+               fake_tc_030 &= ~0x80000000;
+               fake_tt0_030 &= ~0x80000000;
+               fake_tt1_030 &= ~0x80000000;
+               if (hardreset || regs.halted) {
+                       fake_srp_030 = fake_crp_030 = 0;
+                       fake_tt0_030 = fake_tt1_030 = fake_tc_030 = 0;
+               }
+               fake_mmusr_030 = 0;
        }
 
-       a3000_fakekick (0);
-       /* only (E)nable bit is zeroed when CPU is reset, A3000 SuperKickstart expects this */
-       tc_030 &= ~0x80000000;
-       tt0_030 &= ~0x80000000;
-       tt1_030 &= ~0x80000000;
-       if (hardreset) {
-               srp_030 = crp_030 = 0;
-               tt0_030 = tt1_030 = tc_030 = 0;
-       }
-       mmusr_030 = 0;
+       regs.halted = 0;
+       gui_data.cpu_halted = false;
+       gui_led (LED_CPU, 0);
 
        /* 68060 FPU is not compatible with 68040,
        * 68060 accelerators' boot ROM disables the FPU
@@ -3172,14 +3373,14 @@ uae_u32 REGPARAM2 op_illg (uae_u32 opcode)
 
 static TCHAR *mmu30regs[] = { _T("TCR"), _T(""), _T("SRP"), _T("CRP"), _T(""), _T(""), _T(""), _T("") };
 
-static void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
+static void mmu_op30fake_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
 {
        int mode = (opcode >> 3) & 7;
        int preg = (next >> 10) & 31;
        int rw = (next >> 9) & 1;
        int fd = (next >> 8) & 1;
        TCHAR *reg = NULL;
-       uae_u32 otc = tc_030;
+       uae_u32 otc = fake_tc_030;
        int siz;
 
        // Dn, An, (An)+, -(An), abs and indirect
@@ -3194,55 +3395,55 @@ static void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr ex
                reg = _T("TC");
                siz = 4;
                if (rw)
-                       x_put_long (extra, tc_030);
+                       x_put_long (extra, fake_tc_030);
                else
-                       tc_030 = x_get_long (extra);
+                       fake_tc_030 = x_get_long (extra);
                break;
        case 0x12: // SRP
                reg = _T("SRP");
                siz = 8;
                if (rw) {
-                       x_put_long (extra, srp_030 >> 32);
-                       x_put_long (extra + 4, srp_030);
+                       x_put_long (extra, fake_srp_030 >> 32);
+                       x_put_long (extra + 4, fake_srp_030);
                } else {
-                       srp_030 = (uae_u64)x_get_long (extra) << 32;
-                       srp_030 |= x_get_long (extra + 4);
+                       fake_srp_030 = (uae_u64)x_get_long (extra) << 32;
+                       fake_srp_030 |= x_get_long (extra + 4);
                }
                break;
        case 0x13: // CRP
                reg = _T("CRP");
                siz = 8;
                if (rw) {
-                       x_put_long (extra, crp_030 >> 32);
-                       x_put_long (extra + 4, crp_030);
+                       x_put_long (extra, fake_crp_030 >> 32);
+                       x_put_long (extra + 4, fake_crp_030);
                } else {
-                       crp_030 = (uae_u64)x_get_long (extra) << 32;
-                       crp_030 |= x_get_long (extra + 4);
+                       fake_crp_030 = (uae_u64)x_get_long (extra) << 32;
+                       fake_crp_030 |= x_get_long (extra + 4);
                }
                break;
        case 0x18: // MMUSR
                reg = _T("MMUSR");
                siz = 2;
                if (rw)
-                       x_put_word (extra, mmusr_030);
+                       x_put_word (extra, fake_mmusr_030);
                else
-                       mmusr_030 = x_get_word (extra);
+                       fake_mmusr_030 = x_get_word (extra);
                break;
        case 0x02: // TT0
                reg = _T("TT0");
                siz = 4;
                if (rw)
-                       x_put_long (extra, tt0_030);
+                       x_put_long (extra, fake_tt0_030);
                else
-                       tt0_030 = x_get_long (extra);
+                       fake_tt0_030 = x_get_long (extra);
                break;
        case 0x03: // TT1
                reg = _T("TT1");
                siz = 4;
                if (rw)
-                       x_put_long (extra, tt1_030);
+                       x_put_long (extra, fake_tt1_030);
                else
-                       tt1_030 = x_get_long (extra);
+                       fake_tt1_030 = x_get_long (extra);
                break;
        }
 
@@ -3274,13 +3475,13 @@ static void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr ex
        }
 #endif
        if (currprefs.cs_mbdmac == 1 && currprefs.mbresmem_low_size > 0) {
-               if (otc != tc_030) {
-                       a3000_fakekick (tc_030 & 0x80000000);
+               if (otc != fake_tc_030) {
+                       a3000_fakekick (fake_tc_030 & 0x80000000);
                }
        }
 }
 
-static void mmu_op30_ptest (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
+static void mmu_op30fake_ptest (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
 {
 #if MMUOP_DEBUG > 0
        TCHAR tmp[10];
@@ -3291,10 +3492,10 @@ static void mmu_op30_ptest (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr ex
        write_log (_T("PTEST%c %02X,%08X,#%X%s PC=%08X\n"),
                ((next >> 9) & 1) ? 'W' : 'R', (next & 15), extra, (next >> 10) & 7, tmp, pc);
 #endif
-       mmusr_030 = 0;
+       fake_mmusr_030 = 0;
 }
 
-static void mmu_op30_pflush (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
+static void mmu_op30fake_pflush (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
 {
        int mode = (opcode >> 3) & 7;
        int reg = opcode & 7;
@@ -3328,8 +3529,21 @@ static void mmu_op30_pflush (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr e
 #endif
 }
 
+// 68030 (68851) MMU instructions only
 void mmu_op30 (uaecptr pc, uae_u32 opcode, uae_u16 extra, uaecptr extraa)
 {
+       if (currprefs.mmu_model) {
+               if (extra & 0x8000)
+                       mmu_op30_ptest (pc, opcode, extra, extraa);
+               else if ((extra&0xE000)==0x2000 && (extra & 0x1C00))
+                       mmu_op30_pflush (pc, opcode, extra, extraa);
+           else if ((extra&0xE000)==0x2000 && !(extra & 0x1C00))
+               mmu_op30_pload (pc, opcode, extra, extraa);
+               else
+                       mmu_op30_pmove (pc, opcode, extra, extraa);
+               return;
+       }
+
        int type = extra >> 13;
 
        switch (type)
@@ -3337,13 +3551,13 @@ void mmu_op30 (uaecptr pc, uae_u32 opcode, uae_u16 extra, uaecptr extraa)
        case 0:
        case 2:
        case 3:
-               mmu_op30_pmove (pc, opcode, extra, extraa);
+               mmu_op30fake_pmove (pc, opcode, extra, extraa);
        break;
        case 1:
-               mmu_op30_pflush (pc, opcode, extra, extraa);
+               mmu_op30fake_pflush (pc, opcode, extra, extraa);
        break;
        case 4:
-               mmu_op30_ptest (pc, opcode, extra, extraa);
+               mmu_op30fake_ptest (pc, opcode, extra, extraa);
        break;
        default:
                op_illg (opcode);
@@ -3351,9 +3565,10 @@ void mmu_op30 (uaecptr pc, uae_u32 opcode, uae_u16 extra, uaecptr extraa)
        }
 }
 
+// 68040+ MMU instructions only
 void mmu_op (uae_u32 opcode, uae_u32 extra)
 {
-       if (currprefs.cpu_model) {
+       if (currprefs.mmu_model) {
                mmu_op_real (opcode, extra);
                return;
        }
@@ -4018,56 +4233,91 @@ static void opcodedebug (uae_u32 pc, uae_u16 opcode, bool full)
                m68k_disasm_2 (buf, sizeof buf / sizeof (TCHAR), addr, NULL, 1, NULL, NULL, 0);
                write_log (_T("%s\n"), buf);
                if (full)
-                       m68k_dumpstate (stdout, NULL);
+                       m68k_dumpstate (NULL);
        }
 }
 
-#ifdef CPUEMU_31
+void cpu_halt (int id)
+{
+       if (!regs.halted) {
+               write_log (_T("CPU halted: reason = %d\n"), id);
+               regs.halted = id;
+               gui_data.cpu_halted = true;
+               gui_led (LED_CPU, 0);
+       }
+       while (regs.halted) {
+               do_cycles (8 * CYCLE_UNIT);
+               cpu_cycles = adjust_cycles (cpu_cycles);
+               if (regs.spcflags) {
+                       if (do_specialties (cpu_cycles))
+                               return;
+               }
+       }
+}
 
-/* Aranym MMU 68040  */
-static void m68k_run_mmu040 (void)
+#ifdef CPUEMU_33
+
+/* MMU 68060  */
+static void m68k_run_mmu060 (void)
 {
        uae_u16 opcode;
        uaecptr pc;
 retry:
        TRY (prb) {
                for (;;) {
-                       pc = regs.instruction_pc = regs.instruction_pc = m68k_getpc ();
-#if 0
-                       if (regs.regs[8+1] == 0x5b) {
-                               static int cnt = 6;
-                               cnt--;
-                               if (cnt > 0)
-                                       activate_debugger();
-                       }
-#endif
-#if 0
-                       static int done;
-                       if (pc == 0x16AF94) {
-//                             write_log (_T("D0=%d A7=%08x\n"), regs.regs[0], regs.regs[15]);
-                               if (regs.regs[0] == 360) {
-                                       done = 1;
-                                       activate_debugger ();
-                               }
-                       }
-/*
-                       if (pc == 0x16B01A) {
-                               write_log (_T("-> ERR\n"));
-                       }
-                       if (pc == 0x16B018) {
-                               write_log (_T("->\n"));
-                       }
-*/
-                       if (pc == 0x17967C || pc == 0x13b5e2 - 4) {
-                               if (done) {
-                                       write_log (_T("*\n"));
-                                       mmu_dump_tables ();
-                                       activate_debugger ();
-                               }
+                       pc = regs.instruction_pc = m68k_getpc ();
+                       mmu060_state = 0;
+                       opcode = x_prefetch (0);
+                       mmu060_state = 1;
+                       count_instr (opcode);
+                       do_cycles (cpu_cycles);
+                       cpu_cycles = (*cpufunctbl[opcode])(opcode);
+                       cpu_cycles = adjust_cycles (cpu_cycles);
+                       if (regs.spcflags) {
+                               if (do_specialties (cpu_cycles))
+                                       return;
                        }
+               }
+       } CATCH (prb) {
+
+               m68k_setpc (regs.instruction_pc);
+
+               if (mmufixup[0].reg >= 0) {
+                       m68k_areg (regs, mmufixup[0].reg) = mmufixup[0].value;
+                       mmufixup[0].reg = -1;
+               }
+               if (mmufixup[1].reg >= 0) {
+                       m68k_areg (regs, mmufixup[1].reg) = mmufixup[1].value;
+                       mmufixup[1].reg = -1;
+               }
+
+               //activate_debugger ();
+               TRY (prb2) {
+                       Exception (prb);
+               } CATCH (prb2) {
+                       cpu_halt (1);
+                       return;
+               }
+               goto retry;
+       }
+
+}
+
 #endif
 
-                       opcode = get_iword_mmu (0);
+#ifdef CPUEMU_31
+
+/* Aranym MMU 68040  */
+static void m68k_run_mmu040 (void)
+{
+       uae_u16 opcode;
+       uaecptr pc;
+
+retry:
+       TRY (prb) {
+               for (;;) {
+                       pc = regs.instruction_pc = m68k_getpc ();
+                       opcode = x_prefetch (0);
                        count_instr (opcode);
                        do_cycles (cpu_cycles);
                        cpu_cycles = (*cpufunctbl[opcode])(opcode);
@@ -4079,23 +4329,14 @@ retry:
                }
        } CATCH (prb) {
 
-               if (currprefs.mmu_model == 68060) {
-                       regs.instruction_pc = pc;
-                       if (mmufixup[1].reg >= 0) {
-                               m68k_areg (regs, mmufixup[1].reg) = mmufixup[1].value;
-                               mmufixup[1].reg = -1;
-                       }
-               } else {
 #if 0
-                       if (regs.wb3_status & 0x80) {
-                               // movem to memory?
-                               if ((opcode & 0xff80) == 0x4880) {
-                                       regs.mmu_ssw |= MMU_SSW_CM;
-                                       //write_log (_T("MMU_SSW_CM\n"));
-                               }
+               if (regs.wb3_status & 0x80) {
+                       // movem to memory?
+                       if ((opcode & 0xff80) == 0x4880) {
+                               regs.mmu_ssw |= MMU_SSW_CM;
+                               //write_log (_T("MMU_SSW_CM\n"));
                        }
 #endif
-               }
 
                //opcodedebug (pc, opcode, false);
 
@@ -4107,12 +4348,7 @@ retry:
                TRY (prb2) {
                        Exception (prb);
                } CATCH (prb2) {
-                       write_log (_T("MMU: double bus error, rebooting..\n"));
-                       regs.tcr = 0;
-                       m68k_reset (0);
-                       m68k_setpc (0xf80002);
-                       mmu_reset ();
-                       uae_reset (1, 0);
+                       cpu_halt (1);
                        return;
                }
                goto retry;
@@ -4122,6 +4358,91 @@ retry:
 
 #endif
 
+#ifdef CPUEMU_32
+
+// Previous MMU 68030
+static void m68k_run_mmu030 (void)
+{
+       uae_u16 opcode;
+       uaecptr pc;
+
+       mmu030_opcode_stageb = -1;
+retry:
+       TRY (prb) {
+               for (;;) {
+                       int cnt;
+insretry:
+                       pc = regs.instruction_pc = m68k_getpc ();
+
+                       mmu030_state[0] = mmu030_state[1] = mmu030_state[2] = 0;
+#if 1
+                       if (pc == 0x1000) {
+                               write_log (_T("*"));
+                               //activate_debugger ();
+                       }
+#endif
+                       mmu030_opcode = -1;
+                       if (mmu030_opcode_stageb < 0) {
+                               opcode = get_iword_mmu030 (0);
+                       } else {
+                               opcode = mmu030_opcode_stageb;
+                               mmu030_opcode_stageb = -1;
+                       }
+
+                       mmu030_opcode = opcode;
+                       mmu030_ad[0].done = false;
+
+                       cnt = 50;
+                       for (;;) {
+                               opcode = mmu030_opcode;
+                               mmu030_idx = 0;
+                               count_instr (opcode);
+                               do_cycles (cpu_cycles);
+                               mmu030_retry = false;
+                               cpu_cycles = (*cpufunctbl[opcode])(opcode);
+                               cnt--; // so that we don't get in infinite loop if things go horribly wrong
+                               if (!mmu030_retry)
+                                       break;
+                               if (cnt < 0)
+                                       break;
+                               if (mmu030_retry && mmu030_opcode == -1)
+                                       goto insretry; // urgh
+                       }
+
+                       mmu030_opcode = -1;
+
+                       cpu_cycles = adjust_cycles (cpu_cycles);
+                       if (regs.spcflags) {
+                               if (do_specialties (cpu_cycles))
+                                       return;
+                       }
+               }
+       } CATCH (prb) {
+
+               m68k_setpc (regs.instruction_pc);
+               if (mmufixup[0].reg >= 0) {
+                       m68k_areg (regs, mmufixup[0].reg) = mmufixup[0].value;
+                       mmufixup[0].reg = -1;
+               }
+               if (mmufixup[1].reg >= 0) {
+                       m68k_areg (regs, mmufixup[1].reg) = mmufixup[1].value;
+                       mmufixup[1].reg = -1;
+               }
+
+               TRY (prb2) {
+                       Exception (prb);
+               } CATCH (prb2) {
+                       cpu_halt (1);
+                       return;
+               }
+               goto retry;
+       }
+
+}
+
+#endif
+
+
 /* "cycle exact" 68020/030  */
 
 STATIC_INLINE void docodece020 (uae_u32 opcode)
@@ -4451,6 +4772,11 @@ void m68k_go (int may_quit)
                                }
                                savestate_restore_finish ();
                                memory_map_dump ();
+                               if (currprefs.mmu_model == 68030) {
+                                       mmu030_decode_tc (tc_030);
+                               } else if (currprefs.mmu_model >= 68040) {
+                                       mmu_set_tc (regs.tcr);
+                               }
                                startup = 1;
                                restored = 1;
                        }
@@ -4488,14 +4814,14 @@ void m68k_go (int may_quit)
                        /* program jumped to non-existing memory and cpu was >= 68020 */
                        get_real_address (regs.isp); /* stack in no one's land? -> reboot */
                        if (regs.isp & 1)
-                               regs.panic = 1;
+                               regs.panic = 5;
                        if (!regs.panic)
                                exception2_handle (regs.panic_pc, regs.panic_addr);
                        if (regs.panic) {
+                               int id = regs.panic;
                                /* system is very badly confused */
-                               write_log (_T("double bus error or corrupted stack, forcing reboot..\n"));
                                regs.panic = 0;
-                               uae_reset (1, 0);
+                               cpu_halt (id);
                        }
                }
 
@@ -4513,6 +4839,10 @@ void m68k_go (int may_quit)
                        protect_roms (true);
                }
                startup = 0;
+               if (regs.halted) {
+                       cpu_halt (regs.halted);
+                       continue;
+               }
                if (mmu_enabled && !currprefs.cachesize) {
                        run_func = m68k_run_mmu;
                } else {
@@ -4521,7 +4851,9 @@ void m68k_go (int may_quit)
 #ifdef JIT
                                currprefs.cpu_model >= 68020 && currprefs.cachesize ? m68k_run_jit :
 #endif
-                               (currprefs.cpu_model == 68040 || currprefs.cpu_model == 68060) && currprefs.mmu_model ? m68k_run_mmu040 :
+                               currprefs.cpu_model == 68030 && currprefs.mmu_model ? m68k_run_mmu030 :
+                               currprefs.cpu_model == 68040 && currprefs.mmu_model ? m68k_run_mmu040 :
+                               currprefs.cpu_model == 68060 && currprefs.mmu_model ? m68k_run_mmu060 :
                                currprefs.cpu_model >= 68020 && currprefs.cpu_cycle_exact ? m68k_run_2ce :
                                currprefs.cpu_compatible ? (currprefs.cpu_model <= 68020 ? m68k_run_2p : m68k_run_2pf) : m68k_run_2;
                }
@@ -4647,10 +4979,10 @@ static void disasm_size (TCHAR *instrname, struct instr *dp)
        }
 }
 
-void m68k_disasm_2 (TCHAR *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr, int safemode)
+void m68k_disasm_2 (TCHAR *buf, int bufsize, uaecptr pc, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr, int safemode)
 {
-       uaecptr newpc = 0;
-       m68kpc_offset = addr - m68k_getpc ();
+       uae_u32 seaddr2 = 0;
+       uae_u32 deaddr2 = 0;
 
        if (buf)
                memset (buf, 0, bufsize * sizeof (TCHAR));
@@ -4663,13 +4995,13 @@ void m68k_disasm_2 (TCHAR *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int
                struct mnemolookup *lookup;
                struct instr *dp;
                int oldpc;
-               int m68kpc_illg = 0;
+               uaecptr m68kpc_illg = 0;
                bool illegal = false;
 
-               oldpc = m68kpc_offset;
-               opcode = get_iword_1 (m68kpc_offset);
+               oldpc = pc;
+               opcode = get_word_debug (pc);
                if (cpufunctbl[opcode] == op_illg_1 || cpufunctbl[opcode] == op_unimpl_1) {
-                       m68kpc_illg = m68kpc_offset + 2;
+                       m68kpc_illg = pc + 2;
                        illegal = TRUE;
                }
 
@@ -4682,9 +5014,9 @@ void m68k_disasm_2 (TCHAR *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int
                for (lookup = lookuptab;lookup->mnemo != dp->mnemo; lookup++)
                        ;
 
-               buf = buf_out (buf, &bufsize, _T("%08lX "), m68k_getpc () + m68kpc_offset);
+               buf = buf_out (buf, &bufsize, _T("%08lX "), pc);
 
-               m68kpc_offset += 2;
+               pc += 2;
                
                if (lookup->friendlyname)
                        _tcscpy (instrname, lookup->friendlyname);
@@ -4697,7 +5029,7 @@ void m68k_disasm_2 (TCHAR *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int
                disasm_size (instrname, dp);
 
                if (lookup->mnemo == i_MOVEC2 || lookup->mnemo == i_MOVE2C) {
-                       uae_u16 imm = get_iword_1 (m68kpc_offset);
+                       uae_u16 imm = get_word_debug (pc);
                        uae_u16 creg = imm & 0x0fff;
                        uae_u16 r = imm >> 12;
                        TCHAR regs[16], *cname = _T("?");
@@ -4718,34 +5050,30 @@ void m68k_disasm_2 (TCHAR *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int
                                _tcscat (instrname, _T(","));
                                _tcscat (instrname, regs);
                        }
-                       m68kpc_offset += 2;
+                       pc += 2;
                } else if (lookup->mnemo == i_MVMEL) {
-                       newpc = m68k_getpc () + m68kpc_offset;
-                       m68kpc_offset += 2;
-                       newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname, deaddr, safemode);
+                       pc = ShowEA (0, pc, opcode, dp->dreg, dp->dmode, dp->size, instrname, deaddr, safemode);
                        _tcscat (instrname, _T(","));
-                       movemout (instrname, get_iword_1 (oldpc + 2), dp->dmode);
+                       movemout (instrname, get_word_debug (pc), dp->dmode);
+                       pc += 2;
                } else if (lookup->mnemo == i_MVMLE) {
-                       m68kpc_offset += 2;
-                       movemout (instrname, get_iword_1 (oldpc + 2), dp->dmode);
+                       movemout (instrname, get_word_debug (pc), dp->dmode);
+                       pc += 2;
                        _tcscat (instrname, _T(","));
-                       newpc = m68k_getpc () + m68kpc_offset;
-                       newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname, deaddr, safemode);
+                       pc = ShowEA (0, pc, opcode, dp->dreg, dp->dmode, dp->size, instrname, deaddr, safemode);
                } else {
                        if (dp->suse) {
-                               newpc = m68k_getpc () + m68kpc_offset;
-                               newpc += ShowEA (0, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr, safemode);
+                               pc = ShowEA (0, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, &seaddr2, safemode);
                        }
                        if (dp->suse && dp->duse)
                                _tcscat (instrname, _T(","));
                        if (dp->duse) {
-                               newpc = m68k_getpc () + m68kpc_offset;
-                               newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname, deaddr, safemode);
+                               pc = ShowEA (0, pc, opcode, dp->dreg, dp->dmode, dp->size, instrname, &deaddr2, safemode);
                        }
                }
 
-               for (i = 0; i < (m68kpc_offset - oldpc) / 2; i++) {
-                       buf = buf_out (buf, &bufsize, _T("%04x "), get_iword_1 (oldpc + i * 2));
+               for (i = 0; i < (pc - oldpc) / 2; i++) {
+                       buf = buf_out (buf, &bufsize, _T("%04x "), get_word_debug (oldpc + i * 2));
                }
                while (i++ < 5)
                        buf = buf_out (buf, &bufsize, _T("     "));
@@ -4758,26 +5086,30 @@ void m68k_disasm_2 (TCHAR *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int
 
                if (ccpt != 0) {
                        if (deaddr)
-                               *deaddr = newpc;
+                               *deaddr = pc;
                        if (cctrue (dp->cc))
-                               buf = buf_out (buf, &bufsize, _T(" == $%08lX (T)"), newpc);
+                               buf = buf_out (buf, &bufsize, _T(" == $%08x (T)"), seaddr2);
                        else
-                               buf = buf_out (buf, &bufsize, _T(" == $%08lX (F)"), newpc);
+                               buf = buf_out (buf, &bufsize, _T(" == $%08x (F)"), seaddr2);
                } else if ((opcode & 0xff00) == 0x6100) { /* BSR */
                        if (deaddr)
-                               *deaddr = newpc;
-                       buf = buf_out (buf, &bufsize, _T(" == $%08lX"), newpc);
+                               *deaddr = pc;
+                       buf = buf_out (buf, &bufsize, _T(" == $%08x"), seaddr2);
                }
                buf = buf_out (buf, &bufsize, _T("\n"));
 
                if (illegal)
-                       m68kpc_offset =  m68kpc_illg;
+                       pc =  m68kpc_illg;
        }
        if (nextpc)
-               *nextpc = m68k_getpc () + m68kpc_offset;
+               *nextpc = pc;
+       if (seaddr)
+               *seaddr = seaddr2;
+       if (deaddr)
+               *deaddr = deaddr2;
 }
 
-void m68k_disasm_ea (void *f, uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr)
+void m68k_disasm_ea (uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr)
 {
        TCHAR *buf;
 
@@ -4785,10 +5117,10 @@ void m68k_disasm_ea (void *f, uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *s
        if (!buf)
                return;
        m68k_disasm_2 (buf, (MAX_LINEWIDTH + 1) * cnt, addr, nextpc, cnt, seaddr, deaddr, 1);
-       f_out (f, _T("%s"), buf);
+       console_out_f (_T("%s"), buf);
        xfree (buf);
 }
-void m68k_disasm (void *f, uaecptr addr, uaecptr *nextpc, int cnt)
+void m68k_disasm (uaecptr addr, uaecptr *nextpc, int cnt)
 {
        TCHAR *buf;
 
@@ -4796,7 +5128,7 @@ void m68k_disasm (void *f, uaecptr addr, uaecptr *nextpc, int cnt)
        if (!buf)
                return;
        m68k_disasm_2 (buf, (MAX_LINEWIDTH + 1) * cnt, addr, nextpc, cnt, NULL, NULL, 0);
-       f_out (f, _T("%s"), buf);
+       console_out_f (_T("%s"), buf);
        xfree (buf);
 }
 
@@ -4810,21 +5142,17 @@ void sm68k_disasm (TCHAR *instrname, TCHAR *instrcode, uaecptr addr, uaecptr *ne
        uae_u32 opcode;
        struct mnemolookup *lookup;
        struct instr *dp;
-       int oldpc;
+       uaecptr pc, oldpc;
 
-       uaecptr newpc = 0;
-
-       m68kpc_offset = addr - m68k_getpc ();
-
-       oldpc = m68kpc_offset;
-       opcode = get_iword_1 (m68kpc_offset);
+       oldpc = pc = m68k_getpc ();
+       opcode = get_word_debug (pc);
        if (cpufunctbl[opcode] == op_illg_1) {
                opcode = 0x4AFC;
        }
        dp = table68k + opcode;
        for (lookup = lookuptab;lookup->mnemo != dp->mnemo; lookup++);
 
-       m68kpc_offset += 2;
+       pc += 2;
 
        _tcscpy (instrname, lookup->name);
        ccpt = _tcsstr (instrname, _T("cc"));
@@ -4839,20 +5167,18 @@ void sm68k_disasm (TCHAR *instrname, TCHAR *instrcode, uaecptr addr, uaecptr *ne
        }
 
        if (dp->suse) {
-               newpc = m68k_getpc () + m68kpc_offset;
-               newpc += ShowEA (0, opcode, dp->sreg, dp->smode, dp->size, instrname, NULL, 0);
+               pc += ShowEA (0, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, NULL, 0);
        }
        if (dp->suse && dp->duse)
                _tcscat (instrname, _T(","));
        if (dp->duse) {
-               newpc = m68k_getpc () + m68kpc_offset;
-               newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname, NULL, 0);
+               pc += ShowEA (0, pc, opcode, dp->dreg, dp->dmode, dp->size, instrname, NULL, 0);
        }
 
        if (instrcode)
        {
                int i;
-               for (i = 0; i < (m68kpc_offset - oldpc) / 2; i++)
+               for (i = 0; i < (pc - oldpc) / 2; i++)
                {
                        _stprintf (instrcode, _T("%04x "), get_iword_1 (oldpc + i * 2));
                        instrcode += _tcslen (instrcode);
@@ -4860,7 +5186,7 @@ void sm68k_disasm (TCHAR *instrname, TCHAR *instrcode, uaecptr addr, uaecptr *ne
        }
 
        if (nextpc)
-               *nextpc = m68k_getpc () + m68kpc_offset;
+               *nextpc = pc;
 }
 
 struct cpum2c m2cregs[] = {
@@ -4934,17 +5260,17 @@ uae_u32 val_move2c (int regno)
        }
 }
 
-void m68k_dumpstate (void *f, uaecptr *nextpc)
+void m68k_dumpstate (uaecptr *nextpc)
 {
        int i, j;
 
        for (i = 0; i < 8; i++){
-               f_out (f, _T("  D%d %08lX "), i, m68k_dreg (regs, i));
-               if ((i & 3) == 3) f_out (f, _T("\n"));
+               console_out_f (_T("  D%d %08lX "), i, m68k_dreg (regs, i));
+               if ((i & 3) == 3) console_out_f (_T("\n"));
        }
        for (i = 0; i < 8; i++){
-               f_out (f, _T("  A%d %08lX "), i, m68k_areg (regs, i));
-               if ((i & 3) == 3) f_out (f, _T("\n"));
+               console_out_f (_T("  A%d %08lX "), i, m68k_areg (regs, i));
+               if ((i & 3) == 3) console_out_f (_T("\n"));
        }
        if (regs.s == 0)
                regs.usp = m68k_areg (regs, 7);
@@ -4953,20 +5279,20 @@ void m68k_dumpstate (void *f, uaecptr *nextpc)
        if (regs.s && regs.m == 0)
                regs.isp = m68k_areg (regs, 7);
        j = 2;
-       f_out (f, _T("USP  %08X ISP  %08X "), regs.usp, regs.isp);
+       console_out_f (_T("USP  %08X ISP  %08X "), regs.usp, regs.isp);
        for (i = 0; m2cregs[i].regno>= 0; i++) {
                if (!movec_illg (m2cregs[i].regno)) {
                        if (!_tcscmp (m2cregs[i].regname, _T("USP")) || !_tcscmp (m2cregs[i].regname, _T("ISP")))
                                continue;
                        if (j > 0 && (j % 4) == 0)
-                               f_out (f, _T("\n"));
-                       f_out (f, _T("%-4s %08X "), m2cregs[i].regname, val_move2c (m2cregs[i].regno));
+                               console_out_f (_T("\n"));
+                       console_out_f (_T("%-4s %08X "), m2cregs[i].regname, val_move2c (m2cregs[i].regno));
                        j++;
                }
        }
        if (j > 0)
-               f_out (f, _T("\n"));
-       f_out (f, _T("T=%d%d S=%d M=%d X=%d N=%d Z=%d V=%d C=%d IMASK=%d STP=%d\n"),
+               console_out_f (_T("\n"));
+               console_out_f (_T("T=%d%d S=%d M=%d X=%d N=%d Z=%d V=%d C=%d IMASK=%d STP=%d\n"),
                regs.t1, regs.t0, regs.s, regs.m,
                GET_XFLG (), GET_NFLG (), GET_ZFLG (),
                GET_VFLG (), GET_CFLG (),
@@ -4975,12 +5301,12 @@ void m68k_dumpstate (void *f, uaecptr *nextpc)
        if (currprefs.fpu_model) {
                uae_u32 fpsr;
                for (i = 0; i < 8; i++){
-                       f_out (f, _T("FP%d: %g "), i, regs.fp[i]);
+                       console_out_f (_T("FP%d: %g "), i, regs.fp[i]);
                        if ((i & 3) == 3)
-                               f_out (f, _T("\n"));
+                               console_out_f (_T("\n"));
                }
                fpsr = get_fpsr ();
-               f_out (f, _T("FPSR: %04X FPCR: %08x FPIAR: %08x N=%d Z=%d I=%d NAN=%d\n"),
+               console_out_f (_T("FPSR: %04X FPCR: %08x FPIAR: %08x N=%d Z=%d I=%d NAN=%d\n"),
                        fpsr, regs.fpcr, regs.fpiar,
                        (fpsr & 0x8000000) != 0,
                        (fpsr & 0x4000000) != 0,
@@ -4995,12 +5321,12 @@ void m68k_dumpstate (void *f, uaecptr *nextpc)
                for (lookup1 = lookuptab; lookup1->mnemo != dp->mnemo; lookup1++);
                dp = table68k + regs.ir;
                for (lookup2 = lookuptab; lookup2->mnemo != dp->mnemo; lookup2++);
-               f_out (f, _T("Prefetch %04x (%s) %04x (%s)\n"), regs.irc, lookup1->name, regs.ir, lookup2->name);
+               console_out_f (_T("Prefetch %04x (%s) %04x (%s)\n"), regs.irc, lookup1->name, regs.ir, lookup2->name);
        }
 
-       m68k_disasm (f, m68k_getpc (), nextpc, 1);
+       m68k_disasm (m68k_getpc (), nextpc, 1);
        if (nextpc)
-               f_out (f, _T("Next PC: %08lx\n"), *nextpc);
+               console_out_f (_T("Next PC: %08lx\n"), *nextpc);
 }
 
 #ifdef SAVESTATE
@@ -5053,12 +5379,12 @@ uae_u8 *restore_cpu (uae_u8 *src)
                regs.msp = restore_u32 ();
        }
        if (model >= 68030) {
-               crp_030 = restore_u64 ();
-               srp_030 = restore_u64 ();
-               tt0_030 =restore_u32 ();
-               tt1_030 = restore_u32 ();
-               tc_030 = restore_u32 ();
-               mmusr_030 = restore_u16 ();
+               crp_030 = fake_crp_030 = restore_u64 ();
+               srp_030 = fake_srp_030 = restore_u64 ();
+               tt0_030 = fake_tt0_030 = restore_u32 ();
+               tt1_030 = fake_tt1_030 = restore_u32 ();
+               tc_030 = fake_tc_030 = restore_u32 ();
+               mmusr_030 = fake_mmusr_030 = restore_u16 ();
        }
        if (model >= 68040) {
                regs.itt0 = restore_u32 ();
@@ -5338,12 +5664,21 @@ uae_u8 *save_cpu (int *len, uae_u8 *dstptr)
                save_u32 (regs.msp);                    /* MSP */
        }
        if (model >= 68030) {
-               save_u64 (crp_030);                             /* CRP */
-               save_u64 (srp_030);                             /* SRP */
-               save_u32 (tt0_030);                             /* TT0/AC0 */
-               save_u32 (tt1_030);                             /* TT1/AC1 */
-               save_u32 (tc_030);                              /* TCR */
-               save_u16 (mmusr_030);                   /* MMUSR/ACUSR */
+               if (currprefs.mmu_model) {
+                       save_u64 (crp_030);                             /* CRP */
+                       save_u64 (srp_030);                             /* SRP */
+                       save_u32 (tt0_030);                             /* TT0/AC0 */
+                       save_u32 (tt1_030);                             /* TT1/AC1 */
+                       save_u32 (tc_030);                              /* TCR */
+                       save_u16 (mmusr_030);                   /* MMUSR/ACUSR */
+               } else {
+                       save_u64 (fake_crp_030);                /* CRP */
+                       save_u64 (fake_srp_030);                /* SRP */
+                       save_u32 (fake_tt0_030);                /* TT0/AC0 */
+                       save_u32 (fake_tt1_030);                /* TT1/AC1 */
+                       save_u32 (fake_tc_030);                 /* TCR */
+                       save_u16 (fake_mmusr_030);              /* MMUSR/ACUSR */
+               }
        }
        if (model >= 68040) {
                save_u32 (regs.itt0);                   /* ITT0 */
@@ -5407,7 +5742,7 @@ uae_u8 *save_mmu (int *len, uae_u8 *dstptr)
        int model;
 
        model = currprefs.mmu_model;
-       if (model != 68040 && model != 68060)
+       if (model != 68030 && model != 68040 && model != 68060)
                return NULL;
        if (dstptr)
                dstbak = dst = dstptr;
@@ -5470,7 +5805,7 @@ void exception2 (uaecptr addr)
        write_log (_T("delayed exception2!\n"));
        regs.panic_pc = m68k_getpc ();
        regs.panic_addr = addr;
-       regs.panic = 2;
+       regs.panic = 6;
        set_special (SPCFLAG_BRK);
        m68k_setpc (0xf80000);
 #ifdef JIT
@@ -6021,32 +6356,3 @@ void flush_dcache (uaecptr addr, int size)
        }
 }
 
-void m68k_do_rte_mmu (uaecptr a7)
-{
-       uae_u16 ssr = get_word_mmu (a7 + 8 + 4);
-       if (ssr & MMU_SSW_CT) {
-               uaecptr src_a7 = a7 + 8 - 8;
-               uaecptr dst_a7 = a7 + 8 + 52;
-               put_word_mmu (dst_a7 + 0, get_word_mmu (src_a7 + 0));
-               put_long_mmu (dst_a7 + 2, get_long_mmu (src_a7 + 2));
-               // skip this word
-               put_long_mmu (dst_a7 + 8, get_long_mmu (src_a7 + 8));
-       }
-}
-
-void flush_mmu (uaecptr addr, int n)
-{
-}
-
-void m68k_do_rts_mmu (void)
-{
-       m68k_setpc (get_long_mmu (m68k_areg (regs, 7)));
-       m68k_areg (regs, 7) += 4;
-}
-
-void m68k_do_bsr_mmu (uaecptr oldpc, uae_s32 offset)
-{
-       put_long_mmu (m68k_areg (regs, 7) - 4, oldpc);
-       m68k_areg (regs, 7) -= 4;
-       m68k_incpci (offset);
-}
index 39ebb8a452439e9a0fc788cdaef1b4ea18d58465..88cca15412cd05b777ae8d6b3085f2a89cc2ea77 100644 (file)
@@ -3728,7 +3728,7 @@ static void setid (struct uae_input_device *uid, int i, int slot, int sub, int p
                uid[i].flags[slot][sub] |= ID_FLAG_INVERTTOGGLE;
 }
 
-int input_get_default_mouse (struct uae_input_device *uid, int i, int port, int af, bool gp)
+int input_get_default_mouse (struct uae_input_device *uid, int i, int port, int af, bool gp, bool wheel)
 {
        struct didata *did;
 
@@ -3737,11 +3737,12 @@ int input_get_default_mouse (struct uae_input_device *uid, int i, int port, int
        did = &di_mouse[i];
        setid (uid, i, ID_AXIS_OFFSET + 0, 0, port, port ? INPUTEVENT_MOUSE2_HORIZ : INPUTEVENT_MOUSE1_HORIZ, gp);
        setid (uid, i, ID_AXIS_OFFSET + 1, 0, port, port ? INPUTEVENT_MOUSE2_VERT : INPUTEVENT_MOUSE1_VERT, gp);
-       setid (uid, i, ID_AXIS_OFFSET + 2, 0, port, port ? 0 : INPUTEVENT_MOUSE1_WHEEL, gp);
+       if (wheel)
+               setid (uid, i, ID_AXIS_OFFSET + 2, 0, port, port ? 0 : INPUTEVENT_MOUSE1_WHEEL, gp);
        setid (uid, i, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON, af, gp);
        setid (uid, i, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON, gp);
        setid (uid, i, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON, gp);
-       if (port == 0) { /* map back and forward to ALT+LCUR and ALT+RCUR */
+       if (wheel && port == 0) { /* map back and forward to ALT+LCUR and ALT+RCUR */
                if (isrealbutton (did, 3)) {
                        setid (uid, i, ID_BUTTON_OFFSET + 3, 0, port, INPUTEVENT_KEY_ALT_LEFT, gp);
                        setid (uid, i, ID_BUTTON_OFFSET + 3, 1, port, INPUTEVENT_KEY_CURSOR_LEFT, gp);
index e74b4c31b50be4f5bd174c9266062ba818478665..d3d2480bd7d22ae7c40776801d8eecb6857a00a2 100644 (file)
@@ -100,7 +100,7 @@ static int required_sl_texture_w, required_sl_texture_h;
 static int vsync2, guimode, maxscanline;
 static int resetcount;
 static double cursor_x, cursor_y;
-static bool cursor_v;
+static bool cursor_v, cursor_scale;
 
 #define NUMVERTICES 8
 #define D3DFVF_TLVERTEX D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1
@@ -1963,6 +1963,7 @@ static int restoredeviceobjects (void)
        int curw = CURSORMAXWIDTH, curh = CURSORMAXHEIGHT;
        cursorsurfaced3d = createtext (curw, curh, D3DFMT_A8R8G8B8);
        cursor_v = false;
+       cursor_scale = false;
 
        vbsize = sizeof (struct TLVERTEX) * NUMVERTICES;
        if (FAILED (hr = d3ddev->CreateVertexBuffer (vbsize, D3DUSAGE_WRITEONLY,
@@ -2716,7 +2717,10 @@ static void D3D_render2 (void)
                if (cursorsurfaced3d && cursor_v) {
                        D3DXMATRIXA16 t;
 
-                       MatrixScaling (&t, ((float)(window_w) / (tout_w + 2 * cursor_offset2_x)), ((float)(window_h) / (tout_h + 2 * cursor_offset2_y)), 0);
+                       if (cursor_scale)
+                               MatrixScaling (&t, ((float)(window_w) / (tout_w + 2 * cursor_offset2_x)), ((float)(window_h) / (tout_h + 2 * cursor_offset2_y)), 0);
+                       else
+                               MatrixScaling (&t, 1.0f, 1.0f, 0);
                        v.x = cursor_x + cursor_offset2_x;
                        v.y = cursor_y + cursor_offset2_y;
                        v.z = 0;
@@ -2825,7 +2829,7 @@ static void D3D_render2 (void)
                write_log (_T("%s: EndScene() %s\n"), D3DHEAD, D3D_ErrorString (hr));
 }
 
-void D3D_setcursor (int x, int y, int width, int height, bool visible)
+void D3D_setcursor (int x, int y, int width, int height, bool visible, bool noscale)
 {
        if (width && height) {
                cursor_offset2_x = cursor_offset_x * window_w / width;
@@ -2836,6 +2840,7 @@ void D3D_setcursor (int x, int y, int width, int height, bool visible)
                cursor_x = cursor_y = 0;
                cursor_offset2_x = cursor_offset2_y = 0;
        }
+       cursor_scale = !noscale;
        cursor_v = visible;
 }
 
index 6b0bf0409f95907a9685f399f96ad93d4b2f5036..1f48086310d0c82448e67f947a8f80471517852a 100644 (file)
@@ -15,7 +15,7 @@ extern int D3D_isenabled (void);
 extern void D3D_clear (void);
 extern int D3D_canshaders (void);
 extern int D3D_goodenough (void);
-extern void D3D_setcursor (int x, int y, int width, int height, bool visible);
+extern void D3D_setcursor (int x, int y, int width, int height, bool visible, bool noscale);
 extern bool D3D_getvblankpos (int *vpos);
 extern double D3D_getrefreshrate (void);
 extern void D3D_vblank_reset (double freq);
index 3aa9edbeb247b35fadb2af5b889fe3f3ef40603e..834d94e048495e33381daf880774e1f1b93c1fea 100644 (file)
@@ -61,6 +61,7 @@ struct uae_driveinfo {
 
 #define HDF_HANDLE_WIN32 1
 #define HDF_HANDLE_ZFILE 2
+#define HDF_HANDLE_UNKNOWN 3
 
 #define CACHE_SIZE 16384
 #define CACHE_FLUSH_TIME 5
@@ -438,11 +439,11 @@ int hdf_open_target (struct hardfiledata *hfd, const TCHAR *pname)
                        if (udi->nomedia)
                                hfd->drive_empty = -1;
                        if (udi->readonly)
-                               hfd->readonly = 1;
+                               hfd->ci.readonly = 1;
                        flags = FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS;
                        h = CreateFile (udi->device_path,
-                               GENERIC_READ | (hfd->readonly ? 0 : GENERIC_WRITE),
-                               FILE_SHARE_READ | (hfd->readonly ? 0 : FILE_SHARE_WRITE),
+                               GENERIC_READ | (hfd->ci.readonly ? 0 : GENERIC_WRITE),
+                               FILE_SHARE_READ | (hfd->ci.readonly ? 0 : FILE_SHARE_WRITE),
                                NULL, OPEN_EXISTING, flags, NULL);
                        hfd->handle->h = h;
                        if (h == INVALID_HANDLE_VALUE)
@@ -455,12 +456,12 @@ int hdf_open_target (struct hardfiledata *hfd, const TCHAR *pname)
                        _tcsncpy (hfd->product_rev, udi->product_rev, 4);
                        hfd->offset = udi->offset;
                        hfd->physsize = hfd->virtsize = udi->size;
-                       hfd->blocksize = udi->bytespersector;
+                       hfd->ci.blocksize = udi->bytespersector;
                        if (hfd->offset == 0 && !hfd->drive_empty) {
-                               int sf = safetycheck (hfd->handle->h, udi->device_path, 0, hfd->cache, hfd->blocksize);
+                               int sf = safetycheck (hfd->handle->h, udi->device_path, 0, hfd->cache, hfd->ci.blocksize);
                                if (sf > 0)
                                        goto end;
-                               if (sf == 0 && !hfd->readonly && harddrive_dangerous != 0x1234dead) {
+                               if (sf == 0 && !hfd->ci.readonly && harddrive_dangerous != 0x1234dead) {
                                        write_log (_T("'%s' forced read-only, safetycheck enabled\n"), udi->device_path);
                                        hfd->dangerous = 1;
                                        // clear GENERIC_WRITE
@@ -510,7 +511,7 @@ int hdf_open_target (struct hardfiledata *hfd, const TCHAR *pname)
                                        zmode = 1;
                        }
                }
-               h = CreateFile (name, GENERIC_READ | (hfd->readonly ? 0 : GENERIC_WRITE), hfd->readonly ? FILE_SHARE_READ : 0, NULL,
+               h = CreateFile (name, GENERIC_READ | (hfd->ci.readonly ? 0 : GENERIC_WRITE), hfd->ci.readonly ? FILE_SHARE_READ : 0, NULL,
                        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
                hfd->handle->h = h;
                i = _tcslen (name) - 1;
@@ -533,9 +534,9 @@ int hdf_open_target (struct hardfiledata *hfd, const TCHAR *pname)
                        low = GetFileSize (h, &high2);
                        if (low == INVALID_FILE_SIZE && GetLastError () != NO_ERROR)
                                goto end;
-                       low &= ~(hfd->blocksize - 1);
+                       low &= ~(hfd->ci.blocksize - 1);
                        hfd->physsize = hfd->virtsize = ((uae_u64)high2 << 32) | low;
-                       if (hfd->physsize < hfd->blocksize || hfd->physsize == 0) {
+                       if (hfd->physsize < hfd->ci.blocksize || hfd->physsize == 0) {
                                write_log (_T("HDF '%s' is too small\n"), name);
                                goto end;
                        }
@@ -642,9 +643,9 @@ static int hdf_seek (struct hardfiledata *hfd, uae_u64 offset)
                abort ();
        }
        offset += hfd->offset;
-       if (offset & (hfd->blocksize - 1)) {
+       if (offset & (hfd->ci.blocksize - 1)) {
                gui_message (_T("hd: poscheck failed, offset=%I64X not aligned to blocksize=%d! (%I64X & %04X = %04X)\n"),
-                       offset, hfd->blocksize, offset, hfd->blocksize, offset & (hfd->blocksize - 1));
+                       offset, hfd->ci.blocksize, offset, hfd->ci.blocksize, offset & (hfd->ci.blocksize - 1));
                abort ();
        }
        if (hfd->handle_valid == HDF_HANDLE_WIN32) {
@@ -687,8 +688,8 @@ static void poscheck (struct hardfiledata *hfd, int len)
                gui_message (_T("hd: poscheck failed, offset out of bounds! (%I64d >= %I64d, LEN=%d)"), pos, hfd->offset + hfd->physsize, len);
                abort ();
        }
-       if (pos & (hfd->blocksize - 1)) {
-               gui_message (_T("hd: poscheck failed, offset not aligned to blocksize! (%I64X & %04X = %04X\n"), pos, hfd->blocksize, pos & hfd->blocksize);
+       if (pos & (hfd->ci.blocksize - 1)) {
+               gui_message (_T("hd: poscheck failed, offset not aligned to blocksize! (%I64X & %04X = %04X\n"), pos, hfd->ci.blocksize, pos & hfd->ci.blocksize);
                abort ();
        }
 }
@@ -726,8 +727,8 @@ static int hdf_rw (struct hardfiledata *hfd, void *bufferp, uae_u64 offset, int
        uae_u8 *buffer = bufferp;
        int soff, size, mask, bs;
 
-       bs = hfd->blocksize;
-       mask = hfd->blocksize - 1;
+       bs = hfd->ci.blocksize;
+       mask = hfd->ci.blocksize - 1;
        hfd->cache_valid = 0;
        if (hfd->handle_valid == HDF_HANDLE_ZFILE) {
                if (dowrite)
@@ -746,7 +747,7 @@ static int hdf_rw (struct hardfiledata *hfd, void *bufferp, uae_u64 offset, int
                                WriteFile (hfd->handle, hfd->cache, bs, &outlen2, NULL);
                        else
                                ReadFile (hfd->handle, hfd->cache, bs, &outlen2, NULL);
-                       if (outlen2 != hfd->blocksize)
+                       if (outlen2 != hfd->ci.blocksize)
                                goto end;
                        outlen += size;
                        memcpy (buffer, hfd->cache + soff,  size);
@@ -890,7 +891,7 @@ static int hdf_write_2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset,
 {
        DWORD outlen = 0;
 
-       if (hfd->readonly)
+       if (hfd->ci.readonly)
                return 0;
        if (hfd->dangerous)
                return 0;
@@ -905,7 +906,7 @@ static int hdf_write_2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset,
                                hfd->handle->firstwrite = true;
                                if (ismounted (hfd->device_name, hfd->handle->h)) {
                                        gui_message (_T("\"%s\"\n\nBlock zero write attempt but drive has one or more mounted PC partitions. Erase the drive or unmount all PC partitions first."), name);
-                                       hfd->readonly = 1;
+                                       hfd->ci.readonly = true;
                                        return 0;
                                }
                        }
@@ -1611,7 +1612,7 @@ TCHAR *hdf_getnameharddrive (int index, int flags, int *sectorsize, int *dangero
 
 static int hmc (struct hardfiledata *hfd)
 {
-       uae_u8 *buf = xmalloc (uae_u8, hfd->blocksize);
+       uae_u8 *buf = xmalloc (uae_u8, hfd->ci.blocksize);
        DWORD ret, got, err, status;
        int first = 1;
 
@@ -1619,13 +1620,13 @@ static int hmc (struct hardfiledata *hfd)
                write_log (_T("testing if %s has media inserted\n"), hfd->emptyname);
                status = 0;
                SetFilePointer (hfd->handle->h, 0, NULL, FILE_BEGIN);
-               ret = ReadFile (hfd->handle->h, buf, hfd->blocksize, &got, NULL);
+               ret = ReadFile (hfd->handle->h, buf, hfd->ci.blocksize, &got, NULL);
                err = GetLastError ();
                if (ret) {
-                       if (got == hfd->blocksize) {
+                       if (got == hfd->ci.blocksize) {
                                write_log (_T("read ok (%d)\n"), got);
                        } else {
-                               write_log (_T("read ok but no data (%d)\n"), hfd->blocksize);
+                               write_log (_T("read ok but no data (%d)\n"), hfd->ci.blocksize);
                                ret = 0;
                                err = 0;
                        }
@@ -1659,7 +1660,7 @@ end:
 int hardfile_remount (int nr);
 
 
-static void hmc_check (struct hardfiledata *hfd, struct uaedev_config_info *uci, int *rescanned, int *reopen,
+static void hmc_check (struct hardfiledata *hfd, struct uaedev_config_data *uci, int *rescanned, int *reopen,
        int *gotinsert, const TCHAR *drvname, int inserted)
 {
        int ret;
@@ -1734,8 +1735,8 @@ int win32_hardfile_media_change (const TCHAR *drvname, int inserted)
        for (i = 0; i < currprefs.mountitems; i++) {
                extern struct hd_hardfiledata *pcmcia_sram;
                int reopen = 0;
-               struct uaedev_config_info *uci = &currprefs.mountconfig[i];
-               if (uci->controller == HD_CONTROLLER_PCMCIA_SRAM) {
+               struct uaedev_config_data *uci = &currprefs.mountconfig[i];
+               if (uci->ci.controller == HD_CONTROLLER_PCMCIA_SRAM) {
                        hmc_check (&pcmcia_sram->hfd, uci, &rescanned, &reopen, &gotinsert, drvname, inserted);
                }
        }
index b26f9c3768ecb8af0713fe6232908543435ab565..0e47300568cce29a90981698a77fa3855f5457f5 100644 (file)
@@ -623,7 +623,7 @@ static void disablemouse (void)
                return;
        if (!currprefs.gfx_api)
                return;
-       D3D_setcursor (0, 0, 0, 0, false);
+       D3D_setcursor (0, 0, 0, 0, false, true);
 }
 
 static int newcursor_x, newcursor_y;
@@ -646,7 +646,11 @@ static void mouseupdate (void)
 
        if (!currprefs.gfx_api)
                return;
-       D3D_setcursor (x, y, picasso96_state.Width, picasso96_state.Height, cursorvisible);
+       if (currprefs.win32_rtgscalemode == RTG_MODE_CENTER) {
+               D3D_setcursor (x, y, WIN32GFX_GetWidth (), WIN32GFX_GetHeight(), cursorvisible, scalepicasso == 2);
+       } else {
+               D3D_setcursor (x, y, picasso96_state.Width, picasso96_state.Height, cursorvisible, false);
+       }
 }
 
 static int framecnt;
old mode 100755 (executable)
new mode 100644 (file)
index 8689c90..e741621
 #define IDS_MISCLISTITEMS1              386
 #define IDS_MISCLISTITEMS2              387
 #define IDS_MISCLISTITEMS3              388
+#define IDS_WHEELMOUSE                  389
+#define IDS_JOYMODE_WHEELMOUSE          389
 #define IDS_QS_MODELS                   1000
 #define IDS_QS_MODEL_A500               1001
 #define IDS_QS_MODEL_A500P              1002
 #define IDC_FILESYS_SELECTOR            1381
 #define IDC_HDF_AUTOBOOT                1382
 #define IDC_HDF_DONOTMOUNT              1383
+#define IDC_HDF_DONOTMOUNT2             1384
+#define IDC_HDF_ADDFSRES                1384
 #define IDC_ROMFILE                     1390
 #define IDC_KEYFILE                     1391
 #define IDC_KICKCHOOSER                 1392
 #define IDC_CS_RTC1                     1731
 #define IDC_CS_RTC2                     1732
 #define IDC_CS_RTC3                     1733
-#define IDC_CS_IDE4                     1734
-#define IDC_CS_DF0IDHW                  1734
+#define IDC_CS_RTC4                     1734
 #define IDC_CS_AGNUS                    1735
 #define IDC_CS_AGNUSREV                 1736
 #define IDC_CS_DENISE                   1737
 #define IDC_INPUTMAPLIST                1797
 #define IDC_RTG_HWSPRITE                1797
 #define IDC_PORT1_REMAP                 1798
+#define IDC_RTG_SCALE_ALLOW2            1798
+#define IDC_RTG_CENTER                  1798
 #define IDC_PORT0_REMAP                 1799
 #define IDC_PORT2_REMAP                 1800
 #define IDC_PORT3_REMAP                 1801
 #define IDC_LISTDIALOG_LIST             1813
 #define IDC_LOGPATH                     1814
 #define IDC_MIDIROUTER                  1815
+#define IDC_CS_IDE4                     1816
+#define IDC_CS_DF0IDHW                  1817
 #define ID__FLOPPYDRIVES                40004
 #define ID_FLOPPYDRIVES_DF0             40005
 #define ID_ST_CONFIGURATION             40010
index a85a9fcc86d7f80744beeef41968d8aa1717d932..5c6e0ba51679cf8f6afd708ca5f264be7ed5e1a2 100644 (file)
-// Microsoft Visual C++ generated resource script.\r
-//\r
-#include "resource.h"\r
-\r
-#define APSTUDIO_READONLY_SYMBOLS\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Generated from the TEXTINCLUDE 2 resource.\r
-//\r
-#include "winres.h"\r\r
-/////////////////////////////////////////////////////////////////////////////\r
-#undef APSTUDIO_READONLY_SYMBOLS\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// English resources\r
-\r
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r
-LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL\r
-#pragma code_page(1252)\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Icon\r
-//\r
-\r
-// Icon with lowest ID value placed first to ensure application icon\r
-// remains consistent on all systems.\r
-IDI_APPICON             ICON                    "winuae.ico"\r
-IDI_FLOPPY              ICON                    "35floppy.ico"\r
-IDI_ABOUT               ICON                    "amigainfo.ico"\r
-IDI_HARDDISK            ICON                    "drive.ico"\r
-IDI_CPU                 ICON                    "cpu.ico"\r
-IDI_GAMEPORTS           ICON                    "joystick.ico"\r
-IDI_IOPORTS             ICON                    "joystick.ico"\r
-IDI_INPUT               ICON                    "joystick.ico"\r
-IDI_MISC1               ICON                    "misc.ico"\r
-IDI_MISC2               ICON                    "misc.ico"\r
-IDI_MOVE_UP             ICON                    "move_up.ico"\r
-IDI_MOVE_DOWN           ICON                    "move_dow.ico"\r
-IDI_AVIOUTPUT           ICON                    "avioutput.ico"\r
-IDI_DISK                ICON                    "drive.ico"\r
-IDI_FOLDER              ICON                    "folder.ico"\r
-IDI_SOUND               ICON                    "sound.ico"\r
-IDI_DISPLAY             ICON                    "screen.ico"\r
-IDI_ROOT                ICON                    "root.ico"\r
-IDI_MEMORY              ICON                    "chip.ico"\r
-IDI_QUICKSTART          ICON                    "quickstart.ico"\r
-IDI_PATHS               ICON                    "paths.ico"\r
-IDI_DISKIMAGE           ICON                    "diskimage.ico"\r
-IDI_PORTS               ICON                    "port.ico"\r
-IDI_CONFIGFILE          ICON                    "configfile.ico"\r
-IDI_FILE                ICON                    "file.ico"\r
-IDI_EXPANSION           ICON                    "expansion.ico"\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Accelerator\r
-//\r
-\r
-IDR_DBGACCEL ACCELERATORS\r
-BEGIN\r
-    VK_F1,          ID_DBG_PAGE1,           VIRTKEY, NOINVERT\r
-    VK_F2,          ID_DBG_PAGE2,           VIRTKEY, NOINVERT\r
-    VK_F3,          ID_DBG_PAGE3,           VIRTKEY, NOINVERT\r
-    VK_F4,          ID_DBG_PAGE4,           VIRTKEY, NOINVERT\r
-    VK_F5,          ID_DBG_PAGE5,           VIRTKEY, NOINVERT\r
-    VK_F6,          ID_DBG_PAGE6,           VIRTKEY, NOINVERT\r
-    VK_F7,          ID_DBG_PAGE7,           VIRTKEY, NOINVERT\r
-    VK_F8,          ID_DBG_PAGE8,           VIRTKEY, NOINVERT\r
-    VK_F9,          ID_DBG_PAGE9,           VIRTKEY, NOINVERT\r
-    VK_F11,         ID_DBG_STEP_OVER,       VIRTKEY, NOINVERT\r
-    VK_F12,         ID_DBG_STEP_INTO,       VIRTKEY, NOINVERT\r
-    VK_DOWN,        IDC_DBG_MEMDOWN,        VIRTKEY, ALT, NOINVERT\r
-    VK_RIGHT,       IDC_DBG_MEMDOWNFAST,    VIRTKEY, ALT, NOINVERT\r
-    VK_UP,          IDC_DBG_MEMUP,          VIRTKEY, ALT, NOINVERT\r
-    VK_LEFT,        IDC_DBG_MEMUPFAST,      VIRTKEY, ALT, NOINVERT\r
-    "H",            IDC_DBG_HELP,           VIRTKEY, ALT, NOINVERT\r
-    "P",            IDC_DBG_MEMTOPC,        VIRTKEY, ALT, NOINVERT\r
-    "A",            IDC_DBG_AUTOSET,        VIRTKEY, ALT, NOINVERT\r
-END\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Dialog\r
-//\r
-\r
-IDD_KICKSTART DIALOGEX 0, 0, 396, 217\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-EXSTYLE WS_EX_CONTEXTHELP\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    GROUPBOX        "System ROM Settings",IDC_STATIC,1,0,394,93\r
-    LTEXT           "Main ROM file:",IDC_ROMTEXT,14,13,263,10\r
-    COMBOBOX        IDC_ROMFILE,12,26,361,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "...",IDC_KICKCHOOSER,376,25,10,15\r
-    LTEXT           "Extended ROM file:",IDC_ROMFILE2TEXT,14,43,263,10\r
-    COMBOBOX        IDC_ROMFILE2,12,56,361,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "...",IDC_ROMCHOOSER2,376,55,10,15\r
-    CONTROL         "MapROM emulation [] Creates a BlizKick-compatible memory area.",IDC_MAPROM,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,87,77,104,12\r
-    CONTROL         "ShapeShifter support [] Patches the system ROM for ShapeShifter compatibility.",IDC_KICKSHIFTER,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,77,106,13\r
-    GROUPBOX        "Miscellaneous",IDC_STATIC,1,98,394,116\r
-    LTEXT           "Cartridge ROM file:",IDC_FLASHTEXT2,12,112,265,10\r
-    COMBOBOX        IDC_CARTFILE,12,125,361,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "...",IDC_CARTCHOOSER,376,124,10,15\r
-    LTEXT           "Flash RAM file:",IDC_FLASHTEXT,12,144,265,10\r
-    EDITTEXT        IDC_FLASHFILE,12,157,361,12,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_FLASHCHOOSER,376,156,10,15\r
-    LTEXT           "Real Time Clock file",IDC_STATIC,12,174,313,15,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_RTCFILE,12,191,361,12,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_RTCCHOOSER,376,189,10,15\r
-END\r
-\r
-IDD_DISPLAY DIALOGEX 0, 0, 396, 272\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    GROUPBOX        "Screen",IDC_SCREENRESTEXT,1,0,393,77,BS_LEFT\r
-    COMBOBOX        IDC_DISPLAYSELECT,10,13,375,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Fullscreen:",IDC_STATIC,3,33,51,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_RESOLUTION,59,33,76,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_RESOLUTIONDEPTH,144,33,62,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Windowed:",IDC_STATIC,2,54,51,15,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_XSIZE,59,56,56,12,ES_NUMBER\r
-    EDITTEXT        IDC_YSIZE,122,56,56,12,ES_NUMBER\r
-    COMBOBOX        IDC_REFRESHRATE,266,33,119,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_DISPLAY_BUFFERCNT,266,56,119,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Settings",IDC_SETTINGSTEXT,1,86,283,144\r
-    RTEXT           "Native:",IDC_STATIC,9,98,48,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_SCREENMODE_NATIVE,61,98,71,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_SCREENMODE_NATIVE2,142,98,127,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "RTG:",IDC_STATIC,8,115,49,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_SCREENMODE_RTG,61,118,71,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_SCREENMODE_RTG2,142,118,127,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Blacker than black",IDC_BLACKER_THAN_BLACK,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,11,140,142,10\r
-    CONTROL         "Remove interlace artifacts",IDC_FLICKERFIXER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,154,142,10\r
-    CONTROL         "Filtered low resolution",IDC_LORES_SMOOTHED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,140,116,10\r
-    CONTROL         "Resolution autoswitch",IDC_AUTORESOLUTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,154,116,10\r
-    RTEXT           "Resolution:",IDC_STATIC,27,170,110,8,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_LORES,142,169,127,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Refresh:",IDC_REFRESHTEXT,11,190,57,8\r
-    CONTROL         "Slider1",IDC_FRAMERATE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,71,185,99,20\r
-    COMBOBOX        IDC_RATE2BOX,181,190,60,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "FPS adj.:",IDC_REFRESH2TEXT,9,211,61,8\r
-    CONTROL         "",IDC_FRAMERATE2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,71,206,99,20\r
-    EDITTEXT        IDC_RATE2TEXT,181,210,46,12,ES_AUTOHSCROLL\r
-    CONTROL         "",IDC_RATE2ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,232,211,8,10\r
-    GROUPBOX        "Centering",IDC_STATIC,289,86,105,49\r
-    CONTROL         "Horizontal",IDC_XCENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,300,100,90,10\r
-    CONTROL         "Vertical",IDC_YCENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,300,116,90,10\r
-    GROUPBOX        "Line Mode",IDC_LINEMODE,290,139,104,90\r
-    CONTROL         "Normal",IDC_LM_NORMAL,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_GROUP | WS_TABSTOP,299,161,90,10\r
-    CONTROL         "Double",IDC_LM_DOUBLED,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,177,90,10\r
-    CONTROL         "Scanlines",IDC_LM_SCANLINES,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,193,90,10\r
-    COMBOBOX        IDC_DA_MODE,15,245,71,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "",IDC_DA_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,96,241,96,20\r
-    EDITTEXT        IDC_DA_TEXT,205,245,56,12,ES_AUTOHSCROLL | ES_READONLY\r
-    PUSHBUTTON      "Reset to defaults",IDC_DA_RESET,289,245,106,14\r
-END\r
-\r
-IDD_MEMORY DIALOGEX 0, 0, 396, 206\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-EXSTYLE WS_EX_CONTEXTHELP\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    GROUPBOX        "Memory Settings",IDC_STATIC,1,7,393,117\r
-    RTEXT           "Chip:",IDC_STATIC,7,25,60,15,SS_CENTERIMAGE\r
-    CONTROL         "Slider1",IDC_CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,68,22,60,20\r
-    EDITTEXT        IDC_CHIPRAM,135,25,40,12,ES_CENTER | ES_READONLY\r
-    RTEXT           "Fast:",IDC_STATIC,8,49,60,15,SS_CENTERIMAGE\r
-    CONTROL         "Slider1",IDC_FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,68,47,60,20\r
-    EDITTEXT        IDC_FASTRAM,135,53,40,12,ES_CENTER | ES_READONLY\r
-    CONTROL         "Autoconfig Fast RAM",IDC_FASTMEMAUTOCONFIG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,51,76,124,10\r
-    RTEXT           "Slow:",IDC_STATIC,179,25,66,15,SS_CENTERIMAGE\r
-    CONTROL         "Slider1",IDC_SLOWMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,248,22,60,20\r
-    EDITTEXT        IDC_SLOWRAM,311,25,40,12,ES_CENTER | ES_READONLY\r
-    RTEXT           "Z3 Fast:",IDC_STATIC,179,49,66,15,SS_CENTERIMAGE\r
-    CONTROL         "Slider1",IDC_Z3FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,248,47,60,20\r
-    EDITTEXT        IDC_Z3FASTRAM,311,50,40,12,ES_CENTER | ES_READONLY\r
-    RTEXT           "32-bit Chip:",IDC_STATIC,180,74,66,15,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_Z3CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,248,71,60,20\r
-    EDITTEXT        IDC_Z3CHIPRAM,311,76,40,12,ES_CENTER | ES_READONLY\r
-    EDITTEXT        IDC_MAX32RAM,14,99,366,12,ES_CENTER | ES_READONLY\r
-    GROUPBOX        "A3000/A4000 Advanced Memory Settings",IDC_STATIC,1,131,393,65\r
-    RTEXT           "Motherboard Fast:",IDC_STATIC,44,149,129,10,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,177,145,60,20\r
-    EDITTEXT        IDC_MBRAM1,240,148,40,12,ES_CENTER | ES_READONLY\r
-    RTEXT           "Processor Slot Fast:",IDC_STATIC,44,172,129,10,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,177,168,60,20\r
-    EDITTEXT        IDC_MBRAM2,240,171,40,12,ES_CENTER | ES_READONLY\r
-END\r
-\r
-IDD_CPU DIALOGEX 0, 0, 396, 259\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    GROUPBOX        "CPU",IDC_STATIC,1,1,99,160,BS_LEFT\r
-    CONTROL         "68000",IDC_CPU0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,8,15,63,10\r
-    CONTROL         "68010",IDC_CPU1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,29,63,10\r
-    CONTROL         "68020",IDC_CPU2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,42,63,10\r
-    CONTROL         "68030",IDC_CPU3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,56,63,10\r
-    CONTROL         "68040",IDC_CPU4,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,70,63,10\r
-    CONTROL         "68060",IDC_CPU5,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,84,63,10\r
-    CONTROL         "24-bit addressing",IDC_COMPATIBLE24,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,8,101,87,11\r
-    CONTROL         "More compatible [] Emulate 68000's prefetch registers. More compatible but slower.",IDC_COMPATIBLE,\r
-                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,8,115,87,11\r
-    CONTROL         "JIT [] Enable just-in-time CPU emulator. Significantly increases the speed of the CPU emulation. Requires 68020 or higher CPU.",IDC_JITENABLE,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,128,87,11\r
-    CONTROL         "68040 MMU [] 68040 MMU emulation. Not compatible with JIT.",IDC_MMUENABLE,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,142,87,11\r
-    GROUPBOX        "CPU Emulation Speed",IDC_STATIC,110,3,284,96\r
-    CONTROL         "Fastest possible",IDC_CS_HOST,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_GROUP | WS_TABSTOP,115,18,195,10\r
-    CONTROL         "Approximate A500/A1200 or cycle-exact",IDC_CS_68000,\r
-                    "Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,115,32,195,10\r
-    CONTROL         "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,116,50,192,20\r
-    RTEXT           "CPU Speed",IDC_STATIC,115,78,55,9,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_CPUTEXT,178,77,30,12,ES_CENTER | ES_READONLY\r
-    RTEXT           "CPU Idle",IDC_STATIC,213,78,62,9\r
-    CONTROL         "",IDC_CPUIDLE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,282,73,69,21\r
-    GROUPBOX        "Cycle-exact CPU Emulation Speed",IDC_STATIC,110,105,284,55\r
-    RTEXT           "CPU Frequency",IDC_STATIC,113,129,67,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_CPU_FREQUENCY,189,128,46,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    EDITTEXT        IDC_CPU_FREQUENCY2,242,127,70,15\r
-    GROUPBOX        "FPU",IDC_STATIC,1,167,99,91,BS_LEFT\r
-    CONTROL         "None",IDC_FPU0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,8,182,87,10\r
-    CONTROL         "68881",IDC_FPU1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,196,87,10\r
-    CONTROL         "68882",IDC_FPU2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,209,87,10\r
-    CONTROL         "CPU internal",IDC_FPU3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,223,87,10\r
-    CONTROL         "More compatible [] More compatible but slower FPU emulation.",IDC_COMPATIBLE_FPU,\r
-                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,8,242,87,10\r
-    GROUPBOX        "Advanced JIT Settings",IDC_STATIC,110,167,284,91\r
-    RTEXT           "Cache size:",IDC_STATIC,117,187,66,10,SS_CENTERIMAGE\r
-    CONTROL         "Slider1",IDC_CACHE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,186,181,115,20\r
-    EDITTEXT        IDC_CACHETEXT,305,186,30,12,ES_CENTER | ES_READONLY\r
-    CONTROL         "Hard flush",IDC_HARDFLUSH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,214,84,11\r
-    CONTROL         "Constant jump",IDC_CONSTJUMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,228,84,11\r
-    CONTROL         "FPU support",IDC_JITFPU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,242,84,11\r
-    CONTROL         "No flags",IDC_NOFLAGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,217,214,68,11\r
-    CONTROL         "Direct",IDC_TRUST0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,289,214,72,10\r
-    CONTROL         "Indirect",IDC_TRUST1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,289,228,72,10\r
-END\r
-\r
-IDD_FLOPPY DIALOGEX 0, 0, 396, 261\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    GROUPBOX        "Floppy Drives",IDC_SETTINGSTEXT3,1,0,393,163\r
-    CONTROL         "DF0:",IDC_DF0ENABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,14,34,15\r
-    PUSHBUTTON      "Delete save image",IDC_SAVEIMAGE0,97,13,78,15,NOT WS_VISIBLE\r
-    COMBOBOX        IDC_DF0TYPE,180,14,65,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Write-protected",IDC_STATIC,249,17,74,10,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_DF0WP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,328,13,10,15\r
-    PUSHBUTTON      "Eject",IDC_EJECT0,345,12,30,15\r
-    PUSHBUTTON      "...",IDC_DF0,379,12,10,15\r
-    COMBOBOX        IDC_DF0TEXT,6,31,384,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "DF1:",IDC_DF1ENABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,51,34,15\r
-    PUSHBUTTON      "Delete save image",IDC_SAVEIMAGE1,97,49,78,15,NOT WS_VISIBLE\r
-    COMBOBOX        IDC_DF1TYPE,180,51,65,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Write-protected",IDC_STATIC,249,53,74,10,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_DF1WP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,328,50,10,15\r
-    PUSHBUTTON      "Eject",IDC_EJECT1,345,49,30,15\r
-    PUSHBUTTON      "...",IDC_DF1,379,49,10,15\r
-    COMBOBOX        IDC_DF1TEXT,6,68,383,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "DF2:",IDC_DF2ENABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,87,34,15\r
-    PUSHBUTTON      "Delete save image",IDC_SAVEIMAGE2,97,85,78,15,NOT WS_VISIBLE\r
-    COMBOBOX        IDC_DF2TYPE,180,87,65,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Write-protected",IDC_STATIC,250,88,73,10,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_DF2WP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,328,86,9,15\r
-    PUSHBUTTON      "Eject",IDC_EJECT2,345,85,30,15\r
-    PUSHBUTTON      "...",IDC_DF2,379,85,10,15\r
-    COMBOBOX        IDC_DF2TEXT,6,104,384,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "DF3:",IDC_DF3ENABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,123,34,15\r
-    PUSHBUTTON      "Delete save image",IDC_SAVEIMAGE3,97,121,78,15,NOT WS_VISIBLE\r
-    COMBOBOX        IDC_DF3TYPE,180,123,65,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Write-protected",IDC_STATIC,250,125,73,10,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_DF3WP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,328,123,9,15\r
-    PUSHBUTTON      "Eject",IDC_EJECT3,345,121,30,15\r
-    PUSHBUTTON      "...",IDC_DF3,379,121,10,15\r
-    COMBOBOX        IDC_DF3TEXT,6,140,383,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Floppy Drive Emulation Speed",IDC_SETTINGSTEXT2,1,170,393,35\r
-    CONTROL         "",IDC_FLOPPYSPD,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,71,180,116,20\r
-    EDITTEXT        IDC_FLOPPYSPDTEXT,222,183,101,12,ES_CENTER | ES_READONLY\r
-    GROUPBOX        "New Floppy Disk Image",IDC_SETTINGSTEXT,1,211,393,49\r
-    COMBOBOX        IDC_FLOPPYTYPE,58,225,64,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Create Standard Disk [] Creates a standard 880 or 1760 KB ADF disk image.",IDC_CREATE,130,224,97,15\r
-    PUSHBUTTON      "Create Custom Disk [] Creates a low level (MFM) ADF disk image (about 2MB). Useful for programs that use non-standard disk formats (for example some save disks or DOS-formatted floppies)",IDC_CREATE_RAW,235,224,101,15\r
-    RTEXT           "Disk label:",IDC_STATIC,60,244,58,10,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_CREATE_NAME,130,243,97,13,ES_AUTOHSCROLL\r
-    CONTROL         "Bootblock",IDC_FLOPPY_BOOTABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,235,242,59,15\r
-    CONTROL         "FFS",IDC_FLOPPY_FFS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,300,242,34,15\r
-END\r
-\r
-IDD_HARDDISK DIALOGEX 0, 0, 396, 315\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-EXSTYLE WS_EX_CONTEXTHELP\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    CONTROL         "List1",IDC_VOLUMELIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,2,393,153\r
-    PUSHBUTTON      "Add &Directory or Archive...",IDC_NEW_FS,1,157,128,15\r
-    PUSHBUTTON      "Add &Hardfile...",IDC_NEW_HF,135,157,126,15\r
-    PUSHBUTTON      "Add Ha&rd Drive...",IDC_NEW_HD,267,157,127,15\r
-    PUSHBUTTON      "&Properties",IDC_EDIT,267,176,60,15\r
-    PUSHBUTTON      "Remove",IDC_REMOVE,334,176,60,15\r
-    GROUPBOX        "Options",IDC_STATIC,1,191,393,72\r
-    CONTROL         "Add PC drives at startup",IDC_MAPDRIVES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,204,201,11\r
-    CONTROL         "Include removable drives..",IDC_MAPDRIVES_REMOVABLE,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,217,201,11\r
-    CONTROL         "Include network drives..",IDC_MAPDRIVES_NET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,231,201,11\r
-    CONTROL         "CDFS automount CD/DVD drives",IDC_MAPDRIVES_CD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,245,201,11\r
-    CONTROL         "Disable UAEFSDB-support",IDC_NOUAEFSDB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,222,204,167,11\r
-    CONTROL         "Don't use Windows Recycle Bin",IDC_NORECYCLEBIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,222,217,167,11\r
-    CONTROL         "Automount removable drives [] Windows side insert or removal will immediately mount/remove it on Amiga side.",IDC_MAPDRIVES_AUTO,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,222,231,167,11\r
-    CONTROL         "Limit size of directory drives to 1G [] Workaround for example old installers that calculate free space incorrectly if drive is large.",IDC_MAPDRIVES_LIMIT,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,222,245,167,11\r
-    GROUPBOX        "Optical media options",IDC_STATIC,1,266,393,47\r
-    LTEXT           "CD drive/image",IDC_STATIC,5,280,70,10,SS_CENTERIMAGE\r
-    PUSHBUTTON      "Select image file",IDC_CD_SELECT,177,278,98,15\r
-    COMBOBOX        IDC_CD_TYPE,282,279,71,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Eject",IDC_CD_EJECT,360,278,30,15\r
-    COMBOBOX        IDC_CD_TEXT,5,297,386,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP\r
-END\r
-\r
-IDD_SOUND DIALOGEX 0, 0, 396, 288\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    COMBOBOX        IDC_SOUNDCARDLIST,1,1,393,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Sound Emulation",IDC_SOUNDSETTINGS,1,19,132,112\r
-    CONTROL         "Disabled",IDC_SOUND0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,35,108,10\r
-    CONTROL         "Disabled, but emulated",IDC_SOUND1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,53,107,10\r
-    CONTROL         "Enabled",IDC_SOUND2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,71,108,10\r
-    CONTROL         "Automatic switching",IDC_SOUND_AUTO,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,13,89,108,10\r
-    GROUPBOX        "Volume",IDC_STATIC,139,19,255,69\r
-    CONTROL         "",IDC_SOUNDVOLUME,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,207,32,105,20\r
-    EDITTEXT        IDC_SOUNDVOLUME2,329,35,48,12,ES_CENTER | ES_READONLY\r
-    GROUPBOX        "Sound Buffer Size",IDC_STATIC,140,90,254,42\r
-    CONTROL         "Slider1",IDC_SOUNDBUFFERRAM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,207,106,105,20\r
-    EDITTEXT        IDC_SOUNDBUFFERMEM,329,109,48,12,ES_CENTER | ES_READONLY\r
-    GROUPBOX        "Settings",IDC_SOUNDINTERPOLATION2,1,136,393,72\r
-    LTEXT           "Channel mode:",IDC_SOUNDSTEREOTXT,22,148,128,8,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_SOUNDSTEREO,24,158,135,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    LTEXT           "Stereo separation:",IDC_SOUNDSTEREOSEPTXT,180,148,84,8,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_SOUNDSTEREOSEP,181,158,74,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    LTEXT           "Interpolation:",IDC_SOUNDINTERPOLATIONTXT,279,148,98,8,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_SOUNDINTERPOLATION,279,158,96,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    LTEXT           "Frequency:",IDC_SOUNDFREQTXT,22,176,58,8,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_SOUNDFREQ,24,186,55,75,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP\r
-    LTEXT           "Swap channels:",IDC_SOUNDSWAPTXT,85,176,81,8,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_SOUNDSWAP,86,186,74,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    LTEXT           "Stereo delay:",IDC_SOUNDSTEREOMIXTXT,180,176,83,8,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_SOUNDSTEREOMIX,181,186,74,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    LTEXT           "Audio filter:",IDC_SOUNDFILTERTXT,279,176,98,8,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_SOUNDFILTER,279,186,96,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Floppy Drive Sound Emulation",IDC_STATIC,1,213,278,73\r
-    CONTROL         "",IDC_SOUNDDRIVEVOLUME,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,20,229,107,19\r
-    EDITTEXT        IDC_SOUNDDRIVEVOLUME2,144,231,48,12,ES_CENTER | ES_READONLY\r
-    COMBOBOX        IDC_SOUNDDRIVE,205,231,66,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_SOUNDDRIVESELECT,18,257,253,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Drivers",IDC_STATIC,285,213,109,73\r
-    CONTROL         "DirectSound",IDC_SOUND_DS,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,292,227,98,10\r
-    CONTROL         "WASAPI",IDC_SOUND_WASAPI,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,292,240,98,10\r
-    CONTROL         "OpenAL",IDC_SOUND_OPENAL,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,292,253,98,10\r
-    CONTROL         "PortAudio",IDC_SOUND_PORTAUDIO,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,292,266,98,10\r
-    CONTROL         "",IDC_SOUNDVOLUMECD,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,207,61,105,20\r
-    EDITTEXT        IDC_SOUNDVOLUMECD2,329,64,48,12,ES_CENTER | ES_READONLY\r
-    RTEXT           "CD Audio",IDC_STATIC,152,67,51,10,SS_CENTERIMAGE\r
-    RTEXT           "Paula Audio",IDC_STATIC,152,38,51,10,SS_CENTERIMAGE\r
-END\r
-\r
-IDD_LOADSAVE DIALOGEX 0, 0, 396, 318\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    CONTROL         "",IDC_CONFIGTREE,"SysTreeView32",TVS_HASLINES | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_TRACKSELECT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,1,5,393,227,WS_EX_CLIENTEDGE\r
-    RTEXT           "Name:",IDC_STATIC,4,241,47,8,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_EDITNAME,55,239,230,13,ES_AUTOHSCROLL\r
-    RTEXT           "Description:",IDC_STATIC,1,262,50,8,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_EDITDESCRIPTION,55,260,230,13,ES_AUTOHSCROLL\r
-    RTEXT           "Link:",IDC_STATIC,4,284,47,8,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_CONFIGLINK,55,282,168,150,CBS_DROPDOWN | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Ignore link",IDC_CONFIGNOLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,283,58,12\r
-    EDITTEXT        IDC_EDITPATH,289,238,49,15,ES_AUTOHSCROLL | WS_DISABLED\r
-    CONTROL         "Autoload",IDC_CONFIGAUTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,343,240,51,12\r
-    GROUPBOX        "Additional Information",IDC_STATIC,289,256,105,38,BS_LEFT\r
-    PUSHBUTTON      "View",IDC_VIEWINFO,297,272,41,15\r
-    PUSHBUTTON      "Set",IDC_SETINFO,348,272,41,15\r
-    PUSHBUTTON      "Load",IDC_QUICKLOAD,1,301,60,15\r
-    PUSHBUTTON      "Save",IDC_QUICKSAVE,65,301,60,15\r
-    PUSHBUTTON      "Load From...",IDC_LOAD,162,301,60,15\r
-    PUSHBUTTON      "Save As...",IDC_SAVE,226,301,60,15\r
-    PUSHBUTTON      "Delete",IDC_DELETE,335,301,60,15\r
-END\r
-\r
-IDD_IOPORTS DIALOGEX 0, 0, 396, 295\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    GROUPBOX        "Parallel Port",IDC_STATIC,1,1,393,131\r
-    RTEXT           "Printer:",IDC_STATIC,6,16,57,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_PRINTERLIST,67,17,317,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Type:",IDC_STATIC,7,38,57,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_PRINTERTYPELIST,67,39,317,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Flush print job",IDC_FLUSHPRINTER,147,58,75,12\r
-    RTEXT           "Autoflush [] Time in seconds after a pending print job is automatically flushed.",IDC_PRINTERAUTOFLUSHTXT,236,56,110,15,SS_NOTIFY | SS_CENTERIMAGE\r
-    EDITTEXT        IDC_PRINTERAUTOFLUSH,351,58,33,12,ES_NUMBER\r
-    RTEXT           "Ghostscript extra parameters:",IDC_STATIC,8,74,136,15,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_PS_PARAMS,148,75,236,12,ES_AUTOHSCROLL\r
-    RTEXT           "Sampler:",IDC_STATIC,6,94,57,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_SAMPLERLIST,67,95,317,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Stereo sampler",IDC_SAMPLER_STEREO,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,68,114,149,12\r
-    GROUPBOX        "Serial Port",IDC_STATIC,1,137,393,51\r
-    COMBOBOX        IDC_SERIAL,67,150,317,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Shared",IDC_SER_SHARED,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,32,171,66,12\r
-    CONTROL         "RTS/CTS",IDC_SER_CTSRTS,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,106,171,66,12\r
-    CONTROL         "Direct []Use when emulating serial-link games on two PCs running WinUAE",IDC_SER_DIRECT,\r
-                    "Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,181,171,83,12\r
-    CONTROL         "uaeserial.device",IDC_UAESERIAL,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,275,171,108,12\r
-    RTEXT           "Out:",IDC_MIDI,22,202,32,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_MIDIOUTLIST,58,204,145,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "In:",IDC_MIDI2,204,201,31,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_MIDIINLIST,239,203,145,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Protection Dongle",IDC_STATIC,1,252,393,41,BS_LEFT\r
-    GROUPBOX        "MIDI",IDC_STATIC,1,191,393,54,BS_LEFT\r
-    COMBOBOX        IDC_DONGLELIST,58,270,232,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Route MIDI In to MIDI Out",IDC_MIDIROUTER,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,41,227,170,12\r
-END\r
-\r
-IDD_GAMEPORTS DIALOGEX 0, 0, 396, 288\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    GROUPBOX        "Mouse and Joystick settings",IDC_STATIC,1,3,393,211\r
-    RTEXT           "Port 1:",IDC_STATIC,4,18,37,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_PORT0_JOYS,45,19,342,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_PORT0_AF,45,37,86,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_PORT0_JOYSMODE,136,38,106,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Test [] Test Port 1 (mouse) configuration.",IDC_PORT0_TEST,313,37,36,14\r
-    PUSHBUTTON      "Remap [] Remap Port 1 configurarion.",IDC_PORT0_REMAP,352,37,36,14\r
-    RTEXT           "Port 2:",IDC_STATIC,6,56,35,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_PORT1_JOYS,45,57,342,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_PORT1_AF,45,74,86,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_PORT1_JOYSMODE,136,74,106,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Test [] Test Port 2 (joystick) configuration.",IDC_PORT1_TEST,313,74,36,14\r
-    PUSHBUTTON      "Remap [] Remap Port 2 configuration.",IDC_PORT1_REMAP,352,74,36,14\r
-    PUSHBUTTON      "Swap ports [] Swap ports 1 and 2.",IDC_SWAP,45,100,78,14\r
-    LTEXT           "Emulated parallel port joystick adapter",IDC_STATIC,10,124,179,15,SS_CENTERIMAGE\r
-    RTEXT           "X-Arcade layout information []#1",IDC_STATIC,217,124,170,15,SS_NOTIFY | SS_CENTERIMAGE\r
-    COMBOBOX        IDC_PORT2_JOYS,45,142,342,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Test [] Test Parallel port joystick port 1 configuration.",IDC_PORT2_TEST,313,159,36,14\r
-    PUSHBUTTON      "Remap [] Remap Parallel port joystick port 1 configurarion.",IDC_PORT2_REMAP,352,159,36,14\r
-    COMBOBOX        IDC_PORT3_JOYS,45,178,342,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Test [] Test Parallel port joystick 2 configuration.",IDC_PORT3_TEST,313,194,36,14\r
-    PUSHBUTTON      "Remap [] Remap Parallel port joystick port 2 configurarion.",IDC_PORT3_REMAP,352,194,36,14\r
-    GROUPBOX        "Mouse extra settings",IDC_STATIC,1,219,393,68\r
-    RTEXT           "Mouse speed:",IDC_STATIC,19,237,82,10,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_INPUTSPEEDM,115,237,25,13,ES_NUMBER\r
-    CONTROL         "Magic Mouse",IDC_PORT_MOUSETRICK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,235,160,11\r
-    RTEXT           "Magic Mouse cursor mode:",IDC_STATIC,45,254,138,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_PORT_TABLET_CURSOR,195,251,119,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Install virtual mouse driver",IDC_PORT_TABLET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,48,270,136,11\r
-    CONTROL         "Full tablet input emulation",IDC_PORT_TABLET_FULL,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,270,160,11\r
-END\r
-\r
-IDD_CONTRIBUTORS DIALOGEX 0, 0, 411, 242\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION\r
-CAPTION "UAE Authors and Contributors..."\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    DEFPUSHBUTTON   "Ok",ID_OK,177,224,53,14\r
-    CONTROL         "",IDC_CONTRIBUTORS,"RICHEDIT",TCS_HOTTRACK | TCS_VERTICAL | TCS_RAGGEDRIGHT | TCS_OWNERDRAWFIXED | TCS_MULTISELECT | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,4,5,404,214\r
-END\r
-\r
-IDD_ABOUT DIALOGEX 0, 0, 345, 258\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    CONTROL         "",IDC_RICHEDIT1,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,65,10,210,35\r
-    CONTROL         "",IDC_RICHEDIT2,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,1,58,343,28\r
-    PUSHBUTTON      "Contributors",IDC_CONTRIBUTORS,132,100,80,15\r
-    CONTROL         "",IDC_UAEHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,2,196,112,24\r
-    CONTROL         "",IDC_PICASSOHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | NOT WS_VISIBLE | WS_DISABLED,211,131,112,24\r
-    CONTROL         "",IDC_AMIGAHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,116,168,112,24\r
-    CONTROL         "",IDC_WINUAEHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,231,168,112,24\r
-    CONTROL         "",IDC_AIABHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | NOT WS_VISIBLE | WS_DISABLED,22,131,112,24\r
-    CONTROL         "",IDC_THEROOTS,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,117,225,112,24\r
-    CONTROL         "",IDC_CAPS,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,231,196,112,24\r
-    CONTROL         "",IDC_ABIME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,117,196,112,24\r
-    CONTROL         "",IDC_CLOANTOHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,2,168,112,24\r
-    CONTROL         "",IDC_AMIGASYS,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,2,225,112,24\r
-    CONTROL         "",IDC_AMIKIT,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,231,225,112,24\r
-END\r
-\r
-IDD_MISC1 DIALOGEX 0, 0, 396, 318\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    CONTROL         "",IDC_MISCLIST,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,3,5,258,232\r
-    GROUPBOX        "Miscellaneous Options",IDC_STATIC,266,2,128,138\r
-    CTEXT           "SCSI and CD/DVD access:",IDC_STATIC,272,14,117,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_SCSIMODE,287,28,87,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    CTEXT           "Windowed style:",IDC_STATIC,272,45,117,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_WINDOWEDMODE,287,59,87,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CTEXT           "Graphics API:",IDC_STATIC,272,76,117,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_DXMODE,287,89,87,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CTEXT           "DirectDraw:",IDC_STATIC,272,106,117,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_DD_SURFACETYPE,287,119,87,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "GUI",IDC_STATIC,266,144,128,93\r
-    CTEXT           "Language:",IDC_STATIC,271,154,117,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_LANGUAGE,273,168,114,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "GUI Font...",IDC_GUI_FONT,272,185,54,14\r
-    PUSHBUTTON      "List Font...",IDC_GUI_LISTFONT,333,185,54,14\r
-    PUSHBUTTON      "Set default",IDC_GUI_DEFAULT,272,204,54,14\r
-    COMBOBOX        IDC_GUI_SIZE,333,205,54,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Resizeable GUI",IDC_GUI_RESIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,273,222,114,11\r
-    GROUPBOX        "State Files",IDC_STATIC,1,242,393,38\r
-    EDITTEXT        IDC_STATENAME,8,257,231,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP\r
-    CONTROL         "",IDC_STATECLEAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,244,261,9,10\r
-    PUSHBUTTON      "Load state...",IDC_DOLOADSTATE,257,257,65,14\r
-    PUSHBUTTON      "Save state...",IDC_DOSAVESTATE,325,257,65,14\r
-    GROUPBOX        "Keyboard LEDs",IDC_STATIC,1,282,393,34\r
-    COMBOBOX        IDC_KBLED1,10,295,64,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_KBLED2,97,295,64,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_KBLED3,184,295,64,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "USB mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,296,64,11\r
-END\r
-\r
-IDD_HARDFILE DIALOGEX 0, 0, 396, 263\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
-EXSTYLE WS_EX_ACCEPTFILES\r
-CAPTION "Hardfile Settings"\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    GROUPBOX        "Settings",IDC_STATIC,2,2,392,164\r
-    RTEXT           "Path:",IDC_HARDFILE_DIR_TEXT,25,18,22,10\r
-    EDITTEXT        IDC_PATH_NAME,52,15,325,15,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_SELECTOR,380,14,11,15\r
-    RTEXT           "FileSys:",IDC_HARDFILE_FILESYS_TEXT,13,38,34,10\r
-    EDITTEXT        IDC_PATH_FILESYS,52,35,325,15,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_FILESYS_SELECTOR,380,34,11,15\r
-    RTEXT           "Device:",IDC_HARDFILE_DEVICE_TEXT,16,58,31,10\r
-    EDITTEXT        IDC_HARDFILE_DEVICE,52,55,121,15,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "Enable RDB mode",IDC_HDF_RDB,285,55,92,14\r
-    CONTROL         "Read/write",IDC_HDF_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,74,67,10\r
-    CONTROL         "Bootable",IDC_HDF_AUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,136,74,67,10\r
-    CONTROL         "Do not mount",IDC_HDF_DONOTMOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,217,74,67,10\r
-    RTEXT           "Boot priority:",IDC_HARDFILE_BOOTPRI_TEXT,26,94,78,10\r
-    EDITTEXT        IDC_HARDFILE_BOOTPRI,109,90,44,15\r
-    RTEXT           "Surfaces:",IDC_SURFACES_TEXT,160,94,48,10\r
-    EDITTEXT        IDC_HEADS,213,90,40,15,ES_NUMBER\r
-    RTEXT           "Reserved:",IDC_RESERVED_TEXT,262,94,50,10\r
-    EDITTEXT        IDC_RESERVED,317,90,40,15,ES_NUMBER\r
-    RTEXT           "HD Controller:",IDC_STATIC,26,113,78,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_HDF_CONTROLLER,109,112,44,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Sectors:",IDC_SECTORS_TEXT,160,113,48,10\r
-    EDITTEXT        IDC_SECTORS,213,111,40,15,ES_NUMBER\r
-    RTEXT           "Block size:",IDC_BLOCKSIZE_TEXT,261,113,50,10\r
-    EDITTEXT        IDC_BLOCKSIZE,317,111,40,15,ES_NUMBER\r
-    EDITTEXT        IDC_HDFINFO,5,131,385,12,ES_CENTER | ES_READONLY\r
-    GROUPBOX        "New hard disk image file",IDC_STATIC,2,171,392,62\r
-    PUSHBUTTON      "Create",IDC_HF_CREATE,58,187,80,14\r
-    COMBOBOX        IDC_HF_TYPE,58,211,80,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    EDITTEXT        IDC_HF_SIZE,154,187,61,15,ES_NUMBER\r
-    LTEXT           "MB",IDC_STATIC,220,190,53,10,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_HF_DOSTYPE,154,210,61,15\r
-    LTEXT           "DOS type",IDC_STATIC,222,212,51,10,SS_CENTERIMAGE\r
-    CONTROL         "Sparse file",IDC_HF_SPARSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,196,87,10\r
-    CONTROL         "Dynamic HDF",IDC_HF_DYNAMIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,208,87,10\r
-    PUSHBUTTON      "OK",IDOK,147,242,50,14\r
-    PUSHBUTTON      "Cancel",IDCANCEL,203,242,50,14\r
-    EDITTEXT        IDC_HDFINFO2,5,147,385,12,ES_CENTER | ES_READONLY\r
-END\r
-\r
-IDD_FILESYS DIALOGEX 15, 25, 396, 111\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
-CAPTION "Volume Settings"\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    RTEXT           "Device name:",-1,4,7,65,10\r
-    EDITTEXT        IDC_VOLUME_DEVICE,73,5,104,15,ES_AUTOHSCROLL\r
-    RTEXT           "Volume label:",-1,6,28,63,10\r
-    EDITTEXT        IDC_VOLUME_NAME,73,25,104,15,ES_AUTOHSCROLL\r
-    RTEXT           "Path:",-1,5,49,64,10\r
-    EDITTEXT        IDC_PATH_NAME,73,45,315,17,ES_AUTOHSCROLL\r
-    CONTROL         "Read/write",IDC_FS_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,259,7,67,10\r
-    CONTROL         "Bootable",IDC_FS_AUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,336,7,56,10\r
-    RTEXT           "Boot priority:",IDC_VOLUME_BOOTPRI_TEXT,276,28,49,8\r
-    EDITTEXT        IDC_VOLUME_BOOTPRI,336,25,30,15\r
-    PUSHBUTTON      "Select Directory",IDC_FS_SELECT_DIR,72,66,123,15\r
-    PUSHBUTTON      "Select Archive or Plain File",IDC_FS_SELECT_FILE,197,66,123,15\r
-    PUSHBUTTON      "OK",IDOK,72,90,62,15\r
-    PUSHBUTTON      "Cancel",IDCANCEL,138,90,62,15\r
-    PUSHBUTTON      "Eject",IDC_FS_SELECT_EJECT,258,90,62,15\r
-END\r
-\r
-IDD_SETINFO DIALOGEX 0, 0, 396, 85\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
-CAPTION "Additional Information Settings"\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    RTEXT           "Path:",-1,5,20,36,15,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_PATH_NAME,46,20,324,15,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_SELECTOR,376,20,10,15\r
-    PUSHBUTTON      "OK",IDOK,146,57,48,15\r
-    PUSHBUTTON      "Cancel",IDCANCEL,201,57,48,15\r
-END\r
-\r
-IDD_CHIPSET DIALOGEX 0, 0, 396, 169\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    GROUPBOX        "Chipset",IDC_STATIC,1,0,212,111\r
-    CONTROL         "OCS [] Original chipset. A1000 and most A500s.",IDC_OCS,\r
-                    "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,15,88,10\r
-    CONTROL         "ECS Agnus [] Enhanced chipset (ECS Agnus chip only). CDTV and later A500 and A2000 hardware revisions.",IDC_ECS_AGNUS,\r
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,14,31,88,10\r
-    CONTROL         "Full ECS [] Full ECS chipset (ECS Agnus and ECS Denise chips). A500+, A600 and A3000.",IDC_ECS,\r
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,14,47,88,10\r
-    CONTROL         "AGA [] Advanced Graphics Architecture chipset. A1200, A4000 and CD32.",IDC_AGA,\r
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,114,15,86,10\r
-    CONTROL         "ECS Denise [] Enhanced chipset (ECS Denise chip only). Normally paired with ECS Agnus.",IDC_ECS_DENISE,\r
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,114,31,86,10\r
-    CONTROL         "NTSC [] North American and Japanese display standard, 60Hz refresh rate. Other countries use PAL (50Hz. display refresh rate)",IDC_NTSC,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,47,86,10\r
-    CONTROL         "Cycle-exact [] The most compatible A500/A1200 emulation mode. Very fast PC recommended.",IDC_CYCLEEXACT,\r
-                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,69,170,10\r
-    RTEXT           "Chipset Extra:",IDC_STATIC,72,89,71,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_CS_EXT,148,90,49,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Options",IDC_STATIC,221,0,173,111\r
-    CONTROL         "Immediate Blitter [] Faster but less compatible blitter emulation.",IDC_BLITIMM,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,234,16,150,10\r
-    CONTROL         "Wait for Blitter [] Compatibility hack for programs that don't wait for the blitter correctly, causing graphics corruption if CPU is too fast.",IDC_BLITWAIT,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,234,29,150,10\r
-    CONTROL         "Genlock connected [] Allow boot sequence to detect genlock. Genlock is not emulated.",IDC_GENLOCK,\r
-                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,234,42,150,10\r
-    CTEXT           "External display hardware:",IDC_STATIC,228,59,117,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_MONITOREMU,238,78,98,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Collision Level",IDC_STATIC,1,116,393,48\r
-    CONTROL         "None [] Collision hardware emulation disabled.",IDC_COLLISION0,\r
-                    "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,47,132,101,10\r
-    CONTROL         "Sprites only [] Emulate only sprite vs. sprite collisions.",IDC_COLLISION1,\r
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,47,147,101,10\r
-    CONTROL         "Sprites and Sprites vs. Playfield [] Recommended collision emulation level.",IDC_COLLISION2,\r
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,182,132,181,10\r
-    CONTROL         "Full [] 100% collision hardware emulation. Only very few games need this option. Slowest.",IDC_COLLISION3,\r
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,182,147,181,10\r
-END\r
-\r
-IDD_CHIPSET2 DIALOGEX 0, 0, 396, 288\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    CONTROL         "Compatible Settings",IDC_CS_COMPATIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,6,234,10\r
-    GROUPBOX        "Battery Backed Up Real Time Clock",IDC_STATIC,1,22,393,31\r
-    CONTROL         "None",IDC_CS_RTC1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,40,36,81,10\r
-    CONTROL         "MSM6242B",IDC_CS_RTC2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,129,36,77,10\r
-    CONTROL         "RF5C01A",IDC_CS_RTC3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,210,36,67,10\r
-    EDITTEXT        IDC_CS_RTCADJUST,279,34,64,13,ES_AUTOHSCROLL\r
-    GROUPBOX        "CIA-A TOD Clock Source",IDC_STATIC,1,56,393,29\r
-    CONTROL         "Vertical Sync",IDC_CS_CIAA_TOD1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,41,68,86,10\r
-    CONTROL         "Power Supply 50Hz",IDC_CS_CIAA_TOD2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,133,68,109,10\r
-    CONTROL         "Power Supply 60Hz",IDC_CS_CIAA_TOD3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,249,68,116,10\r
-    GROUPBOX        "Chipset Features",IDC_STATIC,1,88,393,146\r
-    CONTROL         "CIA ROM Overlay",IDC_CS_CIAOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,102,104,11\r
-    CONTROL         "CD32 CD",IDC_CS_CD32CD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,116,104,11\r
-    CONTROL         "CDTV CD",IDC_CS_CDTVCD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,130,105,11\r
-    CONTROL         "A600/A1200 IDE",IDC_CS_IDE1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,143,104,11\r
-    CONTROL         "ROM Mirror (E0)",IDC_CS_KSMIRROR_E0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,157,104,11\r
-    CONTROL         "KB Reset Warning",IDC_CS_RESETWARNING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,171,104,11\r
-    LTEXT           "A4091/A4000T SCSI not yet implemented.",IDC_STATIC,17,187,247,8,SS_CENTERIMAGE\r
-    CONTROL         "A590/A2091 SCSI",IDC_CS_A2091,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,202,104,11\r
-    CONTROL         "A4091 SCSI",IDC_CS_A4091,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,215,104,11\r
-    CONTROL         "A1000 Boot RAM/ROM",IDC_CS_A1000RAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,102,121,11\r
-    CONTROL         "CD32 C2P",IDC_CS_CD32C2P,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,116,121,11\r
-    CONTROL         "CDTV SRAM",IDC_CS_CDTVRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,129,121,11\r
-    CONTROL         "A4000/A4000T IDE",IDC_CS_IDE2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,143,121,11\r
-    CONTROL         "ROM Mirror (A8)",IDC_CS_KSMIRROR_A8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,157,121,11\r
-    CONTROL         "No-EHB Denise",IDC_CS_NOEHB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,171,121,11\r
-    CONTROL         "A3000 SCSI",IDC_CS_DMAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,202,121,11\r
-    CONTROL         "CDTV SCSI",IDC_CS_CDTVSCSI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,215,121,11\r
-    CONTROL         "DF0: ID Hardware",IDC_CS_DF0IDHW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,102,125,11\r
-    CONTROL         "CD32 NVRAM",IDC_CS_CD32NVRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,116,125,11\r
-    CONTROL         "CDTV SRAM Expansion",IDC_CS_CDTVRAMEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,129,125,11\r
-    CONTROL         "PCMCIA",IDC_CS_PCMCIA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,143,125,11\r
-    CONTROL         "C00000 is Fast RAM",IDC_CS_SLOWISFAST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,157,125,11\r
-    CONTROL         "A1000 Agnus (8361/8367)",IDC_CS_DIPAGNUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,171,125,11\r
-    CONTROL         "A4000T SCSI",IDC_CS_DMAC2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,202,125,11\r
-    CONTROL         "Include host SCSI devices",IDC_CS_SCSIMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,215,125,11\r
-    GROUPBOX        "Chipset Revision",IDC_STATIC,1,236,393,46\r
-    CONTROL         "Ramsey revision:",IDC_CS_RAMSEY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,34,248,97,11\r
-    CONTROL         "Fat Gary revision:",IDC_CS_FATGARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,34,262,97,11\r
-    EDITTEXT        IDC_CS_RAMSEYREV,136,247,45,13,ES_AUTOHSCROLL\r
-    EDITTEXT        IDC_CS_FATGARYREV,136,262,45,13,ES_AUTOHSCROLL\r
-    CONTROL         "Agnus/Alice revision:",IDC_CS_AGNUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,248,107,11\r
-    CONTROL         "Denise/Lisa revision:",IDC_CS_DENISE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,262,107,11\r
-    EDITTEXT        IDC_CS_AGNUSREV,311,247,45,13,ES_AUTOHSCROLL\r
-    EDITTEXT        IDC_CS_DENISEREV,311,262,45,13,ES_AUTOHSCROLL\r
-END\r
-\r
-IDD_AVIOUTPUT DIALOGEX 0, 0, 396, 260\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    GROUPBOX        "Output Properties",IDC_STATIC,1,0,393,123\r
-    EDITTEXT        IDC_AVIOUTPUT_FILETEXT,15,15,342,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_CLIENTEDGE\r
-    PUSHBUTTON      "...",IDC_AVIOUTPUT_FILE,362,15,23,12\r
-    CONTROL         "Audio",IDC_AVIOUTPUT_AUDIO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | BS_FLAT | WS_TABSTOP,15,34,66,14\r
-    CONTROL         "",IDC_AVIOUTPUT_AUDIO_STATIC,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | SS_SUNKEN | WS_GROUP,88,35,298,13\r
-    CONTROL         "Video",IDC_AVIOUTPUT_VIDEO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | BS_FLAT | WS_TABSTOP,15,52,66,14\r
-    CONTROL         "",IDC_AVIOUTPUT_VIDEO_STATIC,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | SS_SUNKEN | WS_GROUP,87,53,298,13\r
-    CONTROL         "Disable frame rate limit",IDC_AVIOUTPUT_FRAMELIMITER,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,72,176,10\r
-    CONTROL         "Capture before filtering",IDC_AVIOUTPUT_ORIGINALSIZE,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,72,171,10\r
-    CONTROL         "Disable sound output",IDC_AVIOUTPUT_NOSOUNDOUTPUT,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,85,176,10\r
-    CONTROL         "Disable sound sync",IDC_AVIOUTPUT_NOSOUNDSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,85,171,10\r
-    CONTROL         "AVI output enabled",IDC_AVIOUTPUT_ACTIVATED,"Button",BS_AUTORADIOBUTTON | BS_PUSHLIKE | BS_FLAT,15,100,144,14\r
-    GROUPBOX        "Ripper",IDC_STATIC,1,126,393,53\r
-    PUSHBUTTON      "Save screenshot",IDC_SCREENSHOT,53,140,87,14\r
-    PUSHBUTTON      "Pro Wizard 1.62",IDC_PROWIZARD,245,140,87,14,WS_DISABLED\r
-    CONTROL         "Take screenshot before filtering",IDC_SCREENSHOT_ORIGINALSIZE,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,161,162,10\r
-    CONTROL         "Sample ripper",IDC_SAMPLERIPPER_ACTIVATED,"Button",BS_AUTORADIOBUTTON | BS_PUSHLIKE | BS_FLAT,245,159,87,14\r
-    GROUPBOX        "Re-recorder",IDC_STATIC,1,182,393,70\r
-    CONTROL         "Play recording",IDC_STATEREC_PLAY,"Button",BS_AUTORADIOBUTTON | BS_PUSHLIKE | BS_FLAT,53,194,87,14\r
-    CONTROL         "Re-recording enabled",IDC_STATEREC_RECORD,"Button",BS_AUTORADIOBUTTON | BS_PUSHLIKE | BS_FLAT,214,194,118,14\r
-    CONTROL         "Automatic replay",IDC_STATEREC_AUTOPLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,217,129,10\r
-    PUSHBUTTON      "Save recording",IDC_STATEREC_SAVE,214,212,118,14\r
-    RTEXT           "Recording rate (seconds):",IDC_STATIC,15,235,121,10,SS_CENTERIMAGE | WS_TABSTOP\r
-    COMBOBOX        IDC_STATEREC_RATE,141,233,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Recording buffers:",IDC_STATIC,195,235,91,10,SS_CENTERIMAGE | WS_TABSTOP\r
-    COMBOBOX        IDC_STATEREC_BUFFERSIZE,291,233,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP\r
-END\r
-\r
-IDD_INPUT DIALOGEX 0, 0, 396, 318\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    COMBOBOX        IDC_INPUTTYPE,5,4,106,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_INPUTDEVICE,116,4,192,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Device enabled",-1,313,6,66,11,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_INPUTDEVICEDISABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,384,7,9,10\r
-    CONTROL         "List1",IDC_INPUTLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,5,22,390,220\r
-    COMBOBOX        IDC_INPUTAMIGACNT,5,248,24,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_INPUTAMIGA,33,248,286,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Test [] Test input mappings.",IDC_INPUTTEST,324,248,34,14\r
-    PUSHBUTTON      "Remap [] Find and remap quickly.",IDC_INPUTREMAP,361,248,34,14\r
-    RTEXT           "Joystick dead zone (%):",-1,5,271,106,10,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_INPUTDEADZONE,116,270,29,12,ES_NUMBER\r
-    RTEXT           "Autofire rate (lines):",-1,5,288,106,10,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_INPUTAUTOFIRERATE,116,286,29,12,ES_NUMBER\r
-    RTEXT           "Digital joy-mouse speed:",-1,147,271,108,10,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_INPUTSPEEDD,260,270,29,12,ES_NUMBER\r
-    RTEXT           "Analog joy-mouse speed:",-1,147,288,108,10,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_INPUTSPEEDA,260,287,29,12,ES_NUMBER\r
-    PUSHBUTTON      "Copy from:",IDC_INPUTCOPY,324,268,70,14\r
-    COMBOBOX        IDC_INPUTCOPYFROM,324,286,70,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Swap 1<>2",IDC_INPUTSWAP,324,303,70,14\r
-END\r
-\r
-IDD_FILTER DIALOGEX 0, 0, 396, 288\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    GROUPBOX        "Filter Settings",-1,1,1,393,146\r
-    COMBOBOX        IDC_FILTERMODE,20,15,188,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_FILTERFILTER,215,15,63,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Reset to defaults",IDC_FILTERDEFAULT,283,15,106,14\r
-    COMBOBOX        IDC_FILTEROVERLAYTYPE,20,36,108,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_FILTEROVERLAY,134,36,145,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_FILTERAUTOSCALE,284,36,104,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Horiz. size:",-1,7,63,81,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_FILTERHZMULT,92,62,35,150,CBS_DROPDOWN | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Slider1",IDC_FILTERHZ,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,147,56,152,19\r
-    EDITTEXT        IDC_FILTERHZV,316,58,42,12,ES_CENTER | ES_READONLY\r
-    RTEXT           "Vert. size:",-1,7,84,81,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_FILTERVZMULT,92,83,35,150,CBS_DROPDOWN | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Slider1",IDC_FILTERVZ,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,147,77,152,19\r
-    EDITTEXT        IDC_FILTERVZV,316,79,42,12,ES_CENTER | ES_READONLY\r
-    RTEXT           "Horiz. position:",-1,5,105,81,10,SS_CENTERIMAGE\r
-    CONTROL         "Slider1",IDC_FILTERHO,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,147,98,151,19\r
-    EDITTEXT        IDC_FILTERHOV,316,100,42,12,ES_CENTER | ES_READONLY\r
-    RTEXT           "Vert. position:",-1,5,125,81,10,SS_CENTERIMAGE\r
-    CONTROL         "Slider1",IDC_FILTERVO,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,147,119,151,19\r
-    EDITTEXT        IDC_FILTERVOV,316,121,42,12,ES_CENTER | ES_READONLY\r
-    GROUPBOX        "Aspect Ratio Correction",-1,1,152,144,89\r
-    COMBOBOX        IDC_FILTERASPECT,14,169,99,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Keep autoscale aspect",IDC_FILTERKEEPAUTOSCALEASPECT,\r
-                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,189,126,11\r
-    CONTROL         "Keep aspect ratio",IDC_FILTERKEEPASPECT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,204,126,11\r
-    COMBOBOX        IDC_FILTERASPECT2,14,220,99,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Extra Settings",-1,154,152,240,89\r
-    COMBOBOX        IDC_FILTERXTRA,177,172,138,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_FILTERSLR,327,172,41,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Slider1",IDC_FILTERXL,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,195,141,19\r
-    EDITTEXT        IDC_FILTERXLV,327,197,41,12,ES_CENTER | ES_READONLY\r
-    GROUPBOX        "Presets",-1,1,245,393,36\r
-    COMBOBOX        IDC_FILTERPRESETS,13,260,183,150,CBS_DROPDOWN | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Load",IDC_FILTERPRESETLOAD,205,259,55,14\r
-    PUSHBUTTON      "Save",IDC_FILTERPRESETSAVE,265,259,55,14\r
-    PUSHBUTTON      "Delete",IDC_FILTERPRESETDELETE,325,259,55,14\r
-END\r
-\r
-IDD_HARDDRIVE DIALOGEX 0, 0, 396, 109\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
-CAPTION "Harddrive Settings"\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    LTEXT           "Hard drive:",IDC_STATIC,7,11,80,10\r
-    COMBOBOX        IDC_HARDDRIVE,49,9,339,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    DEFPUSHBUTTON   "Create hard disk image file",IDC_HARDDRIVE_IMAGE,49,67,115,14\r
-    EDITTEXT        IDC_PATH_NAME,183,67,97,15,ES_AUTOHSCROLL | NOT WS_VISIBLE\r
-    RTEXT           "HD Controller:",IDC_STATIC,12,90,65,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_HDF_CONTROLLER,91,89,61,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Read/write",IDC_HDF_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,172,90,60,10\r
-    DEFPUSHBUTTON   "Add hard drive",IDOK,236,87,73,14\r
-    PUSHBUTTON      "Cancel",IDCANCEL,316,87,73,14\r
-    EDITTEXT        IDC_HDFINFO,5,29,385,12,ES_CENTER | ES_READONLY\r
-    EDITTEXT        IDC_HDFINFO2,5,46,385,12,ES_CENTER | ES_READONLY\r
-END\r
-\r
-IDD_MISC2 DIALOGEX 0, 0, 396, 263\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    GROUPBOX        "When Active",IDC_STATIC,1,7,125,91\r
-    CTEXT           "Run at priority:",IDC_ACTIVE_PRI,10,18,108,10,SS_CENTERIMAGE | WS_TABSTOP\r
-    COMBOBOX        IDC_ACTIVE_PRIORITY,10,33,108,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    CTEXT           "Mouse uncaptured:",IDC_STATIC,10,50,101,15,SS_CENTERIMAGE\r
-    CONTROL         "Pause emulation",IDC_ACTIVE_PAUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,67,109,10\r
-    CONTROL         "Disable sound",IDC_ACTIVE_NOSOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,81,109,10\r
-    GROUPBOX        "When Inactive",IDC_STATIC,133,7,126,90\r
-    CTEXT           "Run at priority:",IDC_INACTIVE_PRI,144,18,107,10,SS_CENTERIMAGE | WS_TABSTOP\r
-    COMBOBOX        IDC_INACTIVE_PRIORITY,144,33,108,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Pause emulation",IDC_INACTIVE_PAUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,67,109,10\r
-    CONTROL         "Disable sound",IDC_INACTIVE_NOSOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,81,109,10\r
-    GROUPBOX        "When Minimized",IDC_STATIC,269,7,125,89\r
-    CTEXT           "Run at priority:",IDC_MINIMIZED_PRI,278,19,109,10,SS_CENTERIMAGE | WS_TABSTOP\r
-    COMBOBOX        IDC_MINIMIZED_PRIORITY,278,33,108,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Pause emulation",IDC_MINIMIZED_PAUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,67,108,10\r
-    CONTROL         "Disable sound",IDC_MINIMIZED_NOSOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,81,108,10\r
-    GROUPBOX        "File Extension Associations",IDC_STATIC,0,107,260,155\r
-    CONTROL         "",IDC_ASSOCIATELIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,9,124,238,108\r
-    PUSHBUTTON      "Associate all",IDC_ASSOCIATE_ON,36,240,85,14\r
-    PUSHBUTTON      "Deassociate all",IDC_ASSOCIATE_OFF,125,240,85,14\r
-END\r
-\r
-IDD_DISK DIALOGEX 0, 0, 396, 318\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_CONTROL | DS_CENTER | DS_CENTERMOUSE | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    PUSHBUTTON      "Insert floppy disk image",IDC_DISKLISTINSERT,72,299,121,15\r
-    PUSHBUTTON      "Remove floppy disk image",IDC_DISKLISTREMOVE,202,299,121,15\r
-    COMBOBOX        IDC_DISKTEXT,1,281,393,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "",IDC_DISKLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,4,393,275\r
-END\r
-\r
-IDD_PANEL DIALOGEX 0, 0, 530, 345\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
-EXSTYLE WS_EX_ACCEPTFILES | WS_EX_CONTROLPARENT\r
-CAPTION "WinUAE Properties"\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    CONTROL         "",IDC_PANELTREE,"SysTreeView32",TVS_HASLINES | TVS_SHOWSELALWAYS | TVS_TRACKSELECT | TVS_NOHSCROLL | WS_BORDER | WS_TABSTOP,3,5,110,321,WS_EX_CLIENTEDGE\r
-    GROUPBOX        "",IDC_PANEL_FRAME_OUTER,116,2,409,324\r
-    GROUPBOX        "",IDC_PANEL_FRAME,119,5,402,318,NOT WS_VISIBLE\r
-    PUSHBUTTON      "Reset",IDC_RESETAMIGA,3,328,47,14\r
-    PUSHBUTTON      "Quit",IDC_QUITEMU,55,328,47,14\r
-    PUSHBUTTON      "Restart",IDC_RESTARTEMU,107,328,47,14,NOT WS_VISIBLE\r
-    DEFPUSHBUTTON   "OK",IDOK,375,328,47,14\r
-    PUSHBUTTON      "Cancel",IDCANCEL,427,328,47,14\r
-    PUSHBUTTON      "Help",IDHELP,479,328,47,14,WS_DISABLED\r
-END\r
-\r
-IDD_PATHS DIALOGEX 0, 0, 396, 303\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    LTEXT           "System ROMs:",IDC_PATHS_ROML,3,2,260,8,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_PATHS_ROM,3,13,377,15,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_PATHS_ROMS,384,13,11,15\r
-    LTEXT           "Configuration files:",IDC_PATHS_CONFIGL,3,32,164,8,SS_CENTERIMAGE\r
-    CONTROL         "Cache Configuration files",IDC_PATHS_CONFIGCACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,177,31,197,11\r
-    EDITTEXT        IDC_PATHS_CONFIG,3,44,377,15,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_PATHS_CONFIGS,384,43,11,15\r
-    LTEXT           "Screenshots:",IDC_PATHS_SCREENSHOTL,3,62,260,8,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_PATHS_SCREENSHOT,3,73,377,15,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_PATHS_SCREENSHOTS,384,72,11,15\r
-    LTEXT           "State files:",IDC_PATHS_STATEFILEL,3,91,260,8,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_PATHS_SAVESTATE,3,102,377,15,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_PATHS_SAVESTATES,384,101,11,15\r
-    LTEXT           "Videos:",IDC_PATHS_AVIOUTPUTL,3,120,260,8,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_PATHS_AVIOUTPUT,3,131,377,15,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_PATHS_AVIOUTPUTS,384,130,11,15\r
-    LTEXT           "Saveimages:",IDC_PATHS_SAVEIMAGEL,3,149,260,8,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_PATHS_SAVEIMAGE,3,161,377,15,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_PATHS_SAVEIMAGES,384,160,11,15\r
-    LTEXT           "Rips:",IDC_PATHS_RIPSL,3,179,260,8,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_PATHS_RIP,3,190,377,15,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_PATHS_RIPS,383,189,11,15\r
-    PUSHBUTTON      "Reset to defaults",IDC_PATHS_DEFAULT,2,212,92,14\r
-    PUSHBUTTON      "Rescan ROMs",IDC_ROM_RESCAN,2,229,92,14\r
-    PUSHBUTTON      "Clear disk history",IDC_RESETDISKHISTORY,99,229,92,14\r
-    COMBOBOX        IDC_PATHS_DEFAULTTYPE,99,213,163,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Clear registry",IDC_RESETREGISTRY,302,212,92,14\r
-    CONTROL         "Use relative paths",IDC_PATHS_RELATIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,199,231,189,11\r
-    EDITTEXT        IDC_LOGPATH,7,281,324,13,ES_READONLY\r
-    PUSHBUTTON      "Open [] Open selected file.",IDC_LOGOPEN,337,280,51,14\r
-    COMBOBOX        IDC_LOGSELECT,7,263,169,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Enable full logging (temporary)",IDC_LOGENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,264,140,12\r
-    PUSHBUTTON      "Save All [] Save and open both logs and config file.",IDC_LOGSAVE,337,264,51,14\r
-    GROUPBOX        "Debug logging",IDC_STATIC,1,248,393,53\r
-END\r
-\r
-IDD_QUICKSTART DIALOGEX 0, 0, 396, 262\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    GROUPBOX        "Emulated Hardware",IDC_QUICKSTART_CONFIG,1,0,393,54\r
-    RTEXT           "Model:",IDC_STATIC,5,14,68,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_QUICKSTART_MODEL,77,12,263,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "NTSC [] North American and Japanese display standard, 60Hz refresh rate. Other countries use PAL (50Hz. display refresh rate)",IDC_NTSC,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,347,14,35,12\r
-    RTEXT           "Configuration:",IDC_STATIC,5,33,68,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_QUICKSTART_CONFIGURATION,77,31,310,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Compatibility vs Required CPU Power ",IDC_QUICKSTART_COMPA,1,58,393,33\r
-    RTEXT           "Best compatibility",IDC_STATIC,20,73,98,10,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_QUICKSTART_COMPATIBILITY,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,145,68,115,21\r
-    LTEXT           "Low compatibility",IDC_STATIC,279,74,92,10,SS_CENTERIMAGE\r
-    GROUPBOX        "Host Configuration",IDC_QUICKSTART_HOST,1,96,393,35\r
-    RTEXT           "Configuration:",IDC_STATIC,5,109,68,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_QUICKSTART_HOSTCONFIG,77,107,310,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Emulated Drives",IDC_QUICKSTART_DF,1,135,393,93\r
-    CONTROL         "Floppy drive DF0:",IDC_DF0QENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,148,77,15\r
-    PUSHBUTTON      "Select image file",IDC_DF0QQ,93,148,98,15\r
-    RTEXT           "Write-protected",IDC_DF0WPTEXTQ,196,151,69,10,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_DF0WPQ,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,270,149,10,15\r
-    PUSHBUTTON      "Eject",IDC_EJECT0Q,358,148,30,15\r
-    COMBOBOX        IDC_DF0TEXTQ,9,167,379,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Floppy drive DF1:",IDC_DF1QENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,186,77,15\r
-    PUSHBUTTON      "Select image file",IDC_DF1QQ,93,186,98,15\r
-    RTEXT           "Write-protected",IDC_DF1WPTEXTQ,195,189,69,10,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_DF1WPQ,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,270,185,10,15\r
-    PUSHBUTTON      "Eject",IDC_EJECT1Q,358,186,30,15\r
-    COMBOBOX        IDC_DF1TEXTQ,9,204,379,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Set configuration",IDC_QUICKSTART_SETCONFIG,9,239,88,15,NOT WS_VISIBLE\r
-    GROUPBOX        "Mode",IDC_STATIC,250,231,144,28,BS_LEFT\r
-    CONTROL         "Start in Quickstart mode",IDC_QUICKSTARTMODE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,259,242,131,12\r
-    COMBOBOX        IDC_CD0Q_TYPE,199,187,74,50,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP\r
-END\r
-\r
-IDD_FRONTEND DIALOGEX 0, 0, 420, 242\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    CONTROL         "",IDC_FE_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,6,9,235,124\r
-    GROUPBOX        "",IDC_FE_INFO,249,140,160,95\r
-    GROUPBOX        "",IDC_FE_SCREENSHOT,249,7,160,128\r
-END\r
-\r
-IDD_PROGRESSBAR DIALOGEX 0, 0, 396, 58\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
-CAPTION "Processing..."\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    PUSHBUTTON      "Cancel",IDCANCEL,169,40,58,14\r
-    CONTROL         "",IDC_PROGRESSBAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,19,381,14\r
-    CTEXT           "x",IDC_PROGRESSBAR_TEXT,14,5,368,10,SS_CENTERIMAGE | WS_TABSTOP\r
-END\r
-\r
-IDD_STRINGBOX DIALOGEX 0, 0, 396, 209\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
-CAPTION "Enter text..."\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    EDITTEXT        IDC_STRINGBOXEDIT,6,8,383,176,ES_MULTILINE\r
-    DEFPUSHBUTTON   "OK",IDOK,120,190,50,14\r
-    PUSHBUTTON      "Cancel",IDCANCEL,224,190,50,14\r
-END\r
-\r
-IDD_DEBUGGER DIALOGEX 0, 0, 454, 368\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
-EXSTYLE WS_EX_CONTROLPARENT\r
-CAPTION "WinUAE Debugger"\r
-FONT 8, "Courier New", 0, 0, 0x0\r
-BEGIN\r
-    LISTBOX         IDC_DBG_DREG,1,1,52,66,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    LISTBOX         IDC_DBG_AREG,54,1,52,66,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    LISTBOX         IDC_DBG_AMEM,106,1,231,66,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    LISTBOX         IDC_DBG_CCR,338,1,57,42,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    LISTBOX         IDC_DBG_MMISC,396,1,57,42,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    LISTBOX         IDC_DBG_PC,1,68,52,10,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    LISTBOX         IDC_DBG_PREFETCH,54,68,283,10,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    LISTBOX         IDC_DBG_SP_VBR,338,44,115,34,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    EDITTEXT        IDC_DBG_OUTPUT2,1,79,370,262,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | NOT WS_TABSTOP\r
-    PUSHBUTTON      "Set to PC",IDC_DBG_MEMTOPC,38,79,45,12,NOT WS_TABSTOP\r
-    CONTROL         "Auto set",IDC_DBG_AUTOSET,"Button",BS_AUTOCHECKBOX,84,79,50,12\r
-    LISTBOX         IDC_DBG_MCUSTOM,372,79,81,138,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    LISTBOX         IDC_DBG_MEM,1,92,370,249,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    LISTBOX         IDC_DBG_MEM2,1,167,370,87,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    LISTBOX         IDC_DBG_FPREG,372,218,81,66,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    EDITTEXT        IDC_DBG_OUTPUT1,1,255,370,86,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | NOT WS_TABSTOP\r
-    LISTBOX         IDC_DBG_FPSR,372,285,81,34,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    LISTBOX         IDC_DBG_MISCCPU,372,320,81,34,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    EDITTEXT        IDC_DBG_INPUT,1,342,354,12,ES_AUTOHSCROLL | ES_WANTRETURN\r
-    PUSHBUTTON      "?",IDC_DBG_HELP,356,342,15,12,NOT WS_TABSTOP\r
-    CONTROL         "",IDC_DBG_STATUS,"msctls_statusbar32",0x103,0,355,453,12\r
-    LISTBOX         IDC_DBG_DASM,1,92,370,249,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-    EDITTEXT        IDC_DBG_MEMINPUT,1,79,36,12,ES_AUTOHSCROLL | ES_WANTRETURN\r
-    LISTBOX         IDC_DBG_BRKPTS,1,79,370,262,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL\r
-    LISTBOX         IDC_DBG_MISC,1,79,370,262,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL\r
-    LISTBOX         IDC_DBG_CUSTOM,1,79,370,262,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL\r
-    LISTBOX         IDC_DBG_DASM2,1,79,370,87,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT\r
-END\r
-\r
-IDD_DBGMEMINPUT DIALOGEX 0, 0, 150, 58\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
-CAPTION "Enter address..."\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    DEFPUSHBUTTON   "OK",IDOK,15,39,50,14\r
-    PUSHBUTTON      "Cancel",IDCANCEL,75,39,50,14\r
-    EDITTEXT        IDC_DBG_MEMINPUT2,20,12,100,14,ES_AUTOHSCROLL | ES_WANTRETURN\r
-    CTEXT           "Enter address",IDC_DBG_ADDRINPUTTXT,20,1,100,10,SS_CENTERIMAGE | WS_TABSTOP\r
-END\r
-\r
-IDD_EXPANSION DIALOGEX 0, 0, 396, 278\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    GROUPBOX        "RTG Graphics Card",IDC_STATIC,1,0,393,189\r
-    COMBOBOX        IDC_RTG_Z2Z3,26,14,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Memory: [] Graphics card memory. Required for RTG (Picasso96) emulation.",IDC_GFXCARDTEXT,2,35,76,10,SS_NOTIFY | SS_CENTERIMAGE\r
-    CONTROL         "",IDC_P96MEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,88,31,60,20\r
-    EDITTEXT        IDC_P96RAM,152,34,40,12,ES_CENTER | ES_READONLY\r
-    CONTROL         "Match host and RTG color depth if possible",IDC_RTG_MATCH_DEPTH,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,54,212,10\r
-    CONTROL         "Scale if smaller than display size setting",IDC_RTG_SCALE,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,67,212,10\r
-    CONTROL         "Always scale in windowed mode",IDC_RTG_SCALE_ALLOW,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,80,212,10\r
-    CONTROL         "Hardware vertical blank interrupt",IDC_RTG_VBINTERRUPT,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,93,212,10\r
-    CONTROL         "Hardware sprite emulation",IDC_RTG_HWSPRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,107,212,10\r
-    CTEXT           "Color modes:",IDC_STATIC,295,9,83,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_RTG_8BIT,296,23,82,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_RTG_16BIT,296,40,82,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_RTG_24BIT,296,58,82,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_RTG_32BIT,296,75,82,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    COMBOBOX        IDC_RTG_DISPLAYSELECT,11,125,371,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CTEXT           "Refresh rate:",IDC_STATIC,30,149,83,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_RTG_VBLANKRATE,29,162,84,150,CBS_DROPDOWN | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CTEXT           "Buffer mode:",IDC_STATIC,154,149,83,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_RTG_BUFFERCNT,153,162,84,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CTEXT           "Aspect ratio:",IDC_STATIC,282,149,83,10,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_RTG_SCALE_ASPECTRATIO,282,162,84,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Miscellaneous Expansions",IDC_STATIC,1,197,172,80\r
-    CONTROL         "Catweasel Z2 emulation [] Catweasel MK2 Zorro II card emulation. Physical Windows compatible Catweasel card and drivers required.",IDC_CATWEASEL,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,216,147,11\r
-    CONTROL         "uaescsi.device",IDC_SCSIDEVICE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,229,147,11\r
-    GROUPBOX        "Network",IDC_STATIC,181,197,213,80\r
-    CONTROL         "bsdsocket.library [] bsdsocket network library emulation.",IDC_SOCKETS,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,216,187,11\r
-    CONTROL         "uaenet.device [] Sana 2 compatible network device emulation. WinPcap required.",IDC_SANA2,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,229,187,11\r
-    CONTROL         "A2065 Z2 [] A2065 Ethernet Zorro II card emulation. WinPcap required.",IDC_A2065,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,242,187,11\r
-    COMBOBOX        IDC_NETDEVICE,202,257,156,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-END\r
-\r
-IDD_INPUTMAP DIALOGEX 0, 0, 396, 318\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
-FONT 8, "MS Sans Serif", 0, 0, 0x1\r
-BEGIN\r
-    CONTROL         "",IDC_INPUTMAPLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,1,393,268\r
-    EDITTEXT        IDC_INPUTMAPOUT,1,272,393,14,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED\r
-    EDITTEXT        IDC_INPUTMAPOUTM,1,288,393,29,ES_MULTILINE | ES_READONLY | WS_DISABLED\r
-END\r
-\r
-IDD_INFOBOX DIALOGEX 0, 0, 420, 68\r
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
-CAPTION "Scanning ROM image files..."\r
-FONT 8, "MS Sans Serif", 0, 0, 0x0\r
-BEGIN\r
-    DEFPUSHBUTTON   "OK",IDOK,147,51,58,14,NOT WS_VISIBLE\r
-    PUSHBUTTON      "Cancel",IDCANCEL,214,51,58,14\r
-    CTEXT           "",IDC_INFOBOX_TEXT1,4,7,412,11,SS_CENTERIMAGE | SS_SUNKEN | WS_TABSTOP\r
-    CTEXT           "",IDC_INFOBOX_TEXT2,4,21,412,11,SS_CENTERIMAGE | SS_SUNKEN | WS_TABSTOP\r
-    CTEXT           "",IDC_INFOBOX_TEXT3,4,35,412,11,SS_CENTERIMAGE | SS_SUNKEN | WS_TABSTOP\r
-END\r
-\r
-IDD_LIST DIALOGEX 0, 0, 316, 206\r
-STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
-CAPTION "Select Qualifiers"\r
-FONT 8, "MS Shell Dlg", 400, 0, 0x1\r
-BEGIN\r
-    DEFPUSHBUTTON   "OK",IDOK,205,185,50,14\r
-    PUSHBUTTON      "Cancel",IDCANCEL,259,185,50,14\r
-    DEFPUSHBUTTON   "Clear",IDC_LISTDIALOG_CLEAR,6,185,50,14\r
-    CONTROL         "",IDC_LISTDIALOG_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,302,171\r
-END\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Version\r
-//\r
-\r
-VS_VERSION_INFO VERSIONINFO\r
- FILEVERSION 2,5,1,0\r
- PRODUCTVERSION 2,5,1,0\r
- FILEFLAGSMASK 0x3fL\r
-#ifdef _DEBUG\r
- FILEFLAGS 0x1L\r
-#else\r
- FILEFLAGS 0x0L\r
-#endif\r
- FILEOS 0x40004L\r
- FILETYPE 0x1L\r
- FILESUBTYPE 0x0L\r
-BEGIN\r
-    BLOCK "StringFileInfo"\r
-    BEGIN\r
-        BLOCK "040904b0"\r
-        BEGIN\r
-            VALUE "FileDescription", "WinUAE"\r
-            VALUE "FileVersion", "2.5.1.0"\r
-            VALUE "InternalName", "WinUAE"\r
-            VALUE "LegalCopyright", "© 1996-2012 under the GNU Public License (GPL)"\r
-            VALUE "OriginalFilename", "WinUAE.exe"\r
-            VALUE "ProductName", "WinUAE"\r
-            VALUE "ProductVersion", "2.5.1.0"\r
-        END\r
-    END\r
-    BLOCK "VarFileInfo"\r
-    BEGIN\r
-        VALUE "Translation", 0x409, 1200\r
-    END\r
-END\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Cursor\r
-//\r
-\r
-IDC_MYHAND              CURSOR                  "H_arrow.cur"\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Menu\r
-//\r
-\r
-IDM_SYSTRAY MENU\r
-BEGIN\r
-    POPUP "Menu"\r
-    BEGIN\r
-        MENUITEM "Configuration",               ID_ST_CONFIGURATION\r
-        POPUP "Floppy drives"\r
-        BEGIN\r
-            MENUITEM "Eject all drives",            ID_ST_EJECTALL\r
-            MENUITEM "DF0:",                        ID_ST_DF0\r
-            MENUITEM "DF1:",                        ID_ST_DF1\r
-            MENUITEM "DF2:",                        ID_ST_DF2\r
-            MENUITEM "DF3:",                        ID_ST_DF3\r
-        END\r
-        POPUP "CD drives"\r
-        BEGIN\r
-            MENUITEM "Eject",                       ID_ST_CDEJECTALL\r
-            MENUITEM "CD",                          ID_ST_CD0\r
-        END\r
-        MENUITEM "Reset",                       ID_ST_RESET\r
-        MENUITEM "Help",                        ID_ST_HELP\r
-        MENUITEM "Quit WinUAE",                 ID_ST_QUIT\r
-    END\r
-END\r
-\r
-IDM_DBGCONTEXTMENU MENU\r
-BEGIN\r
-    POPUP "Inactive"\r
-    BEGIN\r
-        POPUP "Copy"\r
-        BEGIN\r
-            MENUITEM "Copy line",                   ID_DBG_COPYLBLINE\r
-            MENUITEM "Copy all",                    ID_DBG_COPYLB\r
-        END\r
-    END\r
-    POPUP "Memory"\r
-    BEGIN\r
-        POPUP "Copy"\r
-        BEGIN\r
-            MENUITEM "Copy line",                   ID_DBG_COPYLBLINE\r
-            MENUITEM "Copy all",                    ID_DBG_COPYLB\r
-        END\r
-        POPUP "Set top address"\r
-        BEGIN\r
-            MENUITEM "Set to A0",                   ID_DBG_SETTOA0\r
-            MENUITEM "Set to A1",                   ID_DBG_SETTOA1\r
-            MENUITEM "Set to A2",                   ID_DBG_SETTOA2\r
-            MENUITEM "Set to A3",                   ID_DBG_SETTOA3\r
-            MENUITEM "Set to A4",                   ID_DBG_SETTOA4\r
-            MENUITEM "Set to A5",                   ID_DBG_SETTOA5\r
-            MENUITEM "Set to A6",                   ID_DBG_SETTOA6\r
-            MENUITEM "Set to A7",                   ID_DBG_SETTOA7\r
-            MENUITEM "Enter address",               ID_DBG_ENTERADDR\r
-        END\r
-    END\r
-    POPUP "Disassembly"\r
-    BEGIN\r
-        POPUP "Copy"\r
-        BEGIN\r
-            MENUITEM "Copy line",                   ID_DBG_COPYLBLINE\r
-            MENUITEM "Copy all",                    ID_DBG_COPYLB\r
-        END\r
-        POPUP "Breakpoints"\r
-        BEGIN\r
-            MENUITEM "Toggle breakpoint",           ID_DBG_TOGGLEBP\r
-            MENUITEM "Clear all breakpoints",       ID_DBG_DELETEBPS\r
-        END\r
-        POPUP "Set top address"\r
-        BEGIN\r
-            MENUITEM "Set to PC",                   ID_DBG_SETTOPC\r
-            MENUITEM "Enter address",               ID_DBG_ENTERADDR\r
-        END\r
-    END\r
-END\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// WAVE\r
-//\r
-\r
-IDR_DRIVE_STARTUP_A500_1 WAVE                    "drive_startup.wav"\r
-IDR_DRIVE_CLICK_A500_1  WAVE                    "drive_click.wav"\r
-IDR_DRIVE_SPIN_A500_1   WAVE                    "drive_spin.wav"\r
-IDR_DRIVE_SNATCH_A500_1 WAVE                    "drive_snatch.wav"\r
-IDR_DRIVE_SPINND_A500_1 WAVE                    "drive_spinnd.wav"\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Bitmap\r
-//\r
-\r
-IDB_XARCADE             BITMAP                  "xarcade-winuae.bmp"\r
-IDB_LCD160X43           BITMAP                  "lcd.bmp"\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// DESIGNINFO\r
-//\r
-\r
-#ifdef APSTUDIO_INVOKED\r
-GUIDELINES DESIGNINFO\r
-BEGIN\r
-    IDD_KICKSTART, DIALOG\r
-    BEGIN\r
-        BOTTOMMARGIN, 214\r
-    END\r
-\r
-    IDD_DISPLAY, DIALOG\r
-    BEGIN\r
-        BOTTOMMARGIN, 270\r
-    END\r
-\r
-    IDD_MEMORY, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_CPU, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_FLOPPY, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_HARDDISK, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_SOUND, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_LOADSAVE, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_IOPORTS, DIALOG\r
-    BEGIN\r
-        BOTTOMMARGIN, 293\r
-    END\r
-\r
-    IDD_GAMEPORTS, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_CONTRIBUTORS, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_ABOUT, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_MISC1, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_HARDFILE, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_FILESYS, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_SETINFO, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_CHIPSET, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_CHIPSET2, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_AVIOUTPUT, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_INPUT, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_FILTER, DIALOG\r
-    BEGIN\r
-        BOTTOMMARGIN, 286\r
-    END\r
-\r
-    IDD_HARDDRIVE, DIALOG\r
-    BEGIN\r
-        BOTTOMMARGIN, 108\r
-    END\r
-\r
-    IDD_MISC2, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_DISK, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_PANEL, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_PATHS, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_QUICKSTART, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_FRONTEND, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_PROGRESSBAR, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_STRINGBOX, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_DEBUGGER, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_DBGMEMINPUT, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_EXPANSION, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_INPUTMAP, DIALOG\r
-    BEGIN\r
-        TOPMARGIN, 1\r
-    END\r
-\r
-    IDD_INFOBOX, DIALOG\r
-    BEGIN\r
-    END\r
-\r
-    IDD_LIST, DIALOG\r
-    BEGIN\r
-        LEFTMARGIN, 7\r
-        RIGHTMARGIN, 309\r
-        TOPMARGIN, 7\r
-        BOTTOMMARGIN, 199\r
-    END\r
-END\r
-#endif    // APSTUDIO_INVOKED\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// String Table\r
-//\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_KICKSTART           "ROM"\r
-    IDS_DISK                "Disk swapper"\r
-    IDS_DISPLAY             "Display"\r
-    IDS_HARDDISK            "Hard drives"\r
-    IDS_FLOPPY              "Floppy drives"\r
-    IDS_ABOUT               "About"\r
-    IDS_LOADSAVE            "Configurations"\r
-    IDS_AVIOUTPUT           "Output"\r
-    IDS_IOPORTS             "IO ports"\r
-    IDS_MISC1               "Miscellaneous"\r
-    IDS_MEMORY              "RAM"\r
-    IDS_CPU                 "CPU and FPU"\r
-    IDS_CHIPSET             "Chipset"\r
-    IDS_INPUT               "Input"\r
-    IDS_FILTER              "Filter"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_MISC2               "Pri. & Extensions"\r
-    IDS_PATHS               "Paths"\r
-    IDS_QUICKSTART          "Quickstart"\r
-    IDS_FRONTEND            "Frontend"\r
-    IDS_CHIPSET2            "Adv. Chipset"\r
-    IDS_GAMEPORTS           "Game ports"\r
-    IDS_EXPANSION           "Expansions"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_EXTTEXT             "Floppy disk image files"\r
-    IDS_EXTACTUAL           "ADF"\r
-    IDS_SOUND               "Sound"\r
-    IDS_CDROM               "CD-ROM"\r
-    IDS_FRAMERATE           "Every %1Frame"\r
-    IDS_SECOND              "second "\r
-    IDS_THIRD               "third "\r
-    IDS_FOURTH              "fourth "\r
-    IDS_FIFTH               "fifth "\r
-    IDS_SIXTH               "sixth "\r
-    IDS_SEVENTH             "seventh "\r
-    IDS_EIGHTH              "eighth "\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_NINTH               "ninth "\r
-    IDS_TENTH               "tenth "\r
-    IDS_SELECTADF           "Select a floppy disk image file..."\r
-    IDS_ADF                 "Floppy disk image files"\r
-    IDS_CHOOSEBLANK         "Choose a blank floppy disk image file..."\r
-    IDS_SELECTHDF           "Select a hard disk image file..."\r
-    IDS_HDF                 "Hard disk image files"\r
-    IDS_SELECTUAE           "Select a WinUAE configuration file..."\r
-    IDS_UAE                 "WinUAE configuration files"\r
-    IDS_SELECTROM           "Select a system ROM file..."\r
-    IDS_ROM                 "System ROM files"\r
-    IDS_SELECTKEY           "Select a system ROM key file..."\r
-    IDS_KEY                 "System ROM key files"\r
-    IDS_SELECTINFO          "Select information for your configuration..."\r
-    IDS_NONE                "none"\r
-    IDS_VOLUME              "Volume"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_SELECTFILESYSROOT   "Please select the root directory of the file system..."\r
-    IDS_DEFAULTMIDIOUT      "Default MIDI-Out Device"\r
-    IDS_CONTRIBUTORS1       "Bernd Schmidt - The Grand-Master\nSam Jordan - Custom-chip, floppy-DMA, etc.\nMathias Ortmann - Original WinUAE Main Guy, BSD Socket support\nBrian King - Picasso96 Support, Integrated GUI for WinUAE, previous WinUAE Main Guy\nToni Wilen - Core updates, WinUAE Main Guy\nGustavo Goedert/Peter Remmers/Michael Sontheimer/Tomi Hakala/Tim Gunn/Nemo Pohle - DOS Port Stuff\nSamuel Devulder/Olaf Barthel/Sam Jordan - Amiga Ports\nKrister Bergman - XFree86 and OS/2 Port\nA. Blanchard/Ernesto Corvi - MacOS Port\nChristian Bauer - BeOS Port\nIan Stephenson - NextStep Port\nPeter Teichmann - Acorn/RiscOS Port\nStefan Reinauer - ZorroII/III AutoConfig, Serial Support\nChristian Schmitt/Chris Hames - Serial Support\nHerman ten Brugge - 68020/68881 Emulation Code\nTauno Taipaleenmaki - Various UAE-Control/UAE-Library Support\nBrett Eden/Tim Gunn/Paolo Besser/Nemo Pohle - Various Docs and Web-Sites\nGeorg Veichtlbauer - Help File coordinator, German GUI\nFulvio Leonardi - Italian translator for WinUAE\n"\r
-    IDS_CONTRIBUTORS2       "Arnljot Arntsen, Bill Panagouleas, Cloanto - Hardware support\nSpecial thanks to Alexander Kneer and Tobias Abt (The Picasso96 Team)\nSteven Weiser  - Postscript printing emulation idea and testing.\nPéter Tóth /Balázs Rátkai/Iván Herczeg/András Arató - Hungarian translation.\nKarsten Bock, Gavin Fance, Dirk Trowe and Christian Schindler - Freezer cartridge hardware support.\nMikko Nieminen - Demo compatibility testing.\nArabuusimiehet - [This information is on a need-to-know basis]"\r
-    IDS_INVALIDPRTPORT      "The printer you have in this configuration is not valid on this machine.\n"\r
-    IDS_RESTOREUSS          "Restore a WinUAE snapshot file"\r
-    IDS_USS                 "WinUAE snapshot files"\r
-    IDS_SELECTFLASH         "Select a flash or battery-backed RAM file..."\r
-    IDS_FLASH               "WinUAE flash or battery-backed RAM file"\r
-    IDS_INPUTHOSTWIDGET     "Input source"\r
-    IDS_INPUTAMIGAEVENT     "Input target"\r
-    IDS_INPUTAUTOFIRE       "Autofire"\r
-    IDS_SAVEUSS             "Save a WinUAE snapshot file"\r
-    IDS_MIDIOVERFLOW        "Sysexbuffer overflow. Should not happen."\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_PATH                "Path"\r
-    IDS_RW                  "R/W"\r
-    IDS_SECTORS             "Sectors"\r
-    IDS_SURFACES            "Surfaces"\r
-    IDS_RESERVED            "Reserved"\r
-    IDS_BLOCKSIZE           "Block size"\r
-    IDS_NAME                "Name"\r
-    IDS_DESCRIPTION         "Description"\r
-    IDS_COULDNOTLOADCONFIG  "Could not load the selected configuration!\n"\r
-    IDS_NOHELP              "Online help is disabled because the HTML Help functionality is not installed on this system. HTML Help is available from http://www.microsoft.com/downloads/.\n"\r
-    IDS_MUSTSELECTCONFIG    "You must select a configuration or enter a name before selecting Load...\n"\r
-    IDS_INVALIDCOMPORT      "The serial port you have in this configuration is not valid on this machine.\n"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_HFDSIZE             "Size"\r
-    IDS_DEVICE              "Device"\r
-    IDS_BOOTPRI             "BootPri"\r
-    IDS_FLOPPY_COMPATIBLE   " (compatible)"\r
-    IDS_FLOPPY_TURBO        "Turbo"\r
-    IDS_YES                 "yes"\r
-    IDS_NO                  "no"\r
-    IDS_PRI_ABOVENORMAL     "Above Normal"\r
-    IDS_PRI_NORMAL          "Normal"\r
-    IDS_PRI_BELOWNORMAL     "Below Normal"\r
-    IDS_PRI_LOW             "Low"\r
-    IDS_OLDRTGLIBRARY       "The installed LIBS:Picasso96/rtg.library (%d.%d) should be updated.\nA newer version is included in the ""Amiga Programs"" directory\n of the WinUAE distribution archive.\n\nNewer library version fixes graphics problems and increases performance."\r
-    IDS_DEFAULT_AF          "Amiga Forever"\r
-    IDS_DEFAULT_WINUAE      "WinUAE default (EXE directory)"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_SOUND_STEREO2       "Cloned Stereo (4 Channels)"\r
-    IDS_INPUT_CUSTOMEVENT   "<Custom event>"\r
-    IDS_DEFAULT_NEWWINUAE   "WinUAE default (User directory)"\r
-    IDS_SOUND_CLONED51      "Cloned Stereo (5.1)"\r
-    IDS_SOUND_51            "5.1 Channels"\r
-    IDS_AUTOMATIC           "Automatic"\r
-    IDS_ALL                 "All"\r
-    IDS_INPUTTOGGLE         "Toggle"\r
-    IDS_NETDISCONNECTED     "Cable disconnected"\r
-    IDS_QS_CD               "CD"\r
-    IDS_QS_CD_AUTO          "Autodetect"\r
-    IDS_QS_CD_IMAGE         "Image mode"\r
-    IDS_REMAPTITLE          "Input captured. F12 = Exit. F11 = Skip current event in Remap mode."\r
-    IDS_FILTER_NOOVERLAYS   "No overlays available"\r
-    IDS_STMENUNOCD          "No CD inserted"\r
-    IDS_ON                  "on"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_UNSUPPORTEDPIXELFORMAT \r
-                            "Error: unsupported pixel format. Please use a different screen mode.\n"\r
-    IDS_MUSTENTERNAME       "You must select a configuration or enter a name before selecting Save...\n"\r
-    IDS_MUSTSELECTCONFIGFORDELETE \r
-                            "You must select a configuration or enter a name before selecting Delete...\n"\r
-    IDS_DELETECONFIGCONFIRMATION \r
-                            "Are you sure you want to Delete this configuration?\n"\r
-    IDS_DELETECONFIGTITLE   "Confirm Delete"\r
-    IDS_MUSTSELECTPATH      "You must select a path!"\r
-    IDS_SETTINGSERROR       "Settings error"\r
-    IDS_MUSTSELECTNAME      "You must select a name for the volume!"\r
-    IDS_MUSTSELECTFILE      "You must select a file!"\r
-    IDS_FAILEDHARDFILECREATION "Failed to create hard disk image file..."\r
-    IDS_CREATIONERROR       "Creation error"\r
-    IDS_ERRORTITLE          "WinUAE message"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_INP                 "WinUAE Input Recording"\r
-    IDS_RESTOREINP          "Playback a WinUAE input recording"\r
-    IDS_SAVEINP             "Record a WinUAE input recording"\r
-    IDS_SCREEN_WINDOWED     "Windowed"\r
-    IDS_SCREEN_FULLSCREEN   "Fullscreen"\r
-    IDS_SCREEN_FULLWINDOW   "Full-window"\r
-    IDS_SCREEN_VSYNC        "Legacy VSync"\r
-    IDS_SCREEN_VSYNC_AUTOSWITCH "Legacy VS, 50/60Hz"\r
-    IDS_SOUND_MONO          "Mono"\r
-    IDS_SOUND_MIXED         "Mixed"\r
-    IDS_SOUND_STEREO        "Stereo"\r
-    IDS_DISABLED            "Disabled"\r
-    IDS_SOUND_FILTER_OFF    "Always off"\r
-    IDS_SOUND_FILTER_EMULATED "Emulated (A500)"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_SOUND_FILTER_EMULATED_E "Emulated (A1200)"\r
-    IDS_INPUT_GAMEPORTS     "Game Ports Panel"\r
-    IDS_INPUT_CUSTOM        "Configuration #%d"\r
-    IDS_INPUT_COPY_DEFAULT  "GamePorts"\r
-    IDS_INPUT_COPY_CUSTOM   "Config #%d"\r
-    IDS_3D_NO_FILTER        "Point (%d-bit)"\r
-    IDS_3D_BILINEAR         "Bilinear (%d-bit)"\r
-    IDS_VSYNC_DEFAULT       "Default refresh rate"\r
-    IDS_DRIVESOUND_NONE     "No sound"\r
-    IDS_DRIVESOUND_DEFAULT_A500 "A500 (WinUAE built-in)"\r
-    IDS_AVIOUTPUT_NOCODEC   "no codec selected"\r
-    IDS_DISK_IMAGENAME      "Disk image"\r
-    IDS_DISK_DRIVENAME      "Drive"\r
-    IDS_UNSUPPORTEDSCREENMODE \r
-                            "The selected screen mode can't be displayed in a window, because %s\nSwitching to full-screen display."\r
-    IDS_UNSUPPORTEDSCREENMODE_1 \r
-                            "the desktop is running in an unknown color mode."\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_UNSUPPORTEDSCREENMODE_2 \r
-                            "the desktop is running in 8-bit color depth, which WinUAE can't use in windowed mode."\r
-    IDS_UNSUPPORTEDSCREENMODE_3 \r
-                            "the desktop is too small for the specified window size."\r
-    IDS_UNSUPPORTEDSCREENMODE_4 \r
-                            "you selected an RTG (Picasso96) display with unsupported color depth."\r
-    IDS_FLOPPYTYPE35DD      "3.5"" DD"\r
-    IDS_FLOPPYTYPE35HD      "3.5"" HD"\r
-    IDS_FLOPPYTYPE525SD     "5.25"" SD"\r
-    IDS_FLOPPYTYPEDISABLED  "Disabled"\r
-    IDS_STMENUNOFLOPPY      "No floppy disk inserted"\r
-    IDS_TREEVIEW_HARDWARE   "Hardware"\r
-    IDS_TREEVIEW_HOST       "Host"\r
-    IDS_TREEVIEW_MISC       "Miscellaneous"\r
-    IDS_TREEVIEW_SETTINGS   "Settings"\r
-    IDS_WINUAETITLE_MMB     "[ALT+TAB or middle mouse button untraps mouse - F12 opens settings]"\r
-    IDS_WINUAETITLE_NORMAL  "[ALT+TAB untraps mouse - F12 opens settings]"\r
-    IDS_STARTEMULATION      "Start"\r
-    IDS_TREEVIEW_ABOUT      "About"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_NOHARDDRIVES        "No hard disks detected that were either empty or RDB-partitioned."\r
-    IDS_DEFAULT_HOST        "Default Configuration"\r
-    IDS_SOUND_4CHANNEL      "4 Channels"\r
-    IDS_HF_FS_CUSTOM        "Custom"\r
-    IDS_SELECTFS            "Select file system handler (FastFileSystem, SmartFilesystem, etc.)"\r
-    IDS_KEYJOY              "Keyboard Layout A (Numeric keypad, 0 and 5 = Fire)\nKeyboard Layout B (Cursor keys, Right CTRL and ALT = Fire)\nKeyboard Layout C (W=Up S=Down A=Left D=Right, Left ALT = Fire)\nX-Arcade (Left)\nX-Arcade (Right)"\r
-    IDS_STATEFILE_UNCOMPRESSED "Uncompressed"\r
-    IDS_STATEFILE_RAMDUMP   "RAM dump"\r
-    IDS_STATEFILE_WAVE      "Wave audio dump"\r
-    IDS_SOUND_SWAP_PAULA    "Paula only"\r
-    IDS_SOUND_SWAP_AHI      "AHI only"\r
-    IDS_SOUND_SWAP_BOTH     "Both"\r
-    IDS_SOUND_FILTER_ON_AGA "Always on (A500)"\r
-    IDS_SOUND_FILTER_ON_A500 "Always on (A1200)"\r
-    IDS_DRIVESOUND_PC_FLOPPY "PC floppy drive %c"\r
-    IDS_FLOPPYTYPE35DDESCOM "3.5"" ESCOM"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_NUMSG_NEEDEXT2      "The software uses a non-standard floppy disk format. You may need to use a custom floppy disk image file instead of a standard one. This message will not appear again."\r
-    IDS_NUMSG_NOROMKEY      "Could not find system ROM key file."\r
-    IDS_NUMSG_KSROMCRCERROR "System ROM checksum incorrect. The system ROM image file may be corrupt."\r
-    IDS_NUMSG_KSROMREADERROR "Error while reading system ROM."\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_NUMSG_NOEXTROM      "No extended ROM found."\r
-    IDS_NUMSG_MODRIP_NOTFOUND "No music modules or packed data found."\r
-    IDS_NUMSG_MODRIP_FINISHED "Scan finished."\r
-    IDS_NUMSG_MODRIP_SAVE   "Module/packed data found\n%s\nStart address %08.8X, Size %d bytes\nWould you like to save it?"\r
-    IDS_NUMSG_KS68020       "The selected system ROM requires a 68020 with 32-bit addressing or 68030 or higher CPU."\r
-    IDS_NUMSG_ROMNEED       "One of the following system ROMs is required:\n\n%s\n\nCheck the System ROM path in the Paths panel and click Rescan ROMs."\r
-    IDS_NUMSG_STATEHD       "WARNING: Current configuration is not fully compatible with state saves.\nThis message will not appear again."\r
-    IDS_NUMSG_NOCAPS        "Selected disk image needs the SPS plugin\nwhich is available from\nhttp//www.softpres.org/"\r
-    IDS_NUMSG_OLDCAPS       "You need an updated SPS plugin\nwhich is available from\nhttp//www.softpres.org/"\r
-    IDS_IMGCHK_BOOTBLOCKCRCERROR \r
-                            "The selected floppy disk image is not bootable (boot block checksum error)"\r
-    IDS_IMGCHK_BOOTBLOCKNO  "The selected floppy disk image is not bootable (no boot block)"\r
-    IDS_IMGCHK_DAMAGED      "The selected floppy disk image is damaged or unformatted"\r
-    IDS_IMGCHK_KS2          "The selected floppy disk image requires a 2.04 or later system ROM.\nThe configuration has been updated."\r
-    IDS_IMGCHK_KS3          "The selected floppy disk image requires a 3.0 or later system ROM.\nThe configuration has been updated."\r
-    IDS_ROMSCANEND          "Scan of ROMs finished"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_ROM_AVAILABLE       "available"\r
-    IDS_ROM_UNAVAILABLE     "unavailable"\r
-    IDS_NUMSG_KS68EC020     "The selected system ROM requires a 68020 with 24-bit addressing or higher CPU."\r
-    IDS_ROMSCANNOROMS       "No supported system ROMs detected."\r
-    IDS_NUMSG_KICKREP       "You need to have a floppy disk (image file) in DF0: to use the system ROM replacement."\r
-    IDS_NUMSG_KICKREPNO     "The floppy disk (image file) in DF0: is not compatible with the system ROM replacement functionality."\r
-    IDS_NUMSG_NOROM         "Could not load system ROM, trying system ROM replacement."\r
-    IDS_HDCLONE_OK          "Hard drive image file created succesfully."\r
-    IDS_HDCLONE_FAIL        "Hard drive image file creation failed.\nError code %d:%d."\r
-    IDS_NUMSG_KS68030       "The selected system ROM requires a 68030 CPU."\r
-    IDS_NUMSG_EXPROMNEED    "One of the following expansion boot ROMs is required:\n\n%s\n\nCheck the System ROM path in the Paths panel and click Rescan ROMs."\r
-    IDS_SB_FAVORITENAME     "Enter name..."\r
-    IDS_SB_CUSTOMEVENT      "Enter custom event string.."\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_QS_MODELS           "A500\nA500+\nA600\nA1000\nA1200\nA3000\nA4000\nCD32\nCDTV\nArcadia Multi Select system\nExpanded WinUAE example configuration"\r
-    IDS_QS_MODEL_A500       "1.3 ROM, OCS, 512 KB Chip + 512 KB Slow RAM (most common)\nThis configuration is capable of running most games and demos produced for first-generation hardware. Only few exceptions need a different configuration (e.g. the oldest games tend to be incompatible with this configuration).\n1.3 ROM, ECS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nLater hardware revision of the A500. Nearly 100% compatible with the previous configuration.\n1.3 ROM, ECS Agnus, 1 MB Chip RAM\nFew newer games and demos require this configuration.\n1.3 ROM, OCS Agnus, 512 KB Chip RAM\nVery old (e.g. pre-1988) games and demos may require this configuration.\n1.2 ROM, OCS Agnus, 512 KB Chip RAM\nAs available for the A1000, and installed on the first A500 and A2000 series. Some very old programs only work correctly with this configuration. Note: This system ROM version can only boot from floppy disk (no hard disk boot support).\n1.2 ROM, OCS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nThis configuration adds expansion memory to the first A500 produced. Try this if your game does not work with newer configurations, but works with the previous one. It could add some features to the game, including faster loading times. Note: This system ROM version can only boot from floppy disk (no hard disk boot support)."\r
-    IDS_QS_MODEL_A500P      "Basic non-expanded configuration\nThe A500+ adds an ECS Agnus chip, 1 MB of Chip RAM and a 2.0 ROM to the A500. Many A500 games and demos don't work properly on an A500+.\n2 MB Chip RAM expanded configuration\n\n4 MB Fast RAM expanded configuration\n"\r
-    IDS_QS_MODEL_A600       "Basic non-expanded configuration\nThe A600 is smaller than the A500+ and has an updated 2.0 ROM.\n2 MB Chip RAM expanded configuration\n\n4 MB Fast RAM expanded configuration\n"\r
-    IDS_QS_MODEL_A1000      "512 KB Chip RAM\nThe A1000 was the first model produced, with a configuration equivalent to that of an A500 with OCS chipset. You normally don't need to use this configuration, unless you are nostalgic and would like to hear the short A1000 boot tune\n""ICS"" Denise without EHB support\nVery first A1000 models had Denise without EHB capability.\n256 KB Chip RAM\n Unexpanded A1000. All later A1000 models were sold with a 256 KB RAM expansion built-in."\r
-    IDS_QS_MODEL_A1200      "Basic non-expanded configuration\nUse this configuration to run most AGA demos and games\n4 MB Fast RAM expanded configuration\nSome newer AGA games and demos need an expanded A1200 to run."\r
-    IDS_QS_MODEL_CD32       "CD32\nThe CD32 was one the first 32-bit consoles on the market. It is basically an A1200 with a built-in CD-ROM drive. Insert your CD32 or CDTV CD-ROM into a free CD-ROM drive before starting the emulation.\nCD32 + MPEG Full Motion Video Cartridge (not emulated yet)\n"\r
-    IDS_QS_MODEL_CDTV       "CDTV\nThe CDTV was the first model with a built-in CD-ROM drive. Looking like a black CD player, it featured a configuration equivalent to that of an A500 with 1 MB RAM and an ECS chipset.\nFloppy drive and 64KB SRAM card expanded CDTV\n"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_QS_MODEL_UAE        "High-end expanded configuration"\r
-    IDS_QS_MODEL_ARCADIA    "Arcadia\nArcadia Multi Select system is arcade platform developed by Arcadia and  Mastertronic. It is based on an A500 mainboard with ROM cage attached to expansion port. Arcadia ROM files go to ""Cartridge ROM File"" in ROM-panel."\r
-    IDS_QS_MODEL_A3000      "1.4 ROM, 2MB Chip + 8MB Fast\n\n2.04 ROM, 2MB Chip + 8MB Fast\n\n3.1 ROM, 2MB Chip + 8MB Fast\n"\r
-    IDS_QS_MODEL_A4000      "68030, 3.1 ROM, 2MB Chip + 8MB Fast\n\n68040, 3.1 ROM, 2MB Chip + 8MB Fast\n"\r
-    IDS_QS_MODEL_A4000T     "A4000T (test)\nA4000T"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_FLOPPYTYPE35DDPC    "3.5"" DD (PC)"\r
-    IDS_FLOPPYTYPE35HDPC    "3.5"" HD (PC)"\r
-    IDS_JOYMODE_DEFAULT     "Default"\r
-    IDS_JOYMODE_MOUSE       "Mouse"\r
-    IDS_JOYMODE_JOYSTICK    "Joystick"\r
-    IDS_JOYMODE_JOYSTICKANALOG "Analog joystick"\r
-    IDS_JOYMODE_LIGHTPEN    "Light pen"\r
-    IDS_JOYMODE_MOUSE_CDTV  "CDTV remote mouse"\r
-    IDS_JOYMODE_JOYSTICK_CD32 "CD32 pad"\r
-    IDS_TABLET_BOTH_CURSORS "Show both cursors"\r
-    IDS_TABLET_NATIVE_CURSOR "Show native cursor only"\r
-    IDS_TABLET_HOST_CURSOR  "Show host cursor only"\r
-    IDS_AUTOSCALE_DISABLED  "No scaling"\r
-    IDS_AUTOSCALE_SCALING   "Automatic scaling"\r
-    IDS_AUTOSCALE_RESIZE    "Automatic resize"\r
-    IDS_PRINTER_ASCII       "ASCII-Only"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_PRINTER_EPSON9      "Epson Matrix Printer Emulation, 9pin"\r
-    IDS_PRINTER_POSTSCRIPT_DETECTION "PostScript (Passthrough)"\r
-    IDS_PRINTER_POSTSCRIPT_EMULATION \r
-                            "PostScript (Emulation, GhostScript required)"\r
-    IDS_PRINTER_PASSTHROUGH "Passthrough"\r
-    IDS_RES_LORES           "Lores"\r
-    IDS_RES_HIRES           "Hires (normal)"\r
-    IDS_RES_SUPERHIRES      "SuperHires"\r
-    IDS_PRINTER_EPSON48     "Epson Matrix Printer Emulation, 48pin"\r
-    IDS_SELECTCD            "Select a CD image file..."\r
-    IDS_CD                  "CD image files"\r
-    IDS_BUFFER_SINGLE       "No buffering"\r
-    IDS_BUFFER_DOUBLE       "Double buffering"\r
-    IDS_BUFFER_TRIPLE       "Triple buffering"\r
-    IDS_AUTOSCALE_CENTER    "Automatic center"\r
-    IDS_AUTOSCALE_MAX       "Fullscreen (Max)"\r
-    IDS_AUTOSCALE_TV        "Fullscreen (TV)"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_JOYMODE_GAMEPAD     "Gamepad"\r
-    IDS_AUTOSCALE_DEFAULT   "Default"\r
-    IDS_AUTOSCALE_MANUAL    "Manual"\r
-    IDS_PORT_AUTOFIRE       "Autofire"\r
-    IDS_PORT_AUTOFIRE_TOGGLE "Autofire (toggle)"\r
-    IDS_PORT_AUTOFIRE_ALWAYS "Autofire (always)"\r
-    IDS_PORT_AUTOFIRE_NO    "No autofire"\r
-    IDS_AUTOSCALE_INTEGER   "Integer scaling"\r
-    IDS_SCREEN_VSYNC2_AUTOSWITCH "Low latency VS, 50/60Hz"\r
-    IDS_SCREEN_VSYNC2       "Low latency VSync"\r
-    IDS_SCREEN_VSYNC_NONE   "-"\r
-    IDS_FILTEROVERLAYTYPE_MASKS "Masks"\r
-    IDS_FILTEROVERLAYTYPE_OVERLAYS "Overlays"\r
-    IDS_AUTOSCALE_INTEGER_AUTOSCALE "Auto Integer scaling"\r
-    IDS_WSTYLE_BORDERLESS   "Borderless"\r
-    IDS_WSTYLE_MINIMAL      "Minimal"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_INPUTQUALIFIER      "Qualifiers"\r
-    IDS_GENERIC             "Generic"\r
-    IDS_AUTODETECT          "Autodetect"\r
-END\r
-\r
-STRINGTABLE\r
-BEGIN\r
-    IDS_WSTYLE_STANDARD     "Standard"\r
-    IDS_WSTYLE_EXTENDED     "Extended"\r
-    IDS_MISCLISTITEMS1      "Untrap = middle button\nShow GUI on startup\nUse CTRL-F11 to quit\nDon't show taskbar button\nDon't show notification icon\n"\r
-    IDS_MISCLISTITEMS2      "Always on top\nDisable screensaver\nSynchronize clock\nFaster RTG\nClipboard sharing\nAllow native code\n"\r
-    IDS_MISCLISTITEMS3      "Native on-screen display\nRTG on-screen display\nCreate winuaelog.txt log\nLog illegal memory accesses\nBlank unused displays\nStart mouse uncaptured\nStart minimized\nMinimize when focus is lost\n"\r
-END\r
-\r
-#endif    // English resources\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// Finnish (Finland) resources\r
-\r
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FIN)\r
-LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT\r
-#pragma code_page(1252)\r
-\r
-#ifdef APSTUDIO_INVOKED\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// TEXTINCLUDE\r
-//\r
-\r
-1 TEXTINCLUDE \r
-BEGIN\r
-    "resource.h\0"\r
-END\r
-\r
-3 TEXTINCLUDE \r
-BEGIN\r
-    "\r\0"\r
-END\r
-\r
-2 TEXTINCLUDE \r
-BEGIN\r
-    "#include ""afxres.h""\r\0"\r
-END\r
-\r
-#endif    // APSTUDIO_INVOKED\r
-\r
-#endif    // Finnish (Finland) resources\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-\r
-\r
-#ifndef APSTUDIO_INVOKED\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Generated from the TEXTINCLUDE 3 resource.\r
-//\r
-\r\r
-/////////////////////////////////////////////////////////////////////////////\r
-#endif    // not APSTUDIO_INVOKED\r
-\r
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winres.h"
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
+#pragma code_page(1252)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_APPICON             ICON                    "winuae.ico"
+IDI_FLOPPY              ICON                    "35floppy.ico"
+IDI_ABOUT               ICON                    "amigainfo.ico"
+IDI_HARDDISK            ICON                    "drive.ico"
+IDI_CPU                 ICON                    "cpu.ico"
+IDI_GAMEPORTS           ICON                    "joystick.ico"
+IDI_IOPORTS             ICON                    "joystick.ico"
+IDI_INPUT               ICON                    "joystick.ico"
+IDI_MISC1               ICON                    "misc.ico"
+IDI_MISC2               ICON                    "misc.ico"
+IDI_MOVE_UP             ICON                    "move_up.ico"
+IDI_MOVE_DOWN           ICON                    "move_dow.ico"
+IDI_AVIOUTPUT           ICON                    "avioutput.ico"
+IDI_DISK                ICON                    "drive.ico"
+IDI_FOLDER              ICON                    "folder.ico"
+IDI_SOUND               ICON                    "sound.ico"
+IDI_DISPLAY             ICON                    "screen.ico"
+IDI_ROOT                ICON                    "root.ico"
+IDI_MEMORY              ICON                    "chip.ico"
+IDI_QUICKSTART          ICON                    "quickstart.ico"
+IDI_PATHS               ICON                    "paths.ico"
+IDI_DISKIMAGE           ICON                    "diskimage.ico"
+IDI_PORTS               ICON                    "port.ico"
+IDI_CONFIGFILE          ICON                    "configfile.ico"
+IDI_FILE                ICON                    "file.ico"
+IDI_EXPANSION           ICON                    "expansion.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDR_DBGACCEL ACCELERATORS
+BEGIN
+    VK_F1,          ID_DBG_PAGE1,           VIRTKEY, NOINVERT
+    VK_F2,          ID_DBG_PAGE2,           VIRTKEY, NOINVERT
+    VK_F3,          ID_DBG_PAGE3,           VIRTKEY, NOINVERT
+    VK_F4,          ID_DBG_PAGE4,           VIRTKEY, NOINVERT
+    VK_F5,          ID_DBG_PAGE5,           VIRTKEY, NOINVERT
+    VK_F6,          ID_DBG_PAGE6,           VIRTKEY, NOINVERT
+    VK_F7,          ID_DBG_PAGE7,           VIRTKEY, NOINVERT
+    VK_F8,          ID_DBG_PAGE8,           VIRTKEY, NOINVERT
+    VK_F9,          ID_DBG_PAGE9,           VIRTKEY, NOINVERT
+    VK_F11,         ID_DBG_STEP_OVER,       VIRTKEY, NOINVERT
+    VK_F12,         ID_DBG_STEP_INTO,       VIRTKEY, NOINVERT
+    VK_DOWN,        IDC_DBG_MEMDOWN,        VIRTKEY, ALT, NOINVERT
+    VK_RIGHT,       IDC_DBG_MEMDOWNFAST,    VIRTKEY, ALT, NOINVERT
+    VK_UP,          IDC_DBG_MEMUP,          VIRTKEY, ALT, NOINVERT
+    VK_LEFT,        IDC_DBG_MEMUPFAST,      VIRTKEY, ALT, NOINVERT
+    "H",            IDC_DBG_HELP,           VIRTKEY, ALT, NOINVERT
+    "P",            IDC_DBG_MEMTOPC,        VIRTKEY, ALT, NOINVERT
+    "A",            IDC_DBG_AUTOSET,        VIRTKEY, ALT, NOINVERT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_KICKSTART DIALOGEX 0, 0, 396, 217
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+EXSTYLE WS_EX_CONTEXTHELP
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    GROUPBOX        "System ROM Settings",IDC_STATIC,1,0,394,93
+    LTEXT           "Main ROM file:",IDC_ROMTEXT,14,13,263,10
+    COMBOBOX        IDC_ROMFILE,12,26,361,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "...",IDC_KICKCHOOSER,376,25,10,15
+    LTEXT           "Extended ROM file:",IDC_ROMFILE2TEXT,14,43,263,10
+    COMBOBOX        IDC_ROMFILE2,12,56,361,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "...",IDC_ROMCHOOSER2,376,55,10,15
+    CONTROL         "MapROM emulation [] Creates a BlizKick-compatible memory area.",IDC_MAPROM,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,87,77,104,12
+    CONTROL         "ShapeShifter support [] Patches the system ROM for ShapeShifter compatibility.",IDC_KICKSHIFTER,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,77,106,13
+    GROUPBOX        "Miscellaneous",IDC_STATIC,1,98,394,116
+    LTEXT           "Cartridge ROM file:",IDC_FLASHTEXT2,12,112,265,10
+    COMBOBOX        IDC_CARTFILE,12,125,361,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "...",IDC_CARTCHOOSER,376,124,10,15
+    LTEXT           "Flash RAM file:",IDC_FLASHTEXT,12,144,265,10
+    EDITTEXT        IDC_FLASHFILE,12,157,361,12,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_FLASHCHOOSER,376,156,10,15
+    LTEXT           "Real Time Clock file",IDC_STATIC,12,174,313,15,SS_CENTERIMAGE
+    EDITTEXT        IDC_RTCFILE,12,191,361,12,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_RTCCHOOSER,376,189,10,15
+END
+
+IDD_DISPLAY DIALOGEX 0, 0, 396, 272
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    GROUPBOX        "Screen",IDC_SCREENRESTEXT,1,0,393,77,BS_LEFT
+    COMBOBOX        IDC_DISPLAYSELECT,10,13,375,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Fullscreen:",IDC_STATIC,3,33,51,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_RESOLUTION,59,33,76,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_RESOLUTIONDEPTH,144,33,62,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Windowed:",IDC_STATIC,2,54,51,15,SS_CENTERIMAGE
+    EDITTEXT        IDC_XSIZE,59,56,56,12,ES_NUMBER
+    EDITTEXT        IDC_YSIZE,122,56,56,12,ES_NUMBER
+    COMBOBOX        IDC_REFRESHRATE,266,33,119,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_DISPLAY_BUFFERCNT,266,56,119,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Settings",IDC_SETTINGSTEXT,1,86,283,144
+    RTEXT           "Native:",IDC_STATIC,9,98,48,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_SCREENMODE_NATIVE,61,98,71,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_SCREENMODE_NATIVE2,142,98,127,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "RTG:",IDC_STATIC,8,115,49,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_SCREENMODE_RTG,61,118,71,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_SCREENMODE_RTG2,142,118,127,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Blacker than black",IDC_BLACKER_THAN_BLACK,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,11,140,142,10
+    CONTROL         "Remove interlace artifacts",IDC_FLICKERFIXER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,154,142,10
+    CONTROL         "Filtered low resolution",IDC_LORES_SMOOTHED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,140,116,10
+    CONTROL         "Resolution autoswitch",IDC_AUTORESOLUTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,154,116,10
+    RTEXT           "Resolution:",IDC_STATIC,27,170,110,8,SS_CENTERIMAGE
+    COMBOBOX        IDC_LORES,142,169,127,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Refresh:",IDC_REFRESHTEXT,11,190,57,8
+    CONTROL         "Slider1",IDC_FRAMERATE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,71,185,99,20
+    COMBOBOX        IDC_RATE2BOX,181,190,60,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "FPS adj.:",IDC_REFRESH2TEXT,9,211,61,8
+    CONTROL         "",IDC_FRAMERATE2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,71,206,99,20
+    EDITTEXT        IDC_RATE2TEXT,181,210,46,12,ES_AUTOHSCROLL
+    CONTROL         "",IDC_RATE2ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,232,211,8,10
+    GROUPBOX        "Centering",IDC_STATIC,289,86,105,49
+    CONTROL         "Horizontal",IDC_XCENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,300,100,90,10
+    CONTROL         "Vertical",IDC_YCENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,300,116,90,10
+    GROUPBOX        "Line Mode",IDC_LINEMODE,290,139,104,90
+    CONTROL         "Normal",IDC_LM_NORMAL,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_GROUP | WS_TABSTOP,299,161,90,10
+    CONTROL         "Double",IDC_LM_DOUBLED,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,177,90,10
+    CONTROL         "Scanlines",IDC_LM_SCANLINES,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,193,90,10
+    COMBOBOX        IDC_DA_MODE,15,245,71,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "",IDC_DA_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,96,241,96,20
+    EDITTEXT        IDC_DA_TEXT,205,245,56,12,ES_AUTOHSCROLL | ES_READONLY
+    PUSHBUTTON      "Reset to defaults",IDC_DA_RESET,289,245,106,14
+END
+
+IDD_MEMORY DIALOGEX 0, 0, 396, 206
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+EXSTYLE WS_EX_CONTEXTHELP
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    GROUPBOX        "Memory Settings",IDC_STATIC,1,7,393,117
+    RTEXT           "Chip:",IDC_STATIC,7,25,60,15,SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,68,22,60,20
+    EDITTEXT        IDC_CHIPRAM,135,25,40,12,ES_CENTER | ES_READONLY
+    RTEXT           "Fast:",IDC_STATIC,8,49,60,15,SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,68,47,60,20
+    EDITTEXT        IDC_FASTRAM,135,53,40,12,ES_CENTER | ES_READONLY
+    CONTROL         "Autoconfig Fast RAM",IDC_FASTMEMAUTOCONFIG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,51,76,124,10
+    RTEXT           "Slow:",IDC_STATIC,179,25,66,15,SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_SLOWMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,248,22,60,20
+    EDITTEXT        IDC_SLOWRAM,311,25,40,12,ES_CENTER | ES_READONLY
+    RTEXT           "Z3 Fast:",IDC_STATIC,179,49,66,15,SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_Z3FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,248,47,60,20
+    EDITTEXT        IDC_Z3FASTRAM,311,50,40,12,ES_CENTER | ES_READONLY
+    RTEXT           "32-bit Chip:",IDC_STATIC,180,74,66,15,SS_CENTERIMAGE
+    CONTROL         "",IDC_Z3CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,248,71,60,20
+    EDITTEXT        IDC_Z3CHIPRAM,311,76,40,12,ES_CENTER | ES_READONLY
+    EDITTEXT        IDC_MAX32RAM,14,99,366,12,ES_CENTER | ES_READONLY
+    GROUPBOX        "A3000/A4000 Advanced Memory Settings",IDC_STATIC,1,131,393,65
+    RTEXT           "Motherboard Fast:",IDC_STATIC,44,149,129,10,SS_CENTERIMAGE
+    CONTROL         "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,177,145,60,20
+    EDITTEXT        IDC_MBRAM1,240,148,40,12,ES_CENTER | ES_READONLY
+    RTEXT           "Processor Slot Fast:",IDC_STATIC,44,172,129,10,SS_CENTERIMAGE
+    CONTROL         "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,177,168,60,20
+    EDITTEXT        IDC_MBRAM2,240,171,40,12,ES_CENTER | ES_READONLY
+END
+
+IDD_CPU DIALOGEX 0, 0, 396, 259
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    GROUPBOX        "CPU",IDC_STATIC,1,1,99,160,BS_LEFT
+    CONTROL         "68000",IDC_CPU0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,8,15,63,10
+    CONTROL         "68010",IDC_CPU1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,29,63,10
+    CONTROL         "68020",IDC_CPU2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,42,63,10
+    CONTROL         "68030",IDC_CPU3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,56,63,10
+    CONTROL         "68040",IDC_CPU4,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,70,63,10
+    CONTROL         "68060",IDC_CPU5,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,84,63,10
+    CONTROL         "24-bit addressing",IDC_COMPATIBLE24,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,8,101,87,11
+    CONTROL         "More compatible [] Emulate 68000's prefetch registers. More compatible but slower.",IDC_COMPATIBLE,
+                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,8,115,87,11
+    CONTROL         "JIT [] Enable just-in-time CPU emulator. Significantly increases the speed of the CPU emulation. Requires 68020 or higher CPU.",IDC_JITENABLE,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,128,87,11
+    CONTROL         "MMU [] 68030 or 68040 MMU emulation. Not compatible with JIT.",IDC_MMUENABLE,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,142,87,11
+    GROUPBOX        "CPU Emulation Speed",IDC_STATIC,110,3,284,96
+    CONTROL         "Fastest possible",IDC_CS_HOST,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_GROUP | WS_TABSTOP,115,18,195,10
+    CONTROL         "Approximate A500/A1200 or cycle-exact",IDC_CS_68000,
+                    "Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,115,32,195,10
+    CONTROL         "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,116,50,192,20
+    RTEXT           "CPU Speed",IDC_STATIC,115,78,55,9,SS_CENTERIMAGE
+    EDITTEXT        IDC_CPUTEXT,178,77,30,12,ES_CENTER | ES_READONLY
+    RTEXT           "CPU Idle",IDC_STATIC,213,78,62,9
+    CONTROL         "",IDC_CPUIDLE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,282,73,69,21
+    GROUPBOX        "Cycle-exact CPU Emulation Speed",IDC_STATIC,110,105,284,55
+    RTEXT           "CPU Frequency",IDC_STATIC,113,129,67,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_CPU_FREQUENCY,189,128,46,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    EDITTEXT        IDC_CPU_FREQUENCY2,242,127,70,15
+    GROUPBOX        "FPU",IDC_STATIC,1,167,99,91,BS_LEFT
+    CONTROL         "None",IDC_FPU0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,8,182,87,10
+    CONTROL         "68881",IDC_FPU1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,196,87,10
+    CONTROL         "68882",IDC_FPU2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,209,87,10
+    CONTROL         "CPU internal",IDC_FPU3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,223,87,10
+    CONTROL         "More compatible [] More compatible but slower FPU emulation.",IDC_COMPATIBLE_FPU,
+                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,8,242,87,10
+    GROUPBOX        "Advanced JIT Settings",IDC_STATIC,110,167,284,91
+    RTEXT           "Cache size:",IDC_STATIC,117,187,66,10,SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_CACHE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,186,181,115,20
+    EDITTEXT        IDC_CACHETEXT,305,186,30,12,ES_CENTER | ES_READONLY
+    CONTROL         "Hard flush",IDC_HARDFLUSH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,214,84,11
+    CONTROL         "Constant jump",IDC_CONSTJUMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,228,84,11
+    CONTROL         "FPU support",IDC_JITFPU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,242,84,11
+    CONTROL         "No flags",IDC_NOFLAGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,217,214,68,11
+    CONTROL         "Direct",IDC_TRUST0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,289,214,72,10
+    CONTROL         "Indirect",IDC_TRUST1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,289,228,72,10
+END
+
+IDD_FLOPPY DIALOGEX 0, 0, 396, 261
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    GROUPBOX        "Floppy Drives",IDC_SETTINGSTEXT3,1,0,393,163
+    CONTROL         "DF0:",IDC_DF0ENABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,14,34,15
+    PUSHBUTTON      "Delete save image",IDC_SAVEIMAGE0,97,13,78,15,NOT WS_VISIBLE
+    COMBOBOX        IDC_DF0TYPE,180,14,65,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Write-protected",IDC_STATIC,249,17,74,10,SS_CENTERIMAGE
+    CONTROL         "",IDC_DF0WP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,328,13,10,15
+    PUSHBUTTON      "Eject",IDC_EJECT0,345,12,30,15
+    PUSHBUTTON      "...",IDC_DF0,379,12,10,15
+    COMBOBOX        IDC_DF0TEXT,6,31,384,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "DF1:",IDC_DF1ENABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,51,34,15
+    PUSHBUTTON      "Delete save image",IDC_SAVEIMAGE1,97,49,78,15,NOT WS_VISIBLE
+    COMBOBOX        IDC_DF1TYPE,180,51,65,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Write-protected",IDC_STATIC,249,53,74,10,SS_CENTERIMAGE
+    CONTROL         "",IDC_DF1WP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,328,50,10,15
+    PUSHBUTTON      "Eject",IDC_EJECT1,345,49,30,15
+    PUSHBUTTON      "...",IDC_DF1,379,49,10,15
+    COMBOBOX        IDC_DF1TEXT,6,68,383,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "DF2:",IDC_DF2ENABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,87,34,15
+    PUSHBUTTON      "Delete save image",IDC_SAVEIMAGE2,97,85,78,15,NOT WS_VISIBLE
+    COMBOBOX        IDC_DF2TYPE,180,87,65,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Write-protected",IDC_STATIC,250,88,73,10,SS_CENTERIMAGE
+    CONTROL         "",IDC_DF2WP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,328,86,9,15
+    PUSHBUTTON      "Eject",IDC_EJECT2,345,85,30,15
+    PUSHBUTTON      "...",IDC_DF2,379,85,10,15
+    COMBOBOX        IDC_DF2TEXT,6,104,384,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "DF3:",IDC_DF3ENABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,123,34,15
+    PUSHBUTTON      "Delete save image",IDC_SAVEIMAGE3,97,121,78,15,NOT WS_VISIBLE
+    COMBOBOX        IDC_DF3TYPE,180,123,65,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Write-protected",IDC_STATIC,250,125,73,10,SS_CENTERIMAGE
+    CONTROL         "",IDC_DF3WP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,328,123,9,15
+    PUSHBUTTON      "Eject",IDC_EJECT3,345,121,30,15
+    PUSHBUTTON      "...",IDC_DF3,379,121,10,15
+    COMBOBOX        IDC_DF3TEXT,6,140,383,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Floppy Drive Emulation Speed",IDC_SETTINGSTEXT2,1,170,393,35
+    CONTROL         "",IDC_FLOPPYSPD,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,71,180,116,20
+    EDITTEXT        IDC_FLOPPYSPDTEXT,222,183,101,12,ES_CENTER | ES_READONLY
+    GROUPBOX        "New Floppy Disk Image",IDC_SETTINGSTEXT,1,211,393,49
+    COMBOBOX        IDC_FLOPPYTYPE,58,225,64,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Create Standard Disk [] Creates a standard 880 or 1760 KB ADF disk image.",IDC_CREATE,130,224,97,15
+    PUSHBUTTON      "Create Custom Disk [] Creates a low level (MFM) ADF disk image (about 2MB). Useful for programs that use non-standard disk formats (for example some save disks or DOS-formatted floppies)",IDC_CREATE_RAW,235,224,101,15
+    RTEXT           "Disk label:",IDC_STATIC,60,244,58,10,SS_CENTERIMAGE
+    EDITTEXT        IDC_CREATE_NAME,130,243,97,13,ES_AUTOHSCROLL
+    CONTROL         "Bootblock",IDC_FLOPPY_BOOTABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,235,242,59,15
+    CONTROL         "FFS",IDC_FLOPPY_FFS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,300,242,34,15
+END
+
+IDD_HARDDISK DIALOGEX 0, 0, 396, 315
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+EXSTYLE WS_EX_CONTEXTHELP
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    CONTROL         "List1",IDC_VOLUMELIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,2,393,153
+    PUSHBUTTON      "Add &Directory or Archive...",IDC_NEW_FS,1,157,128,15
+    PUSHBUTTON      "Add &Hardfile...",IDC_NEW_HF,135,157,126,15
+    PUSHBUTTON      "Add Ha&rd Drive...",IDC_NEW_HD,267,157,127,15
+    PUSHBUTTON      "&Properties",IDC_EDIT,267,176,60,15
+    PUSHBUTTON      "Remove",IDC_REMOVE,334,176,60,15
+    GROUPBOX        "Options",IDC_STATIC,1,191,393,72
+    CONTROL         "Add PC drives at startup",IDC_MAPDRIVES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,204,201,11
+    CONTROL         "Include removable drives..",IDC_MAPDRIVES_REMOVABLE,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,217,201,11
+    CONTROL         "Include network drives..",IDC_MAPDRIVES_NET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,231,201,11
+    CONTROL         "CDFS automount CD/DVD drives",IDC_MAPDRIVES_CD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,245,201,11
+    CONTROL         "Disable UAEFSDB-support",IDC_NOUAEFSDB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,222,204,167,11
+    CONTROL         "Don't use Windows Recycle Bin",IDC_NORECYCLEBIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,222,217,167,11
+    CONTROL         "Automount removable drives [] Windows side insert or removal will immediately mount/remove it on Amiga side.",IDC_MAPDRIVES_AUTO,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,222,231,167,11
+    CONTROL         "Limit size of directory drives to 1G [] Workaround for example old installers that calculate free space incorrectly if drive is large.",IDC_MAPDRIVES_LIMIT,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,222,245,167,11
+    GROUPBOX        "Optical media options",IDC_STATIC,1,266,393,47
+    LTEXT           "CD drive/image",IDC_STATIC,5,280,70,10,SS_CENTERIMAGE
+    PUSHBUTTON      "Select image file",IDC_CD_SELECT,177,278,98,15
+    COMBOBOX        IDC_CD_TYPE,282,279,71,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Eject",IDC_CD_EJECT,360,278,30,15
+    COMBOBOX        IDC_CD_TEXT,5,297,386,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+END
+
+IDD_SOUND DIALOGEX 0, 0, 396, 288
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    COMBOBOX        IDC_SOUNDCARDLIST,1,1,393,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Sound Emulation",IDC_SOUNDSETTINGS,1,19,132,112
+    CONTROL         "Disabled",IDC_SOUND0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,35,108,10
+    CONTROL         "Disabled, but emulated",IDC_SOUND1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,53,107,10
+    CONTROL         "Enabled",IDC_SOUND2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,71,108,10
+    CONTROL         "Automatic switching",IDC_SOUND_AUTO,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,13,89,108,10
+    GROUPBOX        "Volume",IDC_STATIC,139,19,255,69
+    CONTROL         "",IDC_SOUNDVOLUME,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,207,32,105,20
+    EDITTEXT        IDC_SOUNDVOLUME2,329,35,48,12,ES_CENTER | ES_READONLY
+    GROUPBOX        "Sound Buffer Size",IDC_STATIC,140,90,254,42
+    CONTROL         "Slider1",IDC_SOUNDBUFFERRAM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,207,106,105,20
+    EDITTEXT        IDC_SOUNDBUFFERMEM,329,109,48,12,ES_CENTER | ES_READONLY
+    GROUPBOX        "Settings",IDC_SOUNDINTERPOLATION2,1,136,393,72
+    LTEXT           "Channel mode:",IDC_SOUNDSTEREOTXT,22,148,128,8,SS_CENTERIMAGE
+    COMBOBOX        IDC_SOUNDSTEREO,24,158,135,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Stereo separation:",IDC_SOUNDSTEREOSEPTXT,180,148,84,8,SS_CENTERIMAGE
+    COMBOBOX        IDC_SOUNDSTEREOSEP,181,158,74,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Interpolation:",IDC_SOUNDINTERPOLATIONTXT,279,148,98,8,SS_CENTERIMAGE
+    COMBOBOX        IDC_SOUNDINTERPOLATION,279,158,96,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Frequency:",IDC_SOUNDFREQTXT,22,176,58,8,SS_CENTERIMAGE
+    COMBOBOX        IDC_SOUNDFREQ,24,186,55,75,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Swap channels:",IDC_SOUNDSWAPTXT,85,176,81,8,SS_CENTERIMAGE
+    COMBOBOX        IDC_SOUNDSWAP,86,186,74,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Stereo delay:",IDC_SOUNDSTEREOMIXTXT,180,176,83,8,SS_CENTERIMAGE
+    COMBOBOX        IDC_SOUNDSTEREOMIX,181,186,74,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Audio filter:",IDC_SOUNDFILTERTXT,279,176,98,8,SS_CENTERIMAGE
+    COMBOBOX        IDC_SOUNDFILTER,279,186,96,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Floppy Drive Sound Emulation",IDC_STATIC,1,213,278,73
+    CONTROL         "",IDC_SOUNDDRIVEVOLUME,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,20,229,107,19
+    EDITTEXT        IDC_SOUNDDRIVEVOLUME2,144,231,48,12,ES_CENTER | ES_READONLY
+    COMBOBOX        IDC_SOUNDDRIVE,205,231,66,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_SOUNDDRIVESELECT,18,257,253,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Drivers",IDC_STATIC,285,213,109,73
+    CONTROL         "DirectSound",IDC_SOUND_DS,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,292,227,98,10
+    CONTROL         "WASAPI",IDC_SOUND_WASAPI,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,292,240,98,10
+    CONTROL         "OpenAL",IDC_SOUND_OPENAL,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,292,253,98,10
+    CONTROL         "PortAudio",IDC_SOUND_PORTAUDIO,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,292,266,98,10
+    CONTROL         "",IDC_SOUNDVOLUMECD,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,207,61,105,20
+    EDITTEXT        IDC_SOUNDVOLUMECD2,329,64,48,12,ES_CENTER | ES_READONLY
+    RTEXT           "CD Audio",IDC_STATIC,152,67,51,10,SS_CENTERIMAGE
+    RTEXT           "Paula Audio",IDC_STATIC,152,38,51,10,SS_CENTERIMAGE
+END
+
+IDD_LOADSAVE DIALOGEX 0, 0, 396, 318
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    CONTROL         "",IDC_CONFIGTREE,"SysTreeView32",TVS_HASLINES | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_TRACKSELECT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,1,5,393,227,WS_EX_CLIENTEDGE
+    RTEXT           "Name:",IDC_STATIC,4,241,47,8,SS_CENTERIMAGE
+    EDITTEXT        IDC_EDITNAME,55,239,230,13,ES_AUTOHSCROLL
+    RTEXT           "Description:",IDC_STATIC,1,262,50,8,SS_CENTERIMAGE
+    EDITTEXT        IDC_EDITDESCRIPTION,55,260,230,13,ES_AUTOHSCROLL
+    RTEXT           "Link:",IDC_STATIC,4,284,47,8,SS_CENTERIMAGE
+    COMBOBOX        IDC_CONFIGLINK,55,282,168,150,CBS_DROPDOWN | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Ignore link",IDC_CONFIGNOLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,283,58,12
+    EDITTEXT        IDC_EDITPATH,289,238,49,15,ES_AUTOHSCROLL | WS_DISABLED
+    CONTROL         "Autoload",IDC_CONFIGAUTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,343,240,51,12
+    GROUPBOX        "Additional Information",IDC_STATIC,289,256,105,38,BS_LEFT
+    PUSHBUTTON      "View",IDC_VIEWINFO,297,272,41,15
+    PUSHBUTTON      "Set",IDC_SETINFO,348,272,41,15
+    PUSHBUTTON      "Load",IDC_QUICKLOAD,1,301,60,15
+    PUSHBUTTON      "Save",IDC_QUICKSAVE,65,301,60,15
+    PUSHBUTTON      "Load From...",IDC_LOAD,162,301,60,15
+    PUSHBUTTON      "Save As...",IDC_SAVE,226,301,60,15
+    PUSHBUTTON      "Delete",IDC_DELETE,335,301,60,15
+END
+
+IDD_IOPORTS DIALOGEX 0, 0, 396, 295
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    GROUPBOX        "Parallel Port",IDC_STATIC,1,1,393,131
+    RTEXT           "Printer:",IDC_STATIC,6,16,57,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_PRINTERLIST,67,17,317,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Type:",IDC_STATIC,7,38,57,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_PRINTERTYPELIST,67,39,317,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Flush print job",IDC_FLUSHPRINTER,147,58,75,12
+    RTEXT           "Autoflush [] Time in seconds after a pending print job is automatically flushed.",IDC_PRINTERAUTOFLUSHTXT,236,56,110,15,SS_NOTIFY | SS_CENTERIMAGE
+    EDITTEXT        IDC_PRINTERAUTOFLUSH,351,58,33,12,ES_NUMBER
+    RTEXT           "Ghostscript extra parameters:",IDC_STATIC,8,74,136,15,SS_CENTERIMAGE
+    EDITTEXT        IDC_PS_PARAMS,148,75,236,12,ES_AUTOHSCROLL
+    RTEXT           "Sampler:",IDC_STATIC,6,94,57,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_SAMPLERLIST,67,95,317,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Stereo sampler",IDC_SAMPLER_STEREO,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,68,114,149,12
+    GROUPBOX        "Serial Port",IDC_STATIC,1,137,393,51
+    COMBOBOX        IDC_SERIAL,67,150,317,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Shared",IDC_SER_SHARED,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,32,171,66,12
+    CONTROL         "RTS/CTS",IDC_SER_CTSRTS,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,106,171,66,12
+    CONTROL         "Direct []Use when emulating serial-link games on two PCs running WinUAE",IDC_SER_DIRECT,
+                    "Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,181,171,83,12
+    CONTROL         "uaeserial.device",IDC_UAESERIAL,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,275,171,108,12
+    RTEXT           "Out:",IDC_MIDI,22,202,32,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_MIDIOUTLIST,58,204,145,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "In:",IDC_MIDI2,204,201,31,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_MIDIINLIST,239,203,145,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Protection Dongle",IDC_STATIC,1,252,393,41,BS_LEFT
+    GROUPBOX        "MIDI",IDC_STATIC,1,191,393,54,BS_LEFT
+    COMBOBOX        IDC_DONGLELIST,58,270,232,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Route MIDI In to MIDI Out",IDC_MIDIROUTER,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,41,227,170,12
+END
+
+IDD_GAMEPORTS DIALOGEX 0, 0, 396, 288
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    GROUPBOX        "Mouse and Joystick settings",IDC_STATIC,1,3,393,211
+    RTEXT           "Port 1:",IDC_STATIC,4,18,37,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_PORT0_JOYS,45,19,342,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_PORT0_AF,45,37,86,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_PORT0_JOYSMODE,136,38,106,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Test [] Test Port 1 (mouse) configuration.",IDC_PORT0_TEST,313,37,36,14
+    PUSHBUTTON      "Remap [] Remap Port 1 configurarion.",IDC_PORT0_REMAP,352,37,36,14
+    RTEXT           "Port 2:",IDC_STATIC,6,56,35,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_PORT1_JOYS,45,57,342,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_PORT1_AF,45,74,86,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_PORT1_JOYSMODE,136,74,106,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Test [] Test Port 2 (joystick) configuration.",IDC_PORT1_TEST,313,74,36,14
+    PUSHBUTTON      "Remap [] Remap Port 2 configuration.",IDC_PORT1_REMAP,352,74,36,14
+    PUSHBUTTON      "Swap ports [] Swap ports 1 and 2.",IDC_SWAP,45,100,78,14
+    LTEXT           "Emulated parallel port joystick adapter",IDC_STATIC,10,124,179,15,SS_CENTERIMAGE
+    RTEXT           "X-Arcade layout information []#1",IDC_STATIC,217,124,170,15,SS_NOTIFY | SS_CENTERIMAGE
+    COMBOBOX        IDC_PORT2_JOYS,45,142,342,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Test [] Test Parallel port joystick port 1 configuration.",IDC_PORT2_TEST,313,159,36,14
+    PUSHBUTTON      "Remap [] Remap Parallel port joystick port 1 configurarion.",IDC_PORT2_REMAP,352,159,36,14
+    COMBOBOX        IDC_PORT3_JOYS,45,178,342,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Test [] Test Parallel port joystick 2 configuration.",IDC_PORT3_TEST,313,194,36,14
+    PUSHBUTTON      "Remap [] Remap Parallel port joystick port 2 configurarion.",IDC_PORT3_REMAP,352,194,36,14
+    GROUPBOX        "Mouse extra settings",IDC_STATIC,1,219,393,68
+    RTEXT           "Mouse speed:",IDC_STATIC,19,237,82,10,SS_CENTERIMAGE
+    EDITTEXT        IDC_INPUTSPEEDM,115,237,25,13,ES_NUMBER
+    CONTROL         "Magic Mouse",IDC_PORT_MOUSETRICK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,235,160,11
+    RTEXT           "Magic Mouse cursor mode:",IDC_STATIC,45,254,138,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_PORT_TABLET_CURSOR,195,251,119,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Install virtual mouse driver",IDC_PORT_TABLET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,48,270,136,11
+    CONTROL         "Full tablet input emulation",IDC_PORT_TABLET_FULL,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,270,160,11
+END
+
+IDD_CONTRIBUTORS DIALOGEX 0, 0, 411, 242
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION
+CAPTION "UAE Authors and Contributors..."
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    DEFPUSHBUTTON   "Ok",ID_OK,177,224,53,14
+    CONTROL         "",IDC_CONTRIBUTORS,"RICHEDIT",TCS_HOTTRACK | TCS_VERTICAL | TCS_RAGGEDRIGHT | TCS_OWNERDRAWFIXED | TCS_MULTISELECT | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,4,5,404,214
+END
+
+IDD_ABOUT DIALOGEX 0, 0, 345, 258
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    CONTROL         "",IDC_RICHEDIT1,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,65,10,210,35
+    CONTROL         "",IDC_RICHEDIT2,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,1,58,343,28
+    PUSHBUTTON      "Contributors",IDC_CONTRIBUTORS,132,100,80,15
+    CONTROL         "",IDC_UAEHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,2,196,112,24
+    CONTROL         "",IDC_PICASSOHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | NOT WS_VISIBLE | WS_DISABLED,211,131,112,24
+    CONTROL         "",IDC_AMIGAHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,116,168,112,24
+    CONTROL         "",IDC_WINUAEHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,231,168,112,24
+    CONTROL         "",IDC_AIABHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | NOT WS_VISIBLE | WS_DISABLED,22,131,112,24
+    CONTROL         "",IDC_THEROOTS,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,117,225,112,24
+    CONTROL         "",IDC_CAPS,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,231,196,112,24
+    CONTROL         "",IDC_ABIME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,117,196,112,24
+    CONTROL         "",IDC_CLOANTOHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,2,168,112,24
+    CONTROL         "",IDC_AMIGASYS,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,2,225,112,24
+    CONTROL         "",IDC_AMIKIT,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,231,225,112,24
+END
+
+IDD_MISC1 DIALOGEX 0, 0, 396, 318
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    CONTROL         "",IDC_MISCLIST,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,3,5,258,232
+    GROUPBOX        "Miscellaneous Options",IDC_STATIC,266,2,128,138
+    CTEXT           "SCSI and CD/DVD access:",IDC_STATIC,272,14,117,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_SCSIMODE,287,28,87,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CTEXT           "Windowed style:",IDC_STATIC,272,45,117,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_WINDOWEDMODE,287,59,87,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CTEXT           "Graphics API:",IDC_STATIC,272,76,117,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_DXMODE,287,89,87,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CTEXT           "DirectDraw:",IDC_STATIC,272,106,117,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_DD_SURFACETYPE,287,119,87,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "GUI",IDC_STATIC,266,144,128,93
+    CTEXT           "Language:",IDC_STATIC,271,154,117,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_LANGUAGE,273,168,114,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "GUI Font...",IDC_GUI_FONT,272,185,54,14
+    PUSHBUTTON      "List Font...",IDC_GUI_LISTFONT,333,185,54,14
+    PUSHBUTTON      "Set default",IDC_GUI_DEFAULT,272,204,54,14
+    COMBOBOX        IDC_GUI_SIZE,333,205,54,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Resizeable GUI",IDC_GUI_RESIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,273,222,114,11
+    GROUPBOX        "State Files",IDC_STATIC,1,242,393,38
+    EDITTEXT        IDC_STATENAME,8,257,231,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
+    CONTROL         "",IDC_STATECLEAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,244,261,9,10
+    PUSHBUTTON      "Load state...",IDC_DOLOADSTATE,257,257,65,14
+    PUSHBUTTON      "Save state...",IDC_DOSAVESTATE,325,257,65,14
+    GROUPBOX        "Keyboard LEDs",IDC_STATIC,1,282,393,34
+    COMBOBOX        IDC_KBLED1,10,295,64,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_KBLED2,97,295,64,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_KBLED3,184,295,64,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "USB mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,296,64,11
+END
+
+IDD_HARDFILE DIALOGEX 0, 0, 396, 263
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_ACCEPTFILES
+CAPTION "Hardfile Settings"
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    GROUPBOX        "Settings",IDC_STATIC,2,2,392,164
+    RTEXT           "Path:",IDC_HARDFILE_DIR_TEXT,25,18,22,10
+    EDITTEXT        IDC_PATH_NAME,52,15,325,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_SELECTOR,380,14,11,15
+    RTEXT           "FileSys:",IDC_HARDFILE_FILESYS_TEXT,13,38,34,10
+    EDITTEXT        IDC_PATH_FILESYS,52,35,325,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_FILESYS_SELECTOR,380,34,11,15
+    RTEXT           "Device:",IDC_HARDFILE_DEVICE_TEXT,16,58,31,10
+    EDITTEXT        IDC_HARDFILE_DEVICE,52,55,121,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "Enable RDB mode",IDC_HDF_RDB,285,55,92,14
+    CONTROL         "Read/write",IDC_HDF_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,74,67,10
+    CONTROL         "Bootable",IDC_HDF_AUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,136,74,67,10
+    CONTROL         "Do not mount",IDC_HDF_DONOTMOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,217,74,67,10
+    RTEXT           "Boot priority:",IDC_HARDFILE_BOOTPRI_TEXT,26,94,78,10
+    EDITTEXT        IDC_HARDFILE_BOOTPRI,109,90,44,15
+    RTEXT           "Surfaces:",IDC_SURFACES_TEXT,160,94,48,10
+    EDITTEXT        IDC_HEADS,213,90,40,15,ES_NUMBER
+    RTEXT           "Reserved:",IDC_RESERVED_TEXT,262,94,50,10
+    EDITTEXT        IDC_RESERVED,317,90,40,15,ES_NUMBER
+    RTEXT           "HD Controller:",IDC_STATIC,26,113,78,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_HDF_CONTROLLER,109,112,44,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Sectors:",IDC_SECTORS_TEXT,160,113,48,10
+    EDITTEXT        IDC_SECTORS,213,111,40,15,ES_NUMBER
+    RTEXT           "Block size:",IDC_BLOCKSIZE_TEXT,261,113,50,10
+    EDITTEXT        IDC_BLOCKSIZE,317,111,40,15,ES_NUMBER
+    EDITTEXT        IDC_HDFINFO,5,131,385,12,ES_CENTER | ES_READONLY
+    GROUPBOX        "New hard disk image file",IDC_STATIC,2,171,392,62
+    PUSHBUTTON      "Create",IDC_HF_CREATE,58,187,80,14
+    COMBOBOX        IDC_HF_TYPE,58,211,80,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    EDITTEXT        IDC_HF_SIZE,154,187,61,15,ES_NUMBER
+    LTEXT           "MB",IDC_STATIC,220,190,53,10,SS_CENTERIMAGE
+    EDITTEXT        IDC_HF_DOSTYPE,154,210,61,15
+    LTEXT           "DOS type",IDC_STATIC,222,212,51,10,SS_CENTERIMAGE
+    CONTROL         "Sparse file",IDC_HF_SPARSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,196,87,10
+    CONTROL         "Dynamic HDF",IDC_HF_DYNAMIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,208,87,10
+    PUSHBUTTON      "OK",IDOK,147,242,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,203,242,50,14
+    EDITTEXT        IDC_HDFINFO2,5,147,385,12,ES_CENTER | ES_READONLY
+    CONTROL         "Global filesystem",IDC_HDF_ADDFSRES,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,298,74,82,10
+END
+
+IDD_FILESYS DIALOGEX 15, 25, 396, 111
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Volume Settings"
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    RTEXT           "Device name:",-1,4,7,65,10
+    EDITTEXT        IDC_VOLUME_DEVICE,73,5,104,15,ES_AUTOHSCROLL
+    RTEXT           "Volume label:",-1,6,28,63,10
+    EDITTEXT        IDC_VOLUME_NAME,73,25,104,15,ES_AUTOHSCROLL
+    RTEXT           "Path:",-1,5,49,64,10
+    EDITTEXT        IDC_PATH_NAME,73,45,315,17,ES_AUTOHSCROLL
+    CONTROL         "Read/write",IDC_FS_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,259,7,67,10
+    CONTROL         "Bootable",IDC_FS_AUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,336,7,56,10
+    RTEXT           "Boot priority:",IDC_VOLUME_BOOTPRI_TEXT,276,28,49,8
+    EDITTEXT        IDC_VOLUME_BOOTPRI,336,25,30,15
+    PUSHBUTTON      "Select Directory",IDC_FS_SELECT_DIR,72,66,123,15
+    PUSHBUTTON      "Select Archive or Plain File",IDC_FS_SELECT_FILE,197,66,123,15
+    PUSHBUTTON      "OK",IDOK,72,90,62,15
+    PUSHBUTTON      "Cancel",IDCANCEL,138,90,62,15
+    PUSHBUTTON      "Eject",IDC_FS_SELECT_EJECT,258,90,62,15
+END
+
+IDD_SETINFO DIALOGEX 0, 0, 396, 85
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Additional Information Settings"
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    RTEXT           "Path:",-1,5,20,36,15,SS_CENTERIMAGE
+    EDITTEXT        IDC_PATH_NAME,46,20,324,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_SELECTOR,376,20,10,15
+    PUSHBUTTON      "OK",IDOK,146,57,48,15
+    PUSHBUTTON      "Cancel",IDCANCEL,201,57,48,15
+END
+
+IDD_CHIPSET DIALOGEX 0, 0, 396, 169
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    GROUPBOX        "Chipset",IDC_STATIC,1,0,212,111
+    CONTROL         "OCS [] Original chipset. A1000 and most A500s.",IDC_OCS,
+                    "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,15,88,10
+    CONTROL         "ECS Agnus [] Enhanced chipset (ECS Agnus chip only). CDTV and later A500 and A2000 hardware revisions.",IDC_ECS_AGNUS,
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,14,31,88,10
+    CONTROL         "Full ECS [] Full ECS chipset (ECS Agnus and ECS Denise chips). A500+, A600 and A3000.",IDC_ECS,
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,14,47,88,10
+    CONTROL         "AGA [] Advanced Graphics Architecture chipset. A1200, A4000 and CD32.",IDC_AGA,
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,114,15,86,10
+    CONTROL         "ECS Denise [] Enhanced chipset (ECS Denise chip only). Normally paired with ECS Agnus.",IDC_ECS_DENISE,
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,114,31,86,10
+    CONTROL         "NTSC [] North American and Japanese display standard, 60Hz refresh rate. Other countries use PAL (50Hz. display refresh rate)",IDC_NTSC,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,47,86,10
+    CONTROL         "Cycle-exact [] The most compatible A500/A1200 emulation mode. Very fast PC recommended.",IDC_CYCLEEXACT,
+                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,69,170,10
+    RTEXT           "Chipset Extra:",IDC_STATIC,72,89,71,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_CS_EXT,148,90,49,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Options",IDC_STATIC,221,0,173,111
+    CONTROL         "Immediate Blitter [] Faster but less compatible blitter emulation.",IDC_BLITIMM,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,234,16,150,10
+    CONTROL         "Wait for Blitter [] Compatibility hack for programs that don't wait for the blitter correctly, causing graphics corruption if CPU is too fast.",IDC_BLITWAIT,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,234,29,150,10
+    CONTROL         "Genlock connected [] Allow boot sequence to detect genlock. Genlock is not emulated.",IDC_GENLOCK,
+                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,234,42,150,10
+    CTEXT           "External display hardware:",IDC_STATIC,228,59,117,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_MONITOREMU,238,78,98,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Collision Level",IDC_STATIC,1,116,393,48
+    CONTROL         "None [] Collision hardware emulation disabled.",IDC_COLLISION0,
+                    "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,47,132,101,10
+    CONTROL         "Sprites only [] Emulate only sprite vs. sprite collisions.",IDC_COLLISION1,
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,47,147,101,10
+    CONTROL         "Sprites and Sprites vs. Playfield [] Recommended collision emulation level.",IDC_COLLISION2,
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,182,132,181,10
+    CONTROL         "Full [] 100% collision hardware emulation. Only very few games need this option. Slowest.",IDC_COLLISION3,
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,182,147,181,10
+END
+
+IDD_CHIPSET2 DIALOGEX 0, 0, 396, 288
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    CONTROL         "Compatible Settings",IDC_CS_COMPATIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,6,234,10
+    GROUPBOX        "Battery Backed Up Real Time Clock",IDC_STATIC,1,22,393,31
+    CONTROL         "None",IDC_CS_RTC1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,15,36,57,10
+    CONTROL         "MSM6242B",IDC_CS_RTC2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,90,36,77,10
+    CONTROL         "RF5C01A",IDC_CS_RTC3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,171,36,67,10
+    CONTROL         "A2000 MSM6242B",IDC_CS_RTC4,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,242,36,78,10
+    EDITTEXT        IDC_CS_RTCADJUST,325,34,64,13,ES_AUTOHSCROLL
+    GROUPBOX        "CIA-A TOD Clock Source",IDC_STATIC,1,56,393,29
+    CONTROL         "Vertical Sync",IDC_CS_CIAA_TOD1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,41,68,86,10
+    CONTROL         "Power Supply 50Hz",IDC_CS_CIAA_TOD2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,133,68,109,10
+    CONTROL         "Power Supply 60Hz",IDC_CS_CIAA_TOD3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,249,68,116,10
+    GROUPBOX        "Chipset Features",IDC_STATIC,1,88,393,146
+    CONTROL         "CIA ROM Overlay",IDC_CS_CIAOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,102,104,11
+    CONTROL         "CD32 CD",IDC_CS_CD32CD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,116,104,11
+    CONTROL         "CDTV CD",IDC_CS_CDTVCD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,130,105,11
+    CONTROL         "A600/A1200 IDE",IDC_CS_IDE1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,143,104,11
+    CONTROL         "ROM Mirror (E0)",IDC_CS_KSMIRROR_E0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,157,104,11
+    CONTROL         "KB Reset Warning",IDC_CS_RESETWARNING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,171,104,11
+    LTEXT           "A4091/A4000T SCSI not yet implemented.",IDC_STATIC,17,187,247,8,SS_CENTERIMAGE
+    CONTROL         "A590/A2091 SCSI",IDC_CS_A2091,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,202,104,11
+    CONTROL         "A4091 SCSI",IDC_CS_A4091,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,215,104,11
+    CONTROL         "A1000 Boot RAM/ROM",IDC_CS_A1000RAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,102,121,11
+    CONTROL         "CD32 C2P",IDC_CS_CD32C2P,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,116,121,11
+    CONTROL         "CDTV SRAM",IDC_CS_CDTVRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,129,121,11
+    CONTROL         "A4000/A4000T IDE",IDC_CS_IDE2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,143,121,11
+    CONTROL         "ROM Mirror (A8)",IDC_CS_KSMIRROR_A8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,157,121,11
+    CONTROL         "No-EHB Denise",IDC_CS_NOEHB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,171,121,11
+    CONTROL         "A3000 SCSI",IDC_CS_DMAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,202,121,11
+    CONTROL         "CDTV SCSI",IDC_CS_CDTVSCSI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,215,121,11
+    CONTROL         "DF0: ID Hardware",IDC_CS_DF0IDHW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,102,125,11
+    CONTROL         "CD32 NVRAM",IDC_CS_CD32NVRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,116,125,11
+    CONTROL         "CDTV SRAM Expansion",IDC_CS_CDTVRAMEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,129,125,11
+    CONTROL         "PCMCIA",IDC_CS_PCMCIA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,143,125,11
+    CONTROL         "C00000 is Fast RAM",IDC_CS_SLOWISFAST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,157,125,11
+    CONTROL         "A1000 Agnus (8361/8367)",IDC_CS_DIPAGNUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,171,125,11
+    CONTROL         "A4000T SCSI",IDC_CS_DMAC2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,202,125,11
+    CONTROL         "Include host SCSI devices",IDC_CS_SCSIMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,215,125,11
+    GROUPBOX        "Chipset Revision",IDC_STATIC,1,236,393,46
+    CONTROL         "Ramsey revision:",IDC_CS_RAMSEY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,34,248,97,11
+    CONTROL         "Fat Gary revision:",IDC_CS_FATGARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,34,262,97,11
+    EDITTEXT        IDC_CS_RAMSEYREV,136,247,45,13,ES_AUTOHSCROLL
+    EDITTEXT        IDC_CS_FATGARYREV,136,262,45,13,ES_AUTOHSCROLL
+    CONTROL         "Agnus/Alice revision:",IDC_CS_AGNUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,248,107,11
+    CONTROL         "Denise/Lisa revision:",IDC_CS_DENISE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,262,107,11
+    EDITTEXT        IDC_CS_AGNUSREV,311,247,45,13,ES_AUTOHSCROLL
+    EDITTEXT        IDC_CS_DENISEREV,311,262,45,13,ES_AUTOHSCROLL
+END
+
+IDD_AVIOUTPUT DIALOGEX 0, 0, 396, 260
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    GROUPBOX        "Output Properties",IDC_STATIC,1,0,393,123
+    EDITTEXT        IDC_AVIOUTPUT_FILETEXT,15,15,342,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_CLIENTEDGE
+    PUSHBUTTON      "...",IDC_AVIOUTPUT_FILE,362,15,23,12
+    CONTROL         "Audio",IDC_AVIOUTPUT_AUDIO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | BS_FLAT | WS_TABSTOP,15,34,66,14
+    CONTROL         "",IDC_AVIOUTPUT_AUDIO_STATIC,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | SS_SUNKEN | WS_GROUP,88,35,298,13
+    CONTROL         "Video",IDC_AVIOUTPUT_VIDEO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | BS_FLAT | WS_TABSTOP,15,52,66,14
+    CONTROL         "",IDC_AVIOUTPUT_VIDEO_STATIC,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | SS_SUNKEN | WS_GROUP,87,53,298,13
+    CONTROL         "Disable frame rate limit",IDC_AVIOUTPUT_FRAMELIMITER,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,72,176,10
+    CONTROL         "Capture before filtering",IDC_AVIOUTPUT_ORIGINALSIZE,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,72,171,10
+    CONTROL         "Disable sound output",IDC_AVIOUTPUT_NOSOUNDOUTPUT,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,85,176,10
+    CONTROL         "Disable sound sync",IDC_AVIOUTPUT_NOSOUNDSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,85,171,10
+    CONTROL         "AVI output enabled",IDC_AVIOUTPUT_ACTIVATED,"Button",BS_AUTORADIOBUTTON | BS_PUSHLIKE | BS_FLAT,15,100,144,14
+    GROUPBOX        "Ripper",IDC_STATIC,1,126,393,53
+    PUSHBUTTON      "Save screenshot",IDC_SCREENSHOT,53,140,87,14
+    PUSHBUTTON      "Pro Wizard 1.62",IDC_PROWIZARD,245,140,87,14,WS_DISABLED
+    CONTROL         "Take screenshot before filtering",IDC_SCREENSHOT_ORIGINALSIZE,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,161,162,10
+    CONTROL         "Sample ripper",IDC_SAMPLERIPPER_ACTIVATED,"Button",BS_AUTORADIOBUTTON | BS_PUSHLIKE | BS_FLAT,245,159,87,14
+    GROUPBOX        "Re-recorder",IDC_STATIC,1,182,393,70
+    CONTROL         "Play recording",IDC_STATEREC_PLAY,"Button",BS_AUTORADIOBUTTON | BS_PUSHLIKE | BS_FLAT,53,194,87,14
+    CONTROL         "Re-recording enabled",IDC_STATEREC_RECORD,"Button",BS_AUTORADIOBUTTON | BS_PUSHLIKE | BS_FLAT,214,194,118,14
+    CONTROL         "Automatic replay",IDC_STATEREC_AUTOPLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,217,129,10
+    PUSHBUTTON      "Save recording",IDC_STATEREC_SAVE,214,212,118,14
+    RTEXT           "Recording rate (seconds):",IDC_STATIC,15,235,121,10,SS_CENTERIMAGE | WS_TABSTOP
+    COMBOBOX        IDC_STATEREC_RATE,141,233,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Recording buffers:",IDC_STATIC,195,235,91,10,SS_CENTERIMAGE | WS_TABSTOP
+    COMBOBOX        IDC_STATEREC_BUFFERSIZE,291,233,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+END
+
+IDD_INPUT DIALOGEX 0, 0, 396, 318
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    COMBOBOX        IDC_INPUTTYPE,5,4,106,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_INPUTDEVICE,116,4,192,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Device enabled",-1,313,6,66,11,SS_CENTERIMAGE
+    CONTROL         "",IDC_INPUTDEVICEDISABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,384,7,9,10
+    CONTROL         "List1",IDC_INPUTLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,5,22,390,220
+    COMBOBOX        IDC_INPUTAMIGACNT,5,248,24,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_INPUTAMIGA,33,248,286,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Test [] Test input mappings.",IDC_INPUTTEST,324,248,34,14
+    PUSHBUTTON      "Remap [] Find and remap quickly.",IDC_INPUTREMAP,361,248,34,14
+    RTEXT           "Joystick dead zone (%):",-1,5,271,106,10,SS_CENTERIMAGE
+    EDITTEXT        IDC_INPUTDEADZONE,116,270,29,12,ES_NUMBER
+    RTEXT           "Autofire rate (lines):",-1,5,288,106,10,SS_CENTERIMAGE
+    EDITTEXT        IDC_INPUTAUTOFIRERATE,116,286,29,12,ES_NUMBER
+    RTEXT           "Digital joy-mouse speed:",-1,147,271,108,10,SS_CENTERIMAGE
+    EDITTEXT        IDC_INPUTSPEEDD,260,270,29,12,ES_NUMBER
+    RTEXT           "Analog joy-mouse speed:",-1,147,288,108,10,SS_CENTERIMAGE
+    EDITTEXT        IDC_INPUTSPEEDA,260,287,29,12,ES_NUMBER
+    PUSHBUTTON      "Copy from:",IDC_INPUTCOPY,324,268,70,14
+    COMBOBOX        IDC_INPUTCOPYFROM,324,286,70,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Swap 1<>2",IDC_INPUTSWAP,324,303,70,14
+END
+
+IDD_FILTER DIALOGEX 0, 0, 396, 288
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    GROUPBOX        "Filter Settings",-1,1,1,393,146
+    COMBOBOX        IDC_FILTERMODE,20,15,188,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_FILTERFILTER,215,15,63,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Reset to defaults",IDC_FILTERDEFAULT,283,15,106,14
+    COMBOBOX        IDC_FILTEROVERLAYTYPE,20,36,108,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_FILTEROVERLAY,134,36,145,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_FILTERAUTOSCALE,284,36,104,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Horiz. size:",-1,7,63,81,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_FILTERHZMULT,92,62,35,150,CBS_DROPDOWN | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Slider1",IDC_FILTERHZ,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,147,56,152,19
+    EDITTEXT        IDC_FILTERHZV,316,58,42,12,ES_CENTER | ES_READONLY
+    RTEXT           "Vert. size:",-1,7,84,81,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_FILTERVZMULT,92,83,35,150,CBS_DROPDOWN | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Slider1",IDC_FILTERVZ,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,147,77,152,19
+    EDITTEXT        IDC_FILTERVZV,316,79,42,12,ES_CENTER | ES_READONLY
+    RTEXT           "Horiz. position:",-1,5,105,81,10,SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_FILTERHO,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,147,98,151,19
+    EDITTEXT        IDC_FILTERHOV,316,100,42,12,ES_CENTER | ES_READONLY
+    RTEXT           "Vert. position:",-1,5,125,81,10,SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_FILTERVO,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,147,119,151,19
+    EDITTEXT        IDC_FILTERVOV,316,121,42,12,ES_CENTER | ES_READONLY
+    GROUPBOX        "Aspect Ratio Correction",-1,1,152,144,89
+    COMBOBOX        IDC_FILTERASPECT,14,169,99,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Keep autoscale aspect",IDC_FILTERKEEPAUTOSCALEASPECT,
+                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,189,126,11
+    CONTROL         "Keep aspect ratio",IDC_FILTERKEEPASPECT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,204,126,11
+    COMBOBOX        IDC_FILTERASPECT2,14,220,99,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Extra Settings",-1,154,152,240,89
+    COMBOBOX        IDC_FILTERXTRA,177,172,138,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_FILTERSLR,327,172,41,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Slider1",IDC_FILTERXL,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,195,141,19
+    EDITTEXT        IDC_FILTERXLV,327,197,41,12,ES_CENTER | ES_READONLY
+    GROUPBOX        "Presets",-1,1,245,393,36
+    COMBOBOX        IDC_FILTERPRESETS,13,260,183,150,CBS_DROPDOWN | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Load",IDC_FILTERPRESETLOAD,205,259,55,14
+    PUSHBUTTON      "Save",IDC_FILTERPRESETSAVE,265,259,55,14
+    PUSHBUTTON      "Delete",IDC_FILTERPRESETDELETE,325,259,55,14
+END
+
+IDD_HARDDRIVE DIALOGEX 0, 0, 396, 109
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Harddrive Settings"
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    LTEXT           "Hard drive:",IDC_STATIC,7,11,80,10
+    COMBOBOX        IDC_HARDDRIVE,49,9,339,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    DEFPUSHBUTTON   "Create hard disk image file",IDC_HARDDRIVE_IMAGE,49,67,115,14
+    EDITTEXT        IDC_PATH_NAME,183,67,97,15,ES_AUTOHSCROLL | NOT WS_VISIBLE
+    RTEXT           "HD Controller:",IDC_STATIC,12,90,65,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_HDF_CONTROLLER,91,89,61,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Read/write",IDC_HDF_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,172,90,60,10
+    DEFPUSHBUTTON   "Add hard drive",IDOK,236,87,73,14
+    PUSHBUTTON      "Cancel",IDCANCEL,316,87,73,14
+    EDITTEXT        IDC_HDFINFO,5,29,385,12,ES_CENTER | ES_READONLY
+    EDITTEXT        IDC_HDFINFO2,5,46,385,12,ES_CENTER | ES_READONLY
+END
+
+IDD_MISC2 DIALOGEX 0, 0, 396, 263
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    GROUPBOX        "When Active",IDC_STATIC,1,7,125,91
+    CTEXT           "Run at priority:",IDC_ACTIVE_PRI,10,18,108,10,SS_CENTERIMAGE | WS_TABSTOP
+    COMBOBOX        IDC_ACTIVE_PRIORITY,10,33,108,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CTEXT           "Mouse uncaptured:",IDC_STATIC,10,50,101,15,SS_CENTERIMAGE
+    CONTROL         "Pause emulation",IDC_ACTIVE_PAUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,67,109,10
+    CONTROL         "Disable sound",IDC_ACTIVE_NOSOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,81,109,10
+    GROUPBOX        "When Inactive",IDC_STATIC,133,7,126,90
+    CTEXT           "Run at priority:",IDC_INACTIVE_PRI,144,18,107,10,SS_CENTERIMAGE | WS_TABSTOP
+    COMBOBOX        IDC_INACTIVE_PRIORITY,144,33,108,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Pause emulation",IDC_INACTIVE_PAUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,67,109,10
+    CONTROL         "Disable sound",IDC_INACTIVE_NOSOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,81,109,10
+    GROUPBOX        "When Minimized",IDC_STATIC,269,7,125,89
+    CTEXT           "Run at priority:",IDC_MINIMIZED_PRI,278,19,109,10,SS_CENTERIMAGE | WS_TABSTOP
+    COMBOBOX        IDC_MINIMIZED_PRIORITY,278,33,108,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Pause emulation",IDC_MINIMIZED_PAUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,67,108,10
+    CONTROL         "Disable sound",IDC_MINIMIZED_NOSOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,81,108,10
+    GROUPBOX        "File Extension Associations",IDC_STATIC,0,107,260,155
+    CONTROL         "",IDC_ASSOCIATELIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,9,124,238,108
+    PUSHBUTTON      "Associate all",IDC_ASSOCIATE_ON,36,240,85,14
+    PUSHBUTTON      "Deassociate all",IDC_ASSOCIATE_OFF,125,240,85,14
+END
+
+IDD_DISK DIALOGEX 0, 0, 396, 318
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_CONTROL | DS_CENTER | DS_CENTERMOUSE | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    PUSHBUTTON      "Insert floppy disk image",IDC_DISKLISTINSERT,72,299,121,15
+    PUSHBUTTON      "Remove floppy disk image",IDC_DISKLISTREMOVE,202,299,121,15
+    COMBOBOX        IDC_DISKTEXT,1,281,393,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "",IDC_DISKLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,4,393,275
+END
+
+IDD_PANEL DIALOGEX 0, 0, 530, 345
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_ACCEPTFILES | WS_EX_CONTROLPARENT
+CAPTION "WinUAE Properties"
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    CONTROL         "",IDC_PANELTREE,"SysTreeView32",TVS_HASLINES | TVS_SHOWSELALWAYS | TVS_TRACKSELECT | TVS_NOHSCROLL | WS_BORDER | WS_TABSTOP,3,5,110,321,WS_EX_CLIENTEDGE
+    GROUPBOX        "",IDC_PANEL_FRAME_OUTER,116,2,409,324
+    GROUPBOX        "",IDC_PANEL_FRAME,119,5,402,318,NOT WS_VISIBLE
+    PUSHBUTTON      "Reset",IDC_RESETAMIGA,3,328,47,14
+    PUSHBUTTON      "Quit",IDC_QUITEMU,55,328,47,14
+    PUSHBUTTON      "Restart",IDC_RESTARTEMU,107,328,47,14,NOT WS_VISIBLE
+    DEFPUSHBUTTON   "OK",IDOK,375,328,47,14
+    PUSHBUTTON      "Cancel",IDCANCEL,427,328,47,14
+    PUSHBUTTON      "Help",IDHELP,479,328,47,14,WS_DISABLED
+END
+
+IDD_PATHS DIALOGEX 0, 0, 396, 303
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    LTEXT           "System ROMs:",IDC_PATHS_ROML,3,2,260,8,SS_CENTERIMAGE
+    EDITTEXT        IDC_PATHS_ROM,3,13,377,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_PATHS_ROMS,384,13,11,15
+    LTEXT           "Configuration files:",IDC_PATHS_CONFIGL,3,32,164,8,SS_CENTERIMAGE
+    CONTROL         "Cache Configuration files",IDC_PATHS_CONFIGCACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,177,31,197,11
+    EDITTEXT        IDC_PATHS_CONFIG,3,44,377,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_PATHS_CONFIGS,384,43,11,15
+    LTEXT           "Screenshots:",IDC_PATHS_SCREENSHOTL,3,62,260,8,SS_CENTERIMAGE
+    EDITTEXT        IDC_PATHS_SCREENSHOT,3,73,377,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_PATHS_SCREENSHOTS,384,72,11,15
+    LTEXT           "State files:",IDC_PATHS_STATEFILEL,3,91,260,8,SS_CENTERIMAGE
+    EDITTEXT        IDC_PATHS_SAVESTATE,3,102,377,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_PATHS_SAVESTATES,384,101,11,15
+    LTEXT           "Videos:",IDC_PATHS_AVIOUTPUTL,3,120,260,8,SS_CENTERIMAGE
+    EDITTEXT        IDC_PATHS_AVIOUTPUT,3,131,377,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_PATHS_AVIOUTPUTS,384,130,11,15
+    LTEXT           "Saveimages:",IDC_PATHS_SAVEIMAGEL,3,149,260,8,SS_CENTERIMAGE
+    EDITTEXT        IDC_PATHS_SAVEIMAGE,3,161,377,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_PATHS_SAVEIMAGES,384,160,11,15
+    LTEXT           "Rips:",IDC_PATHS_RIPSL,3,179,260,8,SS_CENTERIMAGE
+    EDITTEXT        IDC_PATHS_RIP,3,190,377,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_PATHS_RIPS,383,189,11,15
+    PUSHBUTTON      "Reset to defaults",IDC_PATHS_DEFAULT,2,212,92,14
+    PUSHBUTTON      "Rescan ROMs",IDC_ROM_RESCAN,2,229,92,14
+    PUSHBUTTON      "Clear disk history",IDC_RESETDISKHISTORY,99,229,92,14
+    COMBOBOX        IDC_PATHS_DEFAULTTYPE,99,213,163,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Clear registry",IDC_RESETREGISTRY,302,212,92,14
+    CONTROL         "Use relative paths",IDC_PATHS_RELATIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,199,231,189,11
+    EDITTEXT        IDC_LOGPATH,7,281,324,13,ES_READONLY
+    PUSHBUTTON      "Open [] Open selected file.",IDC_LOGOPEN,337,280,51,14
+    COMBOBOX        IDC_LOGSELECT,7,263,169,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Enable full logging (temporary)",IDC_LOGENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,264,140,12
+    PUSHBUTTON      "Save All [] Save and open both logs and config file.",IDC_LOGSAVE,337,264,51,14
+    GROUPBOX        "Debug logging",IDC_STATIC,1,248,393,53
+END
+
+IDD_QUICKSTART DIALOGEX 0, 0, 396, 262
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    GROUPBOX        "Emulated Hardware",IDC_QUICKSTART_CONFIG,1,0,393,54
+    RTEXT           "Model:",IDC_STATIC,5,14,68,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_QUICKSTART_MODEL,77,12,263,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "NTSC [] North American and Japanese display standard, 60Hz refresh rate. Other countries use PAL (50Hz. display refresh rate)",IDC_NTSC,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,347,14,35,12
+    RTEXT           "Configuration:",IDC_STATIC,5,33,68,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_QUICKSTART_CONFIGURATION,77,31,310,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Compatibility vs Required CPU Power ",IDC_QUICKSTART_COMPA,1,58,393,33
+    RTEXT           "Best compatibility",IDC_STATIC,20,73,98,10,SS_CENTERIMAGE
+    CONTROL         "",IDC_QUICKSTART_COMPATIBILITY,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,145,68,115,21
+    LTEXT           "Low compatibility",IDC_STATIC,279,74,92,10,SS_CENTERIMAGE
+    GROUPBOX        "Host Configuration",IDC_QUICKSTART_HOST,1,96,393,35
+    RTEXT           "Configuration:",IDC_STATIC,5,109,68,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_QUICKSTART_HOSTCONFIG,77,107,310,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Emulated Drives",IDC_QUICKSTART_DF,1,135,393,93
+    CONTROL         "Floppy drive DF0:",IDC_DF0QENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,148,77,15
+    PUSHBUTTON      "Select image file",IDC_DF0QQ,93,148,98,15
+    RTEXT           "Write-protected",IDC_DF0WPTEXTQ,196,151,69,10,SS_CENTERIMAGE
+    CONTROL         "",IDC_DF0WPQ,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,270,149,10,15
+    PUSHBUTTON      "Eject",IDC_EJECT0Q,358,148,30,15
+    COMBOBOX        IDC_DF0TEXTQ,9,167,379,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Floppy drive DF1:",IDC_DF1QENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,186,77,15
+    PUSHBUTTON      "Select image file",IDC_DF1QQ,93,186,98,15
+    RTEXT           "Write-protected",IDC_DF1WPTEXTQ,195,189,69,10,SS_CENTERIMAGE
+    CONTROL         "",IDC_DF1WPQ,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,270,185,10,15
+    PUSHBUTTON      "Eject",IDC_EJECT1Q,358,186,30,15
+    COMBOBOX        IDC_DF1TEXTQ,9,204,379,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Set configuration",IDC_QUICKSTART_SETCONFIG,9,239,88,15,NOT WS_VISIBLE
+    GROUPBOX        "Mode",IDC_STATIC,250,231,144,28,BS_LEFT
+    CONTROL         "Start in Quickstart mode",IDC_QUICKSTARTMODE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,259,242,131,12
+    COMBOBOX        IDC_CD0Q_TYPE,199,187,74,50,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
+END
+
+IDD_FRONTEND DIALOGEX 0, 0, 420, 242
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    CONTROL         "",IDC_FE_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,6,9,235,124
+    GROUPBOX        "",IDC_FE_INFO,249,140,160,95
+    GROUPBOX        "",IDC_FE_SCREENSHOT,249,7,160,128
+END
+
+IDD_PROGRESSBAR DIALOGEX 0, 0, 396, 58
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Processing..."
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    PUSHBUTTON      "Cancel",IDCANCEL,169,40,58,14
+    CONTROL         "",IDC_PROGRESSBAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,19,381,14
+    CTEXT           "x",IDC_PROGRESSBAR_TEXT,14,5,368,10,SS_CENTERIMAGE | WS_TABSTOP
+END
+
+IDD_STRINGBOX DIALOGEX 0, 0, 396, 209
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Enter text..."
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    EDITTEXT        IDC_STRINGBOXEDIT,6,8,383,176,ES_MULTILINE
+    DEFPUSHBUTTON   "OK",IDOK,120,190,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,224,190,50,14
+END
+
+IDD_DEBUGGER DIALOGEX 0, 0, 454, 368
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_CONTROLPARENT
+CAPTION "WinUAE Debugger"
+FONT 8, "Courier New", 0, 0, 0x0
+BEGIN
+    LISTBOX         IDC_DBG_DREG,1,1,52,66,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    LISTBOX         IDC_DBG_AREG,54,1,52,66,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    LISTBOX         IDC_DBG_AMEM,106,1,231,66,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    LISTBOX         IDC_DBG_CCR,338,1,57,42,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    LISTBOX         IDC_DBG_MMISC,396,1,57,42,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    LISTBOX         IDC_DBG_PC,1,68,52,10,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    LISTBOX         IDC_DBG_PREFETCH,54,68,283,10,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    LISTBOX         IDC_DBG_SP_VBR,338,44,115,34,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    EDITTEXT        IDC_DBG_OUTPUT2,1,79,370,262,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | NOT WS_TABSTOP
+    PUSHBUTTON      "Set to PC",IDC_DBG_MEMTOPC,38,79,45,12,NOT WS_TABSTOP
+    CONTROL         "Auto set",IDC_DBG_AUTOSET,"Button",BS_AUTOCHECKBOX,84,79,50,12
+    LISTBOX         IDC_DBG_MCUSTOM,372,79,81,138,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    LISTBOX         IDC_DBG_MEM,1,92,370,249,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    LISTBOX         IDC_DBG_MEM2,1,167,370,87,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    LISTBOX         IDC_DBG_FPREG,372,218,81,66,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    EDITTEXT        IDC_DBG_OUTPUT1,1,255,370,86,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | NOT WS_TABSTOP
+    LISTBOX         IDC_DBG_FPSR,372,285,81,34,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    LISTBOX         IDC_DBG_MISCCPU,372,320,81,34,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    EDITTEXT        IDC_DBG_INPUT,1,342,354,12,ES_AUTOHSCROLL | ES_WANTRETURN
+    PUSHBUTTON      "?",IDC_DBG_HELP,356,342,15,12,NOT WS_TABSTOP
+    CONTROL         "",IDC_DBG_STATUS,"msctls_statusbar32",0x103,0,355,453,12
+    LISTBOX         IDC_DBG_DASM,1,92,370,249,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+    EDITTEXT        IDC_DBG_MEMINPUT,1,79,36,12,ES_AUTOHSCROLL | ES_WANTRETURN
+    LISTBOX         IDC_DBG_BRKPTS,1,79,370,262,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL
+    LISTBOX         IDC_DBG_MISC,1,79,370,262,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL
+    LISTBOX         IDC_DBG_CUSTOM,1,79,370,262,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL
+    LISTBOX         IDC_DBG_DASM2,1,79,370,87,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT
+END
+
+IDD_DBGMEMINPUT DIALOGEX 0, 0, 150, 58
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Enter address..."
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,15,39,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,75,39,50,14
+    EDITTEXT        IDC_DBG_MEMINPUT2,20,12,100,14,ES_AUTOHSCROLL | ES_WANTRETURN
+    CTEXT           "Enter address",IDC_DBG_ADDRINPUTTXT,20,1,100,10,SS_CENTERIMAGE | WS_TABSTOP
+END
+
+IDD_EXPANSION DIALOGEX 0, 0, 396, 278
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    GROUPBOX        "RTG Graphics Card",IDC_STATIC,1,0,393,189
+    COMBOBOX        IDC_RTG_Z2Z3,26,14,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Memory: [] Graphics card memory. Required for RTG (Picasso96) emulation.",IDC_GFXCARDTEXT,2,35,76,10,SS_NOTIFY | SS_CENTERIMAGE
+    CONTROL         "",IDC_P96MEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,88,31,60,20
+    EDITTEXT        IDC_P96RAM,152,34,40,12,ES_CENTER | ES_READONLY
+    CONTROL         "Match host and RTG color depth if possible",IDC_RTG_MATCH_DEPTH,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,54,212,10
+    CONTROL         "Scale if smaller than display size setting",IDC_RTG_SCALE,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,67,212,10
+    CONTROL         "Always scale in windowed mode",IDC_RTG_SCALE_ALLOW,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,80,212,10
+    CONTROL         "Hardware vertical blank interrupt",IDC_RTG_VBINTERRUPT,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,106,157,10
+    CONTROL         "Hardware sprite emulation",IDC_RTG_HWSPRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,207,106,148,10
+    CTEXT           "Color modes:",IDC_STATIC,295,9,83,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_RTG_8BIT,296,23,82,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_RTG_16BIT,296,40,82,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_RTG_24BIT,296,58,82,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_RTG_32BIT,296,75,82,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_RTG_DISPLAYSELECT,11,125,371,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CTEXT           "Refresh rate:",IDC_STATIC,30,149,83,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_RTG_VBLANKRATE,29,162,84,150,CBS_DROPDOWN | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CTEXT           "Buffer mode:",IDC_STATIC,154,149,83,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_RTG_BUFFERCNT,153,162,84,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    CTEXT           "Aspect ratio:",IDC_STATIC,282,149,83,10,SS_CENTERIMAGE
+    COMBOBOX        IDC_RTG_SCALE_ASPECTRATIO,282,162,84,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Miscellaneous Expansions",IDC_STATIC,1,197,172,80
+    CONTROL         "Catweasel Z2 emulation [] Catweasel MK2 Zorro II card emulation. Physical Windows compatible Catweasel card and drivers required.",IDC_CATWEASEL,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,216,147,11
+    CONTROL         "uaescsi.device",IDC_SCSIDEVICE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,229,147,11
+    GROUPBOX        "Network",IDC_STATIC,181,197,213,80
+    CONTROL         "bsdsocket.library [] bsdsocket network library emulation.",IDC_SOCKETS,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,216,187,11
+    CONTROL         "uaenet.device [] Sana 2 compatible network device emulation. WinPcap required.",IDC_SANA2,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,229,187,11
+    CONTROL         "A2065 Z2 [] A2065 Ethernet Zorro II card emulation. WinPcap required.",IDC_A2065,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,242,187,11
+    COMBOBOX        IDC_NETDEVICE,202,257,156,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Always center",IDC_RTG_CENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,93,212,10
+END
+
+IDD_INPUTMAP DIALOGEX 0, 0, 396, 318
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+    CONTROL         "",IDC_INPUTMAPLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,1,393,268
+    EDITTEXT        IDC_INPUTMAPOUT,1,272,393,14,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED
+    EDITTEXT        IDC_INPUTMAPOUTM,1,288,393,29,ES_MULTILINE | ES_READONLY | WS_DISABLED
+END
+
+IDD_INFOBOX DIALOGEX 0, 0, 420, 68
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Scanning ROM image files..."
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,147,51,58,14,NOT WS_VISIBLE
+    PUSHBUTTON      "Cancel",IDCANCEL,214,51,58,14
+    CTEXT           "",IDC_INFOBOX_TEXT1,4,7,412,11,SS_CENTERIMAGE | SS_SUNKEN | WS_TABSTOP
+    CTEXT           "",IDC_INFOBOX_TEXT2,4,21,412,11,SS_CENTERIMAGE | SS_SUNKEN | WS_TABSTOP
+    CTEXT           "",IDC_INFOBOX_TEXT3,4,35,412,11,SS_CENTERIMAGE | SS_SUNKEN | WS_TABSTOP
+END
+
+IDD_LIST DIALOGEX 0, 0, 316, 206
+STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Select Qualifiers"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,205,185,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,259,185,50,14
+    DEFPUSHBUTTON   "Clear",IDC_LISTDIALOG_CLEAR,6,185,50,14
+    CONTROL         "",IDC_LISTDIALOG_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,302,171
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 2,5,2,0
+ PRODUCTVERSION 2,5,2,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "FileDescription", "WinUAE"
+            VALUE "FileVersion", "2.6.0.0"
+            VALUE "InternalName", "WinUAE"
+            VALUE "LegalCopyright", "© 1996-2013 under the GNU Public License (GPL)"
+            VALUE "OriginalFilename", "WinUAE.exe"
+            VALUE "ProductName", "WinUAE"
+            VALUE "ProductVersion", "2.6.0.0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Cursor
+//
+
+IDC_MYHAND              CURSOR                  "H_arrow.cur"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDM_SYSTRAY MENU
+BEGIN
+    POPUP "Menu"
+    BEGIN
+        MENUITEM "Configuration",               ID_ST_CONFIGURATION
+        POPUP "Floppy drives"
+        BEGIN
+            MENUITEM "Eject all drives",            ID_ST_EJECTALL
+            MENUITEM "DF0:",                        ID_ST_DF0
+            MENUITEM "DF1:",                        ID_ST_DF1
+            MENUITEM "DF2:",                        ID_ST_DF2
+            MENUITEM "DF3:",                        ID_ST_DF3
+        END
+        POPUP "CD drives"
+        BEGIN
+            MENUITEM "Eject",                       ID_ST_CDEJECTALL
+            MENUITEM "CD",                          ID_ST_CD0
+        END
+        MENUITEM "Reset",                       ID_ST_RESET
+        MENUITEM "Help",                        ID_ST_HELP
+        MENUITEM "Quit WinUAE",                 ID_ST_QUIT
+    END
+END
+
+IDM_DBGCONTEXTMENU MENU
+BEGIN
+    POPUP "Inactive"
+    BEGIN
+        POPUP "Copy"
+        BEGIN
+            MENUITEM "Copy line",                   ID_DBG_COPYLBLINE
+            MENUITEM "Copy all",                    ID_DBG_COPYLB
+        END
+    END
+    POPUP "Memory"
+    BEGIN
+        POPUP "Copy"
+        BEGIN
+            MENUITEM "Copy line",                   ID_DBG_COPYLBLINE
+            MENUITEM "Copy all",                    ID_DBG_COPYLB
+        END
+        POPUP "Set top address"
+        BEGIN
+            MENUITEM "Set to A0",                   ID_DBG_SETTOA0
+            MENUITEM "Set to A1",                   ID_DBG_SETTOA1
+            MENUITEM "Set to A2",                   ID_DBG_SETTOA2
+            MENUITEM "Set to A3",                   ID_DBG_SETTOA3
+            MENUITEM "Set to A4",                   ID_DBG_SETTOA4
+            MENUITEM "Set to A5",                   ID_DBG_SETTOA5
+            MENUITEM "Set to A6",                   ID_DBG_SETTOA6
+            MENUITEM "Set to A7",                   ID_DBG_SETTOA7
+            MENUITEM "Enter address",               ID_DBG_ENTERADDR
+        END
+    END
+    POPUP "Disassembly"
+    BEGIN
+        POPUP "Copy"
+        BEGIN
+            MENUITEM "Copy line",                   ID_DBG_COPYLBLINE
+            MENUITEM "Copy all",                    ID_DBG_COPYLB
+        END
+        POPUP "Breakpoints"
+        BEGIN
+            MENUITEM "Toggle breakpoint",           ID_DBG_TOGGLEBP
+            MENUITEM "Clear all breakpoints",       ID_DBG_DELETEBPS
+        END
+        POPUP "Set top address"
+        BEGIN
+            MENUITEM "Set to PC",                   ID_DBG_SETTOPC
+            MENUITEM "Enter address",               ID_DBG_ENTERADDR
+        END
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// WAVE
+//
+
+IDR_DRIVE_STARTUP_A500_1 WAVE                    "drive_startup.wav"
+IDR_DRIVE_CLICK_A500_1  WAVE                    "drive_click.wav"
+IDR_DRIVE_SPIN_A500_1   WAVE                    "drive_spin.wav"
+IDR_DRIVE_SNATCH_A500_1 WAVE                    "drive_snatch.wav"
+IDR_DRIVE_SPINND_A500_1 WAVE                    "drive_spinnd.wav"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDB_XARCADE             BITMAP                  "xarcade-winuae.bmp"
+IDB_LCD160X43           BITMAP                  "lcd.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+    IDD_KICKSTART, DIALOG
+    BEGIN
+        BOTTOMMARGIN, 214
+    END
+
+    IDD_DISPLAY, DIALOG
+    BEGIN
+        BOTTOMMARGIN, 270
+    END
+
+    IDD_MEMORY, DIALOG
+    BEGIN
+    END
+
+    IDD_CPU, DIALOG
+    BEGIN
+    END
+
+    IDD_FLOPPY, DIALOG
+    BEGIN
+    END
+
+    IDD_HARDDISK, DIALOG
+    BEGIN
+    END
+
+    IDD_SOUND, DIALOG
+    BEGIN
+    END
+
+    IDD_LOADSAVE, DIALOG
+    BEGIN
+    END
+
+    IDD_IOPORTS, DIALOG
+    BEGIN
+        BOTTOMMARGIN, 293
+    END
+
+    IDD_GAMEPORTS, DIALOG
+    BEGIN
+    END
+
+    IDD_CONTRIBUTORS, DIALOG
+    BEGIN
+    END
+
+    IDD_ABOUT, DIALOG
+    BEGIN
+    END
+
+    IDD_MISC1, DIALOG
+    BEGIN
+    END
+
+    IDD_HARDFILE, DIALOG
+    BEGIN
+    END
+
+    IDD_FILESYS, DIALOG
+    BEGIN
+    END
+
+    IDD_SETINFO, DIALOG
+    BEGIN
+    END
+
+    IDD_CHIPSET, DIALOG
+    BEGIN
+    END
+
+    IDD_CHIPSET2, DIALOG
+    BEGIN
+    END
+
+    IDD_AVIOUTPUT, DIALOG
+    BEGIN
+    END
+
+    IDD_INPUT, DIALOG
+    BEGIN
+    END
+
+    IDD_FILTER, DIALOG
+    BEGIN
+        BOTTOMMARGIN, 286
+    END
+
+    IDD_HARDDRIVE, DIALOG
+    BEGIN
+        BOTTOMMARGIN, 108
+    END
+
+    IDD_MISC2, DIALOG
+    BEGIN
+    END
+
+    IDD_DISK, DIALOG
+    BEGIN
+    END
+
+    IDD_PANEL, DIALOG
+    BEGIN
+    END
+
+    IDD_PATHS, DIALOG
+    BEGIN
+    END
+
+    IDD_QUICKSTART, DIALOG
+    BEGIN
+    END
+
+    IDD_FRONTEND, DIALOG
+    BEGIN
+    END
+
+    IDD_PROGRESSBAR, DIALOG
+    BEGIN
+    END
+
+    IDD_STRINGBOX, DIALOG
+    BEGIN
+    END
+
+    IDD_DEBUGGER, DIALOG
+    BEGIN
+    END
+
+    IDD_DBGMEMINPUT, DIALOG
+    BEGIN
+    END
+
+    IDD_EXPANSION, DIALOG
+    BEGIN
+    END
+
+    IDD_INPUTMAP, DIALOG
+    BEGIN
+        TOPMARGIN, 1
+    END
+
+    IDD_INFOBOX, DIALOG
+    BEGIN
+    END
+
+    IDD_LIST, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 309
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 199
+    END
+END
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+    IDS_KICKSTART           "ROM"
+    IDS_DISK                "Disk swapper"
+    IDS_DISPLAY             "Display"
+    IDS_HARDDISK            "Hard drives"
+    IDS_FLOPPY              "Floppy drives"
+    IDS_ABOUT               "About"
+    IDS_LOADSAVE            "Configurations"
+    IDS_AVIOUTPUT           "Output"
+    IDS_IOPORTS             "IO ports"
+    IDS_MISC1               "Miscellaneous"
+    IDS_MEMORY              "RAM"
+    IDS_CPU                 "CPU and FPU"
+    IDS_CHIPSET             "Chipset"
+    IDS_INPUT               "Input"
+    IDS_FILTER              "Filter"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_MISC2               "Pri. & Extensions"
+    IDS_PATHS               "Paths"
+    IDS_QUICKSTART          "Quickstart"
+    IDS_FRONTEND            "Frontend"
+    IDS_CHIPSET2            "Adv. Chipset"
+    IDS_GAMEPORTS           "Game ports"
+    IDS_EXPANSION           "Expansions"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_EXTTEXT             "Floppy disk image files"
+    IDS_EXTACTUAL           "ADF"
+    IDS_SOUND               "Sound"
+    IDS_CDROM               "CD-ROM"
+    IDS_FRAMERATE           "Every %1Frame"
+    IDS_SECOND              "second "
+    IDS_THIRD               "third "
+    IDS_FOURTH              "fourth "
+    IDS_FIFTH               "fifth "
+    IDS_SIXTH               "sixth "
+    IDS_SEVENTH             "seventh "
+    IDS_EIGHTH              "eighth "
+END
+
+STRINGTABLE
+BEGIN
+    IDS_NINTH               "ninth "
+    IDS_TENTH               "tenth "
+    IDS_SELECTADF           "Select a floppy disk image file..."
+    IDS_ADF                 "Floppy disk image files"
+    IDS_CHOOSEBLANK         "Choose a blank floppy disk image file..."
+    IDS_SELECTHDF           "Select a hard disk image file..."
+    IDS_HDF                 "Hard disk image files"
+    IDS_SELECTUAE           "Select a WinUAE configuration file..."
+    IDS_UAE                 "WinUAE configuration files"
+    IDS_SELECTROM           "Select a system ROM file..."
+    IDS_ROM                 "System ROM files"
+    IDS_SELECTKEY           "Select a system ROM key file..."
+    IDS_KEY                 "System ROM key files"
+    IDS_SELECTINFO          "Select information for your configuration..."
+    IDS_NONE                "none"
+    IDS_VOLUME              "Volume"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_SELECTFILESYSROOT   "Please select the root directory of the file system..."
+    IDS_DEFAULTMIDIOUT      "Default MIDI-Out Device"
+    IDS_CONTRIBUTORS1       "Bernd Schmidt - The Grand-Master\nSam Jordan - Custom-chip, floppy-DMA, etc.\nMathias Ortmann - Original WinUAE Main Guy, BSD Socket support\nBrian King - Picasso96 Support, Integrated GUI for WinUAE, previous WinUAE Main Guy\nToni Wilen - Core updates, WinUAE Main Guy\nGustavo Goedert/Peter Remmers/Michael Sontheimer/Tomi Hakala/Tim Gunn/Nemo Pohle - DOS Port Stuff\nSamuel Devulder/Olaf Barthel/Sam Jordan - Amiga Ports\nKrister Bergman - XFree86 and OS/2 Port\nA. Blanchard/Ernesto Corvi - MacOS Port\nChristian Bauer - BeOS Port\nIan Stephenson - NextStep Port\nPeter Teichmann - Acorn/RiscOS Port\nStefan Reinauer - ZorroII/III AutoConfig, Serial Support\nChristian Schmitt/Chris Hames - Serial Support\nHerman ten Brugge - 68020/68881 Emulation Code\nTauno Taipaleenmaki - Various UAE-Control/UAE-Library Support\nBrett Eden/Tim Gunn/Paolo Besser/Nemo Pohle - Various Docs and Web-Sites\nGeorg Veichtlbauer - Help File coordinator, German GUI\nFulvio Leonardi - Italian translator for WinUAE\n"
+    IDS_CONTRIBUTORS2       "Arnljot Arntsen, Bill Panagouleas, Cloanto - Hardware support\nSpecial thanks to Alexander Kneer and Tobias Abt (The Picasso96 Team)\nSteven Weiser  - Postscript printing emulation idea and testing.\nPéter Tóth /Balázs Rátkai/Iván Herczeg/András Arató - Hungarian translation.\nKarsten Bock, Gavin Fance, Dirk Trowe and Christian Schindler - Freezer cartridge hardware support.\nMikko Nieminen - Demo compatibility testing.\nArabuusimiehet - [This information is on a need-to-know basis]"
+    IDS_INVALIDPRTPORT      "The printer you have in this configuration is not valid on this machine.\n"
+    IDS_RESTOREUSS          "Restore a WinUAE snapshot file"
+    IDS_USS                 "WinUAE snapshot files"
+    IDS_SELECTFLASH         "Select a flash or battery-backed RAM file..."
+    IDS_FLASH               "WinUAE flash or battery-backed RAM file"
+    IDS_INPUTHOSTWIDGET     "Input source"
+    IDS_INPUTAMIGAEVENT     "Input target"
+    IDS_INPUTAUTOFIRE       "Autofire"
+    IDS_SAVEUSS             "Save a WinUAE snapshot file"
+    IDS_MIDIOVERFLOW        "Sysexbuffer overflow. Should not happen."
+END
+
+STRINGTABLE
+BEGIN
+    IDS_PATH                "Path"
+    IDS_RW                  "R/W"
+    IDS_SECTORS             "Sectors"
+    IDS_SURFACES            "Surfaces"
+    IDS_RESERVED            "Reserved"
+    IDS_BLOCKSIZE           "Block size"
+    IDS_NAME                "Name"
+    IDS_DESCRIPTION         "Description"
+    IDS_COULDNOTLOADCONFIG  "Could not load the selected configuration!\n"
+    IDS_NOHELP              "Online help is disabled because the HTML Help functionality is not installed on this system. HTML Help is available from http://www.microsoft.com/downloads/.\n"
+    IDS_MUSTSELECTCONFIG    "You must select a configuration or enter a name before selecting Load...\n"
+    IDS_INVALIDCOMPORT      "The serial port you have in this configuration is not valid on this machine.\n"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_HFDSIZE             "Size"
+    IDS_DEVICE              "Device"
+    IDS_BOOTPRI             "BootPri"
+    IDS_FLOPPY_COMPATIBLE   " (compatible)"
+    IDS_FLOPPY_TURBO        "Turbo"
+    IDS_YES                 "yes"
+    IDS_NO                  "no"
+    IDS_PRI_ABOVENORMAL     "Above Normal"
+    IDS_PRI_NORMAL          "Normal"
+    IDS_PRI_BELOWNORMAL     "Below Normal"
+    IDS_PRI_LOW             "Low"
+    IDS_OLDRTGLIBRARY       "The installed LIBS:Picasso96/rtg.library (%d.%d) should be updated.\nA newer version is included in the ""Amiga Programs"" directory\n of the WinUAE distribution archive.\n\nNewer library version fixes graphics problems and increases performance."
+    IDS_DEFAULT_AF          "Amiga Forever"
+    IDS_DEFAULT_WINUAE      "WinUAE default (EXE directory)"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_SOUND_STEREO2       "Cloned Stereo (4 Channels)"
+    IDS_INPUT_CUSTOMEVENT   "<Custom event>"
+    IDS_DEFAULT_NEWWINUAE   "WinUAE default (User directory)"
+    IDS_SOUND_CLONED51      "Cloned Stereo (5.1)"
+    IDS_SOUND_51            "5.1 Channels"
+    IDS_AUTOMATIC           "Automatic"
+    IDS_ALL                 "All"
+    IDS_INPUTTOGGLE         "Toggle"
+    IDS_NETDISCONNECTED     "Cable disconnected"
+    IDS_QS_CD               "CD"
+    IDS_QS_CD_AUTO          "Autodetect"
+    IDS_QS_CD_IMAGE         "Image mode"
+    IDS_REMAPTITLE          "Input captured. F12 = Exit. F11 = Skip current event in Remap mode."
+    IDS_FILTER_NOOVERLAYS   "No overlays available"
+    IDS_STMENUNOCD          "No CD inserted"
+    IDS_ON                  "on"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_UNSUPPORTEDPIXELFORMAT 
+                            "Error: unsupported pixel format. Please use a different screen mode.\n"
+    IDS_MUSTENTERNAME       "You must select a configuration or enter a name before selecting Save...\n"
+    IDS_MUSTSELECTCONFIGFORDELETE 
+                            "You must select a configuration or enter a name before selecting Delete...\n"
+    IDS_DELETECONFIGCONFIRMATION 
+                            "Are you sure you want to Delete this configuration?\n"
+    IDS_DELETECONFIGTITLE   "Confirm Delete"
+    IDS_MUSTSELECTPATH      "You must select a path!"
+    IDS_SETTINGSERROR       "Settings error"
+    IDS_MUSTSELECTNAME      "You must select a name for the volume!"
+    IDS_MUSTSELECTFILE      "You must select a file!"
+    IDS_FAILEDHARDFILECREATION "Failed to create hard disk image file..."
+    IDS_CREATIONERROR       "Creation error"
+    IDS_ERRORTITLE          "WinUAE message"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_INP                 "WinUAE Input Recording"
+    IDS_RESTOREINP          "Playback a WinUAE input recording"
+    IDS_SAVEINP             "Record a WinUAE input recording"
+    IDS_SCREEN_WINDOWED     "Windowed"
+    IDS_SCREEN_FULLSCREEN   "Fullscreen"
+    IDS_SCREEN_FULLWINDOW   "Full-window"
+    IDS_SCREEN_VSYNC        "Legacy VSync"
+    IDS_SCREEN_VSYNC_AUTOSWITCH "Legacy VS, 50/60Hz"
+    IDS_SOUND_MONO          "Mono"
+    IDS_SOUND_MIXED         "Mixed"
+    IDS_SOUND_STEREO        "Stereo"
+    IDS_DISABLED            "Disabled"
+    IDS_SOUND_FILTER_OFF    "Always off"
+    IDS_SOUND_FILTER_EMULATED "Emulated (A500)"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_SOUND_FILTER_EMULATED_E "Emulated (A1200)"
+    IDS_INPUT_GAMEPORTS     "Game Ports Panel"
+    IDS_INPUT_CUSTOM        "Configuration #%d"
+    IDS_INPUT_COPY_DEFAULT  "GamePorts"
+    IDS_INPUT_COPY_CUSTOM   "Config #%d"
+    IDS_3D_NO_FILTER        "Point (%d-bit)"
+    IDS_3D_BILINEAR         "Bilinear (%d-bit)"
+    IDS_VSYNC_DEFAULT       "Default refresh rate"
+    IDS_DRIVESOUND_NONE     "No sound"
+    IDS_DRIVESOUND_DEFAULT_A500 "A500 (WinUAE built-in)"
+    IDS_AVIOUTPUT_NOCODEC   "no codec selected"
+    IDS_DISK_IMAGENAME      "Disk image"
+    IDS_DISK_DRIVENAME      "Drive"
+    IDS_UNSUPPORTEDSCREENMODE 
+                            "The selected screen mode can't be displayed in a window, because %s\nSwitching to full-screen display."
+    IDS_UNSUPPORTEDSCREENMODE_1 
+                            "the desktop is running in an unknown color mode."
+END
+
+STRINGTABLE
+BEGIN
+    IDS_UNSUPPORTEDSCREENMODE_2 
+                            "the desktop is running in 8-bit color depth, which WinUAE can't use in windowed mode."
+    IDS_UNSUPPORTEDSCREENMODE_3 
+                            "the desktop is too small for the specified window size."
+    IDS_UNSUPPORTEDSCREENMODE_4 
+                            "you selected an RTG (Picasso96) display with unsupported color depth."
+    IDS_FLOPPYTYPE35DD      "3.5"" DD"
+    IDS_FLOPPYTYPE35HD      "3.5"" HD"
+    IDS_FLOPPYTYPE525SD     "5.25"" SD"
+    IDS_FLOPPYTYPEDISABLED  "Disabled"
+    IDS_STMENUNOFLOPPY      "No floppy disk inserted"
+    IDS_TREEVIEW_HARDWARE   "Hardware"
+    IDS_TREEVIEW_HOST       "Host"
+    IDS_TREEVIEW_MISC       "Miscellaneous"
+    IDS_TREEVIEW_SETTINGS   "Settings"
+    IDS_WINUAETITLE_MMB     "[ALT+TAB or middle mouse button untraps mouse - F12 opens settings]"
+    IDS_WINUAETITLE_NORMAL  "[ALT+TAB untraps mouse - F12 opens settings]"
+    IDS_STARTEMULATION      "Start"
+    IDS_TREEVIEW_ABOUT      "About"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_NOHARDDRIVES        "No hard disks detected that were either empty or RDB-partitioned."
+    IDS_DEFAULT_HOST        "Default Configuration"
+    IDS_SOUND_4CHANNEL      "4 Channels"
+    IDS_HF_FS_CUSTOM        "Custom"
+    IDS_SELECTFS            "Select file system handler (FastFileSystem, SmartFilesystem, etc.)"
+    IDS_KEYJOY              "Keyboard Layout A (Numeric keypad, 0 and 5 = Fire)\nKeyboard Layout B (Cursor keys, Right CTRL and ALT = Fire)\nKeyboard Layout C (W=Up S=Down A=Left D=Right, Left ALT = Fire)\nX-Arcade (Left)\nX-Arcade (Right)"
+    IDS_STATEFILE_UNCOMPRESSED "Uncompressed"
+    IDS_STATEFILE_RAMDUMP   "RAM dump"
+    IDS_STATEFILE_WAVE      "Wave audio dump"
+    IDS_SOUND_SWAP_PAULA    "Paula only"
+    IDS_SOUND_SWAP_AHI      "AHI only"
+    IDS_SOUND_SWAP_BOTH     "Both"
+    IDS_SOUND_FILTER_ON_AGA "Always on (A500)"
+    IDS_SOUND_FILTER_ON_A500 "Always on (A1200)"
+    IDS_DRIVESOUND_PC_FLOPPY "PC floppy drive %c"
+    IDS_FLOPPYTYPE35DDESCOM "3.5"" ESCOM"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_NUMSG_NEEDEXT2      "The software uses a non-standard floppy disk format. You may need to use a custom floppy disk image file instead of a standard one. This message will not appear again."
+    IDS_NUMSG_NOROMKEY      "Could not find system ROM key file."
+    IDS_NUMSG_KSROMCRCERROR "System ROM checksum incorrect. The system ROM image file may be corrupt."
+    IDS_NUMSG_KSROMREADERROR "Error while reading system ROM."
+END
+
+STRINGTABLE
+BEGIN
+    IDS_NUMSG_NOEXTROM      "No extended ROM found."
+    IDS_NUMSG_MODRIP_NOTFOUND "No music modules or packed data found."
+    IDS_NUMSG_MODRIP_FINISHED "Scan finished."
+    IDS_NUMSG_MODRIP_SAVE   "Module/packed data found\n%s\nStart address %08.8X, Size %d bytes\nWould you like to save it?"
+    IDS_NUMSG_KS68020       "The selected system ROM requires a 68020 with 32-bit addressing or 68030 or higher CPU."
+    IDS_NUMSG_ROMNEED       "One of the following system ROMs is required:\n\n%s\n\nCheck the System ROM path in the Paths panel and click Rescan ROMs."
+    IDS_NUMSG_STATEHD       "WARNING: Current configuration is not fully compatible with state saves.\nThis message will not appear again."
+    IDS_NUMSG_NOCAPS        "Selected disk image needs the SPS plugin\nwhich is available from\nhttp//www.softpres.org/"
+    IDS_NUMSG_OLDCAPS       "You need an updated SPS plugin\nwhich is available from\nhttp//www.softpres.org/"
+    IDS_IMGCHK_BOOTBLOCKCRCERROR 
+                            "The selected floppy disk image is not bootable (boot block checksum error)"
+    IDS_IMGCHK_BOOTBLOCKNO  "The selected floppy disk image is not bootable (no boot block)"
+    IDS_IMGCHK_DAMAGED      "The selected floppy disk image is damaged or unformatted"
+    IDS_IMGCHK_KS2          "The selected floppy disk image requires a 2.04 or later system ROM.\nThe configuration has been updated."
+    IDS_IMGCHK_KS3          "The selected floppy disk image requires a 3.0 or later system ROM.\nThe configuration has been updated."
+    IDS_ROMSCANEND          "Scan of ROMs finished"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_ROM_AVAILABLE       "available"
+    IDS_ROM_UNAVAILABLE     "unavailable"
+    IDS_NUMSG_KS68EC020     "The selected system ROM requires a 68020 with 24-bit addressing or higher CPU."
+    IDS_ROMSCANNOROMS       "No supported system ROMs detected."
+    IDS_NUMSG_KICKREP       "You need to have a floppy disk (image file) in DF0: to use the system ROM replacement."
+    IDS_NUMSG_KICKREPNO     "The floppy disk (image file) in DF0: is not compatible with the system ROM replacement functionality."
+    IDS_NUMSG_NOROM         "Could not load system ROM, trying system ROM replacement."
+    IDS_HDCLONE_OK          "Hard drive image file created succesfully."
+    IDS_HDCLONE_FAIL        "Hard drive image file creation failed.\nError code %d:%d."
+    IDS_NUMSG_KS68030       "The selected system ROM requires a 68030 CPU."
+    IDS_NUMSG_EXPROMNEED    "One of the following expansion boot ROMs is required:\n\n%s\n\nCheck the System ROM path in the Paths panel and click Rescan ROMs."
+    IDS_SB_FAVORITENAME     "Enter name..."
+    IDS_SB_CUSTOMEVENT      "Enter custom event string.."
+END
+
+STRINGTABLE
+BEGIN
+    IDS_QS_MODELS           "A500\nA500+\nA600\nA1000\nA1200\nA3000\nA4000\nCD32\nCDTV\nArcadia Multi Select system\nExpanded WinUAE example configuration"
+    IDS_QS_MODEL_A500       "1.3 ROM, OCS, 512 KB Chip + 512 KB Slow RAM (most common)\nThis configuration is capable of running most games and demos produced for first-generation hardware. Only few exceptions need a different configuration (e.g. the oldest games tend to be incompatible with this configuration).\n1.3 ROM, ECS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nLater hardware revision of the A500. Nearly 100% compatible with the previous configuration.\n1.3 ROM, ECS Agnus, 1 MB Chip RAM\nFew newer games and demos require this configuration.\n1.3 ROM, OCS Agnus, 512 KB Chip RAM\nVery old (e.g. pre-1988) games and demos may require this configuration.\n1.2 ROM, OCS Agnus, 512 KB Chip RAM\nAs available for the A1000, and installed on the first A500 and A2000 series. Some very old programs only work correctly with this configuration. Note: This system ROM version can only boot from floppy disk (no hard disk boot support).\n1.2 ROM, OCS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nThis configuration adds expansion memory to the first A500 produced. Try this if your game does not work with newer configurations, but works with the previous one. It could add some features to the game, including faster loading times. Note: This system ROM version can only boot from floppy disk (no hard disk boot support)."
+    IDS_QS_MODEL_A500P      "Basic non-expanded configuration\nThe A500+ adds an ECS Agnus chip, 1 MB of Chip RAM and a 2.0 ROM to the A500. Many A500 games and demos don't work properly on an A500+.\n2 MB Chip RAM expanded configuration\n\n4 MB Fast RAM expanded configuration\n"
+    IDS_QS_MODEL_A600       "Basic non-expanded configuration\nThe A600 is smaller than the A500+ and has an updated 2.0 ROM.\n2 MB Chip RAM expanded configuration\n\n4 MB Fast RAM expanded configuration\n"
+    IDS_QS_MODEL_A1000      "512 KB Chip RAM\nThe A1000 was the first model produced, with a configuration equivalent to that of an A500 with OCS chipset. You normally don't need to use this configuration, unless you are nostalgic and would like to hear the short A1000 boot tune\n""ICS"" Denise without EHB support\nVery first A1000 models had Denise without EHB capability.\n256 KB Chip RAM\n Unexpanded A1000. All later A1000 models were sold with a 256 KB RAM expansion built-in."
+    IDS_QS_MODEL_A1200      "Basic non-expanded configuration\nUse this configuration to run most AGA demos and games\n4 MB Fast RAM expanded configuration\nSome newer AGA games and demos need an expanded A1200 to run."
+    IDS_QS_MODEL_CD32       "CD32\nThe CD32 was one the first 32-bit consoles on the market. It is basically an A1200 with a built-in CD-ROM drive. Insert your CD32 or CDTV CD-ROM into a free CD-ROM drive before starting the emulation.\nCD32 + MPEG Full Motion Video Cartridge (not emulated yet)\n"
+    IDS_QS_MODEL_CDTV       "CDTV\nThe CDTV was the first model with a built-in CD-ROM drive. Looking like a black CD player, it featured a configuration equivalent to that of an A500 with 1 MB RAM and an ECS chipset.\nFloppy drive and 64KB SRAM card expanded CDTV\n"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_QS_MODEL_UAE        "High-end expanded configuration"
+    IDS_QS_MODEL_ARCADIA    "Arcadia\nArcadia Multi Select system is arcade platform developed by Arcadia and  Mastertronic. It is based on an A500 mainboard with ROM cage attached to expansion port. Arcadia ROM files go to ""Cartridge ROM File"" in ROM-panel."
+    IDS_QS_MODEL_A3000      "1.4 ROM, 2MB Chip + 8MB Fast\n\n2.04 ROM, 2MB Chip + 8MB Fast\n\n3.1 ROM, 2MB Chip + 8MB Fast\n"
+    IDS_QS_MODEL_A4000      "68030, 3.1 ROM, 2MB Chip + 8MB Fast\n\n68040, 3.1 ROM, 2MB Chip + 8MB Fast\n"
+    IDS_QS_MODEL_A4000T     "A4000T (test)\nA4000T"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_FLOPPYTYPE35DDPC    "3.5"" DD (PC)"
+    IDS_FLOPPYTYPE35HDPC    "3.5"" HD (PC)"
+    IDS_JOYMODE_DEFAULT     "Default"
+    IDS_JOYMODE_MOUSE       "Mouse"
+    IDS_JOYMODE_JOYSTICK    "Joystick"
+    IDS_JOYMODE_JOYSTICKANALOG "Analog joystick"
+    IDS_JOYMODE_LIGHTPEN    "Light pen"
+    IDS_JOYMODE_MOUSE_CDTV  "CDTV remote mouse"
+    IDS_JOYMODE_JOYSTICK_CD32 "CD32 pad"
+    IDS_TABLET_BOTH_CURSORS "Show both cursors"
+    IDS_TABLET_NATIVE_CURSOR "Show native cursor only"
+    IDS_TABLET_HOST_CURSOR  "Show host cursor only"
+    IDS_AUTOSCALE_DISABLED  "No scaling"
+    IDS_AUTOSCALE_SCALING   "Automatic scaling"
+    IDS_AUTOSCALE_RESIZE    "Automatic resize"
+    IDS_PRINTER_ASCII       "ASCII-Only"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_PRINTER_EPSON9      "Epson Matrix Printer Emulation, 9pin"
+    IDS_PRINTER_POSTSCRIPT_DETECTION "PostScript (Passthrough)"
+    IDS_PRINTER_POSTSCRIPT_EMULATION 
+                            "PostScript (Emulation, GhostScript required)"
+    IDS_PRINTER_PASSTHROUGH "Passthrough"
+    IDS_RES_LORES           "Lores"
+    IDS_RES_HIRES           "Hires (normal)"
+    IDS_RES_SUPERHIRES      "SuperHires"
+    IDS_PRINTER_EPSON48     "Epson Matrix Printer Emulation, 48pin"
+    IDS_SELECTCD            "Select a CD image file..."
+    IDS_CD                  "CD image files"
+    IDS_BUFFER_SINGLE       "No buffering"
+    IDS_BUFFER_DOUBLE       "Double buffering"
+    IDS_BUFFER_TRIPLE       "Triple buffering"
+    IDS_AUTOSCALE_CENTER    "Automatic center"
+    IDS_AUTOSCALE_MAX       "Fullscreen (Max)"
+    IDS_AUTOSCALE_TV        "Fullscreen (TV)"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_JOYMODE_GAMEPAD     "Gamepad"
+    IDS_AUTOSCALE_DEFAULT   "Default"
+    IDS_AUTOSCALE_MANUAL    "Manual"
+    IDS_PORT_AUTOFIRE       "Autofire"
+    IDS_PORT_AUTOFIRE_TOGGLE "Autofire (toggle)"
+    IDS_PORT_AUTOFIRE_ALWAYS "Autofire (always)"
+    IDS_PORT_AUTOFIRE_NO    "No autofire"
+    IDS_AUTOSCALE_INTEGER   "Integer scaling"
+    IDS_SCREEN_VSYNC2_AUTOSWITCH "Low latency VS, 50/60Hz"
+    IDS_SCREEN_VSYNC2       "Low latency VSync"
+    IDS_SCREEN_VSYNC_NONE   "-"
+    IDS_FILTEROVERLAYTYPE_MASKS "Masks"
+    IDS_FILTEROVERLAYTYPE_OVERLAYS "Overlays"
+    IDS_AUTOSCALE_INTEGER_AUTOSCALE "Auto Integer scaling"
+    IDS_WSTYLE_BORDERLESS   "Borderless"
+    IDS_WSTYLE_MINIMAL      "Minimal"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_INPUTQUALIFIER      "Qualifiers"
+    IDS_GENERIC             "Generic"
+    IDS_AUTODETECT          "Autodetect"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_WSTYLE_STANDARD     "Standard"
+    IDS_WSTYLE_EXTENDED     "Extended"
+    IDS_MISCLISTITEMS1      "Untrap = middle button\nShow GUI on startup\nUse CTRL-F11 to quit\nDon't show taskbar button\nDon't show notification icon\n"
+    IDS_MISCLISTITEMS2      "Always on top\nDisable screensaver\nSynchronize clock\nFaster RTG\nClipboard sharing\nAllow native code\n"
+    IDS_MISCLISTITEMS3      "Native on-screen display\nRTG on-screen display\nCreate winuaelog.txt log\nLog illegal memory accesses\nBlank unused displays\nStart mouse uncaptured\nStart minimized\nMinimize when focus is lost\n"
+    IDS_JOYMODE_WHEELMOUSE  "Wheel Mouse"
+END
+
+#endif    // English resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Finnish (Finland) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FIN)
+LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT
+#pragma code_page(1252)
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE 
+BEGIN
+    "resource.h\0"
+END
+
+3 TEXTINCLUDE 
+BEGIN
+    "\r\0"
+END
+
+2 TEXTINCLUDE 
+BEGIN
+    "#include ""afxres.h""\r\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+#endif    // Finnish (Finland) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
index 8c81e2b661a0e399ecd2dad42aab8c0286823552..025f5ad3af716aa6ebd20e8fe5e5b9f0c4541c1d 100644 (file)
@@ -32,6 +32,7 @@
 #include "win32gui.h"
 #include "drawing.h"
 #include "resource.h"
+#include "gui.h"
 
 static int initialized;
 static RPGUESTINFO guestinfo;
@@ -141,7 +142,7 @@ static void trimws (TCHAR *s)
 }
 
 static const int inputdevmode[] = {
-       RP_INPUTDEVICE_MOUSE, JSEM_MODE_MOUSE,
+       RP_INPUTDEVICE_MOUSE, JSEM_MODE_WHEELMOUSE,
        RP_INPUTDEVICE_JOYSTICK, JSEM_MODE_JOYSTICK,
        RP_INPUTDEVICE_GAMEPAD, JSEM_MODE_GAMEPAD,
        RP_INPUTDEVICE_ANALOGSTICK, JSEM_MODE_JOYSTICK_ANALOG,
@@ -493,7 +494,7 @@ static void fixup_size (struct uae_prefs *prefs)
                int hres = prefs->gfx_resolution;
                if (prefs->gfx_filter) {
                        if (prefs->gfx_filter_horiz_zoom_mult)
-                               hres += (1000 / prefs->gfx_filter_horiz_zoom_mult) - 1;
+                               hres += prefs->gfx_filter_horiz_zoom_mult - 1;
                        hres += uaefilters[prefs->gfx_filter].intmul - 1;
                }
                if (hres > max_horiz_dbl)
@@ -505,7 +506,7 @@ static void fixup_size (struct uae_prefs *prefs)
                int vres = prefs->gfx_vresolution;
                if (prefs->gfx_filter) {
                        if (prefs->gfx_filter_vert_zoom_mult)
-                               vres += (1000 / prefs->gfx_filter_vert_zoom_mult) - 1;
+                               vres += prefs->gfx_filter_vert_zoom_mult - 1;
                        vres += uaefilters[prefs->gfx_filter].intmul - 1;
                }
                if (vres > max_vert_dbl)
@@ -516,23 +517,23 @@ static void fixup_size (struct uae_prefs *prefs)
        write_log(_T("-> %dx%d\n"), prefs->gfx_size_win.width, prefs->gfx_size_win.height);
 }
 
-static int getmult (int mult, bool *half)
+static int getmult (float mult, bool *half)
 {
        *half = false;
-       if (mult >= 4 * 256)
-               return 2;
-       if (mult == 256 + 128) {
+       if (mult >= 3.5)
+               return 2; // 4x
+       if (mult >= 2.5f) {
                *half = true;
-               return 1;
+               return 1; // 3x
        }
-       if (mult == 2 * 256)
-               return 1;
-       if (mult >= 1 * 256)
-               return 0;
-       if (mult >= 256 / 2)
-               return -1;
-       if (mult >= 256 / 4)
-               return -2;
+       if (mult >= 1.5f)
+               return 1; // 2x
+       if (mult >= 0.8f)
+               return 0; // 1x
+       if (mult >= 0.4f)
+               return -1; // 1/2x
+       if (mult >= 0.1f)
+               return -2; // 1/4x
        return 0;
 }
 
@@ -575,17 +576,17 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                sm->lClipWidth = -1;//picasso96_state.Width;
                sm->lClipHeight = -1;//picasso96_state.Height;
 
-               if (hmult < 333 || vmult < 333)
+               if (hmult >= 3.5f || vmult >= 3.5f)
                        m |= RP_SCREENMODE_SCALE_4X;
-               else if (hmult < 500 || vmult < 500)
+               else if (hmult >= 2.5f || vmult >= 2.5f)
                        m |= RP_SCREENMODE_SCALE_3X;
-               else if (hmult < 1000 || vmult < 1000)
+               else if (hmult >= 1.5f || vmult >= 1.5f)
                        m |= RP_SCREENMODE_SCALE_2X;
 
        } else {
 
-               hmult = p->gfx_filter_horiz_zoom_mult > 0 ? 1000 * 256 / p->gfx_filter_horiz_zoom_mult : 256;
-               vmult = p->gfx_filter_vert_zoom_mult > 0 ? 1000 * 256 / p->gfx_filter_vert_zoom_mult : 256;
+               hmult = p->gfx_filter_horiz_zoom_mult;
+               vmult = p->gfx_filter_vert_zoom_mult;
 
                full = p->gfx_apmode[0].gfx_fullscreen;
 
@@ -599,13 +600,6 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                        vres = max_vert_dbl;
                vres += getmult (vmult, &half);
 
-#if 0
-               if (hres > RES_SUPERHIRES)
-                       hres = RES_SUPERHIRES;
-               if (vres > VRES_QUAD)
-                       vres = VRES_QUAD;
-#endif
-
                if (hres == RES_SUPERHIRES) {
                        m = half ? RP_SCREENMODE_SCALE_3X : RP_SCREENMODE_SCALE_2X;
                } else if (hres >= RES_SUPERHIRES + 1) {
@@ -799,9 +793,9 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
 
                int m = 1;
                if (fs == 2) {
-                       p->win32_rtgscaleifsmall = true;
+                       p->win32_rtgscalemode = 1;
                } else {
-                       p->win32_rtgscaleifsmall = false;
+                       p->win32_rtgscalemode = 0;
                        if (smm == RP_SCREENMODE_SCALE_2X) {
                                m = 2;
                        } else if (smm == RP_SCREENMODE_SCALE_3X) {
@@ -810,7 +804,7 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                                m = 4;
                        }
                }
-               p->rtg_horiz_zoom_mult = p->rtg_vert_zoom_mult = 1000 / m;
+               p->rtg_horiz_zoom_mult = p->rtg_vert_zoom_mult = m;
                p->gfx_size_win.width = picasso_vidinfo.width * m;
                p->gfx_size_win.height = picasso_vidinfo.height * m;
 
@@ -876,8 +870,8 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                        }
                }
 
-               p->gfx_filter_horiz_zoom_mult = hmult > 0 ? (int)(1000.0 / hmult) : (int)hmult;
-               p->gfx_filter_vert_zoom_mult = vmult > 0 ? (int)(1000.0 / vmult) : (int)vmult;
+               p->gfx_filter_horiz_zoom_mult = hmult;
+               p->gfx_filter_vert_zoom_mult = vmult;
 
                p->gfx_filter_scanlines = 0;
                p->gfx_scanlines = 0;
@@ -1250,14 +1244,14 @@ static void sendfeatures (void)
 
 static int gethdnum (int n)
 {
-       struct uaedev_config_info *uci = &currprefs.mountconfig[n];
+       struct uaedev_config_data *uci = &currprefs.mountconfig[n];
        int num = -1;
-       if (uci->controller == HD_CONTROLLER_UAE) {
+       if (uci->ci.controller == HD_CONTROLLER_UAE) {
                num = n;
-       } else if (uci->controller <= HD_CONTROLLER_IDE3 ) {
-               num = uci->controller - HD_CONTROLLER_IDE0;
-       } else if (uci->controller <= HD_CONTROLLER_SCSI6) {
-               num = uci->controller - HD_CONTROLLER_SCSI0;
+       } else if (uci->ci.controller <= HD_CONTROLLER_IDE3 ) {
+               num = uci->ci.controller - HD_CONTROLLER_IDE0;
+       } else if (uci->ci.controller <= HD_CONTROLLER_SCSI6) {
+               num = uci->ci.controller - HD_CONTROLLER_SCSI0;
        }
        return num;
 }
@@ -1289,8 +1283,11 @@ void rp_fixup_options (struct uae_prefs *p)
 
        changed_prefs.win32_borderless = currprefs.win32_borderless = 1;
        rp_filter_default = rp_filter = currprefs.gfx_filter;
-       if (rp_filter == 0)
+       if (rp_filter == 0) {
                rp_filter = UAE_FILTER_NULL;
+               if (currprefs.gfx_api)
+                       changed_prefs.gfx_filter = currprefs.gfx_filter = rp_filter;
+       }
 
        fixup_size (p);
        get_screenmode (&sm, p);
@@ -1323,10 +1320,10 @@ void rp_fixup_options (struct uae_prefs *p)
        RPSendMessagex (RP_IPC_TO_HOST_DEVICES, RP_DEVICECATEGORY_HD, hd_mask, NULL, 0, &guestinfo, NULL);
        if (hd_mask) {
                for (i = 0; i < currprefs.mountitems; i++) {
-                       struct uaedev_config_info *uci = &currprefs.mountconfig[i];
+                       struct uaedev_config_data *uci = &currprefs.mountconfig[i];
                        int num = gethdnum (i);
                        if (num >= 0 && ((1 << num) & hd_mask))
-                               rp_harddrive_image_change (num, uci->readonly, uci->rootdir);
+                               rp_harddrive_image_change (num, uci->ci.readonly, uci->ci.rootdir);
                }
        }
 
@@ -1481,23 +1478,23 @@ void rp_update_leds (int led, int onoff, int write)
                return;
        switch (led)
        {
-       case 0:
+       case LED_POWER:
                ledstate = onoff >= 250 ? 100 : onoff * 10 / 26;
                if (ledstate == oldled[led])
                        return;
                oldled[led] = ledstate;
                RPSendMessage (RP_IPC_TO_HOST_POWERLED, ledstate, 0, NULL, 0, &guestinfo, NULL);
                break;
-       case 1:
-       case 2:
-       case 3:
-       case 4:
+       case LED_DF0:
+       case LED_DF1:
+       case LED_DF2:
+       case LED_DF3:
                ledstate = onoff ? 1 : 0;
                ledstate |= write ? 2 : 0;
                if (ledstate == oldled[led])
                        return;
                oldled[led] = ledstate;
-               RPPostMessagex (RP_IPC_TO_HOST_DEVICEACTIVITY, MAKEWORD (RP_DEVICECATEGORY_FLOPPY, led - 1),
+               RPPostMessagex (RP_IPC_TO_HOST_DEVICEACTIVITY, MAKEWORD (RP_DEVICECATEGORY_FLOPPY, led - LED_DF0),
                        MAKELONG ((ledstate & 1) ? -1 : 0, (ledstate & 2) ? RP_DEVICEACTIVITY_WRITE : RP_DEVICEACTIVITY_READ) , &guestinfo);
                break;
        }
index 3fe942622e55b8024566d63c95bd287ba27c3267..140058eaf2ae397ea9f911b6f939bfd237b9970d 100644 (file)
@@ -35,6 +35,8 @@ del cpuemu_20.cpp
 del cpuemu_21.cpp
 del cpuemu_22.cpp
 del cpuemu_31.cpp
+del cpuemu_32.cpp
+del cpuemu_33.cpp
 del linetoscr.cpp
 del aros.rom.cpp
 
index 36328b7e661e6c65fdc44757aaff434ca8907a62..a2efff68b0973353a40f1c47237ffd6414224e7d 100644 (file)
@@ -15,6 +15,7 @@
 #define OPTIMIZED_FLAGS
 #define __i386__
 #define WINDOWS
+#define ZLIB_WINAPI
 
 #ifndef UAE_MINI
 
@@ -52,7 +53,9 @@
 #define CPUEMU_20 /* 68020 prefetch */
 #define CPUEMU_21 /* 68020 "cycle-exact" + blitter */
 #define CPUEMU_22 /* 68030 (040/060) "cycle-exact" + blitter */
-#define CPUEMU_31 /* 68040 Aranym MMU */
+#define CPUEMU_31 /* Aranym 68040 MMU */
+#define CPUEMU_32 /* Previous 68030 MMU */
+#define CPUEMU_33 /* 68060 MMU */
 #define ACTION_REPLAY /* Action Replay 1/2/3 support */
 #define PICASSO96 /* Picasso96 display card emulation */
 #define UAEGFX_INTERNAL /* built-in libs:picasso96/uaegfx.card */
index aab9838142029a09d07678bb03b52e6ddcd1274e..d3b376cbd1695cbb50bf8a1d2e1278476ec29b87 100644 (file)
@@ -462,13 +462,13 @@ void setsoundpaused (void)
        ahi2_pause_sound (1);
 #endif
 }
-void resumepaused (int priority)
+bool resumepaused (int priority)
 {
        //write_log (_T("resume %d (%d)\n"), priority, pause_emulation);
        if (pause_emulation > priority)
-               return;
+               return false;
        if (!pause_emulation)
-               return;
+               return false;
        resumesoundpaused ();
        blkdev_exitgui ();
        if (pausemouseactive)
@@ -479,12 +479,13 @@ void resumepaused (int priority)
        rp_pause (pause_emulation);
 #endif
        setsystime ();
+       return true;
 }
-void setpaused (int priority)
+bool setpaused (int priority)
 {
        //write_log (_T("pause %d (%d)\n"), priority, pause_emulation);
        if (pause_emulation > priority)
-               return;
+               return false;
        pause_emulation = priority;
        setsoundpaused ();
        blkdev_entergui ();
@@ -496,6 +497,7 @@ void setpaused (int priority)
 #ifdef RETROPLATFORM
        rp_pause (pause_emulation);
 #endif
+       return true;
 }
 
 void setminimized (void)
@@ -620,6 +622,32 @@ void updatewinrect (bool allowfullscreen)
        }
 }
 
+static bool iswindowfocus (void)
+{
+       bool donotfocus = false;
+       HWND f = GetFocus ();
+       HWND fw = GetForegroundWindow ();
+       HWND w1 = hAmigaWnd;
+       HWND w2 = hMainWnd;
+       HWND w3 = NULL;
+#ifdef RETROPLATFORM
+       if (rp_isactive ())
+               w3 = rp_getparent ();
+#endif
+       if (f != w1 && f != w2)
+               donotfocus = true;
+       if (w3 != NULL && f == w3)
+               donotfocus = false;
+
+#ifdef RETROPLATFORM
+       if (rp_isactive () && isfullscreen () == 0)
+               donotfocus = false;
+#endif
+       if (isfullscreen () > 0)
+               donotfocus = false;
+       return donotfocus == false;
+}
+
 static void setmouseactive2 (int active, bool allowpause)
 {
        write_log (_T("setmouseactive %d->%d showcursor=%d focus=%d recap=%d\n"), mouseactive, active, showcursor, focus, recapture);
@@ -657,32 +685,9 @@ static void setmouseactive2 (int active, bool allowpause)
        if (mouseactive > 0)
                focus = 1;
 
-       if (focus) {
-               int donotfocus = 0;
-               HWND f = GetFocus ();
-               HWND fw = GetForegroundWindow ();
-               HWND w1 = hAmigaWnd;
-               HWND w2 = hMainWnd;
-               HWND w3 = NULL;
-#ifdef RETROPLATFORM
-               if (rp_isactive ())
-                       w3 = rp_getparent ();
-#endif
-               if (f != w1 && f != w2)
-                       donotfocus = 1;
-               if (w3 != NULL && f == w3)
-                       donotfocus = 0;
-
-#ifdef RETROPLATFORM
-               if (rp_isactive () && isfullscreen () == 0)
-                       donotfocus = 0;
-#endif
-               if (isfullscreen () > 0)
-                       donotfocus = 0;
-               if (donotfocus) {
-                       //focus = 0;
-                       mouseactive = 0;
-               }
+       if (!iswindowfocus ()) {
+               focus = 0;
+               mouseactive = 0;
        }
 
        if (mouseactive) {
@@ -980,7 +985,7 @@ static int isfocus2 (void)
 {
        if (isfullscreen () > 0)
                return 1;
-       if (focus && mouseactive)
+       if (focus && mouseactive > 0)
                return 1;
        if (focus)
                return -1;
@@ -1031,6 +1036,15 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                unsetminimized ();
                dx_check ();
                break;
+       case WM_SIZE:
+               //write_log (_T("WM_SIZE %d\n"), wParam);
+               if (hStatusWnd)
+                       SendMessage (hStatusWnd, WM_SIZE, wParam, lParam);
+               if (wParam == SIZE_MINIMIZED && !minimized) {
+                       setminimized ();
+                       winuae_inactive (hWnd, minimized);
+               }
+               break;
        case WM_ACTIVATE:
                //write_log (_T("active %d\n"), LOWORD(wParam));
                if (LOWORD (wParam) == WA_INACTIVE) {
@@ -1202,25 +1216,6 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                uae_quit ();
                return 0;
 
-       case WM_SIZE:
-               if (hStatusWnd)
-                       SendMessage (hStatusWnd, WM_SIZE, wParam, lParam);
-               break;
-
-       case WM_WINDOWPOSCHANGED:
-               {
-                       WINDOWPOS *wp = (WINDOWPOS*)lParam;
-                       if (isfullscreen () <= 0) {
-                               if (!IsIconic (hWnd) && hWnd == hAmigaWnd) {
-                                       updatewinrect (false);
-                                       config_changed = 1;
-                                       updatemouseclip ();
-                               }
-                               notice_screen_contents_lost ();
-                       }
-               }
-               break;
-
        case WM_SETCURSOR:
                {
                        if ((HWND)wParam == hAmigaWnd && currprefs.input_tablet > 0 && currprefs.input_magic_mouse && isfullscreen () <= 0) {
@@ -1286,11 +1281,9 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
        case WM_MOVING:
                {
                        LRESULT lr = DefWindowProc (hWnd, message, wParam, lParam);
-                       WIN32GFX_WindowMove ();
                        return lr;
                }
        case WM_MOVE:
-               WIN32GFX_WindowMove ();
                return FALSE;
 
        case WM_ENABLE:
@@ -1549,12 +1542,14 @@ static int canstretch (void)
 {
        if (isfullscreen () != 0)
                return 0;
-       if (currprefs.gfx_filter_autoscale == AUTOSCALE_RESIZE)
-               return 0;
-       if (!WIN32GFX_IsPicassoScreen ())
-               return 1;
-       if (currprefs.win32_rtgallowscaling || currprefs.win32_rtgscaleaspectratio)
+       if (!WIN32GFX_IsPicassoScreen ()) {
+               if (currprefs.gfx_filter_autoscale == AUTOSCALE_RESIZE)
+                       return 0;
                return 1;
+       } else {
+               if (currprefs.win32_rtgallowscaling || currprefs.win32_rtgscalemode)
+                       return 1;
+       }
        return 0;
 }
 
@@ -1668,44 +1663,51 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                /* fall through */
 
        case WM_WINDOWPOSCHANGED:
-               WIN32GFX_WindowMove ();
-               if (hAmigaWnd && isfullscreen () <= 0) {
-                       DWORD aw, ah;
-                       int iconic = IsIconic (hWnd);
-                       if (!iconic)
-                               GetWindowRect (hAmigaWnd, &amigawin_rect);
-                       aw = amigawin_rect.right - amigawin_rect.left;
-                       ah = amigawin_rect.bottom - amigawin_rect.top;
+               {
+                       if (isfullscreen () > 0)
+                               break;
                        if (in_sizemove > 0)
                                break;
-
-                       if (isfullscreen() == 0 && hAmigaWnd && !iconic) {
-                               static int store_xy;
-                               RECT rc2;
-                               if (GetWindowRect (hMainWnd, &rc2)) {
-                                       DWORD left = rc2.left - win_x_diff;
-                                       DWORD top = rc2.top - win_y_diff;
-                                       DWORD width = rc2.right - rc2.left;
-                                       DWORD height = rc2.bottom - rc2.top;
-                                       if (store_xy++) {
-                                               regsetint (NULL, _T("MainPosX"), left);
-                                               regsetint (NULL, _T("MainPosY"), top);
-                                       }
-                                       changed_prefs.gfx_size_win.x = left;
-                                       changed_prefs.gfx_size_win.y = top;
-                                       if (canstretch () && (mainwin_rect.right - mainwin_rect.left != width || mainwin_rect.bottom - mainwin_rect.top != height)) {
-                                               changed_prefs.gfx_size_win.width = width - window_extra_width;
-                                               changed_prefs.gfx_size_win.height = height - window_extra_height;
+                       int iconic = IsIconic (hWnd);
+                       if (hAmigaWnd && hWnd == hMainWnd && !iconic) {
+                               //write_log (_T("WM_WINDOWPOSCHANGED MAIN\n"));
+                               GetWindowRect (hMainWnd, &mainwin_rect);
+                               updatewinrect (false);
+                               updatemouseclip ();
+                               if (minimized) {
+                                       unsetminimized ();
+                                       winuae_active (hAmigaWnd, minimized);
+                               }
+                               if (isfullscreen() == 0) {
+                                       static int store_xy;
+                                       RECT rc2;
+                                       if (GetWindowRect (hMainWnd, &rc2)) {
+                                               DWORD left = rc2.left - win_x_diff;
+                                               DWORD top = rc2.top - win_y_diff;
+                                               DWORD width = rc2.right - rc2.left;
+                                               DWORD height = rc2.bottom - rc2.top;
+                                               if (store_xy++) {
+                                                       regsetint (NULL, _T("MainPosX"), left);
+                                                       regsetint (NULL, _T("MainPosY"), top);
+                                               }
+                                               changed_prefs.gfx_size_win.x = left;
+                                               changed_prefs.gfx_size_win.y = top;
+                                               if (canstretch ()) {
+                                                       int w = mainwin_rect.right - mainwin_rect.left;
+                                                       int h = mainwin_rect.bottom - mainwin_rect.top;
+                                                       if (w != changed_prefs.gfx_size_win.width + window_extra_width ||
+                                                               h != changed_prefs.gfx_size_win.height + window_extra_height) {
+                                                                       changed_prefs.gfx_size_win.width = w - window_extra_width;
+                                                                       changed_prefs.gfx_size_win.height = h - window_extra_height;
+                                                                       config_changed = 1;
+                                                       }
+                                               }
                                        }
-                                       config_changed = 1;
+                                       if (hStatusWnd)
+                                               SendMessage (hStatusWnd, WM_SIZE, wParam, lParam);
+                                       return 0;
                                }
-                               if (hStatusWnd)
-                                       SendMessage (hStatusWnd, WM_SIZE, wParam, lParam);
-                               GetWindowRect (hMainWnd, &mainwin_rect);
-                               return 0;
                        }
-                       if (!iconic)
-                               GetWindowRect (hMainWnd, &mainwin_rect);
                }
                break;
 
@@ -1726,8 +1728,13 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam,
 
        case WM_NCLBUTTONDBLCLK:
                if (wParam == HTCAPTION) {
-                       toggle_fullscreen (-1);
-                       return 0;
+                       if (GetKeyState (VK_SHIFT)) {
+                               toggle_fullscreen (0);
+                               return 0;
+                       } else if (GetKeyState (VK_CONTROL)) {
+                               toggle_fullscreen (2);
+                               return 0;
+                       }
                }
                break;
 
@@ -1929,11 +1936,11 @@ int handle_msgpump (void)
        return got;
 }
 
-void handle_events (void)
+bool handle_events (void)
 {
-       MSG msg;
-       int was_paused = 0;
+       static int was_paused = 0;
        static int cnt1, cnt2;
+       static int pausedelay;
 
        if (hStatusWnd && guijoychange && window_led_joy_start > 0) {
                guijoychange = false;
@@ -1941,30 +1948,32 @@ void handle_events (void)
                        PostMessage (hStatusWnd, SB_SETTEXT, (WPARAM)((i + 1) | SBT_OWNERDRAW), (LPARAM)_T(""));
        }
 
-       while (pause_emulation) {
-               if (pause_emulation && was_paused == 0) {
+       pausedelay = 0;
+       if (pause_emulation) {
+               MSG msg;
+               if (was_paused == 0) {
                        setpaused (pause_emulation);
                        was_paused = pause_emulation;
                        manual_painting_needed++;
                        gui_fps (0, 0, 0);
+                       gui_led (LED_SND, 0);
                }
+               MsgWaitForMultipleObjects (0, NULL, FALSE, 100, QS_ALLINPUT);
                while (PeekMessage (&msg, 0, 0, 0, PM_REMOVE)) {
                        TranslateMessage (&msg);
                        DispatchMessage (&msg);
                }
-               sleep_millis (100);
                inputdevicefunc_keyboard.read ();
                inputdevicefunc_mouse.read ();
                inputdevicefunc_joystick.read ();
                inputdevice_handle_inputcode ();
-               check_prefs_changed_gfx ();
 #ifdef RETROPLATFORM
                rp_vsync ();
 #endif
                cnt1 = 0;
                while (checkIPC (globalipc, &currprefs));
-               if (quit_program)
-                       break;
+//             if (quit_program)
+//                     break;
                cnt2--;
                if (cnt2 <= 0) {
                        if (currprefs.win32_powersavedisabled)
@@ -1974,19 +1983,13 @@ void handle_events (void)
                        cnt2 = 10;
                }
        }
-#if 0
-       while (PeekMessage (&msg, 0, 0, 0, PM_REMOVE)) {
-               TranslateMessage (&msg);
-               DispatchMessage (&msg);
-       }
-       while (checkIPC (globalipc, &currprefs));
-#endif
-       if (was_paused) {
+       if (was_paused && (!pause_emulation || quit_program)) {
                updatedisplayarea ();
                manual_painting_needed--;
                pause_emulation = was_paused;
                resumepaused (was_paused);
                sound_closed = 0;
+               was_paused = 0;
        }
        cnt1--;
        if (cnt1 <= 0) {
@@ -2002,6 +2005,7 @@ void handle_events (void)
                        cnt2 = 5;
                }
        }
+       return pause_emulation != 0;
 }
 
 /* We're not a console-app anymore! */
@@ -2216,7 +2220,7 @@ HMODULE language_load (WORD language)
 #if LANG_DLL > 0
        TCHAR dllbuf[MAX_DPATH];
        TCHAR *dllname;
-       bool nosubrev = true;
+       bool nosubrev = false;
 
        if (language <= 0) {
                /* new user-specific Windows ME/2K/XP method to get UI language */
@@ -2939,8 +2943,21 @@ void target_fixup_options (struct uae_prefs *p)
                nosound = true;
        }
        
-       /* switch from 32 to 16 or vice versa if mode does not exist */
        struct MultiDisplay *md = getdisplay (p);
+       if (p->gfx_size_fs.special == WH_NATIVE) {
+               int i;
+               for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
+                       if (md->DisplayModes[i].res.width == md->rect.right - md->rect.left &&
+                               md->DisplayModes[i].res.height == md->rect.bottom - md->rect.top) {
+                                       p->gfx_size_fs.width = md->DisplayModes[i].res.width;
+                                       p->gfx_size_fs.height = md->DisplayModes[i].res.height;
+                                       break;
+                       }
+               }
+               if (md->DisplayModes[i].depth < 0)
+                       p->gfx_size_fs.special = 0;
+       }
+       /* switch from 32 to 16 or vice versa if mode does not exist */
        int depth = p->color_mode == 5 ? 4 : 2;
        for (int i = 0; md->DisplayModes[i].depth >= 0; i++) {
                if (md->DisplayModes[i].depth == depth) {
@@ -2993,7 +3010,7 @@ void target_default_options (struct uae_prefs *p, int type)
                p->win32_powersavedisabled = true;
                p->sana2 = 0;
                p->win32_rtgmatchdepth = 1;
-               p->win32_rtgscaleifsmall = 1;
+               p->win32_rtgscalemode = 1;
                p->win32_rtgallowscaling = 0;
                p->win32_rtgscaleaspectratio = -1;
                p->win32_rtgvblankrate = 0;
@@ -3088,7 +3105,8 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
        cfgfile_target_dwrite_bool (f, _T("midirouter"), p->win32_midirouter);
                        
        cfgfile_target_dwrite_bool (f, _T("rtg_match_depth"), p->win32_rtgmatchdepth);
-       cfgfile_target_dwrite_bool (f, _T("rtg_scale_small"), p->win32_rtgscaleifsmall);
+       cfgfile_target_dwrite_bool (f, _T("rtg_scale_small"), p->win32_rtgscalemode == 1);
+       cfgfile_target_dwrite_bool (f, _T("rtg_scale_center"), p->win32_rtgscalemode == 2);
        cfgfile_target_dwrite_bool (f, _T("rtg_scale_allow"), p->win32_rtgallowscaling);
        cfgfile_target_dwrite (f, _T("rtg_scale_aspect_ratio"), _T("%d:%d"),
                p->win32_rtgscaleaspectratio >= 0 ? (p->win32_rtgscaleaspectratio >> 8) : -1,
@@ -3169,6 +3187,7 @@ int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR *
 {
        TCHAR tmpbuf[CONFIG_BLEN];
        int i, v;
+       bool tbool;
 
        int result = (cfgfile_yesno (option, value, _T("middle_mouse"), &p->win32_middle_mouse)
                || cfgfile_yesno (option, value, _T("map_drives"), &p->win32_automount_drives)
@@ -3210,8 +3229,15 @@ int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR *
 
        if (cfgfile_yesno (option, value, _T("rtg_match_depth"), &p->win32_rtgmatchdepth))
                return 1;
-       if (cfgfile_yesno (option, value, _T("rtg_scale_small"), &p->win32_rtgscaleifsmall))
+       if (cfgfile_yesno (option, value, _T("rtg_scale_small"), &tbool)) {
+               p->win32_rtgscalemode = tbool ? RTG_MODE_SCALE : 0;
                return 1;
+       }
+       if (cfgfile_yesno (option, value, _T("rtg_scale_center"), &tbool)) {
+               if (tbool)
+                       p->win32_rtgscalemode = RTG_MODE_CENTER;
+               return 1;
+       }
        if (cfgfile_yesno (option, value, _T("rtg_scale_allow"), &p->win32_rtgallowscaling))
                return 1;
 
@@ -5538,7 +5564,7 @@ LONG WINAPI WIN32_ExceptionFilter (struct _EXCEPTION_POINTERS *pExceptionPointer
                                        int got = 0;
                                        uaecptr opc = m68k_getpc ();
                                        void *ps = get_real_address (0);
-                                       m68k_dumpstate (0, 0);
+                                       m68k_dumpstate (0);
                                        efix (&ctx->Eax, p, ps, &got);
                                        efix (&ctx->Ebx, p, ps, &got);
                                        efix (&ctx->Ecx, p, ps, &got);
@@ -5979,7 +6005,8 @@ uae_u32 emulib_target_getcpurate (uae_u32 v, uae_u32 *low)
 void fpux_save (int *v)
 {
 #ifndef _WIN64
-       *v = _controlfp (fpucontrol, _MCW_IC | _MCW_RC | _MCW_PC);
+       *v = _controlfp (0, 0);
+       _controlfp (fpucontrol, _MCW_IC | _MCW_RC | _MCW_PC);
 #endif
 }
 void fpux_restore (int *v)
@@ -6025,6 +6052,7 @@ int PASCAL wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL
        thread = GetCurrentThread ();
        //original_affinity = SetThreadAffinityMask(thread, 1);
        fpucontrol = _controlfp (0, 0) & (_MCW_IC | _MCW_RC | _MCW_PC);
+       _tzset ();
 
 #if 0
 #define MSGFLT_ADD 1
index 1f25597e57b7e147a433cb9cbbd04445a33a8529..734fab4bcf6722bbba1a7ef2ab5b1af8b5bbf812 100644 (file)
 #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
 #define GETBDD(x) ((x) % 100)
 
-#define WINUAEPUBLICBETA 0
+#define WINUAEPUBLICBETA 1
 #define LANG_DLL 1
 
 #if WINUAEPUBLICBETA
-#define WINUAEBETA _T("5")
+#define WINUAEBETA _T("1")
 #else
 #define WINUAEBETA _T("")
 #endif
-#define WINUAEDATE MAKEBD(2012, 12, 22)
+#define WINUAEDATE MAKEBD(2013, 1, 12)
 #define WINUAEEXTRA _T("")
 //#define WINUAEEXTRA _T("AmiKit Preview")
 #define WINUAEREV _T("")
@@ -69,8 +69,8 @@ extern uae_u32 OSDEP_minimize_uae (void);
 extern void updatemouseclip (void);
 extern void updatewinrect (bool);
 
-extern void resumepaused (int priority);
-extern void setpaused (int priority);
+extern bool resumepaused (int priority);
+extern bool setpaused (int priority);
 extern void unsetminimized (void);
 extern void setminimized (void);
 
@@ -89,7 +89,7 @@ extern int gui_active;
 extern int quickstart, configurationcache, relativepaths;
 
 extern HKEY hWinUAEKey;
-extern int screen_is_picasso, scalepicasso;
+extern int screen_is_picasso;
 extern HINSTANCE hInst;
 extern int win_x_diff, win_y_diff;
 extern int window_extra_width, window_extra_height;
index c126dba8c0f76328f6a9aa68e584677816909b30..609ff2e4917d35ed3b8874f800696031b29325c9 100644 (file)
@@ -135,8 +135,6 @@ void filesys_addexternals (void)
 {
        int drive, drivetype;
        UINT errormode;
-       TCHAR volumename[MAX_DPATH] = _T("");
-       TCHAR volumepath[16];
        DWORD dwDriveMask;
        int drvnum = 0;
 
@@ -148,21 +146,21 @@ void filesys_addexternals (void)
        dwDriveMask >>= 2; // Skip A and B drives...
 
        for(drive = 'C'; drive <= 'Z'; ++drive) {
-               _stprintf (volumepath, _T("%c:\\"), drive);
+               struct uaedev_config_info ci = { 0 };
+               _stprintf (ci.rootdir, _T("%c:\\"), drive);
                /* Is this drive-letter valid (it used to check for media in drive) */
                if(dwDriveMask & 1) {
-                       TCHAR devname[MAX_DPATH];
-                       bool inserted = CheckRM (volumepath) != 0; /* Is there a disk inserted? */
+                       bool inserted = CheckRM (ci.rootdir) != 0; /* Is there a disk inserted? */
                        int nok = FALSE;
                        int rw = 1;
-                       drivetype = GetDriveType (volumepath);
+
+                       drivetype = GetDriveType (ci.rootdir);
                        if (inserted && drivetype != DRIVE_NO_ROOT_DIR && drivetype != DRIVE_UNKNOWN) {
                                if (hfdcheck (drive)) {
                                        write_log (_T("Drive %c:\\ ignored, was configured as a harddrive\n"), drive);
                                        continue;
                                }
                        }
-                       devname[0] = 0;
                        for (;;) {
                                if (!inserted) {
                                        nok = TRUE;
@@ -179,24 +177,26 @@ void filesys_addexternals (void)
                        }
                        if (nok)
                                continue;
-                       volumename[0] = 0;
                        if (inserted) {
-                               target_get_volume_name (&mountinfo, volumepath, volumename, MAX_DPATH, inserted, true);
-                               if (!volumename[0])
-                                       _stprintf (volumename, _T("WinUNK_%c"), drive);
+                               target_get_volume_name (&mountinfo, ci.rootdir, ci.volname, MAX_DPATH, inserted, true);
+                               if (!ci.volname[0])
+                                       _stprintf (ci.volname, _T("WinUNK_%c"), drive);
                        }
                        if (drivetype == DRIVE_REMOTE)
-                               _tcscat (volumepath, _T("."));
+                               _tcscat (ci.rootdir, _T("."));
                        else
-                               _tcscat (volumepath, _T(".."));
+                               _tcscat (ci.rootdir, _T(".."));
 #if 0
                        if (currprefs.win32_automount_drives > 1) {
                                devname[0] = drive;
                                devname[1] = 0;
                        }
 #endif
+                       ci.readonly = !rw;
+                       ci.bootpri = -20 - drvnum;
+                       ci.autoboot = true;
                        //write_log (_T("Drive type %d: '%s' '%s'\n"), drivetype, volumepath, volumename);
-                       add_filesys_unit (devname[0] ? devname : NULL, volumename, volumepath, !rw, 0, 0, 0, 0, 0, -20 - drvnum, 0, 1, 0, 0, 0);
+                       add_filesys_unit (&ci);
                        drvnum++;
                } /* if drivemask */
                dwDriveMask >>= 1;
index d25ed51e4c6995f4c61c7f47b387572184240116..4cf35cd59ffc0edd05eaed38cfdfef1a9e8fb944 100644 (file)
@@ -43,7 +43,7 @@ struct uae_filter uaefilters[] =
        { 0 }
 };
 
-static int filteroffsetx, filteroffsety, filterxmult = 1000, filterymult = 1000;
+static float filteroffsetx, filteroffsety, filterxmult = 1.0, filterymult = 1.0;
 static int dst_width, dst_height, amiga_width, amiga_height, amiga_depth, dst_depth, scale;
 static int dst_width2, dst_height2, amiga_width2, amiga_height2, amiga_depth2, dst_depth2;
 static int temp_width, temp_height;
@@ -56,7 +56,7 @@ static int deskw, deskh;
 static int d3d;
 static bool inited;
 
-void getfilteroffset (int *dx, int *dy, int *mx, int *my)
+void getfilteroffset (float *dx, float *dy, float *mx, float *my)
 {
        *dx = filteroffsetx;
        *dy = filteroffsety;
@@ -141,7 +141,6 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
        float srcratio, dstratio;
        int aws, ahs;
        int xs, ys;
-       int v;
        int extraw, extrah;
        int fpuv;
        bool specialmode = !isnativevidbuf ();
@@ -150,17 +149,17 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
        bool doautoaspect = false;
        float autoaspectratio;
 
-       int filter_horiz_zoom = currprefs.gfx_filter_horiz_zoom;
-       int filter_vert_zoom = currprefs.gfx_filter_vert_zoom;
+       float filter_horiz_zoom = currprefs.gfx_filter_horiz_zoom / 1000.0f;
+       float filter_vert_zoom = currprefs.gfx_filter_vert_zoom / 1000.0f;
        float filter_horiz_zoom_mult = currprefs.gfx_filter_horiz_zoom_mult;
        float filter_vert_zoom_mult = currprefs.gfx_filter_vert_zoom_mult;
-       int filter_horiz_offset = currprefs.gfx_filter_horiz_offset;
-       int filter_vert_offset = currprefs.gfx_filter_vert_offset;
+       float filter_horiz_offset = currprefs.gfx_filter_horiz_offset / 10000.0f;
+       float filter_vert_offset = currprefs.gfx_filter_vert_offset / 10000.0f;
 
        if (!usedfilter && !currprefs.gfx_api) {
-               filter_horiz_zoom = filter_vert_zoom = 0;
-               filter_horiz_zoom_mult = filter_vert_zoom_mult = 1000;
-               filter_horiz_offset = filter_vert_offset = 0;
+               filter_horiz_zoom = filter_vert_zoom = 0.0;
+               filter_horiz_zoom_mult = filter_vert_zoom_mult = 1.0;
+               filter_horiz_offset = filter_vert_offset = 0.0;
        }
 
        if (screen_is_picasso) {
@@ -174,8 +173,8 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
        aws = aw * scale;
        ahs = ah * scale;
        //write_log (_T("%d %d %d\n"), dst_width, temp_width, aws);
-       extraw = -aws * (filter_horiz_zoom - currprefs.gfx_filteroverlay_overscan * 10) / 2000;
-       extrah = -ahs * (filter_vert_zoom - currprefs.gfx_filteroverlay_overscan * 10) / 2000;
+       extraw = -aws * (filter_horiz_zoom - currprefs.gfx_filteroverlay_overscan * 10) / 2.0f;
+       extrah = -ahs * (filter_vert_zoom - currprefs.gfx_filteroverlay_overscan * 10) / 2.0f;
 
        extraw2 = 0;
        if (getscalerect (&mrmx, &mrmy, &mrsx, &mrsy)) {
@@ -199,14 +198,14 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
        float xmult = filter_horiz_zoom_mult;
        float ymult = filter_vert_zoom_mult;
 
-       srcratio = 4.0 / 3.0;
+       srcratio = 4.0f / 3.0f;
        if (currprefs.gfx_filter_aspect > 0) {
-               dstratio = (currprefs.gfx_filter_aspect >> 8) * 1.0 / (currprefs.gfx_filter_aspect & 0xff);
+               dstratio = (currprefs.gfx_filter_aspect >> 8) * 1.0f / (currprefs.gfx_filter_aspect & 0xff);
        } else if (currprefs.gfx_filter_aspect < 0) {
                if (isfullscreen () && deskw > 0 && deskh > 0)
-                       dstratio = 1.0 * deskw / deskh;
+                       dstratio = 1.0f * deskw / deskh;
                else
-                       dstratio = 1.0 * dst_width / dst_height;
+                       dstratio = 1.0f * dst_width / dst_height;
        } else {
                dstratio = srcratio;
        }
@@ -236,8 +235,8 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
                int cw, ch, cx, cy, cv, crealh = 0;
                static int oxmult, oymult;
 
-               filterxmult = 1000 / scale;
-               filterymult = 1000 / scale;
+               filterxmult = scale;
+               filterymult = scale;
 
                if (scalemode == AUTOSCALE_STATIC_MAX || scalemode == AUTOSCALE_STATIC_NOMINAL || scalemode == AUTOSCALE_INTEGER || scalemode == AUTOSCALE_INTEGER_AUTOSCALE) {
 
@@ -269,15 +268,15 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
                                bool ok = true;
 
                                if (currprefs.gfx_xcenter_pos >= 0 || currprefs.gfx_ycenter_pos >= 0) {
-                                       changed_prefs.gfx_filter_horiz_offset = currprefs.gfx_filter_horiz_offset = 0;
-                                       changed_prefs.gfx_filter_vert_offset = currprefs.gfx_filter_vert_offset = 0;
-                                       filter_horiz_offset = 0;
-                                       filter_vert_offset = 0;
-                                       get_custom_topedge (&cx, &cy);
+                                       changed_prefs.gfx_filter_horiz_offset = currprefs.gfx_filter_horiz_offset = 0.0;
+                                       changed_prefs.gfx_filter_vert_offset = currprefs.gfx_filter_vert_offset = 0.0;
+                                       filter_horiz_offset = 0.0;
+                                       filter_vert_offset = 0.0;
+                                       get_custom_topedge (&cx, &cy, false);
                                }
 
                                if (scalemode == AUTOSCALE_INTEGER_AUTOSCALE)
-                                       ok = get_custom_limits (&cw, &ch, &cx, &cy, &crealh);
+                                       ok = get_custom_limits (&cw, &ch, &cx, &cy, &crealh) != 0;
                                if (scalemode == AUTOSCALE_INTEGER || ok == false)
                                        getmanualpos (&cx, &cy, &cw, &ch);
 
@@ -286,12 +285,12 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
 
                                extraw = 0;
                                extrah = 0;
-                               xmult = 1000.0;
-                               ymult = 1000.0;
+                               xmult = 1.0;
+                               ymult = 1.0;
                                filter_horiz_zoom = 0;
                                filter_vert_zoom = 0;
-                               filter_horiz_zoom_mult = 1000.0;
-                               filter_vert_zoom_mult = 1000.0;
+                               filter_horiz_zoom_mult = 1.0;
+                               filter_vert_zoom_mult = 1.0;
 
                                if (cw2 > maxw || ch2 > maxh) {
                                        while (cw2 / mult > maxw || ch2 / mult > maxh)
@@ -313,12 +312,12 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
 
                } else if (scalemode == AUTOSCALE_MANUAL) {
 
-                       changed_prefs.gfx_filter_horiz_offset = currprefs.gfx_filter_horiz_offset = 0;
-                       changed_prefs.gfx_filter_vert_offset = currprefs.gfx_filter_vert_offset = 0;
-                       filter_horiz_offset = 0;
-                       filter_vert_offset = 0;
+                       changed_prefs.gfx_filter_horiz_offset = currprefs.gfx_filter_horiz_offset = 0.0;
+                       changed_prefs.gfx_filter_vert_offset = currprefs.gfx_filter_vert_offset = 0.0;
+                       filter_horiz_offset = 0.0;
+                       filter_vert_offset = 0.0;
 
-                       get_custom_topedge (&cx, &cy);
+                       get_custom_topedge (&cx, &cy, currprefs.gfx_xcenter_pos < 0 && currprefs.gfx_ycenter_pos < 0);
                        //write_log (_T("%dx%d %dx%d\n"), cx, cy, currprefs.gfx_resolution, currprefs.gfx_vresolution);
 
                        getmanualpos (&cx, &cy, &cw, &ch);
@@ -427,8 +426,8 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
                                        lastresize = AUTORESIZE_FRAME_DELAY;
                                        lastdelay = 0;
                                }
-                               double scalex = currprefs.gfx_filter_horiz_zoom_mult > 0 ? 1000.0 / currprefs.gfx_filter_horiz_zoom_mult : 1.0;
-                               double scaley = currprefs.gfx_filter_vert_zoom_mult > 0 ? 1000.0 / currprefs.gfx_filter_vert_zoom_mult : 1.0;
+                               float scalex = currprefs.gfx_filter_horiz_zoom_mult > 0 ? currprefs.gfx_filter_horiz_zoom_mult : 1.0f;
+                               float scaley = currprefs.gfx_filter_vert_zoom_mult > 0 ? currprefs.gfx_filter_horiz_zoom_mult : 1.0f;
                                SetRect (sr, 0, 0, cw * scale * scalex, ch * scale * scaley);
                                dr->left = (temp_width - aws) /2;
                                dr->top = (temp_height - ahs) / 2;
@@ -480,16 +479,16 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
 
                                if (currprefs.gfx_filter_keep_aspect) {
                                        if (currprefs.ntscmode) {
-                                               dstratio = dstratio * 1.21;
+                                               dstratio = dstratio * 1.21f;
                                                if (currprefs.gfx_filter_keep_aspect == 2 && ispal ())
-                                                       dstratio = dstratio * 0.93;
+                                                       dstratio = dstratio * 0.93f;
                                                else if (currprefs.gfx_filter_keep_aspect == 1 && !ispal ())
-                                                       dstratio = dstratio * 0.98;
+                                                       dstratio = dstratio * 0.98f;
                                        } else {
                                                if (currprefs.gfx_filter_keep_aspect == 2 && ispal ())
-                                                       dstratio = dstratio * 0.95;
+                                                       dstratio = dstratio * 0.95f;
                                                else if (currprefs.gfx_filter_keep_aspect == 1 && !ispal ())
-                                                       dstratio = dstratio * 0.95;
+                                                       dstratio = dstratio * 0.95f;
                                        }
                                }
                                aspect = true;
@@ -521,15 +520,13 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
                                filteroffsety += diff / 2;
                        }
 
-                       v = filter_horiz_offset;
-                       OffsetRect (zr, (int)(-v * aws / 1000.0), 0);
-                       v = filter_vert_offset;
-                       OffsetRect (zr, 0, (int)(-v * ahs / 1000.0));
+                       OffsetRect (zr, (int)(-filter_horiz_offset * aws), 0);
+                       OffsetRect (zr, 0, (int)(-filter_vert_offset * ahs));
 
                        diff = dr->right - dr->left;
-                       filterxmult = diff * 1000 / (dst_width * scale);
+                       filterxmult = diff / (dst_width * scale);
                        diff = dr->bottom - dr->top;
-                       filterymult = diff * 1000 / (dst_height * scale);
+                       filterymult = diff / (dst_height * scale);
                        goto end;
                }
 
@@ -543,15 +540,15 @@ cont:
                if (currprefs.gfx_filter_keep_aspect) {
                        float xm, ym, m;
 
-                       xm = 1.0 * aws / dst_width;
-                       ym = 1.0 * ahs / dst_height;
+                       xm = aws / dst_width;
+                       ym = ahs / dst_height;
                        if (xm < ym)
                                xm = ym;
                        else
                                ym = xm;
-                       xmult = ymult = xm * 1000.0;
+                       xmult = ymult = xm;
 
-                       m = (aws * 1.0 / dst_width) / (ahs * 1.0 / dst_height);
+                       m = (aws * dst_width) / (ahs * dst_height);
                        dstratio = dstratio * m;
                }
 
@@ -559,14 +556,14 @@ cont:
 
        if (currprefs.ntscmode) {
                if (currprefs.gfx_filter_keep_aspect == 2 && ispal ())
-                       dstratio = dstratio * 0.93;
+                       dstratio = dstratio * 0.93f;
                else if (currprefs.gfx_filter_keep_aspect == 1 && !ispal ())
-                       dstratio = dstratio * 0.98;
+                       dstratio = dstratio * 0.98f;
        } else {
                if (currprefs.gfx_filter_keep_aspect == 2 && ispal ())
-                       dstratio = dstratio * 0.95;
+                       dstratio = dstratio * 0.95f;
                else if (currprefs.gfx_filter_keep_aspect == 1 && !ispal ())
-                       dstratio = dstratio * 0.95;
+                       dstratio = dstratio * 0.95f;
        }
 
        if (srcratio > dstratio) {
@@ -576,33 +573,35 @@ cont:
        }
 
        if (xmult <= 0.01)
-               xmult = aws * 1000 / dst_width;
+               xmult = (float)dst_width / aws;
        else
-               xmult = xmult + xmult * filter_horiz_zoom / 2000;
+               xmult = xmult + xmult * filter_horiz_zoom / 2.0f;
        if (ymult <= 0.01)
-               ymult = ahs * 1000 / dst_height;
+               ymult = (float)dst_height / ahs;
        else
-               ymult = ymult + ymult * filter_vert_zoom / 2000;
+               ymult = ymult + ymult * filter_vert_zoom / 2.0f;
 
        if (!filter_horiz_zoom_mult && !filter_vert_zoom_mult) {
                if (currprefs.ntscmode) {
-                       ymult /= 1.21;
+                       ymult /= 1.21f;
                }
        }
 
-       v = filter_horiz_offset;
-       OffsetRect (zr, (int)(-v * aws / 1000.0), 0);
-       v = filter_vert_offset;
-       OffsetRect (zr, 0, (int)(-v * ahs / 1000.0));
+       OffsetRect (zr, (int)(-filter_horiz_offset * aws), 0);
+       OffsetRect (zr, 0, (int)(-filter_vert_offset * ahs));
 
-       xs = dst_width - dst_width * xmult / 1000;
-       ys = dst_height - dst_height * ymult / 1000;
+       xs = dst_width;
+       if (xmult)
+               xs -= dst_width / xmult;
+       ys = dst_height;
+       if (ymult)
+               ys -= dst_height / ymult;
        sizeoffset (dr, zr, xs, ys);
 
        filterxmult = xmult;
        filterymult = ymult;
-       filteroffsetx += (dst_width - aw * 1000 / filterxmult) / 2;
-       filteroffsety += (dst_height - ah * 1000 / filterymult) / 2;
+       filteroffsetx += (dst_width - aw / filterxmult) / 2;
+       filteroffsety += (dst_height - ah / filterymult) / 2;
 
 end:
 
@@ -704,13 +703,13 @@ void S2X_free (void)
        tempsurf3 = 0;
        filteroffsetx = 0;
        filteroffsety = 0;
-       filterxmult = 1000;
-       filterymult = 1000;
+       filterxmult = 1.0;
+       filterymult = 1.0;
        scale = 1;
        inited = false;
 }
 
-void S2X_init (int dw, int dh, int dd)
+bool S2X_init (int dw, int dh, int dd)
 {
        int flags = 0;
        struct vidbuffer *vb = gfxvidinfo.outbuffer;
@@ -736,7 +735,7 @@ void S2X_init (int dw, int dh, int dd)
                alloc_colors_rgb (5, 6, 5, 11, 5, 0, 0, 0, 0, 0, rc, gc, bc);
 
        if (WIN32GFX_IsPicassoScreen ())
-               return;
+               return true;
 
        if (!currprefs.gfx_filter || !usedfilter) {
                usedfilter = &uaefilters[0];
@@ -796,9 +795,12 @@ void S2X_init (int dw, int dh, int dd)
                if (!d3d)
                        tempsurf = allocsurface (temp_width, temp_height);
        }
-       if (!tempsurf && !d3d)
+       if (!tempsurf && !d3d) {
                write_log (_T("DDRAW: failed to create temp surface (%dx%d)\n"), temp_width, temp_height);
+               return false;
+       }
        inited = true;
+       return true;
 }
 
 void S2X_render (void)
index 16663f555545afe47fe72b320850f4a53e4df9b4..ec5bad202b48a8006bd28a56adc58be5703bd83c 100644 (file)
@@ -16,6 +16,7 @@
 #include <commctrl.h>
 #include <ddraw.h>
 #include <shellapi.h>
+#include <dwmapi.h>
 
 #include "sysdeps.h"
 
@@ -75,7 +76,7 @@
 #define SM_NONE 11
 
 struct uae_filter *usedfilter;
-static int scalepicasso;
+int scalepicasso;
 static double remembered_vblank;
 static volatile int vblankthread_mode, vblankthread_counter;
 
@@ -300,23 +301,25 @@ void desktop_coords (int *dw, int *dh, int *ax, int *ay, int *aw, int *ah)
 
 int target_get_display (const TCHAR *name)
 {
-       int oldfound = -1;
-       int found = -1;
+       for (int i = 0; Displays[i].monitorname; i++) {
+               struct MultiDisplay *md = &Displays[i];
+               if (!_tcscmp (md->monitorid, name))
+                       return i + 1;
+       }
        for (int i = 0; Displays[i].monitorname; i++) {
                struct MultiDisplay *md = &Displays[i];
                if (!_tcscmp (md->adapterid, name))
-                       found = i + 1;
+                       return i + 1;
+       }
+       for (int i = 0; Displays[i].monitorname; i++) {
+               struct MultiDisplay *md = &Displays[i];
                if (!_tcscmp (md->adaptername, name))
-                       found = i + 1;
-               if (!_tcscmp (md->monitorname, name))
-                       found = i + 1;
-               if (!_tcscmp (md->monitorid, name))
-                       found = i + 1;
-               if (found >= 0) {
-                       if (oldfound != found)
-                               return -1;
-                       oldfound = found;
-               }
+                       return i + 1;
+       }
+       for (int i = 0; Displays[i].monitorname; i++) {
+               struct MultiDisplay *md = &Displays[i];
+               if (!_tcscmp (md->adapterid, name))
+                       return i + 1;
        }
        return -1;
 }
@@ -350,9 +353,9 @@ void centerdstrect (RECT *dr)
 
 static int picasso_offset_x, picasso_offset_y, picasso_offset_mx, picasso_offset_my;
 
-void getgfxoffset (int *dxp, int *dyp, int *mxp, int *myp)
+void getgfxoffset (float *dxp, float *dyp, float *mxp, float *myp)
 {
-       int dx, dy;
+       float dx, dy;
 
        getfilteroffset (&dx, &dy, mxp, myp);
        *dxp = dx;
@@ -1156,7 +1159,7 @@ static void DX_Blit96 (int x, int y, int w, int h)
                int srcratio, dstratio;
                int srcwidth, srcheight;
 
-               if (scalepicasso < 0) {
+               if (scalepicasso < 0 || scalepicasso > 1) {
                        srcwidth = picasso96_state.Width;
                        srcheight = picasso96_state.Height;
                } else {
@@ -1220,34 +1223,50 @@ void getrtgfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_hei
        if (!srcwidth || !srcheight)
                return;
 
-       if (currprefs.win32_rtgscaleaspectratio < 0) {
-               // automatic
-               srcratio = picasso96_state.Width * 256 / picasso96_state.Height;
-               dstratio = currentmode->native_width * 256 / currentmode->native_height;
-       } else if (currprefs.win32_rtgscaleaspectratio == 0) {
-               // none
-               srcratio = dstratio = 0;
+       if (scalepicasso == RTG_MODE_INTEGER_SCALE) {
+               int divx = currentmode->native_width / srcwidth;
+               int divy = currentmode->native_height / srcheight;
+               int mul = divx > divy ? divy : divx;
+               int xx = srcwidth * mul;
+               int yy = srcheight * mul;
+               SetRect (sr, 0, 0, currentmode->native_width / mul, currentmode->native_height / mul);
+               SetRect (dr, 0, 0, currentmode->native_width, currentmode->native_height);
+       } else if (scalepicasso == RTG_MODE_CENTER) {
+               int xx = (currentmode->native_width - srcwidth) / 2;
+               int yy = (currentmode->native_height - srcheight) / 2;
+               picasso_offset_x = -xx;
+               picasso_offset_y = -yy;
+               SetRect (dr, 0, 0, currentmode->native_width, currentmode->native_height);
        } else {
-               // manual
-               dstratio = (currprefs.win32_rtgscaleaspectratio >> 8) * 256 / (currprefs.win32_rtgscaleaspectratio & 0xff);
-               srcratio = srcwidth * 256 / srcheight;
-       }
+               if (currprefs.win32_rtgscaleaspectratio < 0) {
+                       // automatic
+                       srcratio = srcwidth * 256 / srcheight;
+                       dstratio = currentmode->native_width * 256 / currentmode->native_height;
+               } else if (currprefs.win32_rtgscaleaspectratio == 0) {
+                       // none
+                       srcratio = dstratio = 0;
+               } else {
+                       // manual
+                       dstratio = (currprefs.win32_rtgscaleaspectratio >> 8) * 256 / (currprefs.win32_rtgscaleaspectratio & 0xff);
+                       srcratio = srcwidth * 256 / srcheight;
+               }
 
-       if (srcratio == dstratio) {
-               SetRect (dr, 0, 0, srcwidth, srcheight);
-       } else if (srcratio > dstratio) {
-               int yy = picasso96_state.Height * srcratio / dstratio;
-               SetRect (dr, 0, 0, picasso96_state.Width, yy);
-               picasso_offset_y = (picasso96_state.Height - yy) / 2;
-       } else {
-               int xx = picasso96_state.Width * dstratio / srcratio;
-               SetRect (dr, 0, 0, xx, picasso96_state.Height);
-               picasso_offset_x = (picasso96_state.Width - xx) / 2;
+               if (srcratio == dstratio) {
+                       SetRect (dr, 0, 0, srcwidth, srcheight);
+               } else if (srcratio > dstratio) {
+                       int yy = srcheight * srcratio / dstratio;
+                       SetRect (dr, 0, 0, srcwidth, yy);
+                       picasso_offset_y = (picasso96_state.Height - yy) / 2;
+               } else {
+                       int xx = srcwidth * dstratio / srcratio;
+                       SetRect (dr, 0, 0, xx, srcheight);
+                       picasso_offset_x = (picasso96_state.Width - xx) / 2;
+               }
        }
 
        OffsetRect (zr, picasso_offset_x, picasso_offset_y);
-       picasso_offset_mx = picasso96_state.Width * 1000 / (dr->right - dr->left);
-       picasso_offset_my = picasso96_state.Height * 1000 / (dr->bottom - dr->top);
+       picasso_offset_mx = srcwidth * 1000 / (dr->right - dr->left);
+       picasso_offset_my = srcheight * 1000 / (dr->bottom - dr->top);
 }
 
 static bool rtg_locked;
@@ -1446,8 +1465,8 @@ static void update_gfxparams (void)
 #ifdef PICASSO96
        currentmode->vsync = 0;
        if (screen_is_picasso) {
-               currentmode->current_width = picasso96_state.Width * (1000 / currprefs.rtg_horiz_zoom_mult);
-               currentmode->current_height = picasso96_state.Height * (1000 / currprefs.rtg_vert_zoom_mult);
+               currentmode->current_width = (int)(picasso96_state.Width * currprefs.rtg_horiz_zoom_mult);
+               currentmode->current_height = (int)(picasso96_state.Height * currprefs.rtg_vert_zoom_mult);
                currprefs.gfx_apmode[1].gfx_interlaced = false;
                if (currprefs.win32_rtgvblankrate == 0) {
                        currprefs.gfx_apmode[1].gfx_refreshrate = currprefs.gfx_apmode[0].gfx_refreshrate;
@@ -1489,26 +1508,62 @@ static void update_gfxparams (void)
        scalepicasso = 0;
        if (screen_is_picasso) {
                if (isfullscreen () < 0) {
-                       if ((currprefs.win32_rtgscaleifsmall || currprefs.win32_rtgallowscaling) && (picasso96_state.Width != currentmode->native_width || picasso96_state.Height != currentmode->native_height))
+                       if ((currprefs.win32_rtgscalemode == RTG_MODE_CENTER || currprefs.win32_rtgscalemode == RTG_MODE_SCALE || currprefs.win32_rtgallowscaling) && (picasso96_state.Width != currentmode->native_width || picasso96_state.Height != currentmode->native_height))
                                scalepicasso = 1;
+                       if (currprefs.win32_rtgscalemode == RTG_MODE_CENTER)
+                               scalepicasso = currprefs.win32_rtgscalemode;
                        if (!scalepicasso && currprefs.win32_rtgscaleaspectratio)
                                scalepicasso = -1;
                } else if (isfullscreen () > 0) {
                        if (!currprefs.win32_rtgmatchdepth) { // can't scale to different color depth
                                if (currentmode->native_width > picasso96_state.Width && currentmode->native_height > picasso96_state.Height) {
-                                       if (currprefs.win32_rtgscaleifsmall)
+                                       if (currprefs.win32_rtgscalemode)
                                                scalepicasso = 1;
                                }
+                               if (currprefs.win32_rtgscalemode == RTG_MODE_CENTER)
+                                       scalepicasso = currprefs.win32_rtgscalemode;
                                if (!scalepicasso && currprefs.win32_rtgscaleaspectratio)
                                        scalepicasso = -1;
                        }
                } else if (isfullscreen () == 0) {
-                       if ((currprefs.gfx_size.width != picasso96_state.Width || currprefs.gfx_size.height != picasso96_state.Height) && currprefs.win32_rtgallowscaling)
-                               scalepicasso = 1;
-                       if ((currprefs.gfx_size.width > picasso96_state.Width || currprefs.gfx_size.height > picasso96_state.Height) && currprefs.win32_rtgscaleifsmall)
-                               scalepicasso = 1;
-                       if (!scalepicasso && currprefs.win32_rtgscaleaspectratio)
-                               scalepicasso = -1;
+                       if (currprefs.win32_rtgscalemode == RTG_MODE_INTEGER_SCALE) {
+                               scalepicasso = RTG_MODE_INTEGER_SCALE;
+                               currentmode->current_width = currprefs.gfx_size.width;
+                               currentmode->current_height = currprefs.gfx_size.height;
+                       } else if (currprefs.win32_rtgscalemode == RTG_MODE_CENTER) {
+                               if (currprefs.gfx_size.width < picasso96_state.Width || currprefs.gfx_size.height < picasso96_state.Height) {
+                                       if (!currprefs.win32_rtgallowscaling) {
+                                               ;
+                                       } else if (currprefs.win32_rtgscaleaspectratio) {
+                                               scalepicasso = -1;
+                                               currentmode->current_width = currprefs.gfx_size.width;
+                                               currentmode->current_height = currprefs.gfx_size.height;
+                                       }
+                               } else {
+                                       scalepicasso = 2;
+                                       currentmode->current_width = currprefs.gfx_size.width;
+                                       currentmode->current_height = currprefs.gfx_size.height;
+                               }
+                       } else if (currprefs.win32_rtgscalemode == RTG_MODE_SCALE) {
+                               if (currprefs.gfx_size.width > picasso96_state.Width || currprefs.gfx_size.height > picasso96_state.Height)
+                                       scalepicasso = 1;
+                               if ((currprefs.gfx_size.width != picasso96_state.Width || currprefs.gfx_size.height != picasso96_state.Height) && currprefs.win32_rtgallowscaling) {
+                                       scalepicasso = 1;
+                               } else if (currprefs.gfx_size.width < picasso96_state.Width || currprefs.gfx_size.height < picasso96_state.Height) {
+                                       // no always scaling and smaller? Back to normal size
+                                       currentmode->current_width = changed_prefs.gfx_size_win.width = picasso96_state.Width;
+                                       currentmode->current_height = changed_prefs.gfx_size_win.height = picasso96_state.Height;
+                               } else if (currprefs.gfx_size.width == picasso96_state.Width || currprefs.gfx_size.height == picasso96_state.Height) {
+                                       ;
+                               } else if (!scalepicasso && currprefs.win32_rtgscaleaspectratio) {
+                                       scalepicasso = -1;
+                               }
+                       } else {
+                               if ((currprefs.gfx_size.width != picasso96_state.Width || currprefs.gfx_size.height != picasso96_state.Height) && currprefs.win32_rtgallowscaling)
+                                       scalepicasso = 1;
+                               if (!scalepicasso && currprefs.win32_rtgscaleaspectratio)
+                                       scalepicasso = -1;
+                       }
                }
 
                if (scalepicasso > 0 && (currprefs.gfx_size.width != picasso96_state.Width || currprefs.gfx_size.height != picasso96_state.Height)) {
@@ -1575,6 +1630,10 @@ static int open_windows (bool mousecapture)
                        gui_led (i, -1);
                gui_led (LED_POWER, gui_data.powerled);
                gui_fps (0, 0, 0);
+               for (i = 0; i < 4; i++) {
+                       if (currprefs.floppyslots[i].dfxtype >= 0)
+                               gui_led (LED_DF0 + i, 0);
+               }
                inputdevice_acquire (TRUE);
        } else if (startminimized) {
                setpriority (&priorities[currprefs.win32_iconified_priority]);
@@ -1628,16 +1687,7 @@ int check_prefs_changed_gfx (void)
        if (!config_changed && !display_change_requested)
                return 0;
 
-       if (currprefs.win32_statusbar != changed_prefs.win32_statusbar) {
-               if ((currprefs.win32_statusbar == 0 && changed_prefs.win32_statusbar > 0)) {
-                       c |= 32;
-               } else if ((currprefs.win32_statusbar > 0 && changed_prefs.win32_statusbar == 0)) {
-                       c |= 32;
-               } else {
-                       c |= 512;
-               }
-       }
-
+       c |= currprefs.win32_statusbar != changed_prefs.win32_statusbar ? 512 : 0;
        c |= currprefs.gfx_size_fs.width != changed_prefs.gfx_size_fs.width ? 16 : 0;
        c |= currprefs.gfx_size_fs.height != changed_prefs.gfx_size_fs.height ? 16 : 0;
        c |= ((currprefs.gfx_size_win.width + 7) & ~7) != ((changed_prefs.gfx_size_win.width + 7) & ~7) ? 16 : 0;
@@ -1666,22 +1716,22 @@ int check_prefs_changed_gfx (void)
        c |= _tcscmp (currprefs.gfx_filteroverlay, changed_prefs.gfx_filteroverlay) ? (2|8) : 0;
        c |= currprefs.gfx_filter_filtermode != changed_prefs.gfx_filter_filtermode ? (2|8) : 0;
        c |= currprefs.gfx_filter_bilinear != changed_prefs.gfx_filter_bilinear ? (2|8) : 0;
-       c |= currprefs.gfx_filter_horiz_zoom_mult != changed_prefs.gfx_filter_horiz_zoom_mult ? (1|8) : 0;
-       c |= currprefs.gfx_filter_vert_zoom_mult != changed_prefs.gfx_filter_vert_zoom_mult ? (1|8) : 0;
-       c |= currprefs.gfx_filter_noise != changed_prefs.gfx_filter_noise ? (1|8) : 0;
-       c |= currprefs.gfx_filter_blur != changed_prefs.gfx_filter_blur ? (1|8) : 0;
+       c |= currprefs.gfx_filter_horiz_zoom_mult != changed_prefs.gfx_filter_horiz_zoom_mult ? (1) : 0;
+       c |= currprefs.gfx_filter_vert_zoom_mult != changed_prefs.gfx_filter_vert_zoom_mult ? (1) : 0;
+       c |= currprefs.gfx_filter_noise != changed_prefs.gfx_filter_noise ? (1) : 0;
+       c |= currprefs.gfx_filter_blur != changed_prefs.gfx_filter_blur ? (1) : 0;
        c |= currprefs.gfx_filter_scanlines != changed_prefs.gfx_filter_scanlines ? (1|8) : 0;
        c |= currprefs.gfx_filter_scanlinelevel != changed_prefs.gfx_filter_scanlinelevel ? (1|8) : 0;
        c |= currprefs.gfx_filter_scanlineratio != changed_prefs.gfx_filter_scanlineratio ? (1|8) : 0;
-       c |= currprefs.gfx_filter_aspect != changed_prefs.gfx_filter_aspect ? (1|8) : 0;
-       c |= currprefs.gfx_filter_luminance != changed_prefs.gfx_filter_luminance ? (1|8) : 0;
-       c |= currprefs.gfx_filter_contrast != changed_prefs.gfx_filter_contrast ? (1|8) : 0;
-       c |= currprefs.gfx_filter_saturation != changed_prefs.gfx_filter_saturation ? (1|8) : 0;
-       c |= currprefs.gfx_filter_gamma != changed_prefs.gfx_filter_gamma ? (1|8) : 0;
+       c |= currprefs.gfx_filter_aspect != changed_prefs.gfx_filter_aspect ? (1) : 0;
+       c |= currprefs.gfx_filter_luminance != changed_prefs.gfx_filter_luminance ? (1) : 0;
+       c |= currprefs.gfx_filter_contrast != changed_prefs.gfx_filter_contrast ? (1) : 0;
+       c |= currprefs.gfx_filter_saturation != changed_prefs.gfx_filter_saturation ? (1) : 0;
+       c |= currprefs.gfx_filter_gamma != changed_prefs.gfx_filter_gamma ? (1) : 0;
        //c |= currprefs.gfx_filter_ != changed_prefs.gfx_filter_ ? (1|8) : 0;
 
-       c |= currprefs.rtg_horiz_zoom_mult != changed_prefs.rtg_horiz_zoom_mult ? (1|8) : 0;
-       c |= currprefs.rtg_vert_zoom_mult != changed_prefs.rtg_vert_zoom_mult ? (1|8) : 0;
+       c |= currprefs.rtg_horiz_zoom_mult != changed_prefs.rtg_horiz_zoom_mult ? (1) : 0;
+       c |= currprefs.rtg_vert_zoom_mult != changed_prefs.rtg_vert_zoom_mult ? (1) : 0;
 
        c |= currprefs.gfx_luminance != changed_prefs.gfx_luminance ? (1 | 256) : 0;
        c |= currprefs.gfx_contrast != changed_prefs.gfx_contrast ? (1 | 256) : 0;
@@ -1709,7 +1759,7 @@ int check_prefs_changed_gfx (void)
        c |= currprefs.win32_borderless != changed_prefs.win32_borderless ? 32 : 0;
        c |= currprefs.win32_blankmonitors != changed_prefs.win32_blankmonitors ? 32 : 0;
        c |= currprefs.win32_rtgmatchdepth != changed_prefs.win32_rtgmatchdepth ? 2 : 0;
-       c |= currprefs.win32_rtgscaleifsmall != changed_prefs.win32_rtgscaleifsmall ? (2 | 8 | 64) : 0;
+       c |= currprefs.win32_rtgscalemode != changed_prefs.win32_rtgscalemode ? (2 | 8 | 64) : 0;
        c |= currprefs.win32_rtgallowscaling != changed_prefs.win32_rtgallowscaling ? (2 | 8 | 64) : 0;
        c |= currprefs.win32_rtgscaleaspectratio != changed_prefs.win32_rtgscaleaspectratio ? (8 | 64) : 0;
        c |= currprefs.win32_rtgvblankrate != changed_prefs.win32_rtgvblankrate ? 8 : 0;
@@ -1797,7 +1847,7 @@ int check_prefs_changed_gfx (void)
                currprefs.win32_blankmonitors = changed_prefs.win32_blankmonitors;
                currprefs.win32_statusbar = changed_prefs.win32_statusbar;
                currprefs.win32_rtgmatchdepth = changed_prefs.win32_rtgmatchdepth;
-               currprefs.win32_rtgscaleifsmall = changed_prefs.win32_rtgscaleifsmall;
+               currprefs.win32_rtgscalemode = changed_prefs.win32_rtgscalemode;
                currprefs.win32_rtgallowscaling = changed_prefs.win32_rtgallowscaling;
                currprefs.win32_rtgscaleaspectratio = changed_prefs.win32_rtgscaleaspectratio;
                currprefs.win32_rtgvblankrate = changed_prefs.win32_rtgvblankrate;
@@ -2288,7 +2338,7 @@ static int modeswitchneeded (struct winuae_currentmode *wc)
                        if (picasso96_state.BytesPerPixel > 1 && picasso96_state.BytesPerPixel * 8 != wc->current_depth && currprefs.win32_rtgmatchdepth)
                                return -1;
                        if (picasso96_state.Width < wc->current_width && picasso96_state.Height < wc->current_height) {
-                               if (currprefs.win32_rtgscaleifsmall && !currprefs.win32_rtgmatchdepth)
+                               if ((currprefs.win32_rtgscalemode == 1 || (currprefs.win32_rtgscalemode == 2 && currprefs.win32_rtgallowscaling)) && !currprefs.win32_rtgmatchdepth)
                                        return 0;
                        }
                        if (picasso96_state.Width != wc->current_width ||
@@ -2318,7 +2368,7 @@ static int modeswitchneeded (struct winuae_currentmode *wc)
                DirectDraw_Fill (NULL, 0);
                DirectDraw_BlitToPrimary (NULL);
                if (screen_is_picasso) {
-                       if (currprefs.win32_rtgscaleifsmall && ((wc->native_width > picasso96_state.Width && wc->native_height >= picasso96_state.Height) || (wc->native_height > picasso96_state.Height && wc->native_width >= picasso96_state.Width)))
+                       if (currprefs.win32_rtgscalemode && ((wc->native_width > picasso96_state.Width && wc->native_height >= picasso96_state.Height) || (wc->native_height > picasso96_state.Height && wc->native_width >= picasso96_state.Width)))
                                return -1;
                        if (currprefs.win32_rtgallowscaling && (picasso96_state.Width != wc->native_width || picasso96_state.Height != wc->native_height))
                                return -1;
@@ -2458,10 +2508,23 @@ uae_u32 OSDEP_minimize_uae (void)
        return ShowWindow (hAmigaWnd, SW_MINIMIZE);
 }
 
+typedef HRESULT (CALLBACK* DWMENABLEMMCSS)(BOOL);
+static void setDwmEnableMMCSS (bool state)
+{
+       if (!os_vista)
+               return;
+       DWMENABLEMMCSS pDwmEnableMMCSS;
+       pDwmEnableMMCSS = (DWMENABLEMMCSS)GetProcAddress (
+               GetModuleHandle (_T("dwmapi.dll")), "DwmEnableMMCSS");
+       if (pDwmEnableMMCSS)
+               pDwmEnableMMCSS (state);
+}
+
 void close_windows (void)
 {
        changevblankthreadmode (VBLANKTH_IDLE);
        waitflipevent ();
+       setDwmEnableMMCSS (FALSE);
        reset_sound ();
 #if defined (GFXFILTER)
        S2X_free ();
@@ -2493,12 +2556,8 @@ static void createstatuswindow (void)
        }
        if (currprefs.win32_statusbar == 0)
                return;
-       if (currentmode->flags & DM_W_FULLSCREEN)
+       if (isfullscreen () != 0)
                return;
-#ifdef RETROPLATFORMR
-       if (rp_isactive ())
-               return;
-#endif
        if (currprefs.win32_borderless)
                return;
 
@@ -3547,6 +3606,7 @@ static void movecursor (int x, int y)
 static int create_windows_2 (void)
 {
        static bool firstwindow = true;
+       static int prevsbheight;
        int dxfs = currentmode->flags & (DM_DX_FULLSCREEN);
        int d3dfs = currentmode->flags & (DM_D3D_FULLSCREEN);
        int fsw = currentmode->flags & (DM_W_FULLSCREEN);
@@ -3601,13 +3661,14 @@ static int create_windows_2 (void)
                        else
                                ny = rc.top + (rc.bottom - rc.top - nh);
                }
-               if (w != nw || h != nh || x != nx || y != ny) {
+               if (w != nw || h != nh || x != nx || y != ny || sbheight != prevsbheight) {
                        w = nw;
                        h = nh;
                        x = nx;
                        y = ny;
                        in_sizemove++;
                        if (hMainWnd && !fsw && !dxfs && !d3dfs && !rp_isactive ()) {
+                               window_extra_height += (sbheight - prevsbheight);
                                GetWindowRect (hMainWnd, &r);
                                x = r.left;
                                y = r.top;
@@ -3634,6 +3695,7 @@ static int create_windows_2 (void)
                        amigawin_rect.left, amigawin_rect.top, amigawin_rect.right - amigawin_rect.left, amigawin_rect.bottom - amigawin_rect.top);
                updatemouseclip ();
                rp_screenmode_changed ();
+               prevsbheight = sbheight;
                return 1;
        }
 
@@ -3784,7 +3846,8 @@ static int create_windows_2 (void)
                ShowWindow (hAmigaWnd, SW_SHOWNORMAL);
        UpdateWindow (hAmigaWnd);
        firstwindow = false;
-
+       setDwmEnableMMCSS (true);
+       prevsbheight = sbheight;
        return 1;
 }
 
@@ -4072,15 +4135,12 @@ bool target_graphics_buffer_update (void)
                DirectDraw_ClearSurface (NULL);
        }
        if ((currentmode->flags & DM_SWSCALE) && !screen_is_picasso) {
-               S2X_init (currentmode->native_width, currentmode->native_height, currentmode->native_depth);
+               if (!S2X_init (currentmode->native_width, currentmode->native_height, currentmode->native_depth))
+                       return false;
        }
        return true;
 }
 
-void WIN32GFX_WindowMove (void)
-{
-}
-
 void updatedisplayarea (void)
 {
        if (!screen_is_initialized)
index c818d50d89644cc284f9f76e29cf1774c6bba7d9..70735c98a4872d163f0b41cc86e17d70af702906 100644 (file)
@@ -3,6 +3,10 @@
 
 #include <ddraw.h>
 
+#define RTG_MODE_SCALE 1
+#define RTG_MODE_CENTER 2
+#define RTG_MODE_INTEGER_SCALE 3
+
 extern void sortdisplays (void);
 extern void enumeratedisplays (void);
 
@@ -13,8 +17,6 @@ int WIN32GFX_GetDepth (int real);
 void WIN32GFX_DisplayChangeRequested (int);
 void WIN32GFX_DisablePicasso (void);
 void WIN32GFX_EnablePicasso (void);
-void WIN32GFX_WindowMove (void);
-void WIN32GFX_WindowSize (void);;
 void DX_Invalidate (int x, int y, int width, int height);
 
 RGBFTYPE WIN32GFX_FigurePixelFormats (RGBFTYPE colortype);
@@ -27,6 +29,7 @@ extern int normal_display_change_starting;
 extern int window_led_drives, window_led_drives_end, window_led_joy_start;
 extern int window_led_hd, window_led_hd_end;
 extern int window_led_joys, window_led_joys_end;
+extern int scalepicasso;
 
 extern HDC gethdc (void);
 extern void releasehdc (HDC hdc);
index 2eda445e8198d82075afb6ead626c9a6a87de4a9..30ea5373c444a96a3d22f668346d692ac76ef0eb 100644 (file)
 #define ROM_FORMAT_STRING _T("(*.rom;*.roz)\0*.rom;*.roz;") ARCHIVE_STRING _T("\0")
 #define USS_FORMAT_STRING_RESTORE _T("(*.uss)\0*.uss;*.gz;") ARCHIVE_STRING _T("\0")
 #define USS_FORMAT_STRING_SAVE _T("(*.uss)\0*.uss\0")
-#define HDF_FORMAT_STRING _T("(*.hdf;*.vhd;*.rdf;*.hdz;*.rdz)\0*.hdf;*.vhd;*.rdf;*.hdz;*.rdz\0")
+#define HDF_FORMAT_STRING _T("(*.hdf;*.vhd;*.rdf;*.hdz;*.rdz;*.chd)\0*.hdf;*.vhd;*.rdf;*.hdz;*.rdz;*.chd\0")
 #define INP_FORMAT_STRING _T("(*.inp)\0*.inp\0")
-#define  CD_FORMAT_STRING _T("(*.cue;*.ccd;*.mds;*.iso)\0*.cue;*.ccd;*.mds;*.iso;") ARCHIVE_STRING _T("\0")
+#define  CD_FORMAT_STRING _T("(*.cue;*.ccd;*.mds;*.iso;*.chd)\0*.cue;*.ccd;*.mds;*.iso;*.chd;") ARCHIVE_STRING _T("\0")
 #define CONFIG_HOST _T("Host")
 #define CONFIG_HARDWARE _T("Hardware")
 
@@ -1804,13 +1804,14 @@ void gui_display (int shortcut)
                return;
        here++;
        gui_active++;
-       setpaused (9);
-       screenshot_prepare ();
-       flipgui (true);
-       wait_keyrelease ();
-       inputdevice_unacquire ();
-       clearallkeys ();
-       setmouseactive (0);
+       if (setpaused (7)) {
+               screenshot_prepare ();
+               flipgui (true);
+               wait_keyrelease ();
+               inputdevice_unacquire ();
+               clearallkeys ();
+               setmouseactive (0);
+       }
 
        w = h = -1;
        if (!WIN32GFX_IsPicassoScreen () && currprefs.gfx_apmode[0].gfx_fullscreen && (currprefs.gfx_size.width < gui_width || currprefs.gfx_size.height < gui_height)) {
@@ -1842,19 +1843,20 @@ void gui_display (int shortcut)
        }
        manual_painting_needed--; /* So that WM_PAINT doesn't need to use custom refreshing */
        reset_sound ();
-       resumepaused (9);
        inputdevice_copyconfig (&changed_prefs, &currprefs);
        inputdevice_config_change_test ();
        clearallkeys ();
-       inputdevice_acquire (TRUE);
-       setmouseactive (1);
+       if (resumepaused (7)) {
+               inputdevice_acquire (TRUE);
+               setmouseactive (1);
 #ifdef AVIOUTPUT
-       AVIOutput_Begin ();
+               AVIOutput_Begin ();
 #endif
+               flipgui (false);
+       }
        fpscounter_reset ();
        screenshot_free ();
        write_disk_history ();
-       flipgui (false);
        gui_active--;
        here--;
 }
@@ -3878,10 +3880,11 @@ void InitializeListView (HWND hDlg)
 #ifdef FILESYS
                for(i = 0; i < workprefs.mountitems; i++)
                {
-                       struct uaedev_config_info *uci = &workprefs.mountconfig[i];
+                       struct uaedev_config_data *uci = &workprefs.mountconfig[i];
+                       struct uaedev_config_info *ci = &uci->ci;
                        int nosize = 0, type;
                        struct mountedinfo mi;
-                       TCHAR *rootdir = uci->rootdir;
+                       TCHAR *rootdir = ci->rootdir;
 
                        type = get_filesys_unitconfig (&workprefs, i, &mi);
                        if (type < 0) {
@@ -3898,33 +3901,33 @@ void InitializeListView (HWND hDlg)
                        else
                                _stprintf (size_str, _T("%.1fM"), ((double)(uae_u32)(mi.size / (1024))) / 1024.0);
 
-                       if (uci->controller >= HD_CONTROLLER_IDE0 && uci->controller <= HD_CONTROLLER_IDE3) {
-                               _stprintf (blocksize_str, _T("%d"), uci->blocksize);
-                               _stprintf (devname_str, _T("*IDE%d*"), uci->controller - HD_CONTROLLER_IDE0);
+                       if (ci->controller >= HD_CONTROLLER_IDE0 && ci->controller <= HD_CONTROLLER_IDE3) {
+                               _stprintf (blocksize_str, _T("%d"), ci->blocksize);
+                               _stprintf (devname_str, _T("*IDE%d*"), ci->controller - HD_CONTROLLER_IDE0);
                                _tcscpy (volname_str, _T("n/a"));
                                _tcscpy (bootpri_str, _T("n/a"));
-                       } else if (uci->controller >= HD_CONTROLLER_SCSI0 && uci->controller <= HD_CONTROLLER_SCSI6) {
-                               _stprintf (blocksize_str, _T("%d"), uci->blocksize);
-                               _stprintf (devname_str, _T("*SCSI%d*"), uci->controller - HD_CONTROLLER_SCSI0);
+                       } else if (ci->controller >= HD_CONTROLLER_SCSI0 && ci->controller <= HD_CONTROLLER_SCSI6) {
+                               _stprintf (blocksize_str, _T("%d"), ci->blocksize);
+                               _stprintf (devname_str, _T("*SCSI%d*"), ci->controller - HD_CONTROLLER_SCSI0);
                                _tcscpy (volname_str, _T("n/a"));
                                _tcscpy (bootpri_str, _T("n/a"));
-                       } else if (uci->controller == HD_CONTROLLER_PCMCIA_SRAM) {
+                       } else if (ci->controller == HD_CONTROLLER_PCMCIA_SRAM) {
                                _tcscpy (blocksize_str, _T("n/a"));
                                _tcscpy(devname_str, _T("*SCSRAM*"));
                                _tcscpy (volname_str, _T("n/a"));
                                _tcscpy (bootpri_str, _T("n/a"));
-                       } else if (uci->controller == HD_CONTROLLER_PCMCIA_IDE) {
+                       } else if (ci->controller == HD_CONTROLLER_PCMCIA_IDE) {
                                _tcscpy (blocksize_str, _T("n/a"));
                                _tcscpy(devname_str, _T("*SCIDE*"));
                                _tcscpy (volname_str, _T("n/a"));
                                _tcscpy (bootpri_str, _T("n/a"));
                        } else if (type == FILESYS_HARDFILE) {
-                               _stprintf (blocksize_str, _T("%d"), uci->blocksize);
-                               _tcscpy (devname_str, uci->devname);
+                               _stprintf (blocksize_str, _T("%d"), ci->blocksize);
+                               _tcscpy (devname_str, ci->devname);
                                _tcscpy (volname_str, _T("n/a"));
-                               _stprintf (bootpri_str, _T("%d"), uci->bootpri);
-                       } else if (type == FILESYS_HARDFILE_RDB || type == FILESYS_HARDDRIVE || uci->controller) {
-                               _stprintf (blocksize_str, _T("%d"), uci->blocksize);
+                               _stprintf (bootpri_str, _T("%d"), ci->bootpri);
+                       } else if (type == FILESYS_HARDFILE_RDB || type == FILESYS_HARDDRIVE || ci->controller) {
+                               _stprintf (blocksize_str, _T("%d"), ci->blocksize);
                                _tcscpy (devname_str, _T("*UAE*"));
                                _tcscpy (volname_str, _T("n/a"));
                                _tcscpy (bootpri_str, _T("n/a"));
@@ -3932,20 +3935,22 @@ void InitializeListView (HWND hDlg)
                                        rootdir += 3;
                        } else {
                                _tcscpy (blocksize_str, _T("n/a"));
-                               _tcscpy (devname_str, uci->devname);
-                               _tcscpy (volname_str, uci->volname);
+                               _tcscpy (devname_str, ci->devname);
+                               _tcscpy (volname_str, ci->volname);
                                _tcscpy (size_str, _T("n/a"));
-                               _stprintf (bootpri_str, _T("%d"), uci->bootpri);
+                               _stprintf (bootpri_str, _T("%d"), ci->bootpri);
                        }
                        if (!mi.ismedia) {
                                _tcscpy (blocksize_str, _T("n/a"));
                                _tcscpy (size_str, _T("n/a"));
                        }
-                       WIN32GUI_LoadUIString (uci->readonly ? IDS_NO : IDS_YES, readwrite_str, sizeof (readwrite_str) / sizeof (TCHAR));
+                       if (rootdir == NULL || rootdir[0] == 0)
+                               rootdir = _T("-");
+                       WIN32GUI_LoadUIString (ci->readonly ? IDS_NO : IDS_YES, readwrite_str, sizeof (readwrite_str) / sizeof (TCHAR));
 
                        lvstruct.mask     = LVIF_TEXT | LVIF_PARAM;
-                       lvstruct.pszText  = mi.ismedia == 0 ? _T("E") : (nosize ? _T("X") : (mi.ismounted ? _T("*") : _T(" ")));
-                       if (uci->controller)
+                       lvstruct.pszText  = mi.ismedia == false ? _T("E") : (nosize ? _T("X") : (mi.ismounted ? _T("*") : _T(" ")));
+                       if (ci->controller && mi.ismedia)
                                lvstruct.pszText = _T(" ");
                        lvstruct.lParam   = 0;
                        lvstruct.iItem    = i;
@@ -5094,7 +5099,7 @@ static struct amigamodels amodels[] = {
        { 4, IDS_QS_MODEL_A600 }, // "Amiga 600"
        { 4, IDS_QS_MODEL_A1000 }, // "Amiga 1000"
        { 4, IDS_QS_MODEL_A1200 }, // "Amiga 1200"
-       { 1, IDS_QS_MODEL_A3000 }, // "Amiga 3000"
+       { 2, IDS_QS_MODEL_A3000 }, // "Amiga 3000"
        { 1, IDS_QS_MODEL_A4000 }, // "Amiga 4000"
        { 0, }, //{ 1, IDS_QS_MODEL_A4000T }, // "Amiga 4000T"
        { 3, IDS_QS_MODEL_CD32 }, // "CD32"
@@ -5746,6 +5751,16 @@ static int display_mode_index (uae_u32 x, uae_u32 y, uae_u32 d)
                        break;
                j++;
        }
+       if (x == 0 && y == 0) {
+               j = 0;
+               for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
+                       if (md->DisplayModes[i].res.width == md->rect.right - md->rect.left &&
+                               md->DisplayModes[i].res.height == md->rect.bottom - md->rect.top &&
+                               md->DisplayModes[i].depth == d)
+                               break;
+                       j++;
+               }
+       }
        if(md->DisplayModes[i].depth < 0)
                j = -1;
        return j;
@@ -5791,7 +5806,6 @@ static void update_da (HWND hDlg)
        init_colors ();
        init_custom ();
        updatedisplayarea ();
-       WIN32GFX_WindowMove ();
 }
 
 static void handle_da (HWND hDlg)
@@ -5865,11 +5879,16 @@ static void init_display_mode (HWND hDlg)
                d = d / 8;
        }
 
-       index = display_mode_index (workprefs.gfx_size_fs.width, workprefs.gfx_size_fs.height, d);
-       if (index >= 0)
-               SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_SETCURSEL, md->DisplayModes[index].residx, 0);
-       else
-               index = 0;
+       if (workprefs.gfx_size_fs.special == WH_NATIVE) {
+               int cnt = (int)SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_GETCOUNT, 0, 0);
+               SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_SETCURSEL, cnt - 1, 0);
+               index = display_mode_index (workprefs.gfx_size_fs.width, workprefs.gfx_size_fs.height, d);
+       } else {
+               index = display_mode_index (workprefs.gfx_size_fs.width, workprefs.gfx_size_fs.height, d);
+               if (index >= 0)
+                       SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_SETCURSEL, md->DisplayModes[index].residx, 0);
+               workprefs.gfx_size_fs.special = 0;
+       }
        SendDlgItemMessage(hDlg, IDC_RESOLUTIONDEPTH, CB_RESETCONTENT, 0, 0);
        cnt = 0;
        gui_display_depths[0] = gui_display_depths[1] = gui_display_depths[2] = -1;
@@ -6104,6 +6123,7 @@ static void init_resolution_combo (HWND hDlg)
                        idx = md->DisplayModes[i].residx;
                }
        }
+       SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, 0, (LPARAM)_T("Native"));
 }
 
 static void init_displays_combo (HWND hDlg, bool rtg)
@@ -6284,15 +6304,29 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
        workprefs.gfx_autoresolution = ischecked (hDlg, IDC_AUTORESOLUTION);
 
        int dmode = -1;
+       bool native = false;
        struct MultiDisplay *md = getdisplay (&workprefs);
        LRESULT posn1 = SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_GETCURSEL, 0, 0);
        LRESULT posn2 = SendDlgItemMessage (hDlg, IDC_RESOLUTIONDEPTH, CB_GETCURSEL, 0, 0);
        if (posn1 != CB_ERR && posn2 != CB_ERR) {
+               workprefs.gfx_size_fs.special = 0;
                for (dmode = 0; md->DisplayModes[dmode].depth >= 0; dmode++) {
                        if (md->DisplayModes[dmode].residx == posn1)
                                break;
                }
-               if (md->DisplayModes[dmode].depth > 0) {
+               if (md->DisplayModes[dmode].depth <= 0) {
+                       for (dmode = 0; md->DisplayModes[dmode].depth >= 0; dmode++) {
+                               if (md->DisplayModes[dmode].res.width == md->rect.right - md->rect.left &&
+                                       md->DisplayModes[dmode].res.height == md->rect.bottom - md->rect.top &&
+                                       md->DisplayModes[dmode].depth == gui_display_depths[posn2])
+                                       {
+                                               workprefs.gfx_size_fs.special = WH_NATIVE;
+                                               break;
+                               }
+                       }
+                       if (md->DisplayModes[dmode].depth <= 0)
+                               dmode = -1;
+               } else {
                        i = dmode;
                        while (md->DisplayModes[dmode].residx == posn1) {
                                if (md->DisplayModes[dmode].depth == gui_display_depths[posn2])
@@ -6582,13 +6616,16 @@ static void values_to_chipsetdlg2 (HWND hDlg)
        switch(workprefs.cs_rtc)
        {
        case 0:
-               CheckRadioButton(hDlg, IDC_CS_RTC1, IDC_CS_RTC3, IDC_CS_RTC1);
+               CheckRadioButton(hDlg, IDC_CS_RTC1, IDC_CS_RTC4, IDC_CS_RTC1);
                break;
        case 1:
-               CheckRadioButton(hDlg, IDC_CS_RTC1, IDC_CS_RTC3, IDC_CS_RTC2);
+               CheckRadioButton(hDlg, IDC_CS_RTC1, IDC_CS_RTC4, IDC_CS_RTC2);
                break;
        case 2:
-               CheckRadioButton(hDlg, IDC_CS_RTC1, IDC_CS_RTC3, IDC_CS_RTC3);
+               CheckRadioButton(hDlg, IDC_CS_RTC1, IDC_CS_RTC4, IDC_CS_RTC3);
+               break;
+       case 3:
+               CheckRadioButton(hDlg, IDC_CS_RTC1, IDC_CS_RTC4, IDC_CS_RTC4);
                break;
        }
        CheckDlgButton (hDlg, IDC_CS_COMPATIBLE, workprefs.cs_compatible);
@@ -6700,7 +6737,7 @@ static void values_from_chipsetdlg2 (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
        workprefs.cs_ciaatod = ischecked (hDlg, IDC_CS_CIAA_TOD1) ? 0
                : (ischecked (hDlg, IDC_CS_CIAA_TOD2) ? 1 : 2);
        workprefs.cs_rtc = ischecked (hDlg, IDC_CS_RTC1) ? 0
-               : (ischecked (hDlg, IDC_CS_RTC2) ? 1 : 2);
+               : ischecked (hDlg, IDC_CS_RTC2) ? 1 : ischecked (hDlg, IDC_CS_RTC3) ? 2 : 3;
 
        if (workprefs.cs_rtc) {
                txt[0] = 0;
@@ -6781,6 +6818,7 @@ static void enable_for_chipsetdlg2 (HWND hDlg)
        ew (hDlg, IDC_CS_RTC1, e);
        ew (hDlg, IDC_CS_RTC2, e);
        ew (hDlg, IDC_CS_RTC3, e);
+       ew (hDlg, IDC_CS_RTC4, e);
        ew (hDlg, IDC_CS_RTCADJUST, e);
 }
 
@@ -6846,6 +6884,7 @@ static void enable_for_memorydlg (HWND hDlg)
        ew (hDlg, IDC_RTG_32BIT, rtg);
        ew (hDlg, IDC_RTG_MATCH_DEPTH, rtg2);
        ew (hDlg, IDC_RTG_SCALE, rtg2);
+       ew (hDlg, IDC_RTG_CENTER, rtg2);
        ew (hDlg, IDC_RTG_SCALE_ALLOW, rtg2);
        ew (hDlg, IDC_RTG_SCALE_ASPECTRATIO, rtg2);
        ew (hDlg, IDC_RTG_VBLANKRATE, rtg2);
@@ -7069,7 +7108,8 @@ static void values_to_memorydlg (HWND hDlg)
        }
 
 
-       CheckDlgButton (hDlg, IDC_RTG_SCALE, workprefs.win32_rtgscaleifsmall);
+       CheckDlgButton (hDlg, IDC_RTG_SCALE, workprefs.win32_rtgscalemode == RTG_MODE_SCALE);
+       CheckDlgButton (hDlg, IDC_RTG_CENTER, workprefs.win32_rtgscalemode == RTG_MODE_CENTER);
        CheckDlgButton (hDlg, IDC_RTG_SCALE_ALLOW, workprefs.win32_rtgallowscaling);
        CheckDlgButton (hDlg, IDC_RTG_MATCH_DEPTH, workprefs.win32_rtgmatchdepth);
        CheckDlgButton (hDlg, IDC_RTG_VBINTERRUPT, workprefs.rtg_hardwareinterrupt);
@@ -7322,7 +7362,12 @@ static INT_PTR CALLBACK ExpansionDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP
                                workprefs.win32_rtgmatchdepth = ischecked (hDlg, IDC_RTG_MATCH_DEPTH);
                                break;
                        case IDC_RTG_SCALE:
-                               workprefs.win32_rtgscaleifsmall = ischecked (hDlg, IDC_RTG_SCALE);
+                               workprefs.win32_rtgscalemode = ischecked (hDlg, IDC_RTG_SCALE) ? RTG_MODE_SCALE : 0;
+                               setchecked (hDlg, IDC_RTG_CENTER,  false);
+                               break;
+                       case IDC_RTG_CENTER:
+                               workprefs.win32_rtgscalemode = ischecked (hDlg, IDC_RTG_CENTER) ? RTG_MODE_CENTER : 0;
+                               setchecked (hDlg, IDC_RTG_SCALE,  false);
                                break;
                        case IDC_RTG_SCALE_ALLOW:
                                workprefs.win32_rtgallowscaling = ischecked (hDlg, IDC_RTG_SCALE_ALLOW);
@@ -8319,7 +8364,7 @@ static void enable_for_cpudlg (HWND hDlg)
 
        cpu_based_enable = workprefs.cpu_model >= 68020 && workprefs.address_space_24 == 0;
 
-       jitenable = cpu_based_enable;
+       jitenable = cpu_based_enable && !workprefs.mmu_model;
 #ifndef JIT
        jitenable = FALSE;
 #endif
@@ -8345,7 +8390,7 @@ static void enable_for_cpudlg (HWND hDlg)
        ew (hDlg, IDC_FPU1, workprefs.cpu_model < 68040 && (workprefs.cpu_model >= 68020 || !workprefs.cpu_compatible));
        ew (hDlg, IDC_FPU2, workprefs.cpu_model < 68040 && (workprefs.cpu_model >= 68020 || !workprefs.cpu_compatible));
        ew (hDlg, IDC_FPU3, workprefs.cpu_model >= 68040);
-       ew (hDlg, IDC_MMUENABLE, workprefs.cpu_model == 68040 && workprefs.cachesize == 0);
+       ew (hDlg, IDC_MMUENABLE, workprefs.cpu_model >= 68030 && workprefs.cachesize == 0);
 
        SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETRANGE, TRUE, workprefs.m68k_speed < 0 ? MAKELONG (-9, 0) : MAKELONG (-9, 50));
        SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETPAGESIZE, 0, 1);
@@ -8393,7 +8438,11 @@ static void values_to_cpudlg (HWND hDlg)
        CheckDlgButton (hDlg, IDC_HARDFLUSH, workprefs.comp_hardflush);
        CheckDlgButton (hDlg, IDC_CONSTJUMP, workprefs.comp_constjump);
        CheckDlgButton (hDlg, IDC_JITENABLE, workprefs.cachesize > 0);
-       CheckDlgButton (hDlg, IDC_MMUENABLE, workprefs.cpu_model == 68040 && workprefs.cachesize == 0 && workprefs.mmu_model == 68040);
+       CheckDlgButton (hDlg, IDC_MMUENABLE,
+               ((workprefs.cpu_model == 68060 && workprefs.mmu_model == 68060) ||
+               (workprefs.cpu_model == 68040 && workprefs.mmu_model == 68040) ||
+               (workprefs.cpu_model == 68030 && workprefs.mmu_model == 68030)) &&
+               workprefs.cachesize == 0);
 
        if (workprefs.cpu_cycle_exact) {
                if (workprefs.cpu_clock_multiplier) {
@@ -8419,7 +8468,6 @@ static void values_from_cpudlg (HWND hDlg)
        workprefs.m68k_speed_throttle = SendMessage (GetDlgItem (hDlg, IDC_SPEED), TBM_GETPOS, 0, 0) * 100;
        if (workprefs.m68k_speed_throttle > 0 && workprefs.m68k_speed < 0)
                workprefs.m68k_speed_throttle = 0;
-       workprefs.mmu_model = ischecked (hDlg, IDC_MMUENABLE) ? 68040 : 0;
 
        newcpu = ischecked (hDlg, IDC_CPU0) ? 68000
                : ischecked (hDlg, IDC_CPU1) ? 68010
@@ -8436,6 +8484,7 @@ static void values_from_cpudlg (HWND hDlg)
        if (workprefs.cpu_model != newcpu && newcpu <= 68010)
                newfpu = 0;
        workprefs.cpu_model = newcpu;
+       workprefs.mmu_model = 0;
        switch(newcpu)
        {
        case 68000:
@@ -8453,16 +8502,19 @@ static void values_from_cpudlg (HWND hDlg)
        case 68030:
                workprefs.address_space_24 = 0;
                workprefs.fpu_model = newfpu == 0 ? 0 : (newfpu == 2 ? 68882 : 68881);
+               workprefs.mmu_model = ischecked (hDlg, IDC_MMUENABLE) ? 68030 : 0;
                break;
        case 68040:
                workprefs.fpu_model = newfpu ? 68040 : 0;
                workprefs.address_space_24 = 0;
                if (workprefs.fpu_model)
                        workprefs.fpu_model = 68040;
+               workprefs.mmu_model = ischecked (hDlg, IDC_MMUENABLE) ? 68040 : 0;
                break;
        case 68060:
                workprefs.fpu_model = newfpu ? 68060 : 0;
                workprefs.address_space_24 = 0;
+               workprefs.mmu_model = ischecked (hDlg, IDC_MMUENABLE) ? 68060 : 0;
                break;
        }
 
@@ -9091,46 +9143,40 @@ static INT_PTR CALLBACK SoundDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
 
 struct fsvdlg_vals
 {
-       TCHAR volume[MAX_DPATH];
-       TCHAR device[MAX_DPATH];
-       TCHAR rootdir[MAX_DPATH];
-       int bootpri;
-       int autoboot;
-       int donotmount;
-       int rw;
+       struct uaedev_config_info ci;
        int rdb;
 };
-
-static struct fsvdlg_vals empty_fsvdlg = { _T(""), _T(""), _T(""), 0, 1, 1, 1, 0 };
-static struct fsvdlg_vals current_fsvdlg;
-
 struct hfdlg_vals
 {
-       TCHAR devicename[MAX_DPATH];
-       TCHAR filename[MAX_DPATH];
-       TCHAR fsfilename[MAX_DPATH];
-       int sectors;
-       int reserved;
-       int surfaces;
-       int cylinders, forcedcylinders;
-       int blocksize;
-       bool rw;
-       bool rdb;
-       int bootpri;
-       bool donotmount;
-       bool autoboot;
-       int controller;
+       struct uaedev_config_info ci;
        bool original;
+       uae_u64 size;
+       uae_u32 dostype;
+       int forcedcylinders;
+       bool rdb;
 };
 
-static struct hfdlg_vals empty_hfdlg = { _T(""), _T(""), _T(""), 32, 2, 1, 0, 0, 512, 1, 0, 0, 0, 1, 0, 1 };
+static struct fsvdlg_vals current_fsvdlg;
 static struct hfdlg_vals current_hfdlg;
 static int archivehd;
 
+static void default_fsvdlg (struct fsvdlg_vals *f)
+{
+       memset (f, 0, sizeof (struct fsvdlg_vals));
+       f->ci.autoboot = true;
+}
+static void default_hfdlg (struct hfdlg_vals *f, bool rdb)
+{
+       memset (f, 0, sizeof (struct hfdlg_vals));
+       uci_set_defaults (&f->ci, rdb);
+       f->original = true;
+}
+
+
 static void volumeselectfile (HWND hDlg)
 {
        TCHAR directory_path[MAX_DPATH];
-       _tcscpy (directory_path, current_fsvdlg.rootdir);
+       _tcscpy (directory_path, current_fsvdlg.ci.rootdir);
        if (directory_path[0] == 0) {
                int out = sizeof directory_path / sizeof (TCHAR);
                regquerystr (NULL, _T("FilesystemFilePath"), directory_path, &out);
@@ -9158,7 +9204,7 @@ static void volumeselectdir (HWND hDlg, int newdir)
        TCHAR szTitle[MAX_DPATH];
        TCHAR directory_path[MAX_DPATH];
 
-       _tcscpy (directory_path, current_fsvdlg.rootdir);
+       _tcscpy (directory_path, current_fsvdlg.ci.rootdir);
        if (!newdir) {
                if (directory_path[0] == 0) {
                        int out = sizeof directory_path / sizeof (TCHAR);
@@ -9185,21 +9231,21 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam,
        case WM_INITDIALOG:
                {
                        archivehd = -1;
-                       if (my_existsfile (current_fsvdlg.rootdir))
+                       if (my_existsfile (current_fsvdlg.ci.rootdir))
                                archivehd = 1;
-                       else if (my_existsdir (current_fsvdlg.rootdir))
+                       else if (my_existsdir (current_fsvdlg.ci.rootdir))
                                archivehd = 0;
                        recursive++;
                        setac (hDlg, IDC_PATH_NAME);
-                       SetDlgItemText (hDlg, IDC_VOLUME_NAME, current_fsvdlg.volume);
-                       SetDlgItemText (hDlg, IDC_VOLUME_DEVICE, current_fsvdlg.device);
-                       SetDlgItemText (hDlg, IDC_PATH_NAME, current_fsvdlg.rootdir);
-                       SetDlgItemInt (hDlg, IDC_VOLUME_BOOTPRI, current_fsvdlg.bootpri >= -127 ? current_fsvdlg.bootpri : -127, TRUE);
+                       SetDlgItemText (hDlg, IDC_VOLUME_NAME, current_fsvdlg.ci.volname);
+                       SetDlgItemText (hDlg, IDC_VOLUME_DEVICE, current_fsvdlg.ci.devname);
+                       SetDlgItemText (hDlg, IDC_PATH_NAME, current_fsvdlg.ci.rootdir);
+                       SetDlgItemInt (hDlg, IDC_VOLUME_BOOTPRI, current_fsvdlg.ci.bootpri >= -127 ? current_fsvdlg.ci.bootpri : -127, TRUE);
                        if (archivehd > 0)
-                               current_fsvdlg.rw = 0;
-                       CheckDlgButton (hDlg, IDC_FS_RW, current_fsvdlg.rw);
-                       CheckDlgButton (hDlg, IDC_FS_AUTOBOOT, current_fsvdlg.autoboot);
-                       current_fsvdlg.donotmount = 0;
+                               current_fsvdlg.ci.readonly = true;
+                       CheckDlgButton (hDlg, IDC_FS_RW, !current_fsvdlg.ci.readonly);
+                       CheckDlgButton (hDlg, IDC_FS_AUTOBOOT, current_fsvdlg.ci.autoboot);
+                       current_fsvdlg.ci.donotmount = 0;
                        ew (hDlg, IDC_FS_RW, archivehd <= 0);
                        recursive--;
                }
@@ -9209,14 +9255,14 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam,
                if (GetDlgCtrlID ((HWND)wParam) == IDC_FS_SELECT_FILE) {
                        TCHAR *s = favoritepopup (hDlg);
                        if (s) {
-                               _tcscpy (current_fsvdlg.rootdir, s);
+                               _tcscpy (current_fsvdlg.ci.rootdir, s);
                                xfree (s);
                                volumeselectfile (hDlg);
                        }
                } else if (GetDlgCtrlID ((HWND)wParam) == IDC_FS_SELECT_DIR) {
                        TCHAR *s = favoritepopup (hDlg);
                        if (s) {
-                               _tcscpy (current_fsvdlg.rootdir, s);
+                               _tcscpy (current_fsvdlg.ci.rootdir, s);
                                xfree (s);
                                volumeselectdir (hDlg, 1);
                        }
@@ -9251,12 +9297,12 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam,
                                break;
                        }
                }
-               GetDlgItemText (hDlg, IDC_PATH_NAME, current_fsvdlg.rootdir, sizeof current_fsvdlg.rootdir / sizeof (TCHAR));
-               GetDlgItemText (hDlg, IDC_VOLUME_NAME, current_fsvdlg.volume, sizeof current_fsvdlg.volume / sizeof (TCHAR));
-               GetDlgItemText (hDlg, IDC_VOLUME_DEVICE, current_fsvdlg.device, sizeof current_fsvdlg.device / sizeof (TCHAR));
-               current_fsvdlg.rw = ischecked (hDlg, IDC_FS_RW);
-               current_fsvdlg.bootpri = GetDlgItemInt (hDlg, IDC_VOLUME_BOOTPRI, NULL, TRUE);
-               current_fsvdlg.autoboot = ischecked (hDlg, IDC_FS_AUTOBOOT);
+               GetDlgItemText (hDlg, IDC_PATH_NAME, current_fsvdlg.ci.rootdir, sizeof current_fsvdlg.ci.rootdir / sizeof (TCHAR));
+               GetDlgItemText (hDlg, IDC_VOLUME_NAME, current_fsvdlg.ci.volname, sizeof current_fsvdlg.ci.volname / sizeof (TCHAR));
+               GetDlgItemText (hDlg, IDC_VOLUME_DEVICE, current_fsvdlg.ci.devname, sizeof current_fsvdlg.ci.devname / sizeof (TCHAR));
+               current_fsvdlg.ci.readonly = !ischecked (hDlg, IDC_FS_RW);
+               current_fsvdlg.ci.bootpri = GetDlgItemInt (hDlg, IDC_VOLUME_BOOTPRI, NULL, TRUE);
+               current_fsvdlg.ci.autoboot = ischecked (hDlg, IDC_FS_AUTOBOOT);
                recursive--;
                break;
        }
@@ -9265,28 +9311,28 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam,
 
 STATIC_INLINE int is_hdf_rdb (void)
 {
-       return current_hfdlg.sectors == 0 && current_hfdlg.surfaces == 0 && current_hfdlg.reserved == 0;
+       return current_hfdlg.ci.sectors == 0 && current_hfdlg.ci.surfaces == 0 && current_hfdlg.ci.reserved == 0;
 }
 
 static void sethardfile (HWND hDlg)
 {
        int rdb = is_hdf_rdb ();
 
-       SetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename);
-       SetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.fsfilename);
-       SetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.devicename);
-       SetDlgItemInt (hDlg, IDC_SECTORS, current_hfdlg.sectors, FALSE);
-       SetDlgItemInt (hDlg, IDC_HEADS, current_hfdlg.surfaces, FALSE);
-       SetDlgItemInt (hDlg, IDC_RESERVED, current_hfdlg.reserved, FALSE);
-       SetDlgItemInt (hDlg, IDC_BLOCKSIZE, current_hfdlg.blocksize, FALSE);
-       SetDlgItemInt (hDlg, IDC_HARDFILE_BOOTPRI, current_hfdlg.bootpri >= -127 ? current_hfdlg.bootpri : -127, TRUE);
-       CheckDlgButton (hDlg, IDC_HDF_RW, current_hfdlg.rw);
-       CheckDlgButton (hDlg, IDC_HDF_AUTOBOOT, current_hfdlg.autoboot);
-       CheckDlgButton (hDlg, IDC_HDF_DONOTMOUNT, current_hfdlg.donotmount);
+       SetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.ci.rootdir);
+       SetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.ci.filesys);
+       SetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.ci.devname);
+       SetDlgItemInt (hDlg, IDC_SECTORS, current_hfdlg.ci.sectors, FALSE);
+       SetDlgItemInt (hDlg, IDC_HEADS, current_hfdlg.ci.surfaces, FALSE);
+       SetDlgItemInt (hDlg, IDC_RESERVED, current_hfdlg.ci.reserved, FALSE);
+       SetDlgItemInt (hDlg, IDC_BLOCKSIZE, current_hfdlg.ci.blocksize, FALSE);
+       SetDlgItemInt (hDlg, IDC_HARDFILE_BOOTPRI, current_hfdlg.ci.bootpri >= -127 ? current_hfdlg.ci.bootpri : -127, TRUE);
+       CheckDlgButton (hDlg, IDC_HDF_RW, !current_hfdlg.ci.readonly);
+       CheckDlgButton (hDlg, IDC_HDF_AUTOBOOT, current_hfdlg.ci.autoboot);
+       CheckDlgButton (hDlg, IDC_HDF_DONOTMOUNT, current_hfdlg.ci.donotmount);
        ew (hDlg, IDC_HDF_RDB, !rdb);
        ew (hDlg, IDC_HDF_AUTOBOOT, TRUE);
        ew (hDlg, IDC_HDF_DONOTMOUNT, TRUE);
-       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_hfdlg.controller, 0);
+       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_hfdlg.ci.controller, 0);
 }
 
 static void inithdcontroller (HWND hDlg)
@@ -9347,35 +9393,37 @@ static void sethfdostype (HWND hDlg, int idx)
 
 static void hardfile_testrdb (HWND hDlg, struct hfdlg_vals *hdf)
 {
-       struct zfile *f = zfile_fopen (hdf->filename, _T("rb"), ZFD_NORMAL);
-       uae_u8 tmp[8];
+       uae_u8 id[512];
        int i;
-
-       if (!f)
-               return;
-       for (i = 0; i < 16; i++) {
-               zfile_fseek (f, i * 512, SEEK_SET);
-               memset (tmp, 0, sizeof tmp);
-               zfile_fread (tmp, 1, sizeof tmp, f);
-               if (i == 0 && !memcmp (tmp + 2, "CIS", 3)) {
-                       hdf->controller = HD_CONTROLLER_PCMCIA_SRAM;
-                       break;
-               }
-               if (!memcmp (tmp, "RDSK\0\0\0", 7) || !memcmp (tmp, "DRKS\0\0", 6) || (tmp[0] == 0x53 && tmp[1] == 0x10 && tmp[2] == 0x9b && tmp[3] == 0x13 && tmp[4] == 0 && tmp[5] == 0)) {
-                       // RDSK or ADIDE "encoded" RDSK
-                       hdf->cylinders = hdf->forcedcylinders = 0;
-                       hdf->sectors = 0;
-                       hdf->surfaces = 0;
-                       hdf->reserved = 0;
-                       hdf->fsfilename[0] = 0;
-                       hdf->bootpri = 0;
-                       hdf->autoboot = 1;
-                       hdf->donotmount = 0;
-                       hdf->devicename[0] = 0;
-                       break;
+       struct hardfiledata hfd;
+
+       memset (id, 0, sizeof id);
+       memset (&hfd, 0, sizeof hfd);
+       hfd.ci.readonly = true;
+       hfd.ci.blocksize = 512;
+       if (hdf_open (&hfd, current_hfdlg.ci.rootdir)) {
+               for (i = 0; i < 16; i++) {
+                       hdf_read_rdb (&hfd, id, i * 512, 512);
+                       if (i == 0 && !memcmp (id + 2, "CIS", 3)) {
+                               hdf->ci.controller = HD_CONTROLLER_PCMCIA_SRAM;
+                               break;
+                       }
+                       if (!memcmp (id, "RDSK\0\0\0", 7) || !memcmp (id, "DRKS\0\0", 6) || (id[0] == 0x53 && id[1] == 0x10 && id[2] == 0x9b && id[3] == 0x13 && id[4] == 0 && id[5] == 0)) {
+                               // RDSK or ADIDE "encoded" RDSK
+                               hdf->ci.cyls = hdf->ci.highcyl = hdf->forcedcylinders = 0;
+                               hdf->ci.sectors = 0;
+                               hdf->ci.surfaces = 0;
+                               hdf->ci.reserved = 0;
+                               hdf->ci.filesys[0] = 0;
+                               hdf->ci.bootpri = 0;
+                               hdf->ci.autoboot = 1;
+                               hdf->ci.donotmount = 0;
+                               hdf->ci.devname[0] = 0;
+                               break;
+                       }
                }
+               hdf_close (&hfd);
        }
-       zfile_fclose (f);
        sethardfile (hDlg);
 }
 
@@ -9394,30 +9442,34 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
                struct hardfiledata hfd;
                memset (id, 0, sizeof id);
                memset (&hfd, 0, sizeof hfd);
-               hfd.readonly = 1;
-               hfd.blocksize = 512;
-               if (hdf_open (&hfd, current_hfdlg.filename)) {
+               hfd.ci.readonly = true;
+               hfd.ci.blocksize = 512;
+               current_hfdlg.size = 0;
+               current_hfdlg.dostype = 0;
+               if (hdf_open (&hfd, current_hfdlg.ci.rootdir)) {
                        open = true;
                        for (i = 0; i < 16; i++) {
                                hdf_read (&hfd, id, i * 512, 512);
                                bsize = hfd.virtsize;
+                               current_hfdlg.size = hfd.virtsize;
                                if (!memcmp (id, "RDSK", 4))
                                        break;
                        }
                        if (i == 16)
                                hdf_read (&hfd, id, 0, 512);
+                       current_hfdlg.dostype = (id[0] << 24) | (id[1] << 16) | (id[2] << 8) | (id[3] << 0);
                }
                if (defaults) {
                        if (hfd.flags & HFD_FLAGS_REALDRIVE) {
-                               if (current_hfdlg.controller >= HD_CONTROLLER_IDE0 && current_hfdlg.controller <= HD_CONTROLLER_IDE3) {
-                                       getchspgeometry (bsize, &current_hfdlg.cylinders, &current_hfdlg.surfaces, &current_hfdlg.sectors, true);
+                               if (current_hfdlg.ci.controller >= HD_CONTROLLER_IDE0 && current_hfdlg.ci.controller <= HD_CONTROLLER_IDE3) {
+                                       getchspgeometry (bsize, &current_hfdlg.ci.highcyl, &current_hfdlg.ci.surfaces, &current_hfdlg.ci.sectors, true);
                                        if (current_hfdlg.forcedcylinders == 0)
-                                               current_hfdlg.forcedcylinders = current_hfdlg.cylinders;
+                                               current_hfdlg.forcedcylinders = current_hfdlg.ci.highcyl;
                                } else {
-                                       getchspgeometry (bsize, &current_hfdlg.cylinders, &current_hfdlg.surfaces, &current_hfdlg.sectors, false);
+                                       getchspgeometry (bsize, &current_hfdlg.ci.highcyl, &current_hfdlg.ci.surfaces, &current_hfdlg.ci.sectors, false);
                                }
-                       } else if (current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces) {
-                               getchsgeometry_hdf (open ? &hfd : NULL, bsize, &current_hfdlg.cylinders, &current_hfdlg.surfaces, &current_hfdlg.sectors);
+                       } else if (current_hfdlg.ci.blocksize * current_hfdlg.ci.sectors * current_hfdlg.ci.surfaces) {
+                               getchsgeometry_hdf (open ? &hfd : NULL, bsize, &current_hfdlg.ci.cyls, &current_hfdlg.ci.surfaces, &current_hfdlg.ci.sectors);
                                current_hfdlg.original = 0;
                        }
                }
@@ -9425,12 +9477,12 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
        }
 
        cyls = current_hfdlg.forcedcylinders;
-       if (!cyls && current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces) {
-               cyls = bsize / (current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces);
+       if (!cyls && current_hfdlg.ci.blocksize * current_hfdlg.ci.sectors * current_hfdlg.ci.surfaces) {
+               cyls = bsize / (current_hfdlg.ci.blocksize * current_hfdlg.ci.sectors * current_hfdlg.ci.surfaces);
        }
-       blocks = cyls * (current_hfdlg.sectors * current_hfdlg.surfaces);
-       if (!blocks && current_hfdlg.blocksize)
-               blocks = bsize / current_hfdlg.blocksize;
+       blocks = cyls * (current_hfdlg.ci.sectors * current_hfdlg.ci.surfaces);
+       if (!blocks && current_hfdlg.ci.blocksize)
+               blocks = bsize / current_hfdlg.ci.blocksize;
        for (i = 0; i < sizeof (idtmp) / sizeof (TCHAR) - 1; i++) {
                TCHAR c = id[i];
                if (c < 32 || c > 126)
@@ -9452,9 +9504,9 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
                                (double)bsize / (1024.0 * 1024.0));             
                } else {
                        _stprintf (tmp, _T("%u/%u/%u, %u/%u blocks, %.1fMB/%.1fMB"),
-                               cyls, current_hfdlg.surfaces, current_hfdlg.sectors,
-                               blocks, (int)(bsize / 512),
-                               (double)blocks * 1.0 * current_hfdlg.blocksize / (1024.0 * 1024.0),
+                               cyls, current_hfdlg.ci.surfaces, current_hfdlg.ci.sectors,
+                               blocks, (int)(bsize / current_hfdlg.ci.blocksize),
+                               (double)blocks * 1.0 * current_hfdlg.ci.blocksize / (1024.0 * 1024.0),
                                (double)bsize / (1024.0 * 1024.0));
                        if (cyls > 65535) {
                                _tcscat (tmp2, _T(" [Too many cyls]"));
@@ -9470,11 +9522,13 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
 static void hardfileselecthdf (HWND hDlg, TCHAR *newpath)
 {
        DiskSelection (hDlg, IDC_PATH_NAME, 2, &workprefs, newpath);
-       GetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename, sizeof current_hfdlg.filename / sizeof (TCHAR));
-       fullpath (current_hfdlg.filename, sizeof current_hfdlg.filename / sizeof (TCHAR));
+       GetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.ci.rootdir, sizeof current_hfdlg.ci.rootdir / sizeof (TCHAR));
+       fullpath (current_hfdlg.ci.rootdir, sizeof current_hfdlg.ci.rootdir / sizeof (TCHAR));
        inithardfile (hDlg);
        hardfile_testrdb (hDlg, &current_hfdlg);
        updatehdfinfo (hDlg, true, true);
+       get_hd_geometry (&current_hfdlg.ci);
+       updatehdfinfo (hDlg, false, false);
        sethardfile (hDlg);
 }
 
@@ -9489,8 +9543,8 @@ static void hardfilecreatehdf (HWND hDlg, TCHAR *newpath)
        if (res == 0)
                dostype[0] = 0;
        if (CreateHardFile (hDlg, setting, dostype, newpath, hdfpath)) {
-               if (!current_hfdlg.filename[0])
-                       _tcscpy (current_hfdlg.filename, hdfpath);
+               if (!current_hfdlg.ci.rootdir[0])
+                       _tcscpy (current_hfdlg.ci.rootdir, hdfpath);
        }
        sethardfile (hDlg);
 }
@@ -9563,27 +9617,56 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                        ew (hDlg, IDC_HF_DOSTYPE, res >= 4);
                        break;
                case IDC_HF_CREATE:
-                       _tcscpy (fs, current_hfdlg.fsfilename);
-                       current_hfdlg = empty_hfdlg;
-                       _tcscpy (current_hfdlg.fsfilename, fs);
+                       _tcscpy (fs, current_hfdlg.ci.filesys);
+                       default_hfdlg (&current_hfdlg, false);
+                       _tcscpy (current_hfdlg.ci.filesys, fs);
                        hardfilecreatehdf (hDlg, NULL);
                        break;
                case IDC_SELECTOR:
-                       _tcscpy (fs, current_hfdlg.fsfilename);
-                       _tcscpy (dev, current_hfdlg.devicename);
-                       hdctrlr = current_hfdlg.controller;
-                       current_hfdlg = empty_hfdlg;
-                       _tcscpy (current_hfdlg.fsfilename, fs);
-                       _tcscpy (current_hfdlg.devicename, dev);
-                       current_hfdlg.controller = hdctrlr;
-                       hardfileselecthdf (hDlg, NULL);
+                       {
+#if 0
+                               uae_u64 oldsize = current_hfdlg.size;
+                               int sectors = current_hfdlg.sectors;
+                               int reserved = current_hfdlg.reserved;
+                               int surfaces = current_hfdlg.surfaces;
+                               int cylinders = current_hfdlg.cylinders;
+                               int forcedcylinders = current_hfdlg.forcedcylinders;
+#endif
+                               _tcscpy (fs, current_hfdlg.ci.filesys);
+                               _tcscpy (dev, current_hfdlg.ci.devname);
+                               bool autoboot = current_hfdlg.ci.autoboot;
+                               bool rw = current_hfdlg.ci.readonly;
+                               bool donot = current_hfdlg.ci.donotmount;
+                               int bootpri = current_hfdlg.ci.bootpri;
+                               hdctrlr = current_hfdlg.ci.controller;
+                               default_hfdlg (&current_hfdlg, false);
+                               _tcscpy (current_hfdlg.ci.filesys, fs);
+                               _tcscpy (current_hfdlg.ci.devname, dev);
+                               current_hfdlg.ci.controller = hdctrlr;
+                               current_hfdlg.ci.bootpri = bootpri;
+                               current_hfdlg.ci.autoboot = autoboot;
+                               current_hfdlg.ci.readonly = rw;
+                               current_hfdlg.ci.donotmount = donot;
+                               hardfileselecthdf (hDlg, NULL);
+#if 0
+                               if (oldsize > 0 && oldsize == current_hfdlg.size) {
+                                       current_hfdlg.sectors = sectors;
+                                       current_hfdlg.reserved = reserved;
+                                       current_hfdlg.surfaces = surfaces;
+                                       current_hfdlg.cylinders = cylinders;
+                                       current_hfdlg.forcedcylinders = forcedcylinders;
+                                       updatehdfinfo (hDlg, true, false);
+                               }
+#endif
+                       }
                        break;
                case IDC_FILESYS_SELECTOR:
                        DiskSelection (hDlg, IDC_PATH_FILESYS, 12, &workprefs, 0);
-                       GetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.fsfilename, sizeof current_hfdlg.fsfilename / sizeof (TCHAR));
+                       GetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.ci.filesys, sizeof current_hfdlg.ci.filesys / sizeof (TCHAR));
                        break;
                case IDOK:
-                       if (_tcslen (current_hfdlg.filename) == 0) {
+#if 0
+                       if (_tcslen (current_hfdlg.ci.rootdir) == 0) {
                                TCHAR szMessage[MAX_DPATH];
                                TCHAR szTitle[MAX_DPATH];
                                WIN32GUI_LoadUIString (IDS_MUSTSELECTFILE, szMessage, MAX_DPATH);
@@ -9591,19 +9674,28 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                                MessageBox (hDlg, szMessage, szTitle, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
                                break;
                        }
+#endif
                        EndDialog (hDlg, 1);
                        break;
                case IDCANCEL:
                        EndDialog (hDlg, 0);
                        break;
                case IDC_HDF_RW:
-                       current_hfdlg.rw = ischecked (hDlg, IDC_HDF_RW);
+                       current_hfdlg.ci.readonly = !ischecked (hDlg, IDC_HDF_RW);
                        break;
                case IDC_HDF_AUTOBOOT:
-                       current_hfdlg.autoboot = ischecked (hDlg, IDC_HDF_AUTOBOOT);
+                       current_hfdlg.ci.autoboot = ischecked (hDlg, IDC_HDF_AUTOBOOT);
+                       if (current_hfdlg.ci.autoboot && current_hfdlg.ci.donotmount) {
+                               current_hfdlg.ci.donotmount = false;
+                               setchecked (hDlg, IDC_HDF_DONOTMOUNT, false);
+                       }
                        break;
                case IDC_HDF_DONOTMOUNT:
-                       current_hfdlg.donotmount = ischecked (hDlg, IDC_HDF_DONOTMOUNT);
+                       current_hfdlg.ci.donotmount = ischecked (hDlg, IDC_HDF_DONOTMOUNT);
+                       if (current_hfdlg.ci.donotmount && current_hfdlg.ci.autoboot) {
+                               current_hfdlg.ci.autoboot = false;
+                               setchecked (hDlg, IDC_HDF_AUTOBOOT, false);
+                       }
                        break;
                case IDC_HDF_RDB:
                        SetDlgItemInt (hDlg, IDC_SECTORS, 0, FALSE);
@@ -9611,51 +9703,55 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                        SetDlgItemInt (hDlg, IDC_HEADS, 0, FALSE);
                        SetDlgItemText (hDlg, IDC_PATH_FILESYS, _T(""));
                        SetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, _T(""));
-                       current_hfdlg.sectors = current_hfdlg.reserved = current_hfdlg.surfaces = 0;
-                       current_hfdlg.bootpri = 0;
-                       current_hfdlg.autoboot = 1;
-                       current_hfdlg.donotmount = 0;
+                       current_hfdlg.ci.sectors = current_hfdlg.ci.reserved = current_hfdlg.ci.surfaces = 0;
+                       current_hfdlg.ci.bootpri = 0;
+                       current_hfdlg.ci.autoboot = true;
+                       current_hfdlg.ci.donotmount = false;
                        sethardfile (hDlg);
                        break;
                case IDC_SECTORS:
-                       v = current_hfdlg.sectors;
-                       current_hfdlg.sectors   = GetDlgItemInt (hDlg, IDC_SECTORS, NULL, FALSE);
-                       if (v != current_hfdlg.sectors)
+                       v = current_hfdlg.ci.sectors;
+                       current_hfdlg.ci.sectors = GetDlgItemInt (hDlg, IDC_SECTORS, NULL, FALSE);
+                       if (v != current_hfdlg.ci.sectors)
                                updatehdfinfo (hDlg, true, false);
                        break;
                case IDC_RESERVED:
-                       current_hfdlg.reserved  = GetDlgItemInt (hDlg, IDC_RESERVED, NULL, FALSE);
+                       current_hfdlg.ci.reserved = GetDlgItemInt (hDlg, IDC_RESERVED, NULL, FALSE);
                        break;
                case IDC_HEADS:
-                       v = current_hfdlg.surfaces;
-                       current_hfdlg.surfaces  = GetDlgItemInt (hDlg, IDC_HEADS, NULL, FALSE);
-                       if (v != current_hfdlg.surfaces)
+                       v = current_hfdlg.ci.surfaces;
+                       current_hfdlg.ci.surfaces  = GetDlgItemInt (hDlg, IDC_HEADS, NULL, FALSE);
+                       if (v != current_hfdlg.ci.surfaces)
                                updatehdfinfo (hDlg, true, false);
                        break;
                case IDC_BLOCKSIZE:
-                       v = current_hfdlg.blocksize;
-                       current_hfdlg.blocksize = GetDlgItemInt (hDlg, IDC_BLOCKSIZE, NULL, FALSE);
-                       if (v != current_hfdlg.blocksize)
+                       v = current_hfdlg.ci.blocksize;
+                       current_hfdlg.ci.blocksize = GetDlgItemInt (hDlg, IDC_BLOCKSIZE, NULL, FALSE);
+                       if (v != current_hfdlg.ci.blocksize)
                                updatehdfinfo (hDlg, true, false);
                        break;
                case IDC_HARDFILE_BOOTPRI:
-                       current_hfdlg.bootpri = GetDlgItemInt (hDlg, IDC_HARDFILE_BOOTPRI, NULL, TRUE);
+                       current_hfdlg.ci.bootpri = GetDlgItemInt (hDlg, IDC_HARDFILE_BOOTPRI, NULL, TRUE);
+                       if (current_hfdlg.ci.bootpri < -127)
+                               current_hfdlg.ci.bootpri = -127;
+                       if (current_hfdlg.ci.bootpri > 127)
+                               current_hfdlg.ci.bootpri = 127;
                        break;
                case IDC_PATH_FILESYS:
-                       GetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.fsfilename, sizeof current_hfdlg.fsfilename / sizeof (TCHAR));
+                       GetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.ci.filesys, sizeof current_hfdlg.ci.filesys / sizeof (TCHAR));
                        break;
                case IDC_HARDFILE_DEVICE:
-                       GetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.devicename, sizeof current_hfdlg.devicename / sizeof (TCHAR));
+                       GetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.ci.devname, sizeof current_hfdlg.ci.devname / sizeof (TCHAR));
                        break;
                case IDC_HDF_CONTROLLER:
                        posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0);
                        if (posn != CB_ERR)
-                               current_hfdlg.controller = posn;
+                               current_hfdlg.ci.controller = posn;
                        break;
                case IDC_PATH_NAME:
                        GetDlgItemText (hDlg, IDC_PATH_NAME, tmp, sizeof tmp / sizeof (TCHAR));
-                       if (_tcscmp (tmp, current_hfdlg.filename)) {
-                               _tcscpy (current_hfdlg.filename, tmp);
+                       if (_tcscmp (tmp, current_hfdlg.ci.rootdir)) {
+                               _tcscpy (current_hfdlg.ci.rootdir, tmp);
                                updatehdfinfo (hDlg, true, false);
                        }
                        break;
@@ -9683,7 +9779,7 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
                        hdf_init_target ();
                        recursive++;
                        inithdcontroller (hDlg);
-                       CheckDlgButton (hDlg, IDC_HDF_RW, current_hfdlg.rw);
+                       CheckDlgButton (hDlg, IDC_HDF_RW, !current_hfdlg.ci.readonly);
                        SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_RESETCONTENT, 0, 0);
                        ew (hDlg, IDC_HARDDRIVE_IMAGE, FALSE);
                        ew (hDlg, IDOK, FALSE);
@@ -9692,12 +9788,12 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
                        index = -1;
                        for (i = 0; i < hdf_getnumharddrives (); i++) {
                                SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_ADDSTRING, 0, (LPARAM)hdf_getnameharddrive (i, 1, NULL, NULL));
-                               if (!_tcscmp (current_hfdlg.filename, hdf_getnameharddrive (i, 0, NULL, NULL)))
+                               if (!_tcscmp (current_hfdlg.ci.rootdir, hdf_getnameharddrive (i, 0, NULL, NULL)))
                                        index = i;
                        }
                        if (index >= 0) {
                                SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_SETCURSEL, index, 0);
-                               SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_hfdlg.controller, 0);
+                               SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_hfdlg.ci.controller, 0);
                        }
                        recursive--;
                        return TRUE;
@@ -9724,7 +9820,7 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
                                if (posn != CB_ERR) {
                                        int dang = 1;
                                        hdf_getnameharddrive (posn, 1, NULL, &dang);
-                                       current_hfdlg.rw = ischecked (hDlg, IDC_HDF_RW) && !dang;
+                                       current_hfdlg.ci.readonly = (ischecked (hDlg, IDC_HDF_RW) && !dang) ? false : true;
                                }
                                break;
                        }
@@ -9737,31 +9833,31 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
                                        BOOL ena;
                                        int dang = 1;
                                        hdf_getnameharddrive (posn, 1, NULL, &dang);
-                                       _tcscpy (current_hfdlg.filename, hdf_getnameharddrive (posn, 0, NULL, &dang));
+                                       _tcscpy (current_hfdlg.ci.rootdir, hdf_getnameharddrive (posn, 0, NULL, &dang));
                                        ena = dang >= 0;
                                        ew (hDlg, IDC_HARDDRIVE_IMAGE, ena);
                                        ew (hDlg, IDOK, ena);
                                        ew (hDlg, IDC_HDF_RW, !dang);
                                        if (dang)
-                                               current_hfdlg.rw = FALSE;
-                                       current_hfdlg.blocksize = 512;
+                                               current_hfdlg.ci.readonly = true;
+                                       current_hfdlg.ci.blocksize = 512;
                                        current_hfdlg.forcedcylinders = 0;
-                                       current_hfdlg.cylinders = current_hfdlg.sectors = current_hfdlg.surfaces = 0;
+                                       current_hfdlg.ci.cyls = current_hfdlg.ci.highcyl = current_hfdlg.ci.sectors = current_hfdlg.ci.surfaces = 0;
                                        ew (hDlg, IDC_HDF_CONTROLLER, ena);
                                        SetDlgItemText (hDlg, IDC_HDFINFO, _T(""));
                                        SetDlgItemText (hDlg, IDC_HDFINFO2, _T(""));
                                        updatehdfinfo (hDlg, true, true);
-                                       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_hfdlg.controller, 0);
-                                       CheckDlgButton(hDlg, IDC_HDF_RW, current_hfdlg.rw);
-                                       _tcscpy (current_hfdlg.filename, hdf_getnameharddrive ((int)posn, 0, &current_hfdlg.blocksize, NULL));
+                                       SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_hfdlg.ci.controller, 0);
+                                       CheckDlgButton(hDlg, IDC_HDF_RW, !current_hfdlg.ci.readonly);
+                                       _tcscpy (current_hfdlg.ci.rootdir, hdf_getnameharddrive ((int)posn, 0, &current_hfdlg.ci.blocksize, NULL));
                                }
                        }
                } else if (LOWORD (wParam) == IDC_HDF_CONTROLLER) {
                        posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0);
                        if (posn != CB_ERR) {
-                               current_hfdlg.controller = posn;
+                               current_hfdlg.ci.controller = posn;
                                current_hfdlg.forcedcylinders = 0;
-                               current_hfdlg.cylinders = current_hfdlg.sectors = current_hfdlg.surfaces = 0;
+                               current_hfdlg.ci.cyls = current_hfdlg.ci.highcyl = current_hfdlg.ci.sectors = current_hfdlg.ci.surfaces = 0;
                                SetDlgItemText (hDlg, IDC_HDFINFO, _T(""));
                                SetDlgItemText (hDlg, IDC_HDFINFO2, _T(""));
                                updatehdfinfo (hDlg, true, true);
@@ -9786,14 +9882,15 @@ static int tweakbootpri (int bp, int ab, int dnm)
 
 static void new_filesys (HWND hDlg, int entry)
 {
-       struct uaedev_config_info *uci;
-       int bp = tweakbootpri (current_fsvdlg.bootpri, current_fsvdlg.autoboot, current_fsvdlg.donotmount);
-
-       uci = add_filesys_config (&workprefs, entry, current_fsvdlg.device, current_fsvdlg.volume,
-               current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, 0, bp, 0, 0, 0, 0, 0, 0);
+       struct uaedev_config_data *uci;
+       struct uaedev_config_info ci;
+       int bp = tweakbootpri (current_fsvdlg.ci.bootpri, current_fsvdlg.ci.autoboot, current_fsvdlg.ci.donotmount);
+       memcpy (&ci, &current_fsvdlg.ci, sizeof (struct uaedev_config_info));
+       ci.bootpri = bp;
+       uci = add_filesys_config (&workprefs, entry, &ci, false);
        if (uci) {
-               if (uci->rootdir[0])
-                       filesys_media_change (uci->rootdir, 1, uci);
+               if (uci->ci.rootdir[0])
+                       filesys_media_change (uci->ci.rootdir, 1, uci);
                else
                        filesys_eject (uci->configoffset);
        }
@@ -9801,30 +9898,27 @@ static void new_filesys (HWND hDlg, int entry)
 
 static void new_hardfile (HWND hDlg, int entry)
 {
-       struct uaedev_config_info *uci;
-       int bp = tweakbootpri (current_hfdlg.bootpri, current_hfdlg.autoboot, current_hfdlg.donotmount);
-
-       uci = add_filesys_config (&workprefs, entry, current_hfdlg.devicename, 0,
-               current_hfdlg.filename, ! current_hfdlg.rw,
-               0, current_hfdlg.sectors, current_hfdlg.surfaces,
-               current_hfdlg.reserved, current_hfdlg.blocksize,
-               bp, current_hfdlg.fsfilename,
-               current_hfdlg.controller, 0,
-               0, 0, 0);
-       if (uci)
-               hardfile_do_disk_change (uci, 1);
+       struct uaedev_config_data *uci;
+       struct uaedev_config_info ci;
+       int bp = tweakbootpri (current_hfdlg.ci.bootpri, current_hfdlg.ci.autoboot, current_hfdlg.ci.donotmount);
+       memcpy (&ci, &current_hfdlg.ci, sizeof (struct uaedev_config_info));
+       ci.bootpri = bp;
+       uci = add_filesys_config (&workprefs, entry, &ci, true);
+       if (uci) {
+               struct hardfiledata *hfd = get_hardfile_data (uci->configoffset);
+               hardfile_media_change (hfd, &ci, true, false);
+       }
 }
 
 static void new_harddrive (HWND hDlg, int entry)
 {
-       struct uaedev_config_info *uci;
+       struct uaedev_config_data *uci;
 
-       uci = add_filesys_config (&workprefs, entry, 0, 0,
-               current_hfdlg.filename, ! current_hfdlg.rw, 0, 0, 0,
-               0, current_hfdlg.blocksize, 0, 0, current_hfdlg.controller, 0,
-               current_hfdlg.forcedcylinders, current_hfdlg.surfaces, current_hfdlg.sectors);
-       if (uci)
-               hardfile_do_disk_change (uci, 1);
+       uci = add_filesys_config (&workprefs, entry, &current_hfdlg.ci, true);
+       if (uci) {
+               struct hardfiledata *hfd = get_hardfile_data (uci->configoffset);
+               hardfile_media_change (hfd, &current_hfdlg.ci, true, false);
+       }
 }
 
 static void harddisk_remove (HWND hDlg)
@@ -9847,7 +9941,7 @@ static void harddisk_edit (HWND hDlg)
 {
        int entry = listview_find_selected (GetDlgItem (hDlg, IDC_VOLUMELIST));
        int type;
-       struct uaedev_config_info *uci;
+       struct uaedev_config_data *uci;
        struct mountedinfo mi;
 
        if (entry < 0 || entry >= workprefs.mountitems)
@@ -9860,59 +9954,22 @@ static void harddisk_edit (HWND hDlg)
 
        if(type == FILESYS_HARDFILE || type == FILESYS_HARDFILE_RDB)
        {
-               current_hfdlg.forcedcylinders = uci->cyls;
-               current_hfdlg.sectors = uci->sectors;
-               current_hfdlg.surfaces = uci->surfaces;
-               current_hfdlg.reserved = uci->reserved;
-               current_hfdlg.cylinders = mi.nrcyls;
-               current_hfdlg.blocksize = uci->blocksize;
-               current_hfdlg.controller = uci->controller;
-
-               _tcsncpy (current_hfdlg.filename, uci->rootdir, (sizeof current_hfdlg.filename  / sizeof (TCHAR)) - 1);
-               current_hfdlg.filename[(sizeof current_hfdlg.filename / sizeof (TCHAR)) - 1] = '\0';
-               current_hfdlg.fsfilename[0] = 0;
-               if (uci->filesys) {
-                       _tcsncpy (current_hfdlg.fsfilename, uci->filesys, (sizeof current_hfdlg.fsfilename / sizeof (TCHAR)) - 1);
-                       current_hfdlg.fsfilename[(sizeof current_hfdlg.fsfilename / sizeof (TCHAR)) - 1] = '\0';
-               }
-               current_fsvdlg.device[0] = 0;
-               if (uci->devname) {
-                       _tcsncpy (current_hfdlg.devicename, uci->devname, (sizeof current_hfdlg.devicename / sizeof (TCHAR)) - 1);
-                       current_hfdlg.devicename[(sizeof current_hfdlg.devicename / sizeof (TCHAR)) - 1] = '\0';
-               }
-               current_hfdlg.rw = !uci->readonly;
-               current_hfdlg.bootpri = uci->bootpri;
-               current_hfdlg.autoboot = uci->autoboot;
-               current_hfdlg.donotmount = uci->donotmount;
+               current_hfdlg.forcedcylinders = uci->ci.highcyl;
+               memcpy (&current_hfdlg.ci, uci, sizeof (struct uaedev_config_info));
                if (CustomDialogBox (IDD_HARDFILE, hDlg, HardfileSettingsProc)) {
                        new_hardfile (hDlg, entry);
                }
        }
        else if (type == FILESYS_HARDDRIVE) /* harddisk */
        {
-               current_hfdlg.controller = uci->controller;
-               current_hfdlg.rw = !uci->readonly;
-               _tcsncpy (current_hfdlg.filename, uci->rootdir, (sizeof current_hfdlg.filename) / sizeof (TCHAR) - 1);
-               current_hfdlg.filename[(sizeof current_hfdlg.filename) / sizeof (TCHAR) - 1] = '\0';
+               memcpy (&current_hfdlg.ci, uci, sizeof (struct uaedev_config_info));
                if (CustomDialogBox (IDD_HARDDRIVE, hDlg, HarddriveSettingsProc)) {
                        new_harddrive (hDlg, entry);
                }
        }
        else /* Filesystem */
        {
-               _tcsncpy (current_fsvdlg.rootdir, uci->rootdir, (sizeof current_fsvdlg.rootdir / sizeof (TCHAR)) - 1);
-               current_fsvdlg.rootdir[sizeof (current_fsvdlg.rootdir) / sizeof (TCHAR) - 1] = '\0';
-               _tcsncpy (current_fsvdlg.volume, uci->volname, (sizeof current_fsvdlg.volume / sizeof (TCHAR)) - 1);
-               current_fsvdlg.volume[sizeof (current_fsvdlg.volume) / sizeof (TCHAR) - 1] = '\0';
-               current_fsvdlg.device[0] = 0;
-               if (uci->devname) {
-                       _tcsncpy (current_fsvdlg.device, uci->devname, (sizeof current_fsvdlg.device) / sizeof (TCHAR) - 1);
-                       current_fsvdlg.device[sizeof (current_fsvdlg.device) / sizeof (TCHAR) - 1] = '\0';
-               }
-               current_fsvdlg.rw = !uci->readonly;
-               current_fsvdlg.bootpri = uci->bootpri;
-               current_fsvdlg.autoboot = uci->autoboot;
-               current_fsvdlg.donotmount = uci->donotmount;
+               memcpy (&current_fsvdlg.ci, uci, sizeof (struct uaedev_config_info));
                archivehd = -1;
                if (CustomDialogBox (IDD_FILESYS, hDlg, VolumeSettingsProc)) {
                        new_filesys (hDlg, entry);
@@ -9943,20 +10000,20 @@ static int harddiskdlg_button (HWND hDlg, WPARAM wParam)
                addcdtype (hDlg, IDC_CD_TYPE);
                break;
        case IDC_NEW_FS:
-               current_fsvdlg = empty_fsvdlg;
+               default_fsvdlg (&current_fsvdlg);
                archivehd = 0;
                if (CustomDialogBox (IDD_FILESYS, hDlg, VolumeSettingsProc))
                        new_filesys (hDlg, -1);
                return 1;
        case IDC_NEW_FSARCH:
                archivehd = 1;
-               current_fsvdlg = empty_fsvdlg;
+               default_fsvdlg (&current_fsvdlg);
                if (CustomDialogBox (IDD_FILESYS, hDlg, VolumeSettingsProc))
                        new_filesys (hDlg, -1);
                return 1;
 
        case IDC_NEW_HF:
-               current_hfdlg = empty_hfdlg;
+               default_hfdlg (&current_hfdlg, false);
                if (CustomDialogBox (IDD_HARDFILE, hDlg, HardfileSettingsProc))
                        new_hardfile (hDlg, -1);
                return 1;
@@ -10072,6 +10129,7 @@ static void hilitehd (HWND hDlg)
        ew (hDlg, IDC_REMOVE, TRUE);
 }
 
+/* harddisk parent view */
 static INT_PTR CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
        switch (msg) {
@@ -11766,6 +11824,8 @@ static INT_PTR CALLBACK GamePortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP
                        SendDlgItemMessage (hDlg, id, CB_RESETCONTENT, 0, 0L);
                        WIN32GUI_LoadUIString (IDS_JOYMODE_DEFAULT, tmp, MAX_DPATH);
                        SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp);
+                       WIN32GUI_LoadUIString (IDS_JOYMODE_WHEELMOUSE, tmp, MAX_DPATH);
+                       SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp);
                        WIN32GUI_LoadUIString (IDS_JOYMODE_MOUSE, tmp, MAX_DPATH);
                        SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp);
                        WIN32GUI_LoadUIString (IDS_JOYMODE_JOYSTICK, tmp, MAX_DPATH);
@@ -13295,8 +13355,10 @@ static void enable_for_hw3ddlg (HWND hDlg)
        ew (hDlg, IDC_FILTERPRESETDELETE, filterpreset_selected > 0 && filterpreset_builtin < 0);
 }
 
-static TCHAR *filtermultnames[] = { _T("FS"), _T("1/2x"), _T("1x"), _T("2x"), _T("4x"), _T("6x"), _T("8x"), NULL };
-static int filtermults[] = { 0, 2000, 1000, 500, 250, 167, 125 };
+static TCHAR *filtermultnames[] = {
+       _T("FS"), _T("1/4x"), _T("1/2x"), _T("1x"), _T("1.5x"), _T("2x"), _T("2.5x"), _T("3x"), _T("3.5x"), _T("4x"), _T("6x"), _T("8x"), NULL
+};
+static float filtermults[] = { 0, 0.25f, 0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 6.0f, 8.0f };
 struct filterxtra {
        TCHAR *label;
        int *varw, *varc;
@@ -13324,7 +13386,21 @@ static struct filterxtra filter_3d_extra[] =
        NULL
 };
 static int dummy_in, dummy_out;
-static int *filtervars[] = {
+static int filtertypes[] = {
+       0, 0,
+       1, 1,
+       1, 1,
+       1, 1,
+       0, 0, 0,
+       0, 0, 0,
+       0, 0,
+       0, 0, 0,
+       0, 0, 0,
+       0, 0,
+       0, 0,
+       -1
+};     
+static void *filtervars[] = {
        &workprefs.gfx_filter, &workprefs.gfx_filter_filtermode,
        &workprefs.gfx_filter_vert_zoom, &workprefs.gfx_filter_horiz_zoom,
        &workprefs.gfx_filter_vert_zoom_mult, &workprefs.gfx_filter_horiz_zoom_mult,
@@ -13338,7 +13414,7 @@ static int *filtervars[] = {
        &workprefs.gfx_filter_autoscale, &workprefs.gfx_filter_bilinear,
        NULL
 };
-static int *filtervars2[] = {
+static void *filtervars2[] = {
        NULL, &currprefs.gfx_filter_filtermode,
        &currprefs.gfx_filter_vert_zoom, &currprefs.gfx_filter_horiz_zoom,
        &currprefs.gfx_filter_vert_zoom_mult, &currprefs.gfx_filter_horiz_zoom_mult,
@@ -13365,7 +13441,7 @@ static struct filterpreset filterpresets[] =
        { NULL }
 };
 
-static int getfiltermult (HWND hDlg, DWORD dlg)
+static float getfiltermult (HWND hDlg, DWORD dlg)
 {
        TCHAR tmp[100];
        LRESULT v = SendDlgItemMessage (hDlg, dlg, CB_GETCURSEL, 0, 0L);
@@ -13375,16 +13451,16 @@ static int getfiltermult (HWND hDlg, DWORD dlg)
                return filtermults[v];
        SendDlgItemMessage (hDlg, dlg, WM_GETTEXT, (WPARAM)sizeof tmp / sizeof (TCHAR), (LPARAM)tmp);
        if (!_tcsicmp (tmp, _T("FS")))
-               return 0;
+               return 0.0f;
        f = (float)_tstof (tmp);
-       if (f < 0)
-               f = 0;
-       if (f > 9)
-               f = 9;
-       return (int)(1000.0 / f);
+       if (f < 0.0f)
+               f = 0.0f;
+       if (f > 9.9f)
+               f = 9.9f;
+       return f;
 }
 
-static void setfiltermult2 (HWND hDlg, int id, int val)
+static void setfiltermult2 (HWND hDlg, int id, float val)
 {
        int i, got;
 
@@ -13399,7 +13475,7 @@ static void setfiltermult2 (HWND hDlg, int id, int val)
                TCHAR tmp[100];
                tmp[0] = 0;
                if (val > 0)
-                       _stprintf (tmp, _T("%.2f"), 1000.0 / val);
+                       _stprintf (tmp, _T("%.2f"), val);
                SendDlgItemMessage (hDlg, id, CB_SETCURSEL, 0, 0);
                SetDlgItemText (hDlg, id, tmp);
        }
@@ -13457,8 +13533,8 @@ static void values_to_hw3ddlg (HWND hDlg)
        SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_ADDSTRING, 0, (LPARAM)txt);
        SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_SETCURSEL, workprefs.gfx_filter_autoscale, 0);
 
-       int range1 = workprefs.gfx_filter_autoscale == AUTOSCALE_MANUAL ? -1 : -999;
-       int range2 = workprefs.gfx_filter_autoscale == AUTOSCALE_MANUAL ? 1800 : 999;
+       int range1 = workprefs.gfx_filter_autoscale == AUTOSCALE_MANUAL ? -1 : -9999;
+       int range2 = workprefs.gfx_filter_autoscale == AUTOSCALE_MANUAL ? 1800 : 9999;
 
        SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETRANGE, TRUE, MAKELONG (range1, range2));
        SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPAGESIZE, 0, 1);
@@ -13643,7 +13719,7 @@ static void values_to_hw3ddlg (HWND hDlg)
        SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_INSERTSTRING, 0, (LPARAM)_T(""));
        SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_SETCURSEL, filterpreset_selected, 0);
 
-       int ho, vo, hz, vz;
+       float ho, vo, hz, vz;
        if (workprefs.gfx_filter_autoscale == AUTOSCALE_MANUAL) {
                hz = workprefs.gfx_xcenter_size;
                vz = workprefs.gfx_ycenter_size;
@@ -13656,14 +13732,14 @@ static void values_to_hw3ddlg (HWND hDlg)
                vo = workprefs.gfx_filter_vert_offset;
        }
 
-       SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, hz);
-       SendDlgItemMessage (hDlg, IDC_FILTERVZ, TBM_SETPOS, TRUE, vz);
-       SendDlgItemMessage (hDlg, IDC_FILTERHO, TBM_SETPOS, TRUE, ho);
-       SendDlgItemMessage (hDlg, IDC_FILTERVO, TBM_SETPOS, TRUE, vo);
-       SetDlgItemInt (hDlg, IDC_FILTERHZV, hz, TRUE);
-       SetDlgItemInt (hDlg, IDC_FILTERVZV, vz, TRUE);
-       SetDlgItemInt (hDlg, IDC_FILTERHOV, ho, TRUE);
-       SetDlgItemInt (hDlg, IDC_FILTERVOV, vo, TRUE);
+       SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, (int)hz);
+       SendDlgItemMessage (hDlg, IDC_FILTERVZ, TBM_SETPOS, TRUE, (int)vz);
+       SendDlgItemMessage (hDlg, IDC_FILTERHO, TBM_SETPOS, TRUE, (int)ho);
+       SendDlgItemMessage (hDlg, IDC_FILTERVO, TBM_SETPOS, TRUE, (int)vo);
+       SetDlgItemInt (hDlg, IDC_FILTERHZV, (int)hz, TRUE);
+       SetDlgItemInt (hDlg, IDC_FILTERVZV, (int)vz, TRUE);
+       SetDlgItemInt (hDlg, IDC_FILTERHOV, (int)ho, TRUE);
+       SetDlgItemInt (hDlg, IDC_FILTERVOV, (int)vo, TRUE);
 }
 
 static void values_from_hw3ddlg (HWND hDlg)
@@ -13725,7 +13801,10 @@ static void filter_preset (HWND hDlg, WPARAM wParam)
                                _tcscat (p, _T(","));
                                p++;
                        }
-                       _stprintf (p, _T("%d"), *(filtervars[i]));
+                       if (filtertypes[i])
+                               _stprintf (p, _T("%f"), *((float*)filtervars[i]));
+                       else
+                               _stprintf (p, _T("%d"), *((int*)filtervars[i]));
                        p += _tcslen (p);
                }
                if (ok == 0) {
@@ -13750,9 +13829,16 @@ static void filter_preset (HWND hDlg, WPARAM wParam)
                        t = _tcschr (s, ',');
                        *t++ = 0;
                        for (i = 0; filtervars[i]; i++) {
-                               *(filtervars[i]) = _tstol(s);
-                               if (filtervars2[i])
-                                       *(filtervars2[i]) = *(filtervars[i]);
+                               if (filtertypes[i])
+                                       *((float*)filtervars[i]) = (float)_tstof (s);
+                               else
+                                       *((int*)filtervars[i]) = _tstol (s);
+                               if (filtervars2[i]) {
+                                       if (filtertypes[i])
+                                               *((float*)filtervars2[i]) = *((float*)filtervars[i]);
+                                       else
+                                               *((int*)filtervars2[i]) = *((int*)filtervars[i]);
+                               }
                                s = t;
                                t = _tcschr (s, ',');
                                if (!t)
@@ -13894,11 +13980,10 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                        currprefs.gfx_filter_vert_zoom = workprefs.gfx_filter_vert_zoom = 0;
                        currprefs.gfx_filter_horiz_offset = workprefs.gfx_filter_horiz_offset = 0;
                        currprefs.gfx_filter_vert_offset = workprefs.gfx_filter_vert_offset = 0;
-                       currprefs.gfx_filter_horiz_zoom_mult = workprefs.gfx_filter_horiz_zoom_mult = 1000;
-                       currprefs.gfx_filter_vert_zoom_mult = workprefs.gfx_filter_vert_zoom_mult = 1000;
+                       currprefs.gfx_filter_horiz_zoom_mult = workprefs.gfx_filter_horiz_zoom_mult = 1.0;
+                       currprefs.gfx_filter_vert_zoom_mult = workprefs.gfx_filter_vert_zoom_mult = 1.0;
                        values_to_hw3ddlg (hDlg);
                        updatedisplayarea ();
-                       WIN32GFX_WindowMove ();
                        break;
                case IDC_FILTERPRESETLOAD:
                case IDC_FILTERPRESETSAVE:
@@ -13916,7 +14001,6 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                                enable_for_hw3ddlg (hDlg);
                                values_to_hw3ddlg (hDlg);
                                updatedisplayarea ();
-                               WIN32GFX_WindowMove ();
                        }
                case IDC_FILTERKEEPAUTOSCALEASPECT:
                        {
@@ -13924,7 +14008,6 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                                enable_for_hw3ddlg (hDlg);
                                values_to_hw3ddlg (hDlg);
                                updatedisplayarea ();
-                               WIN32GFX_WindowMove ();
                        }
                        break;
                default:
@@ -13970,12 +14053,10 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                                case IDC_FILTERHZMULT:
                                        currprefs.gfx_filter_horiz_zoom_mult = workprefs.gfx_filter_horiz_zoom_mult = getfiltermult (hDlg, IDC_FILTERHZMULT);
                                        updatedisplayarea ();
-                                       WIN32GFX_WindowMove ();
                                        break;
                                case IDC_FILTERVZMULT:
                                        currprefs.gfx_filter_vert_zoom_mult = workprefs.gfx_filter_vert_zoom_mult = getfiltermult (hDlg, IDC_FILTERVZMULT);
                                        updatedisplayarea ();
-                                       WIN32GFX_WindowMove ();
                                        break;
                                case IDC_FILTERASPECT:
                                        {
@@ -13999,7 +14080,6 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                                                }
                                                currprefs.gfx_filter_aspect = workprefs.gfx_filter_aspect = v2;
                                                updatedisplayarea ();
-                                               WIN32GFX_WindowMove ();
                                        }
                                        break;
                                case IDC_FILTERASPECT2:
@@ -14008,7 +14088,6 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                                                if (v != CB_ERR)
                                                        currprefs.gfx_filter_keep_aspect = workprefs.gfx_filter_keep_aspect = v;
                                                updatedisplayarea ();
-                                               WIN32GFX_WindowMove ();
                                        }
                                        break;
 
@@ -14051,11 +14130,11 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                                        }
                                }
                                currprefs.gfx_filter_horiz_offset = workprefs.gfx_filter_horiz_offset = (int)SendMessage (GetDlgItem (hDlg, IDC_FILTERHO), TBM_GETPOS, 0, 0);
-                                       currprefs.gfx_filter_vert_offset = workprefs.gfx_filter_vert_offset = (int)SendMessage (GetDlgItem (hDlg, IDC_FILTERVO), TBM_GETPOS, 0, 0);
-                                       SetDlgItemInt (hDlg, IDC_FILTERHOV, workprefs.gfx_filter_horiz_offset, TRUE);
-                                       SetDlgItemInt (hDlg, IDC_FILTERVOV, workprefs.gfx_filter_vert_offset, TRUE);
-                               SetDlgItemInt (hDlg, IDC_FILTERHZV, workprefs.gfx_filter_horiz_zoom, TRUE);
-                               SetDlgItemInt (hDlg, IDC_FILTERVZV, workprefs.gfx_filter_vert_zoom, TRUE);
+                               currprefs.gfx_filter_vert_offset = workprefs.gfx_filter_vert_offset = (int)SendMessage (GetDlgItem (hDlg, IDC_FILTERVO), TBM_GETPOS, 0, 0);
+                               SetDlgItemInt (hDlg, IDC_FILTERHOV, (int)workprefs.gfx_filter_horiz_offset, TRUE);
+                               SetDlgItemInt (hDlg, IDC_FILTERVOV, (int)workprefs.gfx_filter_vert_offset, TRUE);
+                               SetDlgItemInt (hDlg, IDC_FILTERHZV, (int)workprefs.gfx_filter_horiz_zoom, TRUE);
+                               SetDlgItemInt (hDlg, IDC_FILTERVZV, (int)workprefs.gfx_filter_vert_zoom, TRUE);
                        }
                        if (filter_selected) {
                                int *pw = filter_selected->varw;
@@ -14074,7 +14153,6 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                                notice_new_xcolors ();
                        }
                        updatedisplayarea ();
-                       WIN32GFX_WindowMove ();
                        recursive--;
                        break;
                }
@@ -15002,6 +15080,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
 {
        int cnt, i, drv, harddrive, drvdrag, firstdrv;
        TCHAR file[MAX_DPATH];
+       TCHAR *filepart = NULL;
        int dfxtext[] = { IDC_DF0TEXT, IDC_DF0TEXTQ, IDC_DF1TEXT, IDC_DF1TEXTQ, IDC_DF2TEXT, -1, IDC_DF3TEXT, -1 };
        POINT pt;
        RECT r, r2;
@@ -15053,6 +15132,13 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int        currentpage)
                int mask;
 
                DragQueryFile (hd, i, file, sizeof (file) / sizeof (TCHAR));
+               filepart = _tcsrchr (file, '/');
+               if (!filepart)
+                       filepart = _tcsrchr (file, '\\');
+               if (filepart)
+                       filepart++;
+               else
+                       filepart = file;
                flags = GetFileAttributes (file);
                if (flags & FILE_ATTRIBUTE_DIRECTORY)
                        type = ZFILE_HDF;
@@ -15085,8 +15171,8 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
                }
 
                if (customDlgType == IDD_HARDFILE) {
-                       _tcscpy (current_hfdlg.filename, file);
-                       SetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename);
+                       _tcscpy (current_hfdlg.ci.rootdir, file);
+                       SetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.ci.rootdir);
                        updatehdfinfo (customDlg, true, true);
                        sethardfile (customDlg);
                        continue;
@@ -15112,8 +15198,9 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
                        if (currentpage == DISK_ID) {
                                diskswapper_addfile (prefs, file);
                        } else if (currentpage == HARDDISK_ID) {
-                               add_filesys_config (&workprefs, -1, NULL, _T(""), file, 0,
-                                       0, 0, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0);
+                               default_fsvdlg (&current_fsvdlg);
+                               _tcscpy (current_fsvdlg.ci.rootdir, file);
+                               add_filesys_config (&workprefs, -1, &current_fsvdlg.ci, false);
                        } else {
                                drv = floppyslot_addfile (prefs, file, drv, firstdrv, i);
                                if (drv < 0)
@@ -15134,26 +15221,23 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int       currentpage)
                        break;
                case ZFILE_HDF:
                        if (flags & FILE_ATTRIBUTE_DIRECTORY) {
-                               if (!full_property_sheet && currentpage < 0)
+                               if (!full_property_sheet && currentpage < 0) {
                                        do_filesys_insert (file);
-                               else
-                                       add_filesys_config (&workprefs, -1, NULL, _T(""), file, 0,
-                                               0, 0, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0);
+                               } else {
+                                       default_fsvdlg (&current_fsvdlg);
+                                       _tcscpy (current_fsvdlg.ci.rootdir, file);
+                                       add_filesys_config (&workprefs, -1, &current_fsvdlg.ci, false);
+                               }
                        } else {
+                               uci_set_defaults (&current_hfdlg.ci, false);
                                current_hfdlg.forcedcylinders = 0;
-                               current_hfdlg.sectors = 32;
-                               current_hfdlg.surfaces = 1;
-                               current_hfdlg.blocksize = 512;
-                               _tcscpy (current_hfdlg.filename, file);
                                updatehdfinfo (NULL, true, true);
-                               add_filesys_config (&workprefs, -1, NULL, NULL, file, 0,
-                                       0, current_hfdlg.sectors, current_hfdlg.surfaces, 2, current_hfdlg.blocksize, 0, NULL, 0, 0,
-                                       0, 0, 0);
+                               add_filesys_config (&workprefs, -1, &current_hfdlg.ci, true);
                        }
                        break;
                case ZFILE_HDFRDB:
-                       add_filesys_config (&workprefs, -1, NULL, NULL, file, 0,
-                               0, 0, 0, 0, 512, 0, NULL, 0, 0, 0, 0, 0);
+                       default_hfdlg (&current_hfdlg, true);
+                       add_filesys_config (&workprefs, -1, &current_hfdlg.ci, true);
                        break;
                case ZFILE_NVR:
                        _tcscpy (prefs->flashfile, file);
@@ -15182,8 +15266,10 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int        currentpage)
                        if (currentpage < 0 && !full_property_sheet) {
                                do_filesys_insert (file);
                        } else if (currentpage == HARDDISK_ID) {
-                               add_filesys_config (&workprefs, -1, NULL, _T(""), file, 0,
-                                       0, 0, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0);
+                               default_fsvdlg (&current_fsvdlg);
+                               _tcscpy (current_fsvdlg.ci.rootdir, file);
+                               _tcscpy (current_fsvdlg.ci.volname, filepart);
+                               add_filesys_config (&workprefs, -1, &current_fsvdlg.ci, false);
                                if (!full_property_sheet)
                                        do_filesys_insert (file);
                        } else {
@@ -16008,6 +16094,10 @@ void gui_led (int led, int on)
                        _stprintf (ptr, _T("%.1f [%.1f]"), p96vblank, fps);
                else
                        _stprintf (ptr, _T("FPS: %.1f"), fps);
+               if (gui_data.cpu_halted) {
+                       _stprintf (ptr, _T("HALT%d"), gui_data.cpu_halted);
+                       center = 1;
+               }
                if (pause_emulation) {
                        _tcscpy (ptr, _T("PAUSED"));
                        center = 1;
index cab4274c4748619d0dc3b20a2ac38ec3743c26f9..0fc75c2c08d7fc2f79169d22bf2f81c6fcaa83e8 100644 (file)
     </Manifest>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\..\archivers\chd\astring.cpp" />
+    <ClCompile Include="..\..\archivers\chd\chd.cpp" />
+    <ClCompile Include="..\..\archivers\chd\chdcdrom.cpp" />
+    <ClCompile Include="..\..\archivers\chd\chdcodec.cpp" />
+    <ClCompile Include="..\..\archivers\chd\flac.cpp" />
+    <ClCompile Include="..\..\archivers\chd\hashing.cpp" />
+    <ClCompile Include="..\..\archivers\chd\huffman.cpp" />
+    <ClCompile Include="..\..\archivers\chd\md5.cpp" />
+    <ClCompile Include="..\..\archivers\chd\sha1.cpp" />
     <ClCompile Include="..\..\archivers\dms\crc_csum.cpp" />
     <ClCompile Include="..\..\archivers\dms\getbits.cpp" />
     <ClCompile Include="..\..\archivers\dms\maketbl.cpp" />
     <ClCompile Include="..\..\calc.cpp" />
     <ClCompile Include="..\..\cpuemu_21.cpp" />
     <ClCompile Include="..\..\cpuemu_22.cpp" />
+    <ClCompile Include="..\..\cpuemu_32.cpp" />
+    <ClCompile Include="..\..\cpuemu_33.cpp" />
+    <ClCompile Include="..\..\cpummu30.cpp" />
     <ClCompile Include="..\..\events.cpp" />
     <ClCompile Include="..\..\hrtmon.rom.cpp" />
     <ClCompile Include="..\..\inputrecord.cpp" />
index 1f38e8d0c70a6c4fe85af9be14ac8c1ad02d386e..57403ea28f8e962354cd226b7ad5cb3d5c3004cc 100644 (file)
@@ -41,6 +41,9 @@
     <Filter Include="unpackers\zip">
       <UniqueIdentifier>{93fcf20a-8921-43e8-b4b9-e5fceb81332d}</UniqueIdentifier>
     </Filter>
+    <Filter Include="unpackers\chd">
+      <UniqueIdentifier>{67d1b86d-3ebd-40fe-9fc2-c749eb7a890b}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\ahidsound_dsonly.cpp">
     <ClCompile Include="..\..\cpuemu_22.cpp">
       <Filter>common</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\cpuemu_32.cpp">
+      <Filter>common</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\cpummu30.cpp">
+      <Filter>common</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\cpuemu_33.cpp">
+      <Filter>common</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\astring.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\chd.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\chdcdrom.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\chdcodec.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\flac.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\hashing.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\huffman.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\md5.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\sha1.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\resources\35floppy.ico">
index 4ddda324a597534f8a20dc46493e85f17d1a3763..d4da90058c3309ce0c9158134b78b4b2a5ffe442 100644 (file)
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\</AdditionalLibraryDirectories>
       <IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+      <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;Dwmapi.lib;%(DelayLoadDLLs)</DelayLoadDLLs>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <ProgramDatabaseFile>$(Platform)\$(Configuration)\winuae.pdb</ProgramDatabaseFile>
       <SubSystem>Windows</SubSystem>
     </Manifest>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\..\archivers\chd\astring.cpp" />
+    <ClCompile Include="..\..\archivers\chd\chd.cpp" />
+    <ClCompile Include="..\..\archivers\chd\chdcdrom.cpp" />
+    <ClCompile Include="..\..\archivers\chd\chdcodec.cpp" />
+    <ClCompile Include="..\..\archivers\chd\flac.cpp" />
+    <ClCompile Include="..\..\archivers\chd\hashing.cpp" />
+    <ClCompile Include="..\..\archivers\chd\huffman.cpp" />
+    <ClCompile Include="..\..\archivers\chd\md5.cpp" />
+    <ClCompile Include="..\..\archivers\chd\sha1.cpp" />
     <ClCompile Include="..\..\archivers\dms\crc_csum.cpp" />
     <ClCompile Include="..\..\archivers\dms\getbits.cpp" />
     <ClCompile Include="..\..\archivers\dms\maketbl.cpp" />
     <ClCompile Include="..\..\calc.cpp" />
     <ClCompile Include="..\..\cpuemu_21.cpp" />
     <ClCompile Include="..\..\cpuemu_22.cpp" />
+    <ClCompile Include="..\..\cpuemu_32.cpp" />
+    <ClCompile Include="..\..\cpuemu_33.cpp" />
+    <ClCompile Include="..\..\cpummu30.cpp" />
     <ClCompile Include="..\..\events.cpp" />
     <ClCompile Include="..\..\hrtmon.rom.cpp" />
     <ClCompile Include="..\..\inputrecord.cpp" />
index 1f38e8d0c70a6c4fe85af9be14ac8c1ad02d386e..93a5175c0c722e2e0bf9f5468af4f302801d4b39 100644 (file)
@@ -41,6 +41,9 @@
     <Filter Include="unpackers\zip">
       <UniqueIdentifier>{93fcf20a-8921-43e8-b4b9-e5fceb81332d}</UniqueIdentifier>
     </Filter>
+    <Filter Include="unpackers\chd">
+      <UniqueIdentifier>{dd8bf794-572a-4d08-9cae-b280eb493e54}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\ahidsound_dsonly.cpp">
     <ClCompile Include="..\..\cpuemu_22.cpp">
       <Filter>common</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\cpummu30.cpp">
+      <Filter>common</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\cpuemu_32.cpp">
+      <Filter>common</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\cpuemu_33.cpp">
+      <Filter>common</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\astring.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\hashing.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\md5.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\sha1.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\chd.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\huffman.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\chdcodec.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\flac.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\archivers\chd\chdcdrom.cpp">
+      <Filter>unpackers\chd</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\resources\35floppy.ico">
index f9f84f59e2a1c46ad2f96e3e853fc3ba94dfb888..5061634628ee2749bde84d2a9e55e7523cfcb8ed 100644 (file)
@@ -1,8 +1,77 @@
 
 - restore only single input target to default.
 
-This is usual quick 2.5.0 bug fix version. Estimated release date: before Christmas.
-I try not to do any GUI changes this time, 2.5.0 translation DLLs should still work with 2.5.1.
+Big MMU emulation update:
+
+- Previous (Next emulator) 68030 MMU added (+missing bus error exception stuff implemented by me),
+  some 68040 MMU updates merged. A3000 1.4 boot ROM, 1.3 SuperKickstart (which uses special MMU mapping for "bonus" code),
+  Enforcer and Amix confirmed working (Amix can't be installed because tape drive is not emulated but pre-installed
+  HD image work)
+- 68060 MMU emulation added, mostly same as 68040, different stack frames and 68060 restarts
+  all bus faults, 68040 restarts only read faults (excluding MOVEM).
+- Executable is larger, MMU compatible 68030 and 68060 CPU emulation cores added.
+- MMU double fault stops the CPU (just like real CPU does), no more instant resets, makes debugging easier.
+  Windowed mode status bar shows "HALTx" (Hx in OSD) in this situation (x = reason code). Only reset gets out of halted state.
+  Also non-MMU mode fake double bus faults or other impossible states (for example odd supervisor stack) now enters halted state.
+
+Note that 68030 MMU is very complex compared to 68040+ = slower than 68040 or 68060 MMU emulation.
+
+- Added second A3000 Quickstart compatibility level, 68030 MMU emulation or fake MMU + JIT.
+- Always refresh windowed status bar floppy leds when emulation starts or statefile is loaded.
+- Executable as a disk image mounting does not generate identical disk creation dates anymore, wrong date calculation fixed.
+- Use name of original file when mounting executable as a disk image, will be truncated if too long.
+- Disable floppy sounds when exe mounted as a disk is inserted.
+- Added wheel mouse Game Ports device type. Old "Mouse" is renamed "Wheel Mouse" and new "Mouse" is
+  mouse without wheel mapped. Added because some older programs can get confused with mouse wheel keyboard events.
+- Win+D (show/hide desktop) has now same behavior as minimize/unminimize.
+- Named pipe accepts also UTF16LE (Windows native) and UTF8 strings if BOM is included. No BOM = assumes
+  current "ANSI" character set. Old ipctester.exe works finally again.
+- Named pipe also supports debugger commands, either using dbg_<name of debugger command> or first setting it
+  to debugger mode using "ipc_debug" command. ("ipc_config" = config mode, "ipc_event" = event mode, "ipc_restore" =
+  back to normal mode). Other direct commands are cfg_<config entry and evt_<event name>.
+  (Works exactly same as uae-configuration commands)
+- Call DwmEnableMMCSS(TRUE) if running under Vista or later.
+- VSync/HSync counting CIA TOD counters run at half rate if genlock mode is active.
+- Added hack that fixes unreliable KS ROM genlock detection in fastest possible CPU modes.
+- Enabling or disabling windowed mode status bar does not reopen the window anymore.
+- Horizontal programmed screen mode registers' upper byte must be masked. Fixes Debian Sarge blank screen.
+- All debugger commands support MMU logical to physical address translations, enable with "mmu <CPU function code>", 0 = disabled.
+- Added support for A2000 old style RTC address range (Adv. chipset panel), this also maps new style clock
+  address range (0x00DC0000) as custom chipset.
+- FPU NULL state implemented. Fixes Amix FPU detection, it tests FPU by restoring NULL frame then immediately saving
+  FPU frame and only accepting the FPU if stored FPU frame is NULL frame.
+- Filesystem added using FileSys hardfile option will have at least 4000 byte stack, filesystem will be only added to
+  FileSystem.resource if it does not already include filesystem with same dostype. (Previously it was always added, replacing
+  previous one)
+- addmemx config option(s) caused crash if emulation was restarted.
+- Filter position and zoom values uses now floats, weird integers are gone. Old settings are ignored, config entries renamed!
+- Custom input events can send commands to debugger, "dbg <debugger command>", output goes to console window if open.
+- Changing filter position/zoom values using custom events or uae-configuration incorrectly forced display subsystem reset.
+- WD33C93/DMAC SCSI emulation improved. (Amix, NetBSD and so on..)
+- Added A590/A2091/A3000 SCSI DMAC state file support. Only basic state, any SCSI operation must not be active while saving.
+- Windowed mode title bar doubleclick now maximizes normally, shift+doubleclick = fullscreen and ctrl+doubleclick = fullwindow.
+- Immediate blitter didn't check if blitter DMA was enabled.
+- Added CHD (Mame) CD image support support. Full data, CD audio and subchannel support.
+- CHD image as a hardfile support added. Read-only.
+- LZMA (7zip) support code updated to latest beta (required by CHD LZMA code)
+- Host FPU rounding/accuracy mode was not reset back to correct original values when using filters.
+- Pause mode updates, configuration changes while in pause mode work better but currently display becomes blank if
+  display mode changes while in pause mode (Old screen was lost and new data can't be generated in pause mode)
+- Filesystem config (cylinders, sectors etc..) parameter passing rewritten, now uses same structure everywhere instead
+  of passing huge and random amount of ugly variables around. Big change, can break things.
+- Partition hardfile parameter/geometry support update, if file named <original hardfile name>.geo is found in same directory as
+  hardfile, it is parsed for mountlist-like parameters (key=value). It also supports parameters that are not available in GUI or
+  in config file (for example lowcyl, buffers, maxtransfer etc..).
+- Log partition hardfile full geometry data when mounting.
+- Added native resolution selection to Display panel fullscreen resolution options. Uses always monitor's native mode. (Actually it is
+  monitor's desktop resolution because biggest listed resolution may be unsupported)
+- Replacing or removing HDF files using the GUI now changes the drive on Amiga side too. Inserting new HDFs won't work.
+- Fixed IDE emulation bug introduced in 2.4b17, IDE status register returned bogus data after execute diagnostics command.
+  (KS driver didn't care, other drivers probably did)
+- 1.5M chip RAM size didn't work (Note that this can't work if JIT is enabled)
+- Very very long (hours..) startup delay if emulation was started in fastest possible + CPU throttle enabled.
+- Windowed RTG to native switch (or vice versa) while window had no focus set internal focus state causing keyboard input to appear
+  on Amiga side.
 
 2.5.1
 
index 6b9f48f7a2ce4c39edeb0cc19232b2b877f2737f..860cb679ff18e5a630c488ae887613f86c09203b 100644 (file)
@@ -302,7 +302,9 @@ void console_out (const TCHAR *txt)
 
 bool console_isch (void)
 {
-       if (realconsole) {
+       if (console_buffer) {
+               return 0;
+       } else if (realconsole) {
                return false;
        } else if (consoleopen < 0) {
                DWORD events = 0;
@@ -314,7 +316,9 @@ bool console_isch (void)
 
 TCHAR console_getch (void)
 {
-       if (realconsole) {
+       if (console_buffer) {
+               return 0;
+       } else if (realconsole) {
                return getwc (stdin);
        } else if (consoleopen < 0) {
                DWORD len;
index f782d5b8463562e990a3196bd211011f3677ed92..6736d8af6872efec225cc59ad9a5d3588130a5fe 100644 (file)
@@ -677,8 +677,12 @@ void restore_state (const TCHAR *filename)
                else if (!_tcscmp (name, _T("CDTV")))
                        end = restore_cdtv (chunk);
                else if (!_tcscmp (name, _T("DMAC")))
-                       end = restore_dmac (chunk);
+                       end = restore_cdtv_dmac (chunk);
 #endif
+               else if (!_tcscmp (name, _T("DMC2")))
+                       end = restore_scsi_dmac (chunk);
+               else if (!_tcscmp (name, _T("SCSI")))
+                       end = restore_scsi_hd (chunk);
                else if (!_tcscmp (name, _T("GAYL")))
                        end = restore_gayle (chunk);
                else if (!_tcscmp (name, _T("IDE ")))
@@ -959,10 +963,18 @@ static int save_state_internal (struct zfile *f, const TCHAR *description, int c
        dst = save_cdtv (&len, NULL);
        save_chunk (f, dst, len, _T("CDTV"), 0);
        xfree (dst);
-       dst = save_dmac (&len, NULL);
+       dst = save_cdtv_dmac (&len, NULL);
        save_chunk (f, dst, len, _T("DMAC"), 0);
        xfree (dst);
 #endif
+       dst = save_scsi_dmac (&len, NULL);
+       save_chunk (f, dst, len, _T("DMC2"), 0);
+       xfree (dst);
+       for (i = 0; i < 8; i++) {
+               dst = save_scsi_hd (i, &len, NULL);
+               save_chunk (f, dst, len, _T("SCSI"), 0);
+               xfree (dst);
+       }
 
 #ifdef ACTION_REPLAY
        dst = save_action_replay (&len, NULL);
@@ -1276,8 +1288,10 @@ void savestate_rewind (void)
        if (restore_u32_func (&p))
                p = restore_cdtv (p);
        if (restore_u32_func (&p))
-               p = restore_dmac (p);
+               p = restore_cdtv_dmac (p);
 #endif
+       if (restore_u32_func (&p))
+               p = restore_scsi_dmac (p);
        if (restore_u32_func (&p))
                p = restore_gayle (p);
        for (i = 0; i < 4; i++) {
@@ -1614,12 +1628,22 @@ retry2:
        p3 = p;
        save_u32_func (&p, 0);
        tlen += 4;
-       if (save_dmac (&len, p)) {
+       if (save_cdtv_dmac (&len, p)) {
                save_u32_func (&p3, 1);
                tlen += len;
                p += len;
        }
 #endif
+       if (bufcheck (st, p, 0))
+               goto retry;
+       p3 = p;
+       save_u32_func (&p, 0);
+       tlen += 4;
+       if (save_scsi_dmac (&len, p)) {
+               save_u32_func (&p3, 1);
+               tlen += len;
+               p += len;
+       }
        if (bufcheck (st, p, 0))
                goto retry;
        p3 = p;
index cc82bef22a6c3108a38657cfa0aa9563c5bd757a..cf512ddd35fac6faa7a8b45a46647318bedc940b 100644 (file)
--- a/scsi.cpp
+++ b/scsi.cpp
@@ -19,7 +19,7 @@ static int outcmd[] = { 0x0a, 0x2a, 0x2f, 0xaa, -1 };
 static int incmd[] = { 0x03, 0x08, 0x12, 0x1a, 0x25, 0x28, 0x37, 0x42, 0x43, 0xa8, -1 };
 static int nonecmd[] = { 0x00, 0x35, -1 };
 
-int scsi_data_dir(struct scsi_data *sd)
+static int scsi_data_dir(struct scsi_data *sd)
 {
        int i;
        uae_u8 cmd;
@@ -44,17 +44,56 @@ int scsi_data_dir(struct scsi_data *sd)
        return -2;
 }
 
+void scsi_emulate_analyze (struct scsi_data *sd)
+{
+       int cmd_len, data_len;
+
+       data_len = sd->data_len;
+       switch (sd->cmd[0])
+       {
+       case 0x0a:
+               cmd_len = 6;
+               data_len = sd->cmd[4] * sd->hfd->hfd.ci.blocksize;
+       break;
+       case 0x2a:
+               cmd_len = 10;
+               data_len = ((sd->cmd[7] << 8) | (sd->cmd[8] << 0)) * (uae_s64)sd->hfd->hfd.ci.blocksize;
+       break;
+       case 0xaa:
+               cmd_len = 12;
+               data_len = ((sd->cmd[6] << 24) | (sd->cmd[7] << 16) | (sd->cmd[8] << 8) | (sd->cmd[9] << 0)) * (uae_s64)sd->hfd->hfd.ci.blocksize;
+       break;
+
+       case 0x25:
+       case 0x28:
+       case 0x35:
+               cmd_len = 10;
+               break;
+       case 0xa8:
+               cmd_len = 12;
+               break;
+       default:
+               cmd_len = 6;
+               break;
+       }
+       sd->cmd_len = cmd_len;
+       sd->data_len = data_len;
+       sd->direction = scsi_data_dir (sd);
+}
+
 void scsi_emulate_cmd(struct scsi_data *sd)
 {
        sd->status = 0;
+       //write_log (_T("CMD=%02x\n"), sd->cmd[0]);
        if (sd->cmd[0] == 0x03) { /* REQUEST SENSE */
-               int len = sd->buffer[4];
+               int len = sd->cmd[4];
                memset (sd->buffer, 0, len);
                memcpy (sd->buffer, sd->sense, sd->sense_len > len ? len : sd->sense_len);
                sd->data_len = len;
+               sd->status = 0;
        } else if (sd->nativescsiunit < 0) {
                sd->status = scsi_emulate(&sd->hfd->hfd, sd->hfd,
-                       sd->cmd, sd->len, sd->buffer, &sd->data_len, sd->reply, &sd->reply_len, sd->sense, &sd->sense_len);
+                       sd->cmd, sd->cmd_len, sd->buffer, &sd->data_len, sd->reply, &sd->reply_len, sd->sense, &sd->sense_len);
                if (sd->status == 0) {
                        if (sd->reply_len > 0) {
                                memset(sd->buffer, 0, 256);
@@ -66,12 +105,12 @@ void scsi_emulate_cmd(struct scsi_data *sd)
 
                memset(sd->sense, 0, 256);
                memset(&as, 0, sizeof as);
-               memcpy (&as.cmd, sd->cmd, sd->len);
+               memcpy (&as.cmd, sd->cmd, sd->cmd_len);
                as.flags = 2 | 1;
                if (sd->direction > 0)
                        as.flags &= ~1;
                as.sense_len = 32;
-               as.cmd_len = sd->len;
+               as.cmd_len = sd->cmd_len;
                as.data = sd->buffer;
                as.len = sd->direction < 0 ? DEVICE_SCSI_BUFSIZE : sd->data_len;
                sys_command_scsi_direct_native(sd->nativescsiunit, &as);
@@ -123,36 +162,42 @@ void scsi_free(struct scsi_data *sd)
        xfree(sd);
 }
 
-void scsi_start_transfer(struct scsi_data *sd, int len)
+void scsi_start_transfer(struct scsi_data *sd)
 {
-       sd->len = len;
        sd->offset = 0;
 }
 
 int scsi_send_data(struct scsi_data *sd, uae_u8 b)
 {
-       if (sd->direction) {
+       if (sd->direction == 1) {
                if (sd->offset >= SCSI_DATA_BUFFER_SIZE) {
                        write_log (_T("SCSI data buffer overflow!\n"));
                        return 0;
                }
                sd->buffer[sd->offset++] = b;
-       } else {
+       } else if (sd->direction == 2) {
                if (sd->offset >= 16) {
                        write_log (_T("SCSI command buffer overflow!\n"));
                        return 0;
                }
                sd->cmd[sd->offset++] = b;
+               if (sd->offset == sd->cmd_len)
+                       return 1;
+       } else {
+               write_log (_T("scsi_send_data() without direction!\n"));
+               return 0;
        }
-       if (sd->offset == sd->len)
+       if (sd->offset == sd->data_len)
                return 1;
        return 0;
 }
 
 int scsi_receive_data(struct scsi_data *sd, uae_u8 *b)
 {
+       if (!sd->data_len)
+               return -1;
        *b = sd->buffer[sd->offset++];
-       if (sd->offset == sd->len)
-               return 1;
+       if (sd->offset == sd->data_len)
+               return 1; // requested length got
        return 0;
 }
index 05f64b3ec9e8015ac5fe3a40e3f5e525195e609c..fa8e6eb148493e74e2a9c0dd309795b9cb853aba 100644 (file)
@@ -165,14 +165,23 @@ void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u
                } else if (led == LED_CPU) {
                        int idle = (gui_data.idle + 5) / 10;
                        pos = 1;
-                       //on = framecnt && !picasso_on;
                        on_rgb = 0xcc0000;
                        off_rgb = 0x000000;
-                       num1 = idle / 100;
-                       num2 = (idle - num1 * 100) / 10;
-                       num3 = idle % 10;
-                       num4 = num1 == 0 ? 13 : -1;
-                       am = 3;
+                       if (gui_data.cpu_halted) {
+                               on_rgb = 0xcccc00;
+                               idle = 0;
+                               on = 1;
+                               num1 = -1;
+                               num2 = 11;
+                               num3 = gui_data.cpu_halted;
+                               am = 2;
+                       } else {
+                               num1 = idle / 100;
+                               num2 = (idle - num1 * 100) / 10;
+                               num3 = idle % 10;
+                               num4 = num1 == 0 ? 13 : -1;
+                               am = 3;
+                       }
                } else if (led == LED_SND) {
                        int snd = abs(gui_data.sndbuf + 5) / 10;
                        if (snd > 99)
@@ -234,8 +243,10 @@ void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u
                                        write_tdnumber (buf, bpp, x, y - TD_PADY, num1, pen_rgb, c2);
                                        x += TD_NUM_WIDTH;
                                }
-                               write_tdnumber (buf, bpp, x, y - TD_PADY, num2, pen_rgb, c2);
-                               x += TD_NUM_WIDTH;
+                               if (num2 >= 0) {
+                                       write_tdnumber (buf, bpp, x, y - TD_PADY, num2, pen_rgb, c2);
+                                       x += TD_NUM_WIDTH;
+                               }
                                write_tdnumber (buf, bpp, x, y - TD_PADY, num3, pen_rgb, c2);
                                x += TD_NUM_WIDTH;
                                if (num4 > 0)
index 0afec9fe87f6e7792cac3b0d4dc250da35da92ee..d8abe9665db92bb69ee923236ff58fda3ab4e16a 100644 (file)
@@ -9,6 +9,7 @@
 #include "options.h"
 #include "zfile.h"
 #include "inputdevice.h"
+#include "debug.h"
 
 #include <windows.h>
 
@@ -16,6 +17,8 @@
 #define MAX_OUTMESSAGES 30
 #define MAX_BINMESSAGE 32
 
+static int ipcmode;
+
 struct uaeipc
 {
        HANDLE hipc, olevent;
@@ -31,12 +34,48 @@ struct uaeipc
 
 static void parsemessage(TCHAR *in, struct uae_prefs *p, TCHAR *out, int outsize)
 {
+       int mode;
+
        out[0] = 0;
-       if (!_tcsncmp (in, _T("CFG "), 4) || !_tcsncmp (in, _T("EVT "), 4)) {
+
+       my_trim (in);
+       if (!_tcsicmp (in, _T("ipc_config"))) {
+               ipcmode = 1;
+               _tcscat (out, _T("200\n"));
+               return;
+       } else if (!_tcsicmp (in, _T("ipc_event"))) {
+               ipcmode = 2;
+               _tcscat (out, _T("200\n"));
+               return;
+       } else if (!_tcsicmp (in, _T("ipc_debug"))) {
+               ipcmode = 3;
+               _tcscat (out, _T("200\n"));
+               return;
+       } else if (!_tcsicmp (in, _T("ipc_restore"))) {
+               ipcmode = 0;
+               _tcscat (out, _T("200\n"));
+               return;
+       }
+
+       mode = 0;
+       if (ipcmode == 1) {
+               mode = 1;
+       } else if (ipcmode == 2) {
+               mode = 1;
+       } else if (ipcmode == 3) {
+               mode = 2;
+       } else if (!_tcsnicmp (in, _T("CFG "), 4) || !_tcsnicmp (in, _T("EVT "), 4)) {
+               mode = 1;
+               in += 4;
+       } else if (!_tcsnicmp (in, _T("DBG "), 4)) {
+               mode = 2;
+               in += 4;
+       }
+
+       if (mode == 1) {
                TCHAR tmpout[256];
                int index = -1;
                int cnt = 0;
-               in += 4;
                for (;;) {
                        int ret;
                        tmpout[0] = 0;
@@ -52,8 +91,12 @@ static void parsemessage(TCHAR *in, struct uae_prefs *p, TCHAR *out, int outsize
                        if (ret >= 0)
                                break;
                }
-               if (_tcslen (out) == 0)
+               if (out[0] == 0)
                        _tcscat (out, _T("404"));
+       } else if (mode == 2) {
+               debug_parser (in, out, outsize);
+               if (!out[0])
+                       _tcscpy (out, _T("404"));
        } else {
                _tcscpy (out, _T("501"));
        }
@@ -131,7 +174,7 @@ void *createIPC (const TCHAR *name, int binary)
        ipc->readpending = FALSE;
        ipc->writepending = FALSE;
        ipc->olevent = INVALID_HANDLE_VALUE;
-       ipc->binary = 1;
+       ipc->binary = 0;
        while (cnt < 10) {
                _stprintf (tmpname, _T("\\\\.\\pipe\\%s"), name);
                if (cnt > 0) {
@@ -232,6 +275,7 @@ int checkIPC (void *vipc, struct uae_prefs *p)
                        if (err == ERROR_IO_INCOMPLETE)
                                return 0;
                        write_log (_T("IPC: GetOverlappedResult error %d\n"), err);
+                       ipc->connected = TRUE;
                        resetIPC (ipc);
                        return 0;
                }
@@ -249,6 +293,8 @@ int checkIPC (void *vipc, struct uae_prefs *p)
                }
        }
        if (!ipc->readpending) {
+               ipc->buffer[0] = ipc->buffer[1] = 0;
+               ipc->buffer[2] = ipc->buffer[3] = 0;
                ok = ReadFile (ipc->hipc, ipc->buffer, IPC_BUFFER_SIZE, &ret, &ipc->ol);
                err = GetLastError ();
                if (!ok) {
@@ -268,11 +314,39 @@ int checkIPC (void *vipc, struct uae_prefs *p)
        if (ipc->binary) {
 
        } else {
-               write_log (_T("IPC: got message '%s'\n"), ipc->buffer);
-               parsemessage ((TCHAR*)ipc->buffer, p, (TCHAR*)ipc->outbuf, sizeof ipc->outbuf);
+               TCHAR out[IPC_BUFFER_SIZE];
+               int outlen;
+               TCHAR *msg;
+               bool freeit = false;
+               int type = 0;
+               if (ipc->buffer[0] == 0xef && ipc->buffer[1] == 0xbb && ipc->buffer[2] == 0xbf) {
+                       msg = utf8u ((char*)ipc->buffer + 3);
+                       type = 1;
+               } else if (ipc->buffer[0] == 0xff && ipc->buffer[1] == 0xfe) {
+                       msg = my_strdup ((TCHAR*)(ipc->buffer + 2));
+                       type = 2;
+               } else {
+                       msg = au ((uae_char*)ipc->buffer);
+               }
+               parsemessage (msg, p, out, sizeof out / sizeof (TCHAR));
+               xfree (msg);
+               if (type == 1) {
+                       char *outp = uutf8 (out);
+                       strcpy ((char*)ipc->outbuf, outp);
+                       outlen = strlen ((char*)ipc->outbuf) + sizeof (char);
+                       xfree (outp);
+               } else if (type == 2) {
+                       if (_tcslen (out) >= IPC_BUFFER_SIZE)
+                               out[IPC_BUFFER_SIZE - 1] = 0;
+                       _tcscpy ((TCHAR*)ipc->outbuf, out);
+                       outlen = _tcsclen ((TCHAR*)ipc->outbuf) + sizeof (TCHAR);
+               } else {
+                       ua_copy ((uae_char*)ipc->outbuf, sizeof ipc->outbuf, out);
+                       outlen = strlen ((char*)ipc->outbuf) + sizeof (char);
+               }
                memset (&ipc->ol, 0, sizeof (OVERLAPPED));
                ipc->ol.hEvent = ipc->olevent;
-               ok = WriteFile (ipc->hipc, ipc->outbuf, strlen ((char*)ipc->outbuf) + 1, &ret, &ipc->ol);
+               ok = WriteFile (ipc->hipc, ipc->outbuf, outlen, &ret, &ipc->ol);
                err = GetLastError ();
                if (!ok && err != ERROR_IO_PENDING) {
                        write_log (_T("IPC: WriteFile() err=%d\n"), err);
index f391859d00ace1f0d64fe10f278f94e7d413d8c2..c4d2499aed4e89173f2c6ef95fbab2b36eda3574 100644 (file)
--- a/zfile.cpp
+++ b/zfile.cpp
@@ -7,7 +7,6 @@
 *     2002-2007 Toni Wilen
 */
 
-#define ZLIB_WINAPI
 #define RECURSIVE_ARCHIVES 1
 //#define ZFILE_DEBUG
 
@@ -289,7 +288,7 @@ int zfile_gettype (struct zfile *z)
                        return ZFILE_NVR;
                if (strcasecmp (ext, _T("uae")) == 0)
                        return ZFILE_CONFIGURATION;
-               if (strcasecmp (ext, _T("cue")) == 0 || strcasecmp (ext, _T("iso")) == 0 || strcasecmp (ext, _T("ccd")) == 0 || strcasecmp (ext, _T("mds")) == 0)
+               if (strcasecmp (ext, _T("cue")) == 0 || strcasecmp (ext, _T("iso")) == 0 || strcasecmp (ext, _T("ccd")) == 0 || strcasecmp (ext, _T("mds")) == 0 || strcasecmp (ext, _T("chd")) == 0)
                        return ZFILE_CDIMAGE;
        }
        memset (buf, 0, sizeof (buf));
@@ -1139,8 +1138,9 @@ static struct zfile *xz (struct zfile *z, int *retcode)
        if (!iscrc)
                CrcGenerateTable ();
        iscrc = true;
-       if (XzUnpacker_Create (&cx, &allocImp) != SZ_OK)
-               return NULL;
+//     if (XzUnpacker_Create (&cx, &allocImp) != SZ_OK)
+//             return NULL;
+       XzUnpacker_Construct (&cx, &allocImp);
        int outwritten = 0;
        int towrite = 0;
        bool first = true;
index 738c120334759b339cf6fec04742ac8ac76df943..f2b6c950d60b9e69b14139236e5bebb222606d8f 100644 (file)
@@ -42,7 +42,6 @@ static time_t fromdostime (uae_u32 dd)
        tm.tm_mon  = ((dd >> 21) & 0x0f) - 1;
        tm.tm_mday = (dd >> 16) & 0x1f;
        t = mktime (&tm);
-       _tzset ();
        t -= _timezone;
        return t;
 }
@@ -177,6 +176,10 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns
                                                whf = 2;
                                                ft = ZFILE_CDIMAGE;
                                        }
+                                       if (ext && !_tcsicmp (ext, _T(".chd"))) {
+                                               whf = 2;
+                                               ft = ZFILE_CDIMAGE;
+                                       }
                                        if (ext && !_tcsicmp (ext, _T(".ccd"))) {
                                                whf = 9;
                                                ft = ZFILE_CDIMAGE;