mirror of
https://github.com/holub/mame
synced 2025-10-07 09:25:34 +03:00
Finished moving quicload/snapshot formats into machine folder (nw)
This commit is contained in:
parent
6370e160b6
commit
bdb76fda6e
18
.gitattributes
vendored
18
.gitattributes
vendored
@ -6327,16 +6327,6 @@ src/mess/drivers/zexall.c svneol=native#text/plain
|
||||
src/mess/drivers/zrt80.c svneol=native#text/plain
|
||||
src/mess/drivers/zsbc3.c svneol=native#text/plain
|
||||
src/mess/drivers/zx.c svneol=native#text/plain
|
||||
src/mess/formats/cbm_crt.c svneol=native#text/plain
|
||||
src/mess/formats/cbm_crt.h svneol=native#text/plain
|
||||
src/mess/formats/cbm_snqk.c svneol=native#text/plain
|
||||
src/mess/formats/cbm_snqk.h svneol=native#text/plain
|
||||
src/mess/formats/spec_snqk.c svneol=native#text/plain
|
||||
src/mess/formats/spec_snqk.h svneol=native#text/plain
|
||||
src/mess/formats/timex_dck.c svneol=native#text/plain
|
||||
src/mess/formats/timex_dck.h svneol=native#text/plain
|
||||
src/mess/formats/z80bin.c svneol=native#text/plain
|
||||
src/mess/formats/z80bin.h svneol=native#text/plain
|
||||
src/mess/includes/a7800.h svneol=native#text/plain
|
||||
src/mess/includes/abc1600.h svneol=native#text/plain
|
||||
src/mess/includes/abc80.h svneol=native#text/plain
|
||||
@ -7012,6 +7002,10 @@ src/mess/machine/cbm2exp.c svneol=native#text/plain
|
||||
src/mess/machine/cbm2exp.h svneol=native#text/plain
|
||||
src/mess/machine/cbm2user.c svneol=native#text/plain
|
||||
src/mess/machine/cbm2user.h svneol=native#text/plain
|
||||
src/mess/machine/cbm_crt.c svneol=native#text/plain
|
||||
src/mess/machine/cbm_crt.h svneol=native#text/plain
|
||||
src/mess/machine/cbm_snqk.c svneol=native#text/plain
|
||||
src/mess/machine/cbm_snqk.h svneol=native#text/plain
|
||||
src/mess/machine/cbmiec.c svneol=native#text/plain
|
||||
src/mess/machine/cbmiec.h svneol=native#text/plain
|
||||
src/mess/machine/cbmipt.c svneol=native#text/plain
|
||||
@ -7477,6 +7471,8 @@ src/mess/machine/sonydriv.h svneol=native#text/plain
|
||||
src/mess/machine/sorcerer.c svneol=native#text/plain
|
||||
src/mess/machine/southbridge.c svneol=native#text/plain
|
||||
src/mess/machine/southbridge.h svneol=native#text/plain
|
||||
src/mess/machine/spec_snqk.c svneol=native#text/plain
|
||||
src/mess/machine/spec_snqk.h svneol=native#text/plain
|
||||
src/mess/machine/special.c svneol=native#text/plain
|
||||
src/mess/machine/strata.c svneol=native#text/plain
|
||||
src/mess/machine/strata.h svneol=native#text/plain
|
||||
@ -7679,6 +7675,8 @@ src/mess/machine/x68k_scsiext.c svneol=native#text/plain
|
||||
src/mess/machine/x68k_scsiext.h svneol=native#text/plain
|
||||
src/mess/machine/x68kexp.c svneol=native#text/plain
|
||||
src/mess/machine/x68kexp.h svneol=native#text/plain
|
||||
src/mess/machine/z80bin.c svneol=native#text/plain
|
||||
src/mess/machine/z80bin.h svneol=native#text/plain
|
||||
src/mess/machine/z80ne.c svneol=native#text/plain
|
||||
src/mess/machine/z88_flash.c svneol=native#text/plain
|
||||
src/mess/machine/z88_flash.h svneol=native#text/plain
|
||||
|
@ -28,6 +28,11 @@
|
||||
|
||||
|
||||
|
||||
static QUICKLOAD_LOAD( cbm_c64 )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbm_quick_sethiaddress);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// INTERRUPTS
|
||||
//**************************************************************************
|
||||
|
@ -28,6 +28,10 @@
|
||||
#define VA13 BIT(va, 13)
|
||||
#define VA12 BIT(va, 12)
|
||||
|
||||
static QUICKLOAD_LOAD( cbm_c64 )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbm_quick_sethiaddress);
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -57,12 +57,25 @@ bus serial (available in all modes), a Fast and a Burst serial bus
|
||||
#include "machine/cbmipt.h"
|
||||
#include "video/vic4567.h"
|
||||
#include "includes/cbm.h"
|
||||
#include "formats/cbm_snqk.h"
|
||||
#include "machine/cbm_snqk.h"
|
||||
#include "includes/c64_legacy.h"
|
||||
#include "includes/c65.h"
|
||||
#include "machine/cbmiec.h"
|
||||
#include "machine/ram.h"
|
||||
|
||||
static void cbm_c65_quick_sethiaddress( running_machine &machine, UINT16 hiaddress )
|
||||
{
|
||||
address_space &space = machine.firstcpu->space(AS_PROGRAM);
|
||||
|
||||
space.write_byte(0x82, hiaddress & 0xff);
|
||||
space.write_byte(0x83, hiaddress >> 8);
|
||||
}
|
||||
|
||||
static QUICKLOAD_LOAD( cbm_c65 )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbm_c65_quick_sethiaddress);
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Main CPU memory handlers
|
||||
|
@ -29,7 +29,23 @@
|
||||
#define A0 BIT(offset, 0)
|
||||
#define VA12 BIT(va, 12)
|
||||
|
||||
static void cbmb_quick_sethiaddress(running_machine &machine, UINT16 hiaddress)
|
||||
{
|
||||
address_space &space = machine.firstcpu->space(AS_PROGRAM);
|
||||
|
||||
space.write_byte(0xf0046, hiaddress & 0xff);
|
||||
space.write_byte(0xf0047, hiaddress >> 8);
|
||||
}
|
||||
|
||||
static QUICKLOAD_LOAD( cbmb )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0x10000, cbmb_quick_sethiaddress);
|
||||
}
|
||||
|
||||
static QUICKLOAD_LOAD( p500 )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbmb_quick_sethiaddress);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// ADDRESS DECODING
|
||||
|
@ -91,7 +91,6 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "includes/mbee.h"
|
||||
#include "formats/z80bin.h"
|
||||
|
||||
#define XTAL_13_5MHz 13500000
|
||||
|
||||
|
@ -152,7 +152,22 @@ ROM sockets: UA3 2K or 4K character
|
||||
|
||||
#include "includes/pet2001.h"
|
||||
|
||||
static void cbm_pet_quick_sethiaddress( running_machine &machine, UINT16 hiaddress )
|
||||
{
|
||||
address_space &space = machine.firstcpu->space(AS_PROGRAM);
|
||||
|
||||
space.write_byte(0x2e, hiaddress & 0xff);
|
||||
space.write_byte(0x2c, hiaddress & 0xff);
|
||||
space.write_byte(0x2a, hiaddress & 0xff);
|
||||
space.write_byte(0x2f, hiaddress >> 8);
|
||||
space.write_byte(0x2d, hiaddress >> 8);
|
||||
space.write_byte(0x2b, hiaddress >> 8);
|
||||
}
|
||||
|
||||
static QUICKLOAD_LOAD( cbm_pet )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbm_pet_quick_sethiaddress);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// INTERRUPTS
|
||||
|
@ -33,6 +33,11 @@
|
||||
|
||||
|
||||
|
||||
static QUICKLOAD_LOAD( cbm_c16 )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbm_quick_sethiaddress);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// INTERRUPTS
|
||||
//**************************************************************************
|
||||
|
@ -156,7 +156,6 @@ NOTES (2011-08-08)
|
||||
********************************************************************************/
|
||||
|
||||
#include "includes/sorcerer.h"
|
||||
#include "formats/z80bin.h"
|
||||
|
||||
static ADDRESS_MAP_START( sorcerer_mem, AS_PROGRAM, 8, sorcerer_state)
|
||||
ADDRESS_MAP_UNMAP_HIGH
|
||||
|
@ -278,7 +278,7 @@ SamRam
|
||||
#include "sound/wave.h"
|
||||
#include "includes/spectrum.h"
|
||||
#include "formats/tzx_cas.h"
|
||||
#include "formats/spec_snqk.h"
|
||||
#include "machine/spec_snqk.h"
|
||||
|
||||
|
||||
/****************************************************************************************************/
|
||||
|
@ -183,7 +183,6 @@ hardware.
|
||||
|
||||
#include "super80.lh"
|
||||
#include "includes/super80.h"
|
||||
#include "formats/z80bin.h"
|
||||
|
||||
#define MASTER_CLOCK (XTAL_12MHz)
|
||||
#define PIXEL_CLOCK (MASTER_CLOCK/2)
|
||||
|
@ -153,11 +153,124 @@ http://www.z88forever.org.uk/zxplus3e/
|
||||
#include "sound/speaker.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "formats/tzx_cas.h"
|
||||
#include "formats/spec_snqk.h"
|
||||
#include "formats/timex_dck.h"
|
||||
#include "machine/spec_snqk.h"
|
||||
#include "machine/beta.h"
|
||||
#include "machine/ram.h"
|
||||
|
||||
enum
|
||||
{
|
||||
TIMEX_CART_NONE,
|
||||
TIMEX_CART_DOCK,
|
||||
TIMEX_CART_EXROM,
|
||||
TIMEX_CART_HOME
|
||||
};
|
||||
|
||||
struct timex_cart_t
|
||||
{
|
||||
int type;
|
||||
UINT8 chunks;
|
||||
UINT8 *data;
|
||||
};
|
||||
|
||||
static timex_cart_t timex_cart;
|
||||
|
||||
|
||||
DEVICE_IMAGE_LOAD_LEGACY( timex_cart )
|
||||
{
|
||||
int file_size;
|
||||
UINT8 * file_data;
|
||||
|
||||
int chunks_in_file = 0;
|
||||
|
||||
int i;
|
||||
|
||||
logerror ("Trying to load cart\n");
|
||||
|
||||
file_size = image.length();
|
||||
|
||||
if (file_size < 0x09)
|
||||
{
|
||||
logerror ("Bad file size\n");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
file_data = (UINT8 *)malloc(file_size);
|
||||
if (file_data == NULL)
|
||||
{
|
||||
logerror ("Memory allocating error\n");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
image.fread(file_data, file_size);
|
||||
|
||||
for (i=0; i<8; i++)
|
||||
if(file_data[i+1]&0x02) chunks_in_file++;
|
||||
|
||||
if (chunks_in_file*0x2000+0x09 != file_size)
|
||||
{
|
||||
free (file_data);
|
||||
logerror ("File corrupted\n");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
switch (file_data[0x00])
|
||||
{
|
||||
case 0x00: logerror ("DOCK cart\n");
|
||||
timex_cart.type = TIMEX_CART_DOCK;
|
||||
timex_cart.data = (UINT8*) malloc (0x10000);
|
||||
if (!timex_cart.data)
|
||||
{
|
||||
free (file_data);
|
||||
logerror ("Memory allocate error\n");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
chunks_in_file = 0;
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
timex_cart.chunks = timex_cart.chunks | ((file_data[i+1]&0x01)<<i);
|
||||
if (file_data[i+1]&0x02)
|
||||
{
|
||||
memcpy (timex_cart.data+i*0x2000, file_data+0x09+chunks_in_file*0x2000, 0x2000);
|
||||
chunks_in_file++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (file_data[i+1]&0x01)
|
||||
memset (timex_cart.data+i*0x2000, 0x00, 0x2000);
|
||||
else
|
||||
memset (timex_cart.data+i*0x2000, 0xff, 0x2000);
|
||||
}
|
||||
}
|
||||
free (file_data);
|
||||
break;
|
||||
|
||||
default: logerror ("Cart type not supported\n");
|
||||
free (file_data);
|
||||
timex_cart.type = TIMEX_CART_NONE;
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
logerror ("Cart loaded\n");
|
||||
logerror ("Chunks %02x\n", timex_cart.chunks);
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
DEVICE_IMAGE_UNLOAD_LEGACY( timex_cart )
|
||||
{
|
||||
if (timex_cart.data)
|
||||
{
|
||||
free (timex_cart.data);
|
||||
timex_cart.data = NULL;
|
||||
}
|
||||
timex_cart.type = TIMEX_CART_NONE;
|
||||
timex_cart.chunks = 0x00;
|
||||
}
|
||||
|
||||
const timex_cart_t *timex_cart_data(void)
|
||||
{
|
||||
return &timex_cart;
|
||||
}
|
||||
|
||||
static const ay8910_interface spectrum_ay_interface =
|
||||
{
|
||||
AY8910_LEGACY_OUTPUT,
|
||||
|
@ -11,6 +11,11 @@
|
||||
|
||||
|
||||
|
||||
static QUICKLOAD_LOAD( cbm_vc20 )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbm_quick_sethiaddress);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// MEMORY MANAGEMENT
|
||||
//**************************************************************************
|
||||
|
@ -1,184 +0,0 @@
|
||||
/***********************************************
|
||||
|
||||
CBM Quickloads
|
||||
|
||||
***********************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "cbm_snqk.h"
|
||||
|
||||
/* prg file format
|
||||
* sfx file format
|
||||
* sda file format
|
||||
* 0 lsb 16bit address
|
||||
* 2 chip data */
|
||||
|
||||
/* p00 file format (p00 .. p63, s00 .. s63, ..)
|
||||
* 0x0000 C64File
|
||||
* 0x0007 0
|
||||
* 0x0008 Name in commodore encoding?
|
||||
* 0x0018 0 0
|
||||
* 0x001a lsb 16bit address
|
||||
* 0x001c data */
|
||||
|
||||
|
||||
static int general_cbm_loadsnap( device_image_interface &image, const char *file_type, int snapshot_size,
|
||||
offs_t offset, void (*cbm_sethiaddress)(running_machine &machine, UINT16 hiaddress) )
|
||||
{
|
||||
char buffer[7];
|
||||
UINT8 *data = NULL;
|
||||
UINT32 bytesread;
|
||||
UINT16 address = 0;
|
||||
int i;
|
||||
address_space &space = image.device().machine().firstcpu->space(AS_PROGRAM);
|
||||
|
||||
if (!file_type)
|
||||
goto error;
|
||||
|
||||
if (!mame_stricmp(file_type, "prg"))
|
||||
{
|
||||
/* prg files */
|
||||
}
|
||||
else if (!mame_stricmp(file_type, "p00"))
|
||||
{
|
||||
/* p00 files */
|
||||
if (image.fread( buffer, sizeof(buffer)) != sizeof(buffer))
|
||||
goto error;
|
||||
if (memcmp(buffer, "C64File", sizeof(buffer)))
|
||||
goto error;
|
||||
image.fseek(26, SEEK_SET);
|
||||
snapshot_size -= 26;
|
||||
}
|
||||
else if (!mame_stricmp(file_type, "t64"))
|
||||
{
|
||||
/* t64 files - for GB64 Single T64s loading to x0801 - header is always the same size */
|
||||
if (image.fread( buffer, sizeof(buffer)) != sizeof(buffer))
|
||||
goto error;
|
||||
if (memcmp(buffer, "C64 tape image file", sizeof(buffer)))
|
||||
goto error;
|
||||
image.fseek(94, SEEK_SET);
|
||||
snapshot_size -= 94;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
image.fread( &address, 2);
|
||||
address = LITTLE_ENDIANIZE_INT16(address);
|
||||
if (!mame_stricmp(file_type, "t64"))
|
||||
address = 2049;
|
||||
snapshot_size -= 2;
|
||||
|
||||
data = (UINT8*)malloc(snapshot_size);
|
||||
if (!data)
|
||||
goto error;
|
||||
|
||||
bytesread = image.fread( data, snapshot_size);
|
||||
if (bytesread != snapshot_size)
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < snapshot_size; i++)
|
||||
space.write_byte(address + i + offset, data[i]);
|
||||
|
||||
cbm_sethiaddress(image.device().machine(), address + snapshot_size);
|
||||
free(data);
|
||||
return IMAGE_INIT_PASS;
|
||||
|
||||
error:
|
||||
if (data)
|
||||
free(data);
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
static void cbm_quick_sethiaddress( running_machine &machine, UINT16 hiaddress )
|
||||
{
|
||||
address_space &space = machine.firstcpu->space(AS_PROGRAM);
|
||||
|
||||
space.write_byte(0x31, hiaddress & 0xff);
|
||||
space.write_byte(0x2f, hiaddress & 0xff);
|
||||
space.write_byte(0x2d, hiaddress & 0xff);
|
||||
space.write_byte(0x32, hiaddress >> 8);
|
||||
space.write_byte(0x30, hiaddress >> 8);
|
||||
space.write_byte(0x2e, hiaddress >> 8);
|
||||
}
|
||||
|
||||
QUICKLOAD_LOAD( cbm_c16 )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbm_quick_sethiaddress);
|
||||
}
|
||||
|
||||
QUICKLOAD_LOAD( cbm_c64 )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbm_quick_sethiaddress);
|
||||
}
|
||||
|
||||
QUICKLOAD_LOAD( cbm_vc20 )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbm_quick_sethiaddress);
|
||||
}
|
||||
|
||||
static void cbm_pet_quick_sethiaddress( running_machine &machine, UINT16 hiaddress )
|
||||
{
|
||||
address_space &space = machine.firstcpu->space(AS_PROGRAM);
|
||||
|
||||
space.write_byte(0x2e, hiaddress & 0xff);
|
||||
space.write_byte(0x2c, hiaddress & 0xff);
|
||||
space.write_byte(0x2a, hiaddress & 0xff);
|
||||
space.write_byte(0x2f, hiaddress >> 8);
|
||||
space.write_byte(0x2d, hiaddress >> 8);
|
||||
space.write_byte(0x2b, hiaddress >> 8);
|
||||
}
|
||||
|
||||
QUICKLOAD_LOAD( cbm_pet )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbm_pet_quick_sethiaddress);
|
||||
}
|
||||
|
||||
static void cbm_pet1_quick_sethiaddress(running_machine &machine, UINT16 hiaddress)
|
||||
{
|
||||
address_space &space = machine.firstcpu->space(AS_PROGRAM);
|
||||
|
||||
space.write_byte(0x80, hiaddress & 0xff);
|
||||
space.write_byte(0x7e, hiaddress & 0xff);
|
||||
space.write_byte(0x7c, hiaddress & 0xff);
|
||||
space.write_byte(0x81, hiaddress >> 8);
|
||||
space.write_byte(0x7f, hiaddress >> 8);
|
||||
space.write_byte(0x7d, hiaddress >> 8);
|
||||
}
|
||||
|
||||
QUICKLOAD_LOAD( cbm_pet1 )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbm_pet1_quick_sethiaddress);
|
||||
}
|
||||
|
||||
static void cbmb_quick_sethiaddress(running_machine &machine, UINT16 hiaddress)
|
||||
{
|
||||
address_space &space = machine.firstcpu->space(AS_PROGRAM);
|
||||
|
||||
space.write_byte(0xf0046, hiaddress & 0xff);
|
||||
space.write_byte(0xf0047, hiaddress >> 8);
|
||||
}
|
||||
|
||||
QUICKLOAD_LOAD( cbmb )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0x10000, cbmb_quick_sethiaddress);
|
||||
}
|
||||
|
||||
QUICKLOAD_LOAD( p500 )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbmb_quick_sethiaddress);
|
||||
}
|
||||
|
||||
static void cbm_c65_quick_sethiaddress( running_machine &machine, UINT16 hiaddress )
|
||||
{
|
||||
address_space &space = machine.firstcpu->space(AS_PROGRAM);
|
||||
|
||||
space.write_byte(0x82, hiaddress & 0xff);
|
||||
space.write_byte(0x83, hiaddress >> 8);
|
||||
}
|
||||
|
||||
QUICKLOAD_LOAD( cbm_c65 )
|
||||
{
|
||||
return general_cbm_loadsnap(image, file_type, quickload_size, 0, cbm_c65_quick_sethiaddress);
|
||||
}
|
@ -1,128 +0,0 @@
|
||||
/***************************************************************************
|
||||
|
||||
mess/formats/timex_dsk.c
|
||||
|
||||
Functions to emulate general aspects of the machine (RAM, ROM, interrupts,
|
||||
I/O ports)
|
||||
|
||||
Changes:
|
||||
|
||||
KT 31/1/00 - Added support for .Z80. At the moment only 48k files are supported!
|
||||
DJR 8/2/00 - Added checks to avoid trying to load 128K .Z80 files into 48K machine!
|
||||
DJR 20/2/00 - Added support for .TAP files.
|
||||
-----------------27/02/00 10:54-------------------
|
||||
KT 27/2/00 - Added my changes for the WAV support
|
||||
--------------------------------------------------
|
||||
DJR 14/3/00 - Fixed +3 tape loading and added option to 'rewind' tapes when end reached.
|
||||
DJR 21/4/00 - Added support for 128K .SNA and .Z80 files.
|
||||
DJR 21/4/00 - Ensure 48K Basic ROM is used when running 48K snapshots on 128K machine.
|
||||
DJR 03/5/00 - Fixed bug of not decoding last byte of .Z80 blocks.
|
||||
DJR 08/5/00 - Fixed TS2068 .TAP loading.
|
||||
DJR 19/5/00 - .TAP files are now classified as cassette files.
|
||||
DJR 02/6/00 - Added support for .SCR files (screendumps).
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "formats/timex_dck.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
|
||||
static timex_cart_t timex_cart;
|
||||
|
||||
|
||||
DEVICE_IMAGE_LOAD_LEGACY( timex_cart )
|
||||
{
|
||||
int file_size;
|
||||
UINT8 * file_data;
|
||||
|
||||
int chunks_in_file = 0;
|
||||
|
||||
int i;
|
||||
|
||||
logerror ("Trying to load cart\n");
|
||||
|
||||
file_size = image.length();
|
||||
|
||||
if (file_size < 0x09)
|
||||
{
|
||||
logerror ("Bad file size\n");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
file_data = (UINT8 *)malloc(file_size);
|
||||
if (file_data == NULL)
|
||||
{
|
||||
logerror ("Memory allocating error\n");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
image.fread(file_data, file_size);
|
||||
|
||||
for (i=0; i<8; i++)
|
||||
if(file_data[i+1]&0x02) chunks_in_file++;
|
||||
|
||||
if (chunks_in_file*0x2000+0x09 != file_size)
|
||||
{
|
||||
free (file_data);
|
||||
logerror ("File corrupted\n");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
switch (file_data[0x00])
|
||||
{
|
||||
case 0x00: logerror ("DOCK cart\n");
|
||||
timex_cart.type = TIMEX_CART_DOCK;
|
||||
timex_cart.data = (UINT8*) malloc (0x10000);
|
||||
if (!timex_cart.data)
|
||||
{
|
||||
free (file_data);
|
||||
logerror ("Memory allocate error\n");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
chunks_in_file = 0;
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
timex_cart.chunks = timex_cart.chunks | ((file_data[i+1]&0x01)<<i);
|
||||
if (file_data[i+1]&0x02)
|
||||
{
|
||||
memcpy (timex_cart.data+i*0x2000, file_data+0x09+chunks_in_file*0x2000, 0x2000);
|
||||
chunks_in_file++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (file_data[i+1]&0x01)
|
||||
memset (timex_cart.data+i*0x2000, 0x00, 0x2000);
|
||||
else
|
||||
memset (timex_cart.data+i*0x2000, 0xff, 0x2000);
|
||||
}
|
||||
}
|
||||
free (file_data);
|
||||
break;
|
||||
|
||||
default: logerror ("Cart type not supported\n");
|
||||
free (file_data);
|
||||
timex_cart.type = TIMEX_CART_NONE;
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
logerror ("Cart loaded\n");
|
||||
logerror ("Chunks %02x\n", timex_cart.chunks);
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
DEVICE_IMAGE_UNLOAD_LEGACY( timex_cart )
|
||||
{
|
||||
if (timex_cart.data)
|
||||
{
|
||||
free (timex_cart.data);
|
||||
timex_cart.data = NULL;
|
||||
}
|
||||
timex_cart.type = TIMEX_CART_NONE;
|
||||
timex_cart.chunks = 0x00;
|
||||
}
|
||||
|
||||
const timex_cart_t *timex_cart_data(void)
|
||||
{
|
||||
return &timex_cart;
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* formats/timex_dck.h
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TIMEX_DCK_H__
|
||||
#define __TIMEX_DCK_H__
|
||||
|
||||
#include "imagedev/snapquik.h"
|
||||
#include "imagedev/cartslot.h"
|
||||
|
||||
enum
|
||||
{
|
||||
TIMEX_CART_NONE,
|
||||
TIMEX_CART_DOCK,
|
||||
TIMEX_CART_EXROM,
|
||||
TIMEX_CART_HOME
|
||||
};
|
||||
|
||||
struct timex_cart_t
|
||||
{
|
||||
int type;
|
||||
UINT8 chunks;
|
||||
UINT8 *data;
|
||||
};
|
||||
|
||||
const timex_cart_t *timex_cart_data(void);
|
||||
|
||||
DEVICE_IMAGE_LOAD_LEGACY( timex_cart );
|
||||
DEVICE_IMAGE_UNLOAD_LEGACY( timex_cart );
|
||||
|
||||
#endif /* __TIMEX_DCK_H__ */
|
@ -1,208 +0,0 @@
|
||||
#include "emu.h"
|
||||
#include "z80bin.h"
|
||||
|
||||
/*-------------------------------------------------
|
||||
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( super80 )
|
||||
-------------------------------------------------*/
|
||||
|
||||
QUICKLOAD_LOAD( super80 )
|
||||
{
|
||||
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)
|
||||
{
|
||||
/* check to see if autorun is on (I hate how this works) */
|
||||
autorun = image.device().machine().root_device().ioport("CONFIG")->read_safe(0xFF) & 1;
|
||||
|
||||
if (autorun)
|
||||
image.device().machine().device("maincpu")->state().set_pc(exec_addr);
|
||||
}
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
QUICKLOAD_LOAD( mbee_z80bin )
|
||||
-------------------------------------------------*/
|
||||
|
||||
QUICKLOAD_LOAD( mbee_z80bin )
|
||||
{
|
||||
UINT16 execute_address, start_addr, end_addr;
|
||||
int autorun;
|
||||
|
||||
/* load the binary into memory */
|
||||
if (z80bin_load_file(&image, file_type, &execute_address, &start_addr, &end_addr) == IMAGE_INIT_FAIL)
|
||||
return IMAGE_INIT_FAIL;
|
||||
|
||||
/* is this file executable? */
|
||||
if (execute_address != 0xffff)
|
||||
{
|
||||
/* check to see if autorun is on (I hate how this works) */
|
||||
autorun = image.device().machine().root_device().ioport("CONFIG")->read_safe(0xFF) & 1;
|
||||
|
||||
device_t *cpu = image.device().machine().device("maincpu");
|
||||
address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
|
||||
space.write_word(0xa6, execute_address); /* fix the EXEC command */
|
||||
|
||||
if (autorun)
|
||||
{
|
||||
space.write_word(0xa2, execute_address); /* fix warm-start vector to get around some copy-protections */
|
||||
cpu->state().set_pc(execute_address);
|
||||
}
|
||||
else
|
||||
{
|
||||
space.write_word(0xa2, 0x8517);
|
||||
}
|
||||
}
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
QUICKLOAD_LOAD( sorcerer )
|
||||
-------------------------------------------------*/
|
||||
|
||||
QUICKLOAD_LOAD( sorcerer )
|
||||
{
|
||||
UINT16 execute_address, start_address, end_address;
|
||||
int autorun;
|
||||
/* load the binary into memory */
|
||||
if (z80bin_load_file(&image, file_type, &execute_address, &start_address, &end_address) == IMAGE_INIT_FAIL)
|
||||
return IMAGE_INIT_FAIL;
|
||||
|
||||
/* is this file executable? */
|
||||
if (execute_address != 0xffff)
|
||||
{
|
||||
/* check to see if autorun is on (I hate how this works) */
|
||||
autorun = image.device().machine().root_device().ioport("CONFIG")->read_safe(0xFF) & 1;
|
||||
|
||||
address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
|
||||
if ((execute_address >= 0xc000) && (execute_address <= 0xdfff) && (space.read_byte(0xdffa) != 0xc3))
|
||||
return IMAGE_INIT_FAIL; /* can't run a program if the cartridge isn't in */
|
||||
|
||||
/* Since Exidy Basic is by Microsoft, it needs some preprocessing before it can be run.
|
||||
1. A start address of 01D5 indicates a basic program which needs its pointers fixed up.
|
||||
2. If autorunning, jump to C689 (command processor), else jump to C3DD (READY prompt).
|
||||
Important addresses:
|
||||
01D5 = start (load) address of a conventional basic program
|
||||
C858 = an autorun basic program will have this exec address on the tape
|
||||
C3DD = part of basic that displays READY and lets user enter input */
|
||||
|
||||
if ((start_address == 0x1d5) || (execute_address == 0xc858))
|
||||
{
|
||||
UINT8 i;
|
||||
static const UINT8 data[]={
|
||||
0xcd, 0x26, 0xc4, // CALL C426 ;set up other pointers
|
||||
0x21, 0xd4, 1, // LD HL,01D4 ;start of program address (used by C689)
|
||||
0x36, 0, // LD (HL),00 ;make sure dummy end-of-line is there
|
||||
0xc3, 0x89, 0xc6 // JP C689 ;run program
|
||||
};
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(data); i++)
|
||||
space.write_byte(0xf01f + i, data[i]);
|
||||
|
||||
if (!autorun)
|
||||
space.write_word(0xf028,0xc3dd);
|
||||
|
||||
/* tell BASIC where program ends */
|
||||
space.write_byte(0x1b7, end_address & 0xff);
|
||||
space.write_byte(0x1b8, (end_address >> 8) & 0xff);
|
||||
|
||||
if ((execute_address != 0xc858) && autorun)
|
||||
space.write_word(0xf028, execute_address);
|
||||
|
||||
image.device().machine().device("maincpu")->state().set_pc(0xf01f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (autorun)
|
||||
image.device().machine().device("maincpu")->state().set_pc(execute_address);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
#define __C128__
|
||||
|
||||
#include "emu.h"
|
||||
#include "formats/cbm_snqk.h"
|
||||
#include "machine/cbm_snqk.h"
|
||||
#include "cpu/m6502/m8502.h"
|
||||
#include "machine/6526cia.h"
|
||||
#include "machine/c64exp.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/m6502/m6510.h"
|
||||
#include "formats/cbm_snqk.h"
|
||||
#include "machine/cbm_snqk.h"
|
||||
#include "machine/c64exp.h"
|
||||
#include "machine/c64user.h"
|
||||
#include "machine/cbmiec.h"
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "emu.h"
|
||||
#include "cpu/m6502/m6509.h"
|
||||
#include "cpu/i86/i86.h"
|
||||
#include "formats/cbm_snqk.h"
|
||||
#include "machine/cbm_snqk.h"
|
||||
#include "includes/cbm.h"
|
||||
#include "machine/6525tpi.h"
|
||||
#include "machine/cbm2exp.h"
|
||||
|
@ -216,7 +216,7 @@ extern const wd17xx_interface mbee_wd17xx_interface;
|
||||
extern const z80pio_interface mbee_z80pio_intf;
|
||||
|
||||
QUICKLOAD_LOAD( mbee );
|
||||
|
||||
QUICKLOAD_LOAD( mbee_z80bin );
|
||||
|
||||
/*----------- defined in video/mbee.c -----------*/
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/m6502/m6502.h"
|
||||
#include "formats/cbm_snqk.h"
|
||||
#include "machine/cbm_snqk.h"
|
||||
#include "machine/6522via.h"
|
||||
#include "machine/6821pia.h"
|
||||
#include "machine/cbmipt.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/m6502/m7501.h"
|
||||
#include "formats/cbm_snqk.h"
|
||||
#include "machine/cbm_snqk.h"
|
||||
#include "machine/cbmiec.h"
|
||||
#include "machine/cbmipt.h"
|
||||
#include "machine/mos6529.h"
|
||||
|
@ -94,5 +94,6 @@ public:
|
||||
|
||||
/*----------- defined in machine/sorcerer.c -----------*/
|
||||
SNAPSHOT_LOAD( sorcerer );
|
||||
QUICKLOAD_LOAD(sorcerer);
|
||||
|
||||
#endif /* SORCERER_H_ */
|
||||
|
@ -120,3 +120,4 @@ MC6845_UPDATE_ROW( super80v_update_row );
|
||||
/*----------- defined in machine/super80.c -----------*/
|
||||
|
||||
extern const z80pio_interface super80_pio_intf;
|
||||
QUICKLOAD_LOAD( super80 );
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "includes/cbm.h"
|
||||
#include "formats/cbm_snqk.h"
|
||||
#include "machine/cbm_snqk.h"
|
||||
#include "cpu/m6502/m6510.h"
|
||||
#include "imagedev/cartslot.h"
|
||||
#include "machine/6522via.h"
|
||||
|
@ -38,7 +38,7 @@
|
||||
#define __C64_EXPANSION_SLOT__
|
||||
|
||||
#include "emu.h"
|
||||
#include "formats/cbm_crt.h"
|
||||
#include "machine/cbm_crt.h"
|
||||
|
||||
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
/*********************************************************************
|
||||
|
||||
formats/cbm_crt.c
|
||||
machine/cbm_crt.c
|
||||
|
||||
Commodore VIC-20/C64 cartridge images
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include "formats/cbm_crt.h"
|
||||
#include "machine/cbm_crt.h"
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*********************************************************************
|
||||
|
||||
formats/cbm_crt.h
|
||||
machine/cbm_crt.h
|
||||
|
||||
Commodore VIC-20/C64 cartridge images
|
||||
|
104
src/mess/machine/cbm_snqk.c
Normal file
104
src/mess/machine/cbm_snqk.c
Normal file
@ -0,0 +1,104 @@
|
||||
/***********************************************
|
||||
|
||||
CBM Quickloads
|
||||
|
||||
***********************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/cbm_snqk.h"
|
||||
|
||||
/* prg file format
|
||||
* sfx file format
|
||||
* sda file format
|
||||
* 0 lsb 16bit address
|
||||
* 2 chip data */
|
||||
|
||||
/* p00 file format (p00 .. p63, s00 .. s63, ..)
|
||||
* 0x0000 C64File
|
||||
* 0x0007 0
|
||||
* 0x0008 Name in commodore encoding?
|
||||
* 0x0018 0 0
|
||||
* 0x001a lsb 16bit address
|
||||
* 0x001c data */
|
||||
|
||||
|
||||
int general_cbm_loadsnap( device_image_interface &image, const char *file_type, int snapshot_size,
|
||||
offs_t offset, void (*cbm_sethiaddress)(running_machine &machine, UINT16 hiaddress) )
|
||||
{
|
||||
char buffer[7];
|
||||
UINT8 *data = NULL;
|
||||
UINT32 bytesread;
|
||||
UINT16 address = 0;
|
||||
int i;
|
||||
address_space &space = image.device().machine().firstcpu->space(AS_PROGRAM);
|
||||
|
||||
if (!file_type)
|
||||
goto error;
|
||||
|
||||
if (!mame_stricmp(file_type, "prg"))
|
||||
{
|
||||
/* prg files */
|
||||
}
|
||||
else if (!mame_stricmp(file_type, "p00"))
|
||||
{
|
||||
/* p00 files */
|
||||
if (image.fread( buffer, sizeof(buffer)) != sizeof(buffer))
|
||||
goto error;
|
||||
if (memcmp(buffer, "C64File", sizeof(buffer)))
|
||||
goto error;
|
||||
image.fseek(26, SEEK_SET);
|
||||
snapshot_size -= 26;
|
||||
}
|
||||
else if (!mame_stricmp(file_type, "t64"))
|
||||
{
|
||||
/* t64 files - for GB64 Single T64s loading to x0801 - header is always the same size */
|
||||
if (image.fread( buffer, sizeof(buffer)) != sizeof(buffer))
|
||||
goto error;
|
||||
if (memcmp(buffer, "C64 tape image file", sizeof(buffer)))
|
||||
goto error;
|
||||
image.fseek(94, SEEK_SET);
|
||||
snapshot_size -= 94;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
image.fread( &address, 2);
|
||||
address = LITTLE_ENDIANIZE_INT16(address);
|
||||
if (!mame_stricmp(file_type, "t64"))
|
||||
address = 2049;
|
||||
snapshot_size -= 2;
|
||||
|
||||
data = (UINT8*)malloc(snapshot_size);
|
||||
if (!data)
|
||||
goto error;
|
||||
|
||||
bytesread = image.fread( data, snapshot_size);
|
||||
if (bytesread != snapshot_size)
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < snapshot_size; i++)
|
||||
space.write_byte(address + i + offset, data[i]);
|
||||
|
||||
cbm_sethiaddress(image.device().machine(), address + snapshot_size);
|
||||
free(data);
|
||||
return IMAGE_INIT_PASS;
|
||||
|
||||
error:
|
||||
if (data)
|
||||
free(data);
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
void cbm_quick_sethiaddress( running_machine &machine, UINT16 hiaddress )
|
||||
{
|
||||
address_space &space = machine.firstcpu->space(AS_PROGRAM);
|
||||
|
||||
space.write_byte(0x31, hiaddress & 0xff);
|
||||
space.write_byte(0x2f, hiaddress & 0xff);
|
||||
space.write_byte(0x2d, hiaddress & 0xff);
|
||||
space.write_byte(0x32, hiaddress >> 8);
|
||||
space.write_byte(0x30, hiaddress >> 8);
|
||||
space.write_byte(0x2e, hiaddress >> 8);
|
||||
}
|
@ -11,13 +11,8 @@
|
||||
|
||||
#define CBM_QUICKLOAD_DELAY_SECONDS 3
|
||||
|
||||
QUICKLOAD_LOAD( cbm_pet1 );
|
||||
QUICKLOAD_LOAD( cbm_pet );
|
||||
QUICKLOAD_LOAD( cbm_c16 );
|
||||
QUICKLOAD_LOAD( cbm_c64 );
|
||||
QUICKLOAD_LOAD( cbm_vc20 );
|
||||
QUICKLOAD_LOAD( cbmb );
|
||||
QUICKLOAD_LOAD( p500 );
|
||||
QUICKLOAD_LOAD( cbm_c65 );
|
||||
int general_cbm_loadsnap( device_image_interface &image, const char *file_type, int snapshot_size,
|
||||
offs_t offset, void (*cbm_sethiaddress)(running_machine &machine, UINT16 hiaddress) );
|
||||
void cbm_quick_sethiaddress( running_machine &machine, UINT16 hiaddress );
|
||||
|
||||
#endif /* __CBM_SNQK_H__ */
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "includes/mbee.h"
|
||||
|
||||
#include "machine/z80bin.h"
|
||||
|
||||
/***********************************************************
|
||||
|
||||
@ -815,3 +815,42 @@ QUICKLOAD_LOAD( mbee )
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
QUICKLOAD_LOAD( mbee_z80bin )
|
||||
-------------------------------------------------*/
|
||||
|
||||
QUICKLOAD_LOAD( mbee_z80bin )
|
||||
{
|
||||
UINT16 execute_address, start_addr, end_addr;
|
||||
int autorun;
|
||||
|
||||
/* load the binary into memory */
|
||||
if (z80bin_load_file(&image, file_type, &execute_address, &start_addr, &end_addr) == IMAGE_INIT_FAIL)
|
||||
return IMAGE_INIT_FAIL;
|
||||
|
||||
/* is this file executable? */
|
||||
if (execute_address != 0xffff)
|
||||
{
|
||||
/* check to see if autorun is on (I hate how this works) */
|
||||
autorun = image.device().machine().root_device().ioport("CONFIG")->read_safe(0xFF) & 1;
|
||||
|
||||
device_t *cpu = image.device().machine().device("maincpu");
|
||||
address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
|
||||
space.write_word(0xa6, execute_address); /* fix the EXEC command */
|
||||
|
||||
if (autorun)
|
||||
{
|
||||
space.write_word(0xa2, execute_address); /* fix warm-start vector to get around some copy-protections */
|
||||
cpu->state().set_pc(execute_address);
|
||||
}
|
||||
else
|
||||
{
|
||||
space.write_word(0xa2, 0x8517);
|
||||
}
|
||||
}
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include "includes/sorcerer.h"
|
||||
#include "machine/z80bin.h"
|
||||
|
||||
#if SORCERER_USING_RS232
|
||||
|
||||
@ -418,3 +419,71 @@ void sorcerer_state::machine_reset()
|
||||
membank("boot")->set_entry(1);
|
||||
machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(sorcerer_state::sorcerer_reset),this));
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
QUICKLOAD_LOAD( sorcerer )
|
||||
-------------------------------------------------*/
|
||||
|
||||
QUICKLOAD_LOAD( sorcerer )
|
||||
{
|
||||
UINT16 execute_address, start_address, end_address;
|
||||
int autorun;
|
||||
/* load the binary into memory */
|
||||
if (z80bin_load_file(&image, file_type, &execute_address, &start_address, &end_address) == IMAGE_INIT_FAIL)
|
||||
return IMAGE_INIT_FAIL;
|
||||
|
||||
/* is this file executable? */
|
||||
if (execute_address != 0xffff)
|
||||
{
|
||||
/* check to see if autorun is on (I hate how this works) */
|
||||
autorun = image.device().machine().root_device().ioport("CONFIG")->read_safe(0xFF) & 1;
|
||||
|
||||
address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
|
||||
if ((execute_address >= 0xc000) && (execute_address <= 0xdfff) && (space.read_byte(0xdffa) != 0xc3))
|
||||
return IMAGE_INIT_FAIL; /* can't run a program if the cartridge isn't in */
|
||||
|
||||
/* Since Exidy Basic is by Microsoft, it needs some preprocessing before it can be run.
|
||||
1. A start address of 01D5 indicates a basic program which needs its pointers fixed up.
|
||||
2. If autorunning, jump to C689 (command processor), else jump to C3DD (READY prompt).
|
||||
Important addresses:
|
||||
01D5 = start (load) address of a conventional basic program
|
||||
C858 = an autorun basic program will have this exec address on the tape
|
||||
C3DD = part of basic that displays READY and lets user enter input */
|
||||
|
||||
if ((start_address == 0x1d5) || (execute_address == 0xc858))
|
||||
{
|
||||
UINT8 i;
|
||||
static const UINT8 data[]={
|
||||
0xcd, 0x26, 0xc4, // CALL C426 ;set up other pointers
|
||||
0x21, 0xd4, 1, // LD HL,01D4 ;start of program address (used by C689)
|
||||
0x36, 0, // LD (HL),00 ;make sure dummy end-of-line is there
|
||||
0xc3, 0x89, 0xc6 // JP C689 ;run program
|
||||
};
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(data); i++)
|
||||
space.write_byte(0xf01f + i, data[i]);
|
||||
|
||||
if (!autorun)
|
||||
space.write_word(0xf028,0xc3dd);
|
||||
|
||||
/* tell BASIC where program ends */
|
||||
space.write_byte(0x1b7, end_address & 0xff);
|
||||
space.write_byte(0x1b8, (end_address >> 8) & 0xff);
|
||||
|
||||
if ((execute_address != 0xc858) && autorun)
|
||||
space.write_word(0xf028, execute_address);
|
||||
|
||||
image.device().machine().device("maincpu")->state().set_pc(0xf01f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (autorun)
|
||||
image.device().machine().device("maincpu")->state().set_pc(execute_address);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/***************************************************************************
|
||||
|
||||
mess/formats/spec_snqk.c
|
||||
mess/machine/spec_snqk.c
|
||||
|
||||
TODO:
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "includes/spectrum.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "formats/spec_snqk.h"
|
||||
#include "machine/spec_snqk.h"
|
||||
|
||||
#define LOAD_REG(_cpu, _reg, _data) \
|
||||
do { \
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* formats/spec_snqk.h
|
||||
* machine/spec_snqk.h
|
||||
*
|
||||
****************************************************************************/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Super80.c written by Robbbert, 2005-2009. See driver source for documentation. */
|
||||
|
||||
#include "includes/super80.h"
|
||||
|
||||
#include "machine/z80bin.h"
|
||||
|
||||
/**************************** PIO ******************************************************************************/
|
||||
|
||||
@ -228,3 +228,29 @@ DRIVER_INIT_MEMBER(super80_state,super80v)
|
||||
{
|
||||
driver_init_common(machine());
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
QUICKLOAD_LOAD( super80 )
|
||||
-------------------------------------------------*/
|
||||
|
||||
QUICKLOAD_LOAD( super80 )
|
||||
{
|
||||
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)
|
||||
{
|
||||
/* check to see if autorun is on (I hate how this works) */
|
||||
autorun = image.device().machine().root_device().ioport("CONFIG")->read_safe(0xFF) & 1;
|
||||
|
||||
if (autorun)
|
||||
image.device().machine().device("maincpu")->state().set_pc(exec_addr);
|
||||
}
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "emuopts.h"
|
||||
#include "formats/cbm_crt.h"
|
||||
#include "machine/cbm_crt.h"
|
||||
#include "formats/imageutl.h"
|
||||
#include "machine/vic10exp.h"
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
#define __VIC10_EXPANSION_SLOT__
|
||||
|
||||
#include "emu.h"
|
||||
#include "formats/cbm_crt.h"
|
||||
#include "machine/cbm_crt.h"
|
||||
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "emuopts.h"
|
||||
#include "formats/cbm_crt.h"
|
||||
#include "machine/cbm_crt.h"
|
||||
#include "machine/vic20exp.h"
|
||||
#include "formats/imageutl.h"
|
||||
|
||||
|
75
src/mess/machine/z80bin.c
Normal file
75
src/mess/machine/z80bin.c
Normal file
@ -0,0 +1,75 @@
|
||||
#include "emu.h"
|
||||
#include "machine/z80bin.h"
|
||||
|
||||
/*-------------------------------------------------
|
||||
z80bin_load_file - load a z80bin file into
|
||||
memory
|
||||
-------------------------------------------------*/
|
||||
|
||||
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;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*********************************************************************
|
||||
|
||||
formats/z80bin.h
|
||||
machine/z80bin.h
|
||||
|
||||
Quickload code for Z80 bin format
|
||||
|
||||
@ -11,10 +11,6 @@
|
||||
#ifndef __Z80_BIN__
|
||||
#define __Z80_BIN__
|
||||
|
||||
#include "imagedev/snapquik.h"
|
||||
|
||||
QUICKLOAD_LOAD( sorcerer );
|
||||
QUICKLOAD_LOAD( super80 );
|
||||
QUICKLOAD_LOAD( mbee_z80bin );
|
||||
int z80bin_load_file(device_image_interface *image, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr );
|
||||
|
||||
#endif
|
@ -555,7 +555,7 @@ $(MESSOBJ)/shared.a: \
|
||||
$(MESS_MACHINE)/ne1000.o \
|
||||
$(MESS_MACHINE)/ne2000.o \
|
||||
$(MESS_MACHINE)/3c503.o \
|
||||
$(MESS_FORMATS)/z80bin.o \
|
||||
$(MESS_MACHINE)/z80bin.o \
|
||||
$(MESS_MACHINE)/mb8795.o \
|
||||
$(MESS_MACHINE)/midiinport.o \
|
||||
$(MESS_MACHINE)/midioutport.o \
|
||||
@ -958,8 +958,8 @@ $(MESSOBJ)/cbm.a: \
|
||||
$(MESS_VIDEO)/vic4567.o \
|
||||
$(MESS_VIDEO)/mos6566.o \
|
||||
$(MESS_DRIVERS)/c900.o \
|
||||
$(MESS_FORMATS)/cbm_snqk.o \
|
||||
$(MESS_FORMATS)/cbm_crt.o \
|
||||
$(MESS_MACHINE)/cbm_snqk.o \
|
||||
$(MESS_MACHINE)/cbm_crt.o \
|
||||
|
||||
$(MESSOBJ)/cccp.a: \
|
||||
$(MESS_DRIVERS)/argo.o \
|
||||
@ -1705,8 +1705,7 @@ $(MESSOBJ)/sinclair.a: \
|
||||
$(MESS_DRIVERS)/atm.o \
|
||||
$(MESS_DRIVERS)/pentagon.o \
|
||||
$(MESS_MACHINE)/beta.o \
|
||||
$(MESS_FORMATS)/spec_snqk.o \
|
||||
$(MESS_FORMATS)/timex_dck.o \
|
||||
$(MESS_MACHINE)/spec_snqk.o \
|
||||
$(MESS_DRIVERS)/ql.o \
|
||||
$(MESS_VIDEO)/zx8301.o \
|
||||
$(MESS_MACHINE)/zx8302.o \
|
||||
|
@ -39,7 +39,6 @@ MAME_LAYOUT = $(MAMEOBJ)/layout
|
||||
# MESS directories
|
||||
MESS_AUDIO = $(MESSOBJ)/audio
|
||||
MESS_DRIVERS = $(MESSOBJ)/drivers
|
||||
MESS_FORMATS = $(MESSOBJ)/formats
|
||||
MESS_LAYOUT = $(MESSOBJ)/layout
|
||||
MESS_MACHINE = $(MESSOBJ)/machine
|
||||
MESS_VIDEO = $(MESSOBJ)/video
|
||||
@ -54,7 +53,6 @@ OBJDIRS += \
|
||||
$(MAME_VIDEO) \
|
||||
$(MESS_AUDIO) \
|
||||
$(MESS_DRIVERS) \
|
||||
$(MESS_FORMATS) \
|
||||
$(MESS_LAYOUT) \
|
||||
$(MESS_MACHINE) \
|
||||
$(MESS_VIDEO) \
|
||||
|
Loading…
Reference in New Issue
Block a user