mirror of
https://github.com/holub/mame
synced 2025-04-28 03:02:52 +03:00
(MESS) electron.c: Added cartridge support. [Wilbert Pol]
This commit is contained in:
parent
8830be5c08
commit
c41d2e4e1c
@ -13,9 +13,11 @@ Incomplete:
|
|||||||
- Graphics (seems to be wrong for several games)
|
- Graphics (seems to be wrong for several games)
|
||||||
- 1 MHz bus is not emulated
|
- 1 MHz bus is not emulated
|
||||||
- Bus claiming by ULA is not implemented
|
- Bus claiming by ULA is not implemented
|
||||||
|
- Currently the cartridge support always loads the upper rom in page 12
|
||||||
|
and the lower rom in page 0. This might need further documentation in
|
||||||
|
the software list and loading code.
|
||||||
|
|
||||||
Missing:
|
Missing:
|
||||||
- Support for ROM images
|
|
||||||
- Support for floppy disks
|
- Support for floppy disks
|
||||||
- Other peripherals
|
- Other peripherals
|
||||||
- Keyboard is missing the 'Break' key
|
- Keyboard is missing the 'Break' key
|
||||||
@ -26,6 +28,7 @@ Missing:
|
|||||||
#include "cpu/m6502/m6502.h"
|
#include "cpu/m6502/m6502.h"
|
||||||
#include "includes/electron.h"
|
#include "includes/electron.h"
|
||||||
#include "imagedev/cassette.h"
|
#include "imagedev/cassette.h"
|
||||||
|
#include "imagedev/cartslot.h"
|
||||||
#include "formats/uef_cas.h"
|
#include "formats/uef_cas.h"
|
||||||
#include "sound/beep.h"
|
#include "sound/beep.h"
|
||||||
|
|
||||||
@ -196,6 +199,14 @@ static MACHINE_CONFIG_START( electron, electron_state )
|
|||||||
MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
|
MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
|
||||||
|
|
||||||
MCFG_CASSETTE_ADD( "cassette", electron_cassette_interface )
|
MCFG_CASSETTE_ADD( "cassette", electron_cassette_interface )
|
||||||
|
|
||||||
|
MCFG_CARTSLOT_ADD("cart")
|
||||||
|
MCFG_CARTSLOT_EXTENSION_LIST("bin")
|
||||||
|
MCFG_CARTSLOT_NOT_MANDATORY
|
||||||
|
MCFG_CARTSLOT_LOAD(electron_state, electron_cart)
|
||||||
|
MCFG_CARTSLOT_INTERFACE("electron_cart")
|
||||||
|
/* software lists */
|
||||||
|
MCFG_SOFTWARE_LIST_ADD("cart_list","electron_cart")
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ public:
|
|||||||
inline UINT8 read_vram( UINT16 addr );
|
inline UINT8 read_vram( UINT16 addr );
|
||||||
inline void electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color);
|
inline void electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color);
|
||||||
void electron_interrupt_handler(int mode, int interrupt);
|
void electron_interrupt_handler(int mode, int interrupt);
|
||||||
|
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( electron_cart );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -338,3 +338,54 @@ void electron_state::machine_start()
|
|||||||
machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(electron_state::setup_beep),this));
|
machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(electron_state::setup_beep),this));
|
||||||
m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(electron_state::electron_tape_timer_handler),this));
|
m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(electron_state::electron_tape_timer_handler),this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEVICE_IMAGE_LOAD_MEMBER( electron_state, electron_cart )
|
||||||
|
{
|
||||||
|
UINT8 *user1 = memregion("user1")->base() + 0x4000;
|
||||||
|
|
||||||
|
if (image.software_entry() == NULL)
|
||||||
|
{
|
||||||
|
UINT32 filesize = image.length();
|
||||||
|
|
||||||
|
if ( filesize != 16384 )
|
||||||
|
{
|
||||||
|
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size. Only size 16384 is supported");
|
||||||
|
return IMAGE_INIT_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (image.fread( user1 + 12 * 16384, filesize) != filesize)
|
||||||
|
{
|
||||||
|
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Error loading file");
|
||||||
|
return IMAGE_INIT_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return IMAGE_INIT_PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int upsize = image.get_software_region_length("uprom");
|
||||||
|
int losize = image.get_software_region_length("lorom");
|
||||||
|
|
||||||
|
if ( upsize != 16384 && upsize != 0 )
|
||||||
|
{
|
||||||
|
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size for uprom");
|
||||||
|
return IMAGE_INIT_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( losize != 16384 && losize != 0 )
|
||||||
|
{
|
||||||
|
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size for lorom");
|
||||||
|
return IMAGE_INIT_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( upsize )
|
||||||
|
{
|
||||||
|
memcpy( user1 + 12 * 16384, image.get_software_region("uprom"), upsize );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( losize )
|
||||||
|
{
|
||||||
|
memcpy( user1 + 0 * 16384, image.get_software_region("lorom"), losize );
|
||||||
|
}
|
||||||
|
|
||||||
|
return IMAGE_INIT_PASS;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user