#include "crc32.h"
#include "uae.h"
#include "custom.h"
+#include "newcpu.h"
#define AKIKO_DEBUG_NVRAM 0
#define AKIKO_DEBUG_IO 0
#define AKIKO_DEBUG_IO_CMD 0
-
static void irq(void)
{
if (!(intreq & 8)) {
}
}
-static int m68k_getpc(void) { return 0; }
-
/*
* CD32 1Kb NVRAM (EEPROM) emulation
*
if (scl_out && !oscl) {
if (bitcounter == 8) {
#if AKIKO_DEBUG_NVRAM
- write_log ("RB %02.2X ", nvram_byte, m68k_getpc());
+ write_log ("RB %02.2X ", nvram_byte, M68K_GETPC);
#endif
sda_in = 0; /* ACK */
if (direction > 0) {
bitcounter++;
if (bitcounter == 8) {
#if AKIKO_DEBUG_NVRAM
- write_log ("NVRAM sent byte %02.2X address %04.4X PC=%08.8X\n", cd32_nvram[nvram_address], nvram_address, m68k_getpc());
+ write_log ("NVRAM sent byte %02.2X address %04.4X PC=%08.8X\n", cd32_nvram[nvram_address], nvram_address, M68K_GETPC);
#endif
nvram_address++;
nvram_address &= NVRAM_SIZE - 1;
}
bitcounter = 0;
#if AKIKO_DEBUG_NVRAM
- write_log ("I2C_DEVICEADDR: rw %d, address %02.2Xxx PC=%08.8X\n", nvram_rw, nvram_address >> 8, m68k_getpc());
+ write_log ("I2C_DEVICEADDR: rw %d, address %02.2Xxx PC=%08.8X\n", nvram_rw, nvram_address >> 8, M68K_GETPC);
#endif
break;
case I2C_WORDADDR:
nvram_address &= 0x300;
nvram_address |= nvram_byte;
#if AKIKO_DEBUG_NVRAM
- write_log ("I2C_WORDADDR: address %04.4X PC=%08.8X\n", nvram_address, m68k_getpc());
+ write_log ("I2C_WORDADDR: address %04.4X PC=%08.8X\n", nvram_address, M68K_GETPC);
#endif
if (direction < 0) {
memcpy (nvram_writetmp, cd32_nvram + (nvram_address & ~(NVRAM_PAGE_SIZE - 1)), NVRAM_PAGE_SIZE);
akiko_internal ();
uae_sem_post (&akiko_sem);
if (msg && addr < 0x30 && AKIKO_DEBUG_IO)
- write_log ("akiko_bget %08.8X: %08.8X %02.2X\n", m68k_getpc(), addr, v & 0xff);
+ write_log ("akiko_bget %08.8X: %08.8X %02.2X\n", M68K_GETPC, addr, v & 0xff);
return v;
}
v = akiko_bget2 (addr + 1, 0);
v |= akiko_bget2 (addr + 0, 0) << 8;
if (addr < 0x30 && AKIKO_DEBUG_IO)
- write_log ("akiko_wget %08.8X: %08.8X %04.4X\n", m68k_getpc(), addr, v & 0xffff);
+ write_log ("akiko_wget %08.8X: %08.8X %04.4X\n", M68K_GETPC, addr, v & 0xffff);
return v;
}
v |= akiko_bget2 (addr + 1, 0) << 16;
v |= akiko_bget2 (addr + 0, 0) << 24;
if (addr < 0x30 && (addr != 4 && addr != 8) && AKIKO_DEBUG_IO)
- write_log ("akiko_lget %08.8X: %08.8X %08.8X\n", m68k_getpc(), addr, v);
+ write_log ("akiko_lget %08.8X: %08.8X %08.8X\n", M68K_GETPC, addr, v);
return v;
}
+static void write_readmask(uae_u16 v)
+{
+ int i, cnt;
+
+ cnt = 0;
+ for (i = 0; i < 16; i++) {
+ if (v & (1 << i))
+ cnt++;
+ }
+ cdrom_readmask_w |= v;
+ cdrom_readmask_r = 0;
+}
+
+
static void akiko_bput2 (uaecptr addr, uae_u32 v, int msg)
{
uae_u32 tmp;
addr &= 0xffff;
v &= 0xff;
if(msg && addr < 0x30 && AKIKO_DEBUG_IO)
- write_log ("akiko_bput %08.8X: %08.8X=%02.2X\n", m68k_getpc(), addr, v & 0xff);
+ write_log ("akiko_bput %08.8X: %08.8X=%02.2X\n", M68K_GETPC, addr, v & 0xff);
uae_sem_wait (&akiko_sem);
switch (addr)
{
cdrom_result_last_pos = v;
break;
case 0x20:
- cdrom_readmask_w |= (v << 8);
- cdrom_readmask_r &= 0x00ff;
+ write_readmask(v <<8);
break;
case 0x21:
- cdrom_readmask_w |= (v << 0);
- cdrom_readmask_r &= 0xff00;
+ write_readmask(v);
break;
case 0x24:
case 0x25:
#endif
addr &= 0xfff;
if((addr < 0x30 && AKIKO_DEBUG_IO))
- write_log("akiko_wput %08.8X: %08.8X=%04.4X\n", m68k_getpc(), addr, v & 0xffff);
+ write_log("akiko_wput %08.8X: %08.8X=%04.4X\n", M68K_GETPC, addr, v & 0xffff);
akiko_bput2 (addr + 1, v & 0xff, 0);
akiko_bput2 (addr + 0, v >> 8, 0);
}
#endif
addr &= 0xffff;
if(addr < 0x30 && AKIKO_DEBUG_IO)
- write_log("akiko_lput %08.8X: %08.8X=%08.8X\n", m68k_getpc(), addr, v);
+ write_log("akiko_lput %08.8X: %08.8X=%08.8X\n", M68K_GETPC, addr, v);
akiko_bput2 (addr + 3, (v >> 0) & 0xff, 0);
akiko_bput2 (addr + 2, (v >> 8) & 0xff, 0);
akiko_bput2 (addr + 1, (v >> 16) & 0xff, 0);
set_special (®s, SPCFLAG_ACTION_REPLAY);
copyfromamiga (artemp, regs.vbr + 0x7c, 4);
copytoamiga (regs.vbr+0x7c, armemory_rom + 0x7c, 4);
- Interrupt (7);
+ NMI ();
}
static void action_replay_go1 (int irq)
hide_cart (0);
action_replay_flag = ACTION_REPLAY_ACTIVE;
memcpy (armemory_ram + 0xf000, ar_custom, 2 * 256);
- Interrupt (7);
+ NMI ();
}
typedef struct {
if (v) {
old = get_long((uaecptr)(regs.vbr + 0x7c));
put_long ((uaecptr)(regs.vbr + 0x7c), v);
- Interrupt (7);
+ NMI ();
put_long ((uaecptr)(regs.vbr + 0x7c), old);
}
} else {
old = get_long((uaecptr)(regs.vbr + 0x7c));
put_long ((uaecptr)(regs.vbr + 0x7c), hrtmem_start + 12 + 2 + get_word (hrtmem_start + 14));
- Interrupt (7);
+ NMI ();
//put_long ((uaecptr)(regs.vbr + 0x7c), old);
}
}
if (t == 0)
return (time_t) 0;
- year = ((int) (t >> 16 + 9) & 0x7f) + 1980;
- month = (int) (t >> 16 + 5) & 0x0f; /* 1..12 means Jan..Dec */
+ year = ((int) ((t >> 16) + 9) & 0x7f) + 1980;
+ month = (int) ((t >> 16) + 5) & 0x0f; /* 1..12 means Jan..Dec */
day = (int) (t >> 16) & 0x1f; /* 1..31 means 1st,...31st */
hour = ((int) t >> 11) & 0x1f;
#ifdef _WIN32
+static int initialized;
+
#include "od-win32/win32.h"
extern struct device_functions devicefunc_win32_aspi;
device_func[DF_IOCTL]->closedev (unitnum);
}
+void device_func_reset (void)
+{
+ initialized = 0;
+ have_ioctl = 0;
+}
+
int device_func_init (int flags)
{
- static int initialized;
int support_scsi = 0, support_ioctl = 0;
int oflags = (flags & DEVICE_TYPE_SCSI) ? 0 : (1 << INQ_ROMD);
"sound_pri_cutoff", "sound_pri_time", "sound_min_buff",
"gfx_test_speed", "gfxlib_replacement", "enforcer", "catweasel_io",
"kickstart_key_file", "fast_copper", "sound_adjust",
+ "serial_hardware_dtrdsr",
0
};
return 0;
}
+uae_u8 *restore_configuration (uae_u8 *src)
+{
+ write_log(src);
+ src += strlen(src) + 1;
+ return src;
+}
+
+uae_u8 *save_configuration(int *len)
+{
+ int tmpsize = 30000;
+ uae_u8 *dstbak, *dst;
+ char *p;
+ int index = -1;
+
+ dstbak = dst = (uae_u8*)malloc (tmpsize);
+ p = dst;
+ for (;;) {
+ char tmpout[256];
+ int ret;
+ tmpout[0] = 0;
+ ret = cfgfile_modify (index, "*", 1, tmpout, sizeof (tmpout));
+ index++;
+ if (strlen(tmpout) > 0) {
+ if (!memcmp(tmpout, "input.", 6))
+ continue;
+ strcpy (p, tmpout);
+ strcat (p, "\n");
+ p += strlen(p);
+ if (p - dstbak >= tmpsize - sizeof(tmpout))
+ break;
+ }
+ if (ret >= 0)
+ break;
+ }
+ *len = p - dstbak + 1;
+ return dstbak;
+}
+
+
static int configure_rom (struct uae_prefs *p, int *rom, int msg)
{
struct romdata *rd;
}
LENDFUNC(READ,WRITE,2,raw_setcc_m,(MEMW d, IMM cc))
+LOWFUNC(READ,NONE,3,raw_cmov_b_rr,(RW1 d, R1 s, IMM cc))
+{
+ /* replacement using branch and mov */
+ int uncc=(cc^1);
+ emit_byte(0x70+uncc);
+ emit_byte(3); /* skip next 2 bytes if not cc=true */
+ emit_byte(0x88);
+ emit_byte(0xc0+8*s+d);
+}
+LENDFUNC(READ,NONE,3,raw_cmov_b_rr,(RW1 d, R1 s, IMM cc))
+
+LOWFUNC(READ,NONE,3,raw_cmov_w_rr,(RW2 d, R2 s, IMM cc))
+{
+ if (have_cmov) {
+ emit_byte(0x66);
+ emit_byte(0x0f);
+ emit_byte(0x40+cc);
+ emit_byte(0xc0+8*d+s);
+ }
+ else { /* replacement using branch and mov */
+ int uncc=(cc^1);
+ emit_byte(0x70+uncc);
+ emit_byte(3); /* skip next 3 bytes if not cc=true */
+ emit_byte(0x66);
+ emit_byte(0x89);
+ emit_byte(0xc0+8*s+d);
+ }
+}
+LENDFUNC(READ,NONE,3,raw_cmov_w_rr,(RW2 d, R2 s, IMM cc))
+
LOWFUNC(READ,NONE,3,raw_cmov_l_rr,(RW4 d, R4 s, IMM cc))
{
if (have_cmov) {
alloc_cache();
changed = 1;
}
+ if (!candirect)
+ canbang = 0;
// Turn off illegal-mem logging when using JIT...
if(currprefs.cachesize)
currprefs.comptrustbyte != 1)
{
// Set all of these to indirect when canbang == 0
- // Basically, set the compforcesettings option...
+ // Basically, set the compforcesettings option...
currprefs.comptrustbyte = 1;
currprefs.comptrustword = 1;
currprefs.comptrustlong = 1;
}
MENDFUNC(2,setcc_m,(IMM d, IMM cc))
+MIDFUNC(3,cmov_b_rr,(RW1 d, R1 s, IMM cc))
+{
+ if (d==s)
+ return;
+ CLOBBER_CMOV;
+ s=readreg(s,1);
+ d=rmw(d,1,1);
+ raw_cmov_b_rr(d,s,cc);
+ unlock(s);
+ unlock(d);
+}
+MENDFUNC(3,cmov_b_rr,(RW1 d, R1 s, IMM cc))
+
+MIDFUNC(3,cmov_w_rr,(RW2 d, R2 s, IMM cc))
+{
+ if (d==s)
+ return;
+ CLOBBER_CMOV;
+ s=readreg(s,2);
+ d=rmw(d,2,2);
+ raw_cmov_w_rr(d,s,cc);
+ unlock(s);
+ unlock(d);
+}
+MENDFUNC(3,cmov_w_rr,(RW2 d, R2 s, IMM cc))
+
MIDFUNC(3,cmov_l_rr,(RW4 d, R4 s, IMM cc))
{
if (d==s)
hpos_previous = hpos;
}
- if ((v & 4) && !interlace_seen)
+ if (((v & 4) && !interlace_seen) || (!(v & 4) && interlace_seen))
interlace_started = 2;
ddf_change = vpos;
events_schedule ();
}
-void customreset (void)
+void customreset (int hardreset)
{
int i;
int zero = 0;
write_log ("Reset at %08.8X\n", m68k_getpc(®s));
memory_map_dump();
+
hsync_counter = 0;
vsync_counter = 0;
ciavsync_counter = 0;
CLXCON (0);
}
+ gayle_reset (hardreset);
#ifdef AUTOCONFIG
expamem_reset ();
#endif
#ifdef NCR
ncr_reset ();
#endif
+#ifdef FILESYS
+ filesys_free_handles();
+#endif
#ifdef JIT
compemu_reset ();
#endif
#if defined(ENFORCER)
enforcer_disable();
#endif
+
+ if (hardreset)
+ rtc_hardreset();
}
void dumpcustom (void)
static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const char *fname);
+static void reset_drive_gui(int i)
+{
+ gui_data.drive_disabled[i] = 0;
+ gui_data.df[i][0] = 0;
+ gui_data.crc32[i] = 0;
+ if (currprefs.dfxtype[i] < 0)
+ gui_data.drive_disabled[i] = 1;
+}
+
static void reset_drive(int i)
{
drive *drv = &floppy[i];
drive_image_free (drv);
drv->motoroff = 1;
disabled &= ~(1 << i);
- gui_data.drive_disabled[i] = 0;
- gui_data.df[i][0] = 0;
- gui_data.crc32[i] = 0;
- if (currprefs.dfxtype[i] < 0) {
+ if (currprefs.dfxtype[i] < 0)
disabled |= 1 << i;
- gui_data.drive_disabled[i] = 1;
- }
+ reset_drive_gui(i);
/* most internal Amiga floppy drives won't enable
* diskready until motor is running at full speed
* and next indexsync has been passed
}
changed_prefs.dfxtype[num] = dfxtype;
}
+ drv->indexhackmode = 0;
+ if (num == 0 && currprefs.dfxtype[num] == 0)
+ drv->indexhackmode = 1;
+ drv->buffered_cyl = -1;
+ drv->buffered_side = -1;
drv->cyl = restore_u8 ();
drv->dskready = restore_u8 ();
drv->drive_id_scnt = restore_u8 ();
strncpy(changed_prefs.df[num],src,255);
newis = changed_prefs.df[num][0] ? 1 : 0;
src+=strlen(src)+1;
- drive_insert (floppy + num, &currprefs, num, changed_prefs.df[num]);
- if (drive_empty (floppy + num)) {
- if (newis && old[0]) {
- strcpy (changed_prefs.df[num], old);
+ if (!(disabled & (1 << num))) {
+ if (!newis) {
+ drv->dskchange = 1;
+ } else {
drive_insert (floppy + num, &currprefs, num, changed_prefs.df[num]);
- if (drive_empty (floppy + num))
- drv->dskchange = 1;
- }
+ if (drive_empty (floppy + num)) {
+ if (newis && old[0]) {
+ strcpy (changed_prefs.df[num], old);
+ drive_insert (floppy + num, &currprefs, num, changed_prefs.df[num]);
+ if (drive_empty (floppy + num))
+ drv->dskchange = 1;
+ }
+ }
+ }
}
+ reset_drive_gui(num);
return src;
}
else
dstbak = dst = (uae_u8*)malloc (2+1+1+1+1+4+4+256);
save_u32 (drv->drive_id); /* drive type ID */
- save_u8 ((drv->motoroff ? 0:1) | ((disabled & (1 << num)) ? 2 : 0) | (drv->idbit ? 4 : 0));
+ save_u8 ((drv->motoroff ? 0:1) | ((disabled & (1 << num)) ? 2 : 0) | (drv->idbit ? 4 : 0) | (drv->dskchange ? 8 : 0));
save_u8 (drv->cyl); /* cylinder */
save_u8 (drv->dskready); /* dskready */
save_u8 (drv->drive_id_scnt); /* id mode position */
/* @@@ interlace_seen used to be (bplcon0 & 4), but this is probably
* better. */
if (prev_x_adjust != visible_left_border || prev_y_adjust != thisframe_y_adjust)
- frame_redraw_necessary |= interlace_seen && currprefs.gfx_linedbl ? 2 : 1;
+ frame_redraw_necessary |= (interlace_seen && currprefs.gfx_linedbl) ? 2 : 1;
max_diwstop = 0;
min_diwstart = 10000;
quit_program = -quit_program;
set_inhibit_frame (IHF_QUIT_PROGRAM);
set_special (®s, SPCFLAG_BRK);
-#ifdef FILESYS
- filesys_prepare_reset ();
-#endif
return;
}
void filesys_cleanup (void)
{
+ filesys_free_handles();
free_mountinfo ();
}
+void filesys_free_handles(void)
+{
+ Unit *u, *u1;
+ for (u = units; u; u = u1) {
+ Key *k1, *knext;
+ u1 = u->next;
+ for (k1 = u->keys; k1; k1 = knext) {
+ knext = k1->next;
+ if (k1->fd)
+ fs_close (u, k1->fd);
+ xfree(k1);
+ }
+ u->keys = NULL;
+ }
+}
+
void filesys_reset (void)
{
Unit *u, *u1;
if (savestate_state == STATE_RESTORE)
return;
+ filesys_free_handles();
for (u = units; u; u = u1) {
u1 = u->next;
xfree (u);
}
}
#endif
+ filesys_free_handles();
u = units;
while (u != 0) {
free_all_ainos (u, &u->rootnode);
put_long (parmpacket + 44, 0); /* unused */
put_long (parmpacket + 48, 0); /* interleave */
put_long (parmpacket + 52, 0); /* lowCyl */
- put_long (parmpacket + 56, uip[unit_no].hf.nrcyls - 1); /* hiCyl */
+ put_long (parmpacket + 56, uip[unit_no].hf.nrcyls <= 0 ? 0 : uip[unit_no].hf.nrcyls - 1); /* hiCyl */
put_long (parmpacket + 60, 50); /* Number of buffers */
put_long (parmpacket + 64, 0); /* Buffer mem type */
put_long (parmpacket + 68, 0x7FFFFFFF); /* largest transfer */
break;
case i_ASR:
- mayfail;
+ mayfail;
if (curi->smode==Dreg) {
- comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n"
- " FAIL(1);\n"
- " return 0;\n"
- "} \n");
- start_brace();
+ comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n"
+ " FAIL(1);\n"
+ " return 0;\n"
+ "} \n");
+ start_brace();
}
comprintf("\tdont_care_flags();\n");
comprintf("\tint highmask;\n"
"\tint width;\n"
"\tint cdata=scratchie++;\n"
- "\tint tmpcnt=scratchie++;\n"
- "\tint highshift=scratchie++;\n");
- comprintf("\tmov_l_rr(tmpcnt,cnt);\n"
- "\tand_l_ri(tmpcnt,63);\n"
- "\tmov_l_ri(cdata,0);\n"
- "\tcmov_l_rr(cdata,data,5);\n");
- /* cdata is now either data (for shift count!=0) or
- 0 (for shift count==0) */
- switch(curi->size) {
- case sz_byte: comprintf("\tshra_b_rr(data,cnt);\n"
- "\thighmask=0x38;\n"
- "\twidth=8;\n");
- break;
- case sz_word: comprintf("\tshra_w_rr(data,cnt);\n"
- "\thighmask=0x30;\n"
- "\twidth=16;\n");
- break;
- case sz_long: comprintf("\tshra_l_rr(data,cnt);\n"
- "\thighmask=0x20;\n"
- "\twidth=32;\n");
- break;
- default: abort();
+ "\tint sdata=scratchie++;\n"
+ "\tint tmpcnt=scratchie++;\n");
+ comprintf("\tmov_l_rr(sdata,data);\n"
+ "\tmov_l_rr(cdata,data);\n"
+ "\tmov_l_rr(tmpcnt,cnt);\n");
+ switch (curi->size) {
+ case sz_byte: comprintf("\tshra_b_ri(sdata,7);\n"); break;
+ case sz_word: comprintf("\tshra_w_ri(sdata,15);\n"); break;
+ case sz_long: comprintf("\tshra_l_ri(sdata,31);\n"); break;
+ default: abort();
}
- comprintf("test_l_ri(cnt,highmask);\n"
- "mov_l_ri(highshift,0);\n"
- "mov_l_ri(scratchie,width/2);\n"
- "cmov_l_rr(highshift,scratchie,5);\n");
- /* The x86 masks out bits, so we now make sure that things
- really get shifted as much as planned */
+ /* sdata is now the MSB propagated to all bits for the
+ register of specified size */
+ comprintf("\tand_l_ri(tmpcnt,63);\n");
switch(curi->size) {
- case sz_byte: comprintf("\tshra_b_rr(data,highshift);\n");break;
- case sz_word: comprintf("\tshra_w_rr(data,highshift);\n");break;
- case sz_long: comprintf("\tshra_l_rr(data,highshift);\n");break;
- default: abort();
+ case sz_byte: comprintf("\tshra_b_rr(data,tmpcnt);\n"
+ "\thighmask=0x38;\n");
+ break;
+ case sz_word: comprintf("\tshra_w_rr(data,tmpcnt);\n"
+ "\thighmask=0x30;\n");
+ break;
+ case sz_long: comprintf("\tshra_l_rr(data,tmpcnt);\n"
+ "\thighmask=0x20;\n");
+ break;
}
- /* And again */
- switch(curi->size) {
- case sz_byte: comprintf("\tshra_b_rr(data,highshift);\n");break;
- case sz_word: comprintf("\tshra_w_rr(data,highshift);\n");break;
- case sz_long: comprintf("\tshra_l_rr(data,highshift);\n");break;
- default: abort();
+ comprintf("\ttest_l_ri(tmpcnt,highmask);\n");
+ switch (curi->size) {
+ case sz_byte: comprintf("\tcmov_b_rr(data,sdata,NATIVE_CC_NE);\n"); break;
+ case sz_word: comprintf("\tcmov_w_rr(data,sdata,NATIVE_CC_NE);\n"); break;
+ case sz_long: comprintf("\tcmov_l_rr(data,sdata,NATIVE_CC_NE);\n"); break;
}
-
+
/* Result of shift is now in data. Now we need to determine
the carry by shifting cdata one less */
+ /* NOTE: carry bit is cleared if shift count is zero */
+ comprintf("\tmov_l_ri(scratchie,0);\n"
+ "\ttest_l_rr(tmpcnt,tmpcnt);\n"
+ "\tcmov_l_rr(sdata,scratchie,NATIVE_CC_EQ);\n"
+ "\tforget_about(scratchie);\n");
comprintf("\tsub_l_ri(tmpcnt,1);\n");
switch(curi->size) {
case sz_byte: comprintf("\tshra_b_rr(cdata,tmpcnt);\n");break;
default: abort();
}
/* If the shift count was higher than the width, we need
- to pick up the sign from data */
- comprintf("test_l_ri(tmpcnt,highmask);\n"
- "cmov_l_rr(cdata,data,5);\n");
- /* And create the flags */
+ to pick up the sign from original data (sdata) */
+ /* NOTE: for shift count of zero, the following holds
+ true and cdata contains 0 so that carry bit is cleared */
+ comprintf("\ttest_l_ri(tmpcnt,highmask);\n"
+ "\tforget_about(tmpcnt);\n"
+ "\tcmov_l_rr(cdata,sdata,NATIVE_CC_NE);\n");
+
+ /* And create the flags (preserve X flag if shift count is zero) */
+ comprintf("\ttest_l_ri(cnt,63);\n"
+ "\tcmov_l_rr(FLAGX,cdata,NATIVE_CC_NE);\n");
comprintf("\tstart_needflags();\n");
comprintf("\tif (needed_flags & FLAG_ZNV)\n");
switch(curi->size) {
comprintf("\t bt_l_ri(cdata,0);\n"); /* Set C */
comprintf("\t live_flags();\n");
comprintf("\t end_needflags();\n");
- comprintf("\t duplicate_carry();\n");
comprintf("if (!(needed_flags & FLAG_CZNV)) dont_care_flags();\n");
genastore ("data", curi->dmode, "dstreg", curi->size, "data");
}
switch(curi->size) {
case sz_byte: comprintf("\tshra_b_rr(data,cnt);\n"
"\thighmask=0x38;\n"
- "\twidth=8;\n");
+ "\twidth=8;\n");
break;
case sz_word: comprintf("\tshra_w_rr(data,cnt);\n"
"\thighmask=0x30;\n"
- "\twidth=16;\n");
+ "\twidth=16;\n");
break;
case sz_long: comprintf("\tshra_l_rr(data,cnt);\n"
"\thighmask=0x20;\n"
- "\twidth=32;\n");
+ "\twidth=32;\n");
break;
default: abort();
}
break;
case i_LSR:
- mayfail;
+ mayfail;
if (curi->smode==Dreg) {
- comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n"
- " FAIL(1);\n"
- " return 0;\n"
- "} \n");
- start_brace();
+ comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n"
+ " FAIL(1);\n"
+ " return 0;\n"
+ "} \n");
+ start_brace();
}
comprintf("\tdont_care_flags();\n");
comprintf("\tmov_l_rr(tmpcnt,cnt);\n"
"\tand_l_ri(tmpcnt,63);\n"
"\tmov_l_ri(cdata,0);\n"
- "\tcmov_l_rr(cdata,data,5);\n");
+ "\tcmov_l_rr(cdata,data,NATIVE_CC_NE);\n");
/* cdata is now either data (for shift count!=0) or
0 (for shift count==0) */
switch(curi->size) {
- case sz_byte: comprintf("\tshrl_b_rr(data,cnt);\n"
- "\thighmask=0x38;\n");
+ case sz_byte: comprintf("\tshrl_b_rr(data,tmpcnt);\n"
+ "\thighmask=0x38;\n");
break;
- case sz_word: comprintf("\tshrl_w_rr(data,cnt);\n"
- "\thighmask=0x30;\n");
+ case sz_word: comprintf("\tshrl_w_rr(data,tmpcnt);\n"
+ "\thighmask=0x30;\n");
break;
- case sz_long: comprintf("\tshrl_l_rr(data,cnt);\n"
- "\thighmask=0x20;\n");
+ case sz_long: comprintf("\tshrl_l_rr(data,tmpcnt);\n"
+ "\thighmask=0x20;\n");
break;
default: abort();
}
- comprintf("test_l_ri(cnt,highmask);\n"
- "mov_l_ri(scratchie,0);\n"
- "cmov_l_rr(scratchie,data,4);\n");
- switch(curi->size) {
- case sz_byte: comprintf("\tmov_b_rr(data,scratchie);\n");break;
- case sz_word: comprintf("\tmov_w_rr(data,scratchie);\n");break;
- case sz_long: comprintf("\tmov_l_rr(data,scratchie);\n");break;
- default: abort();
+ comprintf("\ttest_l_ri(tmpcnt,highmask);\n"
+ "\rmov_l_ri(scratchie,0);\n");
+ if (curi->size == sz_long)
+ comprintf("\tcmov_l_rr(data,scratchie,NATIVE_CC_NE);\n");
+ else {
+ comprintf("\tcmov_l_rr(scratchie,data,NATIVE_CC_EQ);\n");
+ switch(curi->size) {
+ case sz_byte: comprintf("\tmov_b_rr(data,scratchie);\n");break;
+ case sz_word: comprintf("\tmov_w_rr(data,scratchie);\n");break;
+ default: abort();
+ }
}
/* Result of shift is now in data. Now we need to determine
the carry by shifting cdata one less */
comprintf("\tsub_l_ri(tmpcnt,1);\n");
- switch(curi->size) {
- case sz_byte: comprintf("\tshrl_b_rr(cdata,tmpcnt);\n");break;
- case sz_word: comprintf("\tshrl_w_rr(cdata,tmpcnt);\n");break;
- case sz_long: comprintf("\tshrl_l_rr(cdata,tmpcnt);\n");break;
- default: abort();
- }
- comprintf("test_l_ri(tmpcnt,highmask);\n"
- "mov_l_ri(scratchie,0);\n"
- "cmov_l_rr(cdata,scratchie,5);\n");
- /* And create the flags */
+ comprintf("\tshrl_l_rr(cdata,tmpcnt);\n");
+ comprintf("\ttest_l_ri(tmpcnt,highmask);\n");
+ comprintf("\tforget_about(tmpcnt);\n");
+ if (curi->size != sz_long) /* scratchie is still live for LSR.L */
+ comprintf("\tmov_l_ri(scratchie,0);\n");
+ comprintf("\tcmov_l_rr(cdata,scratchie,NATIVE_CC_NE);\n");
+ comprintf("\tforget_about(scratchie);\n");
+ /* And create the flags (preserve X flag if shift count is zero) */
+ comprintf("\ttest_l_ri(cnt,63);\n"
+ "\tcmov_l_rr(FLAGX,cdata,NATIVE_CC_NE);\n");
comprintf("\tstart_needflags();\n");
comprintf("\tif (needed_flags & FLAG_ZNV)\n");
switch(curi->size) {
comprintf("\t bt_l_ri(cdata,0);\n"); /* Set C */
comprintf("\t live_flags();\n");
comprintf("\t end_needflags();\n");
- comprintf("\t duplicate_carry();\n");
comprintf("if (!(needed_flags & FLAG_CZNV)) dont_care_flags();\n");
genastore ("data", curi->dmode, "dstreg", curi->size, "data");
}
comprintf("\tint highmask;\n");
switch(curi->size) {
case sz_byte: comprintf("\tshrl_b_rr(data,cnt);\n"
- "\thighmask=0x38;\n");
+ "\thighmask=0x38;\n");
break;
case sz_word: comprintf("\tshrl_w_rr(data,cnt);\n"
- "\thighmask=0x30;\n");
+ "\thighmask=0x30;\n");
break;
case sz_long: comprintf("\tshrl_l_rr(data,cnt);\n"
- "\thighmask=0x20;\n");
+ "\thighmask=0x20;\n");
break;
default: abort();
}
break;
case i_LSL:
+ mayfail;
+ if (curi->smode==Dreg) {
+ comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n"
+ " FAIL(1);\n"
+ " return 0;\n"
+ "} \n");
+ start_brace();
+ }
comprintf("\tdont_care_flags();\n");
genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
comprintf("\tmov_l_rr(tmpcnt,cnt);\n"
"\tand_l_ri(tmpcnt,63);\n"
"\tmov_l_ri(cdata,0);\n"
- "\tcmov_l_rr(cdata,data,5);\n");
+ "\tcmov_l_rr(cdata,data,NATIVE_CC_NE);\n");
/* cdata is now either data (for shift count!=0) or
0 (for shift count==0) */
switch(curi->size) {
- case sz_byte: comprintf("\tshll_b_rr(data,cnt);\n"
- "\thighmask=0x38;\n");
+ case sz_byte: comprintf("\tshll_b_rr(data,tmpcnt);\n"
+ "\thighmask=0x38;\n");
break;
- case sz_word: comprintf("\tshll_w_rr(data,cnt);\n"
- "\thighmask=0x30;\n");
+ case sz_word: comprintf("\tshll_w_rr(data,tmpcnt);\n"
+ "\thighmask=0x30;\n");
break;
- case sz_long: comprintf("\tshll_l_rr(data,cnt);\n"
- "\thighmask=0x20;\n");
+ case sz_long: comprintf("\tshll_l_rr(data,tmpcnt);\n"
+ "\thighmask=0x20;\n");
break;
default: abort();
}
- comprintf("test_l_ri(cnt,highmask);\n"
- "mov_l_ri(scratchie,0);\n"
- "cmov_l_rr(scratchie,data,4);\n");
- switch(curi->size) {
- case sz_byte: comprintf("\tmov_b_rr(data,scratchie);\n");break;
- case sz_word: comprintf("\tmov_w_rr(data,scratchie);\n");break;
- case sz_long: comprintf("\tmov_l_rr(data,scratchie);\n");break;
- default: abort();
+ comprintf("\ttest_l_ri(tmpcnt,highmask);\n"
+ "\tmov_l_ri(scratchie,0);\n");
+ if (curi->size == sz_long)
+ comprintf("\tcmov_l_rr(data,scratchie,NATIVE_CC_NE);\n");
+ else {
+ comprintf("\tcmov_l_rr(scratchie,data,NATIVE_CC_EQ);\n");
+ switch(curi->size) {
+ case sz_byte: comprintf("\tmov_b_rr(data,scratchie);\n");break;
+ case sz_word: comprintf("\tmov_w_rr(data,scratchie);\n");break;
+ default: abort();
+ }
}
/* Result of shift is now in data. Now we need to determine
the carry by shifting cdata one less */
comprintf("\tsub_l_ri(tmpcnt,1);\n");
- switch(curi->size) {
- case sz_byte: comprintf("\tshll_b_rr(cdata,tmpcnt);\n");break;
- case sz_word: comprintf("\tshll_w_rr(cdata,tmpcnt);\n");break;
- case sz_long: comprintf("\tshll_l_rr(cdata,tmpcnt);\n");break;
- default: abort();
+ comprintf("\tshll_l_rr(cdata,tmpcnt);\n");
+ comprintf("\ttest_l_ri(tmpcnt,highmask);\n");
+ comprintf("\tforget_about(tmpcnt);\n");
+ if (curi->size != sz_long) /* scratchie is still live for LSL.L */
+ comprintf("\tmov_l_ri(scratchie,0);\n");
+ comprintf("\tcmov_l_rr(cdata,scratchie,NATIVE_CC_NE);\n");
+ comprintf("\tforget_about(scratchie);\n");
+ /* And create the flags (preserve X flag if shift count is zero) */
+ switch (curi->size) {
+ case sz_byte: comprintf("\tshrl_l_ri(cdata,7);\n"); break;
+ case sz_word: comprintf("\tshrl_l_ri(cdata,15);\n"); break;
+ case sz_long: comprintf("\tshrl_l_ri(cdata,31);\n"); break;
}
- comprintf("test_l_ri(tmpcnt,highmask);\n"
- "mov_l_ri(scratchie,0);\n"
- "cmov_l_rr(cdata,scratchie,5);\n");
- /* And create the flags */
+ comprintf("\ttest_l_ri(cnt,63);\n"
+ "\tcmov_l_rr(FLAGX,cdata,NATIVE_CC_NE);\n");
comprintf("\tstart_needflags();\n");
comprintf("\tif (needed_flags & FLAG_ZNV)\n");
switch(curi->size) {
- case sz_byte: comprintf("\t test_b_rr(data,data);\n");
- comprintf("\t bt_l_ri(cdata,7);\n"); break;
- case sz_word: comprintf("\t test_w_rr(data,data);\n");
- comprintf("\t bt_l_ri(cdata,15);\n"); break;
- case sz_long: comprintf("\t test_l_rr(data,data);\n");
- comprintf("\t bt_l_ri(cdata,31);\n"); break;
+ case sz_byte: comprintf("\t test_b_rr(data,data);\n"); break;
+ case sz_word: comprintf("\t test_w_rr(data,data);\n"); break;
+ case sz_long: comprintf("\t test_l_rr(data,data);\n"); break;
}
+ comprintf("\t bt_l_ri(cdata,0);\n");
comprintf("\t live_flags();\n");
comprintf("\t end_needflags();\n");
- comprintf("\t duplicate_carry();\n");
comprintf("if (!(needed_flags & FLAG_CZNV)) dont_care_flags();\n");
genastore ("data", curi->dmode, "dstreg", curi->size, "data");
}
comprintf("\tint highmask;\n");
switch(curi->size) {
case sz_byte: comprintf("\tshll_b_rr(data,cnt);\n"
- "\thighmask=0x38;\n");
+ "\thighmask=0x38;\n");
break;
case sz_word: comprintf("\tshll_w_rr(data,cnt);\n"
- "\thighmask=0x30;\n");
+ "\thighmask=0x30;\n");
break;
case sz_long: comprintf("\tshll_l_rr(data,cnt);\n"
- "\thighmask=0x20;\n");
+ "\thighmask=0x20;\n");
break;
default: abort();
}
}
break;
+
case i_ROL:
mayfail;
if (curi->smode==Dreg) {
#include "readcpu.h"
#define BOOL_TYPE "int"
+/* Define the minimal 680x0 where NV flags are not affected by xBCD instructions. */
+#define xBCD_KEEPS_NV_FLAGS 4
static FILE *headerfile;
static FILE *stblfile;
/* This would ordinarily be done in gen_nextiword, which we bypass. */
insn_n_cycles += 4;
printf ("\t%sa = get_disp_ea_020(regs, m68k_areg(regs, %s), next_iword(regs));\n", name, reg);
- } else
+ } else {
printf ("\t%sa = get_disp_ea_000(regs, m68k_areg(regs, %s), %s);\n", name, reg, gen_nextiword (flags & GF_NOREFILL));
+ }
if (!(flags & GF_AD8R)) {
addcycles (2);
insn_n_cycles += 2;
typedef enum
{
- flag_logical_noclobber, flag_logical, flag_add, flag_sub, flag_cmp, flag_addx, flag_subx, flag_zn,
+ flag_logical_noclobber, flag_logical, flag_add, flag_sub, flag_cmp, flag_addx, flag_subx, flag_z, flag_zn,
flag_av, flag_sv
}
flagtypes;
switch (type) {
case flag_logical_noclobber:
case flag_logical:
+ case flag_z:
case flag_zn:
case flag_av:
case flag_sv:
case flag_sv:
printf ("\tSET_VFLG (®s->ccrflags, (flgs ^ flgo) & (flgn ^ flgo));\n");
break;
+ case flag_z:
+ printf ("\tSET_ZFLG (®s->ccrflags, GET_ZFLG (&(regs->ccrflags)) & (%s == 0));\n", vstr);
+ break;
case flag_zn:
printf ("\tSET_ZFLG (®s->ccrflags, GET_ZFLG (&(regs->ccrflags)) & (%s == 0));\n", vstr);
printf ("\tSET_NFLG (®s->ccrflags, %s < 0);\n", vstr);
printf ("\tif ((((dst & 0xFF) - (src & 0xFF) - (GET_XFLG (®s->ccrflags) ? 1 : 0)) & 0x100) > 0xFF) { newv -= 0x60; }\n");
printf ("\tSET_CFLG (®s->ccrflags, (((dst & 0xFF) - (src & 0xFF) - bcd - (GET_XFLG (®s->ccrflags) ? 1 : 0)) & 0x300) > 0xFF);\n");
duplicate_carry (0);
- genflags (flag_zn, curi->size, "newv", "", "");
- printf ("\tSET_VFLG (®s->ccrflags, (tmp_newv & 0x80) != 0 && (newv & 0x80) == 0);\n");
+ /* Manual says bits NV are undefined though a real 68040/060 don't change them */
+ if (cpu_level >= xBCD_KEEPS_NV_FLAGS) {
+ if (next_cpu_level < xBCD_KEEPS_NV_FLAGS)
+ next_cpu_level = xBCD_KEEPS_NV_FLAGS - 1;
+ genflags (flag_z, curi->size, "newv", "", "");
+ } else {
+ genflags (flag_zn, curi->size, "newv", "", "");
+ printf ("\tSET_VFLG (®s->ccrflags, (tmp_newv & 0x80) != 0 && (newv & 0x80) == 0);\n");
+ }
addcycles (2);
genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
break;
printf ("\tif (cflg) newv += 0x60;\n");
printf ("\tSET_CFLG (®s->ccrflags, cflg);\n");
duplicate_carry (0);
- genflags (flag_zn, curi->size, "newv", "", "");
- printf ("\tSET_VFLG (®s->ccrflags, (tmp_newv & 0x80) == 0 && (newv & 0x80) != 0);\n");
+ /* Manual says bits NV are undefined though a real 68040 don't change them */
+ if (cpu_level >= xBCD_KEEPS_NV_FLAGS) {
+ if (next_cpu_level < xBCD_KEEPS_NV_FLAGS)
+ next_cpu_level = xBCD_KEEPS_NV_FLAGS - 1;
+ genflags (flag_z, curi->size, "newv", "", "");
+ }
+ else {
+ genflags (flag_zn, curi->size, "newv", "", "");
+ printf ("\tSET_VFLG (®s->ccrflags, (tmp_newv & 0x80) == 0 && (newv & 0x80) != 0);\n");
+ }
addcycles (2);
genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
break;
printf ("\tif (cflg) newv -= 0x60;\n");
printf ("\tSET_CFLG (®s->ccrflags, cflg);\n");
duplicate_carry(0);
- genflags (flag_zn, curi->size, "newv", "", "");
+ /* Manual says bits NV are undefined though a real 68040 don't change them */
+ if (cpu_level >= xBCD_KEEPS_NV_FLAGS) {
+ if (next_cpu_level < xBCD_KEEPS_NV_FLAGS)
+ next_cpu_level = xBCD_KEEPS_NV_FLAGS - 1;
+ genflags (flag_z, curi->size, "newv", "", "");
+ }
+ else {
+ genflags (flag_zn, curi->size, "newv", "", "");
+ }
genastore ("newv", curi->smode, "srcreg", curi->size, "src");
break;
case i_CLR:
}
+static void getchs2 (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec)
+{
+ unsigned int total = (unsigned int)(hfd->size / 1024);
+ int heads;
+ int sectors = 63;
+
+ /* do we have RDB values? */
+ if (hfd->cylinders) {
+ *cyl = hfd->cylinders;
+ *tracksec = hfd->sectors;
+ *head = hfd->heads;
+ *cylsec = hfd->sectors * hfd->heads;
+ return;
+ }
+ /* what about HDF settings? */
+ if (hfd->surfaces && hfd->secspertrack) {
+ *head = hfd->surfaces;
+ *tracksec = hfd->secspertrack;
+ *cylsec = (*head) * (*tracksec);
+ *cyl = (unsigned int)(hfd->size / hfd->blocksize) / ((*tracksec) * (*head));
+ return;
+ }
+ /* no, lets guess something.. */
+ if (total <= 504 * 1024)
+ heads = 16;
+ else if (total <= 1008 * 1024)
+ heads = 32;
+ else if (total <= 2016 * 1024)
+ heads = 64;
+ else if (total <= 4032 * 1024)
+ heads = 128;
+ else
+ heads = 255;
+ *cyl = (unsigned int)(hfd->size / hfd->blocksize) / (sectors * heads);
+ *cylsec = sectors * heads;
+ *tracksec = sectors;
+ *head = heads;
+}
+
+static void getchs (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec)
+{
+ getchs2 (hfd, cyl, cylsec, head, tracksec);
+ hf_log ("CHS: %08.8X-%08.8X %d %d %d %d %d\n",
+ (uae_u32)(hfd->size >> 32),(uae_u32)hfd->size,
+ *cyl, *cylsec, *head, *tracksec);
+}
+
void getchshd (struct hardfiledata *hfd, int *pcyl, int *phead, int *psectorspertrack)
{
unsigned int total = (unsigned int)(hfd->size / 512);
int pc = cmdbuf[2] >> 6;
int pcode = cmdbuf[2] & 0x3f;
int dbd = cmdbuf[1] & 8;
+ int cyl, cylsec, head, tracksec;
+ if (hdhfd) {
+ cyl = hdhfd->cyls;
+ head = hdhfd->heads;
+ tracksec = hdhfd->secspertrack;
+ cylsec = 0;
+ } else {
+ getchs (hfd, &cyl, &cylsec, &head, &tracksec);
+ }
//write_log("MODE SENSE PC=%d CODE=%d DBD=%d\n", pc, pcode, dbd);
p = r;
p[0] = 4 - 1;
p[0] = 3;
p[1] = 24;
p[3] = 1;
- p[10] = hdhfd->secspertrack >> 8;
- p[11] = hdhfd->secspertrack;
+ p[10] = tracksec >> 8;
+ p[11] = tracksec;
p[12] = hfd->blocksize >> 8;
p[13] = hfd->blocksize;
p[15] = 1; // interleave
r[0] += p[1];
} else if (pcode == 4) {
p[0] = 4;
- wl(p + 1, hdhfd->cyls);
+ wl(p + 1, cyl);
p[1] = 24;
- p[5] = hdhfd->heads;
- wl(p + 13, hdhfd->cyls);
+ p[5] = head;
+ wl(p + 13, cyl);
ww(p + 20, 5400);
r[0] += p[1];
} else {
int pmi = cmdbuf[8] & 1;
uae_u32 lba = (cmdbuf[2] << 24) | (cmdbuf[3] << 16) | (cmdbuf[2] << 8) | cmdbuf[3];
uae_u32 blocks = (uae_u32)(hfd->size / hfd->blocksize - 1);
+ int cyl, cylsec, head, tracksec;
+ if (hdhfd) {
+ cyl = hdhfd->cyls;
+ head = hdhfd->heads;
+ tracksec = hdhfd->secspertrack;
+ cylsec = 0;
+ } else {
+ getchs (hfd, &cyl, &cylsec, &head, &tracksec);
+ }
if (pmi) {
- lba += hdhfd->secspertrack * hdhfd->heads;
- lba /= hdhfd->secspertrack * hdhfd->heads;
- lba *= hdhfd->secspertrack * hdhfd->heads;
+ lba += tracksec * head;
+ lba /= tracksec * head;
+ lba *= tracksec * head;
if (lba > blocks)
lba = blocks;
blocks = lba;
return 0; /* Simply ignore this one... */
}
-static void getchs2 (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec)
-{
- unsigned int total = (unsigned int)(hfd->size / 1024);
- int heads;
- int sectors = 63;
-
- /* do we have RDB values? */
- if (hfd->cylinders) {
- *cyl = hfd->cylinders;
- *tracksec = hfd->sectors;
- *head = hfd->heads;
- *cylsec = hfd->sectors * hfd->heads;
- return;
- }
- /* what about HDF settings? */
- if (hfd->surfaces && hfd->secspertrack) {
- *head = hfd->surfaces;
- *tracksec = hfd->secspertrack;
- *cylsec = (*head) * (*tracksec);
- *cyl = (unsigned int)(hfd->size / hfd->blocksize) / ((*tracksec) * (*head));
- return;
- }
- /* no, lets guess something.. */
- if (total <= 504 * 1024)
- heads = 16;
- else if (total <= 1008 * 1024)
- heads = 32;
- else if (total <= 2016 * 1024)
- heads = 64;
- else if (total <= 4032 * 1024)
- heads = 128;
- else
- heads = 255;
- *cyl = (unsigned int)(hfd->size / hfd->blocksize) / (sectors * heads);
- *cylsec = sectors * heads;
- *tracksec = sectors;
- *head = heads;
-}
-
-static void getchs (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec)
-{
- getchs2 (hfd, cyl, cylsec, head, tracksec);
- hf_log ("CHS: %08.8X-%08.8X %d %d %d %d %d\n",
- (uae_u32)(hfd->size >> 32),(uae_u32)hfd->size,
- *cyl, *cylsec, *head, *tracksec);
-}
-
static void outofbounds (int cmd, uae_u64 offset, uae_u64 len, uae_u64 max)
{
write_log ("UAEHF: cmd %d: out of bounds, %08.8X-%08.8X + %08.8X-%08.8X > %08.8X-%08.8X\n", cmd,
extern void filesys_prepare_reset (void);
extern void filesys_start_threads (void);
extern void filesys_flush_cache (void);
+extern void filesys_free_handles (void);
extern void filesys_install (void);
extern void filesys_install_code (void);
extern struct device_functions *device_func[2];
extern int device_func_init(int flags);
+extern void device_func_reset(void);
extern int sys_command_open (int mode, int unitnum);
extern void sys_command_close (int mode, int unitnum);
extern struct device_info *sys_command_info (int mode, int unitnum, struct device_info *di);
+
+#include "flags_x86.h"
+
#ifdef CPU_64_BIT
typedef uae_u64 uintptr;
#else
DECLARE(shra_b_ri(RW1 r, IMM i));
DECLARE(setcc(W1 d, IMM cc));
DECLARE(setcc_m(IMM d, IMM cc));
+DECLARE(cmov_b_rr(RW1 d, R1 s, IMM cc));
+DECLARE(cmov_w_rr(RW2 d, R2 s, IMM cc));
DECLARE(cmov_l_rr(RW4 d, R4 s, IMM cc));
DECLARE(cmov_l_rm(RW4 d, IMM s, IMM cc));
DECLARE(bsf_l_rr(W4 d, R4 s));
uae_u32 get_copper_address(int copno);
extern int custom_init (void);
-extern void customreset (void);
+extern void customreset (int hardreset);
extern int intlev (void);
extern void dumpcustom (void);
--- /dev/null
+/*
+ * compiler/flags_x86.h - Native flags definitions for IA-32
+ *
+ * Original 68040 JIT compiler for UAE, copyright 2000-2002 Bernd Meyer
+ *
+ * Adaptation for Basilisk II and improvements, copyright 2000-2005
+ * Gwenole Beauchesne
+ *
+ * Basilisk II (C) 1997-2005 Christian Bauer
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef NATIVE_FLAGS_X86_H
+#define NATIVE_FLAGS_X86_H
+
+/* Native integer code conditions */
+enum {
+ NATIVE_CC_HI = 7,
+ NATIVE_CC_LS = 6,
+ NATIVE_CC_CC = 3,
+ NATIVE_CC_CS = 2,
+ NATIVE_CC_NE = 5,
+ NATIVE_CC_EQ = 4,
+ NATIVE_CC_VC = 11,
+ NATIVE_CC_VS = 10,
+ NATIVE_CC_PL = 9,
+ NATIVE_CC_MI = 8,
+ NATIVE_CC_GE = 13,
+ NATIVE_CC_LT = 12,
+ NATIVE_CC_GT = 15,
+ NATIVE_CC_LE = 14
+};
+
+#endif /* NATIVE_FLAGS_X86_H */
extern void *cache_alloc (int);
extern void cache_free (void*);
-extern int canbang;
+extern int canbang, candirect;
void init_shm (void);
#endif
extern void REGPARAM3 MakeSR (struct regstruct *regs) REGPARAM;
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 NMI (void);
extern void doint (void);
extern void dump_counts (void);
extern int m68k_move2c (int, uae_u32 *);
extern uae_u8 *restore_ide (uae_u8 *src);
extern uae_u8 *save_ide (int num, int *len);
+extern uae_u8 *save_configuration (int *len);
+extern uae_u8 *restore_configuration (uae_u8 *src);
+extern uae_u8 *save_log (int *len);
+extern uae_u8 *restore_log (uae_u8 *src);
+
extern void restore_cram (int, size_t);
extern void restore_bram (int, size_t);
extern void restore_fram (int, size_t);
extern struct zvolume *archive_directory_arcacc (struct zfile *z, unsigned int id);
extern struct zfile *archive_access_arcacc (struct znode *zn);
-extern struct zfile *archive_access_select (struct zfile *zf, unsigned int id);
+extern struct zfile *archive_access_select (struct zfile *zf, unsigned int id, int doselect);
extern struct zfile *archive_access_arcacc_select (struct zfile *zf, unsigned int id);
disk_eject (3);
break;
case AKS_IRQ7:
- Interrupt (7);
+ NMI ();
break;
case AKS_PAUSE:
pausemode (-1);
#include "a2091.h"
#include "ncr_scsi.h"
#include "scsi.h"
+#include "blkdev.h"
#ifdef USE_SDL
#include "SDL.h"
#endif
#ifdef FILESYS
+ filesys_prepare_reset ();
filesys_reset ();
#endif
memory_reset ();
{
if (quit_program == -1)
return;
+ if (!canbang && candirect < 0)
+ candirect = 0;
+ if (canbang && candirect < 0)
+ candirect = 1;
/* Do a reset on startup. Whether this is elegant is debatable. */
inputdevice_updateconfig (&currprefs);
if (quit_program >= 0)
#ifdef FILESYS
filesys_cleanup ();
#endif
+ device_func_reset();
savestate_free ();
memory_cleanup ();
cfgfile_addcfgparam (0);
#include "a2091.h"
int canbang;
+int candirect = -1;
#ifdef JIT
/* Set by each memory handler that does not simply access real memory. */
int special_mem;
#endif
+static void nocanbang(void)
+{
+ canbang = 0;
+}
+
int ersatzkickfile;
uae_u32 allocated_chipmem;
{ "Freezer: Action Replay 1200", 0, 0, 0, 0, "AR\0", 262144, 47, 0, 0, ROMTYPE_AR, 1,
0x8d760101, 0x0F6AB834,0x2810094A,0xC0642F62,0xBA42F78B,0xC0B07E6A },
- { "Freezer: Action Cartridge Super IV Pro (+ROM)", 4, 3, 4, 3, "SUPERIV\0", 170368, 60, 0, 0, ROMTYPE_SUPERIV, 1,
- 0xe668a0be, 0x633A6E65,0xA93580B8,0xDDB0BE9C,0x9A64D4A1,0x7D4B4801 },
- { "Freezer: Action Cartridge Super IV Pro", 0, 0, 0, 0, "SUPERIV\0", 0, 62, 0, 0, ROMTYPE_SUPERIV, 1,
+ { "Freezer: Action Cartridge Super IV Professional", 0, 0, 0, 0, "SUPERIV\0", 0, 62, 0, 0, ROMTYPE_SUPERIV, 1,
0xffffffff, 0, 0, 0, 0, 0, "SuperIV" },
- { "Freezer: X-Power Professional 500", 1, 2, 1, 2, "XPOWER\0", 131072, 65, 0, 0, ROMTYPE_SUPERIV, 1,
+ { "Freezer: Action Cart. Super IV Pro (+ROM v4.3)", 4, 3, 4, 3, "SUPERIV\0", 170368, 60, 0, 0, ROMTYPE_SUPERIV, 1,
+ 0xe668a0be, 0x633A6E65,0xA93580B8,0xDDB0BE9C,0x9A64D4A1,0x7D4B4801 },
+ { "Freezer: X-Power Professional 500 v1.2", 1, 2, 1, 2, "XPOWER\0", 131072, 65, 0, 0, ROMTYPE_SUPERIV, 1,
0x9e70c231, 0xa2977a1c,0x41a8ca7d,0x4af4a168,0x726da542,0x179d5963 },
/* only 2 bad dumps available */
{ "Freezer: Nordic Power v?", 0, 0, 0, 0, "NPOWER\0", 65536, 66, 0, 0, ROMTYPE_SUPERIV, 1, },
{ "Freezer: Nordic Power v?", 0, 0, 0, 0, "NPOWER\0", 65536, 67, 0, 0, ROMTYPE_SUPERIV, 1, },
//0xdd16cdec, 0xfd882967,0x87e2da5f,0x4ef6be32,0x5f7c9324,0xb5bd8e64 },
- { "Freezer: HRTMon (built-in)", 0, 0, 0, 0, "HRTMON\0", 0, 63, 0, 0, ROMTYPE_HRTMON, 1,
+ { "Freezer: HRTMon v2.30 (built-in)", 0, 0, 0, 0, "HRTMON\0", 0, 63, 0, 0, ROMTYPE_HRTMON, 1,
0xffffffff, 0, 0, 0, 0, 0, "HRTMon" },
{ "A590/A2091 SCSI boot ROM", 0, 0, 6, 0, "A590\0A2091\0", 16384, 53, 0, 0, ROMTYPE_A2091BOOT, 0,
if (!x) {
write_log ("NATMEM: Failure to find mapping at %p\n",base);
dumplist ();
- canbang = 0;
+ nocanbang();
return 0;
}
return x;
if (x->size > size) {
write_log ("NATMEM: Failure to delete mapping at %08x(size %08x, delsize %08x)\n",start,x->size,size);
dumplist ();
- canbang = 0;
+ nocanbang();
return;
}
shmdt (x->native_address);
if (y->native_address == (void *) -1) {
write_log ("NATMEM: Failure to map existing at %08x(%p)\n",start,base);
dumplist ();
- canbang = 0;
+ nocanbang();
return;
}
y->next = shm_start;
void *answer;
shmpiece *x;
- if (!canbang)
+ if (!canbang) {
+ nocanbang();
return xmalloc (s);
+ }
id = shmget (IPC_PRIVATE, s, 0x1ff, file);
if (id == -1) {
- canbang = 0;
+ nocanbang();
return mapped_malloc (s, file);
}
answer = shmat (id, 0, 0);
if (x->next)
x->next->prev = x;
shm_start = x;
-
return answer;
}
- canbang = 0;
+ nocanbang();
return mapped_malloc (s, file);
}
opcnt++;
}
}
- write_log ("Building CPU function table, %d opcodes (%d %d %d). CPU=%d, FPU=%d.\n",
+ write_log ("Building CPU, %d opcodes (%d %d %d). CPU=%d, FPU=%d, JIT=%d.\n",
opcnt, currprefs.cpu_level,
currprefs.cpu_cycle_exact ? -1 : currprefs.cpu_compatible ? 1 : 0,
- currprefs.address_space_24, currprefs.cpu_model, currprefs.fpu_model);
+ currprefs.address_space_24, currprefs.cpu_model, currprefs.fpu_model,
+ currprefs.cachesize);
#ifdef JIT
build_comp ();
#endif
doint();
}
-void Interrupt (int nr)
+void NMI(void)
{
- do_interrupt (nr, ®s);
+ do_interrupt (7, ®s);
}
#ifndef CPUEMU_68000_ONLY
int intr = intlev ();
unset_special (regs, SPCFLAG_INT | SPCFLAG_DOINT);
if (intr != -1 && intr > regs->intmask)
- Interrupt (intr);
+ do_interrupt (intr, regs);
}
if ((regs->spcflags & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE))) {
unset_special (regs, SPCFLAG_BRK | SPCFLAG_MODE_CHANGE);
else if (savestate_state == STATE_REWIND)
savestate_rewind ();
#endif
- /* following three lines must not be reordered or
- * fastram state restore breaks
- */
reset_all_systems ();
- gayle_reset (hardreset);
- customreset ();
- if (hardreset)
- rtc_hardreset();
+ customreset (hardreset);
m68k_reset (hardreset);
if (hardreset) {
memory_hardreset();
uae_u16 ins;
if (currprefs.cpu_compatible || currprefs.cpu_cycle_exact) {
- customreset ();
+ customreset (0);
return;
}
pc = m68k_getpc(®s);
addrbank *b = &get_mem_bank(pc);
if (b->check(pc, 2 + 2)) {
/* We have memory, hope for the best.. */
- customreset ();
+ customreset (0);
return;
}
write_log("M68K RESET PC=%x, rebooting..\n", pc);
- customreset ();
+ customreset (0);
m68k_setpc (®s, ksboot);
return;
}
int reg = ins & 7;
uae_u32 addr = m68k_areg (®s, reg);
write_log ("reset/jmp (ax) combination emulated -> %x\n", addr);
- customreset ();
+ customreset (0);
if (addr < 0x80000)
addr += 0xf80000;
m68k_setpc (®s, addr - 2);
return;
}
write_log("M68K RESET PC=%x, rebooting..\n", pc);
- customreset ();
+ customreset (0);
m68k_setpc (®s, ksboot);
}
debugfile = 0;
}
+uae_u8 *save_log(int *len)
+{
+ FILE *f;
+ uae_u8 *dst;
+ int size;
+
+ f = fopen(LOG_BOOT, "rb");
+ if (!f)
+ return NULL;
+ fseek(f, 0, SEEK_END);
+ size = ftell(f);
+ fseek(f, 0, SEEK_SET);
+ dst = xcalloc(1, size + 1);
+ if (dst)
+ fread(dst, 1, size, f);
+ fclose(f);
+ *len = size + 1;
+ return dst;
+}
+
typedef DWORD (STDAPICALLTYPE *PFN_GetKey)(LPVOID lpvBuffer, DWORD dwSize);
uae_u8 *target_load_keyfile (struct uae_prefs *p, char *path, int *sizep, char *name)
{
#define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
#define GETBDD(x) ((x) % 100)
-#define WINUAEBETA 9
+#define WINUAEBETA 10
#define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2007, 7, 10)
+#define WINUAEDATE MAKEBD(2007, 7, 19)
#define WINUAEEXTRA ""
#define WINUAEREV ""
8, 9, 10, -1, -1, // A600
23, 24, -1, -1, // A1000
11, 31, 15, -1, -1, // A1200
- 61, 32, 59, -1, -1, // A3000
+ 61, 59, -1, -1, // A3000
16, 46, 31, 13, 12, -1, -1, // A4000
18, -1, 19, -1, -1, // CD32
20, 21, 22, -1, 6, 32, -1, -1, // CDTV
#ifndef JIT
enable = FALSE;
#endif
- enable2 = enable && workprefs.compforcesettings;
+ enable2 = enable && workprefs.compforcesettings && candirect;
ew (hDlg, IDC_TRUST0, enable2);
ew (hDlg, IDC_TRUST1, enable2);
#ifdef JIT
if(enable) {
- if (!canbang) {
+ if (!canbang || !candirect) {
workprefs.compforcesettings = TRUE;
workprefs.comptrustbyte = 1;
workprefs.comptrustword = 1;
}
if (oldcache == 0 && workprefs.cachesize > 0)
canbang = 1;
+ if (!candirect)
+ canbang = 0;
+
#endif
workprefs.cpu_idle = SendMessage(GetDlgItem(hDlg, IDC_CPUIDLE), TBM_GETPOS, 0, 0);
if (workprefs.cpu_idle > 0)
hr = DirectDraw_FlipToGDISurface();
if (FAILED(hr))
write_log ("FlipToGDISurface failed, %s\n", DXError (hr));
- *flags &= ~MB_SETFOREGROUND;
+ *flags |= MB_SETFOREGROUND;
+ *flags |= MB_TOPMOST;
return 0;
/*
HRESULT hr;
RelativePath="..\..\savestate.c"
>
</File>
+ <File
+ RelativePath="..\..\scsi.c"
+ >
+ </File>
<File
RelativePath="..\..\scsiemul.c"
>
>
</File>
<File
- RelativePath="..\..\unzip.c"
+ RelativePath="..\..\zfile.c"
>
</File>
<File
- RelativePath="..\..\zfile.c"
+ RelativePath="..\..\zfile_archive.c"
>
</File>
</Filter>
>
</File>
</Filter>
- <Filter
- Name="dms"
- >
- <File
- RelativePath="..\..\dms\cdata.h"
- >
- </File>
- <File
- RelativePath="..\..\dms\crc_csum.c"
- >
- </File>
- <File
- RelativePath="..\..\dms\getbits.c"
- >
- </File>
- <File
- RelativePath="..\..\dms\maketbl.c"
- >
- </File>
- <File
- RelativePath="..\..\dms\pfile.c"
- >
- </File>
- <File
- RelativePath="..\..\dms\tables.c"
- >
- </File>
- <File
- RelativePath="..\..\dms\u_deep.c"
- >
- </File>
- <File
- RelativePath="..\..\dms\u_heavy.c"
- >
- </File>
- <File
- RelativePath="..\..\dms\u_init.c"
- >
- </File>
- <File
- RelativePath="..\..\dms\u_medium.c"
- >
- </File>
- <File
- RelativePath="..\..\dms\u_quick.c"
- >
- </File>
- <File
- RelativePath="..\..\dms\u_rle.c"
- >
- </File>
- </Filter>
<Filter
Name="prowizard"
>
</Filter>
</Filter>
<Filter
- Name="7z"
+ Name="decompressor"
>
- <File
- RelativePath="..\..\7z\7zAlloc.c"
- >
- </File>
- <File
- RelativePath="..\..\7z\7zBuffer.c"
- >
- </File>
- <File
- RelativePath="..\..\7z\7zCrc.c"
- >
- </File>
- <File
- RelativePath="..\..\7z\7zDecode.c"
- >
- </File>
- <File
- RelativePath="..\..\7z\7zExtract.c"
- >
- </File>
- <File
- RelativePath="..\..\7z\7zHeader.c"
+ <Filter
+ Name="7z"
>
- </File>
- <File
- RelativePath="..\..\7z\7zIn.c"
+ <File
+ RelativePath="..\..\archivers\7z\7zAlloc.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\7z\7zBuffer.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\7z\7zCrc.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\7z\7zDecode.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\7z\7zExtract.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\7z\7zHeader.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\7z\7zIn.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\7z\7zItem.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\7z\7zMain.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\7z\7zMethodID.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\7z\LzmaDecode.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="dms"
>
- </File>
- <File
- RelativePath="..\..\7z\7zItem.c"
+ <File
+ RelativePath="..\..\archivers\dms\crc_csum.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\dms\getbits.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\dms\maketbl.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\dms\pfile.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\dms\tables.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\dms\u_deep.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\dms\u_heavy.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\dms\u_init.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\dms\u_medium.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\dms\u_quick.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\dms\u_rle.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="lha"
>
- </File>
- <File
- RelativePath="..\..\7z\7zMethodID.c"
+ <File
+ RelativePath="..\..\archivers\lha\crcio.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\lha\dhuf.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\lha\header.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\lha\huf.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\lha\larc.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\lha\lhamaketbl.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\lha\lharc.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\lha\shuf.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\lha\slide.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\lha\uae_lha.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\archivers\lha\util.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="lzx"
>
- </File>
- <File
- RelativePath="..\..\7z\LzmaDecode.c"
+ <File
+ RelativePath="..\..\archivers\lzx\unlzx.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="zip"
>
- </File>
+ <File
+ RelativePath="..\..\archivers\zip\unzip.c"
+ >
+ </File>
+ </Filter>
</Filter>
<File
RelativePath="..\resources\drive_click.wav"
RelativePath="..\resources\drive_startup.wav"
>
</File>
- <File
- RelativePath="..\resources\resource"
- >
- </File>
<File
RelativePath="..\resources\resource.h"
>
+Beta 10:
+
+- Arcadia emulation crash fixed
+- SCSI emulator MODE SENSE code 3 and 4 crash fix (uaehf.device only)
+- A3000 KS 1.3 ROM removed from rom scan "available"-list (only
+ proper A3000 ROMs, 1.4b and 3.1 included)
+- added missing version numbers to cartridge roms
+- xBCD instruction 68040/060 undefined behaviour emulated, N and V
+ flags are not cleared. (from Basilisk II JIT)
+- JIT LSL, LSR, ASR X-flag was incorrectly modified when shift count
+ was zero (from Basilisk II JIT)
+- configuration and bootlog (text format) saved with statefile
+ (compressed, few kb size increase, only for debugging purposes)
+ NOTE: fake END-hunk inserted before CONF and LOG hunks, you can
+ simply delete all "useless" data after first END-hunk without
+ corrupting the statefile.
+- action replay/hrtmon statefile hunks are now compressed
+- drive GUI properly initialized when restoring state (disabled
+ drives are "blanked", no track number visible)
+- empty drive disk change status was incorrect in some cases when
+ restoring state (load state, OS detects disk in empty drive)
+- do not allow JIT direct mode if emulation was originally started
+ without JIT direct enabled (different memory allocation which is not
+ compatible with direct = crashes. Will be properly fixed in future)
+- uaescsi.device SCSI mode selection reset after loading new config
+- messagebox in fullscreen mode tweaks, perhaps fixes problem with
+ hidden "too old rtg.library" messagebox in fullscreen mode
+- close native-side open filehandles after software reset
+ (fixes locked startup-sequence after directory fs setpatch reset)
+
Beta 9:
- ROM scan dialog listed "available" even if configuration required
- included beta updated rtg.library, fully enables >1024 pixel wide
bitmaps (including acceleration), obsoletes picasso96fix. (BR)
-
Beta 4:
- return SCSI-1 style inquiry response when using A590/A2091 SCSI
&& strcmp (name, "BRAM") != 0
&& strcmp (name, "FRAM") != 0
&& strcmp (name, "ZRAM") != 0
- && strcmp (name, "PRAM") != 0)
+ && strcmp (name, "PRAM") != 0
+ && strcmp (name, "A3K1") != 0
+ && strcmp (name, "A3K2") != 0)
{
/* without zeros at the end old state files may not work */
- mem = (uae_u8*)calloc (1, len2 + 32);
- zfile_fread (mem, 1, len2, f);
+ mem = (uae_u8*)calloc (1, *totallen + 32);
+ if (flags & 1) {
+ zfile_zuncompress (mem, *totallen, f, len2);
+ } else {
+ zfile_fread (mem, 1, len2, f);
+ }
} else {
mem = 0;
zfile_fseek (f, len2, SEEK_CUR);
end = restore_gayle (chunk);
else if (!strcmp (name, "IDE "))
end = restore_ide (chunk);
- else
+ else if (!strcmp (name, "CONF"))
+ end = restore_configuration (chunk);
+ else if (!strcmp (name, "LOG "))
+ end = chunk + len;
+ else {
+ end = chunk + len;
write_log ("unknown chunk '%s' size %d bytes\n", name, len);
+ }
if (len != end - chunk)
write_log ("Chunk '%s' total size %d bytes but read %d bytes!\n",
name, len, end - chunk);
int save_state (char *filename, char *description)
{
+ uae_u8 endhunk[] = { 'E', 'N', 'D', ' ', 0, 0, 0, 8 };
uae_u8 header[1000];
char tmp[100];
uae_u8 *dst;
#ifdef ACTION_REPLAY
dst = save_action_replay (&len, 0);
- save_chunk (f, dst, len, "ACTR", 0);
+ save_chunk (f, dst, len, "ACTR", 1);
dst = save_hrtmon (&len, 0);
- save_chunk (f, dst, len, "HRTM", 0);
+ save_chunk (f, dst, len, "HRTM", 1);
#endif
#ifdef FILESYS
dst = save_filesys_common (&len);
}
}
- zfile_fwrite ("END ", 1, 4, f);
- zfile_fwrite ("\0\0\0\08", 1, 4, f);
+ /* add fake END tag, makes it easy to strip CONF and LOG hunks */
+ /* move this if you want to use CONF or LOG hunks when restoring state */
+ zfile_fwrite (endhunk, 1, 8, f);
+
+ dst = save_configuration (&len);
+ if (dst) {
+ save_chunk (f, dst, len, "CONF", 1);
+ xfree(dst);
+ }
+ dst = save_log (&len);
+ if (dst) {
+ save_chunk (f, dst, len, "LOG ", 1);
+ xfree(dst);
+ }
+
+ zfile_fwrite (endhunk, 1, 8, f);
+
write_log ("Save of '%s' complete\n", filename);
zfile_fclose (f);
savestate_state = 0;
RAM SPACE
- "xRAM" (CRAM = chip, BRAM = bogo, FRAM = fast, ZFRAM = Z3)
+ "xRAM" (CRAM = chip, BRAM = bogo, FRAM = fast, ZRAM = Z3, P96 = RTG RAM, A3K1/A3K2 = MB RAM)
start address 4 ("bank"=chip/slow/fast etc..)
of RAM "bank"
return ZFILE_UNKNOWN;
}
-static struct zfile *zuncompress (struct zfile *z);
+static struct zfile *zuncompress (struct zfile *z, int);
struct zfile *zfile_gunzip (struct zfile *z)
{
return 0;
}
-static struct zfile *zuncompress (struct zfile *z)
+static struct zfile *zuncompress (struct zfile *z, int dodefault)
{
char *name = z->name;
char *ext = strrchr (name, '.');
if (ext != NULL) {
ext++;
if (strcasecmp (ext, "7z") == 0)
- return archive_access_select (z, ArchiveFormat7Zip);
+ return archive_access_select (z, ArchiveFormat7Zip, dodefault);
if (strcasecmp (ext, "zip") == 0)
- return archive_access_select (z, ArchiveFormatZIP);
+ return archive_access_select (z, ArchiveFormatZIP, dodefault);
if (strcasecmp (ext, "lha") == 0 || strcasecmp (ext, "lzh") == 0)
- return archive_access_select (z, ArchiveFormatLHA);
+ return archive_access_select (z, ArchiveFormatLHA, dodefault);
if (strcasecmp (ext, "lzx") == 0)
- return archive_access_select (z, ArchiveFormatLZX);
+ return archive_access_select (z, ArchiveFormatLZX, dodefault);
if (strcasecmp (ext, "rar") == 0)
- return archive_access_select (z, ArchiveFormatRAR);
+ return archive_access_select (z, ArchiveFormatRAR, dodefault);
if (strcasecmp (ext, "gz") == 0)
return zfile_gunzip (z);
if (strcasecmp (ext, "adz") == 0)
if (header[0] == 0x1f && header[1] == 0x8b)
return zfile_gunzip (z);
if (header[0] == 'P' && header[1] == 'K')
- return archive_access_select (z, ArchiveFormatZIP);
+ return archive_access_select (z, ArchiveFormatZIP, dodefault);
if (header[0] == 'R' && header[1] == 'a' && header[2] == 'r' && header[3] == '!')
- return archive_access_select (z, ArchiveFormatRAR);
+ return archive_access_select (z, ArchiveFormatRAR, dodefault);
if (header[0] == 'D' && header[1] == 'M' && header[2] == 'S' && header[3] == '!')
return dms (z);
if (header[0] == 'L' && header[1] == 'Z' && header[2] == 'X')
- return archive_access_select (z, ArchiveFormatLZX);
+ return archive_access_select (z, ArchiveFormatLZX, dodefault);
if (header[2] == '-' && header[3] == 'l' && header[4] == 'h' && header[6] == '-')
- return archive_access_select (z, ArchiveFormatLHA);
+ return archive_access_select (z, ArchiveFormatLHA, dodefault);
}
return z;
}
#else
static void manglefilename(char *out, const char *in)
{
+ strcpy(out, in);
}
#endif
l = zfile_fopen_2 (path, mode);
if (!l)
return 0;
- l = zuncompress (l);
+ l = zuncompress (l, 0);
return l;
}
return zf;
}
-struct zfile *archive_access_select (struct zfile *zf, unsigned int id)
+struct zfile *archive_access_select (struct zfile *zf, unsigned int id, int dodefault)
{
struct zvolume *zv;
struct znode *zn;
if (z) {
zfile_fclose(zf);
zf = z;
+ } else if (!dodefault && zf->zipname && zf->zipname[0]) {
+ zfile_fclose(zf);
+ zf = NULL;
}
return zf;
}
zfile_fseek(z, 0, SEEK_SET);
zn = zvolume_addfile_abs(zv, &zai);
if (!memcmp (id, exeheader, sizeof id)) {
- uae_u8 *data = xmalloc(strlen(filename) + 2);
- sprintf(data,"%s\n", filename);
+ uae_u8 *data = xmalloc(1 + strlen(filename) + 1 + 2);
+ sprintf(data,"\"%s\"\n", filename);
addfile(zv, "s/startup-sequence", data, strlen(data));
xfree(data);
}