Removed stuff that doesn't belong here (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2011-11-25 12:56:43 +00:00
parent c5b80adf87
commit cb3d823e86
2 changed files with 2 additions and 210 deletions

View File

@ -35,8 +35,7 @@ INLINE void assert_is_snapshot_or_quickload(device_t *device)
{
assert(device != NULL);
assert(downcast<const legacy_device_base *>(device)->inline_config() != NULL);
assert((device->type() == SNAPSHOT) || (device->type() == QUICKLOAD)
|| (device->type() == Z80BIN));
assert((device->type() == SNAPSHOT) || (device->type() == QUICKLOAD));
}
@ -66,39 +65,10 @@ INLINE const snapquick_config *get_config(device_t *device)
INLINE const snapquick_config *get_config_dev(const device_t *device)
{
assert(device != NULL);
assert((device->type() == SNAPSHOT) || (device->type() == QUICKLOAD)
|| (device->type() == Z80BIN));
assert((device->type() == SNAPSHOT) || (device->type() == QUICKLOAD));
return (const snapquick_config *) downcast<const legacy_device_base *>(device)->inline_config();
}
/*-------------------------------------------------
log_quickload - logs and displays useful
data for the end user
-------------------------------------------------*/
void log_quickload(const char *type, UINT32 start, UINT32 length, UINT32 exec, const char *exec_format)
{
astring tempstring;
logerror("Loading %04X bytes of RAM at %04X\n", length, start);
tempstring.catprintf("Quickload type: %s Length: %d bytes\n", type, length);
tempstring.catprintf("Start: 0x%04X End: 0x%04X Exec: ", start, start + length - 1);
logerror("Quickload loaded.\n");
if (!mame_stricmp(exec_format, EXEC_NA))
tempstring.cat("N/A");
else
{
logerror("Execution can resume with ");
logerror(exec_format, exec);
logerror("\n");
tempstring.catprintf(exec_format, exec);
}
ui_popup_time(10, "%s", tempstring.cstr());
}
/***************************************************************************
IMPLEMENTATION
***************************************************************************/
@ -231,143 +201,5 @@ DEVICE_GET_INFO(quickload)
default: DEVICE_GET_INFO_CALL(snapquick); break;
}
}
/*-------------------------------------------------
z80bin_load_file - load a z80bin file into
memory
-------------------------------------------------*/
static int z80bin_load_file(device_image_interface *image, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr )
{
int ch;
UINT16 args[3];
UINT16 i=0, j, size;
UINT8 data;
char pgmname[256];
char message[256];
image->fseek(7, SEEK_SET);
while((ch = image->fgetc()) != 0x1A)
{
if (ch == EOF)
{
image->seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file name");
image->message(" Unexpected EOF while getting file name");
return IMAGE_INIT_FAIL;
}
if (ch != '\0')
{
if (i >= (ARRAY_LENGTH(pgmname) - 1))
{
image->seterror(IMAGE_ERROR_INVALIDIMAGE, "File name too long");
image->message(" File name too long");
return IMAGE_INIT_FAIL;
}
pgmname[i] = ch; /* build program name */
i++;
}
}
pgmname[i] = '\0'; /* terminate string with a null */
if (image->fread(args, sizeof(args)) != sizeof(args))
{
image->seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file size");
image->message(" Unexpected EOF while getting file size");
return IMAGE_INIT_FAIL;
}
exec_addr[0] = LITTLE_ENDIANIZE_INT16(args[0]);
start_addr[0] = LITTLE_ENDIANIZE_INT16(args[1]);
end_addr[0] = LITTLE_ENDIANIZE_INT16(args[2]);
size = (end_addr[0] - start_addr[0] + 1) & 0xffff;
/* display a message about the loaded quickload */
image->message(" %s\nsize=%04X : start=%04X : end=%04X : exec=%04X",pgmname,size,start_addr[0],end_addr[0],exec_addr[0]);
for (i = 0; i < size; i++)
{
j = (start_addr[0] + i) & 0xffff;
if (image->fread(&data, 1) != 1)
{
snprintf(message, ARRAY_LENGTH(message), "%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j);
image->seterror(IMAGE_ERROR_INVALIDIMAGE, message);
image->message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j);
return IMAGE_INIT_FAIL;
}
image->device().machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte(j, data);
}
return IMAGE_INIT_PASS;
}
/*-------------------------------------------------
QUICKLOAD_LOAD( z80bin )
-------------------------------------------------*/
static QUICKLOAD_LOAD( z80bin )
{
const z80bin_config *config;
UINT16 exec_addr, start_addr, end_addr;
int autorun;
/* load the binary into memory */
if (z80bin_load_file(&image, file_type, &exec_addr, &start_addr, &end_addr) == IMAGE_INIT_FAIL)
return IMAGE_INIT_FAIL;
/* is this file executable? */
if (exec_addr != 0xffff)
{
config = (const z80bin_config *)downcast<const legacy_device_base &>(image.device()).inline_config();
/* check to see if autorun is on (I hate how this works) */
autorun = input_port_read_safe(image.device().machine(), "CONFIG", 0xFF) & 1;
/* start program */
if (config->execute != NULL)
{
(*config->execute)(image.device().machine(), start_addr, end_addr, exec_addr, autorun);
}
else
{
if (autorun)
cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, exec_addr);
}
}
return IMAGE_INIT_PASS;
}
/*-------------------------------------------------
DEVICE_GET_INFO(z80bin)
-------------------------------------------------*/
DEVICE_GET_INFO(z80bin)
{
/* quickload */
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = sizeof(z80bin_config); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_IMAGE_FILE_EXTENSIONS: strcpy(info->s, "bin"); break;
/* --- the following bits of info are returned as pointers to functions --- */
case DEVINFO_FCT_SNAPSHOT_QUICKLOAD_LOAD: info->f = (genf *) quickload_load_z80bin; break;
default: DEVICE_GET_INFO_CALL(quickload); break;
}
}
DEFINE_LEGACY_IMAGE_DEVICE(Z80BIN, z80bin);
DEFINE_LEGACY_IMAGE_DEVICE(SNAPSHOT, snapshot);
DEFINE_LEGACY_IMAGE_DEVICE(QUICKLOAD, quickload);

View File

@ -10,8 +10,6 @@
#define __SNAPQUIK_H__
#include "image.h"
#include "ui.h"
/***************************************************************************
CONSTANTS
@ -30,7 +28,6 @@ enum
DECLARE_LEGACY_IMAGE_DEVICE(SNAPSHOT, snapshot);
DECLARE_LEGACY_IMAGE_DEVICE(QUICKLOAD, quickload);
DECLARE_LEGACY_IMAGE_DEVICE(Z80BIN, z80bin);
#define SNAPSHOT_LOAD_NAME(name) snapshot_load_##name
#define SNAPSHOT_LOAD(name) int SNAPSHOT_LOAD_NAME(name)(device_image_interface &image, const char *file_type, int snapshot_size)
@ -38,17 +35,6 @@ DECLARE_LEGACY_IMAGE_DEVICE(Z80BIN, z80bin);
#define QUICKLOAD_LOAD_NAME(name) quickload_load_##name
#define QUICKLOAD_LOAD(name) int QUICKLOAD_LOAD_NAME(name)(device_image_interface &image, const char *file_type, int quickload_size)
#define Z80BIN_EXECUTE_NAME(name) z80bin_execute_##name
#define Z80BIN_EXECUTE(name) void Z80BIN_EXECUTE_NAME(name)(running_machine &machine, UINT16 start_address, UINT16 end_address, UINT16 execute_address, int autorun)
#define LOAD_REG(_cpu, _reg, _data) \
do { \
cpu_set_reg(_cpu, _reg, (_data)); \
} while (0)
#define EXEC_NA "N/A"
#define z80bin_execute_default NULL
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
@ -64,15 +50,6 @@ struct _snapquick_config
attoseconds_t delay_attoseconds; /* loading delay (attoseconds) */
};
typedef void (*z80bin_execute_func)(running_machine &machine, UINT16 start_address, UINT16 end_address, UINT16 execute_address, int autorun);
typedef struct _z80bin_config z80bin_config;
struct _z80bin_config
{
snapquick_config base;
z80bin_execute_func execute;
};
/***************************************************************************
SNAPSHOT DEVICE CONFIGURATION MACROS
***************************************************************************/
@ -95,21 +72,4 @@ struct _z80bin_config
MCFG_DEVICE_CONFIG_DATA64(snapquick_config, delay_seconds, (seconds_t) (_delay)) \
MCFG_DEVICE_CONFIG_DATA64(snapquick_config, delay_attoseconds, (attoseconds_t) (((_delay) - (int)(_delay)) * ATTOSECONDS_PER_SECOND)) \
/***************************************************************************
Z80BIN QUICKLOAD DEVICE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_Z80BIN_QUICKLOAD_ADD(_tag, _execute, _delay) \
MCFG_DEVICE_ADD(_tag, Z80BIN, 0) \
MCFG_DEVICE_CONFIG_DATA64(snapquick_config, delay_seconds, (seconds_t) (_delay)) \
MCFG_DEVICE_CONFIG_DATA64(snapquick_config, delay_attoseconds, (attoseconds_t) (((_delay) - (int)(_delay)) * ATTOSECONDS_PER_SECOND)) \
MCFG_DEVICE_CONFIG_DATAPTR(z80bin_config, execute, Z80BIN_EXECUTE_NAME(_execute))
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
void log_quickload(const char *type, UINT32 start, UINT32 length, UINT32 exec, const char *exec_format);
#endif /* __SNAPQUIK_H__ */