Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PUAE
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
PUAE
Commits
c3278222
Commit
c3278222
authored
May 19, 2010
by
Mustafa 'GnoStiC' TUFAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
19.05.2010
parent
1de3885c
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1205 additions
and
1156 deletions
+1205
-1156
cfgfile.c
src/cfgfile.c
+481
-445
custom.c
src/custom.c
+58
-58
gencpu.c
src/gencpu.c
+0
-1
sdlgfx.c
src/gfx-sdl/sdlgfx.c
+28
-11
misc.c
src/misc.c
+1
-0
newcpu.c
src/newcpu.c
+450
-450
Info.plist
src/od-macosx/Info.plist
+2
-2
savestate.c
src/savestate.c
+1
-1
scsidev.c
src/scsidev.c
+128
-130
scsiemul.c
src/scsiemul.c
+25
-25
sysconfig.h
src/sysconfig.h
+3
-3
config.log
src/tools/config.log
+3
-3
traps.c
src/traps.c
+0
-2
uaeexe.c
src/uaeexe.c
+1
-1
uaelib.c
src/uaelib.c
+24
-24
No files found.
src/cfgfile.c
View file @
c3278222
...
@@ -1720,6 +1720,18 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
...
@@ -1720,6 +1720,18 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
return
1
;
return
1
;
#endif
#endif
if
(
cfgfile_strval
(
option
,
value
,
"chipset_compatible"
,
&
p
->
cs_compatible
,
cscompa
,
0
)
||
cfgfile_strval
(
option
,
value
,
"rtc"
,
&
p
->
cs_rtc
,
rtctype
,
0
)
||
cfgfile_strval
(
option
,
value
,
"ciaatod"
,
&
p
->
cs_ciaatod
,
ciaatodmode
,
0
)
||
cfgfile_strval
(
option
,
value
,
"ide"
,
&
p
->
cs_ide
,
idemode
,
0
)
||
cfgfile_strval
(
option
,
value
,
"scsi"
,
&
p
->
scsi
,
scsimode
,
0
)
||
cfgfile_strval
(
option
,
value
,
"comp_trustword"
,
&
p
->
comptrustword
,
compmode
,
0
)
||
cfgfile_strval
(
option
,
value
,
"comp_trustlong"
,
&
p
->
comptrustlong
,
compmode
,
0
)
||
cfgfile_strval
(
option
,
value
,
"comp_trustnaddr"
,
&
p
->
comptrustnaddr
,
compmode
,
0
)
||
cfgfile_strval
(
option
,
value
,
"collision_level"
,
&
p
->
collision_level
,
collmode
,
0
)
||
cfgfile_strval
(
option
,
value
,
"parallel_matrix_emulation"
,
&
p
->
parallel_matrix_emulation
,
epsonprinter
,
0
))
return
1
;
if
(
cfgfile_string
(
option
,
value
,
"kickstart_rom_file"
,
p
->
romfile
,
sizeof
p
->
romfile
/
sizeof
(
char
))
if
(
cfgfile_string
(
option
,
value
,
"kickstart_rom_file"
,
p
->
romfile
,
sizeof
p
->
romfile
/
sizeof
(
char
))
||
cfgfile_string
(
option
,
value
,
"kickstart_ext_rom_file"
,
p
->
romextfile
,
sizeof
p
->
romextfile
/
sizeof
(
char
))
||
cfgfile_string
(
option
,
value
,
"kickstart_ext_rom_file"
,
p
->
romextfile
,
sizeof
p
->
romextfile
/
sizeof
(
char
))
||
cfgfile_string
(
option
,
value
,
"amax_rom_file"
,
p
->
amaxromfile
,
sizeof
p
->
amaxromfile
/
sizeof
(
char
))
||
cfgfile_string
(
option
,
value
,
"amax_rom_file"
,
p
->
amaxromfile
,
sizeof
p
->
amaxromfile
/
sizeof
(
char
))
...
@@ -1858,8 +1870,25 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
...
@@ -1858,8 +1870,25 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
return
1
;
return
1
;
}
}
if
(
strcasecmp
(
option
,
"quickstart"
)
==
0
)
{
int
model
=
0
;
TCHAR
*
tmpp
=
_tcschr
(
value
,
','
);
if
(
tmpp
)
{
*
tmpp
++
=
0
;
TCHAR
*
tmpp2
=
_tcschr
(
value
,
','
);
if
(
tmpp2
)
*
tmpp2
=
0
;
cfgfile_strval
(
option
,
value
,
option
,
&
model
,
qsmodes
,
0
);
if
(
model
>=
0
)
{
int
config
=
_tstol
(
tmpp
);
built_in_prefs
(
p
,
model
,
config
,
0
,
0
);
}
}
return
1
;
}
for
(
i
=
0
;
i
<
MAX_FILESYSTEM_UNITS
;
i
++
)
{
for
(
i
=
0
;
i
<
MAX_FILESYSTEM_UNITS
;
i
++
)
{
char
tmp
[
100
];
TCHAR
tmp
[
100
];
_stprintf
(
tmp
,
"uaehf%d"
,
i
);
_stprintf
(
tmp
,
"uaehf%d"
,
i
);
if
(
_tcscmp
(
option
,
tmp
)
==
0
)
if
(
_tcscmp
(
option
,
tmp
)
==
0
)
return
1
;
return
1
;
...
@@ -1867,11 +1896,12 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
...
@@ -1867,11 +1896,12 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
if
(
_tcscmp
(
option
,
"filesystem"
)
==
0
if
(
_tcscmp
(
option
,
"filesystem"
)
==
0
||
_tcscmp
(
option
,
"hardfile"
)
==
0
)
||
_tcscmp
(
option
,
"hardfile"
)
==
0
)
{
{
int
secs
,
heads
,
reserved
,
bs
,
ro
;
int
secs
,
heads
,
reserved
,
bs
;
char
*
aname
,
*
root
;
bool
ro
;
char
*
tmpp
=
_tcschr
(
value
,
','
);
TCHAR
*
aname
,
*
root
;
char
*
str
;
TCHAR
*
tmpp
=
_tcschr
(
value
,
','
);
TCHAR
*
str
;
if
(
config_newfilesystem
)
if
(
config_newfilesystem
)
return
1
;
return
1
;
...
@@ -1883,13 +1913,13 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
...
@@ -1883,13 +1913,13 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
if
(
strcmp
(
value
,
"1"
)
==
0
||
strcasecmp
(
value
,
"ro"
)
==
0
if
(
strcmp
(
value
,
"1"
)
==
0
||
strcasecmp
(
value
,
"ro"
)
==
0
||
strcasecmp
(
value
,
"readonly"
)
==
0
||
strcasecmp
(
value
,
"readonly"
)
==
0
||
strcasecmp
(
value
,
"read-only"
)
==
0
)
||
strcasecmp
(
value
,
"read-only"
)
==
0
)
ro
=
1
;
ro
=
true
;
else
if
(
strcmp
(
value
,
"0"
)
==
0
||
strcasecmp
(
value
,
"rw"
)
==
0
else
if
(
strcmp
(
value
,
"0"
)
==
0
||
strcasecmp
(
value
,
"rw"
)
==
0
||
strcasecmp
(
value
,
"readwrite"
)
==
0
||
strcasecmp
(
value
,
"readwrite"
)
==
0
||
strcasecmp
(
value
,
"read-write"
)
==
0
)
||
strcasecmp
(
value
,
"read-write"
)
==
0
)
ro
=
0
;
ro
=
false
;
else
else
goto
invalid_fs
;
goto
invalid_fs
;
secs
=
0
;
heads
=
0
;
reserved
=
0
;
bs
=
0
;
secs
=
0
;
heads
=
0
;
reserved
=
0
;
bs
=
0
;
value
=
tmpp
;
value
=
tmpp
;
...
@@ -1935,21 +1965,22 @@ add_filesys_unit (struct uaedev_mount_info *mountinfo, const char *devname, cons
...
@@ -1935,21 +1965,22 @@ add_filesys_unit (struct uaedev_mount_info *mountinfo, const char *devname, cons
if
(
_tcscmp
(
option
,
"filesystem2"
)
==
0
if
(
_tcscmp
(
option
,
"filesystem2"
)
==
0
||
_tcscmp
(
option
,
"hardfile2"
)
==
0
)
||
_tcscmp
(
option
,
"hardfile2"
)
==
0
)
{
{
int
secs
,
heads
,
reserved
,
bs
,
ro
,
bp
,
hdcv
;
int
secs
,
heads
,
reserved
,
bs
,
bp
,
hdcv
;
char
*
dname
=
NULL
,
*
aname
=
""
,
*
root
=
NULL
,
*
fs
=
NULL
,
*
hdc
;
bool
ro
;
char
*
tmpp
=
_tcschr
(
value
,
','
);
TCHAR
*
dname
=
NULL
,
*
aname
=
""
,
*
root
=
NULL
,
*
fs
=
NULL
,
*
hdc
;
char
*
str
=
NULL
;
TCHAR
*
tmpp
=
_tcschr
(
value
,
','
);
TCHAR
*
str
=
NULL
;
config_newfilesystem
=
1
;
config_newfilesystem
=
1
;
if
(
tmpp
==
0
)
if
(
tmpp
==
0
)
goto
invalid_fs
;
goto
invalid_fs
;
*
tmpp
++
=
'\0'
;
*
tmpp
++
=
'\0'
;
if
(
strcasecmp
(
value
,
"ro"
)
==
0
)
if
(
strcasecmp
(
value
,
"ro"
)
==
0
)
ro
=
1
;
ro
=
true
;
else
if
(
strcasecmp
(
value
,
"rw"
)
==
0
)
else
if
(
strcasecmp
(
value
,
"rw"
)
==
0
)
ro
=
0
;
ro
=
false
;
else
else
goto
invalid_fs
;
goto
invalid_fs
;
secs
=
0
;
heads
=
0
;
reserved
=
0
;
bs
=
0
;
bp
=
0
;
secs
=
0
;
heads
=
0
;
reserved
=
0
;
bs
=
0
;
bp
=
0
;
...
@@ -1974,7 +2005,7 @@ add_filesys_unit (struct uaedev_mount_info *mountinfo, const char *devname, cons
...
@@ -1974,7 +2005,7 @@ add_filesys_unit (struct uaedev_mount_info *mountinfo, const char *devname, cons
*
tmpp
++
=
0
;
*
tmpp
++
=
0
;
if
(
!
getintval
(
&
tmpp
,
&
bp
,
0
))
if
(
!
getintval
(
&
tmpp
,
&
bp
,
0
))
goto
empty_fs
;
goto
empty_fs
;
}
else
{
}
else
{
tmpp
=
_tcschr
(
value
,
':'
);
tmpp
=
_tcschr
(
value
,
':'
);
if
(
tmpp
==
0
)
if
(
tmpp
==
0
)
goto
invalid_fs
;
goto
invalid_fs
;
...
@@ -2101,7 +2132,7 @@ static int cfgfile_separate_linea (char *line, char *line1b, char *line2b)
...
@@ -2101,7 +2132,7 @@ static int cfgfile_separate_linea (char *line, char *line1b, char *line2b)
static
int
cfgfile_separate_line
(
char
*
line
,
char
*
line1b
,
char
*
line2b
)
static
int
cfgfile_separate_line
(
char
*
line
,
char
*
line1b
,
char
*
line2b
)
{
{
char
*
line1
,
*
line2
;
TCHAR
*
line1
,
*
line2
;
int
i
;
int
i
;
line1
=
line
;
line1
=
line
;
...
@@ -2127,7 +2158,7 @@ static int cfgfile_separate_line (char *line, char *line1b, char *line2b)
...
@@ -2127,7 +2158,7 @@ static int cfgfile_separate_line (char *line, char *line1b, char *line2b)
_tcscpy
(
line1b
,
line
);
_tcscpy
(
line1b
,
line
);
if
(
line2b
[
0
]
==
'"'
||
line2b
[
0
]
==
'\"'
)
{
if
(
line2b
[
0
]
==
'"'
||
line2b
[
0
]
==
'\"'
)
{
char
c
=
line2b
[
0
];
TCHAR
c
=
line2b
[
0
];
int
i
=
0
;
int
i
=
0
;
memmove
(
line2b
,
line2b
+
1
,
(
_tcslen
(
line2b
)
+
1
)
*
sizeof
(
char
));
memmove
(
line2b
,
line2b
+
1
,
(
_tcslen
(
line2b
)
+
1
)
*
sizeof
(
char
));
while
(
line2b
[
i
]
!=
0
&&
line2b
[
i
]
!=
c
)
while
(
line2b
[
i
]
!=
0
&&
line2b
[
i
]
!=
c
)
...
@@ -2142,14 +2173,14 @@ static int cfgfile_separate_line (char *line, char *line1b, char *line2b)
...
@@ -2142,14 +2173,14 @@ static int cfgfile_separate_line (char *line, char *line1b, char *line2b)
static
int
isobsolete
(
char
*
s
)
static
int
isobsolete
(
char
*
s
)
{
{
int
i
=
0
;
int
i
=
0
;
while
(
obsolete
[
i
])
{
while
(
obsolete
[
i
])
{
if
(
!
strcasecmp
(
s
,
obsolete
[
i
]))
{
if
(
!
strcasecmp
(
s
,
obsolete
[
i
]))
{
write_log
(
"obsolete config entry '%s'
\n
"
,
s
);
write_log
(
"obsolete config entry '%s'
\n
"
,
s
);
return
1
;
return
1
;
}
i
++
;
}
}
i
++
;
}
if
(
strlen
(
s
)
>=
10
&&
!
memcmp
(
s
,
"gfx_opengl"
,
10
))
{
if
(
strlen
(
s
)
>=
10
&&
!
memcmp
(
s
,
"gfx_opengl"
,
10
))
{
write_log
(
"obsolete config entry '%s
\n
"
,
s
);
write_log
(
"obsolete config entry '%s
\n
"
,
s
);
return
1
;
return
1
;
...
@@ -2163,13 +2194,13 @@ static int isobsolete (char *s)
...
@@ -2163,13 +2194,13 @@ static int isobsolete (char *s)
static
void
cfgfile_parse_separated_line
(
struct
uae_prefs
*
p
,
char
*
line1b
,
char
*
line2b
,
int
type
)
static
void
cfgfile_parse_separated_line
(
struct
uae_prefs
*
p
,
char
*
line1b
,
char
*
line2b
,
int
type
)
{
{
char
line3b
[
CONFIG_BLEN
],
line4b
[
CONFIG_BLEN
];
TCHAR
line3b
[
CONFIG_BLEN
],
line4b
[
CONFIG_BLEN
];
struct
strlist
*
sl
;
struct
strlist
*
sl
;
int
ret
;
int
ret
;
_tcscpy
(
line3b
,
line1b
);
_tcscpy
(
line3b
,
line1b
);
_tcscpy
(
line4b
,
line2b
);
_tcscpy
(
line4b
,
line2b
);
ret
=
cfgfile_parse_option
(
p
,
line1b
,
line2b
,
type
);
ret
=
cfgfile_parse_option
(
p
,
line1b
,
line2b
,
type
);
if
(
!
isobsolete
(
line3b
))
{
if
(
!
isobsolete
(
line3b
))
{
for
(
sl
=
p
->
all_lines
;
sl
;
sl
=
sl
->
next
)
{
for
(
sl
=
p
->
all_lines
;
sl
;
sl
=
sl
->
next
)
{
if
(
sl
->
option
&&
!
strcasecmp
(
line1b
,
sl
->
option
))
break
;
if
(
sl
->
option
&&
!
strcasecmp
(
line1b
,
sl
->
option
))
break
;
...
@@ -2183,103 +2214,104 @@ static void cfgfile_parse_separated_line (struct uae_prefs *p, char *line1b, cha
...
@@ -2183,103 +2214,104 @@ static void cfgfile_parse_separated_line (struct uae_prefs *p, char *line1b, cha
if
(
!
ret
)
{
if
(
!
ret
)
{
u
->
unknown
=
1
;
u
->
unknown
=
1
;
write_log
(
"unknown config entry: '%s=%s'
\n
"
,
u
->
option
,
u
->
value
);
write_log
(
"unknown config entry: '%s=%s'
\n
"
,
u
->
option
,
u
->
value
);
}
}
}
}
}
}
}
}
void
cfgfile_parse_line
(
struct
uae_prefs
*
p
,
char
*
line
,
int
type
)
void
cfgfile_parse_line
(
struct
uae_prefs
*
p
,
TCHAR
*
line
,
int
type
)
{
{
char
line1b
[
CONFIG_BLEN
],
line2b
[
CONFIG_BLEN
];
TCHAR
line1b
[
CONFIG_BLEN
],
line2b
[
CONFIG_BLEN
];
if
(
!
cfgfile_separate_line
(
line
,
line1b
,
line2b
))
if
(
!
cfgfile_separate_line
(
line
,
line1b
,
line2b
))
return
;
cfgfile_parse_separated_line
(
p
,
line1b
,
line2b
,
type
);
return
;
return
;
cfgfile_parse_separated_line
(
p
,
line1b
,
line2b
,
type
);
return
;
}
}
static
void
subst
(
const
char
*
p
,
char
*
f
,
int
n
)
static
void
subst
(
TCHAR
*
p
,
TCHAR
*
f
,
int
n
)
{
{
char
*
str
=
cfgfile_subst_path
(
UNEXPANDED
,
p
,
f
);
TCHAR
*
str
=
cfgfile_subst_path
(
UNEXPANDED
,
p
,
f
);
str
ncpy
(
f
,
str
,
n
-
1
);
_tcs
ncpy
(
f
,
str
,
n
-
1
);
f
[
n
-
1
]
=
'\0'
;
f
[
n
-
1
]
=
'\0'
;
free
(
str
);
free
(
str
);
}
}
static
char
*
cfg_fgets
(
char
*
line
,
int
max
,
FILE
*
fh
)
static
char
*
cfg_fgets
(
char
*
line
,
int
max
,
FILE
*
fh
)
{
{
#ifdef SINGLEFILE
#ifdef SINGLEFILE
extern
char
singlefile_config
[];
extern
TCHAR
singlefile_config
[];
static
char
*
sfile_ptr
;
static
TCHAR
*
sfile_ptr
;
char
*
p
;
TCHAR
*
p
;
#endif
#endif
if
(
fh
)
if
(
fh
)
return
fgets
(
line
,
max
,
fh
);
return
fgets
(
line
,
max
,
fh
);
#ifdef SINGLEFILE
#ifdef SINGLEFILE
if
(
sfile_ptr
==
0
)
{
if
(
sfile_ptr
==
0
)
{
sfile_ptr
=
singlefile_config
;
sfile_ptr
=
singlefile_config
;
if
(
*
sfile_ptr
)
{
if
(
*
sfile_ptr
)
{
write_log
(
"singlefile config found
\n
"
);
write_log
(
"singlefile config found
\n
"
);
while
(
*
sfile_ptr
++
);
while
(
*
sfile_ptr
++
);
}
}
}
}
if
(
*
sfile_ptr
==
0
)
{
if
(
*
sfile_ptr
==
0
)
{
sfile_ptr
=
singlefile_config
;
sfile_ptr
=
singlefile_config
;
return
0
;
return
0
;
}
}
p
=
sfile_ptr
;
p
=
sfile_ptr
;
while
(
*
p
!=
13
&&
*
p
!=
10
&&
*
p
!=
0
)
p
++
;
while
(
*
p
!=
13
&&
*
p
!=
10
&&
*
p
!=
0
)
p
++
;
memset
(
line
,
0
,
max
);
memset
(
line
,
0
,
max
);
memcpy
(
line
,
sfile_ptr
,
(
p
-
sfile_ptr
)
*
sizeof
(
TCHAR
));
memcpy
(
line
,
sfile_ptr
,
p
-
sfile_ptr
);
sfile_ptr
=
p
+
1
;
sfile_ptr
=
p
+
1
;
if
(
*
sfile_ptr
==
13
)
if
(
*
sfile_ptr
==
13
)
sfile_ptr
++
;
sfile_ptr
++
;
if
(
*
sfile_ptr
==
10
)
if
(
*
sfile_ptr
==
10
)
sfile_ptr
++
;
sfile_ptr
++
;
return
line
;
return
line
;
#endif
#endif
return
0
;
return
0
;
}
}
static
int
cfgfile_load_2
(
struct
uae_prefs
*
p
,
const
char
*
filename
,
int
real
,
int
*
type
)
static
int
cfgfile_load_2
(
struct
uae_prefs
*
p
,
const
char
*
filename
,
int
real
,
int
*
type
)
{
{
int
i
;
int
i
;
FILE
*
fh
;
FILE
*
fh
;
char
linea
[
CONFIG_BLEN
];
char
linea
[
CONFIG_BLEN
];
char
line
[
CONFIG_BLEN
],
line1b
[
CONFIG_BLEN
],
line2b
[
CONFIG_BLEN
];
TCHAR
line
[
CONFIG_BLEN
],
line1b
[
CONFIG_BLEN
],
line2b
[
CONFIG_BLEN
];
struct
strlist
*
sl
;
struct
strlist
*
sl
;
int
type1
=
0
,
type2
=
0
,
askedtype
=
0
;
bool
type1
=
false
,
type2
=
false
;
int
askedtype
=
0
;
if
(
type
)
{
if
(
type
)
{
askedtype
=
*
type
;
askedtype
=
*
type
;
*
type
=
0
;
*
type
=
0
;
}
}
if
(
real
)
{
if
(
real
)
{
p
->
config_version
=
0
;
p
->
config_version
=
0
;
config_newfilesystem
=
0
;
config_newfilesystem
=
0
;
reset_inputdevice_config
(
p
);
//
reset_inputdevice_config (p);
}
}
write_log
(
"Opening cfgfile '%s': "
,
filename
);
write_log
(
"Opening cfgfile '%s': "
,
filename
);
fh
=
fopen
(
filename
,
"r"
);
fh
=
fopen
(
filename
,
"r"
);
#ifndef SINGLEFILE
#ifndef SINGLEFILE
if
(
!
fh
)
{
if
(
!
fh
)
{
write_log
(
"failed
\n
"
);
write_log
(
"failed
\n
"
);
return
0
;
return
0
;
}
}
#endif
#endif
write_log
(
"okay.
\n
"
);
write_log
(
"okay.
\n
"
);
while
(
cfg_fgets
(
linea
,
sizeof
(
linea
),
fh
)
!=
0
)
{
while
(
cfg_fgets
(
linea
,
sizeof
(
linea
),
fh
)
!=
0
)
{
trimwsa
(
linea
);
trimwsa
(
linea
);
//write_log ("%s\n",linea);
//write_log ("%s\n",linea);
if
(
strlen
(
linea
)
>
0
)
{
if
(
strlen
(
linea
)
>
0
)
{
if
(
linea
[
0
]
==
'#'
||
linea
[
0
]
==
';'
)
if
(
linea
[
0
]
==
'#'
||
linea
[
0
]
==
';'
)
continue
;
continue
;
if
(
!
cfgfile_separate_linea
(
linea
,
line1b
,
line2b
))
if
(
!
cfgfile_separate_linea
(
linea
,
line1b
,
line2b
))
continue
;
continue
;
type1
=
type2
=
0
;
type1
=
type2
=
0
;
if
(
cfgfile_yesno
(
line1b
,
line2b
,
"config_hardware"
,
&
type1
)
||
if
(
cfgfile_yesno
(
line1b
,
line2b
,
"config_hardware"
,
&
type1
)
||
cfgfile_yesno
(
line1b
,
line2b
,
"config_host"
,
&
type2
))
{
cfgfile_yesno
(
line1b
,
line2b
,
"config_host"
,
&
type2
))
{
if
(
type1
&&
type
)
if
(
type1
&&
type
)
...
@@ -2288,28 +2320,28 @@ static int cfgfile_load_2 (struct uae_prefs *p, const char *filename, int real,
...
@@ -2288,28 +2320,28 @@ static int cfgfile_load_2 (struct uae_prefs *p, const char *filename, int real,
*
type
|=
CONFIG_TYPE_HOST
;
*
type
|=
CONFIG_TYPE_HOST
;
continue
;
continue
;
}
}
if
(
real
)
{
if
(
real
)
{
cfgfile_parse_separated_line
(
p
,
line1b
,
line2b
,
askedtype
);
cfgfile_parse_separated_line
(
p
,
line1b
,
line2b
,
askedtype
);
}
else
{
}
else
{
cfgfile_string
(
line1b
,
line2b
,
"config_description"
,
p
->
description
,
sizeof
p
->
description
/
sizeof
(
char
));
cfgfile_string
(
line1b
,
line2b
,
"config_description"
,
p
->
description
,
sizeof
p
->
description
/
sizeof
(
char
));
cfgfile_string
(
line1b
,
line2b
,
"config_hardware_path"
,
p
->
config_hardware_path
,
sizeof
p
->
config_hardware_path
/
sizeof
(
char
));
cfgfile_string
(
line1b
,
line2b
,
"config_hardware_path"
,
p
->
config_hardware_path
,
sizeof
p
->
config_hardware_path
/
sizeof
(
char
));
cfgfile_string
(
line1b
,
line2b
,
"config_host_path"
,
p
->
config_host_path
,
sizeof
p
->
config_host_path
/
sizeof
(
char
));
cfgfile_string
(
line1b
,
line2b
,
"config_host_path"
,
p
->
config_host_path
,
sizeof
p
->
config_host_path
/
sizeof
(
char
));
}
}
}
}
}
}
if
(
type
&&
*
type
==
0
)
if
(
type
&&
*
type
==
0
)
*
type
=
CONFIG_TYPE_HARDWARE
|
CONFIG_TYPE_HOST
;
*
type
=
CONFIG_TYPE_HARDWARE
|
CONFIG_TYPE_HOST
;
if
(
fh
)
if
(
fh
)
fclose
(
fh
);
fclose
(
fh
);
if
(
!
real
)
if
(
!
real
)
return
1
;
return
1
;
for
(
sl
=
temp_lines
;
sl
;
sl
=
sl
->
next
)
{
for
(
sl
=
temp_lines
;
sl
;
sl
=
sl
->
next
)
{
sprintf
(
line
,
"%s=%s"
,
sl
->
option
,
sl
->
value
);
sprintf
(
line
,
"%s=%s"
,
sl
->
option
,
sl
->
value
);
cfgfile_parse_line
(
p
,
line
,
0
);
cfgfile_parse_line
(
p
,
line
,
0
);
}
}
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
subst
(
prefs_get_attr
(
"floppy_path"
),
p
->
df
[
i
],
sizeof
p
->
df
[
i
]);
subst
(
prefs_get_attr
(
"floppy_path"
),
p
->
df
[
i
],
sizeof
p
->
df
[
i
]);
...
@@ -2330,25 +2362,25 @@ int cfgfile_save (const struct uae_prefs *p, const char *filename, int type)
...
@@ -2330,25 +2362,25 @@ int cfgfile_save (const struct uae_prefs *p, const char *filename, int type)
{
{
FILE
*
fh
=
fopen
(
filename
,
"w"
);
FILE
*
fh
=
fopen
(
filename
,
"w"
);
write_log
(
"save config '%s'
\n
"
,
filename
);
write_log
(
"save config '%s'
\n
"
,
filename
);
if
(
!
fh
)
if
(
!
fh
)
return
0
;
return
0
;
if
(
!
type
)
if
(
!
type
)
type
=
CONFIG_TYPE_HARDWARE
|
CONFIG_TYPE_HOST
;
type
=
CONFIG_TYPE_HARDWARE
|
CONFIG_TYPE_HOST
;
cfgfile_save_options
(
fh
,
p
,
type
);
cfgfile_save_options
(
fh
,
p
,
type
);
fclose
(
fh
);
fclose
(
fh
);
return
1
;
return
1
;
}
}
int
cfgfile_get_description
(
const
char
*
filename
,
char
*
description
,
char
*
hostlink
,
char
*
hardwarelink
,
int
*
type
)
int
cfgfile_get_description
(
const
char
*
filename
,
char
*
description
,
char
*
hostlink
,
char
*
hardwarelink
,
int
*
type
)
{
{
int
result
=
0
;
int
result
=
0
;
struct
uae_prefs
*
p
=
xmalloc
(
struct
uae_prefs
,
1
);
struct
uae_prefs
*
p
=
xmalloc
(
struct
uae_prefs
,
1
);
p
->
description
[
0
]
=
0
;
p
->
description
[
0
]
=
0
;
p
->
config_host_path
[
0
]
=
0
;
p
->
config_host_path
[
0
]
=
0
;
p
->
config_hardware_path
[
0
]
=
0
;
p
->
config_hardware_path
[
0
]
=
0
;
if
(
cfgfile_load_2
(
p
,
filename
,
0
,
type
))
{
if
(
cfgfile_load_2
(
p
,
filename
,
0
,
type
))
{
result
=
1
;
result
=
1
;
if
(
description
)
if
(
description
)
strcpy
(
description
,
p
->
description
);
strcpy
(
description
,
p
->
description
);
...
@@ -2356,9 +2388,9 @@ int cfgfile_get_description (const char *filename, char *description, char *host
...
@@ -2356,9 +2388,9 @@ int cfgfile_get_description (const char *filename, char *description, char *host
strcpy
(
hostlink
,
p
->
config_host_path
);
strcpy
(
hostlink
,
p
->
config_host_path
);
if
(
hardwarelink
)
if
(
hardwarelink
)
strcpy
(
hardwarelink
,
p
->
config_hardware_path
);
strcpy
(
hardwarelink
,
p
->
config_hardware_path
);
}
}
xfree
(
p
);
xfree
(
p
);
return
result
;
return
result
;
}
}
int
cfgfile_configuration_change
(
int
v
)
int
cfgfile_configuration_change
(
int
v
)
...
@@ -2374,7 +2406,7 @@ void cfgfile_show_usage (void)
...
@@ -2374,7 +2406,7 @@ void cfgfile_show_usage (void)
unsigned
int
i
;
unsigned
int
i
;
write_log
(
"UAE Configuration Help:
\n
"
\
write_log
(
"UAE Configuration Help:
\n
"
\
"=======================
\n
"
);
"=======================
\n
"
);
for
(
i
=
0
;
i
<
sizeof
opttable
/
sizeof
*
opttable
;
i
++
)
for
(
i
=
0
;
i
<
sizeof
opttable
/
sizeof
*
opttable
;
i
++
)
write_log
(
"%s: %s
\n
"
,
opttable
[
i
].
config_label
,
opttable
[
i
].
config_help
);
write_log
(
"%s: %s
\n
"
,
opttable
[
i
].
config_label
,
opttable
[
i
].
config_help
);
}
}
...
@@ -2384,16 +2416,16 @@ void cfgfile_show_usage (void)
...
@@ -2384,16 +2416,16 @@ void cfgfile_show_usage (void)
is far less annoying to use. */
is far less annoying to use. */
static
void
parse_gfx_specs
(
struct
uae_prefs
*
p
,
char
*
spec
)
static
void
parse_gfx_specs
(
struct
uae_prefs
*
p
,
char
*
spec
)
{
{
char
*
x0
=
my_strdup
(
spec
);
TCHAR
*
x0
=
my_strdup
(
spec
);
char
*
x1
,
*
x2
;
TCHAR
*
x1
,
*
x2
;
x1
=
str
chr
(
x0
,
':'
);
x1
=
_tcs
chr
(
x0
,
':'
);
if
(
x1
==
0
)
if
(
x1
==
0
)
goto
argh
;
goto
argh
;
x2
=
str
chr
(
x1
+
1
,
':'
);
x2
=
_tcs
chr
(
x1
+
1
,
':'
);
if
(
x2
==
0
)
if
(
x2
==
0
)
goto
argh
;
goto
argh
;
*
x1
++
=
0
;
*
x2
++
=
0
;
*
x1
++
=
0
;
*
x2
++
=
0
;
p
->
gfx_width_win
=
p
->
gfx_width_fs
=
atoi
(
x0
);
p
->
gfx_width_win
=
p
->
gfx_width_fs
=
atoi
(
x0
);
p
->
gfx_height_win
=
p
->
gfx_height_fs
=
atoi
(
x1
);
p
->
gfx_height_win
=
p
->
gfx_height_fs
=
atoi
(
x1
);
...
@@ -2407,24 +2439,24 @@ static void parse_gfx_specs (struct uae_prefs *p, char *spec)
...
@@ -2407,24 +2439,24 @@ static void parse_gfx_specs (struct uae_prefs *p, char *spec)
p
->
gfx_afullscreen
=
strchr
(
x2
,
'a'
)
!=
0
;
p
->
gfx_afullscreen
=
strchr
(
x2
,
'a'
)
!=
0
;
p
->
gfx_pfullscreen
=
strchr
(
x2
,
'p'
)
!=
0
;
p
->
gfx_pfullscreen
=
strchr
(
x2
,
'p'
)
!=
0
;
if
(
p
->
gfx_linedbl
==
3
)
{
if
(
p
->
gfx_linedbl
==
3
)
{
write_log
(
"You can't use both 'd' and 'D' modifiers in the display mode specification.
\n
"
);
write_log
(
"You can't use both 'd' and 'D' modifiers in the display mode specification.
\n
"
);
}
}
free
(
x0
);
free
(
x0
);
return
;
return
;
argh:
argh:
write_log
(
"Bad display mode specification.
\n
"
);
write_log
(
"Bad display mode specification.
\n
"
);
write_log
(
"The format to use is:
\"
width:height:modifiers
\"\n
"
);
write_log
(
"The format to use is:
\"
width:height:modifiers
\"\n
"
);
write_log
(
"Type
\"
uae -h
\"
for detailed help.
\n
"
);
write_log
(
"Type
\"
uae -h
\"
for detailed help.
\n
"
);
free
(
x0
);
free
(
x0
);
}
}
static
void
parse_sound_spec
(
struct
uae_prefs
*
p
,
char
*
spec
)
static
void
parse_sound_spec
(
struct
uae_prefs
*
p
,
char
*
spec
)
{
{
char
*
x0
=
my_strdup
(
spec
);
TCHAR
*
x0
=
my_strdup
(
spec
);
char
*
x1
,
*
x2
=
NULL
,
*
x3
=
NULL
,
*
x4
=
NULL
,
*
x5
=
NULL
;
TCHAR
*
x1
,
*
x2
=
NULL
,
*
x3
=
NULL
,
*
x4
=
NULL
,
*
x5
=
NULL
;
x1
=
_tcschr
(
x0
,
':'
);
x1
=
_tcschr
(
x0
,
':'
);
if
(
x1
!=
NULL
)
{
if
(
x1
!=
NULL
)
{
...
@@ -2465,33 +2497,33 @@ static void parse_sound_spec (struct uae_prefs *p, char *spec)
...
@@ -2465,33 +2497,33 @@ static void parse_sound_spec (struct uae_prefs *p, char *spec)
static
void
parse_joy_spec
(
struct
uae_prefs
*
p
,
char
*
spec
)
static
void
parse_joy_spec
(
struct
uae_prefs
*
p
,
char
*
spec
)
{
{
int
v0
=
2
,
v1
=
0
;
int
v0
=
2
,
v1
=
0
;
if
(
_tcslen
(
spec
)
!=
2
)
if
(
_tcslen
(
spec
)
!=
2
)
goto
bad
;
goto
bad
;
switch
(
spec
[
0
])
{
switch
(
spec
[
0
])
{
case
'0'
:
v0
=
JSEM_JOYS
;
break
;
case
'0'
:
v0
=
JSEM_JOYS
;
break
;
case
'1'
:
v0
=
JSEM_JOYS
+
1
;
break
;
case
'1'
:
v0
=
JSEM_JOYS
+
1
;
break
;
case
'M'
:
case
'm'
:
v0
=
JSEM_MICE
;
break
;
case
'M'
:
case
'm'
:
v0
=
JSEM_MICE
;
break
;
case
'A'
:
case
'a'
:
v0
=
JSEM_KBDLAYOUT
;
break
;
case
'A'
:
case
'a'
:
v0
=
JSEM_KBDLAYOUT
;
break
;
case
'B'
:
case
'b'
:
v0
=
JSEM_KBDLAYOUT
+
1
;
break
;
case
'B'
:
case
'b'
:
v0
=
JSEM_KBDLAYOUT
+
1
;
break
;
case
'C'
:
case
'c'
:
v0
=
JSEM_KBDLAYOUT
+
2
;
break
;
case
'C'
:
case
'c'
:
v0
=
JSEM_KBDLAYOUT
+
2
;
break
;
default:
goto
bad
;
default:
goto
bad
;
}
}
switch
(
spec
[
1
])
{
switch
(
spec
[
1
])
{
case
'0'
:
v1
=
JSEM_JOYS
;
break
;
case
'0'
:
v1
=
JSEM_JOYS
;
break
;
case
'1'
:
v1
=
JSEM_JOYS
+
1
;
break
;
case
'1'
:
v1
=
JSEM_JOYS
+
1
;
break
;
case
'M'
:
case
'm'
:
v1
=
JSEM_MICE
;
break
;
case
'M'
:
case
'm'
:
v1
=
JSEM_MICE
;
break
;
case
'A'
:
case
'a'
:
v1
=
JSEM_KBDLAYOUT
;
break
;
case
'A'
:
case
'a'
:
v1
=
JSEM_KBDLAYOUT
;
break
;
case
'B'
:
case
'b'
:
v1
=
JSEM_KBDLAYOUT
+
1
;
break
;
case
'B'
:
case
'b'
:
v1
=
JSEM_KBDLAYOUT
+
1
;
break
;
case
'C'
:
case
'c'
:
v1
=
JSEM_KBDLAYOUT
+
2
;
break
;
case
'C'
:
case
'c'
:
v1
=
JSEM_KBDLAYOUT
+
2
;
break
;
default:
goto
bad
;
default:
goto
bad
;
}
}
if
(
v0
==
v1
)
if
(
v0
==
v1
)
goto
bad
;
goto
bad
;
/* Let's scare Pascal programmers */
/* Let's scare Pascal programmers */
if
(
0
)
if
(
0
)
bad:
bad:
write_log
(
"Bad joystick mode specification. Use -J xy, where x and y
\n
"
write_log
(
"Bad joystick mode specification. Use -J xy, where x and y
\n
"
"can be 0 for joystick 0, 1 for joystick 1, M for mouse, and
\n
"
"can be 0 for joystick 0, 1 for joystick 1, M for mouse, and
\n
"
...
@@ -2503,8 +2535,8 @@ bad:
...
@@ -2503,8 +2535,8 @@ bad:
static
void
parse_filesys_spec
(
int
readonly
,
const
char
*
spec
)
static
void
parse_filesys_spec
(
int
readonly
,
const
char
*
spec
)
{
{
char
buf
[
256
];
TCHAR
buf
[
256
];
char
*
s2
;
TCHAR
*
s2
;
_tcsncpy
(
buf
,
spec
,
255
);
buf
[
255
]
=
0
;
_tcsncpy
(
buf
,
spec
,
255
);
buf
[
255
]
=
0
;
s2
=
_tcschr
(
buf
,
':'
);
s2
=
_tcschr
(
buf
,
':'
);
...
@@ -2541,8 +2573,8 @@ add_filesys_unit (struct uaedev_mount_info *mountinfo, const char *devname, cons
...
@@ -2541,8 +2573,8 @@ add_filesys_unit (struct uaedev_mount_info *mountinfo, const char *devname, cons
static
void
parse_hardfile_spec
(
char
*
spec
)
static
void
parse_hardfile_spec
(
char
*
spec
)
{
{
char
*
x0
=
my_strdup
(
spec
);
TCHAR
*
x0
=
my_strdup
(
spec
);
char
*
x1
,
*
x2
,
*
x3
,
*
x4
;
TCHAR
*
x1
,
*
x2
,
*
x3
,
*
x4
;
x1
=
_tcschr
(
x0
,
':'
);
x1
=
_tcschr
(
x0
,
':'
);
if
(
x1
==
NULL
)
if
(
x1
==
NULL
)
...
@@ -2575,13 +2607,13 @@ add_filesys_unit (struct uaedev_mount_info *mountinfo, const char *devname, cons
...
@@ -2575,13 +2607,13 @@ add_filesys_unit (struct uaedev_mount_info *mountinfo, const char *devname, cons
write_log
(
"%s
\n
"
,
err_msg
);
write_log
(
"%s
\n
"
,
err_msg
);
}
}
#endif
#endif
free
(
x0
);
free
(
x0
);
return
;
return
;
argh:
argh:
free
(
x0
);
free
(
x0
);
write_log
(
"Bad hardfile parameter specified - type
\"
uae -h
\"
for help.
\n
"
);
write_log
(
"Bad hardfile parameter specified - type
\"
uae -h
\"
for help.
\n
"
);
return
;
return
;
}
}
static
void
parse_cpu_specs
(
struct
uae_prefs
*
p
,
char
*
spec
)
static
void
parse_cpu_specs
(
struct
uae_prefs
*
p
,
char
*
spec
)
...
@@ -2589,11 +2621,11 @@ static void parse_cpu_specs (struct uae_prefs *p, char *spec)
...
@@ -2589,11 +2621,11 @@ static void parse_cpu_specs (struct uae_prefs *p, char *spec)
if
(
*
spec
<
'0'
||
*
spec
>
'4'
)
{
if
(
*
spec
<
'0'
||
*
spec
>
'4'
)
{
write_log
(
"CPU parameter string must begin with '0', '1', '2', '3' or '4'.
\n
"
);
write_log
(
"CPU parameter string must begin with '0', '1', '2', '3' or '4'.
\n
"
);
return
;
return
;
}
}
p
->
cpu_model
=
(
*
spec
++
)
*
10
+
68000
;
p
->
cpu_model
=
(
*
spec
++
)
*
10
+
68000
;
p
->
address_space_24
=
p
->
cpu_model
<
68020
;
p
->
address_space_24
=
p
->
cpu_model
<
68020
;
p
->
cpu_compatible
=
0
;
p
->
cpu_compatible
=
0
;
while
(
*
spec
!=
'\0'
)
{
while
(
*
spec
!=
'\0'
)
{
switch
(
*
spec
)
{
switch
(
*
spec
)
{
case
'a'
:
case
'a'
:
...
@@ -2622,23 +2654,23 @@ static void parse_cpu_specs (struct uae_prefs *p, char *spec)
...
@@ -2622,23 +2654,23 @@ static void parse_cpu_specs (struct uae_prefs *p, char *spec)
/* Returns the number of args used up (0 or 1). */
/* Returns the number of args used up (0 or 1). */
int
parse_cmdline_option
(
struct
uae_prefs
*
p
,
char
c
,
char
*
arg
)
int
parse_cmdline_option
(
struct
uae_prefs
*
p
,
char
c
,
char
*
arg
)
{
{
struct
strlist
*
u
=
xcalloc
(
struct
strlist
,
1
);
struct
strlist
*
u
=
xcalloc
(
struct
strlist
,
1
);
const
char
arg_required
[]
=
"0123rKpImWSAJwNCZUFcblOdHRv"
;
const
TCHAR
arg_required
[]
=
"0123rKpImWSAJwNCZUFcblOdHRv"
;
if
(
str
chr
(
arg_required
,
c
)
&&
!
arg
)
{
if
(
_tcs
chr
(
arg_required
,
c
)
&&
!
arg
)
{
write_log
(
"Missing argument for option `-%c'!
\n
"
,
c
);
write_log
(
"Missing argument for option `-%c'!
\n
"
,
c
);
return
0
;
return
0
;
}
}
u
->
option
=
xmalloc
(
char
,
2
);
u
->
option
=
xmalloc
(
TCHAR
,
2
);
u
->
option
[
0
]
=
c
;
u
->
option
[
0
]
=
c
;
u
->
option
[
1
]
=
0
;
u
->
option
[
1
]
=
0
;
u
->
value
=
arg
?
my_strdup
(
arg
)
:
NULL
;
u
->
value
=
my_strdup
(
arg
)
;
u
->
next
=
p
->
all_lines
;
u
->
next
=
p
->
all_lines
;
p
->
all_lines
=
u
;
p
->
all_lines
=
u
;
switch
(
c
)
{
switch
(
c
)
{
case
'h'
:
usage
();
exit
(
0
);
case
'h'
:
usage
();
exit
(
0
);
case
'0'
:
strncpy
(
p
->
df
[
0
],
arg
,
255
);
p
->
df
[
0
][
255
]
=
0
;
break
;
case
'0'
:
strncpy
(
p
->
df
[
0
],
arg
,
255
);
p
->
df
[
0
][
255
]
=
0
;
break
;
case
'1'
:
strncpy
(
p
->
df
[
1
],
arg
,
255
);
p
->
df
[
1
][
255
]
=
0
;
break
;
case
'1'
:
strncpy
(
p
->
df
[
1
],
arg
,
255
);
p
->
df
[
1
][
255
]
=
0
;
break
;
...
@@ -2650,11 +2682,11 @@ int parse_cmdline_option (struct uae_prefs *p, char c, char *arg)
...
@@ -2650,11 +2682,11 @@ int parse_cmdline_option (struct uae_prefs *p, char c, char *arg)
/* case 'I': strncpy (p->sername, arg, 255); p->sername[255] = 0; currprefs.use_serial = 1; break; */
/* case 'I': strncpy (p->sername, arg, 255); p->sername[255] = 0; currprefs.use_serial = 1; break; */
case
'm'
:
case
'M'
:
parse_filesys_spec
(
c
==
'M'
,
arg
);
break
;
case
'm'
:
case
'M'
:
parse_filesys_spec
(
c
==
'M'
,
arg
);
break
;
case
'W'
:
parse_hardfile_spec
(
arg
);
break
;
case
'W'
:
parse_hardfile_spec
(
arg
);
break
;
case
'S'
:
parse_sound_spec
(
p
,
arg
);
break
;
case
'S'
:
parse_sound_spec
(
p
,
arg
);
break
;
case
'R'
:
p
->
gfx_framerate
=
atoi
(
arg
);
break
;
case
'R'
:
p
->
gfx_framerate
=
atoi
(
arg
);
break
;
case
'x'
:
p
->
no_xhair
=
1
;
break
;
case
'x'
:
p
->
no_xhair
=
1
;
break
;
case
'i'
:
p
->
illegal_mem
=
1
;
break
;
case
'i'
:
p
->
illegal_mem
=
1
;
break
;
case
'J'
:
parse_joy_spec
(
p
,
arg
);
break
;
case
'J'
:
parse_joy_spec
(
p
,
arg
);
break
;
#if defined USE_X11_GFX
#if defined USE_X11_GFX
case
'L'
:
p
->
x11_use_low_bandwidth
=
1
;
break
;
case
'L'
:
p
->
x11_use_low_bandwidth
=
1
;
break
;
...
@@ -2668,81 +2700,81 @@ int parse_cmdline_option (struct uae_prefs *p, char c, char *arg)
...
@@ -2668,81 +2700,81 @@ int parse_cmdline_option (struct uae_prefs *p, char c, char *arg)
case
'w'
:
p
->
m68k_speed
=
atoi
(
arg
);
break
;
case
'w'
:
p
->
m68k_speed
=
atoi
(
arg
);
break
;
/* case 'g': p->use_gfxlib = 1; break; */
/* case 'g': p->use_gfxlib = 1; break; */
case
'G'
:
p
->
start_gui
=
0
;
break
;
case
'G'
:
p
->
start_gui
=
0
;
break
;
#ifdef DEBUGGER
#ifdef DEBUGGER
case
'D'
:
p
->
start_debugger
=
1
;
break
;
case
'D'
:
p
->
start_debugger
=
1
;
break
;
#endif
#endif
case
'n'
:
case
'n'
:
if
(
str
chr
(
arg
,
'i'
)
!=
0
)
if
(
_tcs
chr
(
arg
,
'i'
)
!=
0
)
p
->
immediate_blits
=
1
;
p
->
immediate_blits
=
1
;
break
;
break
;
case
'v'
:
case
'v'
:
set_chipset_mask
(
p
,
a
toi
(
arg
));
set_chipset_mask
(
p
,
_ts
toi
(
arg
));
break
;
break
;
case
'C'
:
case
'C'
:
parse_cpu_specs
(
p
,
arg
);
parse_cpu_specs
(
p
,
arg
);
break
;
break
;
case
'Z'
:
case
'Z'
:
p
->
z3fastmem_size
=
a
toi
(
arg
)
*
0x100000
;
p
->
z3fastmem_size
=
_ts
toi
(
arg
)
*
0x100000
;
break
;
break
;
case
'U'
:
case
'U'
:
p
->
gfxmem_size
=
a
toi
(
arg
)
*
0x100000
;
p
->
gfxmem_size
=
_ts
toi
(
arg
)
*
0x100000
;
break
;
break
;
case
'F'
:
case
'F'
:
p
->
fastmem_size
=
a
toi
(
arg
)
*
0x100000
;
p
->
fastmem_size
=
_ts
toi
(
arg
)
*
0x100000
;
break
;
break
;
case
'b'
:
case
'b'
:
p
->
bogomem_size
=
a
toi
(
arg
)
*
0x40000
;
p
->
bogomem_size
=
_ts
toi
(
arg
)
*
0x40000
;
break
;
break
;
case
'c'
:
case
'c'
:
p
->
chipmem_size
=
a
toi
(
arg
)
*
0x80000
;
p
->
chipmem_size
=
_ts
toi
(
arg
)
*
0x80000
;
break
;
break
;
case
'l'
:
case
'l'
:
if
(
0
==
strcasecmp
(
arg
,
"de"
))
if
(
0
==
strcasecmp
(
arg
,
"de"
))
p
->
keyboard_lang
=
KBD_LANG_DE
;
p
->
keyboard_lang
=
KBD_LANG_DE
;
else
if
(
0
==
strcasecmp
(
arg
,
"dk"
))
else
if
(
0
==
strcasecmp
(
arg
,
"dk"
))
p
->
keyboard_lang
=
KBD_LANG_DK
;
p
->
keyboard_lang
=
KBD_LANG_DK
;
else
if
(
0
==
strcasecmp
(
arg
,
"us"
))
else
if
(
0
==
strcasecmp
(
arg
,
"us"
))
p
->
keyboard_lang
=
KBD_LANG_US
;
p
->
keyboard_lang
=
KBD_LANG_US
;
else
if
(
0
==
strcasecmp
(
arg
,
"se"
))
else
if
(
0
==
strcasecmp
(
arg
,
"se"
))
p
->
keyboard_lang
=
KBD_LANG_SE
;
p
->
keyboard_lang
=
KBD_LANG_SE
;
else
if
(
0
==
strcasecmp
(
arg
,
"fr"
))
else
if
(
0
==
strcasecmp
(
arg
,
"fr"
))
p
->
keyboard_lang
=
KBD_LANG_FR
;
p
->
keyboard_lang
=
KBD_LANG_FR
;
else
if
(
0
==
strcasecmp
(
arg
,
"it"
))
else
if
(
0
==
strcasecmp
(
arg
,
"it"
))
p
->
keyboard_lang
=
KBD_LANG_IT
;
p
->
keyboard_lang
=
KBD_LANG_IT
;
else
if
(
0
==
strcasecmp
(
arg
,
"es"
))
else
if
(
0
==
strcasecmp
(
arg
,
"es"
))
p
->
keyboard_lang
=
KBD_LANG_ES
;
p
->
keyboard_lang
=
KBD_LANG_ES
;
break
;
break
;
case
'O'
:
parse_gfx_specs
(
p
,
arg
);
break
;
case
'O'
:
parse_gfx_specs
(
p
,
arg
);
break
;
case
'd'
:
case
'd'
:
if
(
strchr
(
arg
,
'S'
)
!=
NULL
||
str
chr
(
arg
,
's'
))
{
if
(
_tcschr
(
arg
,
'S'
)
!=
NULL
||
_tcs
chr
(
arg
,
's'
))
{
write_log
(
" Serial on demand.
\n
"
);
write_log
(
" Serial on demand.
\n
"
);
p
->
serial_demand
=
1
;
p
->
serial_demand
=
1
;
}
}
if
(
strchr
(
arg
,
'P'
)
!=
NULL
||
str
chr
(
arg
,
'p'
))
{
if
(
_tcschr
(
arg
,
'P'
)
!=
NULL
||
_tcs
chr
(
arg
,
'p'
))
{
write_log
(
" Parallel on demand.
\n
"
);
write_log
(
" Parallel on demand.
\n
"
);
p
->
parallel_demand
=
1
;
p
->
parallel_demand
=
1
;
}
}
break
;
break
;
case
'H'
:
case
'H'
:
#ifndef USE_AMIGA_GFX
#ifndef USE_AMIGA_GFX
p
->
color_mode
=
atoi
(
arg
);
p
->
color_mode
=
atoi
(
arg
);
if
(
p
->
color_mode
<
0
)
{
if
(
p
->
color_mode
<
0
)
{
write_log
(
"Bad color mode selected. Using default.
\n
"
);
write_log
(
"Bad color mode selected. Using default.
\n
"
);
p
->
color_mode
=
0
;
p
->
color_mode
=
0
;
}
}
#else
#else
p
->
amiga_screen_type
=
atoi
(
arg
);
p
->
amiga_screen_type
=
atoi
(
arg
);
if
(
p
->
amiga_screen_type
<
0
||
p
->
amiga_screen_type
>
2
)
{
if
(
p
->
amiga_screen_type
<
0
||
p
->
amiga_screen_type
>
2
)
{
...
@@ -2750,199 +2782,202 @@ int parse_cmdline_option (struct uae_prefs *p, char c, char *arg)
...
@@ -2750,199 +2782,202 @@ int parse_cmdline_option (struct uae_prefs *p, char c, char *arg)
p
->
amiga_screen_type
=
2
;
p
->
amiga_screen_type
=
2
;
}
}
#endif
#endif
break
;
break
;
default:
default:
write_log
(
"Unknown option `-%c'!
\n
"
,
c
);
write_log
(
"Unknown option `-%c'!
\n
"
,
c
);
break
;
break
;
}
}
return
!!
str
chr
(
arg_required
,
c
);
return
!!
_tcs
chr
(
arg_required
,
c
);
}
}
void
cfgfile_addcfgparam
(
char
*
line
)
void
cfgfile_addcfgparam
(
char
*
line
)
{
{
struct
strlist
*
u
;
struct
strlist
*
u
;
char
line1b
[
CONFIG_BLEN
],
line2b
[
CONFIG_BLEN
];
TCHAR
line1b
[
CONFIG_BLEN
],
line2b
[
CONFIG_BLEN
];
if
(
!
line
)
{
if
(
!
line
)
{
struct
strlist
**
ps
=
&
temp_lines
;
struct
strlist
**
ps
=
&
temp_lines
;
while
(
*
ps
)
{
while
(
*
ps
)
{
struct
strlist
*
s
=
*
ps
;
struct
strlist
*
s
=
*
ps
;
*
ps
=
s
->
next
;
*
ps
=
s
->
next
;
xfree
(
s
->
value
);
xfree
(
s
->
value
);
xfree
(
s
->
option
);
xfree
(
s
->
option
);
xfree
(
s
);
xfree
(
s
);
}
temp_lines
=
0
;
return
;
}
}
temp_lines
=
0
;
if
(
!
cfgfile_separate_line
(
line
,
line1b
,
line2b
))
return
;
return
;
}
if
(
!
cfgfile_separate_line
(
line
,
line1b
,
line2b
))
return
;
u
=
xcalloc
(
struct
strlist
,
1
);
u
=
xcalloc
(
struct
strlist
,
1
);
u
->
option
=
my_strdup
(
line1b
);
u
->
option
=
my_strdup
(
line1b
);
u
->
value
=
my_strdup
(
line2b
);
u
->
value
=
my_strdup
(
line2b
);
u
->
next
=
temp_lines
;
u
->
next
=
temp_lines
;
temp_lines
=
u
;
temp_lines
=
u
;
}
}
unsigned
int
cmdlineparser
(
const
char
*
s
,
char
*
outp
[],
unsigned
int
max
)
unsigned
int
cmdlineparser
(
const
char
*
s
,
char
*
outp
[],
unsigned
int
max
)
{
{
int
j
;
int
j
;
unsigned
int
cnt
=
0
;
unsigned
int
cnt
=
0
;
int
slash
=
0
;
int
slash
=
0
;
int
quote
=
0
;
int
quote
=
0
;
char
tmp1
[
MAX_DPATH
];
TCHAR
tmp1
[
MAX_DPATH
];
const
char
*
prev
;
const
char
*
prev
;
int
doout
;
int
doout
;
doout
=
0
;
doout
=
0
;
prev
=
s
;
prev
=
s
;
j
=
0
;
j
=
0
;
while
(
cnt
<
max
)
{
outp
[
0
]
=
0
;
char
c
=
*
s
++
;
while
(
cnt
<
max
)
{
if
(
!
c
)
TCHAR
c
=
*
s
++
;
break
;
if
(
!
c
)
if
(
c
<
32
)
break
;
continue
;
if
(
c
<
32
)
if
(
c
==
'\\'
)
continue
;
slash
=
1
;
if
(
c
==
'\\'
)
if
(
!
slash
&&
c
==
'"'
)
{
slash
=
1
;
if
(
quote
)
{
if
(
!
slash
&&
c
==
'"'
)
{
quote
=
0
;
if
(
quote
)
{
doout
=
1
;
quote
=
0
;
}
else
{
doout
=
1
;
quote
=
1
;
}
else
{
j
=
-
1
;
quote
=
1
;
}
j
=
-
1
;
}
}
if
(
!
quote
&&
c
==
' '
)
}
doout
=
1
;
if
(
!
quote
&&
c
==
' '
)
if
(
!
doout
)
{
doout
=
1
;
if
(
j
>=
0
)
{
if
(
!
doout
)
{
tmp1
[
j
]
=
c
;
if
(
j
>=
0
)
{
tmp1
[
j
+
1
]
=
0
;
tmp1
[
j
]
=
c
;
}
tmp1
[
j
+
1
]
=
0
;
j
++
;
}
j
++
;
}
if
(
doout
)
{
outp
[
cnt
++
]
=
my_strdup
(
tmp1
);
outp
[
cnt
]
=
0
;
tmp1
[
0
]
=
0
;
doout
=
0
;
j
=
0
;
}
slash
=
0
;
}
}
if
(
doout
)
{
if
(
j
>
0
&&
cnt
<
max
)
{
outp
[
cnt
++
]
=
my_strdup
(
tmp1
);
outp
[
cnt
++
]
=
my_strdup
(
tmp1
);
tmp1
[
0
]
=
0
;
outp
[
cnt
]
=
0
;
doout
=
0
;
j
=
0
;
}
}
slash
=
0
;
return
cnt
;
}
if
(
j
>
0
&&
cnt
<
max
)
outp
[
cnt
++
]
=
my_strdup
(
tmp1
);
return
cnt
;
}
}
#define UAELIB_MAX_PARSE 100
#define UAELIB_MAX_PARSE 100
uae_u32
cfgfile_modify
(
uae_u32
index
,
char
*
parms
,
uae_u32
size
,
char
*
out
,
uae_u32
outsize
)
uae_u32
cfgfile_modify
(
uae_u32
index
,
char
*
parms
,
uae_u32
size
,
char
*
out
,
uae_u32
outsize
)
{
{
char
*
p
;
TCHAR
*
p
;
char
*
argc
[
UAELIB_MAX_PARSE
];
TCHAR
*
argc
[
UAELIB_MAX_PARSE
];
unsigned
int
argv
,
i
;
unsigned
int
argv
,
i
;
uae_u32
err
;
uae_u32
err
;
uae_u8
zero
=
0
;
TCHAR
zero
=
0
;
static
FILE
*
configstore
=
0
;
static
FILE
*
configstore
=
0
;
static
char
*
configsearch
;
static
TCHAR
*
configsearch
;
static
int
configsearchfound
;
static
int
configsearchfound
;
config_changed
=
1
;
config_changed
=
1
;
err
=
0
;
err
=
0
;
argv
=
0
;
argv
=
0
;
p
=
0
;
p
=
0
;
if
(
index
!=
0xffffffff
)
{
if
(
index
!=
0xffffffff
)
{
if
(
!
configstore
)
{
if
(
!
configstore
)
{
err
=
20
;
err
=
20
;
goto
end
;
goto
end
;
}
}
if
(
configsearch
)
{
if
(
configsearch
)
{
char
tmp
[
CONFIG_BLEN
];
TCHAR
tmp
[
CONFIG_BLEN
];
unsigned
int
j
=
0
;
unsigned
int
j
=
0
;
char
*
in
=
configsearch
;
TCHAR
*
in
=
configsearch
;
unsigned
int
inlen
=
strlen
(
configsearch
);
unsigned
int
inlen
=
strlen
(
configsearch
);
int
joker
=
0
;
int
joker
=
0
;
if
(
in
[
inlen
-
1
]
==
'*'
)
{
if
(
in
[
inlen
-
1
]
==
'*'
)
{
joker
=
1
;
joker
=
1
;
inlen
--
;
inlen
--
;
}
}
for
(;;)
{
for
(;;)
{
uae_u8
b
=
0
;
uae_u8
b
=
0
;
if
(
fread
(
&
b
,
1
,
1
,
configstore
)
!=
1
)
{
if
(
fread
(
&
b
,
1
,
1
,
configstore
)
!=
1
)
{
err
=
10
;
err
=
10
;
if
(
configsearch
)
if
(
configsearch
)
err
=
5
;
err
=
5
;
if
(
configsearchfound
)
if
(
configsearchfound
)
err
=
0
;
err
=
0
;
goto
end
;
goto
end
;
}
}
if
(
j
>=
sizeof
(
tmp
)
/
sizeof
(
char
)
-
1
)
if
(
j
>=
sizeof
(
tmp
)
/
sizeof
(
TCHAR
)
-
1
)
j
=
sizeof
(
tmp
)
/
sizeof
(
char
)
-
1
;
j
=
sizeof
(
tmp
)
/
sizeof
(
TCHAR
)
-
1
;
if
(
b
==
0
)
{
if
(
b
==
0
)
{
err
=
10
;
err
=
10
;
if
(
configsearch
)
if
(
configsearch
)
err
=
5
;
err
=
5
;
if
(
configsearchfound
)
if
(
configsearchfound
)
err
=
0
;
err
=
0
;
goto
end
;
goto
end
;
}
}
if
(
b
==
'\n'
)
{
if
(
b
==
'\n'
)
{
if
(
configsearch
&&
!
strncmp
(
tmp
,
in
,
inlen
)
&&
if
(
configsearch
&&
!
_tcsncmp
(
tmp
,
in
,
inlen
)
&&
((
inlen
>
0
&&
strlen
(
tmp
)
>
inlen
&&
tmp
[
inlen
]
==
'='
)
||
(
joker
)))
{
((
inlen
>
0
&&
_tcslen
(
tmp
)
>
inlen
&&
tmp
[
inlen
]
==
'='
)
||
(
joker
)))
{
char
*
p
;
TCHAR
*
p
;
if
(
joker
)
if
(
joker
)
p
=
tmp
-
1
;
p
=
tmp
-
1
;
else
else
p
=
strchr
(
tmp
,
'='
);
p
=
_tcschr
(
tmp
,
'='
);
if
(
p
)
{
if
(
p
)
{
for
(
i
=
0
;
i
<
outsize
-
1
;
i
++
)
{
for
(
i
=
0
;
out
&&
i
<
outsize
-
1
;
i
++
)
{
uae_u8
b
=
*++
p
;
TCHAR
b
=
*++
p
;
out
[
i
]
=
b
;
out
[
i
]
=
b
;
out
[
i
+
1
]
=
0
;
out
[
i
+
1
]
=
0
;
if
(
!
b
)
if
(
!
b
)
break
;
break
;
}
}
}
err
=
0xffffffff
;
configsearchfound
++
;
goto
end
;
}
index
--
;
j
=
0
;
}
else
{
tmp
[
j
++
]
=
b
;
tmp
[
j
]
=
0
;
}
}
}
err
=
0xffffffff
;
configsearchfound
++
;
goto
end
;
}
index
--
;
j
=
0
;
}
else
{
tmp
[
j
++
]
=
b
;
tmp
[
j
]
=
0
;
}
}
}
err
=
0xffffffff
;
}
for
(
i
=
0
;
out
&&
i
<
outsize
-
1
;
i
++
)
{
err
=
0xffffffff
;
uae_u8
b
=
0
;
for
(
i
=
0
;
i
<
outsize
-
1
;
i
++
)
{
if
(
zfile_fread
(
&
b
,
1
,
1
,
configstore
)
!=
1
)
uae_u8
b
=
0
;
err
=
0
;
if
(
fread
(
&
b
,
1
,
1
,
configstore
)
!=
1
)
if
(
b
==
0
)
err
=
0
;
err
=
0
;
if
(
b
==
0
)
if
(
b
==
'\n'
)
err
=
0
;
b
=
0
;
if
(
b
==
'\n'
)
out
[
i
]
=
b
;
b
=
0
;
out
[
i
+
1
]
=
0
;
out
[
i
]
=
b
;
if
(
!
b
)
out
[
i
+
1
]
=
0
;
break
;
if
(
!
b
)
}
break
;
goto
end
;
}
}
goto
end
;
}
if
(
size
>
10000
)
if
(
size
>
10000
)
return
10
;
return
10
;
argv
=
cmdlineparser
(
parms
,
argc
,
UAELIB_MAX_PARSE
);
argv
=
cmdlineparser
(
parms
,
argc
,
UAELIB_MAX_PARSE
);
if
(
argv
<=
1
&&
index
==
0xffffffff
)
{
if
(
argv
<=
1
&&
index
==
0xffffffff
)
{
if
(
configstore
)
{
if
(
configstore
)
{
fclose
(
configstore
);
fclose
(
configstore
);
configstore
=
0
;
configstore
=
0
;
...
@@ -2950,39 +2985,39 @@ uae_u32 cfgfile_modify (uae_u32 index, char *parms, uae_u32 size, char *out, uae
...
@@ -2950,39 +2985,39 @@ uae_u32 cfgfile_modify (uae_u32 index, char *parms, uae_u32 size, char *out, uae
free
(
configsearch
);
free
(
configsearch
);
configstore
=
fopen
(
"configstore"
,
"w+"
);
configstore
=
fopen
(
"configstore"
,
"w+"
);
configsearch
=
NULL
;
configsearch
=
NULL
;
if
(
argv
>
0
&&
str
len
(
argc
[
0
])
>
0
)
if
(
argv
>
0
&&
_tcs
len
(
argc
[
0
])
>
0
)
configsearch
=
my_strdup
(
argc
[
0
]);
configsearch
=
my_strdup
(
argc
[
0
]);
if
(
!
configstore
)
{
if
(
!
configstore
)
{
err
=
20
;
err
=
20
;
goto
end
;
goto
end
;
}
}
fseek
(
configstore
,
0
,
SEEK_SET
);
fseek
(
configstore
,
0
,
SEEK_SET
);
cfgfile_save_options
(
configstore
,
&
currprefs
,
0
);
cfgfile_save_options
(
configstore
,
&
currprefs
,
0
);
fwrite
(
&
zero
,
1
,
1
,
configstore
);
fwrite
(
&
zero
,
1
,
1
,
configstore
);
fseek
(
configstore
,
0
,
SEEK_SET
);
fseek
(
configstore
,
0
,
SEEK_SET
);
err
=
0xffffffff
;
err
=
0xffffffff
;
configsearchfound
=
0
;
configsearchfound
=
0
;
goto
end
;
goto
end
;
}
}
for
(
i
=
0
;
i
<
argv
;
i
++
)
{
for
(
i
=
0
;
i
<
argv
;
i
++
)
{
if
(
i
+
2
<=
argv
)
{
if
(
i
+
2
<=
argv
)
{
if
(
!
inputdevice_uaelib
(
argc
[
i
],
argc
[
i
+
1
]))
{
if
(
!
inputdevice_uaelib
(
argc
[
i
],
argc
[
i
+
1
]))
{
if
(
!
cfgfile_parse_option
(
&
changed_prefs
,
argc
[
i
],
argc
[
i
+
1
],
0
))
{
if
(
!
cfgfile_parse_option
(
&
changed_prefs
,
argc
[
i
],
argc
[
i
+
1
],
0
))
{
err
=
5
;
err
=
5
;
break
;
break
;
}
}
}
}
set_special
(
SPCFLAG_BRK
);
set_special
(
SPCFLAG_BRK
);
i
++
;
i
++
;
}
}
}
}
end:
end:
for
(
i
=
0
;
i
<
argv
;
i
++
)
for
(
i
=
0
;
i
<
argv
;
i
++
)
free
(
argc
[
i
]);
x
free
(
argc
[
i
]);
free
(
p
);
x
free
(
p
);
return
err
;
return
err
;
}
}
uae_u32
cfgfile_uaelib_modify
(
uae_u32
index
,
uae_u32
parms
,
uae_u32
size
,
uae_u32
out
,
uae_u32
outsize
)
uae_u32
cfgfile_uaelib_modify
(
uae_u32
index
,
uae_u32
parms
,
uae_u32
size
,
uae_u32
out
,
uae_u32
outsize
)
...
@@ -2992,80 +3027,80 @@ uae_u32 cfgfile_uaelib_modify (uae_u32 index, uae_u32 parms, uae_u32 size, uae_u
...
@@ -2992,80 +3027,80 @@ uae_u32 cfgfile_uaelib_modify (uae_u32 index, uae_u32 parms, uae_u32 size, uae_u
int
ret
;
int
ret
;
if
(
out
)
if
(
out
)
put_byte
(
out
,
0
);
put_byte
(
out
,
0
);
if
(
size
==
0
)
{
if
(
size
==
0
)
{
while
(
get_byte
(
parms
+
size
)
!=
0
)
while
(
get_byte
(
parms
+
size
)
!=
0
)
size
++
;
size
++
;
}
}
parms_p
=
xmalloc
(
uae_char
,
size
+
1
);
parms_p
=
xmalloc
(
uae_char
,
size
+
1
);
if
(
!
parms_p
)
{
if
(
!
parms_p
)
{
ret
=
10
;
ret
=
10
;
goto
end
;
goto
end
;
}
}
if
(
out
)
{
if
(
out
)
{
out_p
=
xmalloc
(
char
,
outsize
+
1
);
out_p
=
xmalloc
(
TCHAR
,
outsize
+
1
);
if
(
!
out_p
)
{
if
(
!
out_p
)
{
ret
=
10
;
ret
=
10
;
goto
end
;
goto
end
;
}
}
out_p
[
0
]
=
0
;
out_p
[
0
]
=
0
;
}
}
p
=
parms_p
;
p
=
parms_p
;
for
(
i
=
0
;
i
<
size
;
i
++
)
{
for
(
i
=
0
;
i
<
size
;
i
++
)
{
p
[
i
]
=
get_byte
(
parms
+
i
);
p
[
i
]
=
get_byte
(
parms
+
i
);
if
(
p
[
i
]
==
10
||
p
[
i
]
==
13
||
p
[
i
]
==
0
)
if
(
p
[
i
]
==
10
||
p
[
i
]
==
13
||
p
[
i
]
==
0
)
break
;
break
;
}
}
p
[
i
]
=
0
;
p
[
i
]
=
0
;
out_p
[
0
]
=
0
;
out_p
[
0
]
=
0
;
ret
=
cfgfile_modify
(
index
,
parms_p
,
size
,
out_p
,
outsize
);
ret
=
cfgfile_modify
(
index
,
parms_p
,
size
,
out_p
,
outsize
);
if
(
out
)
{
if
(
out
)
{
p
=
out_p
;
p
=
out_p
;
for
(
i
=
0
;
i
<
outsize
-
1
;
i
++
)
{
for
(
i
=
0
;
i
<
outsize
-
1
;
i
++
)
{
uae_u8
b
=
*
p
++
;
uae_u8
b
=
*
p
++
;
put_byte
(
out
+
i
,
b
);
put_byte
(
out
+
i
,
b
);
put_byte
(
out
+
i
+
1
,
0
);
put_byte
(
out
+
i
+
1
,
0
);
if
(
!
b
)
if
(
!
b
)
break
;
break
;
}
}
}
}
end:
end:
xfree
(
out_p
);
xfree
(
out_p
);
xfree
(
parms_p
);
xfree
(
parms_p
);
return
ret
;
return
ret
;
}
}
uae_u32
cfgfile_uaelib
(
int
mode
,
uae_u32
name
,
uae_u32
dst
,
uae_u32
maxlen
)
uae_u32
cfgfile_uaelib
(
int
mode
,
uae_u32
name
,
uae_u32
dst
,
uae_u32
maxlen
)
{
{
char
tmp
[
CONFIG_BLEN
];
TCHAR
tmp
[
CONFIG_BLEN
];
unsigned
int
i
;
int
i
;
struct
strlist
*
sl
;
struct
strlist
*
sl
;
if
(
mode
)
if
(
mode
)
return
0
;
return
0
;
for
(
i
=
0
;
i
<
sizeof
(
tmp
);
i
++
)
{
for
(
i
=
0
;
i
<
sizeof
(
tmp
)
/
sizeof
(
TCHAR
);
i
++
)
{
tmp
[
i
]
=
get_byte
(
name
+
i
);
tmp
[
i
]
=
get_byte
(
name
+
i
);
if
(
tmp
[
i
]
==
0
)
if
(
tmp
[
i
]
==
0
)
break
;
break
;
}
}
tmp
[
sizeof
(
tmp
)
-
1
]
=
0
;
tmp
[
sizeof
(
tmp
)
/
sizeof
(
TCHAR
)
-
1
]
=
0
;
if
(
tmp
[
0
]
==
0
)
if
(
tmp
[
0
]
==
0
)
return
0
;
return
0
;
for
(
sl
=
currprefs
.
all_lines
;
sl
;
sl
=
sl
->
next
)
{
for
(
sl
=
currprefs
.
all_lines
;
sl
;
sl
=
sl
->
next
)
{
if
(
!
strcasecmp
(
sl
->
option
,
tmp
))
if
(
!
strcasecmp
(
sl
->
option
,
tmp
))
break
;
break
;
}
}
if
(
sl
)
{
if
(
sl
)
{
for
(
i
=
0
;
i
<
maxlen
;
i
++
)
{
for
(
i
=
0
;
i
<
maxlen
;
i
++
)
{
put_byte
(
dst
+
i
,
sl
->
value
[
i
]);
put_byte
(
dst
+
i
,
sl
->
value
[
i
]);
if
(
sl
->
value
[
i
]
==
0
)
if
(
sl
->
value
[
i
]
==
0
)
break
;
break
;
}
return
dst
;
}
}
return
dst
;
return
0
;
}
return
0
;
}
}
uae_u8
*
restore_configuration
(
uae_u8
*
src
)
uae_u8
*
restore_configuration
(
uae_u8
*
src
)
...
@@ -3086,7 +3121,7 @@ uae_u8 *save_configuration (int *len)
...
@@ -3086,7 +3121,7 @@ uae_u8 *save_configuration (int *len)
dstbak
=
dst
=
xmalloc
(
uae_u8
,
tmpsize
);
dstbak
=
dst
=
xmalloc
(
uae_u8
,
tmpsize
);
p
=
dst
;
p
=
dst
;
for
(;;)
{
for
(;;)
{
char
tmpout
[
256
];
TCHAR
tmpout
[
256
];
int
ret
;
int
ret
;
tmpout
[
0
]
=
0
;
tmpout
[
0
]
=
0
;
ret
=
cfgfile_modify
(
index
,
"*"
,
1
,
tmpout
,
sizeof
(
tmpout
)
/
sizeof
(
char
));
ret
=
cfgfile_modify
(
index
,
"*"
,
1
,
tmpout
,
sizeof
(
tmpout
)
/
sizeof
(
char
));
...
@@ -3127,11 +3162,12 @@ void default_prefs (struct uae_prefs *p, int type)
...
@@ -3127,11 +3162,12 @@ void default_prefs (struct uae_prefs *p, int type)
{
{
int
i
;
int
i
;
int
roms
[]
=
{
6
,
7
,
8
,
9
,
10
,
14
,
5
,
4
,
3
,
2
,
1
,
-
1
};
int
roms
[]
=
{
6
,
7
,
8
,
9
,
10
,
14
,
5
,
4
,
3
,
2
,
1
,
-
1
};
uae_u8
zero
=
0
;
TCHAR
zero
=
0
;
struct
zfile
*
f
;
struct
zfile
*
f
;
reset_inputdevice_config
(
p
);
memset
(
p
,
0
,
sizeof
(
*
p
));
memset
(
p
,
0
,
sizeof
(
*
p
));
str
cpy
(
p
->
description
,
"UAE default configuration"
);
_tcs
cpy
(
p
->
description
,
"UAE default configuration"
);
p
->
config_hardware_path
[
0
]
=
0
;
p
->
config_hardware_path
[
0
]
=
0
;
p
->
config_host_path
[
0
]
=
0
;
p
->
config_host_path
[
0
]
=
0
;
...
@@ -3182,10 +3218,10 @@ void default_prefs (struct uae_prefs *p, int type)
...
@@ -3182,10 +3218,10 @@ void default_prefs (struct uae_prefs *p, int type)
#ifdef JIT
#ifdef JIT
# ifdef NATMEM_OFFSET
# ifdef NATMEM_OFFSET
p
->
comptrustbyte
=
0
;
p
->
comptrustbyte
=
0
;
p
->
comptrustword
=
0
;
p
->
comptrustword
=
0
;
p
->
comptrustlong
=
0
;
p
->
comptrustlong
=
0
;
p
->
comptrustnaddr
=
0
;
p
->
comptrustnaddr
=
0
;
# else
# else
p
->
comptrustbyte
=
1
;
p
->
comptrustbyte
=
1
;
p
->
comptrustword
=
1
;
p
->
comptrustword
=
1
;
...
@@ -3877,8 +3913,8 @@ static int bip_super (struct uae_prefs *p, int config, int compa, int romcheck)
...
@@ -3877,8 +3913,8 @@ static int bip_super (struct uae_prefs *p, int config, int compa, int romcheck)
p
->
produce_sound
=
2
;
p
->
produce_sound
=
2
;
#ifdef JIT
#ifdef JIT
p
->
cachesize
=
8192
;
p
->
cachesize
=
8192
;
#endif
#endif
p->dfxtype[0] = DRV_35_HD;
p
->
dfxtype
[
0
]
=
DRV_35_HD
;
p
->
dfxtype
[
1
]
=
DRV_35_HD
;
p
->
dfxtype
[
1
]
=
DRV_35_HD
;
p
->
floppy_speed
=
0
;
p
->
floppy_speed
=
0
;
p
->
cpu_idle
=
150
;
p
->
cpu_idle
=
150
;
...
...
src/custom.c
View file @
c3278222
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
#define SPRBORDER 0
#define SPRBORDER 0
STATIC_INLINE
bool
nocustom
(
void
)
STATIC_INLINE
bool
nocustom
(
void
)
{
{
if
(
picasso_on
&&
currprefs
.
picasso96_nocustom
)
if
(
picasso_on
&&
currprefs
.
picasso96_nocustom
)
return
1
;
return
1
;
...
@@ -141,9 +141,9 @@ extern uae_u8* compiled_code;
...
@@ -141,9 +141,9 @@ extern uae_u8* compiled_code;
int
vpos
;
int
vpos
;
static
int
vpos_count
,
vpos_count_prev
;
static
int
vpos_count
,
vpos_count_prev
;
static
int
lof_store
;
// real bit in custom registers
static
int
lof_store
;
// real bit in custom registers
static
int
lof_current
;
// what display device thinks
static
int
lof_current
;
// what display device thinks
static
int
lol
;
static
int
lol
;
static
int
next_lineno
,
prev_lineno
;
static
int
next_lineno
,
prev_lineno
;
static
enum
nln_how
nextline_how
;
static
enum
nln_how
nextline_how
;
static
int
lof_changed
=
0
;
static
int
lof_changed
=
0
;
...
@@ -264,7 +264,7 @@ enum diw_states
...
@@ -264,7 +264,7 @@ enum diw_states
int
plffirstline
,
plflastline
;
int
plffirstline
,
plflastline
;
int
plffirstline_total
,
plflastline_total
;
int
plffirstline_total
,
plflastline_total
;
static
int
autoscale_bordercolors
;
static
int
autoscale_bordercolors
;
int
plfstrt_start
,
plfstrt
,
plfstop
;
int
plfstrt_start
,
plfstrt
,
plfstop
;
static
int
sprite_minx
,
sprite_maxx
;
static
int
sprite_minx
,
sprite_maxx
;
static
int
first_bpl_vpos
;
static
int
first_bpl_vpos
;
...
@@ -844,10 +844,10 @@ STATIC_INLINE void compute_delay_offset (void)
...
@@ -844,10 +844,10 @@ STATIC_INLINE void compute_delay_offset (void)
static
void
record_color_change2
(
int
hpos
,
int
regno
,
unsigned
long
value
)
static
void
record_color_change2
(
int
hpos
,
int
regno
,
unsigned
long
value
)
{
{
int
pos
=
hpos
*
2
;
int
pos
=
hpos
*
2
;
if
(
regno
==
0x1000
+
0x10c
)
if
(
regno
==
0x1000
+
0x10c
)
pos
++
;
// BPLCON4 change needs 1 lores pixel delay
pos
++
;
// BPLCON4 change needs 1 lores pixel delay
curr_color_changes
[
next_color_change
].
linepos
=
pos
;
curr_color_changes
[
next_color_change
].
linepos
=
pos
;
curr_color_changes
[
next_color_change
].
regno
=
regno
;
curr_color_changes
[
next_color_change
].
regno
=
regno
;
curr_color_changes
[
next_color_change
++
].
value
=
value
;
curr_color_changes
[
next_color_change
++
].
value
=
value
;
curr_color_changes
[
next_color_change
].
regno
=
-
1
;
curr_color_changes
[
next_color_change
].
regno
=
-
1
;
...
@@ -1804,11 +1804,11 @@ static void start_bpl_dma (int hpos, int hstart)
...
@@ -1804,11 +1804,11 @@ static void start_bpl_dma (int hpos, int hstart)
if
(
doflickerfix
()
&&
interlace_seen
&&
!
scandoubled_line
)
{
if
(
doflickerfix
()
&&
interlace_seen
&&
!
scandoubled_line
)
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
for
(
i
=
0
;
i
<
8
;
i
++
)
{
prevbpl
[
lof_current
][
vpos
][
i
]
=
bplptx
[
i
];
prevbpl
[
lof_current
][
vpos
][
i
]
=
bplptx
[
i
];
if
(
!
lof_current
&&
(
bplcon0
&
4
))
if
(
!
lof_current
&&
(
bplcon0
&
4
))
bplpt
[
i
]
=
prevbpl
[
1
-
lof_current
][
vpos
][
i
];
bplpt
[
i
]
=
prevbpl
[
1
-
lof_current
][
vpos
][
i
];
if
(
!
(
bplcon0
&
4
)
||
interlace_seen
<
0
)
if
(
!
(
bplcon0
&
4
)
||
interlace_seen
<
0
)
prevbpl
[
1
-
lof_current
][
vpos
][
i
]
=
prevbpl
[
lof_current
][
vpos
][
i
]
=
0
;
prevbpl
[
1
-
lof_current
][
vpos
][
i
]
=
prevbpl
[
lof_current
][
vpos
][
i
]
=
0
;
}
}
}
}
...
@@ -1942,20 +1942,20 @@ static void record_color_change (int hpos, int regno, unsigned long value)
...
@@ -1942,20 +1942,20 @@ static void record_color_change (int hpos, int regno, unsigned long value)
}
}
record_color_change2
(
hpos
,
regno
,
value
);
record_color_change2
(
hpos
,
regno
,
value
);
if
(
regno
==
0
&&
value
!=
0
&&
vpos
>=
20
)
{
if
(
regno
==
0
&&
value
!=
0
&&
vpos
>=
20
)
{
// autoscale if COLOR00 changes in top or bottom of screen
// autoscale if COLOR00 changes in top or bottom of screen
if
(
vpos
>=
minfirstline
)
{
if
(
vpos
>=
minfirstline
)
{
int
vpos2
=
autoscale_bordercolors
?
minfirstline
:
vpos
;
int
vpos2
=
autoscale_bordercolors
?
minfirstline
:
vpos
;
if
(
first_planes_vpos
==
0
)
if
(
first_planes_vpos
==
0
)
first_planes_vpos
=
vpos2
-
2
;
first_planes_vpos
=
vpos2
-
2
;
if
(
plffirstline_total
==
maxvpos
)
if
(
plffirstline_total
==
maxvpos
)
plffirstline_total
=
vpos2
-
2
;
plffirstline_total
=
vpos2
-
2
;
if
(
vpos2
>
last_planes_vpos
||
vpos2
>
plflastline_total
)
if
(
vpos2
>
last_planes_vpos
||
vpos2
>
plflastline_total
)
plflastline_total
=
last_planes_vpos
=
vpos2
+
3
;
plflastline_total
=
last_planes_vpos
=
vpos2
+
3
;
autoscale_bordercolors
=
0
;
autoscale_bordercolors
=
0
;
}
else
{
}
else
{
autoscale_bordercolors
++
;
autoscale_bordercolors
++
;
}
}
}
}
}
}
...
@@ -2713,7 +2713,7 @@ void compute_vsynctime (void)
...
@@ -2713,7 +2713,7 @@ void compute_vsynctime (void)
#endif
#endif
}
}
if
(
currprefs
.
produce_sound
>
1
)
if
(
currprefs
.
produce_sound
>
1
)
update_sound
(
fake_vblank_hz
,
(
bplcon0
&
4
)
?
-
1
:
lof_store
,
islinetoggle
());
update_sound
(
fake_vblank_hz
,
(
bplcon0
&
4
)
?
-
1
:
lof_store
,
islinetoggle
());
}
}
...
@@ -2737,7 +2737,7 @@ void init_hz (void)
...
@@ -2737,7 +2737,7 @@ void init_hz (void)
int
ovblank
=
vblank_hz
;
int
ovblank
=
vblank_hz
;
int
hzc
=
0
;
int
hzc
=
0
;
if
(
vsync_switchmode
(
-
1
,
0
))
if
(
vsync_switchmode
(
-
1
,
0
))
currprefs
.
gfx_avsync
=
changed_prefs
.
gfx_avsync
=
vsync_switchmode
(
-
1
,
0
);
currprefs
.
gfx_avsync
=
changed_prefs
.
gfx_avsync
=
vsync_switchmode
(
-
1
,
0
);
if
(
!
isvsync
()
&&
((
currprefs
.
chipset_refreshrate
==
50
&&
!
currprefs
.
ntscmode
)
||
if
(
!
isvsync
()
&&
((
currprefs
.
chipset_refreshrate
==
50
&&
!
currprefs
.
ntscmode
)
||
...
@@ -2929,8 +2929,8 @@ static uae_u32 REGPARAM2 timehack_helper (TrapContext *context)
...
@@ -2929,8 +2929,8 @@ static uae_u32 REGPARAM2 timehack_helper (TrapContext *context)
timehack_alive
=
10
;
timehack_alive
=
10
;
gettimeofday
(
&
tv
,
NULL
);
gettimeofday
(
&
tv
,
NULL
);
x_put_long
(
m68k_areg
(
regs
,
0
),
tv
.
tv_sec
-
(((
365
*
8
+
2
)
*
24
)
*
60
*
60
));
x_put_long
(
m68k_areg
(
regs
,
0
),
tv
.
tv_sec
-
(((
365
*
8
+
2
)
*
24
)
*
60
*
60
));
x_put_long
(
m68k_areg
(
regs
,
0
)
+
4
,
tv
.
tv_usec
);
x_put_long
(
m68k_areg
(
regs
,
0
)
+
4
,
tv
.
tv_usec
);
return
0
;
return
0
;
#else
#else
return
2
;
return
2
;
...
@@ -3011,7 +3011,7 @@ STATIC_INLINE uae_u16 VPOSR (void)
...
@@ -3011,7 +3011,7 @@ STATIC_INLINE uae_u16 VPOSR (void)
if
(
hp
+
HPOS_OFFSET
>=
maxhpos
)
{
if
(
hp
+
HPOS_OFFSET
>=
maxhpos
)
{
vp
++
;
vp
++
;
if
(
vp
>=
maxvpos
+
lof_store
)
if
(
vp
>=
maxvpos
+
lof_store
)
vp
=
0
;
vp
=
0
;
}
}
vp
=
(
vp
>>
8
)
&
7
;
vp
=
(
vp
>>
8
)
&
7
;
...
@@ -3031,12 +3031,12 @@ STATIC_INLINE uae_u16 VPOSR (void)
...
@@ -3031,12 +3031,12 @@ STATIC_INLINE uae_u16 VPOSR (void)
if
(
!
(
currprefs
.
chipset_mask
&
CSMASK_ECS_AGNUS
))
if
(
!
(
currprefs
.
chipset_mask
&
CSMASK_ECS_AGNUS
))
vp
&=
1
;
vp
&=
1
;
vp
=
vp
|
(
lof_store
?
0x8000
:
0
)
|
csbit
;
vp
=
vp
|
(
lof_store
?
0x8000
:
0
)
|
csbit
;
if
(
currprefs
.
chipset_mask
&
CSMASK_ECS_AGNUS
)
if
(
currprefs
.
chipset_mask
&
CSMASK_ECS_AGNUS
)
vp
|=
lol
?
0x80
:
0
;
vp
|=
lol
?
0x80
:
0
;
#if 0
#if 0
if (M68K_GETPC < 0x00f00000 || M68K_GETPC >= 0x10000000)
if (M68K_GETPC < 0x00f00000 || M68K_GETPC >= 0x10000000)
write_log (
L"VPOSR %04x at %08x\n", vp, M68K_GETPC);
write_log (
"VPOSR %04x at %08x\n", vp, M68K_GETPC);
#endif
#endif
if
(
currprefs
.
cpu_model
>=
68020
)
if
(
currprefs
.
cpu_model
>=
68020
)
hsyncdelay
();
hsyncdelay
();
...
@@ -3049,9 +3049,9 @@ static void VPOSW (uae_u16 v)
...
@@ -3049,9 +3049,9 @@ static void VPOSW (uae_u16 v)
if (M68K_GETPC < 0xf00000 || 1)
if (M68K_GETPC < 0xf00000 || 1)
write_log ("VPOSW %04X PC=%08x\n", v, M68K_GETPC);
write_log ("VPOSW %04X PC=%08x\n", v, M68K_GETPC);
#endif
#endif
if
(
lof_store
!=
((
v
&
0x8000
)
?
1
:
0
))
{
if
(
lof_store
!=
((
v
&
0x8000
)
?
1
:
0
))
{
lof_changed
=
1
;
lof_changed
=
1
;
lof_store
=
(
v
&
0x8000
)
?
1
:
0
;
lof_store
=
(
v
&
0x8000
)
?
1
:
0
;
}
}
if
(
currprefs
.
chipset_mask
&
CSMASK_ECS_AGNUS
)
if
(
currprefs
.
chipset_mask
&
CSMASK_ECS_AGNUS
)
lol
=
(
v
&
0x0080
)
?
1
:
0
;
lol
=
(
v
&
0x0080
)
?
1
:
0
;
...
@@ -3084,7 +3084,7 @@ STATIC_INLINE uae_u16 VHPOSR (void)
...
@@ -3084,7 +3084,7 @@ STATIC_INLINE uae_u16 VHPOSR (void)
if
(
hp
>=
maxhpos
)
{
if
(
hp
>=
maxhpos
)
{
hp
-=
maxhpos
;
hp
-=
maxhpos
;
vp
++
;
vp
++
;
if
(
vp
>=
maxvpos
+
lof_store
)
if
(
vp
>=
maxvpos
+
lof_store
)
vp
=
0
;
vp
=
0
;
}
}
hp
+=
1
;
hp
+=
1
;
...
@@ -3096,8 +3096,8 @@ STATIC_INLINE uae_u16 VHPOSR (void)
...
@@ -3096,8 +3096,8 @@ STATIC_INLINE uae_u16 VHPOSR (void)
if
(
currprefs
.
cpu_model
>=
68020
)
if
(
currprefs
.
cpu_model
>=
68020
)
hsyncdelay
();
hsyncdelay
();
#if 0
#if 0
if (M68K_GETPC < 0x00f00000 || M68K_GETPC >= 0x10000000)
if (M68K_GETPC < 0x00f00000 || M68K_GETPC >= 0x10000000)
write_log ("VPOS %04x %04x at %08x\n", VPOSR (), vp, M68K_GETPC);
write_log ("VPOS %04x %04x at %08x\n", VPOSR (), vp, M68K_GETPC);
#endif
#endif
return
vp
;
return
vp
;
}
}
...
@@ -4919,8 +4919,8 @@ static void init_hardware_frame (void)
...
@@ -4919,8 +4919,8 @@ static void init_hardware_frame (void)
ddflastword_total
=
0
;
ddflastword_total
=
0
;
plflastline_total
=
0
;
plflastline_total
=
0
;
plffirstline_total
=
maxvpos
;
plffirstline_total
=
maxvpos
;
plffirstline_total
=
maxvpos
;
plffirstline_total
=
maxvpos
;
autoscale_bordercolors
=
0
;
autoscale_bordercolors
=
0
;
for
(
i
=
0
;
i
<
MAX_SPRITES
;
i
++
)
for
(
i
=
0
;
i
<
MAX_SPRITES
;
i
++
)
spr
[
i
].
ptxhpos
=
MAXHPOS
;
spr
[
i
].
ptxhpos
=
MAXHPOS
;
}
}
...
@@ -5086,8 +5086,8 @@ static void vsync_handler (void)
...
@@ -5086,8 +5086,8 @@ static void vsync_handler (void)
write_log
(
"vblank interrupt not cleared
\n
"
);
write_log
(
"vblank interrupt not cleared
\n
"
);
#endif
#endif
if
(
bplcon0
&
4
)
if
(
bplcon0
&
4
)
lof_store
=
lof_store
?
0
:
1
;
lof_store
=
lof_store
?
0
:
1
;
lof_current
=
lof_store
;
lof_current
=
lof_store
;
#ifdef PICASSO96
#ifdef PICASSO96
picasso_handle_vsync
();
picasso_handle_vsync
();
...
@@ -5333,12 +5333,12 @@ void hsync_handler (void)
...
@@ -5333,12 +5333,12 @@ void hsync_handler (void)
if
(
islinetoggle
())
if
(
islinetoggle
())
lol
^=
1
;
lol
^=
1
;
if
(
vpos
==
equ_vblank_endline
+
1
&&
lof_current
!=
lof_store
)
{
if
(
vpos
==
equ_vblank_endline
+
1
&&
lof_current
!=
lof_store
)
{
// argh, line=0 field decision was wrong, someone did
// argh, line=0 field decision was wrong, someone did
// something stupid and changed LOF
// something stupid and changed LOF
// lof_current = lof_store;
// lof_current = lof_store;
// don't really know what to do here exactly without corrupt display
// don't really know what to do here exactly without corrupt display
}
}
maxhpos
=
maxhpos_short
+
lol
;
maxhpos
=
maxhpos_short
+
lol
;
eventtab
[
ev_hsync
].
evtime
=
get_cycles
()
+
HSYNCTIME
;
eventtab
[
ev_hsync
].
evtime
=
get_cycles
()
+
HSYNCTIME
;
...
@@ -5381,7 +5381,7 @@ void hsync_handler (void)
...
@@ -5381,7 +5381,7 @@ void hsync_handler (void)
vpos_count
++
;
vpos_count
++
;
if
(
vpos
>=
maxvpos_total
)
if
(
vpos
>=
maxvpos_total
)
vpos
=
0
;
vpos
=
0
;
if
(
vpos
==
maxvpos
+
lof_store
||
vpos
==
maxvpos
+
lof_store
+
1
||
vpos_count
>=
MAXVPOS
)
{
if
(
vpos
==
maxvpos
+
lof_store
||
vpos
==
maxvpos
+
lof_store
+
1
||
vpos_count
>=
MAXVPOS
)
{
// vpos_count >= MAXVPOS just to not crash if VPOSW writes prevent vsync completely
// vpos_count >= MAXVPOS just to not crash if VPOSW writes prevent vsync completely
if
((
bplcon0
&
8
)
&&
!
lightpen_triggered
)
{
if
((
bplcon0
&
8
)
&&
!
lightpen_triggered
)
{
vpos_lpen
=
vpos
-
1
;
vpos_lpen
=
vpos
-
1
;
...
@@ -5431,7 +5431,7 @@ void hsync_handler (void)
...
@@ -5431,7 +5431,7 @@ void hsync_handler (void)
strobe
=
0x38
;
strobe
=
0x38
;
else
if
(
vpos
<
minfirstline
)
else
if
(
vpos
<
minfirstline
)
strobe
=
0x3a
;
strobe
=
0x3a
;
else
if
(
vpos
+
1
==
maxvpos
+
lof_store
)
else
if
(
vpos
+
1
==
maxvpos
+
lof_store
)
strobe
=
0x38
;
strobe
=
0x38
;
else
if
((
currprefs
.
chipset_mask
&
CSMASK_ECS_AGNUS
)
&&
lol
)
else
if
((
currprefs
.
chipset_mask
&
CSMASK_ECS_AGNUS
)
&&
lol
)
strobe
=
0x3e
;
strobe
=
0x3e
;
...
@@ -5464,7 +5464,7 @@ void hsync_handler (void)
...
@@ -5464,7 +5464,7 @@ void hsync_handler (void)
}
}
}
else
{
}
else
{
#endif
#endif
is_lastline
=
vpos
+
1
==
maxvpos
+
lof_store
&&
currprefs
.
m68k_speed
==
-
1
;
is_lastline
=
vpos
+
1
==
maxvpos
+
lof_store
&&
currprefs
.
m68k_speed
==
-
1
;
#ifdef JIT
#ifdef JIT
}
}
#endif
#endif
...
@@ -5481,8 +5481,8 @@ void hsync_handler (void)
...
@@ -5481,8 +5481,8 @@ void hsync_handler (void)
}
else
if
(
currprefs
.
gfx_linedbl
&&
(
doublescan
<=
0
||
interlace_seen
>
0
))
{
}
else
if
(
currprefs
.
gfx_linedbl
&&
(
doublescan
<=
0
||
interlace_seen
>
0
))
{
lineno
*=
2
;
lineno
*=
2
;
nextline_how
=
currprefs
.
gfx_linedbl
==
1
?
nln_doubled
:
nln_nblack
;
nextline_how
=
currprefs
.
gfx_linedbl
==
1
?
nln_doubled
:
nln_nblack
;
if
((
bplcon0
&
4
)
||
(
interlace_seen
>
0
&&
!
lof_current
))
{
if
((
bplcon0
&
4
)
||
(
interlace_seen
>
0
&&
!
lof_current
))
{
if
(
!
lof_current
)
{
if
(
!
lof_current
)
{
lineno
++
;
lineno
++
;
nextline_how
=
nln_lower
;
nextline_how
=
nln_lower
;
}
else
{
}
else
{
...
@@ -5781,8 +5781,8 @@ void customreset (int hardreset)
...
@@ -5781,8 +5781,8 @@ void customreset (int hardreset)
}
}
CLXCON
(
clxcon
);
CLXCON
(
clxcon
);
CLXCON2
(
clxcon2
);
CLXCON2
(
clxcon2
);
calcdiw
();
calcdiw
();
write_log
(
L
"CPU=%d Chipset=%s %s
\n
"
,
write_log
(
"CPU=%d Chipset=%s %s
\n
"
,
currprefs
.
cpu_model
,
currprefs
.
cpu_model
,
(
currprefs
.
chipset_mask
&
CSMASK_AGA
)
?
"AGA"
:
(
currprefs
.
chipset_mask
&
CSMASK_AGA
)
?
"AGA"
:
(
currprefs
.
chipset_mask
&
CSMASK_ECS_AGNUS
|
CSMASK_ECS_DENISE
)
==
(
CSMASK_ECS_AGNUS
|
CSMASK_ECS_DENISE
)
?
"Full ECS"
:
(
currprefs
.
chipset_mask
&
CSMASK_ECS_AGNUS
|
CSMASK_ECS_DENISE
)
==
(
CSMASK_ECS_AGNUS
|
CSMASK_ECS_DENISE
)
?
"Full ECS"
:
...
@@ -6392,7 +6392,7 @@ uae_u8 *restore_custom (uae_u8 *src)
...
@@ -6392,7 +6392,7 @@ uae_u8 *restore_custom (uae_u8 *src)
dsklen
=
RW
;
/* 024 DSKLEN */
dsklen
=
RW
;
/* 024 DSKLEN */
RW
;
/* 026 DSKDAT */
RW
;
/* 026 DSKDAT */
RW
;
/* 028 REFPTR */
RW
;
/* 028 REFPTR */
i
=
RW
;
lof_store
=
lof_current
=
(
i
&
0x8000
)
?
1
:
0
;
lol
=
(
i
&
0x0080
)
?
1
:
0
;
/* 02A VPOSW */
i
=
RW
;
lof_store
=
lof_current
=
(
i
&
0x8000
)
?
1
:
0
;
lol
=
(
i
&
0x0080
)
?
1
:
0
;
/* 02A VPOSW */
RW
;
/* 02C VHPOSW */
RW
;
/* 02C VHPOSW */
COPCON
(
RW
);
/* 02E COPCON */
COPCON
(
RW
);
/* 02E COPCON */
RW
;
/* 030 SERDAT* */
RW
;
/* 030 SERDAT* */
...
@@ -6550,7 +6550,7 @@ uae_u8 *save_custom (int *len, uae_u8 *dstptr, int full)
...
@@ -6550,7 +6550,7 @@ uae_u8 *save_custom (int *len, uae_u8 *dstptr, int full)
SW
(
dsklen
);
/* 024 DSKLEN */
SW
(
dsklen
);
/* 024 DSKLEN */
SW
(
0
);
/* 026 DSKDAT */
SW
(
0
);
/* 026 DSKDAT */
SW
(
0
);
/* 028 REFPTR */
SW
(
0
);
/* 028 REFPTR */
SW
((
lof_store
?
0x8001
:
0
)
|
(
lol
?
0x0080
:
0
));
/* 02A VPOSW */
SW
((
lof_store
?
0x8001
:
0
)
|
(
lol
?
0x0080
:
0
));
/* 02A VPOSW */
SW
(
0
);
/* 02C VHPOSW */
SW
(
0
);
/* 02C VHPOSW */
SW
(
copcon
);
/* 02E COPCON */
SW
(
copcon
);
/* 02E COPCON */
SW
(
serper
);
/* 030 SERDAT * */
SW
(
serper
);
/* 030 SERDAT * */
...
...
src/gencpu.c
View file @
c3278222
...
@@ -3809,7 +3809,6 @@ int main (int argc, char **argv)
...
@@ -3809,7 +3809,6 @@ int main (int argc, char **argv)
* I don't dare to touch the 68k version. */
* I don't dare to touch the 68k version. */
headerfile
=
fopen
(
"cputbl.h"
,
"wb"
);
headerfile
=
fopen
(
"cputbl.h"
,
"wb"
);
stblfile
=
fopen
(
"cpustbl.c"
,
"wb"
);
stblfile
=
fopen
(
"cpustbl.c"
,
"wb"
);
generate_includes
(
stblfile
);
generate_includes
(
stblfile
);
...
...
src/gfx-sdl/sdlgfx.c
View file @
c3278222
...
@@ -123,13 +123,13 @@ static int mousegrab;
...
@@ -123,13 +123,13 @@ static int mousegrab;
static
int
mousehack
;
static
int
mousehack
;
static
int
is_hwsurface
;
static
int
is_hwsurface
;
static
int
have_rawkeys
;
static
int
have_rawkeys
;
static
int
refresh_necessary
;
static
int
refresh_necessary
;
static
int
last_state
=
-
1
;
static
int
last_state
=
-
1
;
int
alt_pressed
;
unsigned
int
mouse_capture
;
/*
/*
* Set window title with some useful status info.
* Set window title with some useful status info.
*/
*/
...
@@ -673,7 +673,7 @@ STATIC_INLINE void render_gl_buffer (const struct gl_buffer_t *buffer, int first
...
@@ -673,7 +673,7 @@ STATIC_INLINE void render_gl_buffer (const struct gl_buffer_t *buffer, int first
if
(
currprefs
.
leds_on_screen
)
bottomledspace
=
14
;
//reserve some space for drawing leds
if
(
currprefs
.
leds_on_screen
)
bottomledspace
=
14
;
//reserve some space for drawing leds
if
(
currprefs
.
gfx_lores_mode
)
{
if
(
currprefs
.
gfx_lores_mode
)
{
amiga_real_w
=
362
;
amiga_real_w
=
362
;
gfx_gl_x_offset
=
(
float
)
currprefs
.
gfx_gl_x_offset
;
gfx_gl_x_offset
=
(
float
)
currprefs
.
gfx_gl_x_offset
;
}
else
{
}
else
{
...
@@ -682,21 +682,21 @@ STATIC_INLINE void render_gl_buffer (const struct gl_buffer_t *buffer, int first
...
@@ -682,21 +682,21 @@ STATIC_INLINE void render_gl_buffer (const struct gl_buffer_t *buffer, int first
}
}
if
(
currprefs
.
gfx_linedbl
)
{
if
(
currprefs
.
gfx_linedbl
)
{
amiga_real_h
=
568
;
amiga_real_h
=
568
;
gfx_gl_y_offset
=
(
float
)
currprefs
.
gfx_gl_y_offset
*
2
;
gfx_gl_y_offset
=
(
float
)
currprefs
.
gfx_gl_y_offset
*
2
;
}
else
{
}
else
{
amiga_real_h
=
284
;
amiga_real_h
=
284
;
gfx_gl_y_offset
=
(
float
)
currprefs
.
gfx_gl_y_offset
;
gfx_gl_y_offset
=
(
float
)
currprefs
.
gfx_gl_y_offset
;
}
}
if
((
current_width
>=
amiga_real_w
)
&&
(
current_height
>=
amiga_real_h
)
&&
(
!
screen_is_picasso
)
)
{
if
((
current_width
>=
amiga_real_w
)
&&
(
current_height
>=
amiga_real_h
)
&&
(
!
screen_is_picasso
)
)
{
gfx_gl_x_panscan
=
currprefs
.
gfx_gl_panscan
*
1
.
33
f
;
gfx_gl_x_panscan
=
currprefs
.
gfx_gl_panscan
*
1
.
33
f
;
gfx_gl_y_panscan
=
currprefs
.
gfx_gl_panscan
;
gfx_gl_y_panscan
=
currprefs
.
gfx_gl_panscan
;
right_crop
=
(
current_width
-
amiga_real_w
)
+
gfx_gl_x_panscan
;
right_crop
=
(
current_width
-
amiga_real_w
)
+
gfx_gl_x_panscan
;
left_crop
=
gfx_gl_x_panscan
;
left_crop
=
gfx_gl_x_panscan
;
bottom_crop
=
(
current_height
-
amiga_real_h
)
+
gfx_gl_y_panscan
;
bottom_crop
=
(
current_height
-
amiga_real_h
)
+
gfx_gl_y_panscan
;
top_crop
=
gfx_gl_y_panscan
;
top_crop
=
gfx_gl_y_panscan
;
bottom_crop
=
bottom_crop
-
bottomledspace
;
bottom_crop
=
bottom_crop
-
bottomledspace
;
bottom_crop_global
=
(
int
)
(
bottom_crop
-
gfx_gl_y_panscan
);
bottom_crop_global
=
(
int
)
(
bottom_crop
-
gfx_gl_y_panscan
);
right_crop_global
=
(
int
)
(
right_crop
-
gfx_gl_x_panscan
);
right_crop_global
=
(
int
)
(
right_crop
-
gfx_gl_x_panscan
);
...
@@ -708,7 +708,7 @@ STATIC_INLINE void render_gl_buffer (const struct gl_buffer_t *buffer, int first
...
@@ -708,7 +708,7 @@ STATIC_INLINE void render_gl_buffer (const struct gl_buffer_t *buffer, int first
gfx_gl_x_offset
=
0
;
gfx_gl_x_offset
=
0
;
gfx_gl_y_offset
=
0
;
gfx_gl_y_offset
=
0
;
}
}
if
(
have_texture_rectangles
)
{
if
(
have_texture_rectangles
)
{
tx0
=
left_crop
-
gfx_gl_x_offset
;
tx0
=
left_crop
-
gfx_gl_x_offset
;
tx1
=
(
float
)
buffer
->
width
-
right_crop
-
gfx_gl_x_offset
;
tx1
=
(
float
)
buffer
->
width
-
right_crop
-
gfx_gl_x_offset
;
...
@@ -1330,6 +1330,23 @@ void handle_events (void)
...
@@ -1330,6 +1330,23 @@ void handle_events (void)
int
keycode
;
int
keycode
;
int
ievent
;
int
ievent
;
// Hack -- Alt + Tab
/*
if (rEvent.key.keysym.sym == SDLK_LALT) alt_pressed = rEvent.key.type;
if (rEvent.key.keysym.sym == SDLK_RALT) alt_pressed = rEvent.key.type;
if ((rEvent.key.keysym.sym == SDLK_TAB) && (alt_pressed == SDL_KEYDOWN)) {
alt_pressed = SDL_KEYUP;
if (mouse_capture) {
SDL_WM_GrabInput(SDL_GRAB_ON);
SDL_ShowCursor(SDL_DISABLE);
} else {
SDL_WM_GrabInput(SDL_GRAB_OFF);
SDL_ShowCursor(SDL_ENABLE);
}
break;
}
*/
if
(
currprefs
.
map_raw_keys
)
{
if
(
currprefs
.
map_raw_keys
)
{
keycode
=
rEvent
.
key
.
keysym
.
scancode
;
keycode
=
rEvent
.
key
.
keysym
.
scancode
;
// Hack - OS4 keyup events have bit 7 set.
// Hack - OS4 keyup events have bit 7 set.
...
...
src/misc.c
View file @
c3278222
...
@@ -836,3 +836,4 @@ int input_get_default_joystick_analog (struct uae_input_device *uid, int i, int
...
@@ -836,3 +836,4 @@ int input_get_default_joystick_analog (struct uae_input_device *uid, int i, int
return
0
;
return
0
;
}
}
//
src/newcpu.c
View file @
c3278222
...
@@ -38,7 +38,7 @@ extern uae_u8* compiled_code;
...
@@ -38,7 +38,7 @@ extern uae_u8* compiled_code;
#else
#else
/* Need to have these somewhere */
/* Need to have these somewhere */
static
void
build_comp
(
void
)
{}
static
void
build_comp
(
void
)
{}
bool
check_prefs_changed_comp
(
void
)
{
return
false
;
}
bool
check_prefs_changed_comp
(
void
)
{
return
false
;
}
#endif
#endif
/* For faster JIT cycles handling */
/* For faster JIT cycles handling */
signed
long
pissoff
=
0
;
signed
long
pissoff
=
0
;
...
@@ -85,8 +85,8 @@ static uae_u32 tt0_030, tt1_030, tc_030;
...
@@ -85,8 +85,8 @@ static uae_u32 tt0_030, tt1_030, tc_030;
static
uae_u16
mmusr_030
;
static
uae_u16
mmusr_030
;
static
struct
cache020
caches020
[
CACHELINES020
];
static
struct
cache020
caches020
[
CACHELINES020
];
static
struct
cache030
icaches030
[
CACHELINES030
];
static
struct
cache030
icaches030
[
CACHELINES030
];
static
struct
cache030
dcaches030
[
CACHELINES030
];
static
struct
cache030
dcaches030
[
CACHELINES030
];
static
struct
cache040
caches040
[
CACHESETS040
];
static
struct
cache040
caches040
[
CACHESETS040
];
#if COUNT_INSTRS
#if COUNT_INSTRS
...
@@ -139,135 +139,135 @@ void dump_counts (void)
...
@@ -139,135 +139,135 @@ void dump_counts (void)
}
}
#endif
#endif
uae_u32
(
*
x_prefetch
)(
int
);
uae_u32
(
*
x_prefetch
)(
int
);
uae_u32
(
*
x_next_iword
)(
void
);
uae_u32
(
*
x_next_iword
)(
void
);
uae_u32
(
*
x_next_ilong
)(
void
);
uae_u32
(
*
x_next_ilong
)(
void
);
uae_u32
(
*
x_get_long
)(
uaecptr
);
uae_u32
(
*
x_get_long
)(
uaecptr
);
uae_u32
(
*
x_get_word
)(
uaecptr
);
uae_u32
(
*
x_get_word
)(
uaecptr
);
uae_u32
(
*
x_get_byte
)(
uaecptr
);
uae_u32
(
*
x_get_byte
)(
uaecptr
);
void
(
*
x_put_long
)(
uaecptr
,
uae_u32
);
void
(
*
x_put_long
)(
uaecptr
,
uae_u32
);
void
(
*
x_put_word
)(
uaecptr
,
uae_u32
);
void
(
*
x_put_word
)(
uaecptr
,
uae_u32
);
void
(
*
x_put_byte
)(
uaecptr
,
uae_u32
);
void
(
*
x_put_byte
)(
uaecptr
,
uae_u32
);
// shared memory access functions
// shared memory access functions
static
void
set_x_funcs
(
void
)
static
void
set_x_funcs
(
void
)
{
{
if
(
currprefs
.
mmu_model
)
{
if
(
currprefs
.
mmu_model
)
{
x_prefetch
=
get_iword_mmu
;
x_prefetch
=
get_iword_mmu
;
x_next_iword
=
next_iword_mmu
;
x_next_iword
=
next_iword_mmu
;
x_next_ilong
=
next_ilong_mmu
;
x_next_ilong
=
next_ilong_mmu
;
x_put_long
=
put_long_mmu
;
x_put_long
=
put_long_mmu
;
x_put_word
=
put_word_mmu
;
x_put_word
=
put_word_mmu
;
x_put_byte
=
put_byte_mmu
;
x_put_byte
=
put_byte_mmu
;
x_get_long
=
get_long_mmu
;
x_get_long
=
get_long_mmu
;
x_get_word
=
get_word_mmu
;
x_get_word
=
get_word_mmu
;
x_get_byte
=
get_byte_mmu
;
x_get_byte
=
get_byte_mmu
;
}
else
if
(
!
currprefs
.
cpu_cycle_exact
)
{
}
else
if
(
!
currprefs
.
cpu_cycle_exact
)
{
x_prefetch
=
get_iword
;
x_prefetch
=
get_iword
;
x_next_iword
=
next_iword
;
x_next_iword
=
next_iword
;
x_next_ilong
=
next_ilong
;
x_next_ilong
=
next_ilong
;
x_put_long
=
put_long
;
x_put_long
=
put_long
;
x_put_word
=
put_word
;
x_put_word
=
put_word
;
x_put_byte
=
put_byte
;
x_put_byte
=
put_byte
;
x_get_long
=
get_long
;
x_get_long
=
get_long
;
x_get_word
=
get_word
;
x_get_word
=
get_word
;
x_get_byte
=
get_byte
;
x_get_byte
=
get_byte
;
}
else
if
(
currprefs
.
cpu_model
<
68020
)
{
}
else
if
(
currprefs
.
cpu_model
<
68020
)
{
x_prefetch
=
NULL
;
x_prefetch
=
NULL
;
x_next_iword
=
NULL
;
x_next_iword
=
NULL
;
x_next_ilong
=
NULL
;
x_next_ilong
=
NULL
;
x_put_long
=
put_long_ce
;
x_put_long
=
put_long_ce
;
x_put_word
=
put_word_ce
;
x_put_word
=
put_word_ce
;
x_put_byte
=
put_byte_ce
;
x_put_byte
=
put_byte_ce
;
x_get_long
=
get_long_ce
;
x_get_long
=
get_long_ce
;
x_get_word
=
get_word_ce
;
x_get_word
=
get_word_ce
;
x_get_byte
=
get_byte_ce
;
x_get_byte
=
get_byte_ce
;
#ifdef CPUEMU_20
#ifdef CPUEMU_20
}
else
if
(
currprefs
.
cpu_model
==
68020
)
{
}
else
if
(
currprefs
.
cpu_model
==
68020
)
{
x_prefetch
=
get_word_ce020_prefetch
;
x_prefetch
=
get_word_ce020_prefetch
;
x_next_iword
=
next_iword_020ce
;
x_next_iword
=
next_iword_020ce
;
x_next_ilong
=
next_ilong_020ce
;
x_next_ilong
=
next_ilong_020ce
;
x_put_long
=
put_long_ce020
;
x_put_long
=
put_long_ce020
;
x_put_word
=
put_word_ce020
;
x_put_word
=
put_word_ce020
;
x_put_byte
=
put_byte_ce020
;
x_put_byte
=
put_byte_ce020
;
x_get_long
=
get_long_ce020
;
x_get_long
=
get_long_ce020
;
x_get_word
=
get_word_ce020
;
x_get_word
=
get_word_ce020
;
x_get_byte
=
get_byte_ce020
;
x_get_byte
=
get_byte_ce020
;
#endif
#endif
#ifdef CPUEMU_21
#ifdef CPUEMU_21
}
else
{
}
else
{
x_prefetch
=
get_word_ce030_prefetch
;
x_prefetch
=
get_word_ce030_prefetch
;
x_next_iword
=
next_iword_030ce
;
x_next_iword
=
next_iword_030ce
;
x_next_ilong
=
next_ilong_030ce
;
x_next_ilong
=
next_ilong_030ce
;
x_put_long
=
put_long_ce030
;
x_put_long
=
put_long_ce030
;
x_put_word
=
put_word_ce030
;
x_put_word
=
put_word_ce030
;
x_put_byte
=
put_byte_ce030
;
x_put_byte
=
put_byte_ce030
;
x_get_long
=
get_long_ce030
;
x_get_long
=
get_long_ce030
;
x_get_word
=
get_word_ce030
;
x_get_word
=
get_word_ce030
;
x_get_byte
=
get_byte_ce030
;
x_get_byte
=
get_byte_ce030
;
#endif
#endif
}
}
}
}
static
void
set_cpu_caches
(
void
)
static
void
set_cpu_caches
(
void
)
{
{
int
i
,
j
;
int
i
,
j
;
#ifdef JIT
#ifdef JIT
if
(
currprefs
.
cachesize
)
{
if
(
currprefs
.
cachesize
)
{
if
(
currprefs
.
cpu_model
<
68040
)
{
if
(
currprefs
.
cpu_model
<
68040
)
{
set_cache_state
(
regs
.
cacr
&
1
);
set_cache_state
(
regs
.
cacr
&
1
);
if
(
regs
.
cacr
&
0x08
)
{
if
(
regs
.
cacr
&
0x08
)
{
flush_icache
(
0
,
3
);
flush_icache
(
0
,
3
);
}
}
}
else
{
}
else
{
set_cache_state
((
regs
.
cacr
&
0x8000
)
?
1
:
0
);
set_cache_state
((
regs
.
cacr
&
0x8000
)
?
1
:
0
);
}
}
}
}
#endif
#endif
if
(
currprefs
.
cpu_model
==
68020
)
{
if
(
currprefs
.
cpu_model
==
68020
)
{
if
(
regs
.
cacr
&
0x08
)
{
// clear instr cache
if
(
regs
.
cacr
&
0x08
)
{
// clear instr cache
for
(
i
=
0
;
i
<
CACHELINES020
;
i
++
)
for
(
i
=
0
;
i
<
CACHELINES020
;
i
++
)
caches020
[
i
].
valid
=
0
;
caches020
[
i
].
valid
=
0
;
regs
.
prefetch020addr
=
0xff000000
;
regs
.
prefetch020addr
=
0xff000000
;
}
}
if
(
regs
.
cacr
&
0x04
)
{
// clear entry in instr cache
if
(
regs
.
cacr
&
0x04
)
{
// clear entry in instr cache
caches020
[(
regs
.
caar
>>
2
)
&
(
CACHELINES020
-
1
)].
valid
=
0
;
caches020
[(
regs
.
caar
>>
2
)
&
(
CACHELINES020
-
1
)].
valid
=
0
;
regs
.
cacr
&=
~
0x04
;
regs
.
cacr
&=
~
0x04
;
}
}
#ifdef CPUEMU_21
#ifdef CPUEMU_21
}
else
if
(
currprefs
.
cpu_model
==
68030
)
{
}
else
if
(
currprefs
.
cpu_model
==
68030
)
{
//regs.cacr |= 0x100;
//regs.cacr |= 0x100;
if
(
regs
.
cacr
&
0x08
)
{
// clear instr cache
if
(
regs
.
cacr
&
0x08
)
{
// clear instr cache
for
(
i
=
0
;
i
<
CACHELINES030
;
i
++
)
{
for
(
i
=
0
;
i
<
CACHELINES030
;
i
++
)
{
icaches030
[
i
].
valid
[
0
]
=
0
;
icaches030
[
i
].
valid
[
0
]
=
0
;
icaches030
[
i
].
valid
[
1
]
=
0
;
icaches030
[
i
].
valid
[
1
]
=
0
;
icaches030
[
i
].
valid
[
2
]
=
0
;
icaches030
[
i
].
valid
[
2
]
=
0
;
icaches030
[
i
].
valid
[
3
]
=
0
;
icaches030
[
i
].
valid
[
3
]
=
0
;
}
}
regs
.
prefetch020addr
=
0xff000000
;
regs
.
prefetch020addr
=
0xff000000
;
}
if
(
regs
.
cacr
&
0x04
)
{
// clear entry in instr cache
icaches030
[(
regs
.
caar
>>
4
)
&
(
CACHELINES030
-
1
)].
valid
[(
regs
.
caar
>>
2
)
&
3
]
=
0
;
regs
.
cacr
&=
~
0x04
;
}
if
(
regs
.
cacr
&
0x800
)
{
// clear data cache
for
(
i
=
0
;
i
<
CACHELINES030
;
i
++
)
{
dcaches030
[
i
].
valid
[
0
]
=
0
;
dcaches030
[
i
].
valid
[
1
]
=
0
;
dcaches030
[
i
].
valid
[
2
]
=
0
;
dcaches030
[
i
].
valid
[
3
]
=
0
;
}
regs
.
cacr
&=
~
0x800
;
}
if
(
regs
.
cacr
&
0x400
)
{
// clear entry in data cache
dcaches030
[(
regs
.
caar
>>
4
)
&
(
CACHELINES030
-
1
)].
valid
[(
regs
.
caar
>>
2
)
&
3
]
=
0
;
regs
.
cacr
&=
~
0x400
;
}
}
#endif
if
(
regs
.
cacr
&
0x04
)
{
// clear entry in instr cache
}
else
if
(
currprefs
.
cpu_model
==
68040
)
{
icaches030
[(
regs
.
caar
>>
4
)
&
(
CACHELINES030
-
1
)].
valid
[(
regs
.
caar
>>
2
)
&
3
]
=
0
;
regs
.
cacr
&=
~
0x04
;
}
if
(
regs
.
cacr
&
0x800
)
{
// clear data cache
for
(
i
=
0
;
i
<
CACHELINES030
;
i
++
)
{
dcaches030
[
i
].
valid
[
0
]
=
0
;
dcaches030
[
i
].
valid
[
1
]
=
0
;
dcaches030
[
i
].
valid
[
2
]
=
0
;
dcaches030
[
i
].
valid
[
3
]
=
0
;
}
regs
.
cacr
&=
~
0x800
;
}
if
(
regs
.
cacr
&
0x400
)
{
// clear entry in data cache
dcaches030
[(
regs
.
caar
>>
4
)
&
(
CACHELINES030
-
1
)].
valid
[(
regs
.
caar
>>
2
)
&
3
]
=
0
;
regs
.
cacr
&=
~
0x400
;
}
#endif
}
else
if
(
currprefs
.
cpu_model
==
68040
)
{
if
(
!
(
regs
.
cacr
&
0x8000
))
{
if
(
!
(
regs
.
cacr
&
0x8000
))
{
for
(
i
=
0
;
i
<
CACHESETS040
;
i
++
)
{
for
(
i
=
0
;
i
<
CACHESETS040
;
i
++
)
{
for
(
j
=
0
;
j
<
CACHELINES040
;
j
++
)
{
for
(
j
=
0
;
j
<
CACHELINES040
;
j
++
)
{
...
@@ -286,7 +286,7 @@ STATIC_INLINE void count_instr (unsigned int opcode)
...
@@ -286,7 +286,7 @@ STATIC_INLINE void count_instr (unsigned int opcode)
{
{
}
}
static
unsigned
long
REGPARAM3
op_illg_1
(
uae_u32
opcode
)
REGPARAM
;
static
unsigned
long
REGPARAM3
op_illg_1
(
uae_u32
opcode
)
REGPARAM
;
static
unsigned
long
REGPARAM2
op_illg_1
(
uae_u32
opcode
)
static
unsigned
long
REGPARAM2
op_illg_1
(
uae_u32
opcode
)
{
{
...
@@ -309,7 +309,7 @@ static void build_cpufunctbl (void)
...
@@ -309,7 +309,7 @@ static void build_cpufunctbl (void)
lvl
=
5
;
lvl
=
5
;
tbl
=
op_smalltbl_0_ff
;
tbl
=
op_smalltbl_0_ff
;
if
(
currprefs
.
cpu_cycle_exact
)
if
(
currprefs
.
cpu_cycle_exact
)
tbl
=
op_smalltbl_21_ff
;
tbl
=
op_smalltbl_21_ff
;
if
(
currprefs
.
mmu_model
)
if
(
currprefs
.
mmu_model
)
tbl
=
op_smalltbl_31_ff
;
tbl
=
op_smalltbl_31_ff
;
break
;
break
;
...
@@ -317,7 +317,7 @@ static void build_cpufunctbl (void)
...
@@ -317,7 +317,7 @@ static void build_cpufunctbl (void)
lvl
=
4
;
lvl
=
4
;
tbl
=
op_smalltbl_1_ff
;
tbl
=
op_smalltbl_1_ff
;
if
(
currprefs
.
cpu_cycle_exact
)
if
(
currprefs
.
cpu_cycle_exact
)
tbl
=
op_smalltbl_22_ff
;
tbl
=
op_smalltbl_22_ff
;
if
(
currprefs
.
mmu_model
)
if
(
currprefs
.
mmu_model
)
tbl
=
op_smalltbl_31_ff
;
tbl
=
op_smalltbl_31_ff
;
break
;
break
;
...
@@ -325,13 +325,13 @@ static void build_cpufunctbl (void)
...
@@ -325,13 +325,13 @@ static void build_cpufunctbl (void)
lvl
=
3
;
lvl
=
3
;
tbl
=
op_smalltbl_2_ff
;
tbl
=
op_smalltbl_2_ff
;
if
(
currprefs
.
cpu_cycle_exact
)
if
(
currprefs
.
cpu_cycle_exact
)
tbl
=
op_smalltbl_23_ff
;
tbl
=
op_smalltbl_23_ff
;
break
;
break
;
case
68020
:
case
68020
:
lvl
=
2
;
lvl
=
2
;
tbl
=
op_smalltbl_3_ff
;
tbl
=
op_smalltbl_3_ff
;
if
(
currprefs
.
cpu_cycle_exact
)
if
(
currprefs
.
cpu_cycle_exact
)
tbl
=
op_smalltbl_20_ff
;
tbl
=
op_smalltbl_20_ff
;
break
;
break
;
case
68010
:
case
68010
:
lvl
=
1
;
lvl
=
1
;
...
@@ -464,7 +464,7 @@ static void update_68k_cycles (void)
...
@@ -464,7 +464,7 @@ static void update_68k_cycles (void)
cpucycleunit
=
CYCLE_UNIT
*
currprefs
.
cpu_clock_multiplier
;
cpucycleunit
=
CYCLE_UNIT
*
currprefs
.
cpu_clock_multiplier
;
}
}
}
else
if
(
currprefs
.
cpu_frequency
)
{
}
else
if
(
currprefs
.
cpu_frequency
)
{
cpucycleunit
=
CYCLE_UNIT
*
baseclock
/
currprefs
.
cpu_frequency
;
cpucycleunit
=
CYCLE_UNIT
*
baseclock
/
currprefs
.
cpu_frequency
;
}
}
if
(
cpucycleunit
<
1
)
if
(
cpucycleunit
<
1
)
cpucycleunit
=
1
;
cpucycleunit
=
1
;
...
@@ -485,7 +485,7 @@ static void prefs_changed_cpu (void)
...
@@ -485,7 +485,7 @@ static void prefs_changed_cpu (void)
void
check_prefs_changed_cpu
(
void
)
void
check_prefs_changed_cpu
(
void
)
{
{
bool
changed
=
0
;
bool
changed
=
0
;
if
(
!
config_changed
)
if
(
!
config_changed
)
return
;
return
;
...
@@ -558,9 +558,9 @@ void init_m68k (void)
...
@@ -558,9 +558,9 @@ void init_m68k (void)
#endif
#endif
write_log
(
"Building CPU table for configuration: %d"
,
currprefs
.
cpu_model
);
write_log
(
"Building CPU table for configuration: %d"
,
currprefs
.
cpu_model
);
regs
.
address_space_mask
=
0xffffffff
;
regs
.
address_space_mask
=
0xffffffff
;
if
(
currprefs
.
cpu_compatible
)
{
if
(
currprefs
.
cpu_compatible
)
{
if
(
currprefs
.
address_space_24
&&
currprefs
.
cpu_model
>=
68030
)
if
(
currprefs
.
address_space_24
&&
currprefs
.
cpu_model
>=
68030
)
currprefs
.
address_space_24
=
false
;
currprefs
.
address_space_24
=
false
;
}
}
if
(
currprefs
.
fpu_model
>
0
)
if
(
currprefs
.
fpu_model
>
0
)
write_log
(
"/%d"
,
currprefs
.
fpu_model
);
write_log
(
"/%d"
,
currprefs
.
fpu_model
);
...
@@ -583,7 +583,7 @@ void init_m68k (void)
...
@@ -583,7 +583,7 @@ void init_m68k (void)
write_log
(
"%d CPU functions
\n
"
,
nr_cpuop_funcs
);
write_log
(
"%d CPU functions
\n
"
,
nr_cpuop_funcs
);
build_cpufunctbl
();
build_cpufunctbl
();
set_x_funcs
();
set_x_funcs
();
#ifdef JIT
#ifdef JIT
/* We need to check whether NATMEM settings have changed
/* We need to check whether NATMEM settings have changed
...
@@ -799,7 +799,7 @@ int get_cpu_model (void)
...
@@ -799,7 +799,7 @@ int get_cpu_model (void)
* extract bitfield data from memory and return it in the MSBs
* extract bitfield data from memory and return it in the MSBs
* bdata caches the unmodified data for put_bitfield()
* bdata caches the unmodified data for put_bitfield()
*/
*/
uae_u32
REGPARAM2
get_bitfield
(
uae_u32
src
,
uae_u32
bdata
[
2
],
uae_s32
offset
,
int
width
)
uae_u32
REGPARAM2
get_bitfield
(
uae_u32
src
,
uae_u32
bdata
[
2
],
uae_s32
offset
,
int
width
)
{
{
uae_u32
tmp
,
res
,
mask
;
uae_u32
tmp
,
res
,
mask
;
...
@@ -848,7 +848,7 @@ uae_u32 REGPARAM2 get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset, i
...
@@ -848,7 +848,7 @@ uae_u32 REGPARAM2 get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset, i
* write bitfield data (in the LSBs) back to memory, upper bits
* write bitfield data (in the LSBs) back to memory, upper bits
* must be cleared already.
* must be cleared already.
*/
*/
void
REGPARAM2
put_bitfield
(
uae_u32
dst
,
uae_u32
bdata
[
2
],
uae_u32
val
,
uae_s32
offset
,
int
width
)
void
REGPARAM2
put_bitfield
(
uae_u32
dst
,
uae_u32
bdata
[
2
],
uae_u32
val
,
uae_s32
offset
,
int
width
)
{
{
offset
=
(
offset
&
7
)
+
width
;
offset
=
(
offset
&
7
)
+
width
;
switch
((
offset
+
7
)
>>
3
)
{
switch
((
offset
+
7
)
>>
3
)
{
...
@@ -872,7 +872,7 @@ void REGPARAM2 put_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32
...
@@ -872,7 +872,7 @@ void REGPARAM2 put_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32
}
}
}
}
uae_u32
REGPARAM2
x_get_bitfield
(
uae_u32
src
,
uae_u32
bdata
[
2
],
uae_s32
offset
,
int
width
)
uae_u32
REGPARAM2
x_get_bitfield
(
uae_u32
src
,
uae_u32
bdata
[
2
],
uae_s32
offset
,
int
width
)
{
{
uae_u32
tmp
,
res
,
mask
;
uae_u32
tmp
,
res
,
mask
;
...
@@ -880,33 +880,33 @@ uae_u32 REGPARAM2 x_get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset,
...
@@ -880,33 +880,33 @@ uae_u32 REGPARAM2 x_get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset,
mask
=
0xffffffffu
<<
(
32
-
width
);
mask
=
0xffffffffu
<<
(
32
-
width
);
switch
((
offset
+
width
+
7
)
>>
3
)
{
switch
((
offset
+
width
+
7
)
>>
3
)
{
case
1
:
case
1
:
tmp
=
x_get_byte
(
src
);
tmp
=
x_get_byte
(
src
);
res
=
tmp
<<
(
24
+
offset
);
res
=
tmp
<<
(
24
+
offset
);
bdata
[
0
]
=
tmp
&
~
(
mask
>>
(
24
+
offset
));
bdata
[
0
]
=
tmp
&
~
(
mask
>>
(
24
+
offset
));
break
;
break
;
case
2
:
case
2
:
tmp
=
x_get_word
(
src
);
tmp
=
x_get_word
(
src
);
res
=
tmp
<<
(
16
+
offset
);
res
=
tmp
<<
(
16
+
offset
);
bdata
[
0
]
=
tmp
&
~
(
mask
>>
(
16
+
offset
));
bdata
[
0
]
=
tmp
&
~
(
mask
>>
(
16
+
offset
));
break
;
break
;
case
3
:
case
3
:
tmp
=
x_get_word
(
src
);
tmp
=
x_get_word
(
src
);
res
=
tmp
<<
(
16
+
offset
);
res
=
tmp
<<
(
16
+
offset
);
bdata
[
0
]
=
tmp
&
~
(
mask
>>
(
16
+
offset
));
bdata
[
0
]
=
tmp
&
~
(
mask
>>
(
16
+
offset
));
tmp
=
x_get_byte
(
src
+
2
);
tmp
=
x_get_byte
(
src
+
2
);
res
|=
tmp
<<
(
8
+
offset
);
res
|=
tmp
<<
(
8
+
offset
);
bdata
[
1
]
=
tmp
&
~
(
mask
>>
(
8
+
offset
));
bdata
[
1
]
=
tmp
&
~
(
mask
>>
(
8
+
offset
));
break
;
break
;
case
4
:
case
4
:
tmp
=
x_get_long
(
src
);
tmp
=
x_get_long
(
src
);
res
=
tmp
<<
offset
;
res
=
tmp
<<
offset
;
bdata
[
0
]
=
tmp
&
~
(
mask
>>
offset
);
bdata
[
0
]
=
tmp
&
~
(
mask
>>
offset
);
break
;
break
;
case
5
:
case
5
:
tmp
=
x_get_long
(
src
);
tmp
=
x_get_long
(
src
);
res
=
tmp
<<
offset
;
res
=
tmp
<<
offset
;
bdata
[
0
]
=
tmp
&
~
(
mask
>>
offset
);
bdata
[
0
]
=
tmp
&
~
(
mask
>>
offset
);
tmp
=
x_get_byte
(
src
+
4
);
tmp
=
x_get_byte
(
src
+
4
);
res
|=
tmp
>>
(
8
-
offset
);
res
|=
tmp
>>
(
8
-
offset
);
bdata
[
1
]
=
tmp
&
~
(
mask
<<
(
8
-
offset
));
bdata
[
1
]
=
tmp
&
~
(
mask
<<
(
8
-
offset
));
break
;
break
;
...
@@ -918,26 +918,26 @@ uae_u32 REGPARAM2 x_get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset,
...
@@ -918,26 +918,26 @@ uae_u32 REGPARAM2 x_get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset,
return
res
;
return
res
;
}
}
void
REGPARAM2
x_put_bitfield
(
uae_u32
dst
,
uae_u32
bdata
[
2
],
uae_u32
val
,
uae_s32
offset
,
int
width
)
void
REGPARAM2
x_put_bitfield
(
uae_u32
dst
,
uae_u32
bdata
[
2
],
uae_u32
val
,
uae_s32
offset
,
int
width
)
{
{
offset
=
(
offset
&
7
)
+
width
;
offset
=
(
offset
&
7
)
+
width
;
switch
((
offset
+
7
)
>>
3
)
{
switch
((
offset
+
7
)
>>
3
)
{
case
1
:
case
1
:
x_put_byte
(
dst
,
bdata
[
0
]
|
(
val
<<
(
8
-
offset
)));
x_put_byte
(
dst
,
bdata
[
0
]
|
(
val
<<
(
8
-
offset
)));
break
;
break
;
case
2
:
case
2
:
x_put_word
(
dst
,
bdata
[
0
]
|
(
val
<<
(
16
-
offset
)));
x_put_word
(
dst
,
bdata
[
0
]
|
(
val
<<
(
16
-
offset
)));
break
;
break
;
case
3
:
case
3
:
x_put_word
(
dst
,
bdata
[
0
]
|
(
val
>>
(
offset
-
16
)));
x_put_word
(
dst
,
bdata
[
0
]
|
(
val
>>
(
offset
-
16
)));
x_put_byte
(
dst
+
2
,
bdata
[
1
]
|
(
val
<<
(
24
-
offset
)));
x_put_byte
(
dst
+
2
,
bdata
[
1
]
|
(
val
<<
(
24
-
offset
)));
break
;
break
;
case
4
:
case
4
:
x_put_long
(
dst
,
bdata
[
0
]
|
(
val
<<
(
32
-
offset
)));
x_put_long
(
dst
,
bdata
[
0
]
|
(
val
<<
(
32
-
offset
)));
break
;
break
;
case
5
:
case
5
:
x_put_long
(
dst
,
bdata
[
0
]
|
(
val
>>
(
offset
-
32
)));
x_put_long
(
dst
,
bdata
[
0
]
|
(
val
>>
(
offset
-
32
)));
x_put_byte
(
dst
+
4
,
bdata
[
1
]
|
(
val
<<
(
40
-
offset
)));
x_put_byte
(
dst
+
4
,
bdata
[
1
]
|
(
val
<<
(
40
-
offset
)));
break
;
break
;
}
}
}
}
...
@@ -954,22 +954,22 @@ uae_u32 REGPARAM2 get_disp_ea_020 (uae_u32 base, uae_u32 dp)
...
@@ -954,22 +954,22 @@ uae_u32 REGPARAM2 get_disp_ea_020 (uae_u32 base, uae_u32 dp)
if
(
dp
&
0x80
)
base
=
0
;
if
(
dp
&
0x80
)
base
=
0
;
if
(
dp
&
0x40
)
regd
=
0
;
if
(
dp
&
0x40
)
regd
=
0
;
if
((
dp
&
0x30
)
==
0x20
)
if
((
dp
&
0x30
)
==
0x20
)
base
+=
(
uae_s32
)(
uae_s16
)
next_iword
();
base
+=
(
uae_s32
)(
uae_s16
)
next_iword
();
if
((
dp
&
0x30
)
==
0x30
)
if
((
dp
&
0x30
)
==
0x30
)
base
+=
next_ilong
();
base
+=
next_ilong
();
if
((
dp
&
0x3
)
==
0x2
)
if
((
dp
&
0x3
)
==
0x2
)
outer
=
(
uae_s32
)(
uae_s16
)
next_iword
();
outer
=
(
uae_s32
)(
uae_s16
)
next_iword
();
if
((
dp
&
0x3
)
==
0x3
)
if
((
dp
&
0x3
)
==
0x3
)
outer
=
next_ilong
();
outer
=
next_ilong
();
if
((
dp
&
0x4
)
==
0
)
if
((
dp
&
0x4
)
==
0
)
base
+=
regd
;
base
+=
regd
;
if
(
dp
&
0x3
)
if
(
dp
&
0x3
)
base
=
get_long
(
base
);
base
=
get_long
(
base
);
if
(
dp
&
0x4
)
if
(
dp
&
0x4
)
base
+=
regd
;
base
+=
regd
;
return
base
+
outer
;
return
base
+
outer
;
}
else
{
}
else
{
...
@@ -977,7 +977,7 @@ uae_u32 REGPARAM2 get_disp_ea_020 (uae_u32 base, uae_u32 dp)
...
@@ -977,7 +977,7 @@ uae_u32 REGPARAM2 get_disp_ea_020 (uae_u32 base, uae_u32 dp)
}
}
}
}
uae_u32
REGPARAM2
x_get_disp_ea_020
(
uae_u32
base
,
uae_u32
dp
)
uae_u32
REGPARAM2
x_get_disp_ea_020
(
uae_u32
base
,
uae_u32
dp
)
{
{
int
reg
=
(
dp
>>
12
)
&
15
;
int
reg
=
(
dp
>>
12
)
&
15
;
int
cycles
=
0
;
int
cycles
=
0
;
...
@@ -995,20 +995,20 @@ uae_u32 REGPARAM2 x_get_disp_ea_020 (uae_u32 base, uae_u32 dp)
...
@@ -995,20 +995,20 @@ uae_u32 REGPARAM2 x_get_disp_ea_020 (uae_u32 base, uae_u32 dp)
regd
=
0
;
regd
=
0
;
if
((
dp
&
0x30
)
==
0x20
)
{
if
((
dp
&
0x30
)
==
0x20
)
{
base
+=
(
uae_s32
)(
uae_s16
)
x_next_iword
();
base
+=
(
uae_s32
)(
uae_s16
)
x_next_iword
();
cycles
++
;
cycles
++
;
}
}
if
((
dp
&
0x30
)
==
0x30
)
{
if
((
dp
&
0x30
)
==
0x30
)
{
base
+=
x_next_ilong
();
base
+=
x_next_ilong
();
cycles
++
;
cycles
++
;
}
}
if
((
dp
&
0x3
)
==
0x2
)
{
if
((
dp
&
0x3
)
==
0x2
)
{
outer
=
(
uae_s32
)(
uae_s16
)
x_next_iword
();
outer
=
(
uae_s32
)(
uae_s16
)
x_next_iword
();
cycles
++
;
cycles
++
;
}
}
if
((
dp
&
0x3
)
==
0x3
)
{
if
((
dp
&
0x3
)
==
0x3
)
{
outer
=
x_next_ilong
();
outer
=
x_next_ilong
();
cycles
++
;
cycles
++
;
}
}
...
@@ -1017,7 +1017,7 @@ uae_u32 REGPARAM2 x_get_disp_ea_020 (uae_u32 base, uae_u32 dp)
...
@@ -1017,7 +1017,7 @@ uae_u32 REGPARAM2 x_get_disp_ea_020 (uae_u32 base, uae_u32 dp)
cycles
++
;
cycles
++
;
}
}
if
(
dp
&
0x3
)
{
if
(
dp
&
0x3
)
{
base
=
x_get_long
(
base
);
base
=
x_get_long
(
base
);
cycles
++
;
cycles
++
;
}
}
if
(
dp
&
0x4
)
{
if
(
dp
&
0x4
)
{
...
@@ -1033,8 +1033,8 @@ uae_u32 REGPARAM2 x_get_disp_ea_020 (uae_u32 base, uae_u32 dp)
...
@@ -1033,8 +1033,8 @@ uae_u32 REGPARAM2 x_get_disp_ea_020 (uae_u32 base, uae_u32 dp)
return
v
;
return
v
;
}
}
uae_u32
REGPARAM3
get_disp_ea_000
(
uae_u32
base
,
uae_u32
dp
)
uae_u32
REGPARAM3
get_disp_ea_000
(
uae_u32
base
,
uae_u32
dp
)
{
{
int
reg
=
(
dp
>>
12
)
&
15
;
int
reg
=
(
dp
>>
12
)
&
15
;
uae_s32
regd
=
regs
.
regs
[
reg
];
uae_s32
regd
=
regs
.
regs
[
reg
];
...
@@ -1475,7 +1475,7 @@ static void Exception_normal (int nr, uaecptr oldpc)
...
@@ -1475,7 +1475,7 @@ static void Exception_normal (int nr, uaecptr oldpc)
int
sv
=
regs
.
s
;
int
sv
=
regs
.
s
;
if
(
nr
>=
24
&&
nr
<
24
+
8
&&
currprefs
.
cpu_model
<=
68010
)
if
(
nr
>=
24
&&
nr
<
24
+
8
&&
currprefs
.
cpu_model
<=
68010
)
nr
=
x_get_byte
(
0x00fffff1
|
(
nr
<<
1
));
nr
=
x_get_byte
(
0x00fffff1
|
(
nr
<<
1
));
exception_debug
(
nr
);
exception_debug
(
nr
);
MakeSR
();
MakeSR
();
...
@@ -1503,33 +1503,33 @@ static void Exception_normal (int nr, uaecptr oldpc)
...
@@ -1503,33 +1503,33 @@ static void Exception_normal (int nr, uaecptr oldpc)
for
(
i
=
0
;
i
<
7
;
i
++
)
{
for
(
i
=
0
;
i
<
7
;
i
++
)
{
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
0
);
x_put_long
(
m68k_areg
(
regs
,
7
),
0
);
}
}
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
regs
.
wb3_data
);
x_put_long
(
m68k_areg
(
regs
,
7
),
regs
.
wb3_data
);
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
regs
.
mmu_fault_addr
);
x_put_long
(
m68k_areg
(
regs
,
7
),
regs
.
mmu_fault_addr
);
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
regs
.
mmu_fault_addr
);
x_put_long
(
m68k_areg
(
regs
,
7
),
regs
.
mmu_fault_addr
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
regs
.
wb3_status
);
x_put_word
(
m68k_areg
(
regs
,
7
),
regs
.
wb3_status
);
regs
.
wb3_status
=
0
;
regs
.
wb3_status
=
0
;
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
regs
.
mmu_ssw
);
x_put_word
(
m68k_areg
(
regs
,
7
),
regs
.
mmu_ssw
);
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
regs
.
mmu_fault_addr
);
x_put_long
(
m68k_areg
(
regs
,
7
),
regs
.
mmu_fault_addr
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0x7000
+
nr
*
4
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0x7000
+
nr
*
4
);
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
oldpc
);
x_put_long
(
m68k_areg
(
regs
,
7
),
oldpc
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
regs
.
sr
);
x_put_word
(
m68k_areg
(
regs
,
7
),
regs
.
sr
);
newpc
=
x_get_long
(
regs
.
vbr
+
4
*
nr
);
newpc
=
x_get_long
(
regs
.
vbr
+
4
*
nr
);
if
(
newpc
&
1
)
{
if
(
newpc
&
1
)
{
if
(
nr
==
2
||
nr
==
3
)
if
(
nr
==
2
||
nr
==
3
)
uae_reset
(
1
);
/* there is nothing else we can do.. */
uae_reset
(
1
);
/* there is nothing else we can do.. */
...
@@ -1548,35 +1548,35 @@ static void Exception_normal (int nr, uaecptr oldpc)
...
@@ -1548,35 +1548,35 @@ static void Exception_normal (int nr, uaecptr oldpc)
#endif
#endif
for
(
i
=
0
;
i
<
18
;
i
++
)
{
for
(
i
=
0
;
i
<
18
;
i
++
)
{
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
}
}
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
last_fault_for_exception_3
);
x_put_long
(
m68k_areg
(
regs
,
7
),
last_fault_for_exception_3
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0x0140
|
(
sv
?
6
:
2
));
/* SSW */
x_put_word
(
m68k_areg
(
regs
,
7
),
0x0140
|
(
sv
?
6
:
2
));
/* SSW */
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
last_addr_for_exception_3
);
x_put_long
(
m68k_areg
(
regs
,
7
),
last_addr_for_exception_3
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0x7000
+
nr
*
4
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0x7000
+
nr
*
4
);
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
oldpc
);
x_put_long
(
m68k_areg
(
regs
,
7
),
oldpc
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
regs
.
sr
);
x_put_word
(
m68k_areg
(
regs
,
7
),
regs
.
sr
);
goto
kludge_me_do
;
goto
kludge_me_do
;
#ifdef MMU
#ifdef MMU
}
}
#endif
#endif
}
else
{
}
else
{
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
last_fault_for_exception_3
);
x_put_long
(
m68k_areg
(
regs
,
7
),
last_fault_for_exception_3
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0x2000
+
nr
*
4
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0x2000
+
nr
*
4
);
}
}
}
else
{
}
else
{
// address error
// address error
...
@@ -1585,62 +1585,62 @@ static void Exception_normal (int nr, uaecptr oldpc)
...
@@ -1585,62 +1585,62 @@ static void Exception_normal (int nr, uaecptr oldpc)
ssw
|=
0x20
;
ssw
|=
0x20
;
for
(
i
=
0
;
i
<
36
;
i
++
)
{
for
(
i
=
0
;
i
<
36
;
i
++
)
{
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
}
}
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
last_fault_for_exception_3
);
x_put_long
(
m68k_areg
(
regs
,
7
),
last_fault_for_exception_3
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
ssw
);
x_put_word
(
m68k_areg
(
regs
,
7
),
ssw
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0xb000
+
nr
*
4
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0xb000
+
nr
*
4
);
}
}
write_log
(
"Exception %d (%x) at %x -> %x!
\n
"
,
nr
,
oldpc
,
currpc
,
x_get_long
(
regs
.
vbr
+
4
*
nr
));
write_log
(
"Exception %d (%x) at %x -> %x!
\n
"
,
nr
,
oldpc
,
currpc
,
x_get_long
(
regs
.
vbr
+
4
*
nr
));
}
else
if
(
nr
==
5
||
nr
==
6
||
nr
==
7
||
nr
==
9
)
{
}
else
if
(
nr
==
5
||
nr
==
6
||
nr
==
7
||
nr
==
9
)
{
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
oldpc
);
x_put_long
(
m68k_areg
(
regs
,
7
),
oldpc
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0x2000
+
nr
*
4
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0x2000
+
nr
*
4
);
}
else
if
(
regs
.
m
&&
nr
>=
24
&&
nr
<
32
)
{
/* M + Interrupt */
}
else
if
(
regs
.
m
&&
nr
>=
24
&&
nr
<
32
)
{
/* M + Interrupt */
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
nr
*
4
);
x_put_word
(
m68k_areg
(
regs
,
7
),
nr
*
4
);
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
currpc
);
x_put_long
(
m68k_areg
(
regs
,
7
),
currpc
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
regs
.
sr
);
x_put_word
(
m68k_areg
(
regs
,
7
),
regs
.
sr
);
regs
.
sr
|=
(
1
<<
13
);
regs
.
sr
|=
(
1
<<
13
);
regs
.
msp
=
m68k_areg
(
regs
,
7
);
regs
.
msp
=
m68k_areg
(
regs
,
7
);
m68k_areg
(
regs
,
7
)
=
regs
.
isp
;
m68k_areg
(
regs
,
7
)
=
regs
.
isp
;
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
0x1000
+
nr
*
4
);
x_put_word
(
m68k_areg
(
regs
,
7
),
0x1000
+
nr
*
4
);
}
else
{
}
else
{
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
nr
*
4
);
x_put_word
(
m68k_areg
(
regs
,
7
),
nr
*
4
);
}
}
}
else
if
(
nr
==
2
||
nr
==
3
)
{
}
else
if
(
nr
==
2
||
nr
==
3
)
{
uae_u16
mode
=
(
sv
?
4
:
0
)
|
(
last_instructionaccess_for_exception_3
?
2
:
1
);
uae_u16
mode
=
(
sv
?
4
:
0
)
|
(
last_instructionaccess_for_exception_3
?
2
:
1
);
mode
|=
last_writeaccess_for_exception_3
?
0
:
16
;
mode
|=
last_writeaccess_for_exception_3
?
0
:
16
;
m68k_areg
(
regs
,
7
)
-=
14
;
m68k_areg
(
regs
,
7
)
-=
14
;
/* fixme: bit3=I/N */
/* fixme: bit3=I/N */
x_put_word
(
m68k_areg
(
regs
,
7
)
+
0
,
mode
);
x_put_word
(
m68k_areg
(
regs
,
7
)
+
0
,
mode
);
x_put_long
(
m68k_areg
(
regs
,
7
)
+
2
,
last_fault_for_exception_3
);
x_put_long
(
m68k_areg
(
regs
,
7
)
+
2
,
last_fault_for_exception_3
);
x_put_word
(
m68k_areg
(
regs
,
7
)
+
6
,
last_op_for_exception_3
);
x_put_word
(
m68k_areg
(
regs
,
7
)
+
6
,
last_op_for_exception_3
);
x_put_word
(
m68k_areg
(
regs
,
7
)
+
8
,
regs
.
sr
);
x_put_word
(
m68k_areg
(
regs
,
7
)
+
8
,
regs
.
sr
);
x_put_long
(
m68k_areg
(
regs
,
7
)
+
10
,
last_addr_for_exception_3
);
x_put_long
(
m68k_areg
(
regs
,
7
)
+
10
,
last_addr_for_exception_3
);
write_log
(
"Exception %d (%x) at %x -> %x!
\n
"
,
nr
,
oldpc
,
currpc
,
x_get_long
(
regs
.
vbr
+
4
*
nr
));
write_log
(
"Exception %d (%x) at %x -> %x!
\n
"
,
nr
,
oldpc
,
currpc
,
x_get_long
(
regs
.
vbr
+
4
*
nr
));
goto
kludge_me_do
;
goto
kludge_me_do
;
}
}
m68k_areg
(
regs
,
7
)
-=
4
;
m68k_areg
(
regs
,
7
)
-=
4
;
x_put_long
(
m68k_areg
(
regs
,
7
),
currpc
);
x_put_long
(
m68k_areg
(
regs
,
7
),
currpc
);
m68k_areg
(
regs
,
7
)
-=
2
;
m68k_areg
(
regs
,
7
)
-=
2
;
x_put_word
(
m68k_areg
(
regs
,
7
),
regs
.
sr
);
x_put_word
(
m68k_areg
(
regs
,
7
),
regs
.
sr
);
kludge_me_do:
kludge_me_do:
newpc
=
x_get_long
(
regs
.
vbr
+
4
*
nr
);
newpc
=
x_get_long
(
regs
.
vbr
+
4
*
nr
);
if
(
newpc
&
1
)
{
if
(
newpc
&
1
)
{
if
(
nr
==
2
||
nr
==
3
)
if
(
nr
==
2
||
nr
==
3
)
uae_reset
(
1
);
/* there is nothing else we can do.. */
uae_reset
(
1
);
/* there is nothing else we can do.. */
...
@@ -2294,55 +2294,55 @@ static void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr ex
...
@@ -2294,55 +2294,55 @@ static void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr ex
reg
=
"TC"
;
reg
=
"TC"
;
siz
=
4
;
siz
=
4
;
if
(
rw
)
if
(
rw
)
x_put_long
(
extra
,
tc_030
);
x_put_long
(
extra
,
tc_030
);
else
else
tc_030
=
x_get_long
(
extra
);
tc_030
=
x_get_long
(
extra
);
break
;
break
;
case
0x12
:
// SRP
case
0x12
:
// SRP
reg
=
"SRP"
;
reg
=
"SRP"
;
siz
=
8
;
siz
=
8
;
if
(
rw
)
{
if
(
rw
)
{
x_put_long
(
extra
,
srp_030
>>
32
);
x_put_long
(
extra
,
srp_030
>>
32
);
x_put_long
(
extra
+
4
,
srp_030
);
x_put_long
(
extra
+
4
,
srp_030
);
}
else
{
}
else
{
srp_030
=
(
uae_u64
)
x_get_long
(
extra
)
<<
32
;
srp_030
=
(
uae_u64
)
x_get_long
(
extra
)
<<
32
;
srp_030
|=
x_get_long
(
extra
+
4
);
srp_030
|=
x_get_long
(
extra
+
4
);
}
}
break
;
break
;
case
0x13
:
// CRP
case
0x13
:
// CRP
reg
=
"CRP"
;
reg
=
"CRP"
;
siz
=
8
;
siz
=
8
;
if
(
rw
)
{
if
(
rw
)
{
x_put_long
(
extra
,
crp_030
>>
32
);
x_put_long
(
extra
,
crp_030
>>
32
);
x_put_long
(
extra
+
4
,
crp_030
);
x_put_long
(
extra
+
4
,
crp_030
);
}
else
{
}
else
{
crp_030
=
(
uae_u64
)
x_get_long
(
extra
)
<<
32
;
crp_030
=
(
uae_u64
)
x_get_long
(
extra
)
<<
32
;
crp_030
|=
x_get_long
(
extra
+
4
);
crp_030
|=
x_get_long
(
extra
+
4
);
}
}
break
;
break
;
case
0x18
:
// MMUSR
case
0x18
:
// MMUSR
reg
=
"MMUSR"
;
reg
=
"MMUSR"
;
siz
=
2
;
siz
=
2
;
if
(
rw
)
if
(
rw
)
x_put_word
(
extra
,
mmusr_030
);
x_put_word
(
extra
,
mmusr_030
);
else
else
mmusr_030
=
x_get_word
(
extra
);
mmusr_030
=
x_get_word
(
extra
);
break
;
break
;
case
0x02
:
// TT0
case
0x02
:
// TT0
reg
=
"TT0"
;
reg
=
"TT0"
;
siz
=
4
;
siz
=
4
;
if
(
rw
)
if
(
rw
)
x_put_long
(
extra
,
tt0_030
);
x_put_long
(
extra
,
tt0_030
);
else
else
tt0_030
=
x_get_long
(
extra
);
tt0_030
=
x_get_long
(
extra
);
break
;
break
;
case
0x03
:
// TT1
case
0x03
:
// TT1
reg
=
"TT1"
;
reg
=
"TT1"
;
siz
=
4
;
siz
=
4
;
if
(
rw
)
if
(
rw
)
x_put_long
(
extra
,
tt1_030
);
x_put_long
(
extra
,
tt1_030
);
else
else
tt1_030
=
x_get_long
(
extra
);
tt1_030
=
x_get_long
(
extra
);
break
;
break
;
}
}
...
@@ -2354,17 +2354,17 @@ static void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr ex
...
@@ -2354,17 +2354,17 @@ static void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr ex
{
{
uae_u32
val
;
uae_u32
val
;
if
(
siz
==
8
)
{
if
(
siz
==
8
)
{
uae_u32
val2
=
x_get_long
(
extra
);
uae_u32
val2
=
x_get_long
(
extra
);
val
=
x_get_long
(
extra
+
4
);
val
=
x_get_long
(
extra
+
4
);
if
(
rw
)
if
(
rw
)
write_log
(
"PMOVE %s,%08X%08X"
,
reg
,
val2
,
val
);
write_log
(
"PMOVE %s,%08X%08X"
,
reg
,
val2
,
val
);
else
else
write_log
(
"PMOVE %08X%08X,%s"
,
val2
,
val
,
reg
);
write_log
(
"PMOVE %08X%08X,%s"
,
val2
,
val
,
reg
);
}
else
{
}
else
{
if
(
siz
==
4
)
if
(
siz
==
4
)
val
=
x_get_long
(
extra
);
val
=
x_get_long
(
extra
);
else
else
val
=
x_get_word
(
extra
);
val
=
x_get_word
(
extra
);
if
(
rw
)
if
(
rw
)
write_log
(
"PMOVE %s,%08X"
,
reg
,
val
);
write_log
(
"PMOVE %s,%08X"
,
reg
,
val
);
else
else
...
@@ -2961,7 +2961,7 @@ retry:
...
@@ -2961,7 +2961,7 @@ retry:
TRY
(
prb
)
{
TRY
(
prb
)
{
for
(;;)
{
for
(;;)
{
pc
=
regs
.
fault_pc
=
m68k_getpc
();
pc
=
regs
.
fault_pc
=
m68k_getpc
();
opcode
=
x_prefetch
(
0
);
opcode
=
x_prefetch
(
0
);
count_instr
(
opcode
);
count_instr
(
opcode
);
do_cycles
(
cpu_cycles
);
do_cycles
(
cpu_cycles
);
cpu_cycles
=
(
*
cpufunctbl
[
opcode
])(
opcode
);
cpu_cycles
=
(
*
cpufunctbl
[
opcode
])(
opcode
);
...
@@ -3008,7 +3008,7 @@ retry:
...
@@ -3008,7 +3008,7 @@ retry:
}
}
/* "cycle exact" 68020/030 */
/* "cycle exact" 68020/030 */
#define MAX68020CYCLES 4
#define MAX68020CYCLES 4
static
void
m68k_run_2ce
(
void
)
static
void
m68k_run_2ce
(
void
)
{
{
...
@@ -3017,7 +3017,7 @@ static void m68k_run_2ce (void)
...
@@ -3017,7 +3017,7 @@ static void m68k_run_2ce (void)
ipl_fetch
();
ipl_fetch
();
for
(;;)
{
for
(;;)
{
uae_u32
opcode
=
x_prefetch
(
0
);
uae_u32
opcode
=
x_prefetch
(
0
);
(
*
cpufunctbl
[
opcode
])(
opcode
);
(
*
cpufunctbl
[
opcode
])(
opcode
);
if
(
r
->
ce020memcycles
>
0
)
{
if
(
r
->
ce020memcycles
>
0
)
{
tmpcycles
=
CYCLE_UNIT
*
MAX68020CYCLES
;
tmpcycles
=
CYCLE_UNIT
*
MAX68020CYCLES
;
...
@@ -3223,7 +3223,7 @@ void m68k_go (int may_quit)
...
@@ -3223,7 +3223,7 @@ void m68k_go (int may_quit)
}
else
{
}
else
{
#endif
#endif
run_func
=
currprefs
.
cpu_cycle_exact
&&
currprefs
.
cpu_model
==
68000
?
m68k_run_1_ce
:
run_func
=
currprefs
.
cpu_cycle_exact
&&
currprefs
.
cpu_model
==
68000
?
m68k_run_1_ce
:
currprefs
.
cpu_compatible
&&
currprefs
.
cpu_model
==
68000
?
m68k_run_1
:
currprefs
.
cpu_compatible
&&
currprefs
.
cpu_model
==
68000
?
m68k_run_1
:
#ifdef JIT
#ifdef JIT
currprefs
.
cpu_model
>=
68020
&&
currprefs
.
cachesize
?
m68k_run_jit
:
currprefs
.
cpu_model
>=
68020
&&
currprefs
.
cachesize
?
m68k_run_jit
:
#endif
#endif
...
@@ -4143,8 +4143,8 @@ STATIC_INLINE void fill_cache040 (uae_u32 addr)
...
@@ -4143,8 +4143,8 @@ STATIC_INLINE void fill_cache040 (uae_u32 addr)
#endif
#endif
#ifdef CPUEMU_20
#ifdef CPUEMU_20
// this one is really simple and easy
// this one is really simple and easy
void
fill_icache020
(
uae_u32
addr
)
void
fill_icache020
(
uae_u32
addr
)
{
{
int
index
;
int
index
;
uae_u32
tag
;
uae_u32
tag
;
...
@@ -4172,219 +4172,219 @@ void fill_icache020 (uae_u32 addr)
...
@@ -4172,219 +4172,219 @@ void fill_icache020 (uae_u32 addr)
regs
.
prefetch020data
=
data
;
regs
.
prefetch020data
=
data
;
}
}
// 68030 caches aren't so simple as 68020 cache..
// 68030 caches aren't so simple as 68020 cache..
STATIC_INLINE
struct
cache030
*
getcache030
(
struct
cache030
*
cp
,
uaecptr
addr
,
uae_u32
*
tagp
,
int
*
lwsp
)
STATIC_INLINE
struct
cache030
*
getcache030
(
struct
cache030
*
cp
,
uaecptr
addr
,
uae_u32
*
tagp
,
int
*
lwsp
)
{
int
index
,
lws
;
uae_u32
tag
;
struct
cache030
*
c
;
addr
&=
~
3
;
index
=
(
addr
>>
4
)
&
(
CACHELINES030
-
1
);
tag
=
regs
.
s
|
(
addr
&
~
((
CACHELINES030
<<
4
)
-
1
));
lws
=
(
addr
>>
2
)
&
3
;
c
=
&
cp
[
index
];
*
tagp
=
tag
;
*
lwsp
=
lws
;
return
c
;
}
STATIC_INLINE
void
update_cache030
(
struct
cache030
*
c
,
uae_u32
val
,
uae_u32
tag
,
int
lws
)
{
if
(
c
->
tag
!=
tag
)
c
->
valid
[
0
]
=
c
->
valid
[
1
]
=
c
->
valid
[
2
]
=
c
->
valid
[
3
]
=
false
;
c
->
tag
=
tag
;
c
->
valid
[
lws
]
=
true
;
c
->
data
[
lws
]
=
val
;
}
void
fill_icache030
(
uae_u32
addr
)
{
{
int
index
,
lws
;
int
lws
;
uae_u32
tag
;
uae_u32
tag
;
struct
cache030
*
c
;
uae_u32
data
;
struct
cache030
*
c
;
addr
&=
~
3
;
index
=
(
addr
>>
4
)
&
(
CACHELINES030
-
1
);
addr
&=
~
3
;
tag
=
regs
.
s
|
(
addr
&
~
((
CACHELINES030
<<
4
)
-
1
));
c
=
getcache030
(
icaches030
,
addr
,
&
tag
,
&
lws
);
lws
=
(
addr
>>
2
)
&
3
;
if
(
c
->
valid
[
lws
]
&&
c
->
tag
==
tag
)
{
c
=
&
cp
[
index
];
// cache hit
*
tagp
=
tag
;
regs
.
prefetch020addr
=
addr
;
*
lwsp
=
lws
;
regs
.
prefetch020data
=
c
->
data
[
lws
];
return
c
;
return
;
}
}
// cache miss
STATIC_INLINE
void
update_cache030
(
struct
cache030
*
c
,
uae_u32
val
,
uae_u32
tag
,
int
lws
)
data
=
mem_access_delay_longi_read_ce020
(
addr
);
{
if
((
regs
.
cacr
&
3
)
==
1
)
{
// not frozen and enabled
if
(
c
->
tag
!=
tag
)
update_cache030
(
c
,
data
,
tag
,
lws
);
c
->
valid
[
0
]
=
c
->
valid
[
1
]
=
c
->
valid
[
2
]
=
c
->
valid
[
3
]
=
false
;
c
->
tag
=
tag
;
c
->
valid
[
lws
]
=
true
;
c
->
data
[
lws
]
=
val
;
}
void
fill_icache030
(
uae_u32
addr
)
{
int
lws
;
uae_u32
tag
;
uae_u32
data
;
struct
cache030
*
c
;
addr
&=
~
3
;
c
=
getcache030
(
icaches030
,
addr
,
&
tag
,
&
lws
);
if
(
c
->
valid
[
lws
]
&&
c
->
tag
==
tag
)
{
// cache hit
regs
.
prefetch020addr
=
addr
;
regs
.
prefetch020data
=
c
->
data
[
lws
];
return
;
}
// cache miss
data
=
mem_access_delay_longi_read_ce020
(
addr
);
if
((
regs
.
cacr
&
3
)
==
1
)
{
// not frozen and enabled
update_cache030
(
c
,
data
,
tag
,
lws
);
#if 0
#if 0
if ((regs.cacr & 0x11) == 0x11 && lws == 0 && !c->valid[0] && !c->valid[1] && !c->valid[2] && !c->valid[3] && ce_banktype[addr >> 16] == CE_MEMBANK_FAST) {
if ((regs.cacr & 0x11) == 0x11 && lws == 0 && !c->valid[0] && !c->valid[1] && !c->valid[2] && !c->valid[3] && ce_banktype[addr >> 16] == CE_MEMBANK_FAST) {
// do burst fetch if cache enabled, not frozen, all slots invalid, no chip ram
// do burst fetch if cache enabled, not frozen, all slots invalid, no chip ram
c->data[1] = mem_access_delay_long_read_ce020 (addr + 4);
c->data[1] = mem_access_delay_long_read_ce020 (addr + 4);
c->data[2] = mem_access_delay_long_read_ce020 (addr + 8);
c->data[2] = mem_access_delay_long_read_ce020 (addr + 8);
c->data[3] = mem_access_delay_long_read_ce020 (addr + 12);
c->data[3] = mem_access_delay_long_read_ce020 (addr + 12);
c->valid[1] = c->valid[2] = c->valid[3] = true;
c->valid[1] = c->valid[2] = c->valid[3] = true;
}
}
#endif
#endif
}
}
regs
.
prefetch020addr
=
addr
;
regs
.
prefetch020addr
=
addr
;
regs
.
prefetch020data
=
data
;
regs
.
prefetch020data
=
data
;
}
}
STATIC_INLINE
bool
cancache030
(
uaecptr
addr
)
STATIC_INLINE
bool
cancache030
(
uaecptr
addr
)
{
{
return
ce_cachable
[
addr
>>
16
];
return
ce_cachable
[
addr
>>
16
];
}
}
// and finally the worst part, 68030 data cache..
// and finally the worst part, 68030 data cache..
void
write_dcache030
(
uaecptr
addr
,
uae_u32
val
,
int
size
)
void
write_dcache030
(
uaecptr
addr
,
uae_u32
val
,
int
size
)
{
{
struct
cache030
*
c1
,
*
c2
;
struct
cache030
*
c1
,
*
c2
;
int
lws1
,
lws2
;
int
lws1
,
lws2
;
uae_u32
tag1
,
tag2
;
uae_u32
tag1
,
tag2
;
int
aligned
=
addr
&
3
;
int
aligned
=
addr
&
3
;
if
(
!
(
regs
.
cacr
&
0x100
)
||
currprefs
.
cpu_model
==
68040
)
// data cache disabled? 68040 shares this too.
if
(
!
(
regs
.
cacr
&
0x100
)
||
currprefs
.
cpu_model
==
68040
)
// data cache disabled? 68040 shares this too.
return
;
return
;
if
(
!
cancache030
(
addr
))
if
(
!
cancache030
(
addr
))
return
;
return
;
c1
=
getcache030
(
dcaches030
,
addr
,
&
tag1
,
&
lws1
);
c1
=
getcache030
(
dcaches030
,
addr
,
&
tag1
,
&
lws1
);
#if 0
#if 0
uaecptr a = 0x1db0c;
uaecptr a = 0x1db0c;
if (addr - (1 << size) + 1 <= a && addr + (1 << size) >= a) {
if (addr - (1 << size) + 1 <= a && addr + (1 << size) >= a) {
write_log (
L"%08x %d %d %08x %08x %d\n", addr, aligned, size, val, tag1, lws1);
write_log (
"%08x %d %d %08x %08x %d\n", addr, aligned, size, val, tag1, lws1);
if (aligned == 2)
if (aligned == 2)
write_log (
L"*\n");
write_log (
"*\n");
}
}
#endif
#endif
// easy one
// easy one
if
(
size
==
2
&&
aligned
==
0
)
{
if
(
size
==
2
&&
aligned
==
0
)
{
update_cache030
(
c1
,
val
,
tag1
,
lws1
);
update_cache030
(
c1
,
val
,
tag1
,
lws1
);
#if 0
#if 0
if ((regs.cacr & 0x1100) == 0x1100 && lws1 == 0 && !c1->valid[0] && !c1->valid[1] && !c1->valid[2] && !c1->valid[3] && ce_banktype[addr >> 16] == CE_MEMBANK_FAST) {
if ((regs.cacr & 0x1100) == 0x1100 && lws1 == 0 && !c1->valid[0] && !c1->valid[1] && !c1->valid[2] && !c1->valid[3] && ce_banktype[addr >> 16] == CE_MEMBANK_FAST) {
// do burst fetch if cache enabled, not frozen, all slots invalid, no chip ram
// do burst fetch if cache enabled, not frozen, all slots invalid, no chip ram
c1->data[1] = mem_access_delay_long_read_ce020 (addr + 4);
c1->data[1] = mem_access_delay_long_read_ce020 (addr + 4);
c1->data[2] = mem_access_delay_long_read_ce020 (addr + 8);
c1->data[2] = mem_access_delay_long_read_ce020 (addr + 8);
c1->data[3] = mem_access_delay_long_read_ce020 (addr + 12);
c1->data[3] = mem_access_delay_long_read_ce020 (addr + 12);
c1->valid[1] = c1->valid[2] = c1->valid[3] = true;
c1->valid[1] = c1->valid[2] = c1->valid[3] = true;
}
}
#endif
#endif
return
;
return
;
}
}
// argh!! merge partial write
// argh!! merge partial write
c2
=
getcache030
(
dcaches030
,
addr
+
4
,
&
tag2
,
&
lws2
);
c2
=
getcache030
(
dcaches030
,
addr
+
4
,
&
tag2
,
&
lws2
);
if
(
size
==
2
)
{
if
(
size
==
2
)
{
if
(
c1
->
valid
[
lws1
]
&&
c1
->
tag
==
tag1
)
{
if
(
c1
->
valid
[
lws1
]
&&
c1
->
tag
==
tag1
)
{
c1
->
data
[
lws1
]
&=
~
(
0xffffffff
>>
(
aligned
*
8
));
c1
->
data
[
lws1
]
&=
~
(
0xffffffff
>>
(
aligned
*
8
));
c1
->
data
[
lws1
]
|=
val
>>
(
aligned
*
8
);
c1
->
data
[
lws1
]
|=
val
>>
(
aligned
*
8
);
}
}
if
(
c2
->
valid
[
lws2
]
&&
c2
->
tag
==
tag2
)
{
if
(
c2
->
valid
[
lws2
]
&&
c2
->
tag
==
tag2
)
{
c2
->
data
[
lws2
]
&=
0xffffffff
>>
((
4
-
aligned
)
*
8
);
c2
->
data
[
lws2
]
&=
0xffffffff
>>
((
4
-
aligned
)
*
8
);
c2
->
data
[
lws2
]
|=
val
<<
((
4
-
aligned
)
*
8
);
c2
->
data
[
lws2
]
|=
val
<<
((
4
-
aligned
)
*
8
);
}
}
}
else
if
(
size
==
1
)
{
}
else
if
(
size
==
1
)
{
val
<<=
16
;
val
<<=
16
;
if
(
c1
->
valid
[
lws1
]
&&
c1
->
tag
==
tag1
)
{
if
(
c1
->
valid
[
lws1
]
&&
c1
->
tag
==
tag1
)
{
c1
->
data
[
lws1
]
&=
~
(
0xffff0000
>>
(
aligned
*
8
));
c1
->
data
[
lws1
]
&=
~
(
0xffff0000
>>
(
aligned
*
8
));
c1
->
data
[
lws1
]
|=
val
>>
(
aligned
*
8
);
c1
->
data
[
lws1
]
|=
val
>>
(
aligned
*
8
);
}
}
if
(
c2
->
valid
[
lws2
]
&&
c2
->
tag
==
tag2
&&
aligned
==
3
)
{
if
(
c2
->
valid
[
lws2
]
&&
c2
->
tag
==
tag2
&&
aligned
==
3
)
{
c2
->
data
[
lws2
]
&=
0x00ffffff
;
c2
->
data
[
lws2
]
&=
0x00ffffff
;
c2
->
data
[
lws2
]
|=
val
<<
8
;
c2
->
data
[
lws2
]
|=
val
<<
8
;
}
}
}
else
if
(
size
==
0
)
{
}
else
if
(
size
==
0
)
{
val
<<=
24
;
val
<<=
24
;
if
(
c1
->
valid
[
lws1
]
&&
c1
->
tag
==
tag1
)
{
if
(
c1
->
valid
[
lws1
]
&&
c1
->
tag
==
tag1
)
{
c1
->
data
[
lws1
]
&=
~
(
0xff000000
>>
(
aligned
*
8
));
c1
->
data
[
lws1
]
&=
~
(
0xff000000
>>
(
aligned
*
8
));
c1
->
data
[
lws1
]
|=
val
>>
(
aligned
*
8
);
c1
->
data
[
lws1
]
|=
val
>>
(
aligned
*
8
);
}
}
}
}
}
}
uae_u32
read_dcache030
(
uaecptr
addr
,
int
size
)
uae_u32
read_dcache030
(
uaecptr
addr
,
int
size
)
{
{
struct
cache030
*
c1
,
*
c2
;
struct
cache030
*
c1
,
*
c2
;
int
lws1
,
lws2
;
int
lws1
,
lws2
;
uae_u32
tag1
,
tag2
;
uae_u32
tag1
,
tag2
;
int
aligned
=
addr
&
3
;
int
aligned
=
addr
&
3
;
int
len
=
(
1
<<
size
)
*
8
;
int
len
=
(
1
<<
size
)
*
8
;
uae_u32
v1
,
v2
;
uae_u32
v1
,
v2
;
if
(
!
(
regs
.
cacr
&
0x100
)
||
currprefs
.
cpu_model
==
68040
||
!
cancache030
(
addr
))
{
// data cache disabled? shared with 68040 "ce"
if
(
!
(
regs
.
cacr
&
0x100
)
||
currprefs
.
cpu_model
==
68040
||
!
cancache030
(
addr
))
{
// data cache disabled? shared with 68040 "ce"
if
(
size
==
2
)
if
(
size
==
2
)
return
mem_access_delay_long_read_ce020
(
addr
);
return
mem_access_delay_long_read_ce020
(
addr
);
else
if
(
size
==
1
)
else
if
(
size
==
1
)
return
mem_access_delay_word_read_ce020
(
addr
);
return
mem_access_delay_word_read_ce020
(
addr
);
else
else
return
mem_access_delay_byte_read_ce020
(
addr
);
return
mem_access_delay_byte_read_ce020
(
addr
);
}
}
c1
=
getcache030
(
dcaches030
,
addr
,
&
tag1
,
&
lws1
);
c1
=
getcache030
(
dcaches030
,
addr
,
&
tag1
,
&
lws1
);
addr
&=
~
3
;
addr
&=
~
3
;
if
(
!
c1
->
valid
[
lws1
]
||
c1
->
tag
!=
tag1
)
{
if
(
!
c1
->
valid
[
lws1
]
||
c1
->
tag
!=
tag1
)
{
v1
=
mem_access_delay_long_read_ce020
(
addr
);
v1
=
mem_access_delay_long_read_ce020
(
addr
);
update_cache030
(
c1
,
v1
,
tag1
,
lws1
);
update_cache030
(
c1
,
v1
,
tag1
,
lws1
);
}
else
{
}
else
{
v1
=
c1
->
data
[
lws1
];
v1
=
c1
->
data
[
lws1
];
if
(
get_long
(
addr
)
!=
v1
)
{
if
(
get_long
(
addr
)
!=
v1
)
{
write_log
(
L"data cache mismatch %d %d %08x %08x != %08x %08x %d PC=%08x
\n
"
,
write_log
(
"data cache mismatch %d %d %08x %08x != %08x %08x %d PC=%08x
\n
"
,
size
,
aligned
,
addr
,
get_long
(
addr
),
v1
,
tag1
,
lws1
,
M68K_GETPC
);
size
,
aligned
,
addr
,
get_long
(
addr
),
v1
,
tag1
,
lws1
,
M68K_GETPC
);
v1
=
get_long
(
addr
);
v1
=
get_long
(
addr
);
}
}
}
}
// only one long fetch needed?
// only one long fetch needed?
if
(
size
==
0
)
{
if
(
size
==
0
)
{
v1
>>=
(
3
-
aligned
)
*
8
;
v1
>>=
(
3
-
aligned
)
*
8
;
return
v1
;
return
v1
;
}
else
if
(
size
==
1
&&
aligned
<=
2
)
{
}
else
if
(
size
==
1
&&
aligned
<=
2
)
{
v1
>>=
(
2
-
aligned
)
*
8
;
v1
>>=
(
2
-
aligned
)
*
8
;
return
v1
;
return
v1
;
}
else
if
(
size
==
2
&&
aligned
==
0
)
{
}
else
if
(
size
==
2
&&
aligned
==
0
)
{
return
v1
;
return
v1
;
}
}
// need two longs
// need two longs
addr
+=
4
;
addr
+=
4
;
c2
=
getcache030
(
dcaches030
,
addr
,
&
tag2
,
&
lws2
);
c2
=
getcache030
(
dcaches030
,
addr
,
&
tag2
,
&
lws2
);
if
(
!
c2
->
valid
[
lws2
]
||
c2
->
tag
!=
tag2
)
{
if
(
!
c2
->
valid
[
lws2
]
||
c2
->
tag
!=
tag2
)
{
v2
=
mem_access_delay_long_read_ce020
(
addr
);
v2
=
mem_access_delay_long_read_ce020
(
addr
);
update_cache030
(
c2
,
v2
,
tag2
,
lws2
);
update_cache030
(
c2
,
v2
,
tag2
,
lws2
);
}
else
{
}
else
{
v2
=
c2
->
data
[
lws2
];
v2
=
c2
->
data
[
lws2
];
if
(
get_long
(
addr
)
!=
v2
)
{
if
(
get_long
(
addr
)
!=
v2
)
{
write_log
(
L"data cache mismatch %d %d %08x %08x != %08x %08x %d PC=%08x
\n
"
,
write_log
(
"data cache mismatch %d %d %08x %08x != %08x %08x %d PC=%08x
\n
"
,
size
,
aligned
,
addr
,
get_long
(
addr
),
v2
,
tag2
,
lws2
,
M68K_GETPC
);
size
,
aligned
,
addr
,
get_long
(
addr
),
v2
,
tag2
,
lws2
,
M68K_GETPC
);
v2
=
get_long
(
addr
);
v2
=
get_long
(
addr
);
}
}
}
}
if
(
size
==
1
&&
aligned
==
3
)
if
(
size
==
1
&&
aligned
==
3
)
return
(
v1
<<
8
)
|
(
v2
>>
24
);
return
(
v1
<<
8
)
|
(
v2
>>
24
);
else
if
(
size
==
2
&&
aligned
==
1
)
else
if
(
size
==
2
&&
aligned
==
1
)
return
(
v1
<<
8
)
|
(
v2
>>
24
);
return
(
v1
<<
8
)
|
(
v2
>>
24
);
else
if
(
size
==
2
&&
aligned
==
2
)
else
if
(
size
==
2
&&
aligned
==
2
)
return
(
v1
<<
16
)
|
(
v2
>>
16
);
return
(
v1
<<
16
)
|
(
v2
>>
16
);
else
if
(
size
==
2
&&
aligned
==
3
)
else
if
(
size
==
2
&&
aligned
==
3
)
return
(
v1
<<
24
)
|
(
v2
>>
8
);
return
(
v1
<<
24
)
|
(
v2
>>
8
);
write_log
(
L"dcache030 weirdness!?
\n
"
);
write_log
(
"dcache030 weirdness!?
\n
"
);
return
0
;
return
0
;
}
}
void
flush_dcache
(
uaecptr
addr
,
int
size
)
void
flush_dcache
(
uaecptr
addr
,
int
size
)
{
{
if
(
!
currprefs
.
cpu_cycle_exact
)
if
(
!
currprefs
.
cpu_cycle_exact
)
return
;
return
;
unsigned
int
i
;
unsigned
int
i
;
if
(
currprefs
.
cpu_model
>=
68030
)
{
if
(
currprefs
.
cpu_model
>=
68030
)
{
for
(
i
=
0
;
i
<
CACHELINES030
;
i
++
)
{
for
(
i
=
0
;
i
<
CACHELINES030
;
i
++
)
{
dcaches030
[
i
].
valid
[
0
]
=
0
;
dcaches030
[
i
].
valid
[
0
]
=
0
;
dcaches030
[
i
].
valid
[
1
]
=
0
;
dcaches030
[
i
].
valid
[
1
]
=
0
;
dcaches030
[
i
].
valid
[
2
]
=
0
;
dcaches030
[
i
].
valid
[
2
]
=
0
;
dcaches030
[
i
].
valid
[
3
]
=
0
;
dcaches030
[
i
].
valid
[
3
]
=
0
;
}
}
}
}
}
}
void
do_cycles_ce020
(
int
clocks
)
void
do_cycles_ce020
(
int
clocks
)
...
...
src/od-macosx/Info.plist
View file @
c3278222
...
@@ -28,8 +28,8 @@
...
@@ -28,8 +28,8 @@
<
k
e
y
>
CFBundleName
<
/k
e
y
>
<
k
e
y
>
CFBundleName
<
/k
e
y
>
<
string
>
PUAE
<
/string
>
<
string
>
PUAE
<
/string
>
<
k
e
y
>
CFBundleGetInfoString
<
/k
e
y
>
<
k
e
y
>
CFBundleGetInfoString
<
/k
e
y
>
<
string
>
2.
1
.0
<
/string
>
<
string
>
2.
2
.0
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
2.
1
.0
<
/string
>
<
string
>
2.
2
.0
<
/string
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/plist
>
<
/plist
>
src/savestate.c
View file @
c3278222
...
@@ -358,7 +358,7 @@ static void restore_header (uae_u8 *src)
...
@@ -358,7 +358,7 @@ static void restore_header (uae_u8 *src)
emuversion
=
restore_string
();
emuversion
=
restore_string
();
description
=
restore_string
();
description
=
restore_string
();
write_log
(
"Saved with: '%s %s', description: '%s'
\n
"
,
write_log
(
"Saved with: '%s %s', description: '%s'
\n
"
,
emuname
,
emuversion
,
description
);
emuname
,
emuversion
,
description
);
xfree
(
description
);
xfree
(
description
);
xfree
(
emuversion
);
xfree
(
emuversion
);
xfree
(
emuname
);
xfree
(
emuname
);
...
...
src/scsidev.c
View file @
c3278222
...
@@ -47,8 +47,8 @@ static int scsierr(SCSI *scgp)
...
@@ -47,8 +47,8 @@ static int scsierr(SCSI *scgp)
{
{
register
struct
scg_cmd
*
cp
=
scgp
->
scmd
;
register
struct
scg_cmd
*
cp
=
scgp
->
scmd
;
if
(
cp
->
error
!=
SCG_NO_ERROR
||
if
(
cp
->
error
!=
SCG_NO_ERROR
||
cp
->
ux_errno
!=
0
||
*
(
u_char
*
)
&
cp
->
scb
!=
0
)
cp
->
ux_errno
!=
0
||
*
(
u_char
*
)
&
cp
->
scb
!=
0
)
return
-
1
;
return
-
1
;
return
0
;
return
0
;
}
}
...
@@ -72,7 +72,7 @@ static int inquiry (SCSI *scgp, void *bp, int cnt)
...
@@ -72,7 +72,7 @@ static int inquiry (SCSI *scgp, void *bp, int cnt)
scgp
->
cmdname
=
"inquiry"
;
scgp
->
cmdname
=
"inquiry"
;
if
(
scsicmd
(
scgp
)
<
0
)
if
(
scsicmd
(
scgp
)
<
0
)
return
(
-
1
);
return
(
-
1
);
return
(
0
);
return
(
0
);
}
}
...
@@ -82,7 +82,7 @@ static void print_product(struct scsi_inquiry *ip)
...
@@ -82,7 +82,7 @@ static void print_product(struct scsi_inquiry *ip)
write_log
(
"'%.16s' "
,
ip
->
ident
);
write_log
(
"'%.16s' "
,
ip
->
ident
);
write_log
(
"'%.4s' "
,
ip
->
revision
);
write_log
(
"'%.4s' "
,
ip
->
revision
);
if
(
ip
->
add_len
<
31
)
{
if
(
ip
->
add_len
<
31
)
{
write_log
(
"NON CCS "
);
write_log
(
"NON CCS "
);
}
}
}
}
...
@@ -98,22 +98,22 @@ static SCSI *openscsi (int scsibus, int target, int lun)
...
@@ -98,22 +98,22 @@ static SCSI *openscsi (int scsibus, int target, int lun)
{
{
SCSI
*
scgp
=
scsi_smalloc
();
SCSI
*
scgp
=
scsi_smalloc
();
if
(
!
scgp
)
{
if
(
!
scgp
)
{
return
NULL
;
return
NULL
;
}
}
scgp
->
debug
=
getenvint
(
"UAE_SCSI_DEBUG"
,
0
);
scgp
->
debug
=
getenvint
(
"UAE_SCSI_DEBUG"
,
0
);
scgp
->
kdebug
=
getenvint
(
"UAE_SCSI_KDEBUG"
,
0
);
scgp
->
kdebug
=
getenvint
(
"UAE_SCSI_KDEBUG"
,
0
);
scgp
->
silent
=
getenvint
(
"UAE_SCSI_SILENT"
,
1
);
scgp
->
silent
=
getenvint
(
"UAE_SCSI_SILENT"
,
1
);
scgp
->
verbose
=
getenvint
(
"UAE_SCSI_VERBOSE"
,
0
);
scgp
->
verbose
=
getenvint
(
"UAE_SCSI_VERBOSE"
,
0
);
scgp
->
scsibus
=
scsibus
;
scgp
->
scsibus
=
scsibus
;
scgp
->
target
=
target
;
scgp
->
target
=
target
;
scgp
->
lun
=
lun
;
scgp
->
lun
=
lun
;
if
(
!
scsi_open
(
scgp
,
NULL
,
scsibus
,
target
,
lun
))
{
if
(
!
scsi_open
(
scgp
,
NULL
,
scsibus
,
target
,
lun
))
{
scsi_sfree
(
scgp
);
scsi_sfree
(
scgp
);
return
NULL
;
return
NULL
;
}
else
{
}
else
{
return
scgp
;
return
scgp
;
}
}
}
}
...
@@ -159,9 +159,9 @@ static struct scsidevdata *get_scsidev_data (int unit)
...
@@ -159,9 +159,9 @@ static struct scsidevdata *get_scsidev_data (int unit)
int
i
;
int
i
;
for
(
i
=
0
;
i
<
num_drives
;
i
++
)
{
for
(
i
=
0
;
i
<
num_drives
;
i
++
)
{
if
(
unit
==
drives
[
i
].
aunit
)
{
if
(
unit
==
drives
[
i
].
aunit
)
{
return
&
drives
[
i
];
return
&
drives
[
i
];
}
}
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -169,21 +169,21 @@ static struct scsidevdata *get_scsidev_data (int unit)
...
@@ -169,21 +169,21 @@ static struct scsidevdata *get_scsidev_data (int unit)
static
struct
scsidevdata
*
add_scsidev_data
(
int
bus
,
int
target
,
int
lun
,
int
aunit
)
static
struct
scsidevdata
*
add_scsidev_data
(
int
bus
,
int
target
,
int
lun
,
int
aunit
)
{
{
if
(
num_drives
+
1
<
MAX_DRIVES
)
{
if
(
num_drives
+
1
<
MAX_DRIVES
)
{
memset
(
&
drives
[
num_drives
],
0
,
sizeof
(
drives
[
num_drives
]));
memset
(
&
drives
[
num_drives
],
0
,
sizeof
(
drives
[
num_drives
]));
drives
[
num_drives
].
bus
=
bus
;
drives
[
num_drives
].
bus
=
bus
;
drives
[
num_drives
].
target
=
target
;
drives
[
num_drives
].
target
=
target
;
drives
[
num_drives
].
lun
=
lun
;
drives
[
num_drives
].
lun
=
lun
;
drives
[
num_drives
].
aunit
=
aunit
;
drives
[
num_drives
].
aunit
=
aunit
;
#if !defined(UAE_SCSIDEV_THREADS)
#if !defined(UAE_SCSIDEV_THREADS)
drives
[
num_drives
].
scgp
=
scgp
;
drives
[
num_drives
].
scgp
=
scgp
;
drives
[
num_drives
].
max_dma
=
scsi_bufsize
(
scgp
,
512
*
1024
);
drives
[
num_drives
].
max_dma
=
scsi_bufsize
(
scgp
,
512
*
1024
);
#endif
#endif
/* check if this drive is an ATAPI drive */
/* check if this drive is an ATAPI drive */
scgp
->
scsibus
=
bus
;
scgp
->
scsibus
=
bus
;
scgp
->
target
=
target
;
scgp
->
target
=
target
;
scgp
->
lun
=
lun
;
scgp
->
lun
=
lun
;
drives
[
num_drives
].
isatapi
=
scsi_isatapi
(
scgp
);
drives
[
num_drives
].
isatapi
=
scsi_isatapi
(
scgp
);
return
&
drives
[
num_drives
++
];
return
&
drives
[
num_drives
++
];
}
}
return
NULL
;
return
NULL
;
...
@@ -194,7 +194,7 @@ static int start_thread (struct scsidevdata *sdd)
...
@@ -194,7 +194,7 @@ static int start_thread (struct scsidevdata *sdd)
{
{
#ifdef UAE_SCSIDEV_THREADS
#ifdef UAE_SCSIDEV_THREADS
if
(
sdd
->
thread_running
)
if
(
sdd
->
thread_running
)
return
1
;
return
1
;
init_comm_pipe
(
&
sdd
->
requests
,
10
,
1
);
init_comm_pipe
(
&
sdd
->
requests
,
10
,
1
);
uae_sem_init
(
&
sdd
->
sync_sem
,
0
,
0
);
uae_sem_init
(
&
sdd
->
sync_sem
,
0
,
0
);
uae_start_thread
(
scsidev_thread
,
sdd
,
&
sdd
->
tid
);
uae_start_thread
(
scsidev_thread
,
sdd
,
&
sdd
->
tid
);
...
@@ -219,14 +219,13 @@ static uae_u32 scsidev_open (void)
...
@@ -219,14 +219,13 @@ static uae_u32 scsidev_open (void)
#endif
#endif
/* Check unit number */
/* Check unit number */
if
((
sdd
=
get_scsidev_data
(
unit
))
&&
if
((
sdd
=
get_scsidev_data
(
unit
))
&&
start_thread
(
sdd
))
{
start_thread
(
sdd
))
{
opencount
++
;
opencount
++
;
put_word
(
m68k_areg
(
regs
,
6
)
+
32
,
get_word
(
m68k_areg
(
regs
,
6
)
+
32
)
+
1
);
put_word
(
m68k_areg
(
regs
,
6
)
+
32
,
get_word
(
m68k_areg
(
regs
,
6
)
+
32
)
+
1
);
put_long
(
tmp1
+
24
,
unit
);
/* io_Unit */
put_long
(
tmp1
+
24
,
unit
);
/* io_Unit */
put_byte
(
tmp1
+
31
,
0
);
/* io_Error */
put_byte
(
tmp1
+
31
,
0
);
/* io_Error */
put_byte
(
tmp1
+
8
,
7
);
/* ln_type = NT_REPLYMSG */
put_byte
(
tmp1
+
8
,
7
);
/* ln_type = NT_REPLYMSG */
return
0
;
return
0
;
}
}
put_long
(
tmp1
+
20
,
(
uae_u32
)
-
1
);
put_long
(
tmp1
+
20
,
(
uae_u32
)
-
1
);
...
@@ -280,8 +279,8 @@ static LONG TestNegativeTime(LONG block)
...
@@ -280,8 +279,8 @@ static LONG TestNegativeTime(LONG block)
-150 == 100:00:00 = 00:00:00 */
-150 == 100:00:00 = 00:00:00 */
if
(
block
>
(
97
*
60
*
75
))
if
(
block
>
(
97
*
60
*
75
))
{
{
/* must be a negative block */
/* must be a negative block */
block
-=
100
*
60
*
75
;
block
-=
100
*
60
*
75
;
}
}
return
block
;
return
block
;
}
}
...
@@ -320,17 +319,16 @@ static void scsidev_do_scsi (struct scsidevdata *sdd, uaecptr request)
...
@@ -320,17 +319,16 @@ static void scsidev_do_scsi (struct scsidevdata *sdd, uaecptr request)
addrbank
*
bank_cmd
=
&
get_mem_bank
(
scsi_cmd
);
addrbank
*
bank_cmd
=
&
get_mem_bank
(
scsi_cmd
);
/* do transfer directly to and from Amiga memory */
/* do transfer directly to and from Amiga memory */
if
(
!
bank_data
||
!
bank_data
->
check
(
scsi_data
,
scsi_len
)
||
if
(
!
bank_data
||
!
bank_data
->
check
(
scsi_data
,
scsi_len
)
||
!
bank_cmd
||
!
bank_cmd
->
check
(
scsi_cmd
,
scsi_cmd_len
))
{
!
bank_cmd
||
!
bank_cmd
->
check
(
scsi_cmd
,
scsi_cmd_len
))
{
put_byte
(
request
+
31
,
(
uae_u8
)
-
5
);
/* IOERR_BADADDRESS */
put_byte
(
request
+
31
,
(
uae_u8
)
-
5
);
/* IOERR_BADADDRESS */
return
;
return
;
}
}
#ifdef SCSI_IS_NOT_THREAD_SAFE
#ifdef SCSI_IS_NOT_THREAD_SAFE
uae_sem_wait
(
&
scgp_sem
);
uae_sem_wait
(
&
scgp_sem
);
#endif
#endif
scmd
->
timeout
=
80
*
60
;
/* the Amiga does not tell us how long the timeout shall be, so make it _very_ long (specified in seconds) */
scmd
->
timeout
=
80
*
60
;
/* the Amiga does not tell us how long the timeout shall be, so make it _very_ long (specified in seconds) */
scmd
->
addr
=
bank_data
->
xlateaddr
(
scsi_data
);
scmd
->
addr
=
bank_data
->
xlateaddr
(
scsi_data
);
scmd
->
size
=
scsi_len
;
scmd
->
size
=
scsi_len
;
scmd
->
flags
=
((
scsi_flags
&
1
)
?
SCG_RECV_DATA
:
0
)
|
SCG_DISRE_ENA
;
scmd
->
flags
=
((
scsi_flags
&
1
)
?
SCG_RECV_DATA
:
0
)
|
SCG_DISRE_ENA
;
...
@@ -406,29 +404,29 @@ static void scsidev_do_scsi (struct scsidevdata *sdd, uaecptr request)
...
@@ -406,29 +404,29 @@ static void scsidev_do_scsi (struct scsidevdata *sdd, uaecptr request)
buffer
[
len
++
]
=
*
tmp
++
;
/* medium type */
buffer
[
len
++
]
=
*
tmp
++
;
/* medium type */
buffer
[
len
++
]
=
0
;
*
tmp
++
;
/* ignore host application code */
buffer
[
len
++
]
=
0
;
*
tmp
++
;
/* ignore host application code */
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
buffer
[
len
++
]
=
0
;
buffer
[
len
++
]
=
0
;
}
}
if
(
*
tmp
)
{
if
(
*
tmp
)
{
/* skip block descriptor */
/* skip block descriptor */
tmp
+=
8
;
tmp
+=
8
;
}
}
tmp
++
;
tmp
++
;
page_len
=
scsi_len
-
(
tmp
-
data
);
page_len
=
scsi_len
-
(
tmp
-
data
);
if
(
page_len
>
0
)
{
if
(
page_len
>
0
)
{
memcpy
(
&
buffer
[
len
],
tmp
,
page_len
);
memcpy
(
&
buffer
[
len
],
tmp
,
page_len
);
len
+=
page_len
;
len
+=
page_len
;
scmd
->
cdb
.
g1_cdb
.
cmd
=
MODE_SELECT_10
;
scmd
->
cdb
.
g1_cdb
.
cmd
=
MODE_SELECT_10
;
scmd
->
cdb
.
g1_cdb
.
lun
=
sdd
->
lun
;
scmd
->
cdb
.
g1_cdb
.
lun
=
sdd
->
lun
;
scmd
->
cdb
.
g1_cdb
.
res
=
1
<<
3
;
/* PF bit */
scmd
->
cdb
.
g1_cdb
.
res
=
1
<<
3
;
/* PF bit */
scmd
->
cdb
.
g1_cdb
.
reladr
=
sp
;
scmd
->
cdb
.
g1_cdb
.
reladr
=
sp
;
scmd
->
cdb
.
g1_cdb
.
count
[
0
]
=
len
>>
8
;
scmd
->
cdb
.
g1_cdb
.
count
[
0
]
=
len
>>
8
;
scmd
->
cdb
.
g1_cdb
.
count
[
1
]
=
len
;
scmd
->
cdb
.
g1_cdb
.
count
[
1
]
=
len
;
}
else
{
}
else
{
do_it
=
0
;
do_it
=
0
;
scmd
->
error
=
0
;
scmd
->
error
=
0
;
*
(
uae_u8
*
)
&
scmd
->
scb
=
0
;
*
(
uae_u8
*
)
&
scmd
->
scb
=
0
;
scmd
->
ux_errno
=
0
;
scmd
->
ux_errno
=
0
;
}
}
}
else
{
}
else
{
/* MODE_SENSE_6 */
/* MODE_SENSE_6 */
...
@@ -472,44 +470,44 @@ static void scsidev_do_scsi (struct scsidevdata *sdd, uaecptr request)
...
@@ -472,44 +470,44 @@ static void scsidev_do_scsi (struct scsidevdata *sdd, uaecptr request)
}
}
}
}
}
else
{
}
else
{
scsicmd
(
scgp
);
scsicmd
(
scgp
);
}
}
put_word
(
acmd
+
18
,
scmd
->
error
==
SCG_FATAL
?
0
:
scsi_cmd_len
);
/* fake scsi_CmdActual */
put_word
(
acmd
+
18
,
scmd
->
error
==
SCG_FATAL
?
0
:
scsi_cmd_len
);
/* fake scsi_CmdActual */
put_byte
(
acmd
+
21
,
*
(
uae_u8
*
)
&
scmd
->
scb
);
/* scsi_Status */
put_byte
(
acmd
+
21
,
*
(
uae_u8
*
)
&
scmd
->
scb
);
/* scsi_Status */
if
(
*
(
uae_u8
*
)
&
scmd
->
scb
)
{
if
(
*
(
uae_u8
*
)
&
scmd
->
scb
)
{
put_byte
(
request
+
31
,
45
);
/* HFERR_BadStatus */
put_byte
(
request
+
31
,
45
);
/* HFERR_BadStatus */
/* copy sense? */
/* copy sense? */
for
(
sactual
=
0
;
for
(
sactual
=
0
;
scsi_sense
&&
sactual
<
scsi_sense_len
&&
sactual
<
scmd
->
sense_count
;
scsi_sense
&&
sactual
<
scsi_sense_len
&&
sactual
<
scmd
->
sense_count
;
sactual
++
)
{
sactual
++
)
{
put_byte
(
scsi_sense
+
sactual
,
scmd
->
u_sense
.
cmd_sense
[
sactual
]);
put_byte
(
scsi_sense
+
sactual
,
scmd
->
u_sense
.
cmd_sense
[
sactual
]);
}
}
put_long
(
acmd
+
8
,
0
);
/* scsi_Actual */
put_long
(
acmd
+
8
,
0
);
/* scsi_Actual */
}
else
{
}
else
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
scsi_sense_len
;
i
++
)
{
for
(
i
=
0
;
i
<
scsi_sense_len
;
i
++
)
{
put_byte
(
scsi_sense
+
i
,
0
);
put_byte
(
scsi_sense
+
i
,
0
);
}
}
sactual
=
0
;
sactual
=
0
;
if
(
scmd
->
error
!=
SCG_NO_ERROR
||
if
(
scmd
->
error
!=
SCG_NO_ERROR
||
scmd
->
ux_errno
!=
0
)
{
scmd
->
ux_errno
!=
0
)
{
/* we might have been limited by the hosts DMA limits,
/* we might have been limited by the hosts DMA limits,
which is usually indicated by ENOMEM */
which is usually indicated by ENOMEM */
if
(
scsi_len
>
(
unsigned
int
)
sdd
->
max_dma
&&
if
(
scsi_len
>
(
unsigned
int
)
sdd
->
max_dma
&&
scmd
->
ux_errno
==
ENOMEM
)
{
scmd
->
ux_errno
==
ENOMEM
)
{
put_byte
(
request
+
31
,
(
uae_u8
)
-
4
);
/* IOERR_BADLENGTH */
put_byte
(
request
+
31
,
(
uae_u8
)
-
4
);
/* IOERR_BADLENGTH */
}
else
{
}
else
{
put_byte
(
request
+
31
,
20
);
/* io_Error, but not specified */
put_byte
(
request
+
31
,
20
);
/* io_Error, but not specified */
put_long
(
acmd
+
8
,
0
);
/* scsi_Actual */
put_long
(
acmd
+
8
,
0
);
/* scsi_Actual */
}
}
}
else
{
}
else
{
put_byte
(
request
+
31
,
0
);
put_byte
(
request
+
31
,
0
);
put_long
(
acmd
+
8
,
scsi_len
-
scmd
->
resid
);
/* scsi_Actual */
put_long
(
acmd
+
8
,
scsi_len
-
scmd
->
resid
);
/* scsi_Actual */
}
}
}
}
put_word
(
acmd
+
28
,
sactual
);
put_word
(
acmd
+
28
,
sactual
);
...
@@ -524,14 +522,14 @@ static void scsidev_do_io (struct scsidevdata *sdd, uaecptr request)
...
@@ -524,14 +522,14 @@ static void scsidev_do_io (struct scsidevdata *sdd, uaecptr request)
tmp2
=
get_word
(
request
+
28
);
/* io_Command */
tmp2
=
get_word
(
request
+
28
);
/* io_Command */
switch
(
tmp2
)
{
switch
(
tmp2
)
{
case
28
:
case
28
:
/* HD_SCSICMD */
/* HD_SCSICMD */
scsidev_do_scsi
(
sdd
,
request
);
scsidev_do_scsi
(
sdd
,
request
);
break
;
break
;
default:
default:
/* Command not understood. */
/* Command not understood. */
put_byte
(
request
+
31
,
(
uae_u8
)
-
3
);
/* io_Error */
put_byte
(
request
+
31
,
(
uae_u8
)
-
3
);
/* io_Error */
break
;
break
;
}
}
#ifdef DEBUGME
#ifdef DEBUGME
printf
(
"scsidev: did io: sdd = 0x%x
\n
"
,
sdd
);
printf
(
"scsidev: did io: sdd = 0x%x
\n
"
,
sdd
);
...
@@ -584,21 +582,21 @@ static void *scsidev_thread (void *sddv)
...
@@ -584,21 +582,21 @@ static void *scsidev_thread (void *sddv)
/* init SCSI */
/* init SCSI */
if
(
!
(
sdd
->
scgp
=
openscsi
(
sdd
->
bus
,
sdd
->
target
,
sdd
->
lun
))
||
if
(
!
(
sdd
->
scgp
=
openscsi
(
sdd
->
bus
,
sdd
->
target
,
sdd
->
lun
))
||
(
sdd
->
max_dma
=
scsi_bufsize
(
sdd
->
scgp
,
512
*
1024
))
<=
0
)
{
(
sdd
->
max_dma
=
scsi_bufsize
(
sdd
->
scgp
,
512
*
1024
))
<=
0
)
{
sdd
->
thread_running
=
0
;
sdd
->
thread_running
=
0
;
uae_sem_post
(
&
sdd
->
sync_sem
);
uae_sem_post
(
&
sdd
->
sync_sem
);
return
0
;
return
0
;
}
}
sdd
->
thread_running
=
1
;
sdd
->
thread_running
=
1
;
uae_sem_post
(
&
sdd
->
sync_sem
);
uae_sem_post
(
&
sdd
->
sync_sem
);
for
(;;)
{
for
(;;)
{
uaecptr
request
;
uaecptr
request
;
request
=
(
uaecptr
)
read_comm_pipe_u32_blocking
(
&
sdd
->
requests
);
request
=
(
uaecptr
)
read_comm_pipe_u32_blocking
(
&
sdd
->
requests
);
#ifdef DEBUGME
#ifdef DEBUGME
printf
(
"scsidev_penguin: sdd = 0x%x
\n
"
,
sdd
);
printf
(
"scsidev_penguin: sdd = 0x%x
\n
"
,
sdd
);
printf
(
"scsidev_penguin: req = %08lx
\n
"
,
(
unsigned
long
)
request
);
printf
(
"scsidev_penguin: req = %08lx
\n
"
,
(
unsigned
long
)
request
);
printf
(
"scsidev_penguin: cmd = %d
\n
"
,
(
int
)
get_word
(
request
+
28
));
printf
(
"scsidev_penguin: cmd = %d
\n
"
,
(
int
)
get_word
(
request
+
28
));
#endif
#endif
if
(
!
request
)
{
if
(
!
request
)
{
printf
(
"scsidev_penguin: going down with 0x%x
\n
"
,
sdd
->
sync_sem
);
printf
(
"scsidev_penguin: going down with 0x%x
\n
"
,
sdd
->
sync_sem
);
...
@@ -629,41 +627,41 @@ static uae_u32 scsidev_init (void)
...
@@ -629,41 +627,41 @@ static uae_u32 scsidev_init (void)
#endif
#endif
if
(
scgp
)
{
if
(
scgp
)
{
/* we still have everything in place */
/* we still have everything in place */
return
m68k_dreg
(
regs
,
0
);
/* device base */
return
m68k_dreg
(
regs
,
0
);
/* device base */
}
}
/* init global SCSI */
/* init global SCSI */
if
(
!
(
scgp
=
openscsi
(
-
1
,
-
1
,
-
1
)))
{
if
(
!
(
scgp
=
openscsi
(
-
1
,
-
1
,
-
1
)))
{
return
0
;
return
0
;
}
}
uae_sem_init
(
&
scgp_sem
,
0
,
1
);
uae_sem_init
(
&
scgp_sem
,
0
,
1
);
/* add all units we find */
/* add all units we find */
for
(
scgp
->
scsibus
=
0
;
scgp
->
scsibus
<
8
;
scgp
->
scsibus
++
)
{
for
(
scgp
->
scsibus
=
0
;
scgp
->
scsibus
<
8
;
scgp
->
scsibus
++
)
{
if
(
!
scsi_havebus
(
scgp
,
scgp
->
scsibus
))
if
(
!
scsi_havebus
(
scgp
,
scgp
->
scsibus
))
continue
;
continue
;
printf
(
"scsibus%d:
\n
"
,
scgp
->
scsibus
);
printf
(
"scsibus%d:
\n
"
,
scgp
->
scsibus
);
for
(
scgp
->
target
=
0
;
scgp
->
target
<
16
;
scgp
->
target
++
)
{
for
(
scgp
->
target
=
0
;
scgp
->
target
<
16
;
scgp
->
target
++
)
{
struct
scsi_inquiry
inq
;
struct
scsi_inquiry
inq
;
scgp
->
lun
=
0
;
scgp
->
lun
=
0
;
if
(
inquiry
(
scgp
,
&
inq
,
sizeof
(
inq
)))
{
if
(
inquiry
(
scgp
,
&
inq
,
sizeof
(
inq
)))
{
continue
;
continue
;
}
}
for
(
scgp
->
lun
=
0
;
scgp
->
lun
<
8
;
scgp
->
lun
++
)
{
for
(
scgp
->
lun
=
0
;
scgp
->
lun
<
8
;
scgp
->
lun
++
)
{
if
(
!
inquiry
(
scgp
,
&
inq
,
sizeof
(
inq
)))
{
if
(
!
inquiry
(
scgp
,
&
inq
,
sizeof
(
inq
)))
{
int
aunit
=
BTL2UNIT
(
scgp
->
scsibus
,
scgp
->
target
,
scgp
->
lun
);
int
aunit
=
BTL2UNIT
(
scgp
->
scsibus
,
scgp
->
target
,
scgp
->
lun
);
struct
scsidevdata
*
sdd
;
struct
scsidevdata
*
sdd
;
write_log
(
" %2.01d,%d (= %3.d): "
,
scgp
->
target
,
scgp
->
lun
,
aunit
);
write_log
(
" %2.01d,%d (= %3.d): "
,
scgp
->
target
,
scgp
->
lun
,
aunit
);
print_product
(
&
inq
);
print_product
(
&
inq
);
sdd
=
add_scsidev_data
(
scgp
->
scsibus
,
scgp
->
target
,
scgp
->
lun
,
aunit
);
sdd
=
add_scsidev_data
(
scgp
->
scsibus
,
scgp
->
target
,
scgp
->
lun
,
aunit
);
write_log
(
!
sdd
?
" - init failed ???"
:
sdd
->
isatapi
?
" - ATAPI"
:
" - SCSI"
);
write_log
(
!
sdd
?
" - init failed ???"
:
sdd
->
isatapi
?
" - ATAPI"
:
" - SCSI"
);
write_log
(
"
\n
"
);
write_log
(
"
\n
"
);
}
}
}
}
}
}
}
}
return
m68k_dreg
(
regs
,
0
);
/* device base */
return
m68k_dreg
(
regs
,
0
);
/* device base */
}
}
...
@@ -791,7 +789,7 @@ void scsidev_reset (void)
...
@@ -791,7 +789,7 @@ void scsidev_reset (void)
for
(
i
=
0
;
i
<
num_drives
;
i
++
)
{
for
(
i
=
0
;
i
<
num_drives
;
i
++
)
{
if
(
!
drives
[
i
].
thread_running
)
{
if
(
!
drives
[
i
].
thread_running
)
{
continue
;
continue
;
}
}
write_comm_pipe_int
(
&
drives
[
i
].
requests
,
0
,
1
);
write_comm_pipe_int
(
&
drives
[
i
].
requests
,
0
,
1
);
uae_sem_wait
(
&
drives
[
i
].
sync_sem
);
uae_sem_wait
(
&
drives
[
i
].
sync_sem
);
...
@@ -801,8 +799,8 @@ void scsidev_reset (void)
...
@@ -801,8 +799,8 @@ void scsidev_reset (void)
#endif
#endif
if
(
scgp
)
{
if
(
scgp
)
{
closescsi
(
scgp
);
closescsi
(
scgp
);
scgp
=
NULL
;
scgp
=
NULL
;
}
}
#endif
#endif
...
...
src/scsiemul.c
View file @
c3278222
...
@@ -207,33 +207,33 @@ static uae_u32 REGPARAM2 dev_open_2 (TrapContext *context, int type)
...
@@ -207,33 +207,33 @@ static uae_u32 REGPARAM2 dev_open_2 (TrapContext *context, int type)
if
(
!
dev
)
if
(
!
dev
)
return
openfail
(
ioreq
,
32
);
/* badunitnum */
return
openfail
(
ioreq
,
32
);
/* badunitnum */
if
(
!
dev
->
opencnt
)
{
if
(
!
dev
->
opencnt
)
{
for
(
i
=
0
;
i
<
MAX_OPEN_DEVICES
;
i
++
)
{
for
(
i
=
0
;
i
<
MAX_OPEN_DEVICES
;
i
++
)
{
pdev
=
&
pdevst
[
i
];
pdev
=
&
pdevst
[
i
];
if
(
pdev
->
inuse
==
0
)
break
;
if
(
pdev
->
inuse
==
0
)
break
;
}
}
if
(
type
==
UAEDEV_SCSI_ID
&&
sys_command_open
(
dev
->
allow_scsi
?
DF_SCSI
:
DF_IOCTL
,
dev
->
unitnum
))
{
if
(
type
==
UAEDEV_SCSI_ID
&&
sys_command_open
(
dev
->
allow_scsi
?
DF_SCSI
:
DF_IOCTL
,
dev
->
unitnum
))
{
setpdev
(
pdev
,
dev
);
setpdev
(
pdev
,
dev
);
}
}
if
(
type
==
UAEDEV_DISK_ID
&&
sys_command_open
(
DF_IOCTL
,
dev
->
unitnum
))
{
if
(
type
==
UAEDEV_DISK_ID
&&
sys_command_open
(
DF_IOCTL
,
dev
->
unitnum
))
{
pdev
->
ioctl
=
1
;
pdev
->
ioctl
=
1
;
pdev
->
mode
=
DF_IOCTL
;
pdev
->
mode
=
DF_IOCTL
;
}
}
if
(
!
pdev
->
scsi
&&
!
pdev
->
ioctl
)
if
(
!
pdev
->
scsi
&&
!
pdev
->
ioctl
)
return
openfail
(
ioreq
,
IOERR_OPENFAIL
);
return
openfail
(
ioreq
,
IOERR_OPENFAIL
);
pdev
->
type
=
type
;
pdev
->
type
=
type
;
pdev
->
unit
=
unit
;
pdev
->
unit
=
unit
;
pdev
->
flags
=
flags
;
pdev
->
flags
=
flags
;
pdev
->
inuse
=
1
;
pdev
->
inuse
=
1
;
put_long
(
ioreq
+
24
,
pdev
-
pdevst
);
put_long
(
ioreq
+
24
,
pdev
-
pdevst
);
start_thread
(
dev
);
start_thread
(
dev
);
}
else
{
}
else
{
for
(
i
=
0
;
i
<
MAX_OPEN_DEVICES
;
i
++
)
{
for
(
i
=
0
;
i
<
MAX_OPEN_DEVICES
;
i
++
)
{
pdev
=
&
pdevst
[
i
];
pdev
=
&
pdevst
[
i
];
if
(
pdev
->
inuse
&&
pdev
->
unit
==
unit
)
break
;
if
(
pdev
->
inuse
&&
pdev
->
unit
==
unit
)
break
;
}
}
if
(
i
==
MAX_OPEN_DEVICES
)
if
(
i
==
MAX_OPEN_DEVICES
)
return
openfail
(
ioreq
,
IOERR_OPENFAIL
);
return
openfail
(
ioreq
,
IOERR_OPENFAIL
);
put_long
(
ioreq
+
24
,
pdev
-
pdevst
);
put_long
(
ioreq
+
24
,
pdev
-
pdevst
);
}
}
dev
->
opencnt
++
;
dev
->
opencnt
++
;
...
@@ -265,8 +265,8 @@ static int is_async_request (struct devstruct *dev, uaecptr request)
...
@@ -265,8 +265,8 @@ static int is_async_request (struct devstruct *dev, uaecptr request)
{
{
int
i
=
0
;
int
i
=
0
;
while
(
i
<
MAX_ASYNC_REQUESTS
)
{
while
(
i
<
MAX_ASYNC_REQUESTS
)
{
if
(
dev
->
d_request
[
i
]
==
request
)
return
1
;
if
(
dev
->
d_request
[
i
]
==
request
)
return
1
;
i
++
;
i
++
;
}
}
return
0
;
return
0
;
}
}
...
@@ -559,7 +559,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
...
@@ -559,7 +559,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
if
(
!
dev
->
di
.
media_inserted
)
if
(
!
dev
->
di
.
media_inserted
)
goto
no_media
;
goto
no_media
;
if
(
dev
->
di
.
write_protected
||
dev
->
drivetype
==
INQ_ROMD
)
{
if
(
dev
->
di
.
write_protected
||
dev
->
drivetype
==
INQ_ROMD
)
{
io_error
=
28
;
/* writeprotect */
io_error
=
28
;
/* writeprotect */
}
else
if
((
io_offset
&
bmask
)
||
bmask
==
0
||
io_data
==
0
)
{
}
else
if
((
io_offset
&
bmask
)
||
bmask
==
0
||
io_data
==
0
)
{
goto
bad_command
;
goto
bad_command
;
}
else
if
((
io_length
&
bmask
)
||
io_length
==
0
)
{
}
else
if
((
io_length
&
bmask
)
||
io_length
==
0
)
{
...
...
src/sysconfig.h
View file @
c3278222
...
@@ -293,7 +293,7 @@
...
@@ -293,7 +293,7 @@
#define PACKAGE_NAME "PUAE"
#define PACKAGE_NAME "PUAE"
/* Define to the full name and version of this package. */
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "PUAE 2.
1
.0"
#define PACKAGE_STRING "PUAE 2.
2
.0"
/* Define to the one symbol short name of this package. */
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "puae"
#define PACKAGE_TARNAME "puae"
...
@@ -302,7 +302,7 @@
...
@@ -302,7 +302,7 @@
#define PACKAGE_URL ""
#define PACKAGE_URL ""
/* Define to the version of this package. */
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.
1
.0"
#define PACKAGE_VERSION "2.
2
.0"
/* Define to the necessary symbol if this constant uses a non-standard name on
/* Define to the necessary symbol if this constant uses a non-standard name on
your system. */
your system. */
...
@@ -395,7 +395,7 @@
...
@@ -395,7 +395,7 @@
/* Version number of package */
/* Version number of package */
#define VERSION "2.
1
.0"
#define VERSION "2.
2
.0"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
significant byte first (like Motorola and SPARC, unlike Intel). */
...
...
src/tools/config.log
View file @
c3278222
...
@@ -445,7 +445,7 @@ configure:4344: $? = 0
...
@@ -445,7 +445,7 @@ configure:4344: $? = 0
configure:4344: result: yes
configure:4344: result: yes
configure:4350: checking for _doprnt
configure:4350: checking for _doprnt
configure:4350: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
configure:4350: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/cc
SMtDaE
.o: In function `main':
/tmp/cc
duySMn
.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:67: undefined reference to `_doprnt'
/home/gnostic/puaex/src/tools/conftest.c:67: undefined reference to `_doprnt'
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
configure:4350: $? = 1
configure:4350: $? = 1
...
@@ -533,7 +533,7 @@ configure:4364: $? = 0
...
@@ -533,7 +533,7 @@ configure:4364: $? = 0
configure:4364: result: yes
configure:4364: result: yes
configure:4364: checking for strcmpi
configure:4364: checking for strcmpi
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/cc
MreunT
.o: In function `main':
/tmp/cc
gpaTxE
.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `strcmpi'
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `strcmpi'
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
configure:4364: $? = 1
configure:4364: $? = 1
...
@@ -613,7 +613,7 @@ configure: failed program was:
...
@@ -613,7 +613,7 @@ configure: failed program was:
configure:4364: result: no
configure:4364: result: no
configure:4364: checking for stricmp
configure:4364: checking for stricmp
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/cc
fHXHOY
.o: In function `main':
/tmp/cc
AjejvH
.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `stricmp'
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `stricmp'
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
configure:4364: $? = 1
configure:4364: $? = 1
...
...
src/traps.c
View file @
c3278222
...
@@ -227,8 +227,6 @@ static void *trap_thread (void *arg)
...
@@ -227,8 +227,6 @@ static void *trap_thread (void *arg)
{
{
TrapContext
*
context
=
(
TrapContext
*
)
arg
;
TrapContext
*
context
=
(
TrapContext
*
)
arg
;
uae_set_thread_priority
(
2
);
/* Wait until main thread is ready to switch to the
/* Wait until main thread is ready to switch to the
* this trap context. */
* this trap context. */
uae_sem_wait
(
&
context
->
switch_to_trap_sem
);
uae_sem_wait
(
&
context
->
switch_to_trap_sem
);
...
...
src/uaeexe.c
View file @
c3278222
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
static
struct
uae_xcmd
*
first
=
NULL
;
static
struct
uae_xcmd
*
first
=
NULL
;
static
struct
uae_xcmd
*
last
=
NULL
;
static
struct
uae_xcmd
*
last
=
NULL
;
static
TCHAR
running
=
0
;
static
TCHAR
running
=
0
;
static
uae_u32
uaeexe_server
(
TrapContext
*
context
)
REGPARAM
;
static
uae_u32
REGPARAM3
uaeexe_server
(
TrapContext
*
context
)
REGPARAM
;
/*
/*
* Install the server
* Install the server
...
...
src/uaelib.c
View file @
c3278222
...
@@ -57,7 +57,7 @@ static uae_u32 emulib_Reset (void)
...
@@ -57,7 +57,7 @@ static uae_u32 emulib_Reset (void)
static
uae_u32
emulib_EnableSound
(
uae_u32
val
)
static
uae_u32
emulib_EnableSound
(
uae_u32
val
)
{
{
if
(
!
sound_available
||
currprefs
.
produce_sound
==
2
)
if
(
!
sound_available
||
currprefs
.
produce_sound
==
2
)
return
0
;
return
0
;
currprefs
.
produce_sound
=
val
;
currprefs
.
produce_sound
=
val
;
return
1
;
return
1
;
...
@@ -79,12 +79,12 @@ static uae_u32 emulib_EnableJoystick (uae_u32 val)
...
@@ -79,12 +79,12 @@ static uae_u32 emulib_EnableJoystick (uae_u32 val)
static
uae_u32
emulib_SetFrameRate
(
uae_u32
val
)
static
uae_u32
emulib_SetFrameRate
(
uae_u32
val
)
{
{
if
(
val
==
0
)
if
(
val
==
0
)
return
0
;
return
0
;
else
if
(
val
>
20
)
else
if
(
val
>
20
)
return
0
;
return
0
;
else
{
else
{
currprefs
.
gfx_framerate
=
val
;
currprefs
.
gfx_framerate
=
val
;
return
1
;
return
1
;
}
}
}
}
...
@@ -191,7 +191,7 @@ static uae_u32 emulib_InsertDisk (uaecptr name, uae_u32 drive)
...
@@ -191,7 +191,7 @@ static uae_u32 emulib_InsertDisk (uaecptr name, uae_u32 drive)
return
0
;
return
0
;
while
((
real_name
[
i
]
=
get_byte
(
name
+
i
))
!=
0
&&
i
++
!=
254
)
while
((
real_name
[
i
]
=
get_byte
(
name
+
i
))
!=
0
&&
i
++
!=
254
)
;
;
if
(
i
==
255
)
if
(
i
==
255
)
return
0
;
/* ENAMETOOLONG */
return
0
;
/* ENAMETOOLONG */
...
@@ -371,32 +371,32 @@ static uae_u32 REGPARAM2 uaelib_demux2 (TrapContext *context)
...
@@ -371,32 +371,32 @@ static uae_u32 REGPARAM2 uaelib_demux2 (TrapContext *context)
switch
(
ARG0
)
switch
(
ARG0
)
{
{
case
0
:
return
emulib_GetVersion
();
case
0
:
return
emulib_GetVersion
();
case
1
:
return
emulib_GetUaeConfig
(
ARG1
);
case
1
:
return
emulib_GetUaeConfig
(
ARG1
);
case
2
:
return
emulib_SetUaeConfig
(
ARG1
);
case
2
:
return
emulib_SetUaeConfig
(
ARG1
);
case
3
:
return
emulib_HardReset
();
case
3
:
return
emulib_HardReset
();
case
4
:
return
emulib_Reset
();
case
4
:
return
emulib_Reset
();
case
5
:
return
emulib_InsertDisk
(
ARG1
,
ARG2
);
case
5
:
return
emulib_InsertDisk
(
ARG1
,
ARG2
);
case
6
:
return
emulib_EnableSound
(
ARG1
);
case
6
:
return
emulib_EnableSound
(
ARG1
);
case
7
:
return
emulib_EnableJoystick
(
ARG1
);
case
7
:
return
emulib_EnableJoystick
(
ARG1
);
case
8
:
return
emulib_SetFrameRate
(
ARG1
);
case
8
:
return
emulib_SetFrameRate
(
ARG1
);
case
9
:
return
emulib_ChgCMemSize
(
ARG1
);
case
9
:
return
emulib_ChgCMemSize
(
ARG1
);
case
10
:
return
emulib_ChgSMemSize
(
ARG1
);
case
10
:
return
emulib_ChgSMemSize
(
ARG1
);
case
11
:
return
emulib_ChgFMemSize
(
ARG1
);
case
11
:
return
emulib_ChgFMemSize
(
ARG1
);
case
12
:
return
emulib_ChangeLanguage
(
ARG1
);
case
12
:
return
emulib_ChangeLanguage
(
ARG1
);
/* The next call brings bad luck */
/* The next call brings bad luck */
case
13
:
return
emulib_ExitEmu
();
case
13
:
return
emulib_ExitEmu
();
case
14
:
return
emulib_GetDisk
(
ARG1
,
ARG2
);
case
14
:
return
emulib_GetDisk
(
ARG1
,
ARG2
);
case
15
:
return
emulib_Debug
();
case
15
:
return
emulib_Debug
();
case
68
:
return
emulib_Minimize
();
case
68
:
return
emulib_Minimize
();
case
69
:
return
emulib_ExecuteNativeCode
();
case
69
:
return
emulib_ExecuteNativeCode
();
case
70
:
return
0
;
/* RESERVED. Something uses this.. */
case
70
:
return
0
;
/* RESERVED. Something uses this.. */
case
80
:
return
currprefs
.
maprom
?
currprefs
.
maprom
:
0xffffffff
;
case
80
:
return
currprefs
.
maprom
?
currprefs
.
maprom
:
0xffffffff
;
case
81
:
return
cfgfile_uaelib
(
ARG1
,
ARG2
,
ARG3
,
ARG4
);
case
81
:
return
cfgfile_uaelib
(
ARG1
,
ARG2
,
ARG3
,
ARG4
);
case
82
:
return
cfgfile_uaelib_modify
(
ARG1
,
ARG2
,
ARG3
,
ARG4
,
ARG5
);
case
82
:
return
cfgfile_uaelib_modify
(
ARG1
,
ARG2
,
ARG3
,
ARG4
,
ARG5
);
case
83
:
currprefs
.
mmkeyboard
=
ARG1
?
1
:
0
;
return
currprefs
.
mmkeyboard
;
case
83
:
currprefs
.
mmkeyboard
=
ARG1
?
1
:
0
;
return
currprefs
.
mmkeyboard
;
#ifdef DEBUGGER
#ifdef DEBUGGER
case
84
:
return
mmu_init
(
ARG1
,
ARG2
,
ARG3
);
case
84
:
return
mmu_init
(
ARG1
,
ARG2
,
ARG3
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment