31.05.2010

parent 3e0522b3
......@@ -1580,7 +1580,7 @@ dnl //mtufan
dnl
is_64bit=no
AC_MSG_CHECKING([whether CPU is 64bit])
if grep "x86_64" /proc/version > /dev/null; then
if [[ "$HOST_CPU" = amd64 ]]; then
is_64bit=yes
AC_DEFINE(CPU_64_BIT,1,[CPU is 64bit])
UAE_DEFINES="$UAE_DEFINES -DCPU_64_BIT -D__x86_64__"
......
......@@ -297,10 +297,10 @@ static void blitter_interrupt (int hpos, int done)
{
if (blit_interrupt)
return;
if (!done && (!currprefs.blitter_cycle_exact || (currprefs.chipset_mask & CSMASK_AGA)))
if (!done && (!currprefs.blitter_cycle_exact || currprefs.cpu_model >= 68020))
return;
blit_interrupt = 1;
send_interrupt (6, 3);
send_interrupt (6, 3 * CYCLE_UNIT);
if (debug_dma)
record_dma_event (DMA_EVENT_BLITIRQ, hpos, vpos);
}
......@@ -325,7 +325,7 @@ STATIC_INLINE void chipmem_agnus_wput2 (uaecptr addr, uae_u32 w)
{
last_custom_value1 = w;
#ifndef BLITTER_DEBUG_NO_D
chipmem_agnus_wput (addr, w);
chipmem_wput_indirect (addr, w);
#endif
}
......@@ -372,7 +372,7 @@ static void blitter_dofast (void)
uae_u32 bltadat, blitahold;
uae_u16 bltbdat;
if (bltadatptr) {
blt_info.bltadat = bltadat = chipmem_agnus_wget (bltadatptr);
blt_info.bltadat = bltadat = chipmem_wget_indirect (bltadatptr);
bltadatptr += 2;
} else
bltadat = blt_info.bltadat;
......@@ -381,14 +381,14 @@ static void blitter_dofast (void)
preva = bltadat;
if (bltbdatptr) {
blt_info.bltbdat = bltbdat = chipmem_agnus_wget (bltbdatptr);
blt_info.bltbdat = bltbdat = chipmem_wget_indirect (bltbdatptr);
bltbdatptr += 2;
blitbhold = (((uae_u32)prevb << 16) | bltbdat) >> blt_info.blitbshift;
prevb = bltbdat;
}
if (bltcdatptr) {
blt_info.bltcdat = chipmem_agnus_wget (bltcdatptr);
blt_info.bltcdat = chipmem_wget_indirect (bltcdatptr);
bltcdatptr += 2;
}
if (dodst)
......@@ -471,7 +471,7 @@ static void blitter_dofast_desc (void)
uae_u32 bltadat, blitahold;
uae_u16 bltbdat;
if (bltadatptr) {
bltadat = blt_info.bltadat = chipmem_agnus_wget (bltadatptr);
bltadat = blt_info.bltadat = chipmem_wget_indirect (bltadatptr);
bltadatptr -= 2;
} else
bltadat = blt_info.bltadat;
......@@ -480,14 +480,14 @@ static void blitter_dofast_desc (void)
preva = bltadat;
if (bltbdatptr) {
blt_info.bltbdat = bltbdat = chipmem_agnus_wget (bltbdatptr);
blt_info.bltbdat = bltbdat = chipmem_wget_indirect (bltbdatptr);
bltbdatptr -= 2;
blitbhold = (((uae_u32)bltbdat << 16) | prevb) >> blt_info.blitdownbshift;
prevb = bltbdat;
}
if (bltcdatptr) {
blt_info.bltcdat = blt_info.bltbdat = chipmem_agnus_wget (bltcdatptr);
blt_info.bltcdat = blt_info.bltbdat = chipmem_wget_indirect (bltcdatptr);
bltcdatptr -= 2;
}
if (dodst)
......@@ -533,7 +533,7 @@ STATIC_INLINE void blitter_read (void)
if (bltcon0 & 0x200) {
if (!dmaen (DMA_BLITTER))
return;
blt_info.bltcdat = chipmem_bank.wget (bltcpt);
blt_info.bltcdat = chipmem_wget_indirect (bltcpt);
last_custom_value1 = blt_info.bltcdat;
}
bltstate = BLT_work;
......@@ -548,7 +548,7 @@ STATIC_INLINE void blitter_write (void)
if (!dmaen (DMA_BLITTER))
return;
last_custom_value1 = blt_info.bltddat;
chipmem_bank.wput (bltdpt, blt_info.bltddat);
chipmem_wput_indirect (bltdpt, blt_info.bltddat);
}
bltstate = BLT_next;
}
......@@ -870,14 +870,14 @@ STATIC_INLINE void blitter_dodma (int ch, int hpos)
switch (ch)
{
case 1:
blt_info.bltadat = dat = chipmem_agnus_wget (bltapt);
blt_info.bltadat = dat = chipmem_wget_indirect (bltapt);
last_custom_value1 = blt_info.bltadat;
addr = bltapt;
bltapt += blit_add;
reg = 0x74;
break;
case 2:
blt_info.bltbdat = dat = chipmem_agnus_wget (bltbpt);
blt_info.bltbdat = dat = chipmem_wget_indirect (bltbpt);
last_custom_value1 = blt_info.bltbdat;
addr = bltbpt;
bltbpt += blit_add;
......@@ -889,7 +889,7 @@ STATIC_INLINE void blitter_dodma (int ch, int hpos)
reg = 0x72;
break;
case 3:
blt_info.bltcdat = dat = chipmem_agnus_wget (bltcpt);
blt_info.bltcdat = dat = chipmem_wget_indirect (bltcpt);
last_custom_value1 = blt_info.bltcdat;
addr = bltcpt;
bltcpt += blit_add;
......@@ -971,7 +971,7 @@ void decide_blitter (int hpos)
if (blt_delayed_irq > 0 && hsync) {
blt_delayed_irq--;
if (!blt_delayed_irq)
send_interrupt (6, 2);
send_interrupt (6, 2 * CYCLE_UNIT);
}
if (bltstate == BLT_done)
......
......@@ -478,13 +478,13 @@ static void update_mirrors (void)
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;
if (!count)
count++, write_log ("Warning: Bad playfield pointer\n");
return NULL;
}
return chipmem_bank.xlateaddr (plpt);
return chipmem_xlate_indirect (plpt);
}
STATIC_INLINE void docols (struct color_entry *colentry)
......@@ -1081,21 +1081,21 @@ STATIC_INLINE void fetch (int nr, int fm, int hpos)
bpl1dat_written = 1;
#ifdef DEBUGGER
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
switch (fm)
{
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;
#ifdef AGA
case 1:
fetched_aga0[nr] = chipmem_lget (p);
fetched_aga0[nr] = chipmem_lget_indirect (p);
last_custom_value1 = (uae_u16)fetched_aga0[nr];
break;
case 2:
fetched_aga1[nr] = chipmem_lget (p);
fetched_aga0[nr] = chipmem_lget (p + 4);
fetched_aga1[nr] = chipmem_lget_indirect (p);
fetched_aga0[nr] = chipmem_lget_indirect (p + 4);
last_custom_value1 = (uae_u16)fetched_aga0[nr];
break;
#endif
......@@ -3132,8 +3132,8 @@ static void immediate_copper (int num)
break;
pos++;
oldpos = pos;
cop_state.i1 = chipmem_agnus_wget (cop_state.ip);
cop_state.i2 = chipmem_agnus_wget (cop_state.ip + 2);
cop_state.i1 = chipmem_wget_indirect (cop_state.ip);
cop_state.i2 = chipmem_wget_indirect (cop_state.ip + 2);
cop_state.ip += 4;
if (!(cop_state.i1 & 1)) { // move
cop_state.i1 &= 0x1fe;
......@@ -3410,7 +3410,7 @@ void send_interrupt (int num, int delay)
{
if (use_eventmode (0x8000) && delay > 0) {
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 {
send_interrupt_do (num);
}
......@@ -3906,9 +3906,9 @@ static void BLTSIZH (int hpos, uae_u16 v)
maybe_blit (hpos, 0);
blt_info.hblitsize = v & 0x7FF;
if (!blt_info.vblitsize)
blt_info.vblitsize = 32768;
blt_info.vblitsize = 0x8000;
if (!blt_info.hblitsize)
blt_info.hblitsize = 0x800;
blt_info.hblitsize = 0x0800;
do_blitter (hpos, copper_access);
}
......@@ -4347,7 +4347,7 @@ static void update_copper (int until_hpos)
alloc_cycle (old_hpos, CYCLE_COPPER);
#ifdef DEBUGGER
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
cop_state.ip += 2;
break;
......@@ -4361,7 +4361,7 @@ static void update_copper (int until_hpos)
alloc_cycle (old_hpos, CYCLE_COPPER);
#ifdef DEBUGGER
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
// next cycle finally reads from new pointer
if (cop_state.strobe == 1)
......@@ -4385,7 +4385,7 @@ static void update_copper (int until_hpos)
case COP_read1:
if (copper_cant_read (old_hpos, 1))
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);
#ifdef DEBUGGER
if (debug_dma)
......@@ -4398,7 +4398,7 @@ static void update_copper (int until_hpos)
case COP_read2:
if (copper_cant_read (old_hpos, 1))
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);
cop_state.ip += 2;
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
if (dma) {
if (cycle && currprefs.cpu_cycle_exact)
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);
#ifdef DEBUGGER
if (debug_dma)
......@@ -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)
{
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;
return data;
}
......@@ -4783,7 +4783,7 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos)
}
#if SPRITE_DEBUG > 1
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
}
......@@ -5411,10 +5411,10 @@ void hsync_handler (void)
// DIP Agnus (8361): vblank interrupt is triggered on line 1!
if (currprefs.cs_dipagnus) {
if (vpos == 1)
send_interrupt (5, 1);
send_interrupt (5, 1 * CYCLE_UNIT);
} else {
if (vpos == 0)
send_interrupt (5, 1);
send_interrupt (5, 1 * CYCLE_UNIT);
}
#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
else
#endif
/* 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;
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_writing[4]; /* drive is writing */
uae_u8 drive_disabled[4]; /* drive is disabled */
uae_u8 powerled; /* state of power led */
bool drive_writing[4]; /* drive is writing */
bool drive_disabled[4]; /* drive is disabled */
bool powerled; /* state of power led */
uae_u8 powerled_brightness; /* 0 to 255 */
uae_u8 drive_side; /* floppy side */
uae_u8 hd; /* harddrive */
......
......@@ -247,7 +247,7 @@ extern void inputdevice_settest (int);
extern int inputdevice_testread_count (void);
//FIXME:
typedef enum {
typedef enum {
DIK_0,
DIK_1,
DIK_2,
......@@ -392,7 +392,7 @@ extern int inputdevice_testread_count (void);
DIK_Y,
DIK_YEN,
DIK_Z
};
};
static struct uae_input_device_kbr_default keytrans[] = {
......
......@@ -45,7 +45,8 @@ extern uae_u32 allocated_chipmem;
extern uae_u32 allocated_fastmem;
extern uae_u32 allocated_bogomem;
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_cardmem;
......@@ -92,9 +93,9 @@ typedef struct {
* This is used for example to translate bitplane pointers in custom.c */
check_func check;
/* 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
ourselves. This holds the memory address where the start of memory is
for this particular bank. */
* of going through function calls, and instead simply grab the memory
* ourselves. This holds the memory address where the start of memory is
* for this particular bank. */
uae_u8 *baseaddr;
TCHAR *name;
/* for instruction opcode/operand fetches */
......@@ -189,23 +190,23 @@ extern void free_fastmemory (void);
STATIC_INLINE uae_u32 get_long (uaecptr addr)
{
return longget(addr);
return longget (addr);
}
STATIC_INLINE uae_u32 get_word (uaecptr addr)
{
return wordget(addr);
return wordget (addr);
}
STATIC_INLINE uae_u32 get_byte (uaecptr addr)
{
return byteget(addr);
return byteget (addr);
}
STATIC_INLINE uae_u32 get_longi(uaecptr addr)
{
return longgeti(addr);
return longgeti (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)
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);
......@@ -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_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
typedef struct shmpiece_reg {
......
......@@ -230,14 +230,14 @@ STATIC_INLINE uaecptr m68k_getpci (void)
{
return regs.pc;
}
STATIC_INLINE void m68k_incpci(int o)
STATIC_INLINE void m68k_incpci (int o)
{
regs.pc += o;
}
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;
}
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)
{
m68k_areg (regs, 7) -= 4;
put_long(m68k_areg (regs, 7), oldpc);
put_long (m68k_areg (regs, 7), oldpc);
m68k_incpc (offset);
}
STATIC_INLINE void m68k_do_bsri (uaecptr oldpc, uae_s32 offset)
{
m68k_areg (regs, 7) -= 4;
put_long(m68k_areg (regs, 7), oldpc);
m68k_incpci(offset);
put_long (m68k_areg (regs, 7), oldpc);
m68k_incpci (offset);
}
STATIC_INLINE uae_u32 get_ibyte (int o)
......
......@@ -282,7 +282,7 @@ struct uae_prefs {
TCHAR romident[256];
TCHAR romextfile[MAX_DPATH];
TCHAR romextident[256];
char keyfile[256];
TCHAR keyfile[256];
TCHAR flashfile[MAX_DPATH];
#ifdef ACTION_REPLAY
TCHAR cartfile[MAX_DPATH];
......@@ -321,6 +321,8 @@ struct uae_prefs {
uae_u32 z3fastmem_size, z3fastmem2_size;
uae_u32 z3fastmem_start;
uae_u32 z3chipmem_size;
uae_u32 z3chipmem_start;
uae_u32 fastmem_size;
uae_u32 chipmem_size;
uae_u32 bogomem_size;
......
......@@ -39,9 +39,11 @@ extern char *restore_string_func (const uae_u8 **);
#ifdef SAVESTATE
/* 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 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 *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 *save_fpu (int *, uae_u8 *);
extern const uae_u8 *restore_disk (unsigned int num, const uae_u8 *src);
extern uae_u8 *save_disk (unsigned int num, uae_u32 *len, uae_u8 *dsptr);
extern const uae_u8 *restore_floppy (const uae_u8 *src);
extern uae_u8 *save_floppy (uae_u32 *len, uae_u8 *dstptr);
extern uae_u8 *restore_disk (int, uae_u8 *);
extern uae_u8 *save_disk (int, int *, uae_u8 *);
extern uae_u8 *restore_floppy (uae_u8 *src);
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_restore_custom (uae_u32 pdskpt, uae_u16 pdsklength, uae_u16 pdskbytr);
extern void restore_disk_finish (void);
extern uae_u8 *restore_custom (uae_u8 *);
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 *save_custom_sprite (int num, int *len, uae_u8 *);
......@@ -109,6 +113,9 @@ extern uae_u8 *restore_configuration (uae_u8 *src);
extern uae_u8 *save_log (int, int *len);
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_bram (int, size_t);
extern void restore_fram (int, size_t);
......
......@@ -111,6 +111,9 @@ static struct uae_input_device2 joysticks2[MAX_INPUT_DEVICES];
static struct uae_input_device2 mice2[MAX_INPUT_DEVICES];
static uae_u8 scancodeused[MAX_INPUT_DEVICES][256];
static int mouse_pullup = 1;
static int joystick_pullup = 1;
static int input_acquired;
static int testmode, testmode_read, testmode_toggle;
struct teststore
......@@ -214,6 +217,35 @@ struct input_queue_struct {
};
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)
{
......@@ -469,7 +501,7 @@ static int getnum (const TCHAR **pp)
const TCHAR *p = *pp;
int v;
/* if (!_tcsnicmp (p, L"false", 5))
/* if (!_tcsnicmp (p, "false", 5))
v = 0;
if (!_tcsnicmp (p, "true", 4))
v = 1;
......@@ -591,12 +623,14 @@ static void clear_id (struct uae_input_device *id)
xfree (id->custom[i][j]);
}
#endif
xfree (id->configname);
xfree (id->name);
TCHAR *cn = id->configname;
TCHAR *n = id->name;
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 inputevent *ie;
......@@ -685,6 +719,8 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value)
if (joystick < 0)
set_kbr_default (pr, idnum, devnum);
id->enabled = iscustom;
} else {
id->enabled = false;
}
return;
}
......@@ -1734,7 +1770,7 @@ static void cap_check (void)
joypot = joydirpot[joy][i];
if (analog_port[joy][i] && pot_cap[joy][i] < joypot)
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
}
if (!(potgo_value & pdir)) { // input?
......@@ -1778,13 +1814,13 @@ static void cap_check (void)
}
/* official Commodore mouse has pull-up resistors in button lines
* 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;
/* 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
* pullups)
*/
if (dong < 0 && digital_port[joy][i] && charge == 0)
if (dong < 0 && (joystick_pullup && digital_port[joy][i]) && charge == 0)
charge = 2;
charge_cap (joy, i, charge);
......@@ -3533,7 +3569,6 @@ static void compatibility_copy (struct uae_prefs *prefs)
{
int used[MAX_INPUT_DEVICES] = { 0 };
int i, joy, j;
bool firstmouse = true;
for (i = 0; i < MAX_JPORTS; i++) {
joymodes[i] = prefs->jports[i].mode;
......@@ -4687,7 +4722,7 @@ void inputdevice_acquire (int allmode)
idev[IDTYPE_KEYBOARD].acquire (i, allmode < 0);
}
// 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;
}
......@@ -4746,7 +4781,7 @@ void inputdevice_testrecord (int type, int num, int wtype, int wnum, int state)
if (!state)
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];
ts->testmode_type = type;
ts->testmode_num = num;
......
......@@ -577,6 +577,71 @@ static uae_u8 *REGPARAM2 chipmem_xlate (uaecptr 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 */
static uae_u8 *bogomemory;
......@@ -2361,6 +2426,7 @@ void memory_reset (void)
init_mem_banks ();
allocate_memory ();
chipmem_setindirect ();
if (_tcscmp (currprefs.romfile, changed_prefs.romfile) != 0
|| _tcscmp (currprefs.romextfile, changed_prefs.romextfile) != 0)
......@@ -2703,7 +2769,7 @@ void map_banks (addrbank *bank, int start, int size, int realsize)
addrbank *orgbank = bank;
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
old = debug_bankchange (-1);
......
......@@ -2267,11 +2267,13 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode)
warned++;
}
Exception (0xA, 0);
//activate_debugger();
return 4;
}
if (warned < 20) {
write_log ("Illegal instruction: %04x at %08X -> %08X\n", opcode, pc, get_long (regs.vbr + 0x10));
warned++;
//activate_debugger();
}
Exception (4, 0);
......@@ -3218,9 +3220,12 @@ void m68k_go (int may_quit)
regs.spcflags |= of & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE);
}
#endif
set_x_funcs ();
#if defined(MMU) && defined(JIT)
if (mmu_enabled && !currprefs.cachesize) {
run_func = m68k_run_mmu;
} else {
#endif
run_func = currprefs.cpu_cycle_exact && currprefs.cpu_model == 68000 ? m68k_run_1_ce :
currprefs.cpu_compatible && currprefs.cpu_model == 68000 ? m68k_run_1 :
#ifdef JIT
......@@ -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 >= 68020 && currprefs.cpu_cycle_exact ? m68k_run_2ce :
currprefs.cpu_compatible ? m68k_run_2p : m68k_run_2;
#if defined(MMU) && defined(JIT)
}
#endif
run_func ();
}
in_m68k_go--;
......@@ -3382,8 +3389,11 @@ void m68k_disasm_2 (char *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int c
m68kpc_offset += 2;
if (lookup->friendlyname)
_tcscpy (instrname, lookup->friendlyname);
else
_tcscpy (instrname, lookup->name);
ccpt = _tcsstr (instrname, L"cc");
ccpt = _tcsstr (instrname, "cc");
if (ccpt != 0) {
_tcsncpy (ccpt, ccnames[dp->cc], 2);
}
......@@ -3677,7 +3687,9 @@ void m68k_dumpstate (void *f, uaecptr *nextpc)
#define CPUTYPE_EC 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;
uae_u32 l;
......@@ -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_frequency = changed_prefs.cpu_frequency = restore_u32 ();
currprefs.cpu_clock_multiplier = changed_prefs.cpu_clock_multiplier = restore_u32 ();
#ifdef JIT
currprefs.cachesize = changed_prefs.cachesize = (flags & 8) ? 8192 : 0;
#endif
currprefs.m68k_speed = changed_prefs.m68k_speed = 0;
if (flags & 4)
......@@ -3802,7 +3816,9 @@ uae_u8 *save_cpu_extra (int *len, uae_u8 *dstptr)
flags |= currprefs.cpu_cycle_exact ? 1 : 0;
flags |= currprefs.cpu_compatible ? 2 : 0;
flags |= currprefs.m68k_speed < 0 ? 4 : 0;
#ifdef JIT
flags |= currprefs.cachesize > 0 ? 8 : 0;
#endif
save_u32 (flags);
save_u32 (currprefs.cpu_frequency);
save_u32 (currprefs.cpu_clock_multiplier);
......@@ -3812,7 +3828,7 @@ uae_u8 *save_cpu_extra (int *len, uae_u8 *dstptr)
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;
unsigned int model, i, khz;
......
......@@ -91,6 +91,41 @@ TCHAR savestate_fname[MAX_DPATH];
static struct staterecord staterecords[MAX_STATERECORDS];
#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
* format independent of host machine's endianess */
......@@ -172,11 +207,11 @@ TCHAR *restore_string_func (const uae_u8 **dstp)
char *top, *to;
len = strlen ((const char *)dst) + 1;
top = to = malloc (len);
top = to = xmalloc (char, len);
do {
v = *dst++;
*top++ = v;
} while(v);
} while (v);
*dstp = dst;
return to;
}
......@@ -278,7 +313,7 @@ static uae_u8 *restore_chunk (struct zfile *f, TCHAR *name, size_t *len, size_t
if (flags & 1) {
zfile_fread (tmp, 1, 4, f);
src = tmp;
*totallen = restore_u32();
*totallen = restore_u32 ();
*filepos = zfile_ftell (f) - 4 - 4 - 4;
len2 -= 4;
} else {
......@@ -353,7 +388,7 @@ static void restore_header (uae_u8 *src)
{
TCHAR *emuname, *emuversion, *description;
restore_u32();
restore_u32 ();
emuname = restore_string ();
emuversion = restore_string ();
description = restore_string ();
......@@ -433,6 +468,9 @@ void restore_state (const TCHAR *filename)
} else if (!_tcscmp (name, "ZRAM")) {
restore_zram (totallen, filepos, z3num++);
continue;
} else if (!_tcscmp (name, "ZCRM")) {
restore_zram (totallen, filepos, -1);
continue;
} else if (!_tcscmp (name, "BORO")) {
restore_bootrom (totallen, filepos);
continue;
......@@ -442,13 +480,15 @@ void restore_state (const TCHAR *filename)
restore_pram (totallen, filepos);
continue;
#endif
} else if (!_tcscmp (name, "CPU "))
} else if (!_tcscmp (name, "CPU ")) {
end = restore_cpu (chunk);
} else if (!_tcscmp (name, "CPUX"))
end = restore_cpu_extra (chunk);
#ifdef FPUEMU
else if (!_tcscmp (name, "FPU "))
end = restore_fpu (chunk);
#endif
#ifdef MMUEMU
#ifdef MMU
else if (!_tcscmp (name, "MMU "))
end = restore_mmu (chunk);
#endif
......@@ -476,6 +516,10 @@ void restore_state (const TCHAR *filename)
end = restore_cia (1, chunk);
else if (!_tcscmp (name, "CHIP"))
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"))
end = restore_audio (0, chunk);
else if (!_tcscmp (name, "AUD1"))
......@@ -561,7 +605,7 @@ void restore_state (const TCHAR *filename)
// target_addtorecent (filename, 0);
return;
error:
error:
savestate_state = 0;
savestate_file = 0;
if (chunk)
......@@ -617,6 +661,8 @@ static void save_rams (struct zfile *f, int comp)
save_chunk (f, dst, len, "ZRAM", comp);
dst = save_zram (&len, 1);
save_chunk (f, dst, len, "ZRAM", comp);
dst = save_zram (&len, -1);
save_chunk (f, dst, len, "ZCRM", comp);
dst = save_bootrom (&len);
save_chunk (f, dst, len, "BORO", comp);
#endif
......@@ -641,11 +687,11 @@ int save_state (const TCHAR *filename, const TCHAR *description)
int comp = savestate_docompress;
if (!savestate_specialdump && !savestate_nodialogs) {
/* state_incompatible_warn ();
state_incompatible_warn ();
if (!save_filesys_cando ()) {
gui_message ("Filesystem active. Try again later");
return -1;
}*/
}
}
savestate_nodialogs = 0;
custom_prepare_savestate ();
......@@ -654,20 +700,20 @@ int save_state (const TCHAR *filename, const TCHAR *description)
return 0;
if (savestate_specialdump) {
size_t pos;
/* if (savestate_specialdump == 2)
write_wavheader (f, 0, 22050);*/
pos = zfile_ftell(f);
if (savestate_specialdump == 2)
write_wavheader (f, 0, 22050);
pos = zfile_ftell (f);
save_rams (f, -1);
if (savestate_specialdump == 2) {
int len, len2, i;
uae_u8 *tmp;
len = zfile_ftell(f) - pos;
len = zfile_ftell (f) - pos;
tmp = xmalloc (uae_u8, len);
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++)
tmp[i] += 0x80;
/* write_wavheader (f, len, 22050);*/
write_wavheader (f, len, 22050);
zfile_fwrite (tmp, len2, 1, f);
xfree (tmp);
}
......@@ -687,13 +733,17 @@ int save_state (const TCHAR *filename, const TCHAR *description)
save_chunk (f, dst, len, "CPU ", 0);
xfree (dst);
dst = save_cpu_extra (&len, 0);
save_chunk (f, dst, len, "CPUX", 0);
xfree (dst);
#ifdef FPUEMU
dst = save_fpu (&len,0 );
save_chunk (f, dst, len, "FPU ", 0);
xfree (dst);
#endif
#ifdef MMUEMU
#ifdef MMU
dst = save_mmu (&len, 0);
save_chunk (f, dst, len, "MMU ", 0);
xfree (dst);
......@@ -720,6 +770,14 @@ int save_state (const TCHAR *filename, const TCHAR *description)
save_chunk (f, dst, len, "CHIP", 0);
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);
save_chunk (f, dst, len, "AGAC", 0);
xfree (dst);
......@@ -934,6 +992,7 @@ void savestate_rewind (void)
p2 = st->end;
write_log ("rewinding from %d\n", replaycounter);
p = restore_cpu (p);
p = restore_cpu_extra (p);
#ifdef FPUEMU
if (restore_u32_func (&p))
p = restore_fpu (p);
......@@ -943,6 +1002,7 @@ void savestate_rewind (void)
}
p = restore_floppy (p);
p = restore_custom (p);
p = restore_custom_extra (p);
p = restore_blitter (p);
p = restore_custom_agacolors (p);
for (i = 0; i < 8; i++) {
......@@ -1030,6 +1090,11 @@ retry2:
save_cpu (&len, p);
tlen += len;
p += len;
if (bufcheck (&p, 0))
goto retry;
save_cpu_extra (&len, p);
tlen += len;
p += len;
#ifdef FPUEMU
if (bufcheck (&p, 0))
goto retry;
......@@ -1059,6 +1124,11 @@ retry2:
save_custom (&len, p, 0);
tlen += len;
p += len;
if (bufcheck (&p, 0))
goto retry;
save_custom_extra (&len, p);
tlen += len;
p += len;
if (bufcheck (&p, 0))
goto retry;
save_blitter (&len, p);
......
......@@ -445,7 +445,7 @@ configure:4344: $? = 0
configure:4344: result: yes
configure:4350: checking for _doprnt
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'
collect2: ld returned 1 exit status
configure:4350: $? = 1
......@@ -533,7 +533,7 @@ configure:4364: $? = 0
configure:4364: result: yes
configure:4364: checking for strcmpi
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'
collect2: ld returned 1 exit status
configure:4364: $? = 1
......@@ -613,7 +613,7 @@ configure: failed program was:
configure:4364: result: no
configure:4364: checking for stricmp
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'
collect2: ld returned 1 exit status
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