1
0
mirror of https://git.code.sf.net/p/fuse-emulator/fuse synced 2026-01-28 14:20:54 +03:00
Files
fuse/specplus2.c
2003-02-07 15:07:13 +00:00

93 lines
2.6 KiB
C

/* specplus2.c: Spectrum +2 specific routines
Copyright (c) 1999-2001 Philip Kendall
$Id$
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author contact information:
E-mail: pak21-fuse@srcf.ucam.org
Postal address: 15 Crescent Road, Wokingham, Berks, RG40 2DB, England
*/
#include <config.h>
#include <stdio.h>
#include <libspectrum.h>
#include "settings.h"
#include "spec128.h"
#include "specplus2.h"
/* The +2 emulation just uses the 128K routines */
int specplus2_init( fuse_machine_info *machine )
{
int error;
machine->machine = LIBSPECTRUM_MACHINE_PLUS2;
machine->id = "plus2";
machine->reset = specplus2_reset;
error = machine_set_timings( machine ); if( error ) return error;
machine->timex = 0;
machine->ram.read_memory = spec128_readbyte;
machine->ram.read_memory_internal = spec128_readbyte_internal;
machine->ram.read_screen = spec128_read_screen_memory;
machine->ram.write_memory = spec128_writebyte;
machine->ram.write_memory_internal = spec128_writebyte_internal;
machine->ram.contend_memory = spec128_contend_memory;
machine->ram.contend_port = spec128_contend_port;
error = machine_allocate_roms( machine, 2 );
if( error ) return error;
machine->rom_length[0] = machine->rom_length[1] = 0x4000;
machine->peripherals = spec128_peripherals;
machine->unattached_port = spec128_unattached_port;
machine->ay.present = 1;
machine->shutdown = NULL;
return 0;
}
int
specplus2_reset( void )
{
int error;
machine_current->ram.locked=0;
machine_current->ram.current_page=0;
machine_current->ram.current_rom=0;
machine_current->ram.current_screen=5;
error = machine_load_rom( &ROM[0], settings_current.rom_plus2_0,
machine_current->rom_length[0] );
if( error ) return error;
error = machine_load_rom( &ROM[1], settings_current.rom_plus2_1,
machine_current->rom_length[1] );
if( error ) return error;
return 0;
}