1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
|
/* machines_periph.c: various machine-specific peripherals
Copyright (c) 2011 Philip Kendall
$Id: machines_periph.c 4926 2013-05-05 07:58:18Z sbaldovi $
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Author contact information:
E-mail: philip-fuse@shadowmagic.org.uk
*/
#include <config.h>
#include "fuse.h"
#include "machines_periph.h"
#include "pentagon.h"
#include "periph.h"
#include "peripherals/disk/beta.h"
#include "spec128.h"
#include "specplus3.h"
#include "tc2068.h"
static void
spec_se_memoryport_write( libspectrum_word port GCC_UNUSED,
libspectrum_byte b )
{
machine_current->ram.last_byte = b;
machine_current->memory_map();
}
static const periph_port_t spec128_memory_ports[] = {
{ 0x8002, 0x0000, NULL, spec128_memoryport_write },
{ 0, 0, NULL, NULL }
};
static const periph_t spec128_memory = {
NULL,
spec128_memory_ports,
0,
NULL
};
static const periph_port_t plus3_memory_ports[] = {
{ 0xc002, 0x4000, NULL, spec128_memoryport_write },
{ 0xf002, 0x1000, NULL, specplus3_memoryport2_write },
{ 0, 0, NULL, NULL }
};
static const periph_t plus3_memory = {
NULL,
plus3_memory_ports,
0,
NULL
};
static const periph_port_t upd765_ports[] = {
{ 0xf002, 0x3000, specplus3_fdc_read, specplus3_fdc_write },
{ 0xf002, 0x2000, specplus3_fdc_status, NULL },
{ 0, 0, NULL, NULL }
};
static const periph_t upd765 = {
NULL,
upd765_ports,
0,
NULL
};
static const periph_port_t se_memory_ports[] = {
{ 0xffff, 0x7ffd, NULL, spec_se_memoryport_write },
{ 0, 0, NULL, NULL }
};
static const periph_t se_memory = {
NULL,
se_memory_ports,
0,
NULL
};
static const periph_port_t tc2068_ay_ports[] = {
{ 0x00ff, 0x00f5, tc2068_ay_registerport_read, ay_registerport_write },
{ 0x00ff, 0x00f6, tc2068_ay_dataport_read, ay_dataport_write },
{ 0, 0, NULL, NULL }
};
static const periph_t tc2068_ay = {
NULL,
tc2068_ay_ports,
0,
NULL
};
static const periph_port_t beta128_pentagon_ports[] = {
{ 0x00ff, 0x001f, pentagon_select_1f_read, beta_cr_write },
{ 0x00ff, 0x003f, beta_tr_read, beta_tr_write },
{ 0x00ff, 0x005f, beta_sec_read, beta_sec_write },
{ 0x00ff, 0x007f, beta_dr_read, beta_dr_write },
{ 0x00ff, 0x00ff, pentagon_select_ff_read, beta_sp_write },
{ 0, 0, NULL, NULL }
};
static const periph_t beta128_pentagon = {
NULL,
beta128_pentagon_ports,
0,
NULL
};
static const periph_port_t beta128_pentagon_late_ports[] = {
{ 0x00ff, 0x001f, pentagon_select_1f_read, beta_cr_write },
{ 0x00ff, 0x003f, beta_tr_read, beta_tr_write },
{ 0x00ff, 0x005f, beta_sec_read, beta_sec_write },
{ 0x00ff, 0x007f, beta_dr_read, beta_dr_write },
{ 0x00ff, 0x00ff, beta_sp_read, beta_sp_write },
{ 0, 0, NULL, NULL }
};
static const periph_t beta128_pentagon_late = {
NULL,
beta128_pentagon_late_ports,
0,
NULL
};
static const periph_port_t pentagon1024_memory_ports[] = {
{ 0xc002, 0x4000, NULL, pentagon1024_memoryport_write },
{ 0xf008, 0xe000, NULL, pentagon1024_v22_memoryport_write }, /* v2.2 */
{ 0, 0, NULL, NULL }
};
static const periph_t pentagon1024_memory = {
NULL,
pentagon1024_memory_ports,
0,
NULL
};
void
machines_periph_init( void )
{
periph_register( PERIPH_TYPE_128_MEMORY, &spec128_memory );
periph_register( PERIPH_TYPE_PLUS3_MEMORY, &plus3_memory );
periph_register( PERIPH_TYPE_UPD765, &upd765 );
periph_register( PERIPH_TYPE_SE_MEMORY, &se_memory );
periph_register( PERIPH_TYPE_AY_TIMEX_WITH_JOYSTICK, &tc2068_ay );
periph_register( PERIPH_TYPE_BETA128_PENTAGON, &beta128_pentagon );
periph_register( PERIPH_TYPE_BETA128_PENTAGON_LATE, &beta128_pentagon_late );
periph_register( PERIPH_TYPE_PENTAGON1024_MEMORY, &pentagon1024_memory );
}
/* Peripherals generally available on all machines; the Timex machines and
Russian clones remove some items from this list */
static void
base_peripherals( void )
{
periph_set_present( PERIPH_TYPE_DIVIDE, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_KEMPSTON, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_KEMPSTON_MOUSE, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_SIMPLEIDE, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_SPECCYBOOT, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_SPECTRANET, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_ULA, PERIPH_PRESENT_ALWAYS );
periph_set_present( PERIPH_TYPE_ZXATASP, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_ZXCF, PERIPH_PRESENT_OPTIONAL );
}
/* Peripherals available on the 48K and 128K */
static void
base_peripherals_48_128( void )
{
base_peripherals();
periph_set_present( PERIPH_TYPE_BETA128, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_INTERFACE1, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_INTERFACE2, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_MELODIK, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_OPUS, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_PLUSD, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_SPECDRUM, PERIPH_PRESENT_OPTIONAL );
}
/* The set of peripherals available on the 48K and similar machines */
void
machines_periph_48( void )
{
base_peripherals_48_128();
periph_set_present( PERIPH_TYPE_FULLER, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_ZXPRINTER, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_DISCIPLE, PERIPH_PRESENT_OPTIONAL );
}
/* The set of peripherals available on the 128K and similar machines */
void
machines_periph_128( void )
{
base_peripherals_48_128();
periph_set_present( PERIPH_TYPE_AY, PERIPH_PRESENT_ALWAYS );
periph_set_present( PERIPH_TYPE_128_MEMORY, PERIPH_PRESENT_ALWAYS );
}
/* The set of peripherals available on the +3 and similar machines */
void
machines_periph_plus3( void )
{
base_peripherals();
periph_set_present( PERIPH_TYPE_AY_PLUS3, PERIPH_PRESENT_ALWAYS );
periph_set_present( PERIPH_TYPE_PARALLEL_PRINTER, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_PLUS3_MEMORY, PERIPH_PRESENT_ALWAYS );
}
/* The set of peripherals available on the TC2068 and TS2068 */
void
machines_periph_timex( void )
{
base_peripherals();
/* ULA uses full decoding */
periph_set_present( PERIPH_TYPE_ULA, PERIPH_PRESENT_NEVER );
periph_set_present( PERIPH_TYPE_ULA_FULL_DECODE, PERIPH_PRESENT_ALWAYS );
/* SCLD always present */
periph_set_present( PERIPH_TYPE_SCLD, PERIPH_PRESENT_ALWAYS );
/* AY chip with joystick always present */
periph_set_present( PERIPH_TYPE_AY_TIMEX_WITH_JOYSTICK, PERIPH_PRESENT_ALWAYS );
/* ZX Printer and Interface 2 available */
periph_set_present( PERIPH_TYPE_INTERFACE2, PERIPH_PRESENT_OPTIONAL );
periph_set_present( PERIPH_TYPE_ZXPRINTER_FULL_DECODE, PERIPH_PRESENT_OPTIONAL );
}
/* The set of peripherals available on the Pentagon and Scorpion */
void
machines_periph_pentagon( void )
{
base_peripherals();
/* 128K-style memory paging available */
periph_set_present( PERIPH_TYPE_128_MEMORY, PERIPH_PRESENT_ALWAYS );
/* AY available */
periph_set_present( PERIPH_TYPE_AY, PERIPH_PRESENT_ALWAYS );
/* ULA uses full decoding */
periph_set_present( PERIPH_TYPE_ULA, PERIPH_PRESENT_NEVER );
periph_set_present( PERIPH_TYPE_ULA_FULL_DECODE, PERIPH_PRESENT_ALWAYS );
/* All machines have a built-in Betadisk 128 interface, which also
handles Kempston joystick as they share a port; we don't add the
actual Betadisk interface here as it differs slightly between the
(original) Pentagon and the Scorpion/Pentagon 1024 */
periph_set_present( PERIPH_TYPE_KEMPSTON, PERIPH_PRESENT_NEVER );
}
|