1 /* specplus3e.c: Spectrum +3e specific routines
2 Copyright (c) 1999-2011 Philip Kendall, Darren Salt
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 Author contact information:
19
20 E-mail: philip-fuse@shadowmagic.org.uk
21
22 */
23
24 #include <config.h>
25
26 #include "machines.h"
27 #include "machines_periph.h"
28 #include "periph.h"
29 #include "peripherals/disk/upd_fdc.h"
30 #include "settings.h"
31 #include "spec48.h"
32 #include "specplus3.h"
33 #include "ui/ui.h"
34
35 static int specplus3e_reset( void );
36 extern upd_fdc *specplus3_fdc;
37
38 int
specplus3e_init(fuse_machine_info * machine)39 specplus3e_init( fuse_machine_info *machine )
40 {
41 machine->machine = LIBSPECTRUM_MACHINE_PLUS3E;
42 machine->id = "plus3e";
43
44 machine->reset = specplus3e_reset;
45
46 machine->timex = 0;
47 machine->ram.port_from_ula = specplus3_port_from_ula;
48 machine->ram.contend_delay = spectrum_contend_delay_76543210;
49 machine->ram.contend_delay_no_mreq = spectrum_contend_delay_none;
50 machine->ram.valid_pages = 8;
51
52 machine->unattached_port = spectrum_unattached_port_none;
53
54 machine->shutdown = specplus3_shutdown;
55
56 machine->memory_map = specplus3_memory_map;
57
58 return 0;
59 }
60
61 static int
specplus3e_reset(void)62 specplus3e_reset( void )
63 {
64 int error;
65
66 error = machine_load_rom( 0, settings_current.rom_plus3e_0,
67 settings_default.rom_plus3e_0, 0x4000 );
68 if( error ) return error;
69 error = machine_load_rom( 1, settings_current.rom_plus3e_1,
70 settings_default.rom_plus3e_1, 0x4000 );
71 if( error ) return error;
72 error = machine_load_rom( 2, settings_current.rom_plus3e_2,
73 settings_default.rom_plus3e_2, 0x4000 );
74 if( error ) return error;
75 error = machine_load_rom( 3, settings_current.rom_plus3e_3,
76 settings_default.rom_plus3e_3, 0x4000 );
77 if( error ) return error;
78
79 error = specplus3_plus2a_common_reset();
80 if( error ) return error;
81
82 periph_clear();
83 machines_periph_plus3();
84
85 periph_set_present( PERIPH_TYPE_UPD765, PERIPH_PRESENT_ALWAYS );
86
87 periph_update();
88
89 specplus3_765_reset();
90 specplus3_menu_items();
91
92 spec48_common_display_setup();
93
94 return 0;
95 }
96