puae 2.3.0

This commit is contained in:
Mustafa 'GnoStiC' TUFAN 2010-09-01 09:50:40 +03:00
parent 66f6641e25
commit 10d242f700
17 changed files with 142 additions and 117 deletions

View File

@ -362,13 +362,16 @@ static int get_standard_cd_unit2 (unsigned int csu)
int unitnum = 0;
int isaudio = 0;
if (currprefs.cdslots[unitnum].name[0] || currprefs.cdslots[unitnum].inuse) {
device_func_init (SCSI_UNIT_IOCTL);
if (!sys_command_open_internal (unitnum, currprefs.cdslots[unitnum].name, csu)) {
device_func_init (SCSI_UNIT_IMAGE);
if (!sys_command_open_internal (unitnum, currprefs.cdslots[unitnum].name, csu))
goto fallback;
if (currprefs.cdslots[unitnum].name[0]) {
device_func_init (SCSI_UNIT_IOCTL);
if (!sys_command_open_internal (unitnum, currprefs.cdslots[unitnum].name, csu)) {
device_func_init (SCSI_UNIT_IMAGE);
if (!sys_command_open_internal (unitnum, currprefs.cdslots[unitnum].name, csu))
goto fallback;
}
} else {
goto fallback;
}
getunitinfo (unitnum, 0, csu, &isaudio);
return unitnum;
}
#ifdef _WIN32

View File

@ -1918,15 +1918,4 @@ void restore_cdtv_finish (void)
}
#endif
void cdtv_entergui (void)
{
if (cd_playing && !cd_paused)
write_comm_pipe_u32 (&requests, 0x102, 1);
}
void cdtv_exitgui (void)
{
if (cd_playing && !cd_paused)
write_comm_pipe_u32 (&requests, 0x103, 1);
}
#endif

View File

@ -3267,14 +3267,14 @@ static int cfgfile_handle_custom_event (TCHAR *custom, int mode)
}
#endif
int cmdlineparser (TCHAR *s, TCHAR *outp[], int max)
int cmdlineparser (const TCHAR *s, TCHAR *outp[], int max)
{
int j;
unsigned int cnt = 0;
int slash = 0;
int quote = 0;
TCHAR tmp1[MAX_DPATH];
TCHAR *prev;
const TCHAR *prev;
int doout;
doout = 0;

View File

@ -640,7 +640,7 @@ static void reset_drive (int num)
static void update_drive_gui (int num)
{
drive *drv = floppy + num;
bool writ = dskdmaen == 3 && drv->state && !(selected & (1 << num));
bool writ = dskdmaen == 3 && drv->state && !((selected | disabled) & (1 << num));
if (drv->state == gui_data.drive_motor[num]
&& drv->cyl == gui_data.drive_track[num]
@ -1166,7 +1166,7 @@ STATIC_INLINE int drive_empty (const drive * drv)
return drv->diskfile == 0;
}
static void drive_step (drive * drv)
static void drive_step (drive * drv, int step_direction)
{
#ifdef CATWEASEL
if (drv->catweasel) {
@ -1179,6 +1179,8 @@ static void drive_step (drive * drv)
return;
}
#endif
if (!drive_empty (drv))
drv->dskchange = 0;
if (drv->steplimit && get_cycles() - drv->steplimitcycle < MIN_STEPLIMIT_CYCLE) {
if (disk_debug_logging > 1)
write_log (" step ignored drive %d, %d",
@ -1190,9 +1192,7 @@ static void drive_step (drive * drv)
* (stupid trackloaders with CPU delay loops)
*/
set_steplimit (drv);
if (!drive_empty (drv))
drv->dskchange = 0;
if (direction) {
if (step_direction) {
if (drv->cyl) {
drv->cyl--;
#ifdef DRIVESOUND
@ -2392,11 +2392,12 @@ static TCHAR *tobin (uae_u8 v)
void DISK_select (uae_u8 data)
{
unsigned int step_pulse, lastselected, dr;
static uae_u8 prevdata;
static unsigned int step;
unsigned int step_pulse, prev_selected, dr;
static uae_u8 prev_data;
static unsigned int prev_step;
prev_selected = selected;
lastselected = selected;
selected = (data >> 3) & 15;
side = 1 - ((data >> 2) & 1);
direction = (data >> 1) & 1;
@ -2407,10 +2408,10 @@ void DISK_select (uae_u8 data)
#ifdef AMAX
if (currprefs.amaxromfile[0])
amax_disk_select (data, prevdata);
amax_disk_select (data, prev_data);
#endif
if ((prevdata & 0x80) != (data & 0x80)) {
if ((prev_data & 0x80) != (data & 0x80)) {
for (dr = 0; dr < 4; dr++) {
if (floppy[dr].indexhackmode > 1 && !(selected & (1 << dr))) {
floppy[dr].indexhack = 1;
@ -2422,42 +2423,44 @@ void DISK_select (uae_u8 data)
if (disk_debug_logging > 1) {
write_log (" %d%d%d%d% ", (selected & 1) ? 0 : 1, (selected & 2) ? 0 : 1, (selected & 4) ? 0 : 1, (selected & 8) ? 0 : 1);
if ((prevdata & 0x80) != (data & 0x80))
if ((prev_data & 0x80) != (data & 0x80))
write_log (" dskmotor %d ", (data & 0x80) ? 1 : 0);
if ((prevdata & 0x02) != (data & 0x02))
if ((prev_data & 0x02) != (data & 0x02))
write_log (" direct %d ", (data & 0x02) ? 1 : 0);
if ((prevdata & 0x04) != (data & 0x04))
if ((prev_data & 0x04) != (data & 0x04))
write_log (" side %d ", (data & 0x04) ? 1 : 0);
}
if (step != step_pulse) {
// step goes high and drive was selected when step pulse changes: step
if (prev_step != step_pulse) {
if (disk_debug_logging > 1)
write_log (" dskstep %d ", step_pulse);
step = step_pulse;
if (step && !savestate_state) {
prev_step = step_pulse;
if (prev_step && !savestate_state) {
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
if (!((selected | disabled) & (1 << dr))) {
drive_step (floppy + dr);
if (!((prev_selected | disabled) & (1 << dr))) {
drive_step (floppy + dr, direction);
if (floppy[dr].indexhackmode > 1 && (data & 0x80))
floppy[dr].indexhack = 1;
}
}
}
}
if (!savestate_state) {
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
drive *drv = floppy + dr;
/* motor on/off workings tested with small assembler code on real Amiga 1200. */
/* motor/id flipflop is set only when drive select goes from high to low */
if (!(selected & (1 << dr)) && (lastselected & (1 << dr)) ) {
if (!(selected & (1 << dr)) && (prev_selected & (1 << dr)) ) {
drv->drive_id_scnt++;
drv->drive_id_scnt &= 31;
drv->idbit = (drv->drive_id & (1L << (31 - drv->drive_id_scnt))) ? 1 : 0;
if (!(disabled & (1 << dr))) {
if ((prevdata & 0x80) == 0 || (data & 0x80) == 0) {
if ((prev_data & 0x80) == 0 || (data & 0x80) == 0) {
/* motor off: if motor bit = 0 in prevdata or data -> turn motor on */
drive_motor (drv, 0);
} else if (prevdata & 0x80) {
} else if (prev_data & 0x80) {
/* motor on: if motor bit = 1 in prevdata only (motor flag state in data has no effect)
-> turn motor off */
drive_motor (drv, 1);
@ -2477,7 +2480,7 @@ void DISK_select (uae_u8 data)
floppy[dr].state = (!(selected & (1 << dr))) | !floppy[dr].motoroff;
update_drive_gui (dr);
}
prevdata = data;
prev_data = data;
if (disk_debug_logging > 1)
write_log ("\n");
}

View File

@ -2329,7 +2329,8 @@ static void gen_opcode (unsigned long int opcode)
fill_prefetch_full ();
break;
case i_Bcc:
// bcc.s and bcc.w cycles confirmed
// bcc.b branch: idle cycle, prefetch, prefetch
// bcc.b not branch: 2 idle cycles, prefetch
if (curi->size == sz_long) {
if (cpu_level < 2) {
addcycles000 (2);

View File

@ -60,9 +60,6 @@
# endif
#endif
//#define hf_log write_log
//#define hf_log2 write_log
#define MAX_ASYNC_REQUESTS 50
#define ASYNC_REQUEST_NONE 0
#define ASYNC_REQUEST_TEMP 1
@ -1000,6 +997,7 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u
case 0x00: /* TEST UNIT READY */
if (nodisk (hfd))
goto nodisk;
scsi_len = 0;
break;
case 0x08: /* READ (6) */
if (nodisk (hfd))
@ -1227,6 +1225,7 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u
case 0x35: /* SYNCRONIZE CACHE (10) */
if (nodisk (hfd))
goto nodisk;
scsi_len = 0;
break;
case 0xa8: /* READ (12) */
if (nodisk (hfd))

View File

@ -7,8 +7,6 @@ extern void akiko_reset (void);
extern int akiko_init (void);
extern void akiko_free (void);
extern void akiko_entergui (void);
extern void akiko_exitgui (void);
extern void AKIKO_hsync_handler (void);
extern void akiko_mute (int);

View File

@ -225,25 +225,7 @@ STATIC_INLINE void put_byte_ce020 (uaecptr addr, uae_u32 v)
mem_access_delay_byte_write_ce020 (addr, v);
}
extern void fill_icache020 (uae_u32);
STATIC_INLINE uae_u32 get_word_ce020_prefetch (int o)
{
uae_u32 pc = m68k_getpc () + o;
for (;;) {
if (pc == regs.prefetch020addr) {
uae_u32 v = regs.prefetch020data >> 16;
return v;
}
if (pc == regs.prefetch020addr + 2) {
uae_u32 v = regs.prefetch020data & 0xffff;
fill_icache020 (pc + 2);
return v;
}
fill_icache020 (pc);
}
}
extern uae_u32 get_word_ce020_prefetch (int);
STATIC_INLINE uae_u32 get_long_ce020_prefetch (int o)
{
@ -281,7 +263,7 @@ STATIC_INLINE void m68k_do_rts_ce020 (void)
#ifdef CPUEMU_21
extern void fill_icache030 (uae_u32 addr);
extern uae_u32 get_word_ce030_prefetch (int);
extern void write_dcache030 (uaecptr, uae_u32, int);
extern uae_u32 read_dcache030 (uaecptr, int);
@ -313,24 +295,6 @@ STATIC_INLINE uae_u32 get_byte_ce030 (uaecptr addr)
return read_dcache030 (addr, 0);
}
STATIC_INLINE uae_u32 get_word_ce030_prefetch (int o)
{
uae_u32 pc = m68k_getpc () + o;
for (;;) {
if (pc == regs.prefetch020addr) {
uae_u32 v = regs.prefetch020data >> 16;
return v;
}
if (pc == regs.prefetch020addr + 2) {
uae_u32 v = regs.prefetch020data & 0xffff;
fill_icache030 (pc + 2);
return v;
}
fill_icache030 (pc);
}
}
STATIC_INLINE uae_u32 get_long_ce030_prefetch (int o)
{
uae_u32 v;

View File

@ -84,6 +84,7 @@ typedef double fptype;
#endif
#endif
#define CPU_PIPELINE_MAX 2
#define CPU000_MEM_CYCLE 4
#define CPU000_CLOCK_MULT 2
#define CPU020_MEM_CYCLE 3
@ -114,6 +115,7 @@ struct cache040
uae_u32 tag[CACHELINES040];
};
struct regstruct
{
uae_u32 regs[16];
@ -164,8 +166,8 @@ struct regstruct
uae_u8 panic;
uae_u32 panic_pc, panic_addr;
uae_u32 prefetch020data;
uae_u32 prefetch020addr;
uae_u32 prefetch020data[CPU_PIPELINE_MAX];
uae_u32 prefetch020addr[CPU_PIPELINE_MAX];
int ce020memcycles;
};

View File

@ -398,6 +398,7 @@ struct uae_prefs {
bool win32_alwaysontop;
bool win32_powersavedisabled;
bool win32_minimize_inactive;
int win32_statusbar;
int win32_active_priority;
int win32_inactive_priority;
@ -517,11 +518,11 @@ extern int cfgfile_string (const TCHAR *option, const TCHAR *value, const TCHAR
extern TCHAR *cfgfile_subst_path (const TCHAR *path, const TCHAR *subst, const TCHAR *file);
extern TCHAR *target_expand_environment (const TCHAR *path);
extern int target_parse_option (struct uae_prefs *, TCHAR *option, TCHAR *value);
extern int target_parse_option (struct uae_prefs *, const TCHAR *option, const TCHAR *value);
/*extern void target_save_options (struct zfile*, struct uae_prefs *);
extern void target_default_options (struct uae_prefs *, int type);
extern void target_fixup_options (struct uae_prefs *);
extern int target_cfgfile_load (struct uae_prefs *, TCHAR *filename, int type, int isdefault);
extern int target_cfgfile_load (struct uae_prefs *, const TCHAR *filename, int type, int isdefault);
extern void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type);
extern int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig);
@ -537,8 +538,8 @@ extern uae_u32 cfgfile_modify (uae_u32 index, TCHAR *parms, uae_u32 size, TCHAR
extern void cfgfile_addcfgparam (TCHAR *);
extern int built_in_prefs (struct uae_prefs *p, int model, int config, int compa, int romcheck);
extern int built_in_chipset_prefs (struct uae_prefs *p);
extern int cmdlineparser (TCHAR *s, TCHAR *outp[], int max);
extern int cfgfile_configuration_change(int);
extern int cmdlineparser (const TCHAR *s, TCHAR *outp[], int max);
extern int cfgfile_configuration_change (int);
extern void fixup_prefs_dimensions (struct uae_prefs *prefs);
extern void fixup_prefs (struct uae_prefs *prefs);
extern void fixup_cpu (struct uae_prefs *prefs);

View File

@ -642,7 +642,7 @@ static void parse_cmdline_and_init_file (int argc, TCHAR **argv)
/* sam: if not found in $HOME then look in current directory */
char *saved_path = strdup (optionsfile);
strcpy (optionsfile, OPTIONSFILENAME);
if (! target_cfgfile_load (&currprefs, optionsfile, 0, 0) ) {
if (! target_cfgfile_load (&currprefs, optionsfile, 0) ) {
/* If not in current dir either, change path back to home
* directory - so that a GUI can save a new config file there */
strcpy (optionsfile, saved_path);

View File

@ -215,6 +215,9 @@ static void set_cpu_caches (void)
{
int i, j;
for (i = 0; i < CPU_PIPELINE_MAX; i++)
regs.prefetch020addr[i] = 0xffffffff;
#ifdef JIT
if (currprefs.cachesize) {
if (currprefs.cpu_model < 68040) {
@ -231,7 +234,6 @@ static void set_cpu_caches (void)
if (regs.cacr & 0x08) { // clear instr cache
for (i = 0; i < CACHELINES020; i++)
caches020[i].valid = 0;
regs.prefetch020addr = 0xff000000;
}
if (regs.cacr & 0x04) { // clear entry in instr cache
caches020[(regs.caar >> 2) & (CACHELINES020 - 1)].valid = 0;
@ -247,7 +249,6 @@ static void set_cpu_caches (void)
icaches030[i].valid[2] = 0;
icaches030[i].valid[3] = 0;
}
regs.prefetch020addr = 0xff000000;
}
if (regs.cacr & 0x04) { // clear entry in instr cache
icaches030[(regs.caar >> 4) & (CACHELINES030 - 1)].valid[(regs.caar >> 2) & 3] = 0;
@ -275,7 +276,6 @@ static void set_cpu_caches (void)
caches040[i].valid[2] = 0;
caches040[i].valid[3] = 0;
}
regs.prefetch020addr = 0xff000000;
}
}
}
@ -4208,8 +4208,8 @@ STATIC_INLINE void fill_cache040 (uae_u32 addr)
for (i = 0; i < CACHELINES040; i++) {
if (c->valid[i] && c->tag[i] == tag) {
// cache hit
regs.prefetch020addr = addr;
regs.prefetch020data = c->data[i][lws];
regs.prefetch020addr[0] = addr;
regs.prefetch020data[0] = c->data[i][lws];
return;
}
}
@ -4224,13 +4224,13 @@ STATIC_INLINE void fill_cache040 (uae_u32 addr)
c->data[i][0] = data;
}
}
regs.prefetch020addr = addr;
regs.prefetch020data = data;
regs.prefetch020addr[0] = addr;
regs.prefetch020data[0] = data;
}
#ifdef CPUEMU_20
// this one is really simple and easy
void fill_icache020 (uae_u32 addr)
STATIC_INLINE void fill_icache020 (uae_u32 addr, int idx)
{
int index;
uae_u32 tag;
@ -4243,8 +4243,8 @@ void fill_icache020 (uae_u32 addr)
c = &caches020[index];
if (c->valid && c->tag == tag) {
// cache hit
regs.prefetch020addr = addr;
regs.prefetch020data = c->data;
regs.prefetch020addr[idx] = addr;
regs.prefetch020data[idx] = c->data;
return;
}
// cache miss
@ -4254,8 +4254,40 @@ void fill_icache020 (uae_u32 addr)
c->valid = !!(regs.cacr & 1);
c->data = data;
}
regs.prefetch020addr = addr;
regs.prefetch020data = data;
regs.prefetch020addr[idx] = addr;
regs.prefetch020data[idx] = data;
}
uae_u32 get_word_ce020_prefetch (int o)
{
unsigned int i;
uae_u32 pc = m68k_getpc () + o;
for (;;) {
for (i = 0; i < 2; i++) {
if (pc == regs.prefetch020addr[0]) {
uae_u32 v = regs.prefetch020data[0] >> 16;
fill_icache020 (regs.prefetch020addr[0] + 4, 1);
return v;
}
if (pc == regs.prefetch020addr[0] + 2) {
uae_u32 v = regs.prefetch020data[0] & 0xffff;
if (regs.prefetch020addr[1] == regs.prefetch020addr[0] + 4) {
regs.prefetch020addr[0] = regs.prefetch020addr[1];
regs.prefetch020data[0] = regs.prefetch020data[1];
fill_icache020 (regs.prefetch020addr[0] + 4, 1);
} else {
fill_icache020 (pc + 4, 0);
fill_icache020 (regs.prefetch020addr[0] + 4, 1);
}
return v;
}
regs.prefetch020addr[0] = regs.prefetch020addr[1];
regs.prefetch020data[0] = regs.prefetch020data[1];
}
fill_icache020 (pc + 0, 0);
fill_icache020 (pc + 4, 1);
}
}
// 68030 caches aren't so simple as 68020 cache..
@ -4284,7 +4316,7 @@ STATIC_INLINE void update_cache030 (struct cache030 *c, uae_u32 val, uae_u32 tag
c->data[lws] = val;
}
void fill_icache030 (uae_u32 addr)
STATIC_INLINE void fill_icache030 (uae_u32 addr, int idx)
{
int lws;
uae_u32 tag;
@ -4295,8 +4327,8 @@ void fill_icache030 (uae_u32 addr)
c = getcache030 (icaches030, addr, &tag, &lws);
if (c->valid[lws] && c->tag == tag) {
// cache hit
regs.prefetch020addr = addr;
regs.prefetch020data = c->data[lws];
regs.prefetch020addr[idx] = addr;
regs.prefetch020data[idx] = c->data[lws];
return;
}
// cache miss
@ -4313,8 +4345,8 @@ void fill_icache030 (uae_u32 addr)
}
#endif
}
regs.prefetch020addr = addr;
regs.prefetch020data = data;
regs.prefetch020addr[idx] = addr;
regs.prefetch020data[idx] = data;
}
STATIC_INLINE bool cancache030 (uaecptr addr)
@ -4462,6 +4494,39 @@ uae_u32 read_dcache030 (uaecptr addr, int size)
return 0;
}
uae_u32 get_word_ce030_prefetch (int o)
{
unsigned int i;
uae_u32 pc = m68k_getpc () + o;
for (;;) {
for (i = 0; i < 2; i++) {
if (pc == regs.prefetch020addr[0]) {
uae_u32 v = regs.prefetch020data[0] >> 16;
fill_icache030 (regs.prefetch020addr[0] + 4, 1);
return v;
}
if (pc == regs.prefetch020addr[0] + 2) {
uae_u32 v = regs.prefetch020data[0] & 0xffff;
if (regs.prefetch020addr[1] == regs.prefetch020addr[0] + 4) {
regs.prefetch020addr[0] = regs.prefetch020addr[1];
regs.prefetch020data[0] = regs.prefetch020data[1];
fill_icache030 (regs.prefetch020addr[0] + 4, 1);
} else {
fill_icache030 (pc + 4, 0);
fill_icache030 (regs.prefetch020addr[0] + 4, 1);
}
return v;
}
regs.prefetch020addr[0] = regs.prefetch020addr[1];
regs.prefetch020data[0] = regs.prefetch020data[1];
}
fill_icache030 (pc + 0, 0);
fill_icache030 (pc + 4, 1);
}
}
void flush_dcache (uaecptr addr, int size)
{
if (!currprefs.cpu_cycle_exact)

View File

@ -138,7 +138,7 @@ void target_save_options (FILE *f, const struct uae_prefs *p)
{
}
int target_parse_option (struct uae_prefs *p, const char *option, const char *value)
int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR *value)
{
return 0;
}

View File

@ -107,7 +107,7 @@ void target_save_options (FILE *f, const struct uae_prefs *p)
{
}
int target_parse_option (struct uae_prefs *p, const char *option, const char *value)
int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR *value)
{
return 0;
}

View File

@ -56,7 +56,7 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
{
}
int target_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value)
int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR *value)
{
return 0;
}

View File

@ -395,7 +395,7 @@ void target_save_options (FILE *f, const struct uae_prefs *p)
{
}
int target_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value)
int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR *value)
{
return 0;
}

View File

@ -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/ccySHNQU.o: In function `main':
/tmp/ccVvVY5L.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/cc4ZEZr9.o: In function `main':
/tmp/ccRMTkaP.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/ccH9Ri3d.o: In function `main':
/tmp/ccdxf26T.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