src/mess/drivers/newbrain.c
| r0 | r2767 | |
| 1 | #include "driver.h"
|
| 2 | #include "cpu/z80/z80daisy.h"
|
| 3 | #include "cpu/cop400/cop400.h"
|
| 4 | #include "machine/nec765.h"
|
| 5 | #include "machine/6850acia.h"
|
| 6 | #include "machine/z80ctc.h"
|
| 7 | #include "machine/z80dart.h"
|
| 8 | #include "machine/z80sio.h"
|
| 9 | #include "includes/newbrain.h"
|
| 10 | #include "devices/basicdsk.h"
|
| 11 | #include "devices/cassette.h"
|
| 12 | |
| 13 | /*
|
| 14 | |
| 15 | NewBrain
|
| 16 | Grundy Business Systems Ltd.
|
| 17 | |
| 18 | 32K RAM
|
| 19 | 28K ROM
|
| 20 | |
| 21 | Z80 @ 2MHz
|
| 22 | COP420 @ 2MHz
|
| 23 | |
| 24 | Z80 @ 4MHz (416): INT/NMI=+5V, WAIT=EXTBUSRQ|BUSAKD, RESET=_FDC RESET, |
| 25 | NEC 765AC @ 4 MHz (418)
|
| 26 | MC6850 ACIA (459)
|
| 27 | Z80CTC (458)
|
| 28 | |
| 29 | */
|
| 30 | |
| 31 | /*
|
| 32 | |
| 33 | TODO:
|
| 34 | |
| 35 | - escape key
|
| 36 | - main z80 interrupt from COP420
|
| 37 | - video
|
| 38 | - tape
|
| 39 | |
| 40 | - floppy disc controller
|
| 41 | - CP/M 2.2
|
| 42 | - expansion box
|
| 43 | - Micropage ROM/RAM card
|
| 44 | - Z80 PIO board
|
| 45 | - peripheral (PI) box
|
| 46 | - sound card
|
| 47 | |
| 48 | */
|
| 49 | |
| 50 | static READ8_HANDLER( newbrain_cop_l_r )
|
| 51 | {
|
| 52 | // connected to the Z80 data bus
|
| 53 | |
| 54 | newbrain_state *state = machine->driver_data;
|
| 55 | |
| 56 | return state->cop_bus;
|
| 57 | }
|
| 58 | |
| 59 | static WRITE8_HANDLER( newbrain_cop_l_w )
|
| 60 | {
|
| 61 | // connected to the Z80 data bus
|
| 62 | |
| 63 | newbrain_state *state = machine->driver_data;
|
| 64 | |
| 65 | state->cop_bus = data;
|
| 66 | }
|
| 67 | |
| 68 | static WRITE8_HANDLER( newbrain_cop_g_w )
|
| 69 | {
|
| 70 | /*
|
| 71 | |
| 72 | bit description
|
| 73 | |
| 74 | G0 inverted to _COPINT
|
| 75 | G1 |
| 76 | G2 |
| 77 | G3 |
| 78 | |
| 79 | */
|
| 80 | |
| 81 | // _Z80INT = ((_CLK | _CLKINT) & _COPINT)
|
| 82 | }
|
| 83 | |
| 84 | static READ8_HANDLER( newbrain_cop_g_r )
|
| 85 | {
|
| 86 | /*
|
| 87 | |
| 88 | bit description
|
| 89 | |
| 90 | G0 |
| 91 | G1 K9
|
| 92 | G2 K7
|
| 93 | G3 K3
|
| 94 | |
| 95 | */
|
| 96 | |
| 97 | newbrain_state *state = machine->driver_data;
|
| 98 | |
| 99 | return (BIT(state->keydata, 3) << 3) | (BIT(state->keydata, 0) << 2) | (BIT(state->keydata, 1) << 1);
|
| 100 | }
|
| 101 | |
| 102 | static READ8_HANDLER( newbrain_cop_d_r )
|
| 103 | {
|
| 104 | /*
|
| 105 | |
| 106 | bit description
|
| 107 | |
| 108 | D0 inverted to K4
|
| 109 | D1 TDO
|
| 110 | D2 inverted to K6
|
| 111 | D3 |
| 112 | |
| 113 | */
|
| 114 | |
| 115 | return 0;
|
| 116 | }
|
| 117 | |
| 118 | static WRITE8_HANDLER( newbrain_cop_d_w )
|
| 119 | {
|
| 120 | /*
|
| 121 | |
| 122 | bit description
|
| 123 | |
| 124 | D0 inverted to K4 -> CD4024 pin 2 (reset)
|
| 125 | D1 TDO
|
| 126 | D2 inverted to K6 -> CD4024 pin 1 (clock), CD4076 pin 7 (clock), inverted to DS8881 pin 3 (enable)
|
| 127 | D3 |
| 128 | |
| 129 | */
|
| 130 | |
| 131 | newbrain_state *state = machine->driver_data;
|
| 132 | |
| 133 | if (!BIT(data, 0))
|
| 134 | {
|
| 135 | state->keylatch = 0;
|
| 136 | }
|
| 137 | |
| 138 | if (!BIT(data, 2))
|
| 139 | {
|
| 140 | char port[4];
|
| 141 | |
| 142 | state->keylatch++;
|
| 143 | |
| 144 | if (state->keylatch == 16)
|
| 145 | {
|
| 146 | state->keylatch = 0;
|
| 147 | }
|
| 148 | |
| 149 | sprintf(port, "D%d", state->keylatch);
|
| 150 | |
| 151 | state->keydata = input_port_read(machine, port);
|
| 152 | }
|
| 153 | }
|
| 154 | |
| 155 | static READ8_HANDLER( newbrain_cop_in_r )
|
| 156 | {
|
| 157 | /*
|
| 158 | |
| 159 | bit description
|
| 160 | |
| 161 | IN0 K8
|
| 162 | IN1 _RD
|
| 163 | IN2 _COP
|
| 164 | IN3 _WR
|
| 165 | |
| 166 | */
|
| 167 | |
| 168 | newbrain_state *state = machine->driver_data;
|
| 169 | |
| 170 | return BIT(state->keydata, 2);
|
| 171 | }
|
| 172 | |
| 173 | static WRITE8_HANDLER( newbrain_cop_so_w )
|
| 174 | {
|
| 175 | // connected to K1
|
| 176 | }
|
| 177 | |
| 178 | static WRITE8_HANDLER( newbrain_cop_sk_w )
|
| 179 | {
|
| 180 | // connected to K2
|
| 181 | }
|
| 182 | |
| 183 | static READ8_HANDLER( newbrain_cop_si_r )
|
| 184 | {
|
| 185 | // connected to TDI
|
| 186 | |
| 187 | return 0;
|
| 188 | }
|
| 189 | |
| 190 | #ifdef UNUSED_CODE
|
| 191 | static WRITE8_HANDLER( fdc_io_w )
|
| 192 | {
|
| 193 | /*
|
| 194 | |
| 195 | bit description
|
| 196 | |
| 197 | 0 PAGING
|
| 198 | 1 |
| 199 | 2 MA16
|
| 200 | 3 MPM
|
| 201 | 4 |
| 202 | 5 _FDC RESET
|
| 203 | 6 |
| 204 | 7 FDC ATT
|
| 205 | |
| 206 | */
|
| 207 | }
|
| 208 | |
| 209 | static WRITE8_HANDLER( fdc_io2_w )
|
| 210 | {
|
| 211 | /*
|
| 212 | |
| 213 | bit description
|
| 214 | |
| 215 | 0 MOTON
|
| 216 | 1 765 RESET
|
| 217 | 2 TC
|
| 218 | 3 |
| 219 | 4 |
| 220 | 5 PA15
|
| 221 | 6 |
| 222 | 7 |
| 223 | |
| 224 | */
|
| 225 | |
| 226 | floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), BIT(data, 0));
|
| 227 | floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1, 0);
|
| 228 | |
| 229 | nec765_set_reset_state(BIT(data, 1));
|
| 230 | |
| 231 | nec765_set_tc_state(BIT(data, 2));
|
| 232 | }
|
| 233 | |
| 234 | static WRITE8_HANDLER( io_w )
|
| 235 | {
|
| 236 | /*
|
| 237 | |
| 238 | bit description
|
| 239 | |
| 240 | 0 _USERP
|
| 241 | 1 ANP
|
| 242 | 2 MLTMD
|
| 243 | 3 MSPD
|
| 244 | 4 ENOR
|
| 245 | 5 ANSW
|
| 246 | 6 ENOT
|
| 247 | 7 |
| 248 | |
| 249 | */
|
| 250 | }
|
| 251 | #endif
|
| 252 | |
| 253 | /* Memory Maps */
|
| 254 | |
| 255 | static ADDRESS_MAP_START( newbrain_map, ADDRESS_SPACE_PROGRAM, 8 )
|
| 256 | ADDRESS_MAP_UNMAP_HIGH
|
| 257 | AM_RANGE(0x0000, 0x7fff) AM_RAM
|
| 258 | AM_RANGE(0xa000, 0xffff) AM_ROM
|
| 259 | ADDRESS_MAP_END
|
| 260 | |
| 261 | static ADDRESS_MAP_START( newbrain_io_map, ADDRESS_SPACE_IO, 8 )
|
| 262 | ADDRESS_MAP_END
|
| 263 | |
| 264 | static ADDRESS_MAP_START( newbrain_cop_map, ADDRESS_SPACE_PROGRAM, 8 )
|
| 265 | AM_RANGE(0x000, 0x3ff) AM_ROM
|
| 266 | ADDRESS_MAP_END
|
| 267 | |
| 268 | static ADDRESS_MAP_START( newbrain_cop_io_map, ADDRESS_SPACE_IO, 8 )
|
| 269 | AM_RANGE(COP400_PORT_L, COP400_PORT_L) AM_READWRITE(newbrain_cop_l_r, newbrain_cop_l_w)
|
| 270 | AM_RANGE(COP400_PORT_G, COP400_PORT_G) AM_READWRITE(newbrain_cop_g_r, newbrain_cop_g_w)
|
| 271 | AM_RANGE(COP400_PORT_D, COP400_PORT_D) AM_READWRITE(newbrain_cop_d_r, newbrain_cop_d_w)
|
| 272 | AM_RANGE(COP400_PORT_IN, COP400_PORT_IN) AM_READ(newbrain_cop_in_r)
|
| 273 | AM_RANGE(COP400_PORT_SK, COP400_PORT_SK) AM_WRITE(newbrain_cop_sk_w)
|
| 274 | AM_RANGE(COP400_PORT_SIO, COP400_PORT_SIO) AM_READWRITE(newbrain_cop_si_r, newbrain_cop_so_w)
|
| 275 | AM_RANGE(COP400_PORT_CKO, COP400_PORT_CKO) AM_READNOP
|
| 276 | ADDRESS_MAP_END
|
| 277 | |
| 278 | static ADDRESS_MAP_START( newbrain_fdc_map, ADDRESS_SPACE_PROGRAM, 8 )
|
| 279 | ADDRESS_MAP_UNMAP_HIGH
|
| 280 | AM_RANGE(0xe000, 0xffff) AM_ROM
|
| 281 | ADDRESS_MAP_END
|
| 282 | |
| 283 | static ADDRESS_MAP_START( newbrain_fdc_io_map, ADDRESS_SPACE_IO, 8 )
|
| 284 | ADDRESS_MAP_END
|
| 285 | |
| 286 | /* Input Ports */
|
| 287 | |
| 288 | static INPUT_PORTS_START( newbrain )
|
| 289 | PORT_START_TAG("D0")
|
| 290 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 291 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END))
|
| 292 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 293 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 294 | |
| 295 | PORT_START_TAG("D1")
|
| 296 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
|
| 297 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
|
| 298 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
|
| 299 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
|
| 300 |
|
| 301 | PORT_START_TAG("D2")
|
| 302 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
|
| 303 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8')
|
| 304 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
|
| 305 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
|
| 306 |
|
| 307 | PORT_START_TAG("D3")
|
| 308 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
|
| 309 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9')
|
| 310 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
|
| 311 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
|
| 312 | |
| 313 | PORT_START_TAG("D4")
|
| 314 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
|
| 315 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
|
| 316 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
|
| 317 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
|
| 318 | |
| 319 | PORT_START_TAG("D5")
|
| 320 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
|
| 321 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('(') PORT_CHAR('[')
|
| 322 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
|
| 323 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
|
| 324 |
|
| 325 | PORT_START_TAG("D6")
|
| 326 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
|
| 327 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(')') PORT_CHAR(']')
|
| 328 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
|
| 329 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
|
| 330 |
|
| 331 | PORT_START_TAG("D7")
|
| 332 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR(';') PORT_CHAR(':')
|
| 333 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* \xC2\xA3") PORT_CHAR('*') PORT_CHAR(0x00A3)
|
| 334 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"')
|
| 335 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
|
| 336 |
|
| 337 | PORT_START_TAG("D8")
|
| 338 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
|
| 339 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("VIDEO TEXT") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) // Vd
|
| 340 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
|
| 341 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
|
| 342 |
|
| 343 | PORT_START_TAG("D9")
|
| 344 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
|
| 345 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
|
| 346 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
|
| 347 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
|
| 348 |
|
| 349 | PORT_START_TAG("D10")
|
| 350 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
|
| 351 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('@')
|
| 352 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
|
| 353 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
|
| 354 | |
| 355 | PORT_START_TAG("D11")
|
| 356 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
|
| 357 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('\\')
|
| 358 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
|
| 359 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
|
| 360 |
|
| 361 | PORT_START_TAG("D12")
|
| 362 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
|
| 363 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('+') PORT_CHAR('^')
|
| 364 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
|
| 365 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INSERT") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT))
|
| 366 |
|
| 367 | PORT_START_TAG("D13")
|
| 368 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
|
| 369 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NEW LINE") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // NL
|
| 370 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
|
| 371 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
|
| 372 |
|
| 373 | PORT_START_TAG("D14")
|
| 374 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('/') PORT_CHAR('?')
|
| 375 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 376 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
|
| 377 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // CH
|
| 378 |
|
| 379 | PORT_START_TAG("D15")
|
| 380 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // SH
|
| 381 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPHICS") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) // GR
|
| 382 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPEAT") // RPT
|
| 383 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // GL
|
| 384 | INPUT_PORTS_END
|
| 385 | |
| 386 | /* Video */
|
| 387 | |
| 388 | static VIDEO_START( newbrain )
|
| 389 | {
|
| 390 | }
|
| 391 | |
| 392 | static VIDEO_UPDATE( newbrain )
|
| 393 | {
|
| 394 | return 0;
|
| 395 | }
|
| 396 | |
| 397 | /* */
|
| 398 | |
| 399 | static int acia_irq;
|
| 400 | static UINT8 rxd = 1, txd = 1;
|
| 401 | |
| 402 | static void acia_interrupt(int state)
|
| 403 | {
|
| 404 | acia_irq = state;
|
| 405 | }
|
| 406 | |
| 407 | static const struct acia6850_interface newbrain_acia_intf =
|
| 408 | {
|
| 409 | 500000, // ???
|
| 410 | 500000, // ???
|
| 411 | &rxd,
|
| 412 | &txd,
|
| 413 | NULL,
|
| 414 | NULL,
|
| 415 | NULL,
|
| 416 | acia_interrupt
|
| 417 | };
|
| 418 | |
| 419 | static void newbrain_fdc_interrupt(int state)
|
| 420 | {
|
| 421 | }
|
| 422 | |
| 423 | static const struct nec765_interface newbrain_nec765_interface =
|
| 424 | {
|
| 425 | newbrain_fdc_interrupt,
|
| 426 | NULL
|
| 427 | };
|
| 428 | |
| 429 | MACHINE_START( newbrain )
|
| 430 | {
|
| 431 | nec765_init(&newbrain_nec765_interface, NEC765A, NEC765_RDY_PIN_NOT_CONNECTED);
|
| 432 | acia6850_config(0, &newbrain_acia_intf);
|
| 433 | }
|
| 434 | |
| 435 | MACHINE_RESET( newbrain )
|
| 436 | {
|
| 437 | }
|
| 438 | |
| 439 | static const struct z80_irq_daisy_chain newbrain_daisy_chain[] =
|
| 440 | {
|
| 441 | { z80ctc_reset, z80ctc_irq_state, z80ctc_irq_ack, z80ctc_irq_reti, 0 },
|
| 442 | { 0, 0, 0, 0, -1 }
|
| 443 | };
|
| 444 | |
| 445 | /* Machine Drivers */
|
| 446 | |
| 447 | static MACHINE_DRIVER_START( newbrain )
|
| 448 | MDRV_DRIVER_DATA(newbrain_state)
|
| 449 | |
| 450 | // basic system hardware
|
| 451 | |
| 452 | MDRV_CPU_ADD_TAG("main", Z80, XTAL_16MHz/8)
|
| 453 | MDRV_CPU_PROGRAM_MAP(newbrain_map, 0)
|
| 454 | MDRV_CPU_IO_MAP(newbrain_io_map, 0)
|
| 455 | |
| 456 | MDRV_CPU_ADD_TAG("cop", COP420, XTAL_16MHz/8)
|
| 457 | MDRV_CPU_PROGRAM_MAP(newbrain_cop_map, 0)
|
| 458 | MDRV_CPU_IO_MAP(newbrain_cop_io_map, 0)
|
| 459 | |
| 460 | MDRV_CPU_ADD_TAG("fdc", Z80, XTAL_4MHz)
|
| 461 | MDRV_CPU_PROGRAM_MAP(newbrain_fdc_map, 0)
|
| 462 | MDRV_CPU_IO_MAP(newbrain_fdc_io_map, 0)
|
| 463 | |
| 464 | MDRV_MACHINE_START(newbrain)
|
| 465 | MDRV_MACHINE_RESET(newbrain)
|
| 466 | |
| 467 | // video hardware
|
| 468 | |
| 469 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
|
| 470 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
| 471 | MDRV_SCREEN_REFRESH_RATE(50)
|
| 472 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
|
| 473 | MDRV_SCREEN_SIZE(640, 400)
|
| 474 | MDRV_SCREEN_VISIBLE_AREA(0, 639, 0, 399)
|
| 475 | |
| 476 | MDRV_PALETTE_LENGTH(2)
|
| 477 | MDRV_PALETTE_INIT(black_and_white)
|
| 478 | |
| 479 | MDRV_VIDEO_START(newbrain)
|
| 480 | MDRV_VIDEO_UPDATE(newbrain)
|
| 481 | MACHINE_DRIVER_END
|
| 482 | |
| 483 | static MACHINE_DRIVER_START( newbraid )
|
| 484 | MDRV_IMPORT_FROM(newbrain)
|
| 485 | MACHINE_DRIVER_END
|
| 486 | |
| 487 | static MACHINE_DRIVER_START( newbramd )
|
| 488 | MDRV_IMPORT_FROM(newbrain)
|
| 489 | MACHINE_DRIVER_END
|
| 490 | |
| 491 | /* ROMs */
|
| 492 | |
| 493 | ROM_START( newbrain )
|
| 494 | ROM_REGION( 0x10000, REGION_CPU1, 0 )
|
| 495 | ROM_SYSTEM_BIOS( 0, "default", "ROM 2.0" )
|
| 496 | ROMX_LOAD( "aben20.rom", 0xa000, 0x2000, CRC(3d76d0c8) SHA1(753b4530a518ad832e4b81c4e5430355ba3f62e0), ROM_BIOS(1) )
|
| 497 | ROMX_LOAD( "cd20tci.rom", 0xc000, 0x4000, CRC(f65b2350) SHA1(1ada7fbf207809537ec1ffb69808524300622ada), ROM_BIOS(1) )
|
| 498 | |
| 499 | ROM_SYSTEM_BIOS( 1, "rom191", "ROM 1.91" )
|
| 500 | ROMX_LOAD( "aben191.rom", 0xa000, 0x2000, CRC(b7be8d89) SHA1(cce8d0ae7aa40245907ea38b7956c62d039d45b7), ROM_BIOS(2) )
|
| 501 | ROMX_LOAD( "cd.rom", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(2) )
|
| 502 | ROMX_LOAD( "ef1x.rom", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(2) )
|
| 503 | |
| 504 | ROM_SYSTEM_BIOS( 2, "rom19", "ROM 1.9" )
|
| 505 | ROMX_LOAD( "aben19.rom", 0xa000, 0x2000, CRC(d0283eb1) SHA1(351d248e69a77fa552c2584049006911fb381ff0), ROM_BIOS(3) )
|
| 506 | ROMX_LOAD( "cd.rom", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(3) )
|
| 507 | ROMX_LOAD( "ef1x.rom", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(3) )
|
| 508 | |
| 509 | ROM_SYSTEM_BIOS( 3, "rom14", "ROM 1.4" )
|
| 510 | ROMX_LOAD( "aben14.rom", 0xa000, 0x2000, CRC(d0283eb1) SHA1(351d248e69a77fa552c2584049006911fb381ff0), ROM_BIOS(4) )
|
| 511 | ROMX_LOAD( "cd.rom", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(4) )
|
| 512 | ROMX_LOAD( "ef1x.rom", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(4) )
|
| 513 | |
| 514 | ROM_REGION( 0x400, REGION_CPU2, 0 )
|
| 515 | ROM_LOAD( "cop420.419", 0x000, 0x400, NO_DUMP )
|
| 516 | |
| 517 | ROM_REGION( 0x10000, REGION_CPU3, 0 )
|
| 518 | ROM_LOAD( "d417-2.417", 0xe000, 0x2000, CRC(e8bda8b9) SHA1(c85a76a5ff7054f4ef4a472ce99ebaed1abd269c) )
|
| 519 | ROM_END
|
| 520 | |
| 521 | #define rom_newbraid rom_newbrain
|
| 522 | |
| 523 | ROM_START( newbramd )
|
| 524 | ROM_REGION( 0x10000, REGION_CPU1, 0 )
|
| 525 | ROM_LOAD( "cdmd.rom", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a) )
|
| 526 | ROM_LOAD( "efmd.rom", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6) )
|
| 527 | |
| 528 | ROM_REGION( 0x400, REGION_CPU2, 0 )
|
| 529 | ROM_LOAD( "cop420.419", 0x000, 0x400, NO_DUMP )
|
| 530 | |
| 531 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) // TODO: remove this
|
| 532 | ROM_LOAD( "d417-2.417", 0xe000, 0x2000, CRC(e8bda8b9) SHA1(c85a76a5ff7054f4ef4a472ce99ebaed1abd269c) )
|
| 533 | ROM_END
|
| 534 | |
| 535 | /* System Configuration */
|
| 536 | |
| 537 | static void newbrain_cassette_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
|
| 538 | {
|
| 539 | /* cassette */
|
| 540 | switch(state)
|
| 541 | {
|
| 542 | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 543 | case MESS_DEVINFO_INT_COUNT: info->i = 2; break;
|
| 544 | case MESS_DEVINFO_INT_CASSETTE_DEFAULT_STATE: info->i = CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED; break;
|
| 545 | |
| 546 | default: cassette_device_getinfo(devclass, state, info); break;
|
| 547 | }
|
| 548 | }
|
| 549 | |
| 550 | static DEVICE_IMAGE_LOAD( newbrain_floppy )
|
| 551 | {
|
| 552 | if (image_has_been_created(image))
|
| 553 | return INIT_FAIL;
|
| 554 | |
| 555 | if (device_load_basicdsk_floppy(image) == INIT_PASS)
|
| 556 | {
|
| 557 | // 180K
|
| 558 | }
|
| 559 | |
| 560 | return INIT_PASS;
|
| 561 | }
|
| 562 | |
| 563 | static void newbrain_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
|
| 564 | {
|
| 565 | /* floppy */
|
| 566 | switch(state)
|
| 567 | {
|
| 568 | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 569 | case MESS_DEVINFO_INT_COUNT: info->i = 2; break;
|
| 570 | |
| 571 | /* --- the following bits of info are returned as pointers to data or functions --- */
|
| 572 | case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(newbrain_floppy); break;
|
| 573 | |
| 574 | /* --- the following bits of info are returned as NULL-terminated strings --- */
|
| 575 | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "img"); break;
|
| 576 | |
| 577 | default: legacybasicdsk_device_getinfo(devclass, state, info); break;
|
| 578 | }
|
| 579 | }
|
| 580 | |
| 581 | SYSTEM_CONFIG_START( newbrain )
|
| 582 | CONFIG_RAM_DEFAULT (32 * 1024)
|
| 583 | CONFIG_DEVICE(newbrain_cassette_getinfo)
|
| 584 | CONFIG_DEVICE(newbrain_floppy_getinfo)
|
| 585 | SYSTEM_CONFIG_END
|
| 586 | |
| 587 | /* System Drivers */
|
| 588 | |
| 589 | // YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS
|
| 590 | COMP( 1981, newbrain, 0, 0, newbrain, newbrain, 0, newbrain, "Grundy Business Systems Ltd.", "NewBrain A", GAME_NOT_WORKING | GAME_NO_SOUND )
|
| 591 | COMP( 1981, newbraid, newbrain, 0, newbraid, newbrain, 0, newbrain, "Grundy Business Systems Ltd.", "NewBrain AD", GAME_NOT_WORKING | GAME_NO_SOUND )
|
| 592 | COMP( 1981, newbramd, newbrain, 0, newbramd, newbrain, 0, newbrain, "Grundy Business Systems Ltd.", "NewBrain MD", GAME_NOT_WORKING | GAME_NO_SOUND )
|