31.05.2010

parent 3e0522b3
...@@ -1580,7 +1580,7 @@ dnl //mtufan ...@@ -1580,7 +1580,7 @@ dnl //mtufan
dnl dnl
is_64bit=no is_64bit=no
AC_MSG_CHECKING([whether CPU is 64bit]) AC_MSG_CHECKING([whether CPU is 64bit])
if grep "x86_64" /proc/version > /dev/null; then if [[ "$HOST_CPU" = amd64 ]]; then
is_64bit=yes is_64bit=yes
AC_DEFINE(CPU_64_BIT,1,[CPU is 64bit]) AC_DEFINE(CPU_64_BIT,1,[CPU is 64bit])
UAE_DEFINES="$UAE_DEFINES -DCPU_64_BIT -D__x86_64__" UAE_DEFINES="$UAE_DEFINES -DCPU_64_BIT -D__x86_64__"
......
...@@ -297,10 +297,10 @@ static void blitter_interrupt (int hpos, int done) ...@@ -297,10 +297,10 @@ static void blitter_interrupt (int hpos, int done)
{ {
if (blit_interrupt) if (blit_interrupt)
return; return;
if (!done && (!currprefs.blitter_cycle_exact || (currprefs.chipset_mask & CSMASK_AGA))) if (!done && (!currprefs.blitter_cycle_exact || currprefs.cpu_model >= 68020))
return; return;
blit_interrupt = 1; blit_interrupt = 1;
send_interrupt (6, 3); send_interrupt (6, 3 * CYCLE_UNIT);
if (debug_dma) if (debug_dma)
record_dma_event (DMA_EVENT_BLITIRQ, hpos, vpos); record_dma_event (DMA_EVENT_BLITIRQ, hpos, vpos);
} }
...@@ -325,7 +325,7 @@ STATIC_INLINE void chipmem_agnus_wput2 (uaecptr addr, uae_u32 w) ...@@ -325,7 +325,7 @@ STATIC_INLINE void chipmem_agnus_wput2 (uaecptr addr, uae_u32 w)
{ {
last_custom_value1 = w; last_custom_value1 = w;
#ifndef BLITTER_DEBUG_NO_D #ifndef BLITTER_DEBUG_NO_D
chipmem_agnus_wput (addr, w); chipmem_wput_indirect (addr, w);
#endif #endif
} }
...@@ -372,7 +372,7 @@ static void blitter_dofast (void) ...@@ -372,7 +372,7 @@ static void blitter_dofast (void)
uae_u32 bltadat, blitahold; uae_u32 bltadat, blitahold;
uae_u16 bltbdat; uae_u16 bltbdat;
if (bltadatptr) { if (bltadatptr) {
blt_info.bltadat = bltadat = chipmem_agnus_wget (bltadatptr); blt_info.bltadat = bltadat = chipmem_wget_indirect (bltadatptr);
bltadatptr += 2; bltadatptr += 2;
} else } else
bltadat = blt_info.bltadat; bltadat = blt_info.bltadat;
...@@ -381,14 +381,14 @@ static void blitter_dofast (void) ...@@ -381,14 +381,14 @@ static void blitter_dofast (void)
preva = bltadat; preva = bltadat;
if (bltbdatptr) { if (bltbdatptr) {
blt_info.bltbdat = bltbdat = chipmem_agnus_wget (bltbdatptr); blt_info.bltbdat = bltbdat = chipmem_wget_indirect (bltbdatptr);
bltbdatptr += 2; bltbdatptr += 2;
blitbhold = (((uae_u32)prevb << 16) | bltbdat) >> blt_info.blitbshift; blitbhold = (((uae_u32)prevb << 16) | bltbdat) >> blt_info.blitbshift;
prevb = bltbdat; prevb = bltbdat;
} }
if (bltcdatptr) { if (bltcdatptr) {
blt_info.bltcdat = chipmem_agnus_wget (bltcdatptr); blt_info.bltcdat = chipmem_wget_indirect (bltcdatptr);
bltcdatptr += 2; bltcdatptr += 2;
} }
if (dodst) if (dodst)
...@@ -471,7 +471,7 @@ static void blitter_dofast_desc (void) ...@@ -471,7 +471,7 @@ static void blitter_dofast_desc (void)
uae_u32 bltadat, blitahold; uae_u32 bltadat, blitahold;
uae_u16 bltbdat; uae_u16 bltbdat;
if (bltadatptr) { if (bltadatptr) {
bltadat = blt_info.bltadat = chipmem_agnus_wget (bltadatptr); bltadat = blt_info.bltadat = chipmem_wget_indirect (bltadatptr);
bltadatptr -= 2; bltadatptr -= 2;
} else } else
bltadat = blt_info.bltadat; bltadat = blt_info.bltadat;
...@@ -480,14 +480,14 @@ static void blitter_dofast_desc (void) ...@@ -480,14 +480,14 @@ static void blitter_dofast_desc (void)
preva = bltadat; preva = bltadat;
if (bltbdatptr) { if (bltbdatptr) {
blt_info.bltbdat = bltbdat = chipmem_agnus_wget (bltbdatptr); blt_info.bltbdat = bltbdat = chipmem_wget_indirect (bltbdatptr);
bltbdatptr -= 2; bltbdatptr -= 2;
blitbhold = (((uae_u32)bltbdat << 16) | prevb) >> blt_info.blitdownbshift; blitbhold = (((uae_u32)bltbdat << 16) | prevb) >> blt_info.blitdownbshift;
prevb = bltbdat; prevb = bltbdat;
} }
if (bltcdatptr) { if (bltcdatptr) {
blt_info.bltcdat = blt_info.bltbdat = chipmem_agnus_wget (bltcdatptr); blt_info.bltcdat = blt_info.bltbdat = chipmem_wget_indirect (bltcdatptr);
bltcdatptr -= 2; bltcdatptr -= 2;
} }
if (dodst) if (dodst)
...@@ -533,7 +533,7 @@ STATIC_INLINE void blitter_read (void) ...@@ -533,7 +533,7 @@ STATIC_INLINE void blitter_read (void)
if (bltcon0 & 0x200) { if (bltcon0 & 0x200) {
if (!dmaen (DMA_BLITTER)) if (!dmaen (DMA_BLITTER))
return; return;
blt_info.bltcdat = chipmem_bank.wget (bltcpt); blt_info.bltcdat = chipmem_wget_indirect (bltcpt);
last_custom_value1 = blt_info.bltcdat; last_custom_value1 = blt_info.bltcdat;
} }
bltstate = BLT_work; bltstate = BLT_work;
...@@ -548,7 +548,7 @@ STATIC_INLINE void blitter_write (void) ...@@ -548,7 +548,7 @@ STATIC_INLINE void blitter_write (void)
if (!dmaen (DMA_BLITTER)) if (!dmaen (DMA_BLITTER))
return; return;
last_custom_value1 = blt_info.bltddat; last_custom_value1 = blt_info.bltddat;
chipmem_bank.wput (bltdpt, blt_info.bltddat); chipmem_wput_indirect (bltdpt, blt_info.bltddat);
} }
bltstate = BLT_next; bltstate = BLT_next;
} }
...@@ -870,14 +870,14 @@ STATIC_INLINE void blitter_dodma (int ch, int hpos) ...@@ -870,14 +870,14 @@ STATIC_INLINE void blitter_dodma (int ch, int hpos)
switch (ch) switch (ch)
{ {
case 1: case 1:
blt_info.bltadat = dat = chipmem_agnus_wget (bltapt); blt_info.bltadat = dat = chipmem_wget_indirect (bltapt);
last_custom_value1 = blt_info.bltadat; last_custom_value1 = blt_info.bltadat;
addr = bltapt; addr = bltapt;
bltapt += blit_add; bltapt += blit_add;
reg = 0x74; reg = 0x74;
break; break;
case 2: case 2:
blt_info.bltbdat = dat = chipmem_agnus_wget (bltbpt); blt_info.bltbdat = dat = chipmem_wget_indirect (bltbpt);
last_custom_value1 = blt_info.bltbdat; last_custom_value1 = blt_info.bltbdat;
addr = bltbpt; addr = bltbpt;
bltbpt += blit_add; bltbpt += blit_add;
...@@ -889,7 +889,7 @@ STATIC_INLINE void blitter_dodma (int ch, int hpos) ...@@ -889,7 +889,7 @@ STATIC_INLINE void blitter_dodma (int ch, int hpos)
reg = 0x72; reg = 0x72;
break; break;
case 3: case 3:
blt_info.bltcdat = dat = chipmem_agnus_wget (bltcpt); blt_info.bltcdat = dat = chipmem_wget_indirect (bltcpt);
last_custom_value1 = blt_info.bltcdat; last_custom_value1 = blt_info.bltcdat;
addr = bltcpt; addr = bltcpt;
bltcpt += blit_add; bltcpt += blit_add;
...@@ -971,7 +971,7 @@ void decide_blitter (int hpos) ...@@ -971,7 +971,7 @@ void decide_blitter (int hpos)
if (blt_delayed_irq > 0 && hsync) { if (blt_delayed_irq > 0 && hsync) {
blt_delayed_irq--; blt_delayed_irq--;
if (!blt_delayed_irq) if (!blt_delayed_irq)
send_interrupt (6, 2); send_interrupt (6, 2 * CYCLE_UNIT);
} }
if (bltstate == BLT_done) if (bltstate == BLT_done)
......
...@@ -478,13 +478,13 @@ static void update_mirrors (void) ...@@ -478,13 +478,13 @@ static void update_mirrors (void)
STATIC_INLINE uae_u8 *pfield_xlateptr (uaecptr plpt, int bytecount) STATIC_INLINE uae_u8 *pfield_xlateptr (uaecptr plpt, int bytecount)
{ {
if (!chipmem_bank.check (plpt, bytecount)) { if (!chipmem_check_indirect (plpt, bytecount)) {
static int count = 0; static int count = 0;
if (!count) if (!count)
count++, write_log ("Warning: Bad playfield pointer\n"); count++, write_log ("Warning: Bad playfield pointer\n");
return NULL; return NULL;
} }
return chipmem_bank.xlateaddr (plpt); return chipmem_xlate_indirect (plpt);
} }
STATIC_INLINE void docols (struct color_entry *colentry) STATIC_INLINE void docols (struct color_entry *colentry)
...@@ -1081,21 +1081,21 @@ STATIC_INLINE void fetch (int nr, int fm, int hpos) ...@@ -1081,21 +1081,21 @@ STATIC_INLINE void fetch (int nr, int fm, int hpos)
bpl1dat_written = 1; bpl1dat_written = 1;
#ifdef DEBUGGER #ifdef DEBUGGER
if (debug_dma) if (debug_dma)
record_dma (0x110 + nr * 2, chipmem_agnus_wget (p), p, hpos, vpos, DMARECORD_BITPLANE); record_dma (0x110 + nr * 2, chipmem_wget_indirect (p), p, hpos, vpos, DMARECORD_BITPLANE);
#endif #endif
switch (fm) switch (fm)
{ {
case 0: case 0:
fetched[nr] = bplxdat[nr] = last_custom_value1 = chipmem_agnus_wget (p); fetched[nr] = bplxdat[nr] = last_custom_value1 = chipmem_wget_indirect (p);
break; break;
#ifdef AGA #ifdef AGA
case 1: case 1:
fetched_aga0[nr] = chipmem_lget (p); fetched_aga0[nr] = chipmem_lget_indirect (p);
last_custom_value1 = (uae_u16)fetched_aga0[nr]; last_custom_value1 = (uae_u16)fetched_aga0[nr];
break; break;
case 2: case 2:
fetched_aga1[nr] = chipmem_lget (p); fetched_aga1[nr] = chipmem_lget_indirect (p);
fetched_aga0[nr] = chipmem_lget (p + 4); fetched_aga0[nr] = chipmem_lget_indirect (p + 4);
last_custom_value1 = (uae_u16)fetched_aga0[nr]; last_custom_value1 = (uae_u16)fetched_aga0[nr];
break; break;
#endif #endif
...@@ -3132,8 +3132,8 @@ static void immediate_copper (int num) ...@@ -3132,8 +3132,8 @@ static void immediate_copper (int num)
break; break;
pos++; pos++;
oldpos = pos; oldpos = pos;
cop_state.i1 = chipmem_agnus_wget (cop_state.ip); cop_state.i1 = chipmem_wget_indirect (cop_state.ip);
cop_state.i2 = chipmem_agnus_wget (cop_state.ip + 2); cop_state.i2 = chipmem_wget_indirect (cop_state.ip + 2);
cop_state.ip += 4; cop_state.ip += 4;
if (!(cop_state.i1 & 1)) { // move if (!(cop_state.i1 & 1)) { // move
cop_state.i1 &= 0x1fe; cop_state.i1 &= 0x1fe;
...@@ -3410,7 +3410,7 @@ void send_interrupt (int num, int delay) ...@@ -3410,7 +3410,7 @@ void send_interrupt (int num, int delay)
{ {
if (use_eventmode (0x8000) && delay > 0) { if (use_eventmode (0x8000) && delay > 0) {
if (!(intreq & (1 << num))) if (!(intreq & (1 << num)))
event2_newevent_xx (-1, delay * CYCLE_UNIT, num, send_interrupt_do); event2_newevent_xx (-1, delay, num, send_interrupt_do);
} else { } else {
send_interrupt_do (num); send_interrupt_do (num);
} }
...@@ -3906,9 +3906,9 @@ static void BLTSIZH (int hpos, uae_u16 v) ...@@ -3906,9 +3906,9 @@ static void BLTSIZH (int hpos, uae_u16 v)
maybe_blit (hpos, 0); maybe_blit (hpos, 0);
blt_info.hblitsize = v & 0x7FF; blt_info.hblitsize = v & 0x7FF;
if (!blt_info.vblitsize) if (!blt_info.vblitsize)
blt_info.vblitsize = 32768; blt_info.vblitsize = 0x8000;
if (!blt_info.hblitsize) if (!blt_info.hblitsize)
blt_info.hblitsize = 0x800; blt_info.hblitsize = 0x0800;
do_blitter (hpos, copper_access); do_blitter (hpos, copper_access);
} }
...@@ -4347,7 +4347,7 @@ static void update_copper (int until_hpos) ...@@ -4347,7 +4347,7 @@ static void update_copper (int until_hpos)
alloc_cycle (old_hpos, CYCLE_COPPER); alloc_cycle (old_hpos, CYCLE_COPPER);
#ifdef DEBUGGER #ifdef DEBUGGER
if (debug_dma) if (debug_dma)
record_dma (0x8c, chipmem_agnus_wget (cop_state.ip), cop_state.ip, old_hpos, vpos, DMARECORD_COPPER); record_dma (0x8c, chipmem_wget_indirect (cop_state.ip), cop_state.ip, old_hpos, vpos, DMARECORD_COPPER);
#endif #endif
cop_state.ip += 2; cop_state.ip += 2;
break; break;
...@@ -4361,7 +4361,7 @@ static void update_copper (int until_hpos) ...@@ -4361,7 +4361,7 @@ static void update_copper (int until_hpos)
alloc_cycle (old_hpos, CYCLE_COPPER); alloc_cycle (old_hpos, CYCLE_COPPER);
#ifdef DEBUGGER #ifdef DEBUGGER
if (debug_dma) if (debug_dma)
record_dma (0x1fe, chipmem_agnus_wget (cop_state.ip), cop_state.ip, old_hpos, vpos, DMARECORD_COPPER); record_dma (0x1fe, chipmem_wget_indirect (cop_state.ip), cop_state.ip, old_hpos, vpos, DMARECORD_COPPER);
#endif #endif
// next cycle finally reads from new pointer // next cycle finally reads from new pointer
if (cop_state.strobe == 1) if (cop_state.strobe == 1)
...@@ -4385,7 +4385,7 @@ static void update_copper (int until_hpos) ...@@ -4385,7 +4385,7 @@ static void update_copper (int until_hpos)
case COP_read1: case COP_read1:
if (copper_cant_read (old_hpos, 1)) if (copper_cant_read (old_hpos, 1))
continue; continue;
cop_state.i1 = last_custom_value1 = chipmem_agnus_wget (cop_state.ip); cop_state.i1 = last_custom_value1 = chipmem_wget_indirect (cop_state.ip);
alloc_cycle (old_hpos, CYCLE_COPPER); alloc_cycle (old_hpos, CYCLE_COPPER);
#ifdef DEBUGGER #ifdef DEBUGGER
if (debug_dma) if (debug_dma)
...@@ -4398,7 +4398,7 @@ static void update_copper (int until_hpos) ...@@ -4398,7 +4398,7 @@ static void update_copper (int until_hpos)
case COP_read2: case COP_read2:
if (copper_cant_read (old_hpos, 1)) if (copper_cant_read (old_hpos, 1))
continue; continue;
cop_state.i2 = last_custom_value1 = chipmem_agnus_wget (cop_state.ip); cop_state.i2 = last_custom_value1 = chipmem_wget_indirect (cop_state.ip);
alloc_cycle (old_hpos, CYCLE_COPPER); alloc_cycle (old_hpos, CYCLE_COPPER);
cop_state.ip += 2; cop_state.ip += 2;
cop_state.saved_i1 = cop_state.i1; cop_state.saved_i1 = cop_state.i1;
...@@ -4690,7 +4690,7 @@ STATIC_INLINE uae_u16 sprite_fetch (struct sprite *s, int dma, int hpos, int cyc ...@@ -4690,7 +4690,7 @@ STATIC_INLINE uae_u16 sprite_fetch (struct sprite *s, int dma, int hpos, int cyc
if (dma) { if (dma) {
if (cycle && currprefs.cpu_cycle_exact) if (cycle && currprefs.cpu_cycle_exact)
s->ptxhpos = hpos; s->ptxhpos = hpos;
data = last_custom_value1 = chipmem_agnus_wget (s->pt); data = last_custom_value1 = chipmem_wget_indirect (s->pt);
alloc_cycle (hpos, CYCLE_SPRITE); alloc_cycle (hpos, CYCLE_SPRITE);
#ifdef DEBUGGER #ifdef DEBUGGER
if (debug_dma) if (debug_dma)
...@@ -4702,7 +4702,7 @@ STATIC_INLINE uae_u16 sprite_fetch (struct sprite *s, int dma, int hpos, int cyc ...@@ -4702,7 +4702,7 @@ STATIC_INLINE uae_u16 sprite_fetch (struct sprite *s, int dma, int hpos, int cyc
} }
STATIC_INLINE uae_u16 sprite_fetch2 (struct sprite *s, int hpos, int cycle, int mode) STATIC_INLINE uae_u16 sprite_fetch2 (struct sprite *s, int hpos, int cycle, int mode)
{ {
uae_u16 data = last_custom_value1 = chipmem_agnus_wget (s->pt); uae_u16 data = last_custom_value1 = chipmem_wget_indirect (s->pt);
s->pt += 2; s->pt += 2;
return data; return data;
} }
...@@ -4783,7 +4783,7 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos) ...@@ -4783,7 +4783,7 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos)
} }
#if SPRITE_DEBUG > 1 #if SPRITE_DEBUG > 1
if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
write_log (L"%d:%d:dma:P=%06X ", vpos, hpos, s->pt); write_log ("%d:%d:dma:P=%06X ", vpos, hpos, s->pt);
} }
#endif #endif
} }
...@@ -5411,10 +5411,10 @@ void hsync_handler (void) ...@@ -5411,10 +5411,10 @@ void hsync_handler (void)
// DIP Agnus (8361): vblank interrupt is triggered on line 1! // DIP Agnus (8361): vblank interrupt is triggered on line 1!
if (currprefs.cs_dipagnus) { if (currprefs.cs_dipagnus) {
if (vpos == 1) if (vpos == 1)
send_interrupt (5, 1); send_interrupt (5, 1 * CYCLE_UNIT);
} else { } else {
if (vpos == 0) if (vpos == 0)
send_interrupt (5, 1); send_interrupt (5, 1 * CYCLE_UNIT);
} }
#ifdef CPUEMU_12 #ifdef CPUEMU_12
......
This diff is collapsed.
...@@ -145,7 +145,8 @@ STATIC_INLINE void color_reg_cpy (struct color_entry *dst, struct color_entry *s ...@@ -145,7 +145,8 @@ STATIC_INLINE void color_reg_cpy (struct color_entry *dst, struct color_entry *s
else else
#endif #endif
/* copy first 32 acolors and color_regs_ecs */ /* copy first 32 acolors and color_regs_ecs */
memcpy (dst->color_regs_ecs, src->color_regs_ecs, sizeof(struct color_entry)); memcpy (dst->color_regs_ecs, src->color_regs_ecs,
sizeof(struct color_entry));
} }
/* /*
......
...@@ -46,11 +46,11 @@ extern bool no_gui, quit_to_gui; ...@@ -46,11 +46,11 @@ extern bool no_gui, quit_to_gui;
struct gui_info struct gui_info
{ {
uae_u8 drive_motor[4]; /* motor on off */ bool drive_motor[4]; /* motor on off */
uae_u8 drive_track[4]; /* rw-head track */ uae_u8 drive_track[4]; /* rw-head track */
uae_u8 drive_writing[4]; /* drive is writing */ bool drive_writing[4]; /* drive is writing */
uae_u8 drive_disabled[4]; /* drive is disabled */ bool drive_disabled[4]; /* drive is disabled */
uae_u8 powerled; /* state of power led */ bool powerled; /* state of power led */
uae_u8 powerled_brightness; /* 0 to 255 */ uae_u8 powerled_brightness; /* 0 to 255 */
uae_u8 drive_side; /* floppy side */ uae_u8 drive_side; /* floppy side */
uae_u8 hd; /* harddrive */ uae_u8 hd; /* harddrive */
......
...@@ -247,7 +247,7 @@ extern void inputdevice_settest (int); ...@@ -247,7 +247,7 @@ extern void inputdevice_settest (int);
extern int inputdevice_testread_count (void); extern int inputdevice_testread_count (void);
//FIXME: //FIXME:
typedef enum { typedef enum {
DIK_0, DIK_0,
DIK_1, DIK_1,
DIK_2, DIK_2,
...@@ -392,7 +392,7 @@ extern int inputdevice_testread_count (void); ...@@ -392,7 +392,7 @@ extern int inputdevice_testread_count (void);
DIK_Y, DIK_Y,
DIK_YEN, DIK_YEN,
DIK_Z DIK_Z
}; };
static struct uae_input_device_kbr_default keytrans[] = { static struct uae_input_device_kbr_default keytrans[] = {
......
...@@ -45,7 +45,8 @@ extern uae_u32 allocated_chipmem; ...@@ -45,7 +45,8 @@ extern uae_u32 allocated_chipmem;
extern uae_u32 allocated_fastmem; extern uae_u32 allocated_fastmem;
extern uae_u32 allocated_bogomem; extern uae_u32 allocated_bogomem;
extern uae_u32 allocated_gfxmem; extern uae_u32 allocated_gfxmem;
extern uae_u32 allocated_z3fastmem, allocated_z3fastmem2, max_z3fastmem; extern uae_u32 allocated_z3fastmem, allocated_z3fastmem2, allocated_z3chipmem;
extern uae_u32 max_z3fastmem;
extern uae_u32 allocated_a3000mem; extern uae_u32 allocated_a3000mem;
extern uae_u32 allocated_cardmem; extern uae_u32 allocated_cardmem;
...@@ -92,9 +93,9 @@ typedef struct { ...@@ -92,9 +93,9 @@ typedef struct {
* This is used for example to translate bitplane pointers in custom.c */ * This is used for example to translate bitplane pointers in custom.c */
check_func check; check_func check;
/* For those banks that refer to real memory, we can save the whole trouble /* For those banks that refer to real memory, we can save the whole trouble
of going through function calls, and instead simply grab the memory * of going through function calls, and instead simply grab the memory
ourselves. This holds the memory address where the start of memory is * ourselves. This holds the memory address where the start of memory is
for this particular bank. */ * for this particular bank. */
uae_u8 *baseaddr; uae_u8 *baseaddr;
TCHAR *name; TCHAR *name;
/* for instruction opcode/operand fetches */ /* for instruction opcode/operand fetches */
...@@ -189,23 +190,23 @@ extern void free_fastmemory (void); ...@@ -189,23 +190,23 @@ extern void free_fastmemory (void);
STATIC_INLINE uae_u32 get_long (uaecptr addr) STATIC_INLINE uae_u32 get_long (uaecptr addr)
{ {
return longget(addr); return longget (addr);
} }
STATIC_INLINE uae_u32 get_word (uaecptr addr) STATIC_INLINE uae_u32 get_word (uaecptr addr)
{ {
return wordget(addr); return wordget (addr);
} }
STATIC_INLINE uae_u32 get_byte (uaecptr addr) STATIC_INLINE uae_u32 get_byte (uaecptr addr)
{ {
return byteget(addr); return byteget (addr);
} }
STATIC_INLINE uae_u32 get_longi(uaecptr addr) STATIC_INLINE uae_u32 get_longi(uaecptr addr)
{ {
return longgeti(addr); return longgeti (addr);
} }
STATIC_INLINE uae_u32 get_wordi(uaecptr addr) STATIC_INLINE uae_u32 get_wordi(uaecptr addr)
{ {
return wordgeti(addr); return wordgeti (addr);
} }
/* /*
...@@ -290,12 +291,12 @@ STATIC_INLINE void put_pointer (uaecptr addr, void *v) ...@@ -290,12 +291,12 @@ STATIC_INLINE void put_pointer (uaecptr addr, void *v)
STATIC_INLINE uae_u8 *get_real_address (uaecptr addr) STATIC_INLINE uae_u8 *get_real_address (uaecptr addr)
{ {
return get_mem_bank(addr).xlateaddr(addr); return get_mem_bank (addr).xlateaddr(addr);
} }
STATIC_INLINE int valid_address(uaecptr addr, uae_u32 size) STATIC_INLINE int valid_address (uaecptr addr, uae_u32 size)
{ {
return get_mem_bank(addr).check(addr, size); return get_mem_bank (addr).check(addr, size);
} }
extern int addr_valid (TCHAR*, uaecptr,uae_u32); extern int addr_valid (TCHAR*, uaecptr,uae_u32);
...@@ -328,6 +329,15 @@ extern void REGPARAM3 chipmem_lput_ce2 (uaecptr, uae_u32) REGPARAM; ...@@ -328,6 +329,15 @@ extern void REGPARAM3 chipmem_lput_ce2 (uaecptr, uae_u32) REGPARAM;
extern void REGPARAM3 chipmem_wput_ce2 (uaecptr, uae_u32) REGPARAM; extern void REGPARAM3 chipmem_wput_ce2 (uaecptr, uae_u32) REGPARAM;
extern void REGPARAM3 chipmem_bput_ce2 (uaecptr, uae_u32) REGPARAM; extern void REGPARAM3 chipmem_bput_ce2 (uaecptr, uae_u32) REGPARAM;
extern uae_u32 (REGPARAM3 *chipmem_lget_indirect)(uaecptr) REGPARAM;
extern uae_u32 (REGPARAM3 *chipmem_wget_indirect)(uaecptr) REGPARAM;
extern uae_u32 (REGPARAM3 *chipmem_bget_indirect)(uaecptr) REGPARAM;
extern void (REGPARAM3 *chipmem_lput_indirect)(uaecptr, uae_u32) REGPARAM;
extern void (REGPARAM3 *chipmem_wput_indirect)(uaecptr, uae_u32) REGPARAM;
extern void (REGPARAM3 *chipmem_bput_indirect)(uaecptr, uae_u32) REGPARAM;
extern int (REGPARAM2 *chipmem_check_indirect)(uaecptr, uae_u32);
extern uae_u8 *(REGPARAM2 *chipmem_xlate_indirect)(uaecptr);
#ifdef NATMEM_OFFSET #ifdef NATMEM_OFFSET
typedef struct shmpiece_reg { typedef struct shmpiece_reg {
......
...@@ -230,14 +230,14 @@ STATIC_INLINE uaecptr m68k_getpci (void) ...@@ -230,14 +230,14 @@ STATIC_INLINE uaecptr m68k_getpci (void)
{ {
return regs.pc; return regs.pc;
} }
STATIC_INLINE void m68k_incpci(int o) STATIC_INLINE void m68k_incpci (int o)
{ {
regs.pc += o; regs.pc += o;
} }
STATIC_INLINE void m68k_do_rts (void) STATIC_INLINE void m68k_do_rts (void)
{ {
m68k_setpc (get_long(m68k_areg (regs, 7))); m68k_setpc (get_long (m68k_areg (regs, 7)));
m68k_areg (regs, 7) += 4; m68k_areg (regs, 7) += 4;
} }
STATIC_INLINE void m68k_do_rtsi (void) STATIC_INLINE void m68k_do_rtsi (void)
...@@ -249,14 +249,14 @@ STATIC_INLINE void m68k_do_rtsi (void) ...@@ -249,14 +249,14 @@ STATIC_INLINE void m68k_do_rtsi (void)
STATIC_INLINE void m68k_do_bsr (uaecptr oldpc, uae_s32 offset) STATIC_INLINE void m68k_do_bsr (uaecptr oldpc, uae_s32 offset)
{ {
m68k_areg (regs, 7) -= 4; m68k_areg (regs, 7) -= 4;
put_long(m68k_areg (regs, 7), oldpc); put_long (m68k_areg (regs, 7), oldpc);
m68k_incpc (offset); m68k_incpc (offset);
} }
STATIC_INLINE void m68k_do_bsri (uaecptr oldpc, uae_s32 offset) STATIC_INLINE void m68k_do_bsri (uaecptr oldpc, uae_s32 offset)
{ {
m68k_areg (regs, 7) -= 4; m68k_areg (regs, 7) -= 4;
put_long(m68k_areg (regs, 7), oldpc); put_long (m68k_areg (regs, 7), oldpc);
m68k_incpci(offset); m68k_incpci (offset);
} }
STATIC_INLINE uae_u32 get_ibyte (int o) STATIC_INLINE uae_u32 get_ibyte (int o)
......
...@@ -282,7 +282,7 @@ struct uae_prefs { ...@@ -282,7 +282,7 @@ struct uae_prefs {
TCHAR romident[256]; TCHAR romident[256];
TCHAR romextfile[MAX_DPATH]; TCHAR romextfile[MAX_DPATH];
TCHAR romextident[256]; TCHAR romextident[256];
char keyfile[256]; TCHAR keyfile[256];
TCHAR flashfile[MAX_DPATH]; TCHAR flashfile[MAX_DPATH];
#ifdef ACTION_REPLAY #ifdef ACTION_REPLAY
TCHAR cartfile[MAX_DPATH]; TCHAR cartfile[MAX_DPATH];
...@@ -321,6 +321,8 @@ struct uae_prefs { ...@@ -321,6 +321,8 @@ struct uae_prefs {
uae_u32 z3fastmem_size, z3fastmem2_size; uae_u32 z3fastmem_size, z3fastmem2_size;
uae_u32 z3fastmem_start; uae_u32 z3fastmem_start;
uae_u32 z3chipmem_size;
uae_u32 z3chipmem_start;
uae_u32 fastmem_size; uae_u32 fastmem_size;
uae_u32 chipmem_size; uae_u32 chipmem_size;
uae_u32 bogomem_size; uae_u32 bogomem_size;
......
...@@ -39,9 +39,11 @@ extern char *restore_string_func (const uae_u8 **); ...@@ -39,9 +39,11 @@ extern char *restore_string_func (const uae_u8 **);
#ifdef SAVESTATE #ifdef SAVESTATE
/* save, restore and initialize routines for Amiga's subsystems */ /* save, restore and initialize routines for Amiga's subsystems */
extern const uae_u8 *restore_cpu (const uae_u8 *src); extern uae_u8 *restore_cpu (uae_u8 *);
extern void restore_cpu_finish (void); extern void restore_cpu_finish (void);
extern uae_u8 *save_cpu (uae_u32 *len, uae_u8 *dstpr); extern uae_u8 *save_cpu (int *, uae_u8 *);
extern uae_u8 *restore_cpu_extra (uae_u8 *);
extern uae_u8 *save_cpu_extra (int *, uae_u8 *);
extern uae_u8 *restore_mmu (uae_u8 *); extern uae_u8 *restore_mmu (uae_u8 *);
extern uae_u8 *save_mmu (int *, uae_u8 *); extern uae_u8 *save_mmu (int *, uae_u8 *);
...@@ -49,16 +51,18 @@ extern uae_u8 *save_mmu (int *, uae_u8 *); ...@@ -49,16 +51,18 @@ extern uae_u8 *save_mmu (int *, uae_u8 *);
extern uae_u8 *restore_fpu (uae_u8 *); extern uae_u8 *restore_fpu (uae_u8 *);
extern uae_u8 *save_fpu (int *, uae_u8 *); extern uae_u8 *save_fpu (int *, uae_u8 *);
extern const uae_u8 *restore_disk (unsigned int num, const uae_u8 *src); extern uae_u8 *restore_disk (int, uae_u8 *);
extern uae_u8 *save_disk (unsigned int num, uae_u32 *len, uae_u8 *dsptr); extern uae_u8 *save_disk (int, int *, uae_u8 *);
extern const uae_u8 *restore_floppy (const uae_u8 *src); extern uae_u8 *restore_floppy (uae_u8 *src);
extern uae_u8 *save_floppy (uae_u32 *len, uae_u8 *dstptr); extern uae_u8 *save_floppy (int *len, uae_u8 *);
extern void DISK_save_custom (uae_u32 *pdskpt, uae_u16 *pdsklen, uae_u16 *pdsksync, uae_u16 *pdskbytr); extern void DISK_save_custom (uae_u32 *pdskpt, uae_u16 *pdsklen, uae_u16 *pdsksync, uae_u16 *pdskbytr);
extern void DISK_restore_custom (uae_u32 pdskpt, uae_u16 pdsklength, uae_u16 pdskbytr); extern void DISK_restore_custom (uae_u32 pdskpt, uae_u16 pdsklength, uae_u16 pdskbytr);
extern void restore_disk_finish (void); extern void restore_disk_finish (void);
extern uae_u8 *restore_custom (uae_u8 *); extern uae_u8 *restore_custom (uae_u8 *);
extern uae_u8 *save_custom (int *, uae_u8 *, int); extern uae_u8 *save_custom (int *, uae_u8 *, int);
extern uae_u8 *restore_custom_extra (uae_u8 *);
extern uae_u8 *save_custom_extra (int *, uae_u8 *);
extern uae_u8 *restore_custom_sprite (int num, uae_u8 *src); extern uae_u8 *restore_custom_sprite (int num, uae_u8 *src);
extern uae_u8 *save_custom_sprite (int num, int *len, uae_u8 *); extern uae_u8 *save_custom_sprite (int num, int *len, uae_u8 *);
...@@ -109,6 +113,9 @@ extern uae_u8 *restore_configuration (uae_u8 *src); ...@@ -109,6 +113,9 @@ extern uae_u8 *restore_configuration (uae_u8 *src);
extern uae_u8 *save_log (int, int *len); extern uae_u8 *save_log (int, int *len);
extern uae_u8 *restore_log (uae_u8 *src); extern uae_u8 *restore_log (uae_u8 *src);
extern uae_u8 *restore_input (uae_u8 *src);
extern uae_u8 *save_input (int *len, uae_u8 *dstptr);
extern void restore_cram (int, size_t); extern void restore_cram (int, size_t);
extern void restore_bram (int, size_t); extern void restore_bram (int, size_t);
extern void restore_fram (int, size_t); extern void restore_fram (int, size_t);
......
...@@ -111,6 +111,9 @@ static struct uae_input_device2 joysticks2[MAX_INPUT_DEVICES]; ...@@ -111,6 +111,9 @@ static struct uae_input_device2 joysticks2[MAX_INPUT_DEVICES];
static struct uae_input_device2 mice2[MAX_INPUT_DEVICES]; static struct uae_input_device2 mice2[MAX_INPUT_DEVICES];
static uae_u8 scancodeused[MAX_INPUT_DEVICES][256]; static uae_u8 scancodeused[MAX_INPUT_DEVICES][256];
static int mouse_pullup = 1;
static int joystick_pullup = 1;
static int input_acquired; static int input_acquired;
static int testmode, testmode_read, testmode_toggle; static int testmode, testmode_read, testmode_toggle;
struct teststore struct teststore
...@@ -214,6 +217,35 @@ struct input_queue_struct { ...@@ -214,6 +217,35 @@ struct input_queue_struct {
}; };
static struct input_queue_struct input_queue[INPUT_QUEUE_SIZE]; static struct input_queue_struct input_queue[INPUT_QUEUE_SIZE];
uae_u8 *restore_input (uae_u8 *src)
{
unsigned int i,j;
restore_u32 ();
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
pot_cap[i][j] = restore_u16 ();
}
}
return src;
}
uae_u8 *save_input (int *len, uae_u8 *dstptr)
{
uae_u8 *dstbak, *dst;
unsigned int i,j;
if (dstptr)
dstbak = dst = dstptr;
else
dstbak = dst = xmalloc (uae_u8, 1000);
save_u32 (0);
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
save_u16 (pot_cap[i][j]);
}
}
*len = dst - dstbak;
return dstbak;
}
static void freejport (struct uae_prefs *dst, int num) static void freejport (struct uae_prefs *dst, int num)
{ {
...@@ -469,7 +501,7 @@ static int getnum (const TCHAR **pp) ...@@ -469,7 +501,7 @@ static int getnum (const TCHAR **pp)
const TCHAR *p = *pp; const TCHAR *p = *pp;
int v; int v;
/* if (!_tcsnicmp (p, L"false", 5)) /* if (!_tcsnicmp (p, "false", 5))
v = 0; v = 0;
if (!_tcsnicmp (p, "true", 4)) if (!_tcsnicmp (p, "true", 4))
v = 1; v = 1;
...@@ -591,12 +623,14 @@ static void clear_id (struct uae_input_device *id) ...@@ -591,12 +623,14 @@ static void clear_id (struct uae_input_device *id)
xfree (id->custom[i][j]); xfree (id->custom[i][j]);
} }
#endif #endif
xfree (id->configname); TCHAR *cn = id->configname;
xfree (id->name); TCHAR *n = id->name;
memset (id, 0, sizeof (struct uae_input_device)); memset (id, 0, sizeof (struct uae_input_device));
id->configname = cn;
id->name = n;
} }
void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) void read_inputdevice_config (struct uae_prefs *pr, TCHAR *option, TCHAR *value)
{ {
struct uae_input_device *id = 0; struct uae_input_device *id = 0;
struct inputevent *ie; struct inputevent *ie;
...@@ -685,6 +719,8 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) ...@@ -685,6 +719,8 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value)
if (joystick < 0) if (joystick < 0)
set_kbr_default (pr, idnum, devnum); set_kbr_default (pr, idnum, devnum);
id->enabled = iscustom; id->enabled = iscustom;
} else {
id->enabled = false;
} }
return; return;
} }
...@@ -1734,7 +1770,7 @@ static void cap_check (void) ...@@ -1734,7 +1770,7 @@ static void cap_check (void)
joypot = joydirpot[joy][i]; joypot = joydirpot[joy][i];
if (analog_port[joy][i] && pot_cap[joy][i] < joypot) if (analog_port[joy][i] && pot_cap[joy][i] < joypot)
charge = 1; // slow charge via pot variable resistor charge = 1; // slow charge via pot variable resistor
if ((digital_port[joy][i] || mouse_port[joy])) if (((joystick_pullup && digital_port[joy][i]) || (mouse_pullup && mouse_port[joy])))
charge = 1; // slow charge via pull-up resistor charge = 1; // slow charge via pull-up resistor
} }
if (!(potgo_value & pdir)) { // input? if (!(potgo_value & pdir)) { // input?
...@@ -1778,13 +1814,13 @@ static void cap_check (void) ...@@ -1778,13 +1814,13 @@ static void cap_check (void)
} }
/* official Commodore mouse has pull-up resistors in button lines /* official Commodore mouse has pull-up resistors in button lines
* NOTE: 3rd party mice may not have pullups! */ * NOTE: 3rd party mice may not have pullups! */
if (dong < 0 && mouse_port[joy] && charge == 0) if (dong < 0 && (mouse_pullup && mouse_port[joy]) && charge == 0)
charge = 2; charge = 2;
/* emulate pullup resistor if button mapped because there too many broken /* emulate pullup resistor if button mapped because there too many broken
* programs that read second button in input-mode (and most 2+ button pads have * programs that read second button in input-mode (and most 2+ button pads have
* pullups) * pullups)
*/ */
if (dong < 0 && digital_port[joy][i] && charge == 0) if (dong < 0 && (joystick_pullup && digital_port[joy][i]) && charge == 0)
charge = 2; charge = 2;
charge_cap (joy, i, charge); charge_cap (joy, i, charge);
...@@ -3533,7 +3569,6 @@ static void compatibility_copy (struct uae_prefs *prefs) ...@@ -3533,7 +3569,6 @@ static void compatibility_copy (struct uae_prefs *prefs)
{ {
int used[MAX_INPUT_DEVICES] = { 0 }; int used[MAX_INPUT_DEVICES] = { 0 };
int i, joy, j; int i, joy, j;
bool firstmouse = true;
for (i = 0; i < MAX_JPORTS; i++) { for (i = 0; i < MAX_JPORTS; i++) {
joymodes[i] = prefs->jports[i].mode; joymodes[i] = prefs->jports[i].mode;
...@@ -4687,7 +4722,7 @@ void inputdevice_acquire (int allmode) ...@@ -4687,7 +4722,7 @@ void inputdevice_acquire (int allmode)
idev[IDTYPE_KEYBOARD].acquire (i, allmode < 0); idev[IDTYPE_KEYBOARD].acquire (i, allmode < 0);
} }
// if (!input_acquired) // if (!input_acquired)
// write_log (L"input devices acquired (%s)\n", allmode ? "all" : "selected only"); // write_log ("input devices acquired (%s)\n", allmode ? "all" : "selected only");
input_acquired = 1; input_acquired = 1;
} }
...@@ -4746,7 +4781,7 @@ void inputdevice_testrecord (int type, int num, int wtype, int wnum, int state) ...@@ -4746,7 +4781,7 @@ void inputdevice_testrecord (int type, int num, int wtype, int wnum, int state)
if (!state) if (!state)
return; return;
//write_log (L"%d %d %d %d %d\n", type, num, wtype, wnum, state); //write_log ("%d %d %d %d %d\n", type, num, wtype, wnum, state);
struct teststore *ts = &testmode_data[testmode_count]; struct teststore *ts = &testmode_data[testmode_count];
ts->testmode_type = type; ts->testmode_type = type;
ts->testmode_num = num; ts->testmode_num = num;
......
...@@ -577,6 +577,71 @@ static uae_u8 *REGPARAM2 chipmem_xlate (uaecptr addr) ...@@ -577,6 +577,71 @@ static uae_u8 *REGPARAM2 chipmem_xlate (uaecptr addr)
return chipmemory + addr; return chipmemory + addr;
} }
STATIC_INLINE void REGPARAM2 chipmem_lput_bigmem (uaecptr addr, uae_u32 v)
{
put_long (addr, v);
}
STATIC_INLINE void REGPARAM2 chipmem_wput_bigmem (uaecptr addr, uae_u32 v)
{
put_word (addr, v);
}
STATIC_INLINE void REGPARAM2 chipmem_bput_bigmem (uaecptr addr, uae_u32 v)
{
put_byte (addr, v);
}
STATIC_INLINE uae_u32 REGPARAM2 chipmem_lget_bigmem (uaecptr addr)
{
return get_long (addr);
}
STATIC_INLINE uae_u32 REGPARAM2 chipmem_wget_bigmem (uaecptr addr)
{
return get_word (addr);
}
STATIC_INLINE uae_u32 REGPARAM2 chipmem_bget_bigmem (uaecptr addr)
{
return get_byte (addr);
}
STATIC_INLINE int REGPARAM2 chipmem_check_bigmem (uaecptr addr, uae_u32 size)
{
return valid_address (addr, size);
}
STATIC_INLINE uae_u8* REGPARAM2 chipmem_xlate_bigmem (uaecptr addr)
{
return get_real_address (addr);
}
uae_u32 (REGPARAM2 *chipmem_lget_indirect)(uaecptr);
uae_u32 (REGPARAM2 *chipmem_wget_indirect)(uaecptr);
uae_u32 (REGPARAM2 *chipmem_bget_indirect)(uaecptr);
void (REGPARAM2 *chipmem_lput_indirect)(uaecptr, uae_u32);
void (REGPARAM2 *chipmem_wput_indirect)(uaecptr, uae_u32);
void (REGPARAM2 *chipmem_bput_indirect)(uaecptr, uae_u32);
int (REGPARAM2 *chipmem_check_indirect)(uaecptr, uae_u32);
uae_u8 *(REGPARAM2 *chipmem_xlate_indirect)(uaecptr);
static void chipmem_setindirect (void)
{
if (currprefs.z3chipmem_size) {
chipmem_lget_indirect = chipmem_lget_bigmem;
chipmem_wget_indirect = chipmem_wget_bigmem;
chipmem_bget_indirect = chipmem_bget_bigmem;
chipmem_lput_indirect = chipmem_lput_bigmem;
chipmem_wput_indirect = chipmem_wput_bigmem;
chipmem_bput_indirect = chipmem_bput_bigmem;
chipmem_check_indirect = chipmem_check_bigmem;
chipmem_xlate_indirect = chipmem_xlate_bigmem;
} else {
chipmem_lget_indirect = chipmem_lget;
chipmem_wget_indirect = chipmem_agnus_wget;
chipmem_bget_indirect = chipmem_agnus_bget;
chipmem_lput_indirect = chipmem_lput;
chipmem_wput_indirect = chipmem_agnus_wput;
chipmem_bput_indirect = chipmem_agnus_bput;
chipmem_check_indirect = chipmem_check;
chipmem_xlate_indirect = chipmem_xlate;
}
}
/* Slow memory */ /* Slow memory */
static uae_u8 *bogomemory; static uae_u8 *bogomemory;
...@@ -2361,6 +2426,7 @@ void memory_reset (void) ...@@ -2361,6 +2426,7 @@ void memory_reset (void)
init_mem_banks (); init_mem_banks ();
allocate_memory (); allocate_memory ();
chipmem_setindirect ();
if (_tcscmp (currprefs.romfile, changed_prefs.romfile) != 0 if (_tcscmp (currprefs.romfile, changed_prefs.romfile) != 0
|| _tcscmp (currprefs.romextfile, changed_prefs.romextfile) != 0) || _tcscmp (currprefs.romextfile, changed_prefs.romextfile) != 0)
...@@ -2703,7 +2769,7 @@ void map_banks (addrbank *bank, int start, int size, int realsize) ...@@ -2703,7 +2769,7 @@ void map_banks (addrbank *bank, int start, int size, int realsize)
addrbank *orgbank = bank; addrbank *orgbank = bank;
uae_u32 realstart = start; uae_u32 realstart = start;
write_log ("MAP_BANK %04X0000 %d %s\n", start, size, bank->name); //write_log ("MAP_BANK %04X0000 %d %s\n", start, size, bank->name);
#ifdef DEBUG #ifdef DEBUG
old = debug_bankchange (-1); old = debug_bankchange (-1);
......
...@@ -2267,11 +2267,13 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode) ...@@ -2267,11 +2267,13 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode)
warned++; warned++;
} }
Exception (0xA, 0); Exception (0xA, 0);
//activate_debugger();
return 4; return 4;
} }
if (warned < 20) { if (warned < 20) {
write_log ("Illegal instruction: %04x at %08X -> %08X\n", opcode, pc, get_long (regs.vbr + 0x10)); write_log ("Illegal instruction: %04x at %08X -> %08X\n", opcode, pc, get_long (regs.vbr + 0x10));
warned++; warned++;
//activate_debugger();
} }
Exception (4, 0); Exception (4, 0);
...@@ -3218,9 +3220,12 @@ void m68k_go (int may_quit) ...@@ -3218,9 +3220,12 @@ void m68k_go (int may_quit)
regs.spcflags |= of & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE); regs.spcflags |= of & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE);
} }
#endif #endif
set_x_funcs ();
#if defined(MMU) && defined(JIT)
if (mmu_enabled && !currprefs.cachesize) { if (mmu_enabled && !currprefs.cachesize) {
run_func = m68k_run_mmu; run_func = m68k_run_mmu;
} else { } else {
#endif
run_func = currprefs.cpu_cycle_exact && currprefs.cpu_model == 68000 ? m68k_run_1_ce : run_func = currprefs.cpu_cycle_exact && currprefs.cpu_model == 68000 ? m68k_run_1_ce :
currprefs.cpu_compatible && currprefs.cpu_model == 68000 ? m68k_run_1 : currprefs.cpu_compatible && currprefs.cpu_model == 68000 ? m68k_run_1 :
#ifdef JIT #ifdef JIT
...@@ -3229,7 +3234,9 @@ void m68k_go (int may_quit) ...@@ -3229,7 +3234,9 @@ void m68k_go (int may_quit)
(currprefs.cpu_model == 68040 || currprefs.cpu_model == 68060) && currprefs.mmu_model ? m68k_run_mmu040 : (currprefs.cpu_model == 68040 || currprefs.cpu_model == 68060) && currprefs.mmu_model ? m68k_run_mmu040 :
currprefs.cpu_model >= 68020 && currprefs.cpu_cycle_exact ? m68k_run_2ce : currprefs.cpu_model >= 68020 && currprefs.cpu_cycle_exact ? m68k_run_2ce :
currprefs.cpu_compatible ? m68k_run_2p : m68k_run_2; currprefs.cpu_compatible ? m68k_run_2p : m68k_run_2;
#if defined(MMU) && defined(JIT)
} }
#endif
run_func (); run_func ();
} }
in_m68k_go--; in_m68k_go--;
...@@ -3382,8 +3389,11 @@ void m68k_disasm_2 (char *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int c ...@@ -3382,8 +3389,11 @@ void m68k_disasm_2 (char *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int c
m68kpc_offset += 2; m68kpc_offset += 2;
if (lookup->friendlyname)
_tcscpy (instrname, lookup->friendlyname);
else
_tcscpy (instrname, lookup->name); _tcscpy (instrname, lookup->name);
ccpt = _tcsstr (instrname, L"cc"); ccpt = _tcsstr (instrname, "cc");
if (ccpt != 0) { if (ccpt != 0) {
_tcsncpy (ccpt, ccnames[dp->cc], 2); _tcsncpy (ccpt, ccnames[dp->cc], 2);
} }
...@@ -3677,7 +3687,9 @@ void m68k_dumpstate (void *f, uaecptr *nextpc) ...@@ -3677,7 +3687,9 @@ void m68k_dumpstate (void *f, uaecptr *nextpc)
#define CPUTYPE_EC 1 #define CPUTYPE_EC 1
#define CPUMODE_HALT 1 #define CPUMODE_HALT 1
const uae_u8 *restore_cpu (const uae_u8 *src)
uae_u8 *restore_cpu (uae_u8 *src)
{ {
unsigned int i, flags, model; unsigned int i, flags, model;
uae_u32 l; uae_u32 l;
...@@ -3776,7 +3788,9 @@ uae_u8 *restore_cpu_extra (uae_u8 *src) ...@@ -3776,7 +3788,9 @@ uae_u8 *restore_cpu_extra (uae_u8 *src)
currprefs.cpu_compatible = changed_prefs.cpu_compatible = (flags & 2) ? true : false; currprefs.cpu_compatible = changed_prefs.cpu_compatible = (flags & 2) ? true : false;
currprefs.cpu_frequency = changed_prefs.cpu_frequency = restore_u32 (); currprefs.cpu_frequency = changed_prefs.cpu_frequency = restore_u32 ();
currprefs.cpu_clock_multiplier = changed_prefs.cpu_clock_multiplier = restore_u32 (); currprefs.cpu_clock_multiplier = changed_prefs.cpu_clock_multiplier = restore_u32 ();
#ifdef JIT
currprefs.cachesize = changed_prefs.cachesize = (flags & 8) ? 8192 : 0; currprefs.cachesize = changed_prefs.cachesize = (flags & 8) ? 8192 : 0;
#endif
currprefs.m68k_speed = changed_prefs.m68k_speed = 0; currprefs.m68k_speed = changed_prefs.m68k_speed = 0;
if (flags & 4) if (flags & 4)
...@@ -3802,7 +3816,9 @@ uae_u8 *save_cpu_extra (int *len, uae_u8 *dstptr) ...@@ -3802,7 +3816,9 @@ uae_u8 *save_cpu_extra (int *len, uae_u8 *dstptr)
flags |= currprefs.cpu_cycle_exact ? 1 : 0; flags |= currprefs.cpu_cycle_exact ? 1 : 0;
flags |= currprefs.cpu_compatible ? 2 : 0; flags |= currprefs.cpu_compatible ? 2 : 0;
flags |= currprefs.m68k_speed < 0 ? 4 : 0; flags |= currprefs.m68k_speed < 0 ? 4 : 0;
#ifdef JIT
flags |= currprefs.cachesize > 0 ? 8 : 0; flags |= currprefs.cachesize > 0 ? 8 : 0;
#endif
save_u32 (flags); save_u32 (flags);
save_u32 (currprefs.cpu_frequency); save_u32 (currprefs.cpu_frequency);
save_u32 (currprefs.cpu_clock_multiplier); save_u32 (currprefs.cpu_clock_multiplier);
...@@ -3812,7 +3828,7 @@ uae_u8 *save_cpu_extra (int *len, uae_u8 *dstptr) ...@@ -3812,7 +3828,7 @@ uae_u8 *save_cpu_extra (int *len, uae_u8 *dstptr)
return dstbak; return dstbak;
} }
uae_u8 *save_cpu (uae_u32 *len, uae_u8 *dstptr) uae_u8 *save_cpu (int *len, uae_u8 *dstptr)
{ {
uae_u8 *dstbak, *dst; uae_u8 *dstbak, *dst;
unsigned int model, i, khz; unsigned int model, i, khz;
......
...@@ -91,6 +91,41 @@ TCHAR savestate_fname[MAX_DPATH]; ...@@ -91,6 +91,41 @@ TCHAR savestate_fname[MAX_DPATH];
static struct staterecord staterecords[MAX_STATERECORDS]; static struct staterecord staterecords[MAX_STATERECORDS];
#endif #endif
static void state_incompatible_warn (void)
{
static int warned;
int dowarn = 0;
int i;
#ifdef BSDSOCKET
if (currprefs.socket_emu)
dowarn = 1;
#endif
#ifdef UAESERIAL
if (currprefs.uaeserial)
dowarn = 1;
#endif
#ifdef SCSIEMU
if (currprefs.scsi)
dowarn = 1;
#endif
#ifdef CATWEASEL
if (currprefs.catweasel)
dowarn = 1;
#endif
#ifdef FILESYS
for(i = 0; i < currprefs.mountitems; i++) {
struct mountedinfo mi;
int type = get_filesys_unitconfig (&currprefs, i, &mi);
if (mi.ismounted && type != FILESYS_VIRTUAL && type != FILESYS_HARDFILE && type != FILESYS_HARDFILE_RDB)
dowarn = 1;
}
#endif
if (!warned && dowarn) {
warned = 1;
gui_message ("WARNING: Current configuration is not fully compatible with state saves.\nThis message will not appear again.");
}
}
/* functions for reading/writing bytes, shorts and longs in big-endian /* functions for reading/writing bytes, shorts and longs in big-endian
* format independent of host machine's endianess */ * format independent of host machine's endianess */
...@@ -172,11 +207,11 @@ TCHAR *restore_string_func (const uae_u8 **dstp) ...@@ -172,11 +207,11 @@ TCHAR *restore_string_func (const uae_u8 **dstp)
char *top, *to; char *top, *to;
len = strlen ((const char *)dst) + 1; len = strlen ((const char *)dst) + 1;
top = to = malloc (len); top = to = xmalloc (char, len);
do { do {
v = *dst++; v = *dst++;
*top++ = v; *top++ = v;
} while(v); } while (v);
*dstp = dst; *dstp = dst;
return to; return to;
} }
...@@ -278,7 +313,7 @@ static uae_u8 *restore_chunk (struct zfile *f, TCHAR *name, size_t *len, size_t ...@@ -278,7 +313,7 @@ static uae_u8 *restore_chunk (struct zfile *f, TCHAR *name, size_t *len, size_t
if (flags & 1) { if (flags & 1) {
zfile_fread (tmp, 1, 4, f); zfile_fread (tmp, 1, 4, f);
src = tmp; src = tmp;
*totallen = restore_u32(); *totallen = restore_u32 ();
*filepos = zfile_ftell (f) - 4 - 4 - 4; *filepos = zfile_ftell (f) - 4 - 4 - 4;
len2 -= 4; len2 -= 4;
} else { } else {
...@@ -353,7 +388,7 @@ static void restore_header (uae_u8 *src) ...@@ -353,7 +388,7 @@ static void restore_header (uae_u8 *src)
{ {
TCHAR *emuname, *emuversion, *description; TCHAR *emuname, *emuversion, *description;
restore_u32(); restore_u32 ();
emuname = restore_string (); emuname = restore_string ();
emuversion = restore_string (); emuversion = restore_string ();
description = restore_string (); description = restore_string ();
...@@ -433,6 +468,9 @@ void restore_state (const TCHAR *filename) ...@@ -433,6 +468,9 @@ void restore_state (const TCHAR *filename)
} else if (!_tcscmp (name, "ZRAM")) { } else if (!_tcscmp (name, "ZRAM")) {
restore_zram (totallen, filepos, z3num++); restore_zram (totallen, filepos, z3num++);
continue; continue;
} else if (!_tcscmp (name, "ZCRM")) {
restore_zram (totallen, filepos, -1);
continue;
} else if (!_tcscmp (name, "BORO")) { } else if (!_tcscmp (name, "BORO")) {
restore_bootrom (totallen, filepos); restore_bootrom (totallen, filepos);
continue; continue;
...@@ -442,13 +480,15 @@ void restore_state (const TCHAR *filename) ...@@ -442,13 +480,15 @@ void restore_state (const TCHAR *filename)
restore_pram (totallen, filepos); restore_pram (totallen, filepos);
continue; continue;
#endif #endif
} else if (!_tcscmp (name, "CPU ")) } else if (!_tcscmp (name, "CPU ")) {
end = restore_cpu (chunk); end = restore_cpu (chunk);
} else if (!_tcscmp (name, "CPUX"))
end = restore_cpu_extra (chunk);
#ifdef FPUEMU #ifdef FPUEMU
else if (!_tcscmp (name, "FPU ")) else if (!_tcscmp (name, "FPU "))
end = restore_fpu (chunk); end = restore_fpu (chunk);
#endif #endif
#ifdef MMUEMU #ifdef MMU
else if (!_tcscmp (name, "MMU ")) else if (!_tcscmp (name, "MMU "))
end = restore_mmu (chunk); end = restore_mmu (chunk);
#endif #endif
...@@ -476,6 +516,10 @@ void restore_state (const TCHAR *filename) ...@@ -476,6 +516,10 @@ void restore_state (const TCHAR *filename)
end = restore_cia (1, chunk); end = restore_cia (1, chunk);
else if (!_tcscmp (name, "CHIP")) else if (!_tcscmp (name, "CHIP"))
end = restore_custom (chunk); end = restore_custom (chunk);
else if (!_tcscmp (name, "CINP"))
end = restore_input (chunk);
else if (!_tcscmp (name, "CHPX"))
end = restore_custom_extra (chunk);
else if (!_tcscmp (name, "AUD0")) else if (!_tcscmp (name, "AUD0"))
end = restore_audio (0, chunk); end = restore_audio (0, chunk);
else if (!_tcscmp (name, "AUD1")) else if (!_tcscmp (name, "AUD1"))
...@@ -561,7 +605,7 @@ void restore_state (const TCHAR *filename) ...@@ -561,7 +605,7 @@ void restore_state (const TCHAR *filename)
// target_addtorecent (filename, 0); // target_addtorecent (filename, 0);
return; return;
error: error:
savestate_state = 0; savestate_state = 0;
savestate_file = 0; savestate_file = 0;
if (chunk) if (chunk)
...@@ -617,6 +661,8 @@ static void save_rams (struct zfile *f, int comp) ...@@ -617,6 +661,8 @@ static void save_rams (struct zfile *f, int comp)
save_chunk (f, dst, len, "ZRAM", comp); save_chunk (f, dst, len, "ZRAM", comp);
dst = save_zram (&len, 1); dst = save_zram (&len, 1);
save_chunk (f, dst, len, "ZRAM", comp); save_chunk (f, dst, len, "ZRAM", comp);
dst = save_zram (&len, -1);
save_chunk (f, dst, len, "ZCRM", comp);
dst = save_bootrom (&len); dst = save_bootrom (&len);
save_chunk (f, dst, len, "BORO", comp); save_chunk (f, dst, len, "BORO", comp);
#endif #endif
...@@ -641,11 +687,11 @@ int save_state (const TCHAR *filename, const TCHAR *description) ...@@ -641,11 +687,11 @@ int save_state (const TCHAR *filename, const TCHAR *description)
int comp = savestate_docompress; int comp = savestate_docompress;
if (!savestate_specialdump && !savestate_nodialogs) { if (!savestate_specialdump && !savestate_nodialogs) {
/* state_incompatible_warn (); state_incompatible_warn ();
if (!save_filesys_cando ()) { if (!save_filesys_cando ()) {
gui_message ("Filesystem active. Try again later"); gui_message ("Filesystem active. Try again later");
return -1; return -1;
}*/ }
} }
savestate_nodialogs = 0; savestate_nodialogs = 0;
custom_prepare_savestate (); custom_prepare_savestate ();
...@@ -654,20 +700,20 @@ int save_state (const TCHAR *filename, const TCHAR *description) ...@@ -654,20 +700,20 @@ int save_state (const TCHAR *filename, const TCHAR *description)
return 0; return 0;
if (savestate_specialdump) { if (savestate_specialdump) {
size_t pos; size_t pos;
/* if (savestate_specialdump == 2) if (savestate_specialdump == 2)
write_wavheader (f, 0, 22050);*/ write_wavheader (f, 0, 22050);
pos = zfile_ftell(f); pos = zfile_ftell (f);
save_rams (f, -1); save_rams (f, -1);
if (savestate_specialdump == 2) { if (savestate_specialdump == 2) {
int len, len2, i; int len, len2, i;
uae_u8 *tmp; uae_u8 *tmp;
len = zfile_ftell(f) - pos; len = zfile_ftell (f) - pos;
tmp = xmalloc (uae_u8, len); tmp = xmalloc (uae_u8, len);
zfile_fseek(f, pos, SEEK_SET); zfile_fseek(f, pos, SEEK_SET);
len2 = zfile_fread(tmp, 1, len, f); len2 = zfile_fread (tmp, 1, len, f);
for (i = 0; i < len2; i++) for (i = 0; i < len2; i++)
tmp[i] += 0x80; tmp[i] += 0x80;
/* write_wavheader (f, len, 22050);*/ write_wavheader (f, len, 22050);
zfile_fwrite (tmp, len2, 1, f); zfile_fwrite (tmp, len2, 1, f);
xfree (tmp); xfree (tmp);
} }
...@@ -687,13 +733,17 @@ int save_state (const TCHAR *filename, const TCHAR *description) ...@@ -687,13 +733,17 @@ int save_state (const TCHAR *filename, const TCHAR *description)
save_chunk (f, dst, len, "CPU ", 0); save_chunk (f, dst, len, "CPU ", 0);
xfree (dst); xfree (dst);
dst = save_cpu_extra (&len, 0);
save_chunk (f, dst, len, "CPUX", 0);
xfree (dst);
#ifdef FPUEMU #ifdef FPUEMU
dst = save_fpu (&len,0 ); dst = save_fpu (&len,0 );
save_chunk (f, dst, len, "FPU ", 0); save_chunk (f, dst, len, "FPU ", 0);
xfree (dst); xfree (dst);
#endif #endif
#ifdef MMUEMU #ifdef MMU
dst = save_mmu (&len, 0); dst = save_mmu (&len, 0);
save_chunk (f, dst, len, "MMU ", 0); save_chunk (f, dst, len, "MMU ", 0);
xfree (dst); xfree (dst);
...@@ -720,6 +770,14 @@ int save_state (const TCHAR *filename, const TCHAR *description) ...@@ -720,6 +770,14 @@ int save_state (const TCHAR *filename, const TCHAR *description)
save_chunk (f, dst, len, "CHIP", 0); save_chunk (f, dst, len, "CHIP", 0);
xfree (dst); xfree (dst);
dst = save_custom_extra (&len, 0);
save_chunk (f, dst, len, "CHPX", 0);
xfree (dst);
dst = save_input (&len, 0);
save_chunk (f, dst, len, "CINP", 0);
xfree (dst);
dst = save_custom_agacolors (&len, 0); dst = save_custom_agacolors (&len, 0);
save_chunk (f, dst, len, "AGAC", 0); save_chunk (f, dst, len, "AGAC", 0);
xfree (dst); xfree (dst);
...@@ -934,6 +992,7 @@ void savestate_rewind (void) ...@@ -934,6 +992,7 @@ void savestate_rewind (void)
p2 = st->end; p2 = st->end;
write_log ("rewinding from %d\n", replaycounter); write_log ("rewinding from %d\n", replaycounter);
p = restore_cpu (p); p = restore_cpu (p);
p = restore_cpu_extra (p);
#ifdef FPUEMU #ifdef FPUEMU
if (restore_u32_func (&p)) if (restore_u32_func (&p))
p = restore_fpu (p); p = restore_fpu (p);
...@@ -943,6 +1002,7 @@ void savestate_rewind (void) ...@@ -943,6 +1002,7 @@ void savestate_rewind (void)
} }
p = restore_floppy (p); p = restore_floppy (p);
p = restore_custom (p); p = restore_custom (p);
p = restore_custom_extra (p);
p = restore_blitter (p); p = restore_blitter (p);
p = restore_custom_agacolors (p); p = restore_custom_agacolors (p);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
...@@ -1030,6 +1090,11 @@ retry2: ...@@ -1030,6 +1090,11 @@ retry2:
save_cpu (&len, p); save_cpu (&len, p);
tlen += len; tlen += len;
p += len; p += len;
if (bufcheck (&p, 0))
goto retry;
save_cpu_extra (&len, p);
tlen += len;
p += len;
#ifdef FPUEMU #ifdef FPUEMU
if (bufcheck (&p, 0)) if (bufcheck (&p, 0))
goto retry; goto retry;
...@@ -1059,6 +1124,11 @@ retry2: ...@@ -1059,6 +1124,11 @@ retry2:
save_custom (&len, p, 0); save_custom (&len, p, 0);
tlen += len; tlen += len;
p += len; p += len;
if (bufcheck (&p, 0))
goto retry;
save_custom_extra (&len, p);
tlen += len;
p += len;
if (bufcheck (&p, 0)) if (bufcheck (&p, 0))
goto retry; goto retry;
save_blitter (&len, p); save_blitter (&len, p);
......
...@@ -445,7 +445,7 @@ configure:4344: $? = 0 ...@@ -445,7 +445,7 @@ configure:4344: $? = 0
configure:4344: result: yes configure:4344: result: yes
configure:4350: checking for _doprnt configure:4350: checking for _doprnt
configure:4350: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5 configure:4350: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccwoa8am.o: In function `main': /tmp/ccvIP0rc.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:67: undefined reference to `_doprnt' /home/gnostic/puaex/src/tools/conftest.c:67: undefined reference to `_doprnt'
collect2: ld returned 1 exit status collect2: ld returned 1 exit status
configure:4350: $? = 1 configure:4350: $? = 1
...@@ -533,7 +533,7 @@ configure:4364: $? = 0 ...@@ -533,7 +533,7 @@ configure:4364: $? = 0
configure:4364: result: yes configure:4364: result: yes
configure:4364: checking for strcmpi configure:4364: checking for strcmpi
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5 configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccvPJKzx.o: In function `main': /tmp/ccrvPcpr.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `strcmpi' /home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `strcmpi'
collect2: ld returned 1 exit status collect2: ld returned 1 exit status
configure:4364: $? = 1 configure:4364: $? = 1
...@@ -613,7 +613,7 @@ configure: failed program was: ...@@ -613,7 +613,7 @@ configure: failed program was:
configure:4364: result: no configure:4364: result: no
configure:4364: checking for stricmp configure:4364: checking for stricmp
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5 configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccIoevFC.o: In function `main': /tmp/ccc5rzSv.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `stricmp' /home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `stricmp'
collect2: ld returned 1 exit status collect2: ld returned 1 exit status
configure:4364: $? = 1 configure:4364: $? = 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment