hrtmem_lget, hrtmem_wget, hrtmem_bget,
hrtmem_lput, hrtmem_wput, hrtmem_bput,
hrtmem_xlate, hrtmem_check, NULL, "HRTMon memory",
+ hrtmem_lget, hrtmem_wget, ABFLAG_RAM
};
static void copyfromamiga(uae_u8 *dst,uaecptr src,int len)
arrom_lget, arrom_wget, arrom_bget,
arrom_lput, arrom_wput, arrom_bput,
arrom_xlate, arrom_check, NULL, "Action Replay ROM",
+ arrom_lget, arrom_wget, ABFLAG_ROM
};
static addrbank arram_bank = {
arram_lget, arram_wget, arram_bget,
arram_lput, arram_wput, arram_bput,
arram_xlate, arram_check, NULL, "Action Replay RAM",
+ arram_lget, arram_wget, ABFLAG_RAM
};
static void action_replay_unmap_banks()
static addrbank arcadia_boot_bank = {
arbb_lget, arbb_wget, arbb_bget,
arbb_lput, arbb_wput, arbb_bput,
- default_xlate, default_check, NULL, "Arcadia BIOS"
+ default_xlate, default_check, NULL, "Arcadia BIOS",
+ arbb_lget, arbb_wget, ABFLAG_ROM
};
static uae_u32 REGPARAM2 arb_lget (uaecptr addr)
static addrbank arcadia_rom_bank = {
arb_lget, arb_wget, arb_bget,
arb_lput, arb_wput, arb_bput,
- default_xlate, default_check, NULL, "Arcadia Game ROM"
+ default_xlate, default_check, NULL, "Arcadia Game ROM",
+ arb_lget, arb_wget, ABFLAG_ROM
};
int is_arcadia_rom (char *path)
audio_activate();
}
- if (audio_work_to_do > 0) {
+ if (audio_work_to_do > 0 && currprefs.sound_auto) {
audio_work_to_do--;
if (audio_work_to_do == 0)
audio_deactivate();
addrbank rtarea_bank = {
rtarea_lget, rtarea_wget, rtarea_bget,
rtarea_lput, rtarea_wput, rtarea_bput,
- rtarea_xlate, default_check, NULL, "UAE Boot ROM"
+ rtarea_xlate, default_check, NULL, "UAE Boot ROM",
+ rtarea_lget, rtarea_wget, ABFLAG_ROMIN
};
uae_u8 *REGPARAM2 rtarea_xlate (uaecptr addr)
bltstate = BLT_done;
blitter_done_notify ();
INTREQ(0x8040);
- eventtab[ev_blitter].active = 0;
+ event2_remevent(ev2_blitter);
unset_special (®s, SPCFLAG_BLTNASTY);
#ifdef BLITTER_DEBUG
write_log ("vpos=%d, cycles %d, missed %d, total %d\n",
}
}
-void blitter_handler(void)
+void blitter_handler(uae_u32 data)
{
static int blitter_stuck;
+
if (!dmaen(DMA_BLITTER)) {
- eventtab[ev_blitter].active = 1;
- eventtab[ev_blitter].oldcycles = get_cycles ();
- eventtab[ev_blitter].evtime = 10 * CYCLE_UNIT + get_cycles (); /* wait a little */
+ event2_newevent (ev2_blitter, 10);
blitter_stuck++;
if (blitter_stuck < 20000 || !currprefs.immediate_blits)
return; /* gotta come back later. */
}
blitter_stuck = 0;
if (blit_slowdown > 0 && !currprefs.immediate_blits) {
- eventtab[ev_blitter].active = 1;
- eventtab[ev_blitter].oldcycles = get_cycles ();
- eventtab[ev_blitter].evtime = blit_slowdown * CYCLE_UNIT + get_cycles ();
+ event2_newevent (ev2_blitter, blit_slowdown);
blit_slowdown = -1;
return;
}
blit_diag = blitfill ? blit_cycle_diagram_fill[blit_ch] : blit_cycle_diagram[blit_ch];
}
if ((bltcon1 & 0x80) && (currprefs.chipset_mask & CSMASK_ECS_AGNUS))
- write_log("warning: BLTCON1 DOFF-bit set\n");
+ write_log("warning: ECS BLTCON1 DOFF-bit set\n");
ddat1use = ddat2use = 0;
blit_dmacount = blit_dmacount2 = 0;
{
if (bltstate == BLT_done)
return;
- if (bltcon)
- blit_bltset (bltcon);
+ if (bltcon) {
+ if (bltstate != BLT_work)
+ blit_bltset (bltcon);
+ }
blit_modset ();
}
blit_last_hpos = hpos;
blit_cyclecounter = 0;
- reset_blit (1|2);
+ blit_bltset (1|2);
+ blit_modset ();
if (blitline) {
blitsing = bltcon1 & 0x2;
blitonedot = 0;
cycles = blt_info.vblitsize;
} else {
- blit_firstline_cycles = blit_first_cycle + blit_diag[1] * blt_info.hblitsize * CYCLE_UNIT;
+ blit_firstline_cycles = blit_first_cycle + (blit_diag[1] * blt_info.hblitsize + cpu_cycles) * CYCLE_UNIT;
cycles = blt_info.vblitsize * blt_info.hblitsize;
}
if (currprefs.immediate_blits)
cycles = 1;
- eventtab[ev_blitter].active = 1;
- eventtab[ev_blitter].oldcycles = get_cycles ();
- eventtab[ev_blitter].evtime = cycles * blit_diag[1] * CYCLE_UNIT + get_cycles ();
- events_schedule();
+ event2_newevent(ev2_blitter, cycles * blit_diag[1]);
}
-
void maybe_blit (int hpos, int hack)
{
static int warned;
goto end;
}
- if (!eventtab[ev_blitter].active)
- write_log ("FOO!!?\n");
if (hack == 1 && get_cycles() < blit_firstline_cycles)
goto end;
- blitter_handler ();
+ blitter_handler (0);
end:;
#ifdef BLITTER_DEBUG
- blitter_delayed_debug = 1;
+ blitter_delayed_debug = 1;
#endif
}
if ((unsigned int) (sd - 1) >= (unsigned int) sb->dtablesize) {
TRACE (("Invalid Socket Descriptor (%d)\n", sd));
bsdsocklib_seterrno (sb, 38); /* ENOTSOCK */
-
return -1;
}
- if (sb->dtable[sd -1] == INVALID_SOCKET)
- {
- struct socketbase *sb1,*nsb;
- // Fix for Newsrog (All Tasks of Newsrog using the same dtable)
- for (sb1 = socketbases; sb1; sb1 = nsb)
- {
- if (strcmp(get_real_address (get_long (sb1->ownertask + 10)),get_real_address (get_long (sb->ownertask + 10))) == 0)
- { // Task with same name already exists -> use same dtable
- if (sb1->dtable[sd-1] != INVALID_SOCKET)
- return sb1->dtable[sd-1];
- }
-
- nsb = sb1->next;
- }
- }
+ if (sb->dtable[sd - 1] == INVALID_SOCKET) {
+ struct socketbase *sb1,*nsb;
+ // Fix for Newsrog (All Tasks of Newsrog using the same dtable)
+ for (sb1 = socketbases; sb1; sb1 = nsb) {
+ if (strcmp(get_real_address (get_long (sb1->ownertask + 10)), get_real_address (get_long (sb->ownertask + 10))) == 0) {
+ // Task with same name already exists -> use same dtable
+ if (sb1->dtable[sd - 1] != INVALID_SOCKET)
+ return sb1->dtable[sd - 1];
+ }
+ nsb = sb1->next;
+ }
+ }
return sb->dtable[sd - 1];
}
unlocksigqueue ();
- INTREQ (0xA000);
+ INTREQ (0x8000 | 0x2000);
}
static uae_u32 REGPARAM2 bsdsock_int_handler (TrapContext *context)
TRACE (("ERRNOSTRPTR),invalid"));
} else {
unsigned long ulTmp;
- if (currtag & 0x8000)
- { /* SBTM_GETREF */
- ulTmp = get_long(currval);
- }
- else
- { /* SBTM_GETVAL */
- ulTmp = currval;
- }
+ if (currtag & 0x8000) { /* SBTM_GETREF */
+ ulTmp = get_long(currval);
+ } else { /* SBTM_GETVAL */
+ ulTmp = currval;
+ }
TRACE (("ERRNOSTRPTR),%d", ulTmp));
- if (ulTmp < number_sys_error)
- {
- tagcopy (currtag, currval, tagptr, &errnotextptrs[ulTmp]);
- }
- else
- {
- tagcopy (currtag, currval, tagptr, &strErrptr);
- }
+ if (ulTmp < number_sys_error) {
+ tagcopy (currtag, currval, tagptr, &errnotextptrs[ulTmp]);
+ } else {
+ tagcopy (currtag, currval, tagptr, &strErrptr);
+ }
}
break;
case SBTC_HERRNOSTRPTR:
TRACE (("HERRNOSTRPTR),invalid"));
} else {
unsigned long ulTmp;
- if (currtag & 0x8000)
- { /* SBTM_GETREF */
- ulTmp = get_long(currval);
- }
- else
- { /* SBTM_GETVAL */
- ulTmp = currval;
- }
+ if (currtag & 0x8000) { /* SBTM_GETREF */
+ ulTmp = get_long(currval);
+ } else { /* SBTM_GETVAL */
+ ulTmp = currval;
+ }
TRACE (("HERRNOSTRPTR),%d", ulTmp));
- if (ulTmp < number_host_error)
- {
- tagcopy (currtag, currval, tagptr, &herrnotextptrs[ulTmp]);
- }
- else
- {
- tagcopy (currtag, currval, tagptr, &strErrptr);
- }
+ if (ulTmp < number_host_error) {
+ tagcopy (currtag, currval, tagptr, &herrnotextptrs[ulTmp]);
+ } else {
+ tagcopy (currtag, currval, tagptr, &strErrptr);
+ }
}
break;
case SBTC_ERRNOBYTEPTR:
int catweasel_read_mouse(int port, int *dx, int *dy, int *buttons)
{
- return 0;
if (!cwc.can_mouse)
return 0;
*dx = mouse_x[port];
ioport_write (cwc.iobase + 3, 65);
}
-int catweasel4_configure(void)
+static int catweasel3_configure(void)
+{
+ ioport_write (cwc.iobase, 241);
+ ioport_write (cwc.iobase + 1, 0);
+ ioport_write (cwc.iobase + 2, 0);
+ ioport_write (cwc.iobase + 4, 0);
+ ioport_write (cwc.iobase + 5, 0);
+ ioport_write (cwc.iobase + 0x29, 0);
+ ioport_write (cwc.iobase + 0x2b, 0);
+ return 1;
+}
+
+static int catweasel4_configure(void)
{
struct zfile *f;
+ time_t t;
ioport_write (cwc.iobase, 241);
ioport_write (cwc.iobase + 1, 0);
ioport_write (cwc.iobase + 5, 0);
ioport_write (cwc.iobase + 0x29, 0);
ioport_write (cwc.iobase + 0x2b, 0);
+ sleep_millis(10);
if (cw_config_done()) {
write_log ("CW: FPGA already configured, skipping core upload\n");
- goto ok;
+ return 1;
}
cw_resetFPGA();
sleep_millis(10);
f = zfile_gunzip (f);
}
write_log ("CW: starting core upload, this will take few seconds\n");
+ t = time(NULL) + 10; // give up if upload takes more than 10s
for (;;) {
uae_u8 b;
if (zfile_fread (&b, 1, 1, f) != 1)
break;
ioport_write (cwc.iobase + 3, (b & 1) ? 67 : 65);
- while (!cw_fpga_ready());
+ while (!cw_fpga_ready()) {
+ if (time(NULL) >= t) {
+ write_log ("CW: FPGA core upload got stuck!?\n");
+ cw_resetFPGA();
+ return 0;
+ }
+ }
ioport_write (cwc.iobase + 192, b);
}
if (!cw_config_done()) {
}
sleep_millis(10);
write_log ("CW: core uploaded successfully\n");
-ok:
return 1;
}
#define PCI_CW_MK4 "PCI\\VEN_E159&DEV_0001&SUBSYS_00035213"
#define PCI_CW_MK4_BUG "PCI\\VEN_E159&DEV_0001&SUBSYS_00025213"
-extern int os_64bit;
+extern int os_winnt;
int force_direct_catweasel;
static int direct_detect(void)
{
int devIndex;
int cw = 0;
- if (!os_64bit && !force_direct_catweasel)
+ if (!os_winnt)
return 0;
devs = SetupDiGetClassDevsEx(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT, NULL, NULL, NULL);
if (devs == INVALID_HANDLE_VALUE)
}
}
SetupDiDestroyDeviceInfoList(devs);
+ if (cw) {
+ if (!ioport_init ())
+ cw = 0;
+ }
return cw;
}
int i, len;
uae_u8 buffer[10000];
uae_u32 model, base;
+ int detect = 0;
if (cwc.type)
return 1;
- catweasel_detect();
- if (currprefs.catweasel >= 100) {
- cwc.type = currprefs.catweasel >= 0x400 ? 3 : 1;
- cwc.iobase = currprefs.catweasel;
- if (!ioport_init())
- goto fail;
- strcpy(name, "[DIRECT]");
+ if (force_direct_catweasel >= 100) {
+
+ cwc.iobase = force_direct_catweasel & 0xffff;
+ if (force_direct_catweasel > 0xffff) {
+ cwc.direct_type = force_direct_catweasel >> 16;
+ } else {
+ cwc.direct_type = force_direct_catweasel >= 0x400 ? 3 : 1;
+ }
} else {
if (handle != INVALID_HANDLE_VALUE || currprefs.catweasel > 0)
break;
}
- if (handle == INVALID_HANDLE_VALUE) {
- strcpy(name, "[DIRECT]");
- if (ioport_init()) {
- if (cwc.direct_type == 4) {
- if (catweasel4_configure()) {
- cwc.type = 4;
- cwc.can_joy = 2;
- cwc.can_sid = 2;
- cwc.can_kb = 1;
- cwc.can_mouse = 2;
- }
- } else if (cwc.direct_type == 3) {
- cwc.type = 3;
- cwc.can_joy = 1;
- cwc.can_sid = 1;
- cwc.can_kb = 1;
- cwc.can_mouse = 0;
- }
- }
- if (cwc.type == 0) {
- write_log ("CW: No Catweasel detected\n");
- goto fail;
+ if (handle == INVALID_HANDLE_VALUE)
+ catweasel_detect();
+ }
+
+ if (handle == INVALID_HANDLE_VALUE) {
+ strcpy(name, "[DIRECT]");
+ if (cwc.direct_type && ioport_init()) {
+ if (cwc.direct_type == 4 && catweasel4_configure()) {
+ cwc.type = 4;
+ cwc.can_joy = 2;
+ cwc.can_sid = 2;
+ cwc.can_kb = 1;
+ cwc.can_mouse = 2;
+ } else if (cwc.direct_type == 3 && catweasel3_configure()) {
+ cwc.type = 3;
+ cwc.can_joy = 1;
+ cwc.can_sid = 1;
+ cwc.can_kb = 1;
+ cwc.can_mouse = 0;
}
}
+ if (cwc.type == 0) {
+ write_log ("CW: No Catweasel detected\n");
+ goto fail;
+ }
}
if (!cwc.direct_type) {
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (handle != INVALID_HANDLE_VALUE) {
CloseHandle (handle);
- break;
+ write_log("CW: Windows driver device detected '%s'\n", name);
+ detected = 1;
+ return TRUE;
}
}
if (handle == INVALID_HANDLE_VALUE) {
+ if (force_direct_catweasel >= 100) {
+ if (ioport_init())
+ return TRUE;
+ return FALSE;
+ }
if (direct_detect()) {
detected = 1;
return TRUE;
}
}
- detected = 1;
- return TRUE;
+ return FALSE;
}
#define outb(v,port) catweasel_do_bput(port,v)
addrbank dmac_bank = {
dmac_lget, dmac_wget, dmac_bget,
dmac_lput, dmac_wput, dmac_bput,
- default_xlate, default_check, NULL, "DMAC"
+ default_xlate, default_check, NULL, "DMAC",
+ dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
return 0;
/* emulate buggy TODMED counter.
* it counts: .. 29 2A 2B 2C 2D 2E 2F 20 30 31 32 ..
- * (0F->00->10 only takes couple of cycles but it will trigger alarm..
+ * (2F->20->30 only takes couple of cycles but it will trigger alarm..
*/
if (tod & 0x000fff)
return 0;
static uae_u32 REGPARAM3 cia_lget (uaecptr) REGPARAM;
static uae_u32 REGPARAM3 cia_wget (uaecptr) REGPARAM;
static uae_u32 REGPARAM3 cia_bget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 cia_lgeti (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 cia_wgeti (uaecptr) REGPARAM;
static void REGPARAM3 cia_lput (uaecptr, uae_u32) REGPARAM;
static void REGPARAM3 cia_wput (uaecptr, uae_u32) REGPARAM;
static void REGPARAM3 cia_bput (uaecptr, uae_u32) REGPARAM;
addrbank cia_bank = {
cia_lget, cia_wget, cia_bget,
cia_lput, cia_wput, cia_bput,
- default_xlate, default_check, NULL, "CIA"
+ default_xlate, default_check, NULL, "CIA",
+ cia_lgeti, cia_wgeti, ABFLAG_IO
};
return v;
}
+static uae_u32 REGPARAM2 cia_wgeti (uaecptr addr)
+{
+ if (currprefs.cpu_level >= 2)
+ return dummy_wgeti(addr);
+ return cia_wget(addr);
+}
+static uae_u32 REGPARAM2 cia_lgeti (uaecptr addr)
+{
+ if (currprefs.cpu_level >= 2)
+ return dummy_lgeti(addr);
+ return cia_lget(addr);
+}
+
void REGPARAM2 cia_bput (uaecptr addr, uae_u32 value)
{
int r = (addr & 0xf00) >> 8;
addrbank clock_bank = {
clock_lget, clock_wget, clock_bget,
clock_lput, clock_wput, clock_bput,
- default_xlate, default_check, NULL, "Battery backed up clock"
+ default_xlate, default_check, NULL, "Battery backed up clock",
+ dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
uae_u32 REGPARAM2 clock_lget (uaecptr addr)
static int rpt_did_reset;
struct ev eventtab[ev_max];
+struct ev2 eventtab2[ev2_max];
volatile frame_time_t vsynctime, vsyncmintime;
uae_u16 vtotal = MAXVPOS_PAL, htotal = MAXHPOS_PAL;
static uae_u16 hsstop, hbstrt, hbstop, vsstop, vbstrt, vbstop, hsstrt, vsstrt, hcenter;
static int interlace_started;
+static int ciavsyncmode;
#define HSYNCTIME (maxhpos * CYCLE_UNIT);
*/
/* Used also by bebox.cpp */
-unsigned long int frametime = 0, lastframetime = 0, timeframes = 0, hsync_counter = 0;
+unsigned long int frametime = 0, lastframetime = 0, timeframes = 0;
+unsigned long hsync_counter = 0, vsync_counter = 0, ciavsync_counter = 0;
unsigned long int idletime;
int bogusframe;
changed_prefs.chipset_refreshrate = abs (currprefs.gfx_refreshrate);
}
+ ciavsyncmode = 0;
beamcon0 = new_beamcon0;
isntsc = beamcon0 & 0x20 ? 0 : 1;
if (hack_vpos > 0) {
minfirstline = 2;
sprite_vblank_endline = minfirstline - 2;
dumpsync();
+ ciavsyncmode = 1;
}
/* limit to sane values */
if (vblank_hz < 10)
static void COPJMP (int num)
{
- int was_active = eventtab[ev_copper].active;
int oldstrobe = cop_state.strobe;
- eventtab[ev_copper].active = 0;
if (nocustom()) {
immediate_copper (num);
return;
}
- if (was_active)
- events_schedule ();
unset_special (®s, SPCFLAG_COPPER);
cop_state.ignore_next = 0;
newcop = (dmacon & DMA_COPPER) && (dmacon & DMA_MASTER);
if (oldcop != newcop) {
- eventtab[ev_copper].active = 0;
if (newcop && !oldcop) {
compute_spcflag_copper ();
} else if (!newcop) {
events_schedule();
}
-#define INTDELAY
-
-static int intlev_2 (void)
+int intlev (void)
{
uae_u16 imask = intreq & intena;
- unsigned long cycles = get_cycles ();
- int c = 4;
- int i;
-
- if (!(imask && (intena & 0x4000))) {
- unset_special (®s, SPCFLAG_INT);
+ if (!(imask && (intena & 0x4000)))
return -1;
- }
- for (i = 14; i >= 0; i--) {
- if (imask & (1 << i)) {
-#ifdef INTDELAY
- if (!(irqdelay[i] && (cycles - irqcycles[i]) < c * CYCLE_UNIT)) {
-#endif
- irqdelay[i] = 0;
- if (i == 13 || i == 14)
- return 6;
- else if (i == 11 || i == 12)
- return 5;
- else if (i >= 7 && i <= 10)
- return 4;
- else if (i >= 4 && i <= 6)
- return 3;
- else if (i == 3)
- return 2;
- else
- return 1;
- }
-#ifdef INTDELAY
- }
-#endif
- }
+ if (imask & (0x4000 | 0x2000)) // 13 14
+ return 6;
+ if (imask & (0x1000 | 0x0800)) // 11 12
+ return 5;
+ if (imask & (0x0400 | 0x0200 | 0x0100 | 0x0080)) // 7 8 9 10
+ return 4;
+ if (imask & (0x0040 | 0x0020 | 0x0010)) // 4 5 6
+ return 3;
+ if (imask & 0x0008) // 3
+ return 2;
+ if (imask & (0x0001 | 0x0002 | 0x0004)) // 0 1 2
+ return 1;
return -1;
}
-int intlev (void)
-{
- int il = -1;
-#ifdef JIT
- if (currprefs.cachesize) {
- uae_u16 imask = intreq & intena;
- if (imask && (intena & 0x4000)) {
- if (imask & 0x6000)
- il = 6;
- if (imask & 0x1800)
- il = 5;
- if (imask & 0x0780)
- il = 4;
- if (imask & 0x0070)
- il = 3;
- if (imask & 0x0008)
- il = 2;
- if (imask & 0x0007)
- il = 1;
- }
- } else {
-#endif
- il = intlev_2 ();
- if (il >= 0 && il <= regs.intmask)
- unset_special (®s, SPCFLAG_INT);
-#ifdef JIT
- }
-#endif
- return il;
-}
-
-static void doint (void)
+static void INTENA_f(uae_u32 data)
{
- int i;
- uae_u16 imask;
-
- set_special (®s, SPCFLAG_INT);
-#ifdef JIT
- if (currprefs.cachesize)
- return;
-#endif
- imask = intreq & intena;
- if (imask && (intena & 0x4000)) {
- for (i = 0; i < 15; i++) {
- if ((imask & (1 << i)) && irqdelay[i] == 0) {
- irqdelay[i] = 1;
- irqcycles[i] = get_cycles ();
- }
- }
- }
+ doint();
}
-
STATIC_INLINE void INTENA (uae_u16 v)
{
setclr (&intena,v);
if (v & 0x40)
write_log("INTENA %04.4X (%04.4X) %p\n", intena, v, M68K_GETPC);
#endif
- if (v & 0x8000)
- doint ();
+ if (v & 0x8000) {
+ if (!currprefs.cpu_compatible > 0)
+ INTENA_f(0);
+ else
+ event2_newevent2 (6, 0, INTENA_f);
+ }
}
void INTREQ_0 (uae_u16 v)
{
- int i;
if (v & (0x80|0x100|0x200|0x400))
audio_update_irq (v);
setclr (&intreq, v);
- if (!(v & 0x8000)) {
- for (i = 0; i < 15; i++) {
- if (v & (1 << i))
- irqdelay[i] = 0;
- }
- }
doint ();
}
-void INTREQ (uae_u16 v)
+static void INTREQ_f(uae_u32 data)
{
-#if 0
- if ((v & (0xc000)) == 0xc000)
- write_log("%d INTREQ %04.4X (%04.4X) %x %x %x\n",
- vpos, intreq, v, M68K_GETPC, cop1lc, cop2lc);
-#endif
- INTREQ_0 (v);
+ INTREQ_0 (data);
serial_check_irq ();
rethink_cias ();
}
+void INTREQ (uae_u16 v)
+{
+ if (!currprefs.cpu_compatible)
+ INTREQ_f(v);
+ else
+ event2_newevent2(6, v, INTREQ_f);
+}
+
static void ADKCON (int hpos, uae_u16 v)
{
if (currprefs.produce_sound > 0)
blt_info.vblitsize = v >> 6;
blt_info.hblitsize = v & 0x3F;
- if (!blt_info.vblitsize) blt_info.vblitsize = 1024;
- if (!blt_info.hblitsize) blt_info.hblitsize = 64;
+ if (!blt_info.vblitsize)
+ blt_info.vblitsize = 1024;
+ if (!blt_info.hblitsize)
+ blt_info.hblitsize = 64;
do_blitter (current_hpos());
}
error, vpos, until_hpos);
write_log("cvcmp=%d chcmp=%d chpos=%d cvpos=%d ci1=%04.4X ci2=%04.4X\n",
cop_state.vcmp,cop_state.hcmp,cop_state.hpos,cop_state.vpos,cop_state.saved_i1,cop_state.saved_i2);
- write_log("cstate=%d ip=%08.8X ev_copper=%d\n",
- cop_state.state,cop_state.ip,eventtab[ev_copper].active);
+ write_log("cstate=%d ip=%08.8X\n",
+ cop_state.state,cop_state.ip);
}
static void update_copper (int until_hpos)
int vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80);
int c_hpos = cop_state.hpos;
- if (nocustom()) {
- eventtab[ev_copper].active = 0;
- return;
- }
-
- if (eventtab[ev_copper].active) {
- dump_copper ("error1",until_hpos);
- eventtab[ev_copper].active = 0;
+ if (nocustom())
return;
- }
-
+
if (cop_state.state == COP_wait && vp < cop_state.vcmp) {
dump_copper ("error2",until_hpos);
- eventtab[ev_copper].active = 0;
copper_enabled_thisline = 0;
return;
}
case COP_skip1:
{
- static int skipped_before;
unsigned int vcmp, hcmp, vp1, hp1;
- if (! skipped_before) {
- skipped_before = 1;
- write_log ("Program uses Copper SKIP instruction.\n");
- }
-
if (c_hpos >= (maxhpos & ~1))
break;
return;
}
copper_enabled_thisline = 1;
-
- if (! eventtab[ev_copper].active)
- set_special (®s, SPCFLAG_COPPER);
+ set_special (®s, SPCFLAG_COPPER);
}
static void copper_handler (void)
{
/* This will take effect immediately, within the same cycle. */
set_special (®s, SPCFLAG_COPPER);
-
if (! copper_enabled_thisline)
uae_abort ("copper_handler");
-
- eventtab[ev_copper].active = 0;
}
void blitter_done_notify (void)
STATIC_INLINE void sync_copper_with_cpu (int hpos, int do_schedule)
{
/* Need to let the copper advance to the current position. */
- if (eventtab[ev_copper].active) {
- eventtab[ev_copper].active = 0;
- if (do_schedule)
- events_schedule ();
- set_special (®s, SPCFLAG_COPPER);
- }
if (copper_enabled_thisline)
update_copper (hpos);
}
lof_changed = 0;
- eventtab[ev_copper].active = 0;
COPJMP (1);
init_hardware_frame ();
if (cop_state.state == COP_wait) {
int vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80);
if (vp < cop_state.vcmp) {
- if (eventtab[ev_copper].active || copper_enabled_thisline)
- write_log ("COPPER BUG %d: vp=%d vpos=%d vcmp=%d act=%d thisline=%d\n", n, vp, vpos, cop_state.vcmp, eventtab[ev_copper].active, copper_enabled_thisline);
+ if (copper_enabled_thisline)
+ write_log ("COPPER BUG %d: vp=%d vpos=%d vcmp=%d act=%d thisline=%d\n", n, vp, vpos, cop_state.vcmp, copper_enabled_thisline);
}
}
}
+static void CIA_vsync_prehandler(void)
+{
+ CIA_vsync_handler ();
+#if 0
+ if (input_recording > 0) {
+ inprec_rstart(INPREC_CIAVSYNC);
+ inprec_ru32(ciavsync_counter);
+ inprec_rend();
+ } else if (input_recording < 0) {
+ uae_u32 v = -1;
+ while (inprec_pstart(INPREC_CIAVSYNC)) {
+ v = inprec_pu32();
+ inprec_pend();
+ }
+ if (v != ciavsync_counter)
+ write_log("INPREC: ciavsync sync error %d <> %d\n", v, ciavsync_counter);
+ }
+#endif
+ ciavsync_counter++;
+}
+
static void hsync_handler (void)
{
- static int ciahsync;
int hpos = current_hpos ();
if (!nocustom()) {
picasso_handle_hsync ();
#endif
- ciahsync++;
- if (ciahsync >= (currprefs.ntscmode ? MAXVPOS_NTSC : MAXVPOS_PAL) * MAXHPOS_PAL / maxhpos) { /* not so perfect.. */
- CIA_vsync_handler ();
- ciahsync = 0;
+ if (ciavsyncmode) {
+ static int ciahsync;
+ ciahsync++;
+ if (ciahsync >= (currprefs.ntscmode ? MAXVPOS_NTSC : MAXVPOS_PAL) * MAXHPOS_PAL / maxhpos) { /* not so perfect.. */
+ CIA_vsync_prehandler ();
+ ciahsync = 0;
+ }
}
if ((currprefs.chipset_mask & CSMASK_AGA) || (!currprefs.chipset_mask & CSMASK_ECS_AGNUS))
- last_custom_value = rand ();
+ last_custom_value = uaerand ();
else
last_custom_value = 0xffff;
}
vpos = 0;
vsync_handler ();
+#if 0
+ if (input_recording > 0) {
+ inprec_rstart(INPREC_VSYNC);
+ inprec_ru32(vsync_counter);
+ inprec_rend();
+ } else if (input_recording < 0) {
+ uae_u32 v = -1;
+ while (inprec_pstart(INPREC_VSYNC)) {
+ v = inprec_pu32();
+ inprec_pend();
+ }
+ if (v != vsync_counter)
+ write_log("INPREC: vsync sync error %d <> %d\n", v, vsync_counter);
+ }
+#endif
+ vsync_counter++;
+ if (!ciavsyncmode)
+ CIA_vsync_prehandler();
}
DISK_hsync (maxhpos);
#endif
if (!nocustom()) {
+ int lineno = vpos;
if (bplcon0 & 4)
notice_interlace_seen ();
- if (!nodraw ()) {
- int lineno = vpos;
- nextline_how = nln_normal;
- if (currprefs.gfx_linedbl) {
- lineno *= 2;
- nextline_how = currprefs.gfx_linedbl == 1 ? nln_doubled : nln_nblack;
- if (bplcon0 & 4) {
- if (!lof) {
- lineno++;
- nextline_how = nln_lower;
- } else {
- nextline_how = nln_upper;
- }
+ nextline_how = nln_normal;
+ if (currprefs.gfx_linedbl) {
+ lineno *= 2;
+ nextline_how = currprefs.gfx_linedbl == 1 ? nln_doubled : nln_nblack;
+ if (bplcon0 & 4) {
+ if (!lof) {
+ lineno++;
+ nextline_how = nln_lower;
+ } else {
+ nextline_how = nln_upper;
}
}
- next_lineno = lineno;
- reset_decisions ();
}
+ next_lineno = lineno;
+ reset_decisions ();
}
#ifdef FILESYS
#endif
while (input_recording < 0 && inprec_pstart(INPREC_KEY)) {
- record_key_direct (inprec_pu8());
- inprec_pend();
+ record_key_direct (inprec_pu8());
+ inprec_pend();
}
while (input_recording < 0 && inprec_pstart(INPREC_DISKREMOVE)) {
- disk_eject (inprec_pu8());
- inprec_pend();
+ disk_eject (inprec_pu8());
+ inprec_pend();
}
while (input_recording < 0 && inprec_pstart(INPREC_DISKINSERT)) {
- int drv = inprec_pu8();
- inprec_pstr (currprefs.df[drv]);
- strcpy (changed_prefs.df[drv], currprefs.df[drv]);
- disk_insert_force (drv, currprefs.df[drv]);
- inprec_pend();
+ int drv = inprec_pu8();
+ inprec_pstr (currprefs.df[drv]);
+ strcpy (changed_prefs.df[drv], currprefs.df[drv]);
+ disk_insert_force (drv, currprefs.df[drv]);
+ inprec_pend();
}
+
inputdevice_hsync ();
hsync_counter++;
//copper_check (2);
}
+#if 0
+ unsigned long int mintime = ~0L;
+ for (i = 0; i < ev_max; i++) {
+ if (eventtab[i].active) {
+ unsigned long int eventtime = eventtab[i].evtime - currcycle;
+#ifdef EVENT_DEBUG
+ if (eventtime == 0) {
+ write_log("event %d bug\n",i);
+ }
+#endif
+ if (eventtime < mintime)
+ mintime = eventtime;
+ }
+ }
+ nextevent = currcycle + mintime;
+#endif
+
+static void MISC_handler(void)
+{
+ int i, recheck;
+ evt mintime;
+ evt ct = get_cycles();
+ static int recursive;
+
+ if (recursive)
+ return;
+ recursive++;
+ eventtab[ev_misc].active = 0;
+ recheck = 1;
+ while (recheck) {
+ recheck = 0;
+ mintime = ~0L;
+ for (i = 0; i < ev2_max; i++) {
+ if (eventtab2[i].active) {
+ if (eventtab2[i].evtime == ct) {
+ eventtab2[i].active = 0;
+ eventtab2[i].handler(eventtab2[i].data);
+ if (eventtab2[i].active)
+ recheck = 1;
+ } else {
+ evt eventtime = eventtab2[i].evtime - ct;
+ if (eventtime < mintime)
+ mintime = eventtime;
+ }
+ }
+ }
+ }
+ if (mintime != ~0L) {
+ eventtab[ev_misc].active = 1;
+ eventtab[ev_misc].oldcycles = ct;
+ eventtab[ev_misc].evtime = ct + mintime;
+ events_schedule();
+ }
+ recursive--;
+}
+
+STATIC_INLINE void event2_newevent_x(int no, evt t, uae_u32 data, evfunc2 func)
+{
+ evt et = t * CYCLE_UNIT + get_cycles();
+
+ if (no < 0) {
+ for (no = ev2_misc; no < ev2_max; no++) {
+ if (!eventtab2[no].active)
+ break;
+ if (eventtab2[no].evtime == et && eventtab2[no].handler == func) {
+ eventtab2[no].handler(eventtab2[no].data);
+ break;
+ }
+ }
+ if (no == ev2_max) {
+ write_log("out of event2's! PC=%x\n", M68K_GETPC);
+ return;
+ }
+ }
+ eventtab2[no].active = 1;
+ eventtab2[no].evtime = et;
+ eventtab2[no].handler = func;
+ eventtab2[no].data = data;
+ MISC_handler();
+}
+void event2_newevent(int no, evt t)
+{
+ event2_newevent_x(no, t, 0, eventtab2[no].handler);
+}
+void event2_newevent2(evt t, uae_u32 data, evfunc2 func)
+{
+ event2_newevent_x(-1, t, data, func);
+}
+
+void event2_remevent(int no)
+{
+ eventtab2[no].active = 0;
+}
+
void init_eventtab (void)
{
int i;
eventtab[i].active = 0;
eventtab[i].oldcycles = 0;
}
+ for (i = 0; i < ev2_max; i++) {
+ eventtab2[i].active = 0;
+ }
eventtab[ev_cia].handler = CIA_handler;
eventtab[ev_hsync].handler = hsync_handler;
eventtab[ev_hsync].evtime = get_cycles () + HSYNCTIME;
eventtab[ev_hsync].active = 1;
-
- eventtab[ev_copper].handler = copper_handler;
- eventtab[ev_copper].active = 0;
- eventtab[ev_blitter].handler = blitter_handler;
- eventtab[ev_blitter].active = 0;
- eventtab[ev_disk].handler = DISK_handler;
- eventtab[ev_disk].active = 0;
+ eventtab[ev_misc].handler = MISC_handler;
eventtab[ev_audio].handler = audio_evhandler;
- eventtab[ev_audio].active = 0;
+
+ eventtab2[ev2_blitter].handler = blitter_handler;
+ eventtab2[ev2_disk].handler = DISK_handler;
+
events_schedule ();
}
int i;
int zero = 0;
- write_log ("reset at %x\n", m68k_getpc(®s));
+ write_log ("Reset at %08.8X\n", m68k_getpc(®s));
+ memory_map_dump();
hsync_counter = 0;
+ vsync_counter = 0;
+ ciavsync_counter = 0;
lightpen_x = lightpen_y = lightpen_triggered = 0;
lightpen_cx = lightpen_cy = -1;
if (! savestate_state) {
custom_lget, custom_wget, custom_bget,
custom_lput, custom_wput, custom_bput,
default_xlate, default_check, NULL, "Custom chipset",
+ custom_lgeti, custom_wgeti, ABFLAG_IO
};
+static uae_u32 REGPARAM2 custom_wgeti (uaecptr addr)
+{
+ if (currprefs.cpu_level >= 2)
+ return dummy_wgeti(addr);
+ return custom_wget(addr);
+}
+static uae_u32 REGPARAM2 custom_lgeti (uaecptr addr)
+{
+ if (currprefs.cpu_level >= 2)
+ return dummy_lgeti(addr);
+ return custom_lget(addr);
+}
+
STATIC_INLINE uae_u32 REGPARAM2 custom_wget_1 (uaecptr addr, int noput)
{
uae_u16 v;
void custom_prepare_savestate (void)
{
+ int i;
+
+ for (i = 0; i < ev2_max; i++) {
+ if (eventtab2[i].active) {
+ eventtab2[i].active = 0;
+ eventtab2[i].handler(eventtab2[i].data);
+ }
+ }
}
#define RB restore_u8 ()
STATIC_INLINE void sync_copper (int hpos)
{
- if (eventtab[ev_copper].active) {
- eventtab[ev_copper].active = 0;
- update_copper (hpos);
- return;
- }
if (copper_enabled_thisline)
update_copper (hpos);
}
#include "autoconf.h"
#include "akiko.h"
#include "inputdevice.h"
+#include "crc32.h"
static int debugger_active;
static uaecptr skipaddr_start, skipaddr_end;
int exception_debugging;
int debug_copper;
int debug_sprite_mask = 0xff;
+
static uaecptr debug_copper_pc;
extern int audio_channel_mask;
" fl List breakpoints\n"
" fd Remove all breakpoints\n"
" f <addr1> <addr2> Step forward until <addr1> <= PC <= <addr2>\n"
- " e Dump contents of all custom registers\n"
+ " e Dump contents of all custom registers, ea = AGA colors\n"
" i [<addr>] Dump contents of interrupt and trap vectors\n"
" o <0-2|addr> [<lines>]View memory as Copper instructions\n"
" od Enable/disable Copper vpos/hpos tracing\n"
" Cl List currently found trainer addresses\n"
" D Deep trainer\n"
" W <address> <value> Write into Amiga memory\n"
- " w <num> <address> <length> <R/W/RW/F> [<value>]\n"
+ " w <num> <address> <length> <R/W/I/F> [<value>] (read/write/opcode/freeze)\n"
" Add/remove memory watchpoints\n"
" wd Enable illegal access logger\n"
" S <file> <addr> <n> Save a block of Amiga memory\n"
struct memwatch_node {
uaecptr addr;
int size;
- int rw;
+ int rwi;
uae_u32 val;
int val_enabled;
uae_u32 modval;
}
/* add special custom register check here */
-static void illg_debug_check (uaecptr addr, int rw, int size, uae_u32 val)
+static void illg_debug_check (uaecptr addr, int rwi, int size, uae_u32 val)
{
return;
}
-static void illg_debug_do (uaecptr addr, int rw, int size, uae_u32 val)
+static void illg_debug_do (uaecptr addr, int rwi, int size, uae_u32 val)
{
uae_u8 mask;
uae_u32 pc = m68k_getpc (®s);
- char rws = rw ? 'W' : 'R';
int i;
for (i = size - 1; i >= 0; i--) {
uae_u8 v = val >> (i * 8);
uae_u32 ad = addr + i;
if (ad >= 0x1000000)
- mask = 3;
+ mask = 7;
else
mask = illgdebug[ad];
if (!mask)
continue;
if (mask & 0x80) {
- illg_debug_check (ad, rw, size, val);
+ illg_debug_check (ad, rwi, size, val);
} else if ((mask & 3) == 3) {
- if (rw)
- console_out ("RW: %08.8X=%02.2X %c PC=%08.8X\n", ad, v, rws, pc);
- else
- console_out ("RW: %08.8X %c PC=%08.8X\n", ad, rws, pc);
+ if (rwi & 2)
+ console_out ("W: %08.8X=%02.2X PC=%08.8X\n", ad, v, pc);
+ else if (rwi & 1)
+ console_out ("R: %08.8X PC=%08.8X\n", ad, pc);
if (illgdebug_break)
activate_debugger ();
- } else if ((mask & 1) && rw) {
- console_out ("RO: %08.8X=%02.2X %c PC=%08.8X\n", ad, v, rws, pc);
+ } else if ((mask & 1) && (rwi & 1)) {
+ console_out ("RO: %08.8X=%02.2X PC=%08.8X\n", ad, v, pc);
if (illgdebug_break)
activate_debugger ();
- } else if ((mask & 2) && !rw) {
- console_out ("WO: %08.8X %c PC=%08.8X\n", ad, rws, pc);
+ } else if ((mask & 2) && (rwi & 2)) {
+ console_out ("WO: %08.8X PC=%08.8X\n", ad, pc);
if (illgdebug_break)
activate_debugger ();
}
return munge24 (addr) >> 16;
}
-static int memwatch_func (uaecptr addr, int rw, int size, uae_u32 val)
+struct smc_item {
+ uae_u32 addr;
+ uae_u8 cnt;
+};
+
+static int smc_size;
+static struct smc_item *smc_table;
+
+static void smc_reset(void)
+{
+ int i;
+ if (!smc_table)
+ return;
+ for (i = 0; i < smc_size; i++) {
+ smc_table[i].addr = 0xffffffff;
+ smc_table[i].cnt = 0;
+ }
+}
+
+static void smc_detect_init(void)
+{
+ xfree(smc_table);
+ smc_table = NULL;
+ smc_size = 1 << 24;
+ if (currprefs.z3fastmem_size)
+ smc_size = currprefs.z3fastmem_start + currprefs.z3fastmem_size;
+ smc_size += 4;
+ smc_table = xmalloc (smc_size * sizeof (struct smc_item));
+ smc_reset();
+ console_out("SMCD enabled\n");
+}
+
+#define SMC_MAXHITS 8
+static void smc_detector(uaecptr addr, int rwi, int size, uae_u32 *valp)
+{
+ int i, hitcnt;
+ uaecptr hitaddr, hitpc;
+
+ if (!smc_table)
+ return;
+ if (addr >= smc_size)
+ return;
+ if (rwi == 2) {
+ for (i = 0; i < size; i++) {
+ if (smc_table[addr + i].cnt < SMC_MAXHITS) {
+ smc_table[addr + i].addr = m68k_getpc(®s);
+ }
+ }
+ return;
+ }
+ hitpc = smc_table[addr].addr;
+ if (hitpc == 0xffffffff)
+ return;
+ hitaddr = addr;
+ hitcnt = 0;
+ while (addr < smc_size && smc_table[addr].addr != 0xffffffff) {
+ smc_table[addr++].addr = 0xffffffff;
+ hitcnt++;
+ }
+ if ((hitpc & 0xFFF80000) == 0xF80000)
+ return;
+ if (currprefs.cpu_level == 0 && currprefs.cpu_compatible) {
+ /* ignore single-word unconditional jump instructions
+ * (instruction prefetch from PC+2 can cause false positives) */
+ if (regs.irc == 0x4e75 || regs.irc == 4e74 || regs.irc == 0x4e72 || regs.irc == 4e77)
+ return; /* RTS, RTD, RTE, RTR */
+ if ((regs.irc & 0xff00) == 0x6000 && (regs.irc & 0x00ff) != 0 && (regs.irc & 0x00ff) != 0xff)
+ return; /* BRA.B */
+ }
+ if (hitcnt < 100) {
+ smc_table[hitaddr].cnt++;
+ console_out("SMC at %08.8X - %08.8X (%d) from %08.8X\n",
+ hitaddr, hitaddr + hitcnt, hitcnt, hitpc);
+ if (smc_table[hitaddr].cnt >= SMC_MAXHITS)
+ console_out("* hit count >= %d, future hits ignored\n", SMC_MAXHITS);
+ }
+}
+
+static int memwatch_func (uaecptr addr, int rwi, int size, uae_u32 *valp)
{
int i, brk;
+ uae_u32 val = *valp;
if (illgdebug)
- illg_debug_do (addr, rw, size, val);
+ illg_debug_do (addr, rwi, size, val);
addr = munge24 (addr);
+ if (smc_table && (rwi >= 2))
+ smc_detector(addr, rwi, size, valp);
for (i = 0; i < MEMWATCH_TOTAL; i++) {
struct memwatch_node *m = &mwnodes[i];
uaecptr addr2 = m->addr;
uaecptr addr3 = addr2 + m->size;
- int rw2 = m->rw;
+ int rwi2 = m->rwi;
brk = 0;
if (m->size == 0)
continue;
- if (m->val_enabled && m->val != val)
+ if (!m->frozen && m->val_enabled && m->val != val)
continue;
- if (rw != rw2 && rw2 < 2)
+ if (!(rwi & rwi2))
continue;
if (addr >= addr2 && addr < addr3)
brk = 1;
if (!brk && size == 4 && ((addr + 2 >= addr2 && addr + 2 < addr3) || (addr + 3 >= addr2 && addr + 3 < addr3)))
brk = 1;
if (brk && m->modval_written) {
- if (!rw) {
+ if (!rwi) {
brk = 0;
} else if (m->modval_written == 1) {
m->modval_written = 2;
}
}
if (brk) {
- if (m->frozen)
+ if (m->frozen) {
+ if (m->val_enabled)
+ *valp = m->val;
return 0;
+ }
mwhit.addr = addr;
- mwhit.rw = rw;
+ mwhit.rwi = rwi;
mwhit.size = size;
mwhit.val = 0;
- if (mwhit.rw)
+ if (mwhit.rwi & 2)
mwhit.val = val;
memwatch_triggered = i + 1;
debugging = 1;
return 1;
}
-static int mmu_hit (uaecptr addr, int size, int rw, uae_u32 *v);
+static int mmu_hit (uaecptr addr, int size, int rwi, uae_u32 *v);
static uae_u32 REGPARAM2 mmu_lget (uaecptr addr)
{
int off = debug_mem_off (addr);
uae_u32 v;
v = debug_mem_banks[off]->lget(addr);
- memwatch_func (addr, 0, 4, v);
+ memwatch_func (addr, 1, 4, &v);
return v;
}
+static uae_u32 REGPARAM2 mmu_lgeti (uaecptr addr)
+{
+ int off = debug_mem_off (addr);
+ uae_u32 v = 0;
+ if (!mmu_hit(addr, 4, 4, &v))
+ v = debug_mem_banks[off]->lgeti(addr);
+ return v;
+}
+static uae_u32 REGPARAM2 mmu_wgeti (uaecptr addr)
+{
+ int off = debug_mem_off (addr);
+ uae_u32 v = 0;
+ if (!mmu_hit(addr, 2, 4, &v))
+ v = debug_mem_banks[off]->wgeti(addr);
+ return v;
+}
+
static uae_u32 REGPARAM2 debug_wget (uaecptr addr)
{
int off = debug_mem_off (addr);
uae_u32 v;
v = debug_mem_banks[off]->wget(addr);
- memwatch_func (addr, 0, 2, v);
+ memwatch_func (addr, 1, 2, &v);
return v;
}
static uae_u32 REGPARAM2 debug_bget (uaecptr addr)
int off = debug_mem_off (addr);
uae_u32 v;
v = debug_mem_banks[off]->bget(addr);
- memwatch_func (addr, 0, 1, v);
+ memwatch_func (addr, 1, 1, &v);
+ return v;
+}
+static uae_u32 REGPARAM2 debug_lgeti (uaecptr addr)
+{
+ int off = debug_mem_off (addr);
+ uae_u32 v;
+ v = debug_mem_banks[off]->lgeti(addr);
+ memwatch_func (addr, 4, 4, &v);
+ return v;
+}
+static uae_u32 REGPARAM2 debug_wgeti (uaecptr addr)
+{
+ int off = debug_mem_off (addr);
+ uae_u32 v;
+ v = debug_mem_banks[off]->wgeti(addr);
+ memwatch_func (addr, 4, 2, &v);
return v;
}
static void REGPARAM2 debug_lput (uaecptr addr, uae_u32 v)
{
int off = debug_mem_off (addr);
- if (memwatch_func (addr, 1, 4, v))
+ if (memwatch_func (addr, 2, 4, &v))
debug_mem_banks[off]->lput(addr, v);
}
static void REGPARAM2 debug_wput (uaecptr addr, uae_u32 v)
{
int off = debug_mem_off (addr);
- if (memwatch_func (addr, 1, 2, v))
+ if (memwatch_func (addr, 2, 2, &v))
debug_mem_banks[off]->wput(addr, v);
}
static void REGPARAM2 debug_bput (uaecptr addr, uae_u32 v)
{
int off = debug_mem_off (addr);
- if (memwatch_func (addr, 1, 1, v))
+ if (memwatch_func (addr, 2, 1, &v))
debug_mem_banks[off]->bput(addr, v);
}
a2->lput = mode ? mmu_lput : debug_lput;
a2->check = debug_check;
a2->xlateaddr = debug_xlate;
+ a2->wgeti = mode ? mmu_wgeti : debug_wgeti;
+ a2->lgeti = mode ? mmu_lgeti : debug_lgeti;
}
if (mode)
mmu_enabled = 1;
mwn = &mwnodes[i];
if (mwn->size == 0)
continue;
- console_out ("%d: %08.8X - %08.8X (%d) %s",
+ console_out ("%d: %08.8X - %08.8X (%d) %c%c%c",
i, mwn->addr, mwn->addr + (mwn->size - 1), mwn->size,
- mwn->frozen ? "F" : (mwn->rw == 0 ? "R" : (mwn->rw == 1 ? "W" : "RW")));
+ (mwn->rwi & 1) ? 'R' : ' ', (mwn->rwi & 2) ? 'W' : ' ', (mwn->rwi & 4) ? 'I' : ' ');
+ if (mwn->frozen)
+ console_out ("F");
if (mwn->val_enabled)
console_out (" =%X", mwn->val);
if (mwn->modval_written)
}
mwn->addr = readhex (c);
mwn->size = 1;
- mwn->rw = 2;
+ mwn->rwi = 7;
mwn->val_enabled = 0;
mwn->frozen = 0;
mwn->modval_written = 0;
mwn->size = readhex (c);
ignore_ws (c);
if (more_params (c)) {
- char nc = toupper (next_char (c));
- if (nc == 'F')
- mwn->frozen = 1;
- else if (nc == 'W')
- mwn->rw = 1;
- else if (nc == 'R' && toupper(**c) != 'W')
- mwn->rw = 0;
- else if (nc == 'R' && toupper(**c) == 'W')
- next_char (c);
+ for (;;) {
+ char ncc = peek_next_char(c);
+ char nc = toupper (next_char (c));
+ if (mwn->rwi == 7)
+ mwn->rwi = 0;
+ if (nc == 'F')
+ mwn->frozen = 1;
+ if (nc == 'W')
+ mwn->rwi |= 2;
+ if (nc == 'I')
+ mwn->rwi |= 4;
+ if (nc == 'R')
+ mwn->rwi |= 1;
+ if (ncc == ' ')
+ break;
+ if (!more_params(c))
+ break;
+ }
ignore_ws (c);
if (more_params (c)) {
if (toupper(**c) == 'M') {
console_out ("Wrote %x (%u) at %08x.%c\n", val, val, addr, cc);
}
-static void memory_map_dump (void)
+static uae_u8 *dump_xlate(uae_u32 addr)
+{
+ if (!mem_banks[addr >> 16]->check(addr, 1))
+ return NULL;
+ return mem_banks[addr >> 16]->xlateaddr(addr);
+}
+
+static void memory_map_dump_2 (int log)
{
- int i, j, max;
+ int i, j, max, im;
addrbank *a1 = mem_banks[0];
+ char txt[256];
+ im = currprefs.illegal_mem;
+ currprefs.illegal_mem = 0;
max = currprefs.address_space_24 ? 256 : 65536;
j = 0;
for (i = 0; i < max + 1; i++) {
if (i < max)
a2 = mem_banks[i];
if (a1 != a2) {
- char *name = a1->name;
+ int k, mirrored, size;
+ uae_u8 *caddr;
+ char *name;
+ char tmp[MAX_DPATH];
+
+ name = a1->name;
if (name == NULL)
name = "<none>";
- console_out("%08.8X %6dK %s\n", j << 16, (i - j) << (16 - 10), name);
+
+ k = j;
+ caddr = dump_xlate(k << 16);
+ mirrored = caddr ? 1 : 0;
+ k++;
+ while (k < i && caddr) {
+ if (dump_xlate(k << 16) == caddr)
+ mirrored++;
+ k++;
+ }
+ size = (i - j) << (16 - 10);
+ sprintf (txt, "%08.8X %7dK/%d = %7dK %s", j << 16, size, mirrored, mirrored ? size / mirrored : size, name);
+
+ tmp[0] = 0;
+ if (a1->flags == ABFLAG_ROM && mirrored) {
+ char *p = txt + strlen(txt);
+ uae_u32 crc = get_crc32(a1->xlateaddr(j << 16), (size * 1024) / mirrored);
+ struct romdata *rd = getromdatabycrc(crc);
+ sprintf(p, " (%08.8X)", crc);
+ if (rd) {
+ tmp[0] = '=';
+ getromname(rd, tmp + 1);
+ strcat(tmp,"\n");
+ }
+ }
+ strcat(txt,"\n");
+ if (log)
+ write_log (txt);
+ else
+ console_out(txt);
+ if (tmp[0]) {
+ if (log)
+ write_log (tmp);
+ else
+ console_out(tmp);
+ }
j = i;
a1 = a2;
}
}
+ currprefs.illegal_mem = im;
+}
+void memory_map_dump (void)
+{
+ memory_map_dump_2 (1);
}
static void show_exec_tasks (void)
if (*inptr == 'c') {
screenshot (1, 1);
} else if (*inptr == 'm') {
- next_char(&inptr);
- if (more_params(&inptr))
- debug_sprite_mask = readint(&inptr);
- console_out("sprite mask: %02.2X\n", debug_sprite_mask);
+ if (*(inptr + 1) == 'c') {
+ if (!memwatch_enabled)
+ initialize_memwatch(0);
+ if (!smc_table)
+ smc_detect_init();
+ else
+ smc_reset();
+ } else {
+ next_char(&inptr);
+ if (more_params(&inptr))
+ debug_sprite_mask = readint(&inptr);
+ console_out("sprite mask: %02.2X\n", debug_sprite_mask);
+ }
} else {
searchmem (&inptr);
}
next_char(&inptr);
disk_debug(&inptr);
} else if(*inptr == 'm') {
- memory_map_dump();
+ memory_map_dump_2(0);
} else {
uae_u32 daddr;
int count;
}
}
} else {
- console_out ("Memwatch %d: break at %08.8X.%c %c %08.8X\n", memwatch_triggered - 1, mwhit.addr,
- mwhit.size == 1 ? 'B' : (mwhit.size == 2 ? 'W' : 'L'), mwhit.rw ? 'W' : 'R', mwhit.val);
+ console_out ("Memwatch %d: break at %08.8X.%c %c%c%c %08.8X\n", memwatch_triggered - 1, mwhit.addr,
+ mwhit.size == 1 ? 'B' : (mwhit.size == 2 ? 'W' : 'L'),
+ (mwhit.rwi & 1) ? 'R' : ' ', (mwhit.rwi & 2) ? 'W' : ' ', (mwhit.rwi & 4) ? 'I' : ' ',
+ mwhit.val);
memwatch_triggered = 0;
}
if (skipaddr_doskip > 0) {
#define DISK_INDEXSYNC 1
#define DISK_WORDSYNC 2
-#define DISK_MOTORDELAY 4
-#define DISK_REVOLUTION 8 /* 8,16,32,64 */
+#define DISK_REVOLUTION 4 /* 8,16,32,64 */
#define DSKREADY_TIME 4
#define DSKREADY_DOWN_TIME 10
openwritefile (drv, 0);
drive_settype_id(drv); /* Set DD or HD drive */
drive_fill_bigbuf (drv, 1);
- drv->mfmpos = (rand () | (rand () << 16)) % drv->tracklen;
+ drv->mfmpos = uaerand ();
+ drv->mfmpos |= (uaerand () << 16);
+ drv->mfmpos %= drv->tracklen;
drv->prevtracklen = 0;
#ifdef DRIVESOUND
driveclick_insert (drv - floppy, 0);
static void rand_shifter (drive *drv)
{
- int r = ((rand () >> 4) & 7) + 1;
+ int r = ((uaerand () >> 4) & 7) + 1;
while (r-- > 0) {
word <<= 1;
- word |= (rand () & 0x1000) ? 1 : 0;
+ word |= (uaerand () & 0x1000) ? 1 : 0;
bitoffset++;
bitoffset &= 15;
}
return !drv->motoroff;
}
+static void motordelay_func(uae_u32 v)
+{
+ floppy[v].motordelay = 0;
+}
+
static void drive_motor (drive * drv, int off)
{
if (drv->motoroff && !off) {
write_log (" ->motor off");
if (currprefs.cpu_level <= 1) {
drv->motordelay = 1;
- diskevent_flag = DISK_MOTORDELAY;
- eventtab[ev_disk].oldcycles = get_cycles ();
- eventtab[ev_disk].evtime = get_cycles () + 30 * CYCLE_UNIT;
- eventtab[ev_disk].active = 1;
- events_schedule ();
+ event2_newevent2(30, drv - floppy, motordelay_func);
}
}
drv->motoroff = off;
}
}
-void DISK_handler (void)
+void DISK_handler (uae_u32 data)
{
int flag = diskevent_flag;
- eventtab[ev_disk].active = 0;
+
+ event2_remevent(ev2_disk);
DISK_update (disk_sync_cycle);
if (flag & (DISK_REVOLUTION << 0))
fetchnextrevolution (&floppy[0]);
INTREQ (0x8000 | 0x1000);
if (flag & DISK_INDEXSYNC)
cia_diskindex ();
- floppy[0].motordelay = floppy[1].motordelay = floppy[2].motordelay = floppy[3].motordelay = 0;
#if 0
{
int i;
tword <<= 1;
if (!drive_empty (drv)) {
if (unformatted (drv))
- tword |= (rand() & 0x1000) ? 1 : 0;
+ tword |= (uaerand() & 0x1000) ? 1 : 0;
else
tword |= getonebit (drv->bigmfmbuf, mfmpos);
}
updatetrackspeed (drv, drv->mfmpos);
if (diskevent_flag) {
disk_sync_cycle = startcycle >> 8;
- eventtab[ev_disk].oldcycles = get_cycles ();
- eventtab[ev_disk].evtime = get_cycles () + startcycle - firstcycle;
- eventtab[ev_disk].active = 1;
- events_schedule ();
+ event2_newevent(ev2_disk, startcycle - firstcycle);
}
}
word <<= 1;
if (!drive_empty (drv)) {
if (unformatted (drv))
- word |= (rand() & 0x1000) ? 1 : 0;
+ word |= (uaerand() & 0x1000) ? 1 : 0;
else
word |= getonebit (drv->bigmfmbuf, drv->mfmpos);
}
int cycles = (tohpos << 8) - disk_hpos;
int startcycle = disk_hpos;
- disk_jitter = ((rand () >> 4) & 3) + 1;
+ disk_jitter = ((uaerand () >> 4) & 3) + 1;
if (disk_jitter > 2)
disk_jitter = 1;
if (cycles <= 0)
framecnt++;
if (framecnt >= currprefs.gfx_framerate)
framecnt = 0;
+ if (inhibit_frame)
+ framecnt = 1;
}
int coord_native_to_amiga_x (int x)
check_prefs_changed_custom ();
check_prefs_changed_cpu ();
- if (inhibit_frame != 0)
- framecnt = 1;
-
if (framecnt == 0)
init_drawing_frame ();
} else {
init_drawing_frame ();
- //flush_clear_screen ();
notice_screen_contents_lost ();
frame_res_cnt = FRAMES_UNTIL_RES_SWITCH;
lightpen_y1 = lightpen_y2 = -1;
#include "zfile.h"
#include "catweasel.h"
#include "cdtv.h"
+#include "debug.h"
#define MAX_EXPANSION_BOARDS 8
{
write_log ("expamem_map_clear() got called. Shouldn't happen.\n");
}
-
static void expamem_init_clear (void)
{
memset (expamem, 0xff, sizeof expamem);
ecard = MAX_EXPANSION_BOARDS - 1;
}
+static void expamem_init_last (void)
+{
+ write_log("Memory map after autoconfig:\n");
+ memory_map_dump();
+ expamem_init_clear();
+}
+
static uae_u32 REGPARAM3 expamem_lget (uaecptr) REGPARAM;
static uae_u32 REGPARAM3 expamem_wget (uaecptr) REGPARAM;
static uae_u32 REGPARAM3 expamem_bget (uaecptr) REGPARAM;
addrbank expamem_bank = {
expamem_lget, expamem_wget, expamem_bget,
expamem_lput, expamem_wput, expamem_bput,
- default_xlate, default_check, NULL, "Autoconfig"
+ default_xlate, default_check, NULL, "Autoconfig",
+ dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
static uae_u32 REGPARAM2 expamem_lget (uaecptr addr)
addrbank fastmem_bank = {
fastmem_lget, fastmem_wget, fastmem_bget,
fastmem_lput, fastmem_wput, fastmem_bput,
- fastmem_xlate, fastmem_check, NULL, "Fast memory"
+ fastmem_xlate, fastmem_check, NULL, "Fast memory",
+ fastmem_lget, fastmem_wget, ABFLAG_RAM
};
static int REGPARAM2 catweasel_check (uaecptr addr, uae_u32 size)
{
- write_log ("catweasel_check @%08.8X size %08.8X\n", addr, size);
return 0;
}
static addrbank catweasel_bank = {
catweasel_lget, catweasel_wget, catweasel_bget,
catweasel_lput, catweasel_wput, catweasel_bput,
- catweasel_xlate, catweasel_check, NULL, "Catweasel"
+ catweasel_xlate, catweasel_check, NULL, "Catweasel",
+ dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
static void expamem_map_catweasel (void)
static addrbank filesys_bank = {
filesys_lget, filesys_wget, filesys_bget,
filesys_lput, filesys_wput, filesys_bput,
- default_xlate, default_check, NULL, "Filesystem Autoconfig Area"
+ default_xlate, default_check, NULL, "Filesystem Autoconfig Area",
+ dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
#endif /* FILESYS */
addrbank z3fastmem_bank = {
z3fastmem_lget, z3fastmem_wget, z3fastmem_bget,
z3fastmem_lput, z3fastmem_wput, z3fastmem_bput,
- z3fastmem_xlate, z3fastmem_check, NULL, "ZorroIII Fast RAM"
+ z3fastmem_xlate, z3fastmem_check, NULL, "ZorroIII Fast RAM",
+ z3fastmem_lget, z3fastmem_wget, ABFLAG_RAM
};
/* Z3-based UAEGFX-card */
{
gfxmem_start = ((expamem_hi | (expamem_lo >> 4)) << 16);
map_banks (&gfxmem_bank, gfxmem_start >> 16, allocated_gfxmem >> 16, allocated_gfxmem);
- write_log ("UAEGFX-card: mapped @$%lx \n", gfxmem_start);
+ write_log ("UAEGFX-card: mapped @$%lx, %d MB RTG RAM\n", gfxmem_start, allocated_gfxmem / 0x100000);
}
static void expamem_init_gfxcard (void)
card_map[cardno++] = expamem_map_catweasel;
}
#endif
+ if (cardno > 0 && cardno < MAX_EXPANSION_BOARDS) {
+ card_init[cardno] = expamem_init_last;
+ card_map[cardno++] = expamem_map_clear;
+ }
while (cardno < MAX_EXPANSION_BOARDS) {
card_init[cardno] = expamem_init_clear;
card_map[cardno++] = expamem_map_clear;
#include "sysconfig.h"
#include "sysdeps.h"
#include "zfile.h"
+#include "uae.h"
/* ELSE */
//#include "types.h"
if (i >= pulses)
i = 0;
indx = idx[i];
- if (rand() <= (indx * RAND_MAX) / maxidx) {
+ if (uaerand() <= (indx * RAND_MAX) / maxidx) {
pulse += avgp[i] - ref_pulse;
if (indx >= maxidx)
ref_pulse = 0;
max_pulse = avg_pulse + (avgp[nexti] - minp[nexti]);
if (min_pulse < ref_pulse)
min_pulse = ref_pulse;
- randval = rand();
+ randval = uaerand();
if (randval < (RAND_MAX / 2)) {
if (randval > (RAND_MAX / 4)) {
if (randval <= (3 * RAND_MAX / 8))
ref_pulse = 0;
if (i == eodat)
outstep++;
- } else if (rand() <= ((idx[i] * RAND_MAX) / maxidx)) {
+ } else if (uaerand() <= ((idx[i] * RAND_MAX) / maxidx)) {
avg_pulse = avgp[i];
min_pulse = minp[i];
max_pulse = maxp[i];
- randval = rand();
+ randval = uaerand();
if (randval < (RAND_MAX / 2)) {
if (randval > (RAND_MAX / 4)) {
if (randval <= (3 * RAND_MAX / 8))
{
uaecptr out;
Key *k = lookup_key (unit, GET_PCK_ARG1 (packet));
- write_log("lock_from_fh %x\n", k);
+ //write_log("lock_from_fh %x\n", k);
if (k == 0) {
PUT_PCK_RES1 (packet, DOS_FALSE);
return;
}
out = action_dup_lock_2 (unit, packet, make_lock (unit, k->aino->uniq, -2));
- write_log("=%x\n", out);
+ //write_log("=%x\n", out);
}
static void
err = -2;
goto error;
}
+ memset (buf, 0, readblocksize);
hdf_read (hfd, buf, partblock * hfd->blocksize, readblocksize);
if (!rdb_checksum ("PART", buf, partblock)) {
err = -2;
err = -1;
goto error;
}
+ memset (buf, 0, readblocksize);
hdf_read (hfd, buf, fileblock * hfd->blocksize, readblocksize);
if (!rdb_checksum ("FSHD", buf, fileblock)) {
write_log("RDB: checksum error in FSHD block %d\n", fileblock);
lsegblock = rl (buf + 72);
i = 0;
for (;;) {
+ int pb = lsegblock;
if (!legalrdbblock (uip, lsegblock))
goto error;
+ memset (buf, 0, readblocksize);
hdf_read (hfd, buf, lsegblock * hfd->blocksize, readblocksize);
if (!rdb_checksum ("LSEG", buf, lsegblock))
goto error;
lsegblock = rl (buf + 16);
+ if (lsegblock == pb)
+ goto error;
memcpy (fsmem + i * (blocksize - 20), buf + 20, blocksize - 20);
i++;
if (lsegblock == -1)
if (aino->deleted)
return 0;
- if (! fsdb_mode_representable_p (aino) || aino->comment != 0)
+ if (! fsdb_mode_representable_p (aino, aino->amigaos_mode) || aino->comment != 0)
return 1;
nn_begin = nname_begin (aino->nname);
addrbank gayle_bank = {
gayle_lget, gayle_wget, gayle_bget,
gayle_lput, gayle_wput, gayle_bput,
- default_xlate, default_check, NULL, "Gayle"
+ default_xlate, default_check, NULL, "Gayle",
+ dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
uae_u32 REGPARAM2 gayle_lget (uaecptr addr)
static FILE *headerfile;
static FILE *stblfile;
-static int using_prefetch;
+static int using_prefetch, using_indirect;
static int using_exception_3;
static int using_ce;
static int cpu_level;
printf ("\t%s %s = get_long_prefetch (regs, %d);\n", type, name, r + 2);
insn_n_cycles += 8;
}
+ } else if (using_indirect) {
+ insn_n_cycles += 8;
+ printf ("\t%s %s = get_ilongi (%d);\n", type, name, r);
} else {
insn_n_cycles += 8;
printf ("\t%s %s = get_ilong (regs, %d);\n", type, name, r);
sprintf (buffer, "get_word_prefetch (regs, %d)", r + 2);
insn_n_cycles += 4;
}
+ } else if (using_indirect) {
+ sprintf (buffer, "get_iwordi(%d)", r);
+ insn_n_cycles += 4;
} else {
sprintf (buffer, "get_iword (regs, %d)", r);
insn_n_cycles += 4;
sprintf (buffer, "(uae_u8)get_word_prefetch (regs, %d)", r + 2);
insn_n_cycles += 4;
}
+ } else if (using_indirect) {
+ sprintf (buffer, "get_ibytei (%d)", r);
+ insn_n_cycles += 4;
} else {
sprintf (buffer, "get_ibyte (regs, %d)", r);
insn_n_cycles += 4;
case i_RTS:
if (using_ce)
printf ("\tm68k_do_rts_ce(regs);\n");
+ else if (using_indirect)
+ printf ("\tm68k_do_rtsi(regs);\n");
else
printf ("\tm68k_do_rts(regs);\n");
m68k_pc_offset = 0;
addcycles (2);
if (using_ce)
printf ("\tm68k_do_bsr_ce (regs, m68k_getpc(regs) + %d, s);\n", m68k_pc_offset);
+ else if (using_indirect)
+ printf ("\tm68k_do_bsri (regs, m68k_getpc(regs) + %d, s);\n", m68k_pc_offset);
else
printf ("\tm68k_do_bsr (regs, m68k_getpc(regs) + %d, s);\n", m68k_pc_offset);
m68k_pc_offset = 0;
generate_includes (stblfile);
using_prefetch = 0;
+ using_indirect = 0;
using_exception_3 = 1;
using_ce = 0;
extern void reset_blit (int);
extern int blitnasty (void);
extern int blitnnasty (int);
-extern void blitter_handler (void);
+extern void blitter_handler (uae_u32);
extern void build_blitfilltable (void);
extern void do_blitter (int);
extern void decide_blitter (int hpos);
STATIC_INLINE uae_u32 get_word_prefetch (struct regstruct *regs, int o)
{
uae_u32 v = regs->irc;
- regs->irc = get_word (m68k_getpc(regs) + o);
+ regs->irc = get_wordi (m68k_getpc(regs) + o);
return v;
}
STATIC_INLINE uae_u32 get_long_prefetch (struct regstruct *regs, int o)
}
#ifdef CPUEMU_6
-
-#if 0
-STATIC_INLINE uae_u32 mem_access_delay_word_read_cycles (uaecptr addr, int *cycles)
+STATIC_INLINE uae_u32 mem_access_delay_word_read (uaecptr addr)
{
if (addr < 0x200000 || (addr >= 0xc00000 && addr < 0xe00000)) {
- return wait_cpu_cycle_read_cycles (addr, 1, cycles);
+ return wait_cpu_cycle_read (addr, 1);
} else if (!(addr >= 0xa00000 && addr < 0xc00000)) {
do_cycles_ce (4 * CYCLE_UNIT / 2);
- *cycles = 4;
}
return get_word (addr);
}
-#endif
-
-STATIC_INLINE uae_u32 mem_access_delay_word_read (uaecptr addr)
+STATIC_INLINE uae_u32 mem_access_delay_wordi_read (uaecptr addr)
{
if (addr < 0x200000 || (addr >= 0xc00000 && addr < 0xe00000)) {
return wait_cpu_cycle_read (addr, 1);
} else if (!(addr >= 0xa00000 && addr < 0xc00000)) {
do_cycles_ce (4 * CYCLE_UNIT / 2);
}
- return get_word (addr);
+ return get_wordi (addr);
}
+
STATIC_INLINE uae_u32 mem_access_delay_byte_read (uaecptr addr)
{
if (addr < 0x200000 || (addr >= 0xc00000 && addr < 0xe00000)) {
{
return mem_access_delay_word_read (addr);
}
+STATIC_INLINE uae_u32 get_wordi_ce (uaecptr addr)
+{
+ return mem_access_delay_wordi_read (addr);
+}
STATIC_INLINE uae_u32 get_byte_ce (uaecptr addr)
{
STATIC_INLINE uae_u32 get_word_ce_prefetch (struct regstruct *regs, int o)
{
uae_u32 v = regs->irc;
- regs->irc = get_word_ce (m68k_getpc(regs) + o);
+ regs->irc = get_wordi_ce (m68k_getpc(regs) + o);
return v;
}
-#if 0
-STATIC_INLINE int get_word_ce_prefetch_cycles (int o)
-{
- int cycles = 0;
- regs.irc = mem_access_delay_word_read_cycles (m68k_getpc() + o, &cycles);
- return cycles;
-}
-#endif
-
STATIC_INLINE void put_word_ce (uaecptr addr, uae_u16 v)
{
mem_access_delay_word_write (addr, v);
extern int mmu_init(int,uaecptr,uaecptr);
extern void mmu_do_hit(void);
extern void dump_aga_custom (void);
-
+extern void memory_map_dump (void);
#else
STATIC_INLINE void activate_debugger (void) { };
extern void disk_insert_force (int num, const char *name);
extern void DISK_check_change (void);
extern struct zfile *DISK_validate_filename (const char *, int, int *, uae_u32 *);
-extern void DISK_handler (void);
+extern void DISK_handler (uae_u32);
extern void DISK_update (int hpos);
extern void DISK_hsync (int hpos);
extern void DISK_reset (void);
extern unsigned long currcycle, nextevent, is_lastline;
extern unsigned long sample_evtime;
typedef void (*evfunc)(void);
+typedef void (*evfunc2)(uae_u32);
+
+typedef unsigned long int evt;
struct ev
{
int active;
- unsigned long int evtime, oldcycles;
+ evt evtime, oldcycles;
evfunc handler;
};
+struct ev2
+{
+ int active;
+ evt evtime;
+ uae_u32 data;
+ evfunc2 handler;
+};
+
enum {
- ev_hsync, ev_copper, ev_audio, ev_cia, ev_blitter, ev_disk,
+ ev_hsync, ev_audio, ev_cia, ev_misc,
ev_max
};
+enum {
+ ev2_blitter, ev2_disk, ev2_misc,
+ ev2_max = 8
+};
+
extern struct ev eventtab[ev_max];
+extern struct ev2 eventtab2[ev2_max];
+extern void event2_newevent(int, evt);
+extern void event2_newevent2(evt, uae_u32, evfunc2);
+extern void event2_remevent(int);
#ifdef JIT
#include "events_jit.h"
extern int fsdb_name_invalid (const char *n);
extern int fsdb_fill_file_attrs (a_inode *, a_inode *);
extern int fsdb_set_file_attrs (a_inode *);
-extern int fsdb_mode_representable_p (const a_inode *);
+extern int fsdb_mode_representable_p (const a_inode *, int);
extern int fsdb_mode_supported (const a_inode *);
extern char *fsdb_create_unique_nname (a_inode *base, const char *);
#define INPREC_KEY 3
#define INPREC_DISKINSERT 4
#define INPREC_DISKREMOVE 5
+#define INPREC_VSYNC 6
+#define INPREC_CIAVSYNC 7
#define INPREC_END 0xff
extern int input_recording;
extern uae_u8* baseaddr[];
+enum { ABFLAG_UNK = 0, ABFLAG_RAM, ABFLAG_ROM, ABFLAG_ROMIN, ABFLAG_IO, ABFLAG_NONE };
typedef struct {
/* These ones should be self-explanatory... */
mem_get_func lget, wget, bget;
for this particular bank. */
uae_u8 *baseaddr;
char *name;
+ /* for instruction opcode/operand fetches */
+ mem_get_func lgeti, wgeti;
+ int flags;
} addrbank;
extern uae_u8 *filesysory;
extern int REGPARAM3 default_check(uaecptr addr, uae_u32 size) REGPARAM;
extern uae_u8 *REGPARAM3 default_xlate(uaecptr addr) REGPARAM;
+/* 680x0 opcode fetches */
+extern uae_u32 REGPARAM3 dummy_lgeti (uaecptr addr) REGPARAM;
+extern uae_u32 REGPARAM3 dummy_wgeti (uaecptr addr) REGPARAM;
#define bankindex(addr) (((uaecptr)(addr)) >> 16)
#define longget(addr) (call_mem_get_func(get_mem_bank(addr).lget, addr))
#define wordget(addr) (call_mem_get_func(get_mem_bank(addr).wget, addr))
#define byteget(addr) (call_mem_get_func(get_mem_bank(addr).bget, addr))
+#define longgeti(addr) (call_mem_get_func(get_mem_bank(addr).lgeti, addr))
+#define wordgeti(addr) (call_mem_get_func(get_mem_bank(addr).wgeti, addr))
#define longput(addr,l) (call_mem_put_func(get_mem_bank(addr).lput, addr, l))
#define wordput(addr,w) (call_mem_put_func(get_mem_bank(addr).wput, addr, w))
#define byteput(addr,b) (call_mem_put_func(get_mem_bank(addr).bput, addr, b))
{
return byteget(addr);
}
+STATIC_INLINE uae_u32 get_longi(uaecptr addr)
+{
+ return longgeti(addr);
+}
+STATIC_INLINE uae_u32 get_wordi(uaecptr addr)
+{
+ return wordgeti(addr);
+}
/*
* Read a host pointer from addr
extern unsigned long irqcycles[15];
extern int irqdelay[15];
extern int mmu_enabled, mmu_triggered;
+extern int cpu_cycles;
STATIC_INLINE void set_special (struct regstruct *regs, uae_u32 x)
{
return regs->pc + ((char *)p - (char *)regs->pc_oldp);
}
+STATIC_INLINE void m68k_setpci(struct regstruct *regs, uaecptr newpc)
+{
+ regs->pc = newpc;
+}
+STATIC_INLINE uaecptr m68k_getpci(struct regstruct *regs)
+{
+ return regs->pc;
+}
+STATIC_INLINE void m68k_incpci(struct regstruct *regs, int o)
+{
+ regs->pc += o;
+}
+
#define get_ibyte(regs, o) do_get_mem_byte((uae_u8 *)((regs)->pc_p + (o) + 1))
#define get_iword(regs, o) do_get_mem_word((uae_u16 *)((regs)->pc_p + (o)))
#define get_ilong(regs, o) do_get_mem_long((uae_u32 *)((regs)->pc_p + (o)))
+#define get_iwordi(o) get_wordi(o)
+#define get_ilongi(o) get_longi(o)
+
#define m68k_incpc(regs, o) ((regs)->pc_p += (o))
/* These are only used by the 68020/68881 code, and therefore don't
m68k_incpc (regs, 2);
return r;
}
+STATIC_INLINE uae_u32 next_iwordi (struct regstruct *regs)
+{
+ uae_u32 r = get_iwordi (m68k_getpci(regs));
+ m68k_incpc (regs, 2);
+ return r;
+}
STATIC_INLINE uae_u32 next_ilong (struct regstruct *regs)
{
m68k_incpc (regs, 4);
return r;
}
+STATIC_INLINE uae_u32 next_ilongi (struct regstruct *regs)
+{
+ uae_u32 r = get_ilongi (m68k_getpci(regs));
+ m68k_incpc (regs, 4);
+ return r;
+}
STATIC_INLINE void m68k_do_rts(struct regstruct *regs)
{
m68k_setpc(regs, get_long(m68k_areg(regs, 7)));
m68k_areg(regs, 7) += 4;
}
+STATIC_INLINE void m68k_do_rtsi(struct regstruct *regs)
+{
+ m68k_setpci(regs, get_long(m68k_areg(regs, 7)));
+ m68k_areg(regs, 7) += 4;
+}
STATIC_INLINE void m68k_do_bsr(struct regstruct *regs, uaecptr oldpc, uae_s32 offset)
{
put_long(m68k_areg(regs, 7), oldpc);
m68k_incpc(regs, offset);
}
+STATIC_INLINE void m68k_do_bsri(struct regstruct *regs, uaecptr oldpc, uae_s32 offset)
+{
+ m68k_areg(regs, 7) -= 4;
+ put_long(m68k_areg(regs, 7), oldpc);
+ m68k_incpci(regs, offset);
+}
STATIC_INLINE void m68k_do_jsr(struct regstruct *regs, uaecptr oldpc, uaecptr dest)
{
}
extern uae_u32 REGPARAM3 get_disp_ea_020 (struct regstruct *regs, uae_u32 base, uae_u32 dp) REGPARAM;
+extern uae_u32 REGPARAM3 get_disp_ea_020i (struct regstruct *regs, uae_u32 base, uae_u32 dp) REGPARAM;
extern uae_u32 REGPARAM3 get_disp_ea_000 (struct regstruct *regs, uae_u32 base, uae_u32 dp) 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 REGPARAM3 MakeFromSR (struct regstruct *regs) REGPARAM;
extern void REGPARAM3 Exception (int, struct regstruct *regs, uaecptr) REGPARAM;
extern void Interrupt (int nr);
+extern void doint (void);
extern void dump_counts (void);
extern int m68k_move2c (int, uae_u32 *);
extern int m68k_movec2 (int, uae_u32 *);
#define UAEMAJOR 1
#define UAEMINOR 3
-#define UAESUBREV 3
+#define UAESUBREV 4
typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang;
extern void fetch_saveimagepath (char*, int, int);
extern void fetch_configurationpath (char *out, int size);
extern void fetch_screenshotpath (char *out, int size);
+extern int uaerand(void);
\ No newline at end of file
static int inprec_size;
int input_recording = 0;
static uae_u8 *inprec_plast, *inprec_plastptr;
+static int inprec_div;
static uae_u32 oldbuttons[4];
static uae_u16 oldjoy[2];
if (inprec_zf == NULL)
return 0;
inprec_size = 10000;
+ inprec_div = 1;
if (record < 0) {
uae_u32 id;
zfile_fseek (inprec_zf, 0, SEEK_END);
return 0;
}
inprec_pu32();
- srand(inprec_pu32());
+ t = inprec_pu32();
i = inprec_pu32();
while (i-- > 0)
inprec_pu8();
inprec_p = inprec_plastptr;
oldbuttons[0] = oldbuttons[1] = oldbuttons[2] = oldbuttons[3] = 0;
oldjoy[0] = oldjoy[1] = 0;
+ if (record < -1)
+ inprec_div = maxvpos;
} else if (record > 0) {
inprec_buffer = inprec_p = xmalloc (inprec_size);
inprec_ru32('UAE\0');
return 0;
}
input_recording = record;
+ srand(t);
CIA_inprec_prepare();
write_log ("inprec initialized '%s', mode=%d\n", fname, input_recording);
return 1;
{
uae_u8 *p = inprec_p;
uae_u32 hc = hsync_counter;
+ static uae_u8 *lastp;
+ uae_u32 hc_orig, hc2_orig;
if (savestate_state)
return 0;
inprec_close();
return 0;
}
- if (input_recording < -1) {
- hc /= maxvpos;
- hc *= maxvpos;
- }
+ hc_orig = hc;
+ hc /= inprec_div;
+ hc *= inprec_div;
for (;;) {
uae_u32 hc2 = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
- if (input_recording < -1) {
- hc2 /= maxvpos;
- hc2 *= maxvpos;
+ if (p > lastp) {
+ write_log("INPREC: Next %08.8x (%08.8x=%d): %d (%d)\n", hc2, hc, hc2 - hc, p[5 + 1], p[5]);
+ lastp = p;
}
- if (hc2 != hc)
+ hc2_orig = hc2;
+ hc2 /= inprec_div;
+ hc2 *= inprec_div;
+ if (hc > hc2) {
+ write_log("INPREC: %08.8x > %08.8x: %d (%d) missed!\n", hc, hc2, p[5 + 1], p[5]);
+ inprec_close();
+ return 0;
+ }
+ if (hc2 != hc) {
+ lastp = p;
break;
+ }
if (p[5 + 1] == type) {
- write_log("INPREC: %08.8x: %d (%d)\n", hc, type, p[5]);
+ write_log("INPREC: %08.8x: %d (%d) (%+d)\n", hc, type, p[5], hc_orig - hc2_orig);
inprec_plast = p;
inprec_plastptr = p + 5 + 2;
return 1;
inprec_plast[5 + 1] = 0;
inprec_plast = NULL;
inprec_plastptr = NULL;
- if (input_recording < -1) {
- hc /= maxvpos;
- hc *= maxvpos;
- }
+ hc /= inprec_div;
+ hc *= inprec_div;
for (;;) {
uae_u32 hc2 = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
- if (input_recording < -1) {
- hc2 /= maxvpos;
- hc2 *= maxvpos;
- }
+ hc2 /= inprec_div;
+ hc2 *= inprec_div;
if (hc2 != hc)
break;
if (p[5 + 1] != 0)
v = (joybutton[joy] & (1 << button)) ? 1 : 0;
if (input_recording > 0 && ((joybutton[joy] ^ oldbuttons[joy]) & (1 << button))) {
- oldbuttons[joy] = joybutton[joy];
+ oldbuttons[joy] &= ~(1 << button);
+ if (v)
+ oldbuttons[joy] |= 1 << button;
inprec_rstart(INPREC_JOYBUTTON);
inprec_ru8(joy);
inprec_ru8(button);
}
}
mouseupdate (100);
- inputdelay = rand () % (maxvpos - 1);
+ inputdelay = uaerand () % (maxvpos - 1);
idev[IDTYPE_MOUSE].read ();
input_read = 1;
input_vpos = 0;
char optionsfile[256];
+int uaerand(void)
+{
+ return rand();
+}
/* If you want to pipe printer output to a file, put something like
* "cat >>printerfile.tmp" above.
* The printer support was only tested with the driver "PostScript" on
void getromname (struct romdata *rd, char *name)
{
name[0] = 0;
+ if (!rd)
+ return;
strcat (name, rd->name);
if (rd->subrev && rd->subrev != rd->rev)
sprintf (name + strlen (name), " rev %d.%d", rd->subver, rd->subrev);
#define NONEXISTINGDATA 0
//#define NONEXISTINGDATA 0xffffffff
-static void dummylog(int rw, uaecptr addr, int size, uae_u32 val)
+static void dummylog(int rw, uaecptr addr, int size, uae_u32 val, int ins)
{
if (illegal_count >= MAX_ILG)
return;
return;
if (MAX_ILG >= 0)
illegal_count++;
- if (rw) {
+ if (ins) {
+ write_log ("WARNING: Illegal opcode %cget at %08lx PC=%x\n",
+ size == 2 ? 'w' : 'l', addr, M68K_GETPC);
+ } else if (rw) {
write_log ("Illegal %cput at %08lx=%08lx PC=%x\n",
size == 1 ? 'b' : size == 2 ? 'w' : 'l', addr, val, M68K_GETPC);
} else {
special_mem |= S_READ;
#endif
if (currprefs.illegal_mem)
- dummylog(0, addr, 4, 0);
+ dummylog(0, addr, 4, 0, 0);
+ if (currprefs.cpu_level >= 2)
+ return NONEXISTINGDATA;
+ return (regs.irc << 16) | regs.irc;
+}
+uae_u32 REGPARAM2 dummy_lgeti (uaecptr addr)
+{
+#ifdef JIT
+ special_mem |= S_READ;
+#endif
+ if (currprefs.illegal_mem)
+ dummylog(0, addr, 4, 0, 1);
if (currprefs.cpu_level >= 2)
return NONEXISTINGDATA;
return (regs.irc << 16) | regs.irc;
special_mem |= S_READ;
#endif
if (currprefs.illegal_mem)
- dummylog(0, addr, 2, 0);
+ dummylog(0, addr, 2, 0, 0);
+ if (currprefs.cpu_level >= 2)
+ return NONEXISTINGDATA;
+ return regs.irc;
+}
+uae_u32 REGPARAM2 dummy_wgeti (uaecptr addr)
+{
+#ifdef JIT
+ special_mem |= S_READ;
+#endif
+ if (currprefs.illegal_mem)
+ dummylog(0, addr, 2, 0, 1);
if (currprefs.cpu_level >= 2)
return NONEXISTINGDATA;
return regs.irc;
special_mem |= S_READ;
#endif
if (currprefs.illegal_mem)
- dummylog(0, addr, 1, 0);
+ dummylog(0, addr, 1, 0, 0);
if (currprefs.cpu_level >= 2)
return NONEXISTINGDATA;
return (addr & 1) ? regs.irc : regs.irc >> 8;
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- dummylog(1, addr, 4, l);
+ dummylog(1, addr, 4, l, 0);
}
void REGPARAM2 dummy_wput (uaecptr addr, uae_u32 w)
{
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- dummylog(1, addr, 2, w);
+ dummylog(1, addr, 2, w, 0);
}
void REGPARAM2 dummy_bput (uaecptr addr, uae_u32 b)
{
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- dummylog(1, addr, 1, b);
+ dummylog(1, addr, 1, b, 0);
}
int REGPARAM2 dummy_check (uaecptr addr, uae_u32 size)
addrbank dummy_bank = {
dummy_lget, dummy_wget, dummy_bget,
dummy_lput, dummy_wput, dummy_bput,
- default_xlate, dummy_check, NULL, NULL
+ default_xlate, dummy_check, NULL, NULL,
+ dummy_lgeti, dummy_wgeti, ABFLAG_NONE
};
#ifdef AUTOCONFIG
addrbank mbres_bank = {
mbres_lget, mbres_wget, mbres_bget,
mbres_lput, mbres_wput, mbres_bput,
- default_xlate, mbres_check, NULL, "MBRES"
+ default_xlate, mbres_check, NULL, "MBRES",
+ dummy_lgeti, dummy_wgeti, ABFLAG_RAM
};
#endif
addrbank chipmem_bank = {
chipmem_lget, chipmem_wget, chipmem_bget,
chipmem_lput, chipmem_wput, chipmem_bput,
- chipmem_xlate, chipmem_check, NULL, "Chip memory"
+ chipmem_xlate, chipmem_check, NULL, "Chip memory",
+ chipmem_lget, chipmem_wget, ABFLAG_RAM
};
addrbank chipmem_agnus_bank = {
chipmem_agnus_lget, chipmem_agnus_wget, chipmem_agnus_bget,
chipmem_agnus_lput, chipmem_agnus_wput, chipmem_agnus_bput,
- chipmem_xlate, chipmem_check, NULL, "Chip memory"
+ chipmem_xlate, chipmem_check, NULL, "Chip memory",
+ chipmem_agnus_lget, chipmem_agnus_wget, ABFLAG_RAM
};
#ifdef AGA
addrbank chipmem_bank_ce2 = {
chipmem_lget_ce2, chipmem_wget_ce2, chipmem_bget_ce2,
chipmem_lput_ce2, chipmem_wput_ce2, chipmem_bput_ce2,
- chipmem_xlate, chipmem_check, NULL, "Chip memory"
+ chipmem_xlate, chipmem_check, NULL, "Chip memory",
+ chipmem_lget_ce2, chipmem_wget_ce2, ABFLAG_RAM
};
#endif
addrbank bogomem_bank = {
bogomem_lget, bogomem_wget, bogomem_bget,
bogomem_lput, bogomem_wput, bogomem_bput,
- bogomem_xlate, bogomem_check, NULL, "Slow memory"
+ bogomem_xlate, bogomem_check, NULL, "Slow memory",
+ bogomem_lget, bogomem_wget, ABFLAG_RAM
};
#ifdef AUTOCONFIG
addrbank a3000mem_bank = {
a3000mem_lget, a3000mem_wget, a3000mem_bget,
a3000mem_lput, a3000mem_wput, a3000mem_bput,
- a3000mem_xlate, a3000mem_check, NULL, "A3000 memory"
+ a3000mem_xlate, a3000mem_check, NULL, "A3000 memory",
+ a3000mem_lget, a3000mem_wget, ABFLAG_RAM
};
#endif
addrbank kickmem_bank = {
kickmem_lget, kickmem_wget, kickmem_bget,
kickmem_lput, kickmem_wput, kickmem_bput,
- kickmem_xlate, kickmem_check, NULL, "Kickstart ROM"
+ kickmem_xlate, kickmem_check, NULL, "Kickstart ROM",
+ kickmem_lget, kickmem_wget, ABFLAG_ROM
};
addrbank kickram_bank = {
kickmem_lget, kickmem_wget, kickmem_bget,
kickmem2_lput, kickmem2_wput, kickmem2_bput,
- kickmem_xlate, kickmem_check, NULL, "Kickstart Shadow RAM"
+ kickmem_xlate, kickmem_check, NULL, "Kickstart Shadow RAM",
+ kickmem_lget, kickmem_wget, ABFLAG_UNK
};
addrbank extendedkickmem_bank = {
extendedkickmem_lget, extendedkickmem_wget, extendedkickmem_bget,
extendedkickmem_lput, extendedkickmem_wput, extendedkickmem_bput,
- extendedkickmem_xlate, extendedkickmem_check, NULL, "Extended Kickstart ROM"
+ extendedkickmem_xlate, extendedkickmem_check, NULL, "Extended Kickstart ROM",
+ extendedkickmem_lget, extendedkickmem_wget, ABFLAG_ROM
};
static int kickstart_checksum (uae_u8 *mem, int size)
dochecksum = 0;
}
for (j = 0; j < 256 && i >= 262144; j++) {
- if (!memcmp (kickmemory + j, kickstring, strlen (kickstring) + 1))
+ if (!memcmp (mem + j, kickstring, strlen (kickstring) + 1))
break;
}
+
if (j == 256 || i < 262144)
dochecksum = 0;
-
if (dochecksum)
kickstart_checksum (mem, size);
return i;
- /*
+/*
* UAE - The Un*x Amiga Emulator
*
* MC68000 emulation
extern uae_u8* compiled_code;
#include "compemu.h"
#include <signal.h>
-int oink=0;
/* For faster cycles handling */
-signed long pissoff=0;
+signed long pissoff = 0;
/* Counter for missed vsyncmintime deadlines */
-int gonebad=0;
+int gonebad = 0;
#else
/* Need to have these somewhere */
static void build_comp(void) {}
unsigned long irqcycles[15];
int irqdelay[15];
int mmu_enabled, mmu_triggered;
+int cpu_cycles;
const int areg_byteinc[] = { 1,1,1,1,1,1,1,2 };
const int imm8_table[] = { 8,1,2,3,4,5,6,7 };
}
}
- set_special (regs, SPCFLAG_INT);
+ doint();
if (regs->t1 || regs->t0)
set_special (regs, SPCFLAG_TRACE);
else
Exception (nr + 24, regs, 0);
regs->intmask = nr;
- set_special (regs, SPCFLAG_INT);
+ doint();
}
void Interrupt (int nr)
if (regs->spcflags & SPCFLAG_DOTRACE)
Exception (9, regs, last_trace_ad);
+
if (regs->spcflags & SPCFLAG_TRAP) {
unset_special (regs, SPCFLAG_TRAP);
Exception (3, regs, 0);
do_copper ();
if (regs->spcflags & (SPCFLAG_INT | SPCFLAG_DOINT)) {
int intr = intlev ();
-#ifdef JIT
- if (currprefs.cachesize)
- unset_special (regs, SPCFLAG_INT | SPCFLAG_DOINT);
-#endif
+ unset_special (regs, SPCFLAG_INT | SPCFLAG_DOINT);
if (intr != -1 && intr > regs->intmask)
Interrupt (intr);
}
if (regs->spcflags & SPCFLAG_TRACE)
do_trace ();
- /* interrupt takes at least 2 cycles (maybe 4) to reach the CPU and
- * there are programs that require this delay (which is not too surprising..)
- */
-#ifdef JIT
- if ((regs->spcflags & SPCFLAG_DOINT)
- || (!currprefs.cachesize && (regs->spcflags & SPCFLAG_INT))) {
-#else
if (regs->spcflags & SPCFLAG_INT) {
-#endif
int intr = intlev ();
-#ifdef JIT
- if (currprefs.cachesize)
- unset_special (regs, SPCFLAG_DOINT);
-#endif
+ unset_special (regs, SPCFLAG_INT | SPCFLAG_DOINT);
if (intr != -1 && intr > regs->intmask)
do_interrupt (intr, regs);
}
-
-#ifdef JIT
- if ((regs->spcflags & SPCFLAG_INT) && currprefs.cachesize) {
- unset_special (regs, SPCFLAG_INT);
- set_special (regs, SPCFLAG_DOINT);
+ if (regs->spcflags & SPCFLAG_DOINT) {
+ unset_special (regs, SPCFLAG_DOINT);
+ set_special (regs, SPCFLAG_INT);
}
-#endif
if ((regs->spcflags & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE))) {
unset_special (regs, SPCFLAG_BRK | SPCFLAG_MODE_CHANGE);
return 0;
}
-static uae_u32 pcs[1000];
+void doint (void)
+{
+ if (currprefs.cpu_compatible)
+ set_special (®s, SPCFLAG_INT);
+ else
+ set_special (®s, SPCFLAG_DOINT);
+}
+//static uae_u32 pcs[1000];
#ifndef CPUEMU_5
/* It's really sad to have two almost identical functions for this, but we
do it all for performance... :(
This version emulates 68000's prefetch "cache" */
+int cpu_cycles;
static void m68k_run_1 (void)
{
struct regstruct *r = ®s;
for (;;) {
- int cycles;
uae_u32 opcode = r->ir;
count_instr (opcode);
//write_log("%08.8X-%04.4X ",pc, opcode);
}
#endif
-
- cycles = (*cpufunctbl[opcode])(opcode, r);
-
- cycles &= cycles_mask;
- cycles |= cycles_val;
- do_cycles (cycles);
+ do_cycles (cpu_cycles);
+ cpu_cycles = (*cpufunctbl[opcode])(opcode, r);
+ cpu_cycles &= cycles_mask;
+ cpu_cycles |= cycles_val;
if (r->spcflags) {
- if (do_specialties (cycles, r))
+ if (do_specialties (cpu_cycles, r))
return;
}
if (!currprefs.cpu_compatible || (currprefs.cpu_cycle_exact && currprefs.cpu_level == 0))
void exec_nostats(void)
{
struct regstruct *r = ®s;
- int new_cycles;
for (;;)
{
uae_u16 opcode = get_iword(r, 0);
- new_cycles = (*cpufunctbl[opcode])(opcode, r);
+ cpu_cycles = (*cpufunctbl[opcode])(opcode, r);
- new_cycles &= cycles_mask;
- new_cycles |= cycles_val;
- do_cycles (new_cycles);
+ cpu_cycles &= cycles_mask;
+ cpu_cycles |= cycles_val;
+
+ do_cycles (cpu_cycles);
if (end_block(opcode) || r->spcflags)
return; /* We will deal with the spcflags in the caller */
struct regstruct *r = ®s;
int blocklen;
cpu_history pc_hist[MAXRUN];
- int new_cycles;
int total_cycles;
if (check_for_cache_miss())
special_mem = DISTRUST_CONSISTENT_MEM;
pc_hist[blocklen].location = (uae_u16*)r->pc_p;
- new_cycles = (*cpufunctbl[opcode])(opcode, r);
+ cpu_cycles = (*cpufunctbl[opcode])(opcode, r);
- new_cycles &= cycles_mask;
- new_cycles |= cycles_val;
- do_cycles (new_cycles);
- total_cycles += new_cycles;
+ cpu_cycles &= cycles_mask;
+ cpu_cycles |= cycles_val;
+ do_cycles (cpu_cycles);
+ total_cycles += cpu_cycles;
pc_hist[blocklen].specmem = special_mem;
blocklen++;
if (end_block(opcode) || blocklen >= MAXRUN || r->spcflags) {
struct regstruct *r = ®s;
prefetch_pc = m68k_getpc (r);
- prefetch = get_long (prefetch_pc);
+ prefetch = get_longi (prefetch_pc);
for (;;) {
- int cycles;
uae_u32 opcode;
uae_u32 pc = m68k_getpc (r);
+
+ do_cycles (cpu_cycles);
+
if (pc == prefetch_pc)
opcode = prefetch >> 16;
else if (pc == prefetch_pc + 2)
opcode = prefetch & 0xffff;
else
- opcode = get_word (pc);
+ opcode = get_wordi (pc);
count_instr (opcode);
prefetch_pc = m68k_getpc (r) + 2;
- prefetch = get_long (prefetch_pc);
- cycles = (*cpufunctbl[opcode])(opcode, r);
- cycles &= cycles_mask;
- cycles |= cycles_val;
- do_cycles (cycles);
+ prefetch = get_longi (prefetch_pc);
+ cpu_cycles = (*cpufunctbl[opcode])(opcode, r);
+ cpu_cycles &= cycles_mask;
+ cpu_cycles |= cycles_val;
if (r->spcflags) {
- if (do_specialties (cycles, r))
+ if (do_specialties (cpu_cycles, r))
return;
}
}
struct regstruct *r = ®s;
for (;;) {
- int cycles;
uae_u32 opcode = get_iword (r, 0);
count_instr (opcode);
- cycles = (*cpufunctbl[opcode])(opcode, r);
-
- cycles &= cycles_mask;
- cycles |= cycles_val;
- do_cycles (cycles);
+ do_cycles (cpu_cycles);
+ cpu_cycles = (*cpufunctbl[opcode])(opcode, r);
+ cpu_cycles &= cycles_mask;
+ cpu_cycles |= cycles_val;
if (r->spcflags) {
- if (do_specialties (cycles, r))
+ if (do_specialties (cpu_cycles, r))
return;
}
}
static void m68k_run_mmu (void)
{
for (;;) {
- int cycles;
uae_u32 opcode = get_iword (®s, 0);
+ do_cycles (cpu_cycles);
mmu_backup_regs = regs;
- cycles = (*cpufunctbl[opcode])(opcode, ®s);
- cycles &= cycles_mask;
- cycles |= cycles_val;
+ cpu_cycles = (*cpufunctbl[opcode])(opcode, ®s);
+ cpu_cycles &= cycles_mask;
+ cpu_cycles |= cycles_val;
if (mmu_triggered)
mmu_do_hit();
- do_cycles (cycles);
if (regs.spcflags) {
- if (do_specialties (cycles, ®s))
+ if (do_specialties (cpu_cycles, ®s))
return;
}
}
}
}
+#if 0 /* what was the meaning of this? this breaks trace emulation if debugger is used */
if (regs.spcflags) {
uae_u32 of = regs.spcflags;
regs.spcflags &= ~(SPCFLAG_BRK | SPCFLAG_MODE_CHANGE);
do_specialties (0, ®s);
regs.spcflags |= of & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE);
}
+#endif
#ifndef JIT
run_func = currprefs.cpu_level == 0 && currprefs.cpu_cycle_exact ? m68k_run_1_ce :
currprefs.cpu_level == 0 && currprefs.cpu_compatible ? m68k_run_1 :
#include "sounddep/sound.h"
#include "dxwrap.h"
#include "win32.h"
-#include "win32gfx.h"
#include "parser.h"
#include "enforcer.h"
#include "ahidsound.h"
-static long samples,playchannel,intcount,norec;
+static long samples, playchannel, intcount;
+static int record_enabled;
int ahi_on;
-static char *sndptrmax, soundneutral,sndptr,*tempmem;
-#if 0
-static HWND dsound_tmpw;
-#endif
-static WAVEFORMATEX wavfmt;
+static char *sndptrmax, soundneutral, sndptr;
static LPSTR lpData,sndptrout;
extern uae_u32 chipmem_mask;
-unsigned int samplecount,*sndbufrecpt;
+unsigned int *sndbufrecpt;
static char *ahisndbuffer,*sndrecbuffer;
-static int ahisndbufsize,oldpos,*ahisndbufpt,ahitweak;;
-static unsigned int dwBytes,dwBytes1,dwBytes2,espstore;
-static LPVOID dwData1,dwData2;
+static int ahisndbufsize,*ahisndbufpt,ahitweak;;
int ahi_pollrate = 40;
int sound_freq_ahi, sound_channels_ahi, sound_bits_ahi;
static uae_u32 REGPARAM2 emulib_ExecuteNativeCode2 (TrapContext *context)
{
+ unsigned int espstore;
uae_u8* object_UAM = (uae_u8*) m68k_areg(&context->regs, 0);
uae_u32 d1 = m68k_dreg(&context->regs, 1);
uae_u32 d2 = m68k_dreg(&context->regs, 2);
uaevar.z3offset = (uae_u32)(get_real_address (0x10000000) - 0x10000000);
uaevar.amigawnd = hAmigaWnd;
a6 = &uaevar;
- if( object_UAM )
- {
- SET_NATIVE_FUNC2(object_UAM );
+ if(object_UAM) {
+ SET_NATIVE_FUNC2(object_UAM);
__asm
{ mov espstore,esp
push regs_
mov esp,espstore
}
//CALL_NATIVE_FUNC2( d1, d2,d3, d4, d5, d6, d7, a1, a2, a3, a4 , a5 , a6 , a7);
+ } else {
+ return 0;
}
- else
- return 0;
}
#endif
if (!ahi_on)
return;
- ahi_on=0;
- ahisndbufpt =(int*) ahisndbuffer;
- samplecount = 0;
- if(lpDSB2) {
- hr = IDirectSoundBuffer_Stop(lpDSB2);
- }
-
- if(FAILED(hr)) {
- write_log( "AHI: SoundStop() failure: %s\n", DXError(hr));
+ ahi_on = 0;
+ record_enabled = 0;
+ ahisndbufpt = (int*) ahisndbuffer;
+
+ if (lpDSB2) {
+ hr = IDirectSoundBuffer_Stop (lpDSB2);
+ if(FAILED(hr))
+ write_log( "AHI: SoundStop() failure: %s\n", DXError(hr));
} else {
write_log( "AHI: Sound Stopped...\n" );
}
- if(lpDSB2) {
- IDirectSoundBuffer_Release( lpDSB2 );
- lpDSB2 = NULL;
- }
- if(lpDSBprimary2)
- {
- IDirectSoundBuffer_Release(lpDSBprimary2);
- lpDSBprimary2 = NULL;
- }
- if(lpDS2)
- {
- IDirectSound_Release(lpDS2);
- lpDS2 = NULL;
- }
+
+ if (lpDSB2)
+ IDirectSoundBuffer_Release (lpDSB2);
+ lpDSB2 = NULL;
+ if (lpDSBprimary2)
+ IDirectSoundBuffer_Release (lpDSBprimary2);
+ lpDSBprimary2 = NULL;
+ if (lpDS2)
+ IDirectSound_Release (lpDS2);
+ lpDS2 = NULL;
- if(lpDSB2r)
- {
- IDirectSoundCaptureBuffer_Release(lpDSB2r);
- lpDSB2r = NULL;
- }
- if(lpDS2r)
- {
- IDirectSound_Release(lpDS2r);
- lpDS2 = NULL;
- }
-#if 0
- if (dsound_tmpw)
- {
- DestroyWindow(dsound_tmpw);
- dsound_tmpw = 0;
- }
-#endif
+ if (lpDSB2r)
+ IDirectSoundCaptureBuffer_Release (lpDSB2r);
+ lpDSB2r = NULL;
+ if (lpDS2r)
+ IDirectSound_Release (lpDS2r);
+ lpDS2r = NULL;
if (ahisndbuffer)
free(ahisndbuffer);
+ ahisndbuffer = NULL;
}
void ahi_updatesound(int force)
{
HRESULT hr;
- int i;
+ int pos;
+ unsigned int dwBytes1, dwBytes2;
+ LPVOID dwData1, dwData2;
+ static int oldpos;
- if(sound_flushes2 == 1)
- {
- oldpos=0;
- INTREQ(0xa000);
- intcount=1;
- /* Lock the entire buffer */
- hr = IDirectSoundBuffer_Lock(lpDSB2, 0, ahisndbufsize, &lpData, &dwBytes,&dwData2,&dwBytes2,0);
- if(hr == DSERR_BUFFERLOST)
- {
+ if(sound_flushes2 == 1) {
+ oldpos = 0;
+ intcount = 1;
+ INTREQ(0x8000 | 0x2000);
+ hr = IDirectSoundBuffer_Play(lpDSB2, 0, 0, DSBPLAY_LOOPING);
+ if(hr == DSERR_BUFFERLOST) {
IDirectSoundBuffer_Restore(lpDSB2);
- hr = IDirectSoundBuffer_Lock(lpDSB2, 0, 0, &lpData, &dwBytes,&dwData2,&dwBytes2, DSBLOCK_ENTIREBUFFER);
+ hr = IDirectSoundBuffer_Play(lpDSB2, 0, 0, DSBPLAY_LOOPING);
}
- /* Get the big looping IDirectSoundBuffer_Play() rolling here, but only once at startup */
- hr = IDirectSoundBuffer_Play(lpDSB2, 0, 0, DSBPLAY_LOOPING);
- hr = IDirectSoundBuffer_Unlock(lpDSB2,lpData,dwBytes,dwData2,dwBytes2);
- if (!norec)
- hr = IDirectSoundCaptureBuffer_Start(lpDSB2r,DSBPLAY_LOOPING);
- //memset( lpData, 0x80,4 );
}
-/*
-{
-long dwEvt=1;
-
- dwEvt = MsgWaitForMultipleObjects(
- 2, // How many possible events
- rghEvent, // Location of handles
- FALSE, // Wait for all?
- INFINITE, // How long to wait
- QS_ALLINPUT); // Any message is an event
-
-calcsound=1;
-if (dwEvt==0)freeblock=0;
-if (dwEvt==1)freeblock=1;
-
-if (dwEvt>1 ){calcsound=0;return;}
-}
-*/
-
- hr = IDirectSoundBuffer_GetCurrentPosition(lpDSB2, &i, 0);
- if(hr != DSERR_BUFFERLOST)
- {
- i -= ahitweak;
- if (i < 0)
- i = i + ahisndbufsize;
- if (i >= ahisndbufsize)
- i = i - ahisndbufsize;
- i = (i / (amigablksize * 4)) * (amigablksize * 4);
- if (force == 1)
- {
- if ((oldpos != i))
- {
- INTREQ(0xa000);
+ hr = IDirectSoundBuffer_GetCurrentPosition(lpDSB2, &pos, 0);
+ if(hr != DSERR_BUFFERLOST) {
+ pos -= ahitweak;
+ if (pos < 0)
+ pos += ahisndbufsize;
+ if (pos >= ahisndbufsize)
+ pos -= ahisndbufsize;
+ pos = (pos / (amigablksize * 4)) * (amigablksize * 4);
+ if (force == 1) {
+ if (oldpos != pos) {
intcount = 1;
+ INTREQ(0x8000 | 0x2000);
return; //to generate amiga ints every amigablksize
} else {
return;
}
hr = IDirectSoundBuffer_Lock(lpDSB2, oldpos, amigablksize * 4, &dwData1, &dwBytes1, &dwData2, &dwBytes2, 0);
- if(hr == DSERR_BUFFERLOST)
- {
- write_log("AHI: lostbuf%d %x\n",i,amigablksize);
+ if(hr == DSERR_BUFFERLOST) {
+ write_log("AHI: lostbuf %d %x\n", pos, amigablksize);
IDirectSoundBuffer_Restore(lpDSB2);
- hr = IDirectSoundBuffer_Lock(lpDSB2, 0, 0, &lpData, &dwBytes, NULL, NULL, DSBLOCK_ENTIREBUFFER);
- dwData1=lpData;dwBytes1=dwBytes;dwBytes2=0;dwData2=0;
+ hr = IDirectSoundBuffer_Lock(lpDSB2, oldpos, amigablksize * 4, &dwData1, &dwBytes1, &dwData2, &dwBytes2, 0);
}
if(FAILED(hr))
return;
- //write_log("%d %x\n",freeblock,blksize);
-
if (currprefs.sound_stereo_swap_ahi) {
int i;
- uae_s16 *p1 = (uae_s16*)ahisndbuffer;
- uae_s16 *p2 = (uae_s16*)dwData1;
- for (i = 0; i < dwBytes1 / 2; i += 2) {
- p2[i + 0] = p1[i + 1];
- p2[i + 1] = p1[i + 0];
+ uae_s16 *p = (uae_s16*)ahisndbuffer;
+ for (i = 0; i < (dwBytes1 + dwBytes2) / 2; i += 2) {
+ uae_s16 tmp;
+ tmp = p[i + 0];
+ p[i + 0] = p[i + 1];
+ p[i + 1] = tmp;
}
- } else {
- memcpy(dwData1,ahisndbuffer,dwBytes1);
}
- sndptrmax = ahisndbuffer+ahisndbufsize;
+ memcpy(dwData1, ahisndbuffer, dwBytes1);
+ if (dwData2)
+ memcpy(dwData2, (uae_u8*)ahisndbuffer + dwBytes1, dwBytes2);
+
+ sndptrmax = ahisndbuffer + ahisndbufsize;
ahisndbufpt = (int*)ahisndbuffer;
- IDirectSoundBuffer_Unlock(lpDSB2, dwData1,dwBytes1,dwData2, dwBytes2);
+ IDirectSoundBuffer_Unlock(lpDSB2, dwData1, dwBytes1, dwData2, dwBytes2);
+
oldpos += amigablksize * 4;
if (oldpos >= ahisndbufsize)
oldpos -= ahisndbufsize;
- if (oldpos != i) {
- INTREQ(0xa000);
+ if (oldpos != pos) {
intcount = 1;
+ INTREQ(0x8000 | 0x2000);
}
}
-/* Use this to pause or stop Win32 sound output */
-
-
void ahi_finish_sound_buffer( void )
{
sound_flushes2++;
extern GUID sound_device_guid[];
+static WAVEFORMATEX wavfmt;
+
+static int ahi_init_record_win32 (void)
+{
+ HRESULT hr;
+ DSCBUFFERDESC sound_buffer_rec;
+ // Record begin
+ hr = DirectSoundCaptureCreate(NULL, &lpDS2r, NULL);
+ if (FAILED(hr)) {
+ write_log( "AHI: DirectSoundCaptureCreate() failure: %s\n", DXError(hr));
+ record_enabled = -1;
+ return 0;
+ }
+ memset (&sound_buffer_rec, 0, sizeof(DSCBUFFERDESC));
+ sound_buffer_rec.dwSize = sizeof(DSCBUFFERDESC);
+ sound_buffer_rec.dwBufferBytes = amigablksize * 4 * RECORDBUFFER;
+ sound_buffer_rec.lpwfxFormat = &wavfmt;
+ sound_buffer_rec.dwFlags = 0 ;
+
+ hr = IDirectSoundCapture_CreateCaptureBuffer(lpDS2r, &sound_buffer_rec, &lpDSB2r, NULL);
+ if (FAILED(hr)) {
+ write_log ("AHI: CreateCaptureSoundBuffer() failure: %s\n", DXError(hr));
+ record_enabled = -1;
+ return 0;
+ }
+
+ hr = IDirectSoundCaptureBuffer_Start(lpDSB2r, DSCBSTART_LOOPING);
+ if (FAILED(hr)) {
+ write_log("AHI: DirectSoundCaptureBuffer_Start failed: %s\n", DXError(hr));
+ record_enabled = -1;
+ return 0;
+ }
+ record_enabled = 1;
+ write_log("AHI: Init AHI Audio Recording \n");
+ return 1;
+}
+
static int ahi_init_sound_win32 (void)
{
HRESULT hr;
DSBUFFERDESC sound_buffer;
DSCAPS DSCaps;
- DSCBUFFERDESC sound_buffer_rec;
if (lpDS2)
return 0;
ahisndbuffer = malloc(ahisndbufsize + 32);
if (!ahisndbuffer)
return 0;
- hr = DirectSoundCreate( &sound_device_guid[currprefs.win32_soundcard], &lpDS2, NULL );
- if (FAILED(hr))
- {
+ hr = DirectSoundCreate(&sound_device_guid[currprefs.win32_soundcard], &lpDS2, NULL);
+ if (FAILED(hr)) {
write_log( "AHI: DirectSoundCreate() failure: %s\n", DXError(hr));
return 0;
}
- memset (&sound_buffer, 0, sizeof( DSBUFFERDESC ));
- sound_buffer.dwSize = sizeof( DSBUFFERDESC );
+ memset (&sound_buffer, 0, sizeof(DSBUFFERDESC));
+ sound_buffer.dwSize = sizeof(DSBUFFERDESC);
sound_buffer.dwFlags = DSBCAPS_PRIMARYBUFFER;
sound_buffer.dwBufferBytes = 0;
sound_buffer.lpwfxFormat = NULL;
-#if 0
- dsound_tmpw = CreateWindowEx( WS_EX_ACCEPTFILES,
- "PCsuxRox",
- "Argh",
- WS_CAPTION,
- CW_USEDEFAULT, CW_USEDEFAULT,
- 10, 10,
- NULL,
- NULL,
- 0,
- NULL);
-#endif
+
DSCaps.dwSize = sizeof(DSCAPS);
hr = IDirectSound_GetCaps(lpDS2, &DSCaps);
- if(SUCCEEDED(hr))
- {
+ if(SUCCEEDED(hr)) {
if(DSCaps.dwFlags & DSCAPS_EMULDRIVER)
write_log( "AHI: Your DirectSound Driver is emulated via WaveOut - yuck!\n" );
}
if FAILED(IDirectSound_SetCooperativeLevel(lpDS2, hMainWnd, DSSCL_PRIORITY))
return 0;
hr = IDirectSound_CreateSoundBuffer(lpDS2, &sound_buffer, &lpDSBprimary2, NULL);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
write_log("AHI: CreateSoundBuffer() failure: %s\n", DXError(hr));
return 0;
}
hr = IDirectSoundBuffer_SetFormat(lpDSBprimary2, &wavfmt);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
write_log( "AHI: SetFormat() failure: %s\n", DXError(hr));
return 0;
}
sound_buffer.dwBufferBytes = ahisndbufsize;
sound_buffer.lpwfxFormat = &wavfmt;
sound_buffer.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLVOLUME /*| DSBCAPS_CTRLPOSITIONNOTIFY */
- | DSBCAPS_GETCURRENTPOSITION2|DSBCAPS_GLOBALFOCUS |DSBCAPS_STATIC ;
+ | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_STATIC ;
hr = IDirectSound_CreateSoundBuffer(lpDS2, &sound_buffer, &lpDSB2, NULL);
- if (FAILED(hr))
- {
+ if (FAILED(hr)) {
write_log("AHI: CreateSoundBuffer() failure: %s\n", DXError(hr));
return 0;
}
-/* //used for PositionNotify
- for ( i = 0; i < 2; i++)
- {
- rghEvent[i] = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (NULL == rghEvent[i]) return FALSE;
- }
- rgdsbpn[0].dwOffset = 0;
- rgdsbpn[0].hEventNotify = rghEvent[0];
- rgdsbpn[1].dwOffset = (soundbufsize/2)*1;
- rgdsbpn[1].hEventNotify = rghEvent[1];
-
-
- if FAILED(IDirectSoundBuffer_QueryInterface(lpDSB,
- &IID_IDirectSoundNotify, (VOID **)&lpdsNotify))
- return FALSE;
-
- if FAILED(IDirectSoundNotify_SetNotificationPositions(
- lpdsNotify, 2,rgdsbpn))
- {
- IDirectSoundNotify_Release(lpdsNotify);
- return FALSE;
- }
-
-*/
hr = IDirectSoundBuffer_SetVolume (lpDSB2, 0);
- if (FAILED(hr))
- {
+ if (FAILED(hr)) {
write_log("AHI: SetVolume() 2 failure: %s\n", DXError(hr));
return 0;
}
hr = IDirectSoundBuffer_GetFormat(lpDSBprimary2,&wavfmt,500,0);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
write_log("AHI: GetFormat() failure: %s\n", DXError(hr));
return 0;
}
- // Record begin
- hr = DirectSoundCaptureCreate( NULL, &lpDS2r, NULL );
- if (FAILED(hr))
- {
- write_log( "AHI: DirectSoundCaptureCreate() failure: %s\n", DXError(hr));
- norec = 1;
- }
- memset (&sound_buffer_rec, 0, sizeof( DSCBUFFERDESC ));
- sound_buffer_rec.dwSize = sizeof( DSCBUFFERDESC );
- sound_buffer_rec.dwBufferBytes = amigablksize*4*RECORDBUFFER;
- sound_buffer_rec.lpwfxFormat = &wavfmt;
- sound_buffer_rec.dwFlags = 0 ;
-
- if (!norec)
- {
- hr = IDirectSoundCapture_CreateCaptureBuffer( lpDS2r, &sound_buffer_rec, &lpDSB2r, NULL );
- if (FAILED(hr))
- {
- write_log ("AHI: CreateCaptureSoundBuffer() failure: %s\n", DXError(hr));
- norec = 1;
- }
- }
- if(ahisndbuffer==0)
- return 0;
- ahisndbufpt =(int*) ahisndbuffer;
+ ahisndbufpt =(int*)ahisndbuffer;
sndptrmax = ahisndbuffer + ahisndbufsize;
- samplecount = 0;
- memset(ahisndbuffer, soundneutral, amigablksize*8);
+ memset(ahisndbuffer, soundneutral, amigablksize * 8);
write_log("AHI: Init AHI Sound Rate %d, Channels %d, Bits %d, Buffsize %d\n",
sound_freq_ahi, sound_channels_ahi, sound_bits_ahi, amigablksize);
- if (!norec)
- write_log("AHI: Init AHI Audio Recording \n");
ahi_on = 1;
return sound_freq_ahi;
}
-static int rate;
-
int ahi_open_sound (void)
{
+ int rate;
+
uaevar.changenum++;
if (!sound_freq_ahi)
return 0;
- if (ahi_on) {
+ if (ahi_on)
ahi_close_sound();
- }
sound_flushes2 = 1;
- if ((rate = ahi_init_sound_win32 ()) )
+ if ((rate = ahi_init_sound_win32 ()))
return rate;
return 0;
}
int opcode = m68k_dreg (&context->regs, 0);
switch (opcode)
{
- int i,slen,t,todo,byte1,byte2;
- LPTSTR p,p2,pos1,pos2;
uae_u32 src, num_vars;
- static int cap_pos,clipsize;
+ static int cap_pos, clipsize;
static LPTSTR clipdat;
- int cur_pos;
case 0:
cap_pos = 0;
case 2:
{
+ int i;
uaecptr addr = m68k_areg (&context->regs, 0);
for (i = 0; i < amigablksize * 4; i += 4)
*ahisndbufpt++ = get_long(addr + i);
case 3:
{
+ LPTSTR pos1,pos2;
uaecptr addr;
HRESULT hr;
- if (norec)
- return -1;
+ int i, t, todo, byte1, byte2, cur_pos;
+
if (!ahi_on)
return -2;
- hr = IDirectSoundCaptureBuffer_GetCurrentPosition(lpDSB2r,&t,&cur_pos);
+ if (record_enabled == 0)
+ ahi_init_record_win32();
+ if (record_enabled < 0)
+ return -2;
+ hr = IDirectSoundCaptureBuffer_GetCurrentPosition(lpDSB2r, &t, &cur_pos);
if (FAILED(hr))
return -1;
+
t = amigablksize * 4;
-
if (cap_pos <= cur_pos)
todo = cur_pos - cap_pos;
else
todo = cur_pos + (RECORDBUFFER * t) - cap_pos;
- if (todo < t) { //if no complete buffer ready exit
+ if (todo < t) //if no complete buffer ready exit
return -1;
- }
- hr = IDirectSoundCaptureBuffer_Lock(lpDSB2r,cap_pos,t,&pos1,&byte1,&pos2,&byte2,0);
+ hr = IDirectSoundCaptureBuffer_Lock(lpDSB2r, cap_pos, t, &pos1, &byte1, &pos2, &byte2, 0);
if (FAILED(hr))
return -1;
- if ((cap_pos + t) < (t * RECORDBUFFER)) {
+ if ((cap_pos + t) < (t * RECORDBUFFER))
cap_pos = cap_pos + t;
- } else {
- cap_pos = 0;
- }
+ else
+ cap_pos = 0;
addr = m68k_areg (&context->regs, 0);
sndbufrecpt = (unsigned int*)pos1;
- t=t/4;
+ t /= 4;
for (i = 0; i < t; i++) {
put_long(addr, *sndbufrecpt++);
addr += 4;
}
t *= 4;
- IDirectSoundCaptureBuffer_Unlock(lpDSB2r,pos1,byte1,pos2,byte2);
+ IDirectSoundCaptureBuffer_Unlock(lpDSB2r, pos1, byte1, pos2, byte2);
+ return (todo - t) / t;
}
- return (todo - t) / t;
case 4:
+ {
+ int i;
if (!ahi_on)
return -2;
i = intcount;
intcount = 0;
- return i;
+ return i;
+ }
case 5:
if (!ahi_on)
return 0;
case 11:
+ {
+ int i;
for (i = 0; i < clipsize; i++)
- put_byte(m68k_areg (&context->regs, 0) + i,clipdat[i]);
+ put_byte(m68k_areg (&context->regs, 0) + i, clipdat[i]);
CloseClipboard();
+ }
return 0;
case 12:
{
- uae_u8 *addr = get_real_address (m68k_areg (&context->regs, 0));
+ uae_u8 *addr = get_real_address (m68k_areg (®s, 0));
+ static LPTSTR p;
+ int slen;
+ LPTSTR p2;
+
if (OpenClipboard (0)) {
EmptyClipboard();
slen = strlen(addr);
- p = GlobalAlloc (GMEM_DDESHARE,slen+2);
+ if (p)
+ GlobalFree (p);
+ p = GlobalAlloc (GMEM_MOVEABLE,slen+2);
if (p) {
p2 = GlobalLock (p);
if (p2) {
GlobalUnlock (p);
SetClipboardData (CF_TEXT,p2);
}
- GlobalFree (p);
- }
+ }
CloseClipboard ();
}
}
{
char *dllname;
uae_u32 result;
- dllname = ( char *) m68k_areg (&context->regs, 0);
+ dllname = (char *) m68k_areg (&context->regs, 0);
dllname = (char *)get_real_address ((uae_u32)dllname);
result=(uae_u32) LoadLibrary(dllname);
write_log("%s windows dll/alib loaded at %d (0 mean failure)\n",dllname,result);
syncdivisor = (3580000.0 * CYCLE_UNIT) / (double)syncbase;
- return result;
+ return result;
}
case 101: //get dll label
m = (HMODULE) m68k_dreg (&context->regs, 1);
funcname = (char *)m68k_areg (&context->regs, 0);
funcname = (char *)get_real_address ((uae_u32)funcname);
- return (uae_u32) GetProcAddress(m,funcname);
+ return (uae_u32) GetProcAddress(m,funcname);
}
case 102: //execute native code
case 104: //screenlost
{
- static int oldnum=0;
+ static int oldnum = 0;
if (uaevar.changenum == oldnum)
return 0;
- oldnum=uaevar.changenum;
+ oldnum = uaevar.changenum;
return 1;
}
#if defined(X86_MSVC_ASSEMBLY)
+
case 105: //returns memory offset
return (uae_u32) get_real_address(0);
+
case 106: //byteswap 16bit vars
//a0 = start address
//d1 = number of 16bit vars
static int first_frame = 1;
static unsigned int StreamSizeAudio; // audio write position
-static double StreamSizeAudioExpected;
+static unsigned int StreamSizeAudioExpected;
int avioutput_audio, avioutput_video, avioutput_enabled, avioutput_requested;
return 1;
}
+static int compressorallocated;
static void AVIOutput_FreeCOMPVARS(COMPVARS *pcv)
{
ICClose(pcv->hic);
- ICCompressorFree(pcv);
+ if (compressorallocated)
+ ICCompressorFree(pcv);
+ compressorallocated = FALSE;
pcv->hic = NULL;
}
int ss;
uae_u8 *state;
+ compressorallocated = TRUE;
ss = ICGetState(pcompvars->hic, NULL, 0);
if (ss > 0) {
+ DWORD err;
state = xmalloc (ss);
- if (ICGetState(pcompvars->hic, state, ss) != ICERR_OK) {
+ err = ICGetState(pcompvars->hic, state, ss);
+ if (err < 0) {
ss = 0;
xfree(state);
}
#include <math.h>
-#define ADJUST_SIZE 50
+#define ADJUST_SIZE 100
#define EXP 1.5
void frame_drawn(void)
{
double diff, skipmode;
+ int idiff;
if (!avioutput_video || !avioutput_enabled)
return;
AVIOutput_WriteVideo();
- if (avioutput_audio && (frame_count % avioutput_fps) == 0) {
- StreamSizeAudioExpected += currprefs.sound_freq;
- diff = (StreamSizeAudio - StreamSizeAudioExpected) / sndbufsize;
- skipmode = pow (diff < 0 ? -diff : diff, EXP);
- if (diff < 0) skipmode = -skipmode;
- if (skipmode < -ADJUST_SIZE) skipmode = -ADJUST_SIZE;
- if (skipmode > ADJUST_SIZE) skipmode = ADJUST_SIZE;
- sound_setadjust (skipmode);
- write_log("AVIOutput: diff=%.2f skip=%.2f\n", diff, skipmode);
- }
+ if (!avioutput_audio || (frame_count % avioutput_fps))
+ return;
+
+ StreamSizeAudioExpected += currprefs.sound_freq;
+ idiff = StreamSizeAudio - StreamSizeAudioExpected;
+ diff = idiff / 100.0;
+ skipmode = pow (diff < 0 ? -diff : diff, EXP);
+ if (idiff < 0)
+ skipmode = -skipmode;
+ if (skipmode < -ADJUST_SIZE)
+ skipmode = -ADJUST_SIZE;
+ if (skipmode > ADJUST_SIZE)
+ skipmode = ADJUST_SIZE;
+
+ sound_setadjust (skipmode);
+
+ write_log("AVIOutput: diff=%.2f skip=%.2f (%d-%d=%d)\n", diff, skipmode,
+ StreamSizeAudio, StreamSizeAudioExpected, idiff);
}
static CRITICAL_SECTION csSigQueueLock;
static DWORD threadid;
-#ifdef __GNUC__
-#define THREAD(func,arg) CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)func,(LPVOID)arg,0,&threadid)
-#define THREADEND()
-#else
#define THREAD(func,arg) (HANDLE)_beginthreadex(NULL, 0, func, arg, 0, &threadid)
#define THREADEND(result) _endthreadex(result)
-#endif
#define SETERRNO bsdsocklib_seterrno(sb, WSAGetLastError() - WSABASEERR)
#define SETHERRNO bsdsocklib_setherrno(sb, WSAGetLastError() - WSABASEERR)
static unsigned int __stdcall sock_thread(void *);
static CRITICAL_SECTION SockThreadCS;
-#define PREPARE_THREAD EnterCriticalSection( &SockThreadCS )
-#define TRIGGER_THREAD { SetEvent( hSockReq ); WaitForSingleObject( hSockReqHandled, INFINITE ); LeaveCriticalSection( &SockThreadCS ); }
+#define PREPARE_THREAD EnterCriticalSection(&SockThreadCS)
+#define TRIGGER_THREAD { SetEvent(hSockReq); WaitForSingleObject(hSockReqHandled, INFINITE); LeaveCriticalSection(&SockThreadCS); }
#define SOCKVER_MAJOR 2
#define SOCKVER_MINOR 2
SetThreadPriority(thread, pri);
}
-static int mySockStartup( void )
+static int mySockStartup(void)
{
int result = 0;
SOCKET dummy;
DWORD lasterror;
- if (WSAStartup(MAKEWORD( SOCKVER_MAJOR, SOCKVER_MINOR ), &wsbData)) {
+ if (WSAStartup(MAKEWORD(SOCKVER_MAJOR, SOCKVER_MINOR), &wsbData)) {
lasterror = WSAGetLastError();
- if( lasterror == WSAVERNOTSUPPORTED ) {
- char szMessage[ MAX_DPATH ];
- WIN32GUI_LoadUIString( IDS_WSOCK2NEEDED, szMessage, MAX_DPATH );
- gui_message( szMessage );
+ if(lasterror == WSAVERNOTSUPPORTED) {
+ char szMessage[MAX_DPATH];
+ WIN32GUI_LoadUIString(IDS_WSOCK2NEEDED, szMessage, MAX_DPATH);
+ gui_message(szMessage);
} else
- write_log( "BSDSOCK: ERROR - Unable to initialize Windows socket layer! Error code: %d\n", lasterror );
+ write_log("BSDSOCK: ERROR - Unable to initialize Windows socket layer! Error code: %d\n", lasterror);
return 0;
}
return 0;
} else {
- write_log( "BSDSOCK: using %s\n", wsbData.szDescription );
+ write_log("BSDSOCK: using %s\n", wsbData.szDescription);
// make sure WSP/NSPStartup gets called from within the regular stack
// (Windows 95/98 need this)
if((dummy = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) != INVALID_SOCKET) {
closesocket(dummy);
result = 1;
} else {
- write_log( "BSDSOCK: ERROR - WSPStartup/NSPStartup failed! Error code: %d\n",
- WSAGetLastError() );
+ write_log("BSDSOCK: ERROR - WSPStartup/NSPStartup failed! Error code: %d\n",
+ WSAGetLastError());
result = 0;
}
}
{
int result = 0;
- if(currprefs.socket_emu) {
+ if (currprefs.socket_emu) {
if((result = mySockStartup())) {
InitializeCriticalSection(&csSigQueueLock);
if(hSockThread == NULL) {
WNDCLASS wc; // Set up an invisible window and dummy wndproc
- InitializeCriticalSection( &SockThreadCS );
- hSockReq = CreateEvent( NULL, FALSE, FALSE, NULL );
- hSockReqHandled = CreateEvent( NULL, FALSE, FALSE, NULL );
+ InitializeCriticalSection(&SockThreadCS);
+ hSockReq = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hSockReqHandled = CreateEvent(NULL, FALSE, FALSE, NULL);
wc.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW;
wc.lpfnWndProc = SocketWindowProc;
wc.lpszMenuName = 0;
wc.lpszClassName = "SocketFun";
if(RegisterClass(&wc)) {
- hSockWnd = CreateWindowEx ( 0,
+ hSockWnd = CreateWindowEx (0,
"SocketFun", "WinUAE Socket Window",
WS_POPUP,
0, 0,
void deinit_socket_layer(void)
{
int i;
- if(currprefs.socket_emu) {
+ if (currprefs.socket_emu) {
WSACleanup();
if(socket_layer_initialized) {
DeleteCriticalSection(&csSigQueueLock);
{
BOOL true = 1;
- if( s )
- {
+ if(s) {
setsockopt(s,SOL_SOCKET,SO_DONTLINGER,(char *)&true,sizeof(true));
shutdown(s,1);
closesocket(s);
if (sb->hEvent != NULL) CloseHandle(sb->hEvent);
- for (i = sb->dtablesize; i--; )
- {
+ for (i = sb->dtablesize; i--; ) {
if (sb->dtable[i] != INVALID_SOCKET) host_closesocketquick(sb->dtable[i]);
- if (sb->mtable[i]) asyncsb[(sb->mtable[i]-0xb000)/2] = NULL;
+ if (sb->mtable[i]) asyncsb[(sb->mtable[i] - 0xb000) / 2] = NULL;
}
shutdown(sb->sockAbort,1);
void host_sbreset(void)
{
- memset(asyncsb,0,sizeof asyncsb);
- memset(asyncsock,0,sizeof asyncsock);
- memset(asyncsd,0,sizeof asyncsd);
- memset(threadargsw,0,sizeof threadargsw);
+ memset(asyncsb, 0, sizeof asyncsb);
+ memset(asyncsock, 0, sizeof asyncsock);
+ memset(asyncsd, 0, sizeof asyncsd);
+ memset(threadargsw, 0, sizeof threadargsw);
}
void sockmsg(unsigned int msg, WPARAM wParam, LPARAM lParam)
if ((SOCKET)wParam != asyncsock[index])
{
// cancel socket event
- WSAAsyncSelect((SOCKET)wParam,hWndSelector ? hAmigaWnd : hSockWnd,0,0);
+ WSAAsyncSelect((SOCKET)wParam, hWndSelector ? hAmigaWnd : hSockWnd, 0, 0);
return;
}
- sdi = asyncsd[index]-1;
+ sdi = asyncsd[index] - 1;
// asynchronous socket event?
if (sb && !(sb->ftable[sdi] & SF_BLOCKINGINPROGRESS) && sb->mtable[sdi])
RelativePath="..\..\build68k.c"
>
</File>
- <File
- RelativePath=".\build68k.rc"
- >
- </File>
</Filter>
- <File
- RelativePath=".\resource.h"
- >
- </File>
</Files>
<Globals>
</Globals>
+++ /dev/null
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by build68k.rc
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
#define RDP_MOUSE1 "\\??\\Root#RDP_MOU#"
#define RDP_MOUSE2 "\\\\?\\Root#RDP_MOU#"
+static int rdpmouse(char *buf)
+{
+ if (!memcmp (RDP_MOUSE1, buf, strlen (RDP_MOUSE1)))
+ return 1;
+ if (!memcmp (RDP_MOUSE2, buf, strlen (RDP_MOUSE2)))
+ return 1;
+ return 0;
+}
+
static int initialize_rawinput (void)
{
RAWINPUTDEVICELIST *ridl = 0;
ridl = malloc (sizeof(RAWINPUTDEVICELIST) * num);
memset (ridl, 0, sizeof (RAWINPUTDEVICELIST) * num);
- bufsize = 1000;
+ bufsize = 10000;
buf = malloc (bufsize);
+ register_rawinput();
gotnum = pGetRawInputDeviceList(ridl, &num, sizeof (RAWINPUTDEVICELIST));
if (gotnum <= 0) {
write_log ("RAWINPUT didn't find any devices\n");
for (i = 0; i < gotnum; i++) {
int type = ridl[i].dwType;
HANDLE h = ridl[i].hDevice;
- vtmp = bufsize;
- pGetRawInputDeviceInfo (h, RIDI_DEVICENAME, buf, &vtmp);
- if (!memcmp (RDP_MOUSE1, buf, strlen (RDP_MOUSE1)))
+ if (pGetRawInputDeviceInfo (h, RIDI_DEVICENAME, NULL, &vtmp) == 1)
+ continue;
+ if (vtmp >= bufsize)
+ continue;
+ if (pGetRawInputDeviceInfo (h, RIDI_DEVICENAME, buf, &vtmp) == -1)
continue;
- if (!memcmp (RDP_MOUSE2, buf, strlen (RDP_MOUSE2)))
+ if (rdpmouse(buf))
continue;
if (type == RIM_TYPEMOUSE)
rnum_mouse++;
PRID_DEVICE_INFO rdi;
int v, j;
- vtmp = bufsize;
- pGetRawInputDeviceInfo (h, RIDI_DEVICENAME, buf, &vtmp);
+ if (pGetRawInputDeviceInfo (h, RIDI_DEVICENAME, NULL, &vtmp) == -1)
+ continue;
+ if (vtmp >= bufsize)
+ continue;
+ if (pGetRawInputDeviceInfo (h, RIDI_DEVICENAME, buf, &vtmp) == -1)
+ continue;
if (did == di_mouse) {
- if (!memcmp (RDP_MOUSE1, buf, strlen (RDP_MOUSE1)))
+ if (rdpmouse(buf))
continue;
- if (!memcmp (RDP_MOUSE2, buf, strlen (RDP_MOUSE2)))
- continue;
- if (rnum_mouse < 2)
+ if (rnum_mouse < 2 && !os_vista)
continue;
if (num_mouse >= MAX_INPUT_DEVICES - 1) /* leave space for Windows mouse */
continue;
write_log ("%p %s: ", h, type == RIM_TYPEMOUSE ? "mouse" : "keyboard");
did->sortname = my_strdup (buf);
write_log ("'%s'\n", buf);
- vtmp = bufsize;
rdi = (PRID_DEVICE_INFO)buf;
rdi->cbSize = sizeof (RID_DEVICE_INFO);
- pGetRawInputDeviceInfo (h, RIDI_DEVICEINFO, buf, &vtmp);
+ if (pGetRawInputDeviceInfo (h, RIDI_DEVICEINFO, NULL, &vtmp) == -1)
+ continue;
+ if (vtmp >= bufsize)
+ continue;
+ if (pGetRawInputDeviceInfo (h, RIDI_DEVICEINFO, buf, &vtmp) == -1)
+ continue;
if (type == RIM_TYPEMOUSE) {
PRID_DEVICE_INFO_MOUSE rdim = &rdi->mouse;
- write_log ("id=%d buttons=%d rate=%d",
- rdim->dwId, rdim->dwNumberOfButtons, rdim->dwSampleRate);
+ write_log ("id=%d buttons=%d hw=%d rate=%d\n",
+ rdim->dwId, rdim->dwNumberOfButtons, rdim->fHasHorizontalWheel, rdim->dwSampleRate);
did->buttons = rdim->dwNumberOfButtons;
did->axles = 3;
did->axistype[0] = 1;
did->axistype[2] = 1;
did->axissort[2] = 2;
did->axisname[2] = my_strdup ("Wheel");
+ if (rdim->fHasHorizontalWheel) {
+ did->axistype[3] = 1;
+ did->axissort[3] = 3;
+ did->axisname[3] = my_strdup ("HWheel");
+ did->axles++;
+ }
for (j = 0; j < did->buttons; j++) {
did->buttonsort[j] = j;
sprintf (tmp, "Button %d", j + 1);
rdik->dwType, rdik->dwSubType, rdik->dwKeyboardMode,
rdik->dwNumberOfFunctionKeys, rdik->dwNumberOfIndicators, rdik->dwNumberOfKeysTotal);
}
- write_log("\n");
}
}
did->buttons = 5; /* no non-direcinput support for >5 buttons */
if (did->buttons > 3 && !os_winnt)
did->buttons = 3; /* Windows 98/ME support max 3 non-DI buttons */
- did->axles = 3;
+ did->axles = os_vista ? 4 : 3;
did->axistype[0] = 1;
did->axissort[0] = 0;
did->axisname[0] = my_strdup ("X-Axis");
did->axissort[2] = 2;
did->axisname[2] = my_strdup ("Wheel");
}
+ if (did->axles > 3) {
+ did->axistype[3] = 1;
+ did->axissort[3] = 3;
+ did->axisname[3] = my_strdup ("HWheel");
+ }
for (j = 0; j < did->buttons; j++) {
did->buttonsort[j] = j;
sprintf (tmp, "Button %d", j + 1);
}
+static void fixbuttons (struct didata *did)
+{
+ if (did->buttons > 0)
+ return;
+ write_log("'%s' has no buttons, adding single default button\n", did->name);
+ did->buttonmappings[0] = DIJOFS_BUTTON(0);
+ did->buttonsort[0] = 0;
+ did->buttonname[0] = my_strdup("Button");
+ did->buttons++;
+}
+
static void sortobjects (struct didata *did, int *mappings, int *sort, char **names, int *types, int num)
{
int i, j, tmpi;
}
did->axles += 2;
}
+
if (pdidoi->dwType & DIDFT_BUTTON) {
if (did->buttons >= MAX_MAPPINGS)
return DIENUM_CONTINUE;
}
did->buttons++;
}
+
return DIENUM_CONTINUE;
}
if (hr == DI_OK) {
hr = IDirectInputDevice8_SetDataFormat(lpdi, &c_dfDIMouse);
IDirectInputDevice8_EnumObjects (lpdi, EnumObjectsCallback, (void*)did, DIDFT_ALL);
+ fixbuttons (did);
sortobjects (did, did->axismappings, did->axissort, did->axisname, did->axistype, did->axles);
sortobjects (did, did->buttonmappings, did->buttonsort, did->buttonname, 0, did->buttons);
did->lpdi = lpdi;
continue;
if (did->connection == DIDC_CAT) {
int cx, cy, cbuttons;
- catweasel_read_mouse(did->catweasel, &cx, &cy, &cbuttons);
- if (cx)
- setmousestate(i, 0, cx, 0);
- if (cy)
- setmousestate(i, 1, cy, 0);
- setmousebuttonstate(i, 0, cbuttons & 8);
- setmousebuttonstate(i, 1, cbuttons & 4);
- setmousebuttonstate(i, 2, cbuttons & 2);
+ if (catweasel_read_mouse(did->catweasel, &cx, &cy, &cbuttons)) {
+ if (cx)
+ setmousestate(i, 0, cx, 0);
+ if (cy)
+ setmousestate(i, 1, cy, 0);
+ setmousebuttonstate(i, 0, cbuttons & 8);
+ setmousebuttonstate(i, 1, cbuttons & 4);
+ setmousebuttonstate(i, 2, cbuttons & 2);
+ }
continue;
}
if (!lpdi || did->connection != DIDC_DX)
&InputBuffer, DataLength, &OutputBuffer, DataLength, &ReturnedLength, NULL))
return 0;
led = 0;
- if (OutputBuffer.LedFlags & KEYBOARD_NUM_LOCK_ON) led |= KBLED_NUMLOCK;
- if (OutputBuffer.LedFlags & KEYBOARD_CAPS_LOCK_ON) led |= KBLED_CAPSLOCK;
- if (OutputBuffer.LedFlags & KEYBOARD_SCROLL_LOCK_ON) led |= KBLED_SCROLLLOCK;
+ if (OutputBuffer.LedFlags & KEYBOARD_NUM_LOCK_ON)
+ led |= KBLED_NUMLOCK;
+ if (OutputBuffer.LedFlags & KEYBOARD_CAPS_LOCK_ON)
+ led |= KBLED_CAPSLOCK;
+ if (OutputBuffer.LedFlags & KEYBOARD_SCROLL_LOCK_ON) led
+ |= KBLED_SCROLLLOCK;
#endif
}
return led;
continue;
if (did->connection == DIDC_CAT) {
uae_u8 cdir, cbuttons;
- catweasel_read_joystick(&cdir, &cbuttons);
- cdir >>= did->catweasel * 4;
- cbuttons >>= did->catweasel * 4;
- setjoystickstate(i, 0, !(cdir & 1) ? 1 : !(cdir & 2) ? -1 : 0, 0);
- setjoystickstate(i, 1, !(cdir & 4) ? 1 : !(cdir & 8) ? -1 : 0, 0);
- setjoybuttonstate(i, 0, cbuttons & 8);
- setjoybuttonstate(i, 1, cbuttons & 4);
- setjoybuttonstate(i, 2, cbuttons & 2);
+ if (catweasel_read_joystick(&cdir, &cbuttons)) {
+ cdir >>= did->catweasel * 4;
+ cbuttons >>= did->catweasel * 4;
+ setjoystickstate(i, 0, !(cdir & 1) ? 1 : !(cdir & 2) ? -1 : 0, 0);
+ setjoystickstate(i, 1, !(cdir & 4) ? 1 : !(cdir & 8) ? -1 : 0, 0);
+ setjoybuttonstate(i, 0, cbuttons & 8);
+ setjoybuttonstate(i, 1, cbuttons & 4);
+ setjoybuttonstate(i, 2, cbuttons & 2);
+ }
continue;
}
lpdi = did->lpdi;
if (hr == DI_OK) {
did->lpdi = lpdi;
IDirectInputDevice8_EnumObjects (lpdi, EnumObjectsCallback, (void*)did, DIDFT_ALL);
+ fixbuttons (did);
sortobjects (did, did->axismappings, did->axissort, did->axisname, did->axistype, did->axles);
sortobjects (did, did->buttonmappings, did->buttonsort, did->buttonname, 0, did->buttons);
}
static int drive_write_adf_amigados (UWORD *mbuf, UWORD *mend, UBYTE *writebuffer, UBYTE *writebuffer_ok, int track)
{
- int i, secwritten = 0;
+ int i;
ULONG odd, even, chksum, id, dlong;
UBYTE *secdata;
UBYTE secbuf[544];
- char sectable[11];
- memset (sectable, 0, sizeof (sectable));
mend -= (4 + 16 + 8 + 512);
- while (secwritten < 11) {
+ for (;;) {
int trackoffs;
+ /* all sectors complete? */
+ for (i = 0; i < 11; i++) {
+ if (!writebuffer_ok[i])
+ break;
+ }
+ if (i == 11)
+ return 0;
+
do {
while (*mbuf++ != 0x4489) {
if (mbuf >= mend) {
printf("* corrupt sector number %d\n", trackoffs);
goto next;
}
+ /* this sector is already ok? */
+ if (writebuffer_ok[trackoffs])
+ goto next;
+
chksum = odd ^ even;
for (i = 0; i < 4; i++) {
odd = getmfmlong (mbuf);
printf("* sector %d data crc error\n", trackoffs);
goto next;
}
- sectable[trackoffs] = 1;
- secwritten++;
memcpy (writebuffer + trackoffs * 512, secbuf + 32, 512);
- writebuffer_ok[trackoffs] = 1;
+ writebuffer_ok[trackoffs] = 0xff;
continue;
next:
mbuf += 8;
}
- if (secwritten == 0 || secwritten < 0) return 5;
- return 0;
}
/* search and align to 0x4489 WORDSYNC markers */
#define TRACK_SIZE 16384
#define MAX_RETRIES 50
-static UBYTE writebuffer[11 * 512];
-static UBYTE writebuffer_ok[11];
+#define SECTORS 11
+#define CYLINDERS 80
+#define TRACKS (CYLINDERS * 2)
+#define BLOCKSIZE 512
+
+static UBYTE writebuffer[SECTORS * BLOCKSIZE];
static BYTE *trackbuffer;
static HANDLE h = INVALID_HANDLE_VALUE;
-static FILE *fout;
static int checkversion(void)
{
int trk, i, j, sec;
int errsec, oktrk, retr;
time_t t = time(0);
+ static FILE *fout, *ferr;
+ char *fnameerr;
+ UBYTE writebuffer_ok[SECTORS];
+ int fromscratch = 0;
+
+ memset (writebuffer, 0, sizeof writebuffer);
+ fout = fopen(fname,"r+b");
+ if (!fout) {
+ if (!(fout = fopen(fname, "w+b"))) {
+ printf("Failed to create '%s'\n", fname);
+ return;
+ }
+ /* pre-create the image */
+ for (i = 0; i < (sizeof writebuffer) / 8; i++)
+ memcpy (writebuffer + i * 8, "*NULADF*", 8);
+ for (i = 0; i < TRACKS; i++)
+ fwrite(writebuffer, SECTORS * BLOCKSIZE, 1, fout);
+ fromscratch = 1;
+ }
- if (!(fout = fopen(fname, "wb"))) {
- printf("Failed to open '%s'\n", fname);
- return;
+ /* create error status file */
+ memset (writebuffer, 0, sizeof writebuffer);
+ fnameerr = malloc (strlen (fname) + 10);
+ sprintf (fnameerr, "%s.status", fname);
+ ferr = fopen(fnameerr, "r+b");
+ if (!ferr) {
+ ferr = fopen(fnameerr, "w+b");
+ fromscratch = 1;
}
+ if (ferr && fromscratch)
+ fwrite(writebuffer, SECTORS * TRACKS, 1, ferr);
+
errsec = oktrk = retr = 0;
- for (trk = 0; trk < 2 * 80; trk++) {
+ for (trk = 0; trk < TRACKS; trk++) {
+
printf ("Track %d: processing started..\n", trk);
memset (writebuffer_ok, 0, sizeof writebuffer_ok);
- memset (writebuffer, 0, sizeof writebuffer);
- sec = 0;
- for (j = 0; j < MAX_RETRIES; j++) {
+ /* fill decoded trackbuffer with easily detectable error code */
+ for (i = 0; i < (sizeof writebuffer) / 8; i++)
+ memcpy (writebuffer + i * 8, "*ERRADF*", 8);
+
+ /* read possible old track */
+ if (ferr) {
+ if (!fseek(ferr, trk * SECTORS, SEEK_SET))
+ fread (writebuffer_ok, SECTORS, 1, ferr);
+ if (!fseek(fout, SECTORS * BLOCKSIZE * trk, SEEK_SET))
+ fread (writebuffer, SECTORS * BLOCKSIZE, 1, fout);
+ }
+
+ j = 0;
+ for (;;) {
+ /* all sectors ok? */
+ sec = 0;
+ for (i = 0; i < SECTORS; i++) {
+ if (writebuffer_ok[i])
+ sec++;
+ }
+ if (sec == SECTORS || j >= MAX_RETRIES)
+ break;
+
if (j > 0)
- printf("Retrying.. (%d of max %d), %d/%d sectors ok\n", j, MAX_RETRIES - 1, sec, 11);
+ printf("Retrying.. (%d of max %d), %d/%d sectors ok\n", j, MAX_RETRIES - 1, sec, SECTORS);
+ /* read raw track */
if (!readraw(trk / 2, trk % 2)) {
printf("Raw read error, possible reasons:\nMissing second drive or your hardware only supports single drive.\nOperation aborted.\n");
return;
}
+ /* decode track (ignores already ok sectors) */
isamigatrack(trackbuffer, TRACK_SIZE, writebuffer, writebuffer_ok, trk);
- sec = 0;
- for (i = 0; i < 11; i++) {
- if (writebuffer_ok[i])
- sec++;
- }
- if (sec == 11)
- break;
retr++;
if ((retr % 10) == 0)
seek(trk == 0 ? 2 : 0, 0);
+ j++;
}
- errsec += 11 - sec;
+ errsec += SECTORS - sec;
if (j == MAX_RETRIES) {
- printf("Track %d: read error or non-AmigaDOS formatted track (%d/%d sectors ok)\n", trk, sec, 11);
+ printf("Track %d: read error or non-AmigaDOS formatted track (%d/%d sectors ok)\n", trk, sec, SECTORS);
} else {
oktrk++;
printf("Track %d: all sectors ok (%d retries)\n", trk, j);
}
- fwrite(writebuffer, 11 * 512, 1, fout);
+ /* write decoded track */
+ fseek(fout, SECTORS * BLOCKSIZE * trk, SEEK_SET);
+ fwrite(writebuffer, SECTORS * BLOCKSIZE, 1, fout);
+ /* write sector status */
+ if (ferr) {
+ fseek(ferr, trk * SECTORS, SEEK_SET);
+ fwrite (writebuffer_ok, SECTORS, 1, ferr);
+ };
+
}
fclose(fout);
+ if (ferr) {
+ fclose(ferr);
+ if (oktrk >= TRACKS)
+ unlink(fnameerr);
+ }
+ free(fnameerr);
t = time(0) - t;
printf ("Completed. %02.2dm%02.2ds, %d/160 tracks read without errors, %d retries, %d faulty sectors\n",
t / 60, t % 60, oktrk, retr, errsec);
if (aino->deleted)
return 0;
- if (!fsdb_mode_representable_p (aino) || aino->comment != 0)
+ if (!fsdb_mode_representable_p (aino, aino->amigaos_mode) || aino->comment != 0)
return 1;
nn_begin = nname_begin (aino->nname);
return ERROR_OBJECT_NOT_AROUND;
mode &= FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
- /* Unix dirs behave differently than AmigaOS ones. */
- /* windows dirs go where no dir has gone before... */
- if (! aino->dir) {
+ if (1 || ! aino->dir) {
mode = 0;
if ((tmpmask & (A_FIBF_WRITE | A_FIBF_DELETE)) == 0)
mode |= FILE_ATTRIBUTE_READONLY;
int fsdb_mode_supported (const a_inode *aino)
{
int mask = aino->amigaos_mode;
- if (fsdb_mode_representable_p (aino))
+ if (0 && aino->dir)
+ return 0;
+ if (fsdb_mode_representable_p (aino, mask))
+ return mask;
+ mask &= ~(A_FIBF_SCRIPT | A_FIBF_READ | A_FIBF_EXECUTE);
+ if (fsdb_mode_representable_p (aino, mask))
+ return mask;
+ mask &= ~A_FIBF_WRITE;
+ if (fsdb_mode_representable_p (aino, mask))
return mask;
- mask &= ~(A_FIBF_SCRIPT | A_FIBF_DELETE | A_FIBF_WRITE);
- return mask;
+ mask &= ~A_FIBF_DELETE;
+ if (fsdb_mode_representable_p (aino, mask))
+ return mask;
+ return 0;
}
/* Return nonzero if we can represent the amigaos_mode of AINO within the
* native FS. Return zero if that is not possible. */
-int fsdb_mode_representable_p (const a_inode *aino)
+int fsdb_mode_representable_p (const a_inode *aino, int amigaos_mode)
{
- int mask = aino->amigaos_mode ^ 15;
+ int mask = amigaos_mode ^ 15;
- if (aino->dir)
- return aino->amigaos_mode == 0;
+ if (0 && aino->dir)
+ return amigaos_mode == 0;
- if (mask == 15) /* ---RWED == OK */
+ if (mask & A_FIBF_SCRIPT) /* script */
+ return 0;
+ if ((mask & 15) == 15) /* xxxxRWED == OK */
return 1;
if (!(mask & A_FIBF_EXECUTE)) /* not executable */
return 0;
if (!(mask & A_FIBF_READ)) /* not readable */
return 0;
- if (mask & A_FIBF_SCRIPT) /* script */
- return 0;
- if ((mask & 15) == (A_FIBF_READ | A_FIBF_EXECUTE)) /* ----R-E- == ReadOnly */
+ if ((mask & 15) == (A_FIBF_READ | A_FIBF_EXECUTE)) /* ----RxEx == ReadOnly */
return 1;
return 0;
}
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\..\..\msvs2005\VC\VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\..\..\msvs2005\VC\VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\..\..\msvs2005\VC\VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\..\..\msvs2005\VC\VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\..\..\msvs2005\VC\VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\..\..\msvs2005\VC\VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
hdf_init ();
i = isharddrive (name);
if (i >= 0) {
+ DWORD r;
udi = &uae_drives[i];
hfd->flags = 1;
flags = FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS;
hdf_close (hfd);
return 0;
}
+ if (!DeviceIoControl(h, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, 0, NULL, 0, &r, NULL))
+ write_log("FSCTL_ALLOW_EXTENDED_DASD_IO returned %d\n", GetLastError());
strncpy (hfd->vendor_id, udi->vendor_id, 8);
strncpy (hfd->product_id, udi->product_id, 16);
strncpy (hfd->product_rev, udi->product_rev, 4);
int code = 0;
static int swapperdrive = 0;
+ if (scancode == specialkeycode())
+ return;
+
//write_log( "keyboard = %d scancode = 0x%02.2x state = %d\n", keyboard, scancode, newstate );
if (newstate) {
switch (scancode)
return;
}
- if (scancode == specialkeycode())
- return;
if (specialpressed())
return;
#define FLAGVAL_V (1 << FLAGBIT_V)
#define FLAGVAL_X (1 << FLAGBIT_X)
-#define SET_ZFLG(flags, y) ((flags)->cznv = ((flags)->cznv & ~FLAGVAL_Z) | (((y) & 1) << FLAGBIT_Z))
-#define SET_CFLG(flags, y) ((flags)->cznv = ((flags)->cznv & ~FLAGVAL_C) | (((y) & 1) << FLAGBIT_C))
-#define SET_VFLG(flags, y) ((flags)->cznv = ((flags)->cznv & ~FLAGVAL_V) | (((y) & 1) << FLAGBIT_V))
-#define SET_NFLG(flags, y) ((flags)->cznv = ((flags)->cznv & ~FLAGVAL_N) | (((y) & 1) << FLAGBIT_N))
-#define SET_XFLG(flags, y) ((flags)->x = (y) << FLAGBIT_X)
+#define SET_ZFLG(flags, y) ((flags)->cznv = ((flags)->cznv & ~FLAGVAL_Z) | (((y) ? 1 : 0) << FLAGBIT_Z))
+#define SET_CFLG(flags, y) ((flags)->cznv = ((flags)->cznv & ~FLAGVAL_C) | (((y) ? 1 : 0) << FLAGBIT_C))
+#define SET_VFLG(flags, y) ((flags)->cznv = ((flags)->cznv & ~FLAGVAL_V) | (((y) ? 1 : 0) << FLAGBIT_V))
+#define SET_NFLG(flags, y) ((flags)->cznv = ((flags)->cznv & ~FLAGVAL_N) | (((y) ? 1 : 0) << FLAGBIT_N))
+#define SET_XFLG(flags, y) ((flags)->x = ((y) ? 1 : 0) << FLAGBIT_X)
#define GET_ZFLG(flags) (((flags)->cznv >> FLAGBIT_Z) & 1)
#define GET_CFLG(flags) (((flags)->cznv >> FLAGBIT_C) & 1)
memstats.dwLength = sizeof(memstats);
GlobalMemoryStatus(&memstats);
-
totalphys64 = memstats.dwTotalPhys;
- size64 = 16 * 1024 * 1024;
total64 = (uae_u64)memstats.dwAvailPageFile + (uae_u64)memstats.dwAvailPhys;
+ if (os_winnt) {
+ typedef BOOL (CALLBACK* GLOBALMEMORYSTATUSEX)(LPMEMORYSTATUSEX);
+ GLOBALMEMORYSTATUSEX pGlobalMemoryStatusEx;
+ MEMORYSTATUSEX memstatsex;
+ pGlobalMemoryStatusEx = (GLOBALMEMORYSTATUSEX)GetProcAddress(GetModuleHandle("kernel32.dll"), "GlobalMemoryStatusEx");
+ if (pGlobalMemoryStatusEx) {
+ memstatsex.dwLength = sizeof (MEMORYSTATUSEX);
+ if (pGlobalMemoryStatusEx(&memstatsex)) {
+ totalphys64 = memstatsex.ullTotalPhys;
+ total64 = memstatsex.ullAvailPageFile + memstatsex.ullAvailPhys;
+ }
+ }
+ }
+
+ size64 = 16 * 1024 * 1024;
while (total64 >= (size64 << 1)
&& size64 != ((uae_u64)2048) * 1024 * 1024)
size64 <<= 1;
addrbank gfxmem_bank = {
gfxmem_lget, gfxmem_wget, gfxmem_bget,
gfxmem_lput, gfxmem_wput, gfxmem_bput,
- gfxmem_xlate, gfxmem_check, NULL
+ gfxmem_xlate, gfxmem_check, NULL, "RTG RAM",
+ dummy_lgeti, dummy_wgeti, ABFLAG_RAM
};
/* Call this function first, near the beginning of code flow
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
COMBOBOX IDC_INPUTTYPE,5,5,98,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_INPUTDEVICE,109,4,167,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
- CONTROL "",IDC_INPUTDEVICEDISABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,282,7,9,8
+ COMBOBOX IDC_INPUTDEVICE,109,5,167,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ CONTROL "",IDC_INPUTDEVICEDISABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,282,8,9,8
CONTROL "List1",IDC_INPUTLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,5,22,290,146
COMBOBOX IDC_INPUTAMIGACNT,5,174,24,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_INPUTAMIGA,33,174,262,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
IDD_INPUT, DIALOG
BEGIN
- BOTTOMMARGIN, 187
+ BOTTOMMARGIN, 240
END
IDD_QUICKSTART, DIALOG
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,3,3,0
- PRODUCTVERSION 1,3,3,0
+ FILEVERSION 1,3,4,0
+ PRODUCTVERSION 1,3,4,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "WinUAE"
- VALUE "FileVersion", "1.3.3"
+ VALUE "FileVersion", "1.3.4"
VALUE "InternalName", "WinUAE"
VALUE "LegalCopyright", "© 1996-2006 under the GNU Public License (GPL)"
VALUE "OriginalFilename", "WinUAE.exe"
VALUE "ProductName", "WinUAE"
- VALUE "ProductVersion", "1.3.3"
+ VALUE "ProductVersion", "1.3.4"
END
END
BLOCK "VarFileInfo"
IDS_DELETECONFIGCONFIRMATION
"Are you sure you want to Delete this configuration?\n"
IDS_DELETECONFIGTITLE "Confirm Delete"
- IDS_GFXCARDCHECK "WinUAE will now determine the 16-bit pixel format of your graphics card. Your\nscreen will go black for two seconds, with a resolution of 640x480 @ 60Hz. This\nprocedure is required for best rendering of the emulation environment on 16-bit\ndisplay-modes, and should be done whenever you run WinUAE for the first time, or\ninstall a new graphics card in your PC. Proceed with this test?"
+ IDS_GFXCARDCHECK "WinUAE will now determine the 16-bit pixel format of your graphics card. Your screen will go black for two seconds, with a resolution of 640x480 @ 60Hz. This procedure is required for best rendering of the emulation environment on 16-bit display-modes, and should be done whenever you run WinUAE for the first time, or install a new graphics card in your PC. Proceed with this test?"
IDS_GFXCARDTITLE "Pixel format detection"
IDS_MUSTSELECTPATH "You must select a path!"
IDS_SETTINGSERROR "Settings error"
#include <math.h>
-#define ADJUST_SIZE 100
-#define EXP 1.9
+#define ADJUST_SIZE 30
+#define EXP 2.1
int sound_debug = 0;
if (max_sndbufsize > dsoundbuf)
max_sndbufsize = dsoundbuf;
- snd_writeoffset = max_sndbufsize * 3 / 4;
+ snd_writeoffset = max_sndbufsize * 5 / 8;
snd_maxoffset = max_sndbufsize;
snd_totalmaxoffset_of = max_sndbufsize + (dsoundbuf - max_sndbufsize) / 3;
snd_totalmaxoffset_uf = max_sndbufsize + (dsoundbuf - max_sndbufsize) * 2 / 3;
write_log ("DS driver '%s'/%d/%d bits/%d Hz/buffer %d/dist %d\n",
sound_devices[currprefs.win32_soundcard],
- currprefs.sound_stereo,
+ wavfmt.nChannels,
16, freq, max_sndbufsize, snd_configsize);
obtainedfreq = currprefs.sound_freq;
static void finish_sound_buffer_ds (void)
{
+ static int tfprev;
DWORD playpos, safepos, status;
HRESULT hr;
void *b1, *b2;
return;
}
safedist -= playpos;
+ if (safedist < 64)
+ safedist = 64;
safedist += sndbufsize;
if (safedist < 0)
safedist += dsoundbuf;
cf (snd_writeoffset);
waiting_for_buffer = -1;
restart_sound_buffer();
- write_log("SOUND: safe=%d w=%d max=%d tof=%d tuf=%d\n",
- safedist, snd_writeoffset, snd_maxoffset, snd_totalmaxoffset_of, snd_totalmaxoffset_uf);
+ write_log("SOUND: safe=%d bs=%d w=%d max=%d tof=%d tuf=%d\n",
+ safedist - sndbufsize, sndbufsize, snd_writeoffset,
+ snd_maxoffset, snd_totalmaxoffset_of, snd_totalmaxoffset_uf);
+ tfprev = timeframes + 10;
+ tfprev = (tfprev / 10) * 10;
}
hr = IDirectSoundBuffer_GetStatus (lpDSBsecondary, &status);
if (diff > snd_totalmaxoffset_of) {
gui_data.sndbuf_status = 2;
statuscnt = SND_STATUSCNT;
- writepos = safepos + snd_writeoffset;
- cf(writepos);
+ restart_sound_buffer();
diff = snd_writeoffset;
break;
}
vdiff = diff - snd_writeoffset;
m = 100.0 * vdiff / max_sndbufsize;
- skipmode = pow (m < 0 ? -m : m, EXP) / 2.0;
+ skipmode = pow (m < 0 ? -m : m, EXP) / 2;
if (m < 0)
skipmode = -skipmode;
if (skipmode > ADJUST_SIZE)
skipmode = ADJUST_SIZE;
- if (sound_debug) {
- static int tfprev;
- if (tfprev != timeframes && !(timeframes % 10)) {
- write_log ("b=%5d,%5d,%5d,%5d d=%5d vd=%5.0f s=%+02.1f\n",
+ if (tfprev != timeframes) {
+ if (sound_debug && !(tfprev % 10))
+ write_log ("b=%4d,%5d,%5d,%5d d=%5d vd=%5.0f s=%+02.1f\n",
sndbufsize, snd_configsize, max_sndbufsize, dsoundbuf, diff, vdiff, skipmode);
- }
tfprev = timeframes;
+ if (!avioutput_audio)
+ sound_setadjust (skipmode);
+ gui_data.sndbuf = vdiff * 1000 / (snd_maxoffset - snd_writeoffset);
}
writepos += sndbufsize;
cf(writepos);
-
- if (!avioutput_audio)
- sound_setadjust (skipmode);
-
- gui_data.sndbuf = vdiff * 1000 / snd_maxoffset;
}
static void channelswap(uae_s16 *sndbuffer, int len)
-cd d:\projects\winuae_bak
+cd c:\projects\winuae_bak
rm -rf bak
mkdir bak
-copy /s d:\projects\winuae\src\*.* d:\projects\winuae_bak\bak\
-copy f:\amiga\text\winuaechangelog.txt d:\projects\winuae_bak\bak\od-win32
+copy /s c:\projects\winuae\src\*.* c:\projects\winuae_bak\bak\
+copy d:\amiga\text\winuaechangelog.txt c:\projects\winuae_bak\bak\od-win32
cd bak
del *.obj *.ilk *.exe *.pdb *.pch *.idb /s
zip -9 -r winuaesrc *
-copy winuaesrc.zip f:\amiga\winuaepackets\winuaesrc%1.zip
-move winuaesrc.zip f:\amiga
-cd d:\projects\winuae\src\od-win32
+copy winuaesrc.zip d:\amiga\winuaepackets\winuaesrc%1.zip
+move winuaesrc.zip d:\amiga
+cd c:\projects\winuae\src\od-win32
zip -9 winuaedebug%1 winuae_msvc\release\winuae.pdb
-move winuaedebug%1.zip f:\amiga\winuaepackets\
+move winuaedebug%1.zip d:\amiga\winuaepackets\
#include <stdarg.h>
#include <signal.h>
-#define _WIN32_WINNT 0x501 /* XButtons */
+#define _WIN32_WINNT 0x600 /* XButtons + MOUSEHWHEEL */
#include <windows.h>
#include <commctrl.h>
static int forceroms;
char VersionStr[256];
+char BetaStr[64];
int in_sizemove;
int manual_painting_needed;
if (QueryPerformanceFrequency(&freq)) {
qpc_avail = 1;
qpfrate = freq.QuadPart;
- /* we don't want 32-bit overflow, limit to 100MHz */
+ /* limit to 10MHz */
qpcdivisor = 0;
- while (qpfrate > 100000000) {
+ while (qpfrate > 10000000) {
qpfrate >>= 1;
qpcdivisor++;
qpc_avail = -1;
{
int oldactive = mouseactive;
static int mousecapture, showcursor;
- char txt[100], txt2[110];
+ char txt[400], txt2[200];
if (active > 0 && mousehack_allowed () && mousehack_alive ()) {
if (!isfullscreen ())
mouseactive = active;
strcpy (txt, "WinUAE");
+ txt2[0] = 0;
if (mouseactive > 0) {
focus = 1;
WIN32GUI_LoadUIString (currprefs.win32_middle_mouse ? IDS_WINUAETITLE_MMB : IDS_WINUAETITLE_NORMAL,
txt2, sizeof (txt2));
+ }
+ if (WINUAEBETA > 0)
+ strcat (txt, BetaStr);
+ if (txt2[0]) {
strcat (txt, " - ");
strcat (txt, txt2);
}
if (dinput_winmouse () >= 0)
setmousestate (dinput_winmouse(), 2, ((short)HIWORD(wParam)), 0);
return 0;
+ case WM_MOUSEHWHEEL:
+ if (dinput_winmouse () >= 0)
+ setmousestate (dinput_winmouse(), 3, ((short)HIWORD(wParam)), 0);
+ return 0;
case WM_PAINT:
{
{
LPNMMOUSE lpnm = (LPNMMOUSE) lParam;
int num = (int)lpnm->dwItemSpec;
- if (num >= 6 && num <= 9) {
- num -= 6;
+ if (num >= 7 && num <= 10) {
+ num -= 7;
if (nm->code == NM_RCLICK) {
disk_eject (num);
} else if (changed_prefs.dfxtype[num] >= 0) {
DiskSelection (hWnd, IDC_DF0 + num, 0, &changed_prefs, 0);
disk_insert (num, changed_prefs.df[num]);
}
- } else if (num == 3) {
+ } else if (num == 4) {
if (nm->code == NM_CLICK)
gui_display (-1);
else
p->win32_iconified_pause = 1;
p->win32_inactive_nosound = 0;
p->win32_inactive_pause = 0;
- p->win32_no_overlay = 0;
+ p->win32_no_overlay = os_vista ? 1 : 0;
p->win32_ctrl_F11_is_quit = 0;
p->win32_soundcard = 0;
p->win32_active_priority = 1;
initpath ("SaveimagePath", start_path_data);
initpath ("VideoPath", start_path_data);
initpath ("InputPath", start_path_data);
- if (disposition == REG_CREATED_NEW_KEY)
- {
+ if (disposition == REG_CREATED_NEW_KEY) {
/* Create and initialize all our sub-keys to the default values */
colortype = 0;
RegSetValueEx(hWinUAEKey, "DisplayInfo", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype));
load_keyring(NULL, NULL);
}
-static void betamessage (void)
+static char *BETAMESSAGE = {
+ "This is unstable beta software. Click cancel if you are not comfortable using software that is incomplete and can have serious programming errors."
+};
+
+static int betamessage (void)
{
+#ifdef WINUAEPUBLICBETA
+ int showmsg = TRUE;
+ HANDLE h = INVALID_HANDLE_VALUE;
+ ULONGLONG regft64;
+ ULARGE_INTEGER ft64;
+ ULARGE_INTEGER sft64;
+ struct tm *t;
+ __int64 ltime;
+ DWORD dwType, size, data;
+
+ ft64.QuadPart = 0;
+ for (;;) {
+ FILETIME ft, sft;
+ SYSTEMTIME st;
+ char tmp1[MAX_DPATH];
+
+ if (!hWinUAEKey)
+ break;
+ if (GetModuleFileName(NULL, tmp1, sizeof tmp1) == 0)
+ break;
+ h = CreateFile(tmp1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h == INVALID_HANDLE_VALUE)
+ break;
+ if (GetFileTime(h, &ft, NULL, NULL) == 0)
+ break;
+ ft64.LowPart = ft.dwLowDateTime;
+ ft64.HighPart = ft.dwHighDateTime;
+ dwType = REG_QWORD;
+ size = sizeof regft64;
+ if (RegQueryValueEx(hWinUAEKey, "BetaToken", 0, &dwType, (LPBYTE)®ft64, &size) != ERROR_SUCCESS)
+ break;
+ GetSystemTime(&st);
+ SystemTimeToFileTime(&st, &sft);
+ sft64.LowPart = sft.dwLowDateTime;
+ sft64.HighPart = sft.dwHighDateTime;
+ if (ft64.QuadPart == regft64)
+ showmsg = FALSE;
+ /* complain again in 7 days */
+ if (sft64.QuadPart > regft64 + (ULONGLONG)1000000000 * 60 * 60 * 24 * 7)
+ showmsg = TRUE;
+ break;
+ }
+ if (h != INVALID_HANDLE_VALUE)
+ CloseHandle(h);
+ if (showmsg) {
+ int r;
+ char title[MAX_DPATH];
+
+ dwType = REG_DWORD;
+ size = sizeof data;
+ if (hWinUAEKey && RegQueryValueEx(hWinUAEKey, "Beta_Just_Shut_Up", 0, &dwType, (LPBYTE)&data, &size) == ERROR_SUCCESS) {
+ if (data == 68000) {
+ write_log("I was told to shut up :(\n");
+ return 1;
+ }
+ }
+
+ _time64(<ime);
+ t = _gmtime64 (<ime);
+ /* "expire" in 1 month */
+ if (MAKEBD(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday) > WINUAEDATE + 100)
+ pre_gui_message("This beta build of WinUAE is obsolete.\nPlease download newer version.");
+
+ strcpy (title, "WinUAE Public Beta Disclaimer");
+ strcat (title, BetaStr);
+ r = MessageBox (NULL, BETAMESSAGE, title, MB_OKCANCEL | MB_TASKMODAL | MB_SETFOREGROUND | MB_ICONWARNING | MB_DEFBUTTON2);
+ if (r == IDABORT || r == IDCANCEL)
+ return 0;
+ if (ft64.QuadPart > 0) {
+ regft64 = ft64.QuadPart;
+ RegSetValueEx(hWinUAEKey, "BetaToken", 0, REG_QWORD, (LPBYTE)®ft64, sizeof regft64);
+ }
+ }
+#endif
+ return 1;
}
static int dxdetect (void)
#endif
}
-int os_winnt, os_winnt_admin, os_64bit;
+int os_winnt, os_winnt_admin, os_64bit, os_vista;
static int isadminpriv (void)
{
{
os_winnt = 0;
os_winnt_admin = 0;
+ os_vista = 0;
os_64bit = 0;
pGetNativeSystemInfo = (PGETNATIVESYSTEMINFO)GetProcAddress(
}
if (osVersion.dwPlatformId == VER_PLATFORM_WIN32_NT)
os_winnt = 1;
+ if (osVersion.dwMajorVersion >= 6)
+ os_vista = 1;
if (SystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
os_64bit = 1;
}
static int original_affinity;
+static int getval(char *s)
+{
+ int base = 10;
+ int v;
+ char *endptr;
+
+ if (s[0] == '0' && s[1] == 'x')
+ s += 2, base = 16;
+ v = strtol (s, &endptr, base);
+ if (*endptr != '\0' || *s == '\0')
+ return 0;
+ return v;
+}
+
+static void makeverstr(char *s)
+{
+#if WINUAEBETA > 0
+ sprintf(BetaStr, " (%sBeta %d, %d.%02d.%02d)", WINUAEPUBLICBETA > 0 ? "Public " : "", WINUAEBETA,
+ GETBDY(WINUAEDATE), GETBDM(WINUAEDATE), GETBDD(WINUAEDATE));
+#endif
+ sprintf(s, "WinUAE %d.%d.%d%s",
+ UAEMAJOR, UAEMINOR, UAESUBREV, BetaStr);
+}
+
static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow)
{
AVIOutput_Initialize();
#endif
-#ifdef __MINGW32__
- argc = _argc; argv = _argv;
-#else
argc = __argc; argv = __argv;
-#endif
for (i = 1; i < argc; i++) {
char *arg = argv[i];
if (!strcmp (arg, "-log")) console_logging = 1;
if (!strcmp (arg, "-screenshotbmp")) screenshotmode = 0;
if (!strcmp (arg, "-psprintdebug")) postscript_print_debugging = 1;
if (!strcmp (arg, "-sounddebug")) sound_debug = 1;
- if (!strcmp (arg, "-directcatweasel")) force_direct_catweasel = 1;
+ if (!strcmp (arg, "-directcatweasel")) {
+ force_direct_catweasel = 1;
+ if (i + 1 < argc)
+ force_direct_catweasel = getval (argv[++i]);
+ }
if (!strcmp (arg, "-affinity") && i + 1 < argc) {
- cpu_affinity = atol (argv[i + 1]);
+ cpu_affinity = getval (argv[++i]);
if (cpu_affinity == 0)
cpu_affinity = original_affinity;
SetThreadAffinityMask(GetCurrentThread(), cpu_affinity);
- i++;
}
if (!strcmp (arg, "-datapath") && i + 1 < argc) {
- strcpy(start_path_data, argv[i + 1]);
+ strcpy(start_path_data, argv[++i]);
start_data = 1;
- i++;
}
}
#if 0
argv[0] = 0;
#endif
getstartpaths(start_data);
- sprintf(VersionStr, "WinUAE %d.%d.%d%s (%d-bit)",
- UAEMAJOR, UAEMINOR, UAESUBREV, WINUAEBETA ? WINUAEBETASTR : "",
- #if defined(WIN64)
- 64
- #else
- 32
- #endif
- );
+ makeverstr(VersionStr);
SetCurrentDirectory (start_path_data);
logging_init ();
- if(WIN32_RegisterClasses() && WIN32_InitLibraries() && DirectDraw_Start(NULL))
- {
+ if(WIN32_RegisterClasses() && WIN32_InitLibraries() && DirectDraw_Start(NULL)) {
DEVMODE devmode;
DWORD i = 0;
WIN32_InitLang();
WIN32_InitHtmlHelp();
DirectDraw_Release();
- betamessage ();
- keyboard_settrans ();
+ if (betamessage ()) {
+ keyboard_settrans ();
#ifdef CATWEASEL
- catweasel_init();
+ catweasel_init();
#endif
#ifdef PARALLEL_PORT
- paraport_mask = paraport_init ();
+ paraport_mask = paraport_init ();
#endif
- createIPC();
- real_main (argc, argv);
+ createIPC();
+ real_main (argc, argv);
+ }
}
closeIPC();
return m;
}
+typedef BOOL (CALLBACK* CHANGEWINDOWMESSAGEFILTER)(UINT, DWORD);
+#define MSGFLT_ADD 1
+
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HANDLE thread;
thread = GetCurrentThread();
original_affinity = SetThreadAffinityMask(thread, 1);
+#if 0
+ CHANGEWINDOWMESSAGEFILTER pChangeWindowMessageFilter;
+ pChangeWindowMessageFilter = (CHANGEWINDOWMESSAGEFILTER)GetProcAddress(
+ GetModuleHandle("user32.dll"), "ChangeWindowMessageFilter");
+ if (pChangeWindowMessageFilter)
+ pChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD);
+#endif
__try {
WinMain2 (hInstance, hPrevInstance, lpCmdLine, nCmdShow);
} __except(ExceptionFilter(GetExceptionInformation(), GetExceptionCode())) {
#ifndef __WIN32_H__
#define __WIN32_H__
+#define MAKEBD(x,y,z) ((((x) - 2000) * 10000 + (y)) * 100 + (z))
+#define GETBDY(x) ((x) / 1000000 + 2000)
+#define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
+#define GETBDD(x) ((x) % 100)
+
+#define WINUAEBETA 2
+#define WINUAEPUBLICBETA 1
+#define WINUAEDATE MAKEBD(2006, 12, 2)
+
#define IHF_WINDOWHIDDEN 6
#define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU )
extern int manual_palette_refresh_needed;
extern int mouseactive, focus;
extern int ignore_messages_all;
-#define WINUAEBETA 0
-#define WINUAEBETASTR ""
extern char start_path_exe[MAX_DPATH];
extern char start_path_data[MAX_DPATH];
extern int framecnt;
extern char prtname[];
extern char VersionStr[256];
-extern int os_winnt, os_winnt_admin, os_64bit;
+extern char BetaStr[64];
+extern int os_winnt, os_winnt_admin, os_64bit, os_vista;
extern int paraport_mask;
extern int gui_active;
extern DWORD quickstart;
write_log ("'%s' '%s' %s\n", desc, name, outGUID(guid));
if ((strstr(desc, "X1900") || strstr(desc, "X1800") || strstr(desc, "X1600")) && !b0rken_ati_overlay) {
b0rken_ati_overlay = 1;
- write_log ("** Radeon X1x00 series display card detected, enabling overlay workaround.\n");
- write_log ("** (blank display with Catalyst 6.1 and newer). Use -disableowr to disable workaround.\n");
+ if (!os_vista) {
+ write_log ("** Radeon X1x00 series display card detected, enabling overlay workaround.\n");
+ write_log ("** (blank display with Catalyst 6.1 and newer). Use -disableowr to disable workaround.\n");
+ }
}
return 1;
}
int next;
int filterindex = 0;
- char szTitle[MAX_DPATH];
+ char szTitle[MAX_DPATH] = { 0 };
char szFormat[MAX_DPATH];
char szFilter[MAX_DPATH] = { 0 };
sprintf( szFilter, "%s ", szFormat );
memcpy( szFilter + strlen( szFilter ), DISK_FORMAT_STRING, sizeof(DISK_FORMAT_STRING) + 1);
- openFileName.lpstrTitle = szTitle;
openFileName.lpstrDefExt = "ADF";
openFileName.lpstrFilter = szFilter;
break;
sprintf( szFilter, "%s ", szFormat );
memcpy( szFilter + strlen( szFilter ), "(*.adf)\0*.adf\0", 15 );
- openFileName.lpstrTitle = szTitle;
openFileName.lpstrDefExt = "ADF";
openFileName.lpstrFilter = szFilter;
break;
sprintf( szFilter, "%s ", szFormat );
memcpy( szFilter + strlen( szFilter ), HDF_FORMAT_STRING, sizeof (HDF_FORMAT_STRING) + 1);
- openFileName.lpstrTitle = szTitle;
openFileName.lpstrDefExt = "HDF";
openFileName.lpstrFilter = szFilter;
break;
sprintf( szFilter, "%s ", szFormat );
memcpy( szFilter + strlen( szFilter ), "(*.uae)\0*.uae\0", 15 );
- openFileName.lpstrTitle = szTitle;
openFileName.lpstrDefExt = "UAE";
openFileName.lpstrFilter = szFilter;
break;
sprintf( szFilter, "%s ", szFormat );
memcpy( szFilter + strlen( szFilter ), ROM_FORMAT_STRING, sizeof (ROM_FORMAT_STRING) + 1);
- openFileName.lpstrTitle = szTitle;
openFileName.lpstrDefExt = "ROM";
openFileName.lpstrFilter = szFilter;
break;
sprintf( szFilter, "%s ", szFormat );
memcpy( szFilter + strlen( szFilter ), "(*.key)\0*.key\0", 15 );
- openFileName.lpstrTitle = szTitle;
openFileName.lpstrDefExt = "KEY";
openFileName.lpstrFilter = szFilter;
break;
sprintf( szFilter, "%s ", szFormat );
memcpy( szFilter + strlen( szFilter ), INP_FORMAT_STRING, sizeof (INP_FORMAT_STRING) + 1);
- openFileName.lpstrTitle = szTitle;
openFileName.lpstrDefExt = "INP";
openFileName.lpstrFilter = szFilter;
break;
all = 0;
filterindex = statefile_previousfilter;
}
- openFileName.lpstrTitle = szTitle;
openFileName.lpstrDefExt = "USS";
openFileName.lpstrFilter = szFilter;
break;
sprintf( szFilter, "%s ", szFormat );
memcpy( szFilter + strlen( szFilter ), "(*.nvr)\0*.nvr\0", 15 );
- openFileName.lpstrTitle = szTitle;
openFileName.lpstrDefExt = "NVR";
openFileName.lpstrFilter = szFilter;
break;
default:
WIN32GUI_LoadUIString( IDS_SELECTINFO, szTitle, MAX_DPATH );
- openFileName.lpstrTitle = szTitle;
openFileName.lpstrFilter = NULL;
openFileName.lpstrDefExt = NULL;
break;
case 12:
WIN32GUI_LoadUIString( IDS_SELECTFS, szTitle, MAX_DPATH );
- openFileName.lpstrTitle = szTitle;
openFileName.lpstrFilter = NULL;
openFileName.lpstrDefExt = NULL;
openFileName.lpstrInitialDir = path_out;
case 13:
WIN32GUI_LoadUIString( IDS_SELECTINFO, szTitle, MAX_DPATH );
- openFileName.lpstrTitle = szTitle;
openFileName.lpstrFilter = NULL;
openFileName.lpstrDefExt = NULL;
openFileName.lpstrInitialDir = path_out;
openFileName.lpfnHook = NULL;
openFileName.lpTemplateName = NULL;
openFileName.lCustData = 0;
+ openFileName.lpstrTitle = szTitle;
+
if (multi)
openFileName.Flags |= OFN_ALLOWMULTISELECT;
if (flag == 1 || flag == 3 || flag == 5 || flag == 9 || flag == 11 || flag == 16) {
strcpy (workprefs.cartfile, full_path);
break;
case IDC_INPREC_PLAY:
- inprec_open(full_path, IsDlgButtonChecked(hDlg, IDC_AVIOUTPUT_AUDIO) == BST_CHECKED ? -2 : -1);
+ inprec_open(full_path, IsDlgButtonChecked(hDlg, IDC_INPREC_PLAYMODE) == BST_CHECKED ? -1 : -2);
break;
case IDC_INPREC_RECORD:
inprec_open(full_path, 1);
if (hDlg == pages[HARDDISK_ID]) {
listview_num_columns = HARDDISK_COLUMNS;
lv_type = LV_HARDDISK;
- WIN32GUI_LoadUIString( IDS_DEVICE, column_heading[0], MAX_COLUMN_HEADING_WIDTH );
- WIN32GUI_LoadUIString( IDS_VOLUME, column_heading[1], MAX_COLUMN_HEADING_WIDTH );
- WIN32GUI_LoadUIString( IDS_PATH, column_heading[2], MAX_COLUMN_HEADING_WIDTH );
- WIN32GUI_LoadUIString( IDS_RW, column_heading[3], MAX_COLUMN_HEADING_WIDTH );
- WIN32GUI_LoadUIString( IDS_BLOCKSIZE, column_heading[4], MAX_COLUMN_HEADING_WIDTH );
- WIN32GUI_LoadUIString( IDS_HFDSIZE, column_heading[5], MAX_COLUMN_HEADING_WIDTH );
- WIN32GUI_LoadUIString( IDS_BOOTPRI, column_heading[6], MAX_COLUMN_HEADING_WIDTH );
- list = GetDlgItem( hDlg, IDC_VOLUMELIST );
+ WIN32GUI_LoadUIString(IDS_DEVICE, column_heading[0], MAX_COLUMN_HEADING_WIDTH);
+ WIN32GUI_LoadUIString(IDS_VOLUME, column_heading[1], MAX_COLUMN_HEADING_WIDTH);
+ WIN32GUI_LoadUIString(IDS_PATH, column_heading[2], MAX_COLUMN_HEADING_WIDTH);
+ WIN32GUI_LoadUIString(IDS_RW, column_heading[3], MAX_COLUMN_HEADING_WIDTH);
+ WIN32GUI_LoadUIString(IDS_BLOCKSIZE, column_heading[4], MAX_COLUMN_HEADING_WIDTH);
+ WIN32GUI_LoadUIString(IDS_HFDSIZE, column_heading[5], MAX_COLUMN_HEADING_WIDTH);
+ WIN32GUI_LoadUIString(IDS_BOOTPRI, column_heading[6], MAX_COLUMN_HEADING_WIDTH);
+ list = GetDlgItem(hDlg, IDC_VOLUMELIST);
} else if (hDlg == pages[INPUT_ID]) {
listview_num_columns = INPUT_COLUMNS;
lv_type = LV_INPUT;
- WIN32GUI_LoadUIString( IDS_INPUTHOSTWIDGET, column_heading[0], MAX_COLUMN_HEADING_WIDTH );
- WIN32GUI_LoadUIString( IDS_INPUTAMIGAEVENT, column_heading[1], MAX_COLUMN_HEADING_WIDTH );
- WIN32GUI_LoadUIString( IDS_INPUTAUTOFIRE, column_heading[2], MAX_COLUMN_HEADING_WIDTH );
+ WIN32GUI_LoadUIString(IDS_INPUTHOSTWIDGET, column_heading[0], MAX_COLUMN_HEADING_WIDTH);
+ WIN32GUI_LoadUIString(IDS_INPUTAMIGAEVENT, column_heading[1], MAX_COLUMN_HEADING_WIDTH);
+ WIN32GUI_LoadUIString(IDS_INPUTAUTOFIRE, column_heading[2], MAX_COLUMN_HEADING_WIDTH);
strcpy (column_heading[3], "#");
- list = GetDlgItem( hDlg, IDC_INPUTLIST );
+ list = GetDlgItem(hDlg, IDC_INPUTLIST);
} else {
listview_num_columns = DISK_COLUMNS;
lv_type = LV_DISK;
strcpy (column_heading[0], "#");
- WIN32GUI_LoadUIString( IDS_DISK_IMAGENAME, column_heading[1], MAX_COLUMN_HEADING_WIDTH );
- WIN32GUI_LoadUIString( IDS_DISK_DRIVENAME, column_heading[2], MAX_COLUMN_HEADING_WIDTH );
+ WIN32GUI_LoadUIString(IDS_DISK_IMAGENAME, column_heading[1], MAX_COLUMN_HEADING_WIDTH);
+ WIN32GUI_LoadUIString(IDS_DISK_DRIVENAME, column_heading[2], MAX_COLUMN_HEADING_WIDTH);
list = GetDlgItem (hDlg, IDC_DISK);
}
cachedlist = list;
- ListView_DeleteAllItems( list );
+ ListView_DeleteAllItems(list);
- for( i = 0; i < listview_num_columns; i++ )
- listview_column_width[i] = ListView_GetStringWidth( list, column_heading[i] ) + 15;
+ for(i = 0; i < listview_num_columns; i++)
+ listview_column_width[i] = ListView_GetStringWidth(list, column_heading[i]) + 15;
// If there are no columns, then insert some
lvcolumn.mask = LVCF_WIDTH;
if (drv >= 0)
sprintf (tmp, "DF%d:", drv);
ListView_SetItemText (list, result, 2, tmp);
- width = ListView_GetStringWidth( list, lvstruct.pszText ) + 15;
+ width = ListView_GetStringWidth(list, lvstruct.pszText) + 15;
if (width > listview_column_width[0])
listview_column_width[ 0 ] = width;
entry++;
}
listview_column_width[0] = 30;
- listview_column_width[1] = 354;
+ listview_column_width[1] = 336;
listview_column_width[2] = 50;
}
static int listview_entry_from_click (HWND list, int *column)
{
POINT point;
+ POINTS p;
DWORD pos = GetMessagePos ();
int items, entry;
- point.x = LOWORD (pos);
- point.y = HIWORD (pos);
+ p = MAKEPOINTS (pos);
+ point.x = p.x;
+ point.y = p.y;
ScreenToClient (list, &point);
entry = ListView_GetTopIndex (list);
items = entry + ListView_GetCountPerPage (list);
/* Get the bounding rectangle of an item. If the mouse
* location is within the bounding rectangle of the item,
* you know you have found the item that was being clicked. */
- ListView_GetItemRect (list, entry, &rect, LVIR_BOUNDS);
- if (PtInRect (&rect, point)) {
- int i, x = 0;
- UINT flag = LVIS_SELECTED | LVIS_FOCUSED;
- ListView_SetItemState (list, entry, flag, flag);
- for (i = 0; i < listview_num_columns && column; i++) {
- if (x < point.x && x + listview_column_width[i] > point.x) {
- *column = i;
- break;
+ if (ListView_GetItemRect (list, entry, &rect, LVIR_BOUNDS)) {
+ if (PtInRect (&rect, point)) {
+ POINT ppt;
+ int i, x;
+ UINT flag = LVIS_SELECTED | LVIS_FOCUSED;
+
+ ListView_GetItemPosition(list, entry, &ppt);
+ x = ppt.x;
+ ListView_SetItemState (list, entry, flag, flag);
+ for (i = 0; i < listview_num_columns && column; i++) {
+ if (x < point.x && x + listview_column_width[i] > point.x) {
+ *column = i;
+ break;
+ }
+ x += listview_column_width[i];
}
- x += listview_column_width[i];
+ return entry;
}
- return entry;
}
entry++;
}
misc_kbled (hDlg, IDC_KBLED1, workprefs.keyboard_leds[0]);
misc_kbled (hDlg, IDC_KBLED2, workprefs.keyboard_leds[1]);
misc_kbled (hDlg, IDC_KBLED3, workprefs.keyboard_leds[2]);
+ CheckDlgButton (hDlg, IDC_KBLED_USB, workprefs.win32_kbledmode);
SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"1");
break;
}
- strcpy (changed_prefs.df[0], workprefs.df[0]);
- strcpy (changed_prefs.df[1], workprefs.df[1]);
- strcpy (changed_prefs.df[2], workprefs.df[2]);
- strcpy (changed_prefs.df[3], workprefs.df[3]);
return FALSE;
}
BOOL success;
LRESULT item;
- v = GetDlgItemInt( hDlg, IDC_INPUTDEADZONE, &success, FALSE );
+ v = GetDlgItemInt(hDlg, IDC_INPUTDEADZONE, &success, FALSE);
if (success) {
currprefs.input_joystick_deadzone = workprefs.input_joystick_deadzone = v;
currprefs.input_joystick_deadzone = workprefs.input_joymouse_deadzone = v;
}
- v = GetDlgItemInt( hDlg, IDC_INPUTAUTOFIRERATE, &success, FALSE );
+ v = GetDlgItemInt(hDlg, IDC_INPUTAUTOFIRERATE, &success, FALSE);
if (success)
currprefs.input_autofire_framecnt = workprefs.input_autofire_framecnt = v;
- v = GetDlgItemInt( hDlg, IDC_INPUTSPEEDD, &success, FALSE );
+ v = GetDlgItemInt(hDlg, IDC_INPUTSPEEDD, &success, FALSE);
if (success)
currprefs.input_joymouse_speed = workprefs.input_joymouse_speed = v;
- v = GetDlgItemInt( hDlg, IDC_INPUTSPEEDA, &success, FALSE );
+ v = GetDlgItemInt(hDlg, IDC_INPUTSPEEDA, &success, FALSE);
if (success)
currprefs.input_joymouse_multiplier = workprefs.input_joymouse_multiplier = v;
- v = GetDlgItemInt( hDlg, IDC_INPUTSPEEDM, &success, FALSE );
+ v = GetDlgItemInt(hDlg, IDC_INPUTSPEEDM, &success, FALSE);
if (success)
currprefs.input_mouse_speed = workprefs.input_mouse_speed = v;
static void input_toggleautofire (void)
{
- int af, flags, event;
+ int af, flags, evt;
char name[256];
char custom[MAX_DPATH];
if (input_selected_device < 0 || input_selected_widget < 0)
return;
- event = inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
+ evt = inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
&flags, name, custom, input_selected_sub_num);
- if (event <= 0)
+ if (evt <= 0)
return;
af = (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 0 : 1;
inputdevice_set_mapping (input_selected_device, input_selected_widget,
} else {
DISK_history_add (file, -1);
strcpy (workprefs.df[drv], file);
- strcpy (changed_prefs.df[drv], workprefs.df[drv]);
+ disk_insert (drv, workprefs.df[drv]);
drv++;
if (drv >= (currentpage == QUICKSTART_ID ? 2 : 4))
drv = 0;
dialogreturn = -1;
hAccelTable = NULL;
+ DragAcceptFiles(hwnd, TRUE);
dhwnd = CreateDialog (hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_PANEL), hwnd, DialogProc);
psresult = 0;
if (dhwnd != NULL) {
MSG msg;
DWORD v;
+ char tmp[MAX_DPATH];
+
+ if (WINUAEBETA > 0 && GetWindowText (dhwnd, tmp, sizeof (tmp)) > 0) {
+ strcat (tmp, BetaStr);
+ SetWindowText (dhwnd, tmp);
+ }
ShowWindow (dhwnd, SW_SHOW);
for (;;) {
HANDLE IPChandle;
pos = 0;
ptr = drive_text + pos * 16;
if (gui_data.sndbuf_status < 3) {
- sprintf(ptr, "SND: %.0f%%", (double)((gui_data.sndbuf) / 10.0));
+ sprintf(ptr, "SND: %+.0f%%", (double)((gui_data.sndbuf) / 10.0));
} else {
strcpy (ptr, "SND: -");
on = 0;
write_log("\n");
WIN32GUI_LoadUIString (IDS_ERRORTITLE, szTitle, MAX_DPATH);
+ strcat (szTitle, BetaStr);
MessageBox (guiDlg, msg, szTitle, MB_OK | MB_TASKMODAL | MB_SETFOREGROUND );
}
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib"
ShowProgress="0"
- OutputFile="f:\amiga\winuae.exe"
+ OutputFile="d:\amiga\winuae.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateManifest="false"
/>
<Tool
Name="VCManifestTool"
+ AdditionalManifestFiles="..\resources\winuae.exe.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
</Configuration>
<Configuration
- Name="Debug|x64"
- OutputDirectory="x64\$(ConfigurationName)"
- IntermediateDirectory="x64\$(ConfigurationName)"
+ Name="Release|Win32"
+ OutputDirectory="d:\amiga"
+ IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
/>
<Tool
Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
+ PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName=".\Debug/winuae_msvc.tlb"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/winuae_msvc.tlb"
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalOptions=""
- Optimization="0"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32,_WINDOWS,ZLIB_DLL,OPENGL_SUPPORT,_WIN32_IE 0x0500,UNIX;WIN64"
+ PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,_WIN32_IE=0x0500,UNIX"
+ StringPooling="true"
ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- BufferSecurityCheck="true"
- RuntimeTypeInfo="true"
- PrecompiledHeaderFile=".\Debug/winuae_msvc.pch"
- AssemblerListingLocation=".\Debug/"
- ObjectFile=".\Debug/"
- ProgramDataBaseFileName=".\Debug/"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ EnableFunctionLevelLinking="false"
+ EnableEnhancedInstructionSet="0"
+ FloatingPointModel="0"
+ TreatWChar_tAsBuiltInType="false"
+ RuntimeTypeInfo="false"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\Release/winuae_msvc.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
CompileAs="0"
DisableSpecificWarnings="4996"
- EnablePREfast="false"
+ ForcedIncludeFiles=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
+ PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib zlib1.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib"
+ AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib"
OutputFile="d:\amiga\winuae.exe"
- LinkIncremental="2"
+ LinkIncremental="1"
SuppressStartupBanner="true"
- GenerateManifest="false"
+ AdditionalLibraryDirectories=""
+ GenerateManifest="true"
+ AdditionalManifestDependencies=""
DelayLoadDLLs="setupapi.dll"
GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Debug/winuae.pdb"
+ ProgramDatabaseFile=".\Release/winuae.pdb"
SubSystem="2"
StackReserveSize="2621440"
StackCommitSize="2621440"
- TargetMachine="17"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ OptimizeForWindows98="0"
+ LinkTimeCodeGeneration="0"
+ TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
+ AdditionalManifestFiles="..\resources\winuae.exe.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
</Configuration>
<Configuration
- Name="Release|Win32"
- OutputDirectory="f:\amiga"
- IntermediateDirectory=".\Release"
+ Name="TestRelease|Win32"
+ IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=".\Release/winuae_msvc.tlb"
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="1"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- WholeProgramOptimization="false"
- AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,_WIN32_IE=0x0500,UNIX"
- StringPooling="true"
- ExceptionHandling="0"
- BasicRuntimeChecks="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="false"
- EnableEnhancedInstructionSet="0"
- FloatingPointModel="0"
- TreatWChar_tAsBuiltInType="false"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- PrecompiledHeaderFile=".\Release/winuae_msvc.pch"
- AssemblerListingLocation=".\Release/"
- ObjectFile=".\Release/"
- ProgramDataBaseFileName=".\Release/"
- WarningLevel="3"
- SuppressStartupBanner="true"
- CompileAs="0"
- DisableSpecificWarnings="4996"
- ForcedIncludeFiles=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib"
- OutputFile="f:\amiga\winuae.exe"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- AdditionalLibraryDirectories=""
- GenerateManifest="true"
- AdditionalManifestDependencies=""
- DelayLoadDLLs="setupapi.dll"
- GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Release/winuae.pdb"
- SubSystem="2"
- StackReserveSize="2621440"
- StackCommitSize="2621440"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="0"
- LinkTimeCodeGeneration="0"
- TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
- AdditionalManifestFiles="..\resources\winuae.exe.manifest"
- SuppressStartupBanner="false"
- VerboseOutput="true"
/>
<Tool
Name="VCXDCMakeTool"
/>
</Configuration>
<Configuration
- Name="Release|x64"
- OutputDirectory="$(SolutionDir)x64\$(ConfigurationName)"
- IntermediateDirectory="x64\$(ConfigurationName)"
+ Name="Release64|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName=".\Release/winuae_msvc.tlb"
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="1"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- WholeProgramOptimization="false"
- AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,ZLIB_DLL,_WIN32_IE 0x0500,WIN64,_WIN64,UNIX"
- StringPooling="true"
- ExceptionHandling="0"
- BasicRuntimeChecks="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- EnableEnhancedInstructionSet="0"
- FloatingPointModel="0"
- TreatWChar_tAsBuiltInType="false"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- PrecompiledHeaderFile=".\Release/winuae_msvc.pch"
- AssemblerListingLocation=".\Release/"
- ObjectFile=".\Release/"
- ProgramDataBaseFileName=".\Release/"
- WarningLevel="3"
- SuppressStartupBanner="true"
- CompileAs="1"
- DisableSpecificWarnings="4996"
- ForcedIncludeFiles=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib"
- ShowProgress="0"
- OutputFile="d:\amiga\winuae64.exe"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- AdditionalLibraryDirectories=""
- GenerateManifest="true"
- DelayLoadDLLs=""
- GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Release/winuae.pdb"
- SubSystem="2"
- StackReserveSize="0"
- StackCommitSize="0"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="0"
- LinkTimeCodeGeneration="0"
- TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
</Configuration>
<Configuration
- Name="TestRelease|Win32"
+ Name="Debug64|Win32"
+ OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/winuae_msvc.tlb"
/>
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
+ PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32,_WINDOWS,ZLIB_DLL,OPENGL_SUPPORT,_WIN32_IE 0x0500,UNIX"
+ ExceptionHandling="0"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderFile=".\Debug/winuae_msvc.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ CompileAs="0"
+ DisableSpecificWarnings="4996"
+ EnablePREfast="false"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib zdll.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib"
+ OutputFile="d:\amiga\winuae.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateManifest="false"
+ DelayLoadDLLs="setupapi.dll"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/winuae.pdb"
+ SubSystem="2"
+ StackReserveSize="2621440"
+ StackCommitSize="2621440"
/>
<Tool
Name="VCALinkTool"
/>
</Configuration>
<Configuration
- Name="TestRelease|x64"
- OutputDirectory="$(SolutionDir)x64\$(ConfigurationName)"
+ Name="Debug|x64"
+ OutputDirectory="x64\$(ConfigurationName)"
IntermediateDirectory="x64\$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="0"
/>
<Tool
Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
+ PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="3"
- TypeLibraryName=".\Release/winuae_msvc.tlb"
+ TypeLibraryName=".\Debug/winuae_msvc.tlb"
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalOptions="/Oy-"
+ AdditionalOptions=""
Optimization="0"
- InlineFunctionExpansion="1"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="0"
- OmitFramePointers="false"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,ZLIB_DLL,_WIN32_IE 0x0500,UNIX;WIN64"
- StringPooling="true"
+ PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32,_WINDOWS,ZLIB_DLL,OPENGL_SUPPORT,_WIN32_IE 0x0500,UNIX;WIN64"
ExceptionHandling="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- EnableEnhancedInstructionSet="0"
- TreatWChar_tAsBuiltInType="false"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- PrecompiledHeaderFile=".\Release/winuae_msvc.pch"
- AssemblerListingLocation=".\TestRelease/"
- ObjectFile=".\TestRelease/"
- ProgramDataBaseFileName=".\TestRelease/"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderFile=".\Debug/winuae_msvc.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
- CompileAs="1"
- ForcedIncludeFiles=""
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ DisableSpecificWarnings="4996"
+ EnablePREfast="false"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
+ PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib zlib1.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib"
OutputFile="d:\amiga\winuae.exe"
- LinkIncremental="1"
+ LinkIncremental="2"
SuppressStartupBanner="true"
+ GenerateManifest="false"
DelayLoadDLLs="setupapi.dll"
GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Release/winuae.pdb"
+ ProgramDatabaseFile=".\Debug/winuae.pdb"
SubSystem="2"
StackReserveSize="2621440"
StackCommitSize="2621440"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="0"
TargetMachine="17"
/>
<Tool
/>
</Configuration>
<Configuration
- Name="Release64|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
+ Name="Release|x64"
+ OutputDirectory="$(SolutionDir)x64\$(ConfigurationName)"
+ IntermediateDirectory="x64\$(ConfigurationName)"
ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Release/winuae_msvc.tlb"
/>
<Tool
Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ WholeProgramOptimization="false"
+ AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
+ PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,ZLIB_DLL,_WIN32_IE 0x0500,WIN64,_WIN64,UNIX"
+ StringPooling="true"
+ ExceptionHandling="0"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ EnableFunctionLevelLinking="true"
+ EnableEnhancedInstructionSet="0"
+ FloatingPointModel="0"
+ TreatWChar_tAsBuiltInType="false"
+ RuntimeTypeInfo="false"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\Release/winuae_msvc.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="1"
+ DisableSpecificWarnings="4996"
+ ForcedIncludeFiles=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
+ AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib"
+ ShowProgress="0"
+ OutputFile="d:\amiga\winuae64.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories=""
+ GenerateManifest="true"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Release/winuae.pdb"
+ SubSystem="2"
+ StackReserveSize="0"
+ StackCommitSize="0"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ OptimizeForWindows98="0"
+ LinkTimeCodeGeneration="0"
+ TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
</Configuration>
<Configuration
- Name="Release64|x64"
+ Name="TestRelease|x64"
OutputDirectory="$(SolutionDir)x64\$(ConfigurationName)"
IntermediateDirectory="x64\$(ConfigurationName)"
ConfigurationType="1"
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="3"
+ AdditionalOptions="/Oy-"
+ Optimization="0"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- WholeProgramOptimization="false"
+ FavorSizeOrSpeed="0"
+ OmitFramePointers="false"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,_WIN32_IE 0x0500,UNIX;WIN64"
+ PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,ZLIB_DLL,_WIN32_IE 0x0500,UNIX;WIN64"
StringPooling="true"
ExceptionHandling="0"
- BasicRuntimeChecks="0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
- EnableFunctionLevelLinking="false"
+ EnableFunctionLevelLinking="true"
EnableEnhancedInstructionSet="0"
- FloatingPointModel="0"
TreatWChar_tAsBuiltInType="false"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
- PrecompiledHeaderFile=".\Release64/winuae_msvc.pch"
- AssemblerListingLocation=".\Release64/"
- ObjectFile=".\Release64/"
- ProgramDataBaseFileName=".\Release64/"
+ PrecompiledHeaderFile=".\Release/winuae_msvc.pch"
+ AssemblerListingLocation=".\TestRelease/"
+ ObjectFile=".\TestRelease/"
+ ProgramDataBaseFileName=".\TestRelease/"
WarningLevel="3"
SuppressStartupBanner="true"
- Detect64BitPortabilityProblems="true"
CompileAs="1"
- DisableSpecificWarnings="4996"
ForcedIncludeFiles=""
/>
<Tool
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib zlib.lib"
- OutputFile="d:\amiga\winuae64.exe"
+ AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib zlib1.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib"
+ OutputFile="d:\amiga\winuae.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
- AdditionalLibraryDirectories=""
- GenerateManifest="true"
- DelayLoadDLLs=""
+ DelayLoadDLLs="setupapi.dll"
GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Release64/winuae.pdb"
+ ProgramDatabaseFile=".\Release/winuae.pdb"
SubSystem="2"
StackReserveSize="2621440"
StackCommitSize="2621440"
OptimizeReferences="2"
EnableCOMDATFolding="2"
OptimizeForWindows98="0"
- LinkTimeCodeGeneration="0"
TargetMachine="17"
/>
<Tool
/>
<Tool
Name="VCManifestTool"
- AdditionalManifestFiles="..\resources\winuae.exe.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
</Configuration>
<Configuration
- Name="Debug64|Win32"
- OutputDirectory="$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
+ Name="Release64|x64"
+ OutputDirectory="$(SolutionDir)x64\$(ConfigurationName)"
+ IntermediateDirectory="x64\$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
/>
<Tool
Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
+ PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=".\Debug/winuae_msvc.tlb"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Release/winuae_msvc.tlb"
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalOptions=""
- Optimization="0"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32,_WINDOWS,ZLIB_DLL,OPENGL_SUPPORT,_WIN32_IE 0x0500,UNIX"
+ PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,_WIN32_IE 0x0500,UNIX;WIN64"
+ StringPooling="true"
ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- BufferSecurityCheck="true"
- RuntimeTypeInfo="true"
- PrecompiledHeaderFile=".\Debug/winuae_msvc.pch"
- AssemblerListingLocation=".\Debug/"
- ObjectFile=".\Debug/"
- ProgramDataBaseFileName=".\Debug/"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ EnableFunctionLevelLinking="false"
+ EnableEnhancedInstructionSet="0"
+ FloatingPointModel="0"
+ TreatWChar_tAsBuiltInType="false"
+ RuntimeTypeInfo="false"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\Release64/winuae_msvc.pch"
+ AssemblerListingLocation=".\Release64/"
+ ObjectFile=".\Release64/"
+ ProgramDataBaseFileName=".\Release64/"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- CompileAs="0"
+ CompileAs="1"
DisableSpecificWarnings="4996"
- EnablePREfast="false"
+ ForcedIncludeFiles=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
+ PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
/>
<Tool
Name="VCLinkerTool"
- AdditionalOptions="/MACHINE:I386"
- AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib zdll.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib"
- OutputFile="d:\amiga\winuae.exe"
- LinkIncremental="2"
+ AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib zlib.lib"
+ OutputFile="d:\amiga\winuae64.exe"
+ LinkIncremental="1"
SuppressStartupBanner="true"
- GenerateManifest="false"
- DelayLoadDLLs="setupapi.dll"
+ AdditionalLibraryDirectories=""
+ GenerateManifest="true"
+ DelayLoadDLLs=""
GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Debug/winuae.pdb"
+ ProgramDatabaseFile=".\Release64/winuae.pdb"
SubSystem="2"
StackReserveSize="2621440"
StackCommitSize="2621440"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ OptimizeForWindows98="0"
+ LinkTimeCodeGeneration="0"
+ TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
+ AdditionalManifestFiles="..\resources\winuae.exe.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
</FileConfiguration>
<FileConfiguration
- Name="Debug|x64"
+ Name="Release|Win32"
>
<Tool
Name="VCResourceCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|Win32"
+ Name="Debug64|Win32"
>
<Tool
Name="VCResourceCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|x64"
+ Name="Debug|x64"
>
<Tool
Name="VCResourceCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
- Name="TestRelease|x64"
+ Name="Release|x64"
>
<Tool
Name="VCResourceCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
- Name="Release64|x64"
+ Name="TestRelease|x64"
>
<Tool
Name="VCResourceCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
- Name="Debug64|Win32"
+ Name="Release64|x64"
>
<Tool
Name="VCResourceCompilerTool"
-- CPU emulation changes needed for some new future features, will
- explain later, not yet finished.. breakage possible.
+Beta 2:
+
+- fixed possible crash when input recording stops (introduced in b1)
+- log memory map after reset and also after autoconfig
+- log loaded KS ROM information in memory map dump
+- fixed boot crash (some CPU/KS combinations only)
+- bug in new event handler fixed (symptom was random really slow
+ non-ce/non-immediate blitter)
+- interrupt priorities are correct again (broke in b1) Some tweaks.
+- filesystem flag emulation updates (again) Protection flags on FAT
+ volumes should now work properly in non-UAEFSDB mode.
+- filesystem directory protection flags supported (on FAT volumes)
+ Very old comment says: "Unix dirs behave differently than AmigaOS
+ ones. windows dirs go where no dir has gone before..." Perhaps
+ Windows 95 had some issues? Hope I didn't miss something..
+
+Beta 1:
+
+- dms files inside archives automatically added to disk history
+- Windows98/ME direct MK4 catweasel support. Need command line
+ parameter "-directcatweasel 0xyzzzz". y = CW model (3 or 4,
+ 3 is default), zzzz is io address in hexadecimal. (simple, quick
+ workaround if someone really wants to use MK3/4 under 98/ME for
+ some unknown reason) IO address in configuration file is obsoleted
+ (was never compatible with CW joystick or mouse port detection)
+- Catweasel MK4 mouse support fixed (broke in 1.3.3)
+- Catweasel direct mode automatically enabled if Windows is 2000
+ or newer, IO library is installed and CW driver is not installed
+ (previously was automatically enabled only if OS was 64-bit)
+- compiler updated to beta SP1. I am very anti-"don't fix it if it
+ is not broken" person but I think you must already know it :)
+- updated to latest Windows SDK
+- winuaeclipboard crash fix (BR)
+- finally replaced really ugly interrupt delay hack with more
+ cleaner and accurate method (fixes Fun School 4)
+- made non-ce "more compatible" CPU emulators' main loop more
+ compatible with programs requiring delayed interrups
+- windowed mode "leds" had incorrect mouse click positions
+- debugger memwatch "freeze" option now also accepts memory values
+- added separate memory bank function for 680x0 opcode fetches
- debugger memwatch points can now detect between opcode fetch
- and data fetch, 68000-only currently. (see above)
+ and data fetch, 68000-only currently.
+- basic self modifying code (SMC) detection implemented in
+ debugger (smc-command) Works in 68000-mode only.
+- Windows Vista rawinput crash fix (weird change in vista..)
+- avioutput sound sync errors fixed (broke in 1.3.3)
+- avioutput video codec type registry saving improved
+- fixed CPU emulation condition code bug caused by compiler bug or
+ undefined C behaviour (not sure yet..) Affected some copy
+ protections. Introduced in E-UAE merge.
+- added horizontal mouse wheel input-panel support (hwheel support
+ added in Windows Vista, not tested)
+- add single "fake" button entry if joystick driver reports zero
+ buttons (PPJoy in two-player mode, no idea if this helps)
+- cleaned up AHI emulation, initialize and start recording only
+ when requested for the first time
+- disk image dragndrop caused instant disk swap instead of delayed
+ swap (eject, wait 1.5s, insert new disk)
+- fixed Windows only bug in new stack magic replacement code, both
+ bsdsocket and AHI leaked Windows handles (SR)
+- less aggressive sound adjustment
+- horizontally scrolling list view selection fix (for example input
+ panel with wide enough key name could have made autofire selection
+ impossible)
+- inputrecording reliability increased (but it still loses sync)
Final 1.3.3
if (context->trap_has_retval)
m68k_dreg (regs, 0) = context->trap_retval;
+#ifdef _WIN32
+ CloseHandle(context->thread);
+#endif
uae_sem_destroy (&context->switch_to_trap_sem);
uae_sem_destroy (&context->switch_to_emu_sem);
static int log_serial = 1;
+#define CMD_INVALID 0
+#define CMD_RESET 1
+#define CMD_READ 2
+#define CMD_WRITE 3
+#define CMD_UPDATE 4
+#define CMD_CLEAR 5
+#define CMD_STOP 6
+#define CMD_START 7
+#define CMD_FLUSH 8
+#define SDCMD_QUERY 9
+#define SDCMD_BREAK 10
+#define SDCMD_SETPARAMS 11
+
+#define SerErr_DevBusy 1
+#define SerErr_BaudMismatch 2
+#define SerErr_BufErr 4
+#define SerErr_InvParam 5
+#define SerErr_LineErr 6
+#define SerErr_ParityErr 9
+#define SerErr_TimerErr 11
+#define SerErr_BufOverflow 12
+#define SerErr_NoDSR 13
+#define SerErr_DetectedBreak 15
+
+#define SERB_XDISABLED 7 /* io_SerFlags xOn-xOff feature disabled bit */
+#define SERF_XDISABLED (1<<7) /* " xOn-xOff feature disabled mask */
+#define SERB_EOFMODE 6 /* " EOF mode enabled bit */
+#define SERF_EOFMODE (1<<6) /* " EOF mode enabled mask */
+#define SERB_SHARED 5 /* " non-exclusive access bit */
+#define SERF_SHARED (1<<5) /* " non-exclusive access mask */
+#define SERB_RAD_BOOGIE 4 /* " high-speed mode active bit */
+#define SERF_RAD_BOOGIE (1<<4) /* " high-speed mode active mask */
+#define SERB_QUEUEDBRK 3 /* " queue this Break ioRqst */
+#define SERF_QUEUEDBRK (1<<3) /* " queue this Break ioRqst */
+#define SERB_7WIRE 2 /* " RS232 7-wire protocol */
+#define SERF_7WIRE (1<<2) /* " RS232 7-wire protocol */
+#define SERB_PARTY_ODD 1 /* " parity feature enabled bit */
+#define SERF_PARTY_ODD (1<<1) /* " parity feature enabled mask */
+#define SERB_PARTY_ON 0 /* " parity-enabled bit */
+#define SERF_PARTY_ON (1<<0) /* " parity-enabled mask */
+
+#define IO_STATB_XOFFREAD 12 /* io_Status receive currently xOFF'ed bit */
+#define IO_STATF_XOFFREAD (1<<12) /* " receive currently xOFF'ed mask */
+#define IO_STATB_XOFFWRITE 11 /* " transmit currently xOFF'ed bit */
+#define IO_STATF_XOFFWRITE (1<<11) /* " transmit currently xOFF'ed mask */
+#define IO_STATB_READBREAK 10 /* " break was latest input bit */
+#define IO_STATF_READBREAK (1<<10) /* " break was latest input mask */
+#define IO_STATB_WROTEBREAK 9 /* " break was latest output bit */
+#define IO_STATF_WROTEBREAK (1<<9) /* " break was latest output mask */
+#define IO_STATB_OVERRUN 8 /* " status word RBF overrun bit */
+#define IO_STATF_OVERRUN (1<<8) /* " status word RBF overrun mask */
+
+#define io_CtlChar 0x30 /* ULONG control char's (order = xON,xOFF,INQ,ACK) */
+#define io_RBufLen 0x34 /* ULONG length in bytes of serial port's read buffer */
+#define io_ExtFlags 0x38 /* ULONG additional serial flags (see bitdefs below) */
+#define io_Baud 0x3c /* ULONG baud rate requested (true baud) */
+#define io_BrkTime 0x40 /* ULONG duration of break signal in MICROseconds */
+#define io_TermArray0 0x44 /* ULONG termination character array */
+#define io_TermArray1 0x48 /* ULONG termination character array */
+#define io_ReadLen 0x4c /* UBYTE bits per read character (# of bits) */
+#define io_WriteLen 0x4d /* UBYTE bits per write character (# of bits) */
+#define io_StopBits 0x4e /* UBYTE stopbits for read (# of bits) */
+#define io_SerFlags 0x4f /* UBYTE see SerFlags bit definitions below */
+#define io_Status 0x50 /* UWORD */
+
+/* status of serial port, as follows:
+* BIT ACTIVE FUNCTION
+* 0 --- reserved
+* 1 --- reserved
+* 2 high Connected to parallel "select" on the A1000.
+* Connected to both the parallel "select" and
+* serial "ring indicator" pins on the A500
+* & A2000. Take care when making cables.
+* 3 low Data Set Ready
+* 4 low Clear To Send
+* 5 low Carrier Detect
+* 6 low Ready To Send
+* 7 low Data Terminal Ready
+* 8 high read overrun
+* 9 high break sent
+* 10 high break received
+* 11 high transmit x-OFFed
+* 12 high receive x-OFFed
+* 13-15 reserved
+*/
+
+
struct devstruct {
int unit;
char *name;
- int opencnt;
+ int uniq;
+ int exclusive;
volatile uaecptr d_request[MAX_ASYNC_REQUESTS];
volatile int d_request_type[MAX_ASYNC_REQUESTS];
volatile uae_u32 d_request_data[MAX_ASYNC_REQUESTS];
uae_sem_t sync_sem;
};
-struct priv_devstruct {
- int inuse;
- int unit;
- int mode;
- int scsi;
- int ioctl;
- int noscsi;
- int type;
- int flags; /* OpenDevice() */
-};
+static int uniq;
static struct devstruct devst[MAX_TOTAL_DEVICES];
-static struct priv_devstruct pdevst[MAX_OPEN_DEVICES];
static uae_sem_t change_sem;
put_byte (dst++, *src++);
}
-static struct devstruct *getdevstruct (int unit)
+static struct devstruct *getdevstruct (int uniq)
{
int i;
for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
- if (unit >= 0 && devst[i].unit == unit) return &devst[i];
+ if (devst[i].uniq == uniq)
+ return &devst[i];
}
return 0;
}
-static struct priv_devstruct *getpdevstruct (uaecptr request)
-{
- int i = get_long (request + 24);
- if (i < 0 || i >= MAX_OPEN_DEVICES || pdevst[i].inuse == 0) {
- write_log ("serial.device: corrupt iorequest %08.8X %d\n", request, i);
- return 0;
- }
- return &pdevst[i];
-}
-
static void *dev_thread (void *devs);
static int start_thread (struct devstruct *dev)
{
- if (dev->thread_running)
- return 1;
init_comm_pipe (&dev->requests, 100, 1);
uae_sem_init (&dev->sync_sem, 0, 0);
uae_start_thread (dev_thread, dev, &dev->tid);
return dev->thread_running;
}
-static void dev_close_3 (struct devstruct *dev, struct priv_devstruct *pdev)
+static void dev_close_3 (struct devstruct *dev)
{
- if (!dev->opencnt) return;
- dev->opencnt--;
- if (!dev->opencnt) {
- pdev->inuse = 0;
- write_comm_pipe_u32 (&dev->requests, 0, 1);
- }
+ dev->unit = -1;
+ xfree(dev->name);
+ write_comm_pipe_u32 (&dev->requests, 0, 1);
}
static uae_u32 dev_close_2 (void)
{
uae_u32 request = m68k_areg (regs, 1);
- struct priv_devstruct *pdev = getpdevstruct (request);
struct devstruct *dev;
- if (!pdev)
- return 0;
- dev = getdevstruct (pdev->unit);
+ dev = getdevstruct (pdev->uniq);
if (log_serial)
- write_log ("%s:%d close, req=%08.8X\n", getdevname (pdev->type), pdev->unit, request);
+ write_log ("%s:%d close, req=%08.8X\n", dev->name, dev->unit, request);
if (!dev)
return 0;
- dev_close_3 (dev, pdev);
+ dev_close_3 (dev);
put_long (request + 24, 0);
put_word (m68k_areg(regs, 6) + 32, get_word (m68k_areg(regs, 6) + 32) - 1);
return 0;
uaecptr ioreq = m68k_areg(regs, 1);
uae_u32 unit = m68k_dreg (regs, 0);
uae_u32 flags = m68k_dreg (regs, 1);
- struct devstruct *dev = getdevstruct (unit);
- struct priv_devstruct *pdev = 0;
+ struct devstruct *dev;
int i;
+ char devname[256];
if (log_serial)
write_log ("opening %s:%d ioreq=%08.8X\n", getdevname (type), unit, ioreq);
- if (!dev)
- return openfail (ioreq, 32); /* badunitnum */
- if (!dev->opencnt) {
- for (i = 0; i < MAX_OPEN_DEVICES; i++) {
- pdev = &pdevst[i];
- if (pdev->inuse == 0) break;
- }
- pdev->type = type;
- pdev->unit = unit;
- pdev->flags = flags;
- pdev->inuse = 1;
- put_long (ioreq + 24, pdev - pdevst);
- start_thread (dev);
- } else {
- for (i = 0; i < MAX_OPEN_DEVICES; i++) {
- pdev = &pdevst[i];
- if (pdev->inuse && pdev->unit == unit) break;
- }
- if (i == MAX_OPEN_DEVICES)
- return openfail (ioreq, -1);
- put_long (ioreq + 24, pdev - pdevst);
+ sprintf(devname,"COM%d", unit);
+ for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
+ if (devst[i].unit == unit && devst[i].exclusive)
+ return openfail (ioreq, -6); /* busy */
}
- dev->opencnt++;
+ for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
+ if (devst[i].unit == -1)
+ break;
+ }
+ dev = &devst[i];
+ if (i == MAX_TOTAL_DEVICES)
+ return openfail (ioreq, 32); /* badunitnum */
+ dev->unit = unit;
+ dev->name = my_strdup (devname);
+ dev->uniq = ++uniq;
+ dev->exclusive = (get_word(ioreq + io_SerFlags) & SERF_SHARED) ? 0 : 1;
+ put_long (ioreq + 24, i);
+ start_thread (dev);
put_word (m68k_areg(regs, 6) + 32, get_word (m68k_areg(regs, 6) + 32) + 1);
put_byte (ioreq + 31, 0);
{
return 0;
}
-static uae_u32 diskdev_expunge (void)
-{
- return 0;
-}
static int is_async_request (struct devstruct *dev, uaecptr request)
{
int i = 0;
while (i < MAX_ASYNC_REQUESTS) {
- if (dev->d_request[i] == request) return 1;
+ if (dev->d_request[i] == request)
+ return 1;
i++;
}
return 0;
uae_u32 io_offset = get_long (request + 44); // 0x2c
uae_u32 io_error = 0;
int async = 0;
- struct priv_devstruct *pdev = getpdevstruct (request);
+ struct devstruct *dev = getdevstruct (get_long(request + 24));
- if (!pdev)
+ if (!dev)
return 0;
command = get_word (request+28);
switch (command)
{
+ case SDCMD_QUERY:
+ break;
+ case SDCMD_SETPARAMS:
+ break;
+ case CMD_WRITE:
+ break;
+ case CMD_READ:
+ break;
+ case SDCMD_BREAK;
+ case CMD_FLUSH;
+ case CMD_START:
+ case CMD_STOP:
+ case CMD_CLEAR:
+ case CMD_RESET:
+ break;
default:
io_error = -3;
break;
uae_u32 request = m68k_areg(regs, 1);
uae_u8 flags = get_byte (request + 30);
int command = get_word (request + 28);
- struct priv_devstruct *pdev = getpdevstruct (request);
- struct devstruct *dev = getdevstruct (pdev->unit);
+ struct devstruct *dev = getdevstruct (get_long(request + 24));
put_byte (request+8, NT_MESSAGE);
- if (!dev || !pdev) {
+ if (!dev) {
put_byte (request + 31, 32);
return get_byte (request + 31);
}
put_byte (request+31, 0);
if ((flags & 1) && dev_canquick (dev, request)) {
if (dev_do_io (dev, request))
- write_log ("device %s command %d bug with IO_QUICK\n", getdevname (pdev->type), command);
+ write_log ("device %s:%d command %d bug with IO_QUICK\n", dev->name, dev->unit, command);
return get_byte (request + 31);
} else {
add_async_request (dev, request, ASYNC_REQUEST_TEMP, 0);
static uae_u32 dev_abortio (void)
{
uae_u32 request = m68k_areg(regs, 1);
- struct priv_devstruct *pdev = getpdevstruct (request);
- struct devstruct *dev;
+ struct devstruct *dev = getdevstruct (get_long(request + 24));
- if (!pdev) {
- put_byte (request + 31, 32);
- return get_byte (request + 31);
- }
- dev = getdevstruct (pdev->unit);
if (!dev) {
put_byte (request + 31, 32);
return get_byte (request + 31);
}
put_byte (request + 31, -2);
if (log_serial)
- write_log ("abortio %s unit=%d, request=%08.8X\n", getdevname (pdev->type), pdev->unit, request);
+ write_log ("abortio %s:%d, request=%08.8X\n", dev->name, dev->unit, request);
abort_async (dev, request, -2, 0);
return 0;
}
-struct uaeserial_info {
- char *name;
- int num;
-};
-
-static struct uaeserial_info devices[] = {
- { "COM1", 1 },
- { "COM2", 2 },
- { "COM3", 3 },
- { "COM4", 4 },
- { NULL }
-};
-
static void dev_reset (void)
{
int i, j;
memset (dev, 0, sizeof (struct devstruct));
dev->unit = -1;
}
- for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
- dev = &devst[i];
- uaedev = &devices[i];
- if (!dev->name)
- break;
- dev->unit = uaedev->num;
- dev->name = strdup (uaedev->name);
- }
}
static uaecptr ROM_serialdev_resname = 0,
const char *uae_ignoreextensions[] =
{ ".gif", ".jpg", ".png", ".xml", ".pdf", ".txt", 0 };
const char *uae_diskimageextensions[] =
- { ".adf", ".adz", ".ipf", ".fdi", ".exe", 0 };
+ { ".adf", ".adz", ".ipf", ".fdi", ".exe", ".dms", 0 };
int zfile_is_ignore_ext(const char *name)