src/mess/machine/beta.c
| r0 | r2541 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | beta.h |
| 4 | |
| 5 | Implementation of Beta disk drive support for Spectrum and clones |
| 6 | |
| 7 | 04/05/2008 Created by Miodrag Milanovic |
| 8 | |
| 9 | *********************************************************************/ |
| 10 | #include "driver.h" |
| 11 | #include "devices/basicdsk.h" |
| 12 | #include "machine/wd17xx.h" |
| 13 | |
| 14 | static int betadisk_status; |
| 15 | static int betadisk_active; |
| 16 | |
| 17 | int betadisk_is_active(void) |
| 18 | { |
| 19 | return betadisk_active; |
| 20 | } |
| 21 | |
| 22 | void betadisk_enable(void) |
| 23 | { |
| 24 | betadisk_active = 1; |
| 25 | } |
| 26 | |
| 27 | void betadisk_disable(void) |
| 28 | { |
| 29 | betadisk_active = 0; |
| 30 | } |
| 31 | |
| 32 | void betadisk_clear_status(void) |
| 33 | { |
| 34 | betadisk_status = 0; |
| 35 | } |
| 36 | |
| 37 | void betadisk_wd179x_callback(running_machine *machine, wd17xx_state_t state, void *param) |
| 38 | { |
| 39 | switch (state) |
| 40 | { |
| 41 | case WD17XX_DRQ_SET: |
| 42 | { |
| 43 | betadisk_status |= (1<<6); |
| 44 | } |
| 45 | break; |
| 46 | |
| 47 | case WD17XX_DRQ_CLR: |
| 48 | { |
| 49 | betadisk_status &=~(1<<6); |
| 50 | } |
| 51 | break; |
| 52 | |
| 53 | case WD17XX_IRQ_SET: |
| 54 | { |
| 55 | betadisk_status |= (1<<7); |
| 56 | } |
| 57 | break; |
| 58 | |
| 59 | case WD17XX_IRQ_CLR: |
| 60 | { |
| 61 | betadisk_status &=~(1<<7); |
| 62 | } |
| 63 | break; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | READ8_HANDLER(betadisk_status_r) |
| 68 | { |
| 69 | if (betadisk_active==1) { |
| 70 | return wd17xx_status_r(machine, offset); |
| 71 | } else { |
| 72 | return 0xff; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | READ8_HANDLER(betadisk_track_r) |
| 77 | { |
| 78 | if (betadisk_active==1) { |
| 79 | return wd17xx_track_r(machine, offset); |
| 80 | } else { |
| 81 | return 0xff; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | READ8_HANDLER(betadisk_sector_r) |
| 86 | { |
| 87 | if (betadisk_active==1) { |
| 88 | return wd17xx_sector_r(machine, offset); |
| 89 | } else { |
| 90 | return 0xff; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | READ8_HANDLER(betadisk_data_r) |
| 95 | { |
| 96 | if (betadisk_active==1) { |
| 97 | return wd17xx_data_r(machine, offset); |
| 98 | } else { |
| 99 | return 0xff; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | READ8_HANDLER(betadisk_state_r) |
| 104 | { |
| 105 | if (betadisk_active==1) { |
| 106 | return betadisk_status | 0x3f; |
| 107 | } else { |
| 108 | return 0xff; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | WRITE8_HANDLER(betadisk_param_w) |
| 113 | { |
| 114 | if (betadisk_active==1) { |
| 115 | wd17xx_set_drive ( data & 3); |
| 116 | wd17xx_set_side ((data & 0x10) ? 0 : 1 ); |
| 117 | wd17xx_set_density(data & 0x20 ? DEN_MFM_LO : DEN_FM_LO ); |
| 118 | if ((data & 0x04) == 0) // reset |
| 119 | { |
| 120 | wd17xx_reset(); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | WRITE8_HANDLER(betadisk_command_w) |
| 126 | { |
| 127 | if (betadisk_active==1) { |
| 128 | wd17xx_command_w(machine, offset, data); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | WRITE8_HANDLER(betadisk_track_w) |
| 133 | { |
| 134 | if (betadisk_active==1) { |
| 135 | wd17xx_track_w(machine, offset, data); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | WRITE8_HANDLER(betadisk_sector_w) |
| 140 | { |
| 141 | if (betadisk_active==1) { |
| 142 | wd17xx_sector_w(machine, offset, data); |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | WRITE8_HANDLER(betadisk_data_w) |
| 147 | { |
| 148 | if (betadisk_active==1) { |
| 149 | wd17xx_data_w(machine, offset, data); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | DEVICE_IMAGE_LOAD( beta_floppy ) |
| 154 | { |
| 155 | if (device_load_basicdsk_floppy (image) != INIT_PASS) |
| 156 | return INIT_FAIL; |
| 157 | |
| 158 | basicdsk_set_geometry (image, 80, 2, 16, 256, 1, 0, FALSE); |
| 159 | return INIT_PASS; |
| 160 | } |
| 161 | |
| 162 | void beta_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 163 | { |
| 164 | /* floppy */ |
| 165 | switch(state) |
| 166 | { |
| 167 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 168 | case MESS_DEVINFO_INT_COUNT: info->i = 4; break; |
| 169 | |
| 170 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 171 | case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(beta_floppy); break; |
| 172 | |
| 173 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 174 | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "trd"); break; |
| 175 | |
| 176 | default: legacybasicdsk_device_getinfo(devclass, state, info); break; |
| 177 | } |
| 178 | } |
src/mess/drivers/pentagon.c
| r2540 | r2541 | |
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "includes/spectrum.h" |
| 3 | #include "eventlst.h" |
| 3 | 4 | #include "devices/snapquik.h" |
| 4 | 5 | #include "devices/cartslot.h" |
| 5 | 6 | #include "devices/cassette.h" |
| 7 | #include "sound/ay8910.h" |
| 8 | #include "sound/speaker.h" |
| 6 | 9 | #include "formats/tzx_cas.h" |
| 10 | #include "devices/basicdsk.h" |
| 11 | #include "machine/wd17xx.h" |
| 12 | #include "machine/beta.h" |
| 7 | 13 | |
| 8 | | extern MACHINE_START( scorpion ); |
| 14 | MACHINE_START( pentagon ) |
| 15 | { |
| 16 | wd17xx_init(machine, WD_TYPE_179X, betadisk_wd179x_callback, NULL); |
| 17 | } |
| 9 | 18 | |
| 10 | | /****************************************************************************************************/ |
| 11 | | /* pentagon */ |
| 12 | 19 | |
| 13 | | static READ8_HANDLER(pentagon_port_r) |
| 14 | | { |
| 15 | | return 0x0ff; |
| 20 | static int ROMSelection; |
| 21 | |
| 22 | static OPBASE_HANDLER( pentagon_opbase ) |
| 23 | { |
| 24 | if ( address >= 0x4000 ) { |
| 25 | if (ROMSelection == 3) { |
| 26 | ROMSelection = 1; |
| 27 | betadisk_disable(); |
| 28 | memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x014000); // Set BASIC ROM |
| 29 | } |
| 30 | } |
| 31 | else if ((address & 0xff00) == 0x3d00) |
| 32 | { |
| 33 | if (ROMSelection == 1) |
| 34 | { |
| 35 | ROMSelection = 3; |
| 36 | betadisk_enable(); |
| 37 | memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x01c000); // Set TRDOS ROM |
| 38 | } |
| 39 | } |
| 40 | return address; |
| 16 | 41 | } |
| 17 | 42 | |
| 43 | static void pentagon_update_memory(running_machine *machine) |
| 44 | { |
| 45 | unsigned char *ChosenROM; |
| 46 | |
| 47 | read8_machine_func rh; |
| 48 | write8_machine_func wh; |
| 18 | 49 | |
| 19 | | static WRITE8_HANDLER(pentagon_port_w) |
| 20 | | { |
| 50 | if (spectrum_128_port_7ffd_data & 8) |
| 51 | { |
| 52 | //logerror("SCREEN 1: BLOCK 7\n"); |
| 53 | spectrum_128_screen_location = mess_ram + (7<<14); |
| 54 | } |
| 55 | else |
| 56 | { |
| 57 | //logerror("SCREEN 0: BLOCK 5\n"); |
| 58 | spectrum_128_screen_location = mess_ram + (5<<14); |
| 59 | } |
| 60 | |
| 61 | /* select ram at 0x0c000-0x0ffff */ |
| 62 | { |
| 63 | int ram_page; |
| 64 | unsigned char *ram_data; |
| 65 | |
| 66 | ram_page = (spectrum_128_port_7ffd_data & 0x07); |
| 67 | ram_data = mess_ram + (ram_page<<14); |
| 68 | |
| 69 | memory_set_bankptr(4, ram_data); |
| 70 | |
| 71 | //logerror("RAM at 0xc000: %02x\n",ram_page); |
| 72 | } |
| 73 | |
| 74 | /* rom at 0x0000 */ |
| 75 | //logerror("ROM at 0x0000\n"); |
| 76 | |
| 77 | /* connect page 0 of rom to 0x0000 */ |
| 78 | rh = SMH_BANK1; |
| 79 | wh = SMH_NOP; |
| 80 | |
| 81 | if( betadisk_is_active() && !( spectrum_128_port_7ffd_data & 0x10 ) ) { |
| 82 | ROMSelection = 2; |
| 83 | } |
| 84 | else |
| 85 | { |
| 86 | /* ROM switching */ |
| 87 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ; |
| 88 | } |
| 89 | /* rom 0 is 128K rom, rom 1 is 48 BASIC */ |
| 90 | ChosenROM = memory_region(REGION_CPU1) + 0x010000 + (ROMSelection<<14); |
| 91 | |
| 92 | memory_set_bankptr(1, ChosenROM); |
| 93 | |
| 94 | //logerror("rom switch: %02x\n", ROMSelection); |
| 95 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, rh); |
| 96 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, wh); |
| 21 | 97 | } |
| 22 | 98 | |
| 99 | static WRITE8_HANDLER(pentagon_port_7ffd_w) |
| 100 | { |
| 101 | //logerror("pentagon 7ffd w: %02x\n", data); |
| 23 | 102 | |
| 103 | /* disable paging? */ |
| 104 | if (spectrum_128_port_7ffd_data & 0x20) |
| 105 | return; |
| 24 | 106 | |
| 25 | | /* ports are not decoded full. |
| 26 | | The function decodes the ports appropriately */ |
| 27 | | static ADDRESS_MAP_START (pentagon_io, ADDRESS_SPACE_IO, 8) |
| 28 | | AM_RANGE(0x0000, 0xffff) AM_READWRITE( pentagon_port_r, pentagon_port_w ) |
| 107 | /* store new state */ |
| 108 | spectrum_128_port_7ffd_data = data; |
| 109 | |
| 110 | /* update memory */ |
| 111 | pentagon_update_memory(machine); |
| 112 | } |
| 113 | |
| 114 | static ADDRESS_MAP_START (pentagon_io, ADDRESS_SPACE_IO, 8) |
| 115 | ADDRESS_MAP_UNMAP_HIGH |
| 116 | AM_RANGE(0x001f, 0x001f) AM_READWRITE(betadisk_status_r,betadisk_command_w) AM_MIRROR(0xff00) |
| 117 | AM_RANGE(0x003f, 0x003f) AM_READWRITE(betadisk_track_r,betadisk_track_w) AM_MIRROR(0xff00) |
| 118 | AM_RANGE(0x005f, 0x005f) AM_READWRITE(betadisk_sector_r,betadisk_sector_w) AM_MIRROR(0xff00) |
| 119 | AM_RANGE(0x007f, 0x007f) AM_READWRITE(betadisk_data_r,betadisk_data_w) AM_MIRROR(0xff00) |
| 120 | AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) |
| 121 | AM_RANGE(0x00ff, 0x00ff) AM_READWRITE(betadisk_state_r, betadisk_param_w) AM_MIRROR(0xff00) |
| 122 | AM_RANGE(0x4000, 0x4000) AM_WRITE(pentagon_port_7ffd_w) AM_MIRROR(0x3ffd) |
| 123 | AM_RANGE(0x8000, 0x8000) AM_WRITE(AY8910_write_port_0_w) AM_MIRROR(0x3ffd) |
| 124 | AM_RANGE(0xc000, 0xc000) AM_READWRITE(AY8910_read_port_0_r,AY8910_control_port_0_w) AM_MIRROR(0x3ffd) |
| 29 | 125 | ADDRESS_MAP_END |
| 30 | 126 | |
| 31 | 127 | static MACHINE_RESET( pentagon ) |
| 32 | 128 | { |
| 129 | betadisk_enable(); |
| 130 | betadisk_clear_status(); |
| 131 | |
| 132 | memory_set_opbase_handler( 0, pentagon_opbase ); |
| 133 | |
| 134 | memset(mess_ram,0,128*1024); |
| 135 | |
| 33 | 136 | /* Bank 5 is always in 0x4000 - 0x7fff */ |
| 34 | 137 | memory_set_bankptr(2, mess_ram + (5<<14)); |
| 35 | 138 | |
| 36 | 139 | /* Bank 2 is always in 0x8000 - 0xbfff */ |
| 37 | 140 | memory_set_bankptr(3, mess_ram + (2<<14)); |
| 141 | |
| 142 | spectrum_128_port_7ffd_data = 0; |
| 143 | |
| 144 | pentagon_update_memory(machine); |
| 145 | |
| 146 | MACHINE_RESET_CALL(spectrum); |
| 147 | |
| 148 | wd17xx_reset(); |
| 38 | 149 | } |
| 39 | 150 | |
| 40 | 151 | static MACHINE_DRIVER_START( pentagon ) |
| 41 | 152 | MDRV_IMPORT_FROM( spectrum_128 ) |
| 42 | 153 | MDRV_CPU_MODIFY("main") |
| 43 | 154 | MDRV_CPU_IO_MAP(pentagon_io, 0) |
| 44 | | MDRV_MACHINE_START( scorpion ) |
| 155 | MDRV_MACHINE_START( pentagon ) |
| 45 | 156 | MDRV_MACHINE_RESET( pentagon ) |
| 46 | 157 | MACHINE_DRIVER_END |
| 47 | 158 | |
| 48 | 159 | |
| 160 | |
| 49 | 161 | /*************************************************************************** |
| 50 | 162 | |
| 51 | 163 | Game driver(s) |
| 52 | 164 | |
| 53 | 165 | ***************************************************************************/ |
| 54 | 166 | |
| 55 | | |
| 56 | 167 | ROM_START(pentagon) |
| 57 | 168 | ROM_REGION(0x020000, REGION_CPU1, 0) |
| 169 | ROM_LOAD("128p-0.rom",0x010000, 0x4000, CRC(124AD9E0)) |
| 170 | ROM_LOAD("128p-1.rom",0x014000, 0x4000, CRC(B96A36BE)) |
| 171 | ROM_LOAD("gluck.rom",0x018000, 0x4000, CRC(CA321D79)) |
| 172 | ROM_LOAD("trdos.rom",0x01c000, 0x4000, CRC(10751ABA)) |
| 58 | 173 | ROM_CART_LOAD(0, "rom", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 59 | 174 | ROM_END |
| 60 | 175 | |
| 61 | | SYSTEM_CONFIG_EXTERN(specpls3) |
| 176 | SYSTEM_CONFIG_EXTERN(spectrum) |
| 62 | 177 | |
| 178 | SYSTEM_CONFIG_START(pentagon) |
| 179 | CONFIG_IMPORT_FROM(spectrum) |
| 180 | CONFIG_RAM_DEFAULT(128 * 1024) |
| 181 | CONFIG_DEVICE(beta_floppy_getinfo) |
| 182 | SYSTEM_CONFIG_END |
| 183 | |
| 63 | 184 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 64 | | COMP( ????, pentagon, spectrum, 0, pentagon, spectrum, 0, specpls3, "???", "Pentagon", GAME_NOT_WORKING) |
| 185 | COMP( ????, pentagon, 0, 0, pentagon, spectrum, 0, pentagon, "???", "Pentagon", 0) |
src/mess/drivers/specpls3.c
| r2540 | r2541 | |
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | | /* decoding as per spectrum FAQ on www.worldofspectrum.org */ |
| 333 | | static READ8_HANDLER ( spectrum_plus3_port_r ) |
| 334 | | { |
| 335 | | if ((offset & 1)==0) |
| 336 | | { |
| 337 | | return spectrum_port_fe_r(machine, offset); |
| 338 | | } |
| 339 | | |
| 340 | | if ((offset & 2)==0) |
| 341 | | { |
| 342 | | switch ((offset>>14) & 0x03) |
| 343 | | { |
| 344 | | /* +3 fdc,memory,centronics */ |
| 345 | | case 0: |
| 346 | | { |
| 347 | | switch ((offset>>12) & 0x03) |
| 348 | | { |
| 349 | | /* +3 centronics */ |
| 350 | | case 0: |
| 351 | | break; |
| 352 | | |
| 353 | | /* +3 fdc status */ |
| 354 | | case 2: |
| 355 | | return spectrum_plus3_port_2ffd_r(machine, offset); |
| 356 | | /* +3 fdc data */ |
| 357 | | case 3: |
| 358 | | return spectrum_plus3_port_3ffd_r(machine, offset); |
| 359 | | |
| 360 | | default: |
| 361 | | break; |
| 362 | | } |
| 363 | | } |
| 364 | | break; |
| 365 | | |
| 366 | | /* 128k AY data */ |
| 367 | | case 3: |
| 368 | | return spectrum_128_port_fffd_r(machine, offset); |
| 369 | | |
| 370 | | default: |
| 371 | | break; |
| 372 | | } |
| 373 | | } |
| 374 | | |
| 375 | | return video_screen_get_vpos(machine->primary_screen)<193 ? spectrum_128_screen_location[0x1800|(video_screen_get_vpos(machine->primary_screen)&0xf8)<<2]:0xff; |
| 376 | | } |
| 377 | | |
| 378 | | static WRITE8_HANDLER ( spectrum_plus3_port_w ) |
| 379 | | { |
| 380 | | if ((offset & 1)==0) |
| 381 | | spectrum_port_fe_w(machine, offset, data); |
| 382 | | |
| 383 | | /* the following is not decoded exactly, need to check |
| 384 | | what is correct! */ |
| 385 | | |
| 386 | | if ((offset & 2)==0) |
| 387 | | { |
| 388 | | switch ((offset>>14) & 0x03) |
| 389 | | { |
| 390 | | /* +3 fdc,memory,centronics */ |
| 391 | | case 0: |
| 392 | | { |
| 393 | | switch ((offset>>12) & 0x03) |
| 394 | | { |
| 395 | | /* +3 centronics */ |
| 396 | | case 0: |
| 397 | | { |
| 398 | | |
| 399 | | |
| 400 | | } |
| 401 | | break; |
| 402 | | |
| 403 | | /* +3 memory */ |
| 404 | | case 1: |
| 405 | | spectrum_plus3_port_1ffd_w(machine, offset, data); |
| 406 | | break; |
| 407 | | |
| 408 | | /* +3 fdc data */ |
| 409 | | case 3: |
| 410 | | spectrum_plus3_port_3ffd_w(machine, offset, data); |
| 411 | | break; |
| 412 | | |
| 413 | | default: |
| 414 | | break; |
| 415 | | } |
| 416 | | } |
| 417 | | break; |
| 418 | | |
| 419 | | /* 128k memory */ |
| 420 | | case 1: |
| 421 | | spectrum_plus3_port_7ffd_w(machine, offset, data); |
| 422 | | break; |
| 423 | | |
| 424 | | /* 128k AY data */ |
| 425 | | case 2: |
| 426 | | spectrum_128_port_bffd_w(machine, offset, data); |
| 427 | | break; |
| 428 | | |
| 429 | | /* 128K AY register */ |
| 430 | | case 3: |
| 431 | | spectrum_128_port_fffd_w(machine, offset, data); |
| 432 | | |
| 433 | | default: |
| 434 | | break; |
| 435 | | } |
| 436 | | } |
| 437 | | |
| 438 | | /*logerror("Write %02x to +3 port: %04x\n", data, offset); */ |
| 439 | | } |
| 440 | | |
| 441 | 332 | /* ports are not decoded full. |
| 442 | 333 | The function decodes the ports appropriately */ |
| 443 | 334 | static ADDRESS_MAP_START (spectrum_plus3_io, ADDRESS_SPACE_IO, 8) |
| 444 | | AM_RANGE(0x0000, 0xffff) AM_READWRITE( spectrum_plus3_port_r, spectrum_plus3_port_w ) |
| 335 | ADDRESS_MAP_UNMAP_HIGH |
| 336 | AM_RANGE(0x0000, 0x0000) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) |
| 337 | AM_RANGE(0x001f, 0x001f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) |
| 338 | AM_RANGE(0x4000, 0x4000) AM_WRITE(spectrum_plus3_port_7ffd_w) AM_MIRROR(0x3ffd) |
| 339 | AM_RANGE(0x8000, 0x8000) AM_WRITE(AY8910_write_port_0_w) AM_MIRROR(0x3ffd) |
| 340 | AM_RANGE(0xc000, 0xc000) AM_READWRITE(AY8910_read_port_0_r,AY8910_control_port_0_w) AM_MIRROR(0x3ffd) |
| 341 | AM_RANGE(0x1000, 0x1000) AM_WRITE(spectrum_plus3_port_1ffd_w) AM_MIRROR(0x0ffd) |
| 342 | AM_RANGE(0x2000, 0x2000) AM_READ(spectrum_plus3_port_2ffd_r) AM_MIRROR(0x0ffd) |
| 343 | AM_RANGE(0x3000, 0x3000) AM_READWRITE(spectrum_plus3_port_3ffd_r,spectrum_plus3_port_3ffd_w) AM_MIRROR(0x0ffd) |
| 445 | 344 | ADDRESS_MAP_END |
| 446 | 345 | |
| 447 | 346 | static MACHINE_RESET( spectrum_plus3 ) |
src/mess/drivers/scorpion.c
| r2540 | r2541 | |
| 154 | 154 | #include "sound/speaker.h" |
| 155 | 155 | #include "formats/tzx_cas.h" |
| 156 | 156 | |
| 157 | | /* +3 hardware */ |
| 158 | | #include "machine/nec765.h" |
| 159 | | #include "devices/dsk.h" |
| 160 | | |
| 161 | | /****************************************************************************************************/ |
| 162 | | /* BETADISK/TR-DOS disc controller emulation */ |
| 163 | | /* microcontroller KR1818VG93 is a russian wd179x clone */ |
| 164 | 157 | #include "machine/wd17xx.h" |
| 158 | #include "machine/beta.h" |
| 165 | 159 | |
| 166 | | /* |
| 167 | | DRQ (D6) and INTRQ (D7). |
| 168 | | DRQ - signal showing request of data by microcontroller |
| 169 | | INTRQ - signal of completion of execution of command. |
| 170 | | */ |
| 171 | | |
| 172 | | static int betadisk_status; |
| 173 | | static int betadisk_active; |
| 174 | | |
| 175 | | static void betadisk_wd179x_callback(running_machine *machine, wd17xx_state_t state, void *param) |
| 176 | | { |
| 177 | | switch (state) |
| 178 | | { |
| 179 | | case WD17XX_DRQ_SET: |
| 180 | | { |
| 181 | | betadisk_status |= (1<<6); |
| 182 | | } |
| 183 | | break; |
| 184 | | |
| 185 | | case WD17XX_DRQ_CLR: |
| 186 | | { |
| 187 | | betadisk_status &=~(1<<6); |
| 188 | | } |
| 189 | | break; |
| 190 | | |
| 191 | | case WD17XX_IRQ_SET: |
| 192 | | { |
| 193 | | betadisk_status |= (1<<7); |
| 194 | | } |
| 195 | | break; |
| 196 | | |
| 197 | | case WD17XX_IRQ_CLR: |
| 198 | | { |
| 199 | | betadisk_status &=~(1<<7); |
| 200 | | } |
| 201 | | break; |
| 202 | | } |
| 203 | | } |
| 204 | | |
| 205 | 160 | MACHINE_START( scorpion ) |
| 206 | 161 | { |
| 207 | | betadisk_active = 0; |
| 208 | | betadisk_status = 0x03f; |
| 209 | 162 | wd17xx_init(machine, WD_TYPE_179X, betadisk_wd179x_callback, NULL); |
| 210 | 163 | } |
| 211 | 164 | |
| r2540 | r2541 | |
| 239 | 192 | |
| 240 | 193 | static int scorpion_256_port_1ffd_data = 0; |
| 241 | 194 | |
| 195 | static int ROMSelection; |
| 196 | |
| 197 | static OPBASE_HANDLER( scorpion_opbase ) |
| 198 | { |
| 199 | if ( address >= 0x4000 ) { |
| 200 | if (ROMSelection == 3) { |
| 201 | ROMSelection = 1; |
| 202 | betadisk_disable(); |
| 203 | memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x014000); // Set BASIC ROM |
| 204 | } |
| 205 | } |
| 206 | else if ((address & 0xff00) == 0x3d00) |
| 207 | { |
| 208 | if (ROMSelection == 1) |
| 209 | { |
| 210 | ROMSelection = 3; |
| 211 | betadisk_enable(); |
| 212 | memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x01c000); // Set TRDOS ROM |
| 213 | } |
| 214 | } |
| 215 | return address; |
| 216 | } |
| 217 | |
| 242 | 218 | static void scorpion_update_memory(running_machine *machine) |
| 243 | 219 | { |
| 244 | 220 | unsigned char *ChosenROM; |
| 245 | | int ROMSelection; |
| 221 | |
| 246 | 222 | read8_machine_func rh; |
| 247 | 223 | write8_machine_func wh; |
| 248 | 224 | |
| 249 | 225 | if (spectrum_128_port_7ffd_data & 8) |
| 250 | 226 | { |
| 251 | | logerror("SCREEN 1: BLOCK 7\n"); |
| 227 | //logerror("SCREEN 1: BLOCK 7\n"); |
| 252 | 228 | spectrum_128_screen_location = mess_ram + (7<<14); |
| 253 | 229 | } |
| 254 | 230 | else |
| 255 | 231 | { |
| 256 | | logerror("SCREEN 0: BLOCK 5\n"); |
| 232 | //logerror("SCREEN 0: BLOCK 5\n"); |
| 257 | 233 | spectrum_128_screen_location = mess_ram + (5<<14); |
| 258 | 234 | } |
| 259 | 235 | |
| r2540 | r2541 | |
| 267 | 243 | |
| 268 | 244 | memory_set_bankptr(4, ram_data); |
| 269 | 245 | |
| 270 | | logerror("RAM at 0xc000: %02x\n",ram_page); |
| 246 | //logerror("RAM at 0xc000: %02x\n",ram_page); |
| 271 | 247 | } |
| 272 | 248 | |
| 273 | 249 | if (scorpion_256_port_1ffd_data & 0x01) |
| 274 | 250 | { |
| 275 | 251 | /* ram at 0x0000 */ |
| 276 | | logerror("RAM at 0x0000\n"); |
| 252 | //logerror("RAM at 0x0000\n"); |
| 277 | 253 | |
| 278 | 254 | /* connect page 0 of ram to 0x0000 */ |
| 279 | 255 | rh = SMH_BANK1; |
| r2540 | r2541 | |
| 283 | 259 | else |
| 284 | 260 | { |
| 285 | 261 | /* rom at 0x0000 */ |
| 286 | | logerror("ROM at 0x0000\n"); |
| 262 | //logerror("ROM at 0x0000\n"); |
| 287 | 263 | |
| 288 | 264 | /* connect page 0 of rom to 0x0000 */ |
| 289 | 265 | rh = SMH_BANK1; |
| r2540 | r2541 | |
| 303 | 279 | |
| 304 | 280 | memory_set_bankptr(1, ChosenROM); |
| 305 | 281 | |
| 306 | | logerror("rom switch: %02x\n", ROMSelection); |
| 282 | //logerror("rom switch: %02x\n", ROMSelection); |
| 307 | 283 | } |
| 308 | 284 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, rh); |
| 309 | 285 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, wh); |
| 310 | 286 | } |
| 311 | 287 | |
| 312 | 288 | |
| 289 | |
| 290 | static TIMER_CALLBACK(nmi_check_callback) |
| 291 | { |
| 292 | if ((input_port_read(machine, "NMI") & 1)==1) { |
| 293 | scorpion_256_port_1ffd_data |= 0x02; |
| 294 | scorpion_update_memory(machine); |
| 295 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 296 | } |
| 297 | } |
| 298 | |
| 313 | 299 | static WRITE8_HANDLER(scorpion_port_7ffd_w) |
| 314 | 300 | { |
| 315 | | logerror("scorpion 7ffd w: %02x\n", data); |
| 301 | //logerror("scorpion 7ffd w: %02x\n", data); |
| 316 | 302 | |
| 317 | 303 | /* disable paging? */ |
| 318 | 304 | if (spectrum_128_port_7ffd_data & 0x20) |
| r2540 | r2541 | |
| 327 | 313 | |
| 328 | 314 | static WRITE8_HANDLER(scorpion_port_1ffd_w) |
| 329 | 315 | { |
| 330 | | logerror("scorpion 1ffd w: %02x\n", data); |
| 316 | //logerror("scorpion 1ffd w: %02x\n", data); |
| 331 | 317 | |
| 332 | 318 | scorpion_256_port_1ffd_data = data; |
| 333 | 319 | |
| r2540 | r2541 | |
| 337 | 323 | scorpion_update_memory(machine); |
| 338 | 324 | } |
| 339 | 325 | } |
| 340 | | |
| 341 | | |
| 342 | | /* not sure if decoding is full or partial on scorpion */ |
| 343 | | /* TO BE CHECKED! */ |
| 344 | | static READ8_HANDLER(scorpion_port_r) |
| 345 | | { |
| 346 | | |
| 347 | | /* KT: the following is not decoded exactly, need to check what |
| 348 | | is correct */ |
| 349 | | if ((offset & 2)==0) |
| 350 | | { |
| 351 | | switch ((offset>>8) & 0xff) |
| 352 | | { |
| 353 | | case 0xff: return spectrum_128_port_fffd_r(machine, offset); |
| 354 | | case 0x1f: return spectrum_port_1f_r(machine, offset); |
| 355 | | case 0x7f: return spectrum_port_7f_r(machine, offset); |
| 356 | | case 0xdf: return spectrum_port_df_r(machine, offset); |
| 357 | | } |
| 358 | | } |
| 359 | | switch (offset & 0x0ff) |
| 360 | | { |
| 361 | | case 0x0fe: |
| 362 | | return spectrum_port_fe_r(machine, offset); |
| 363 | | /* case 0x01f: |
| 364 | | return wd17xx_status_r(machine, offset); |
| 365 | | case 0x03f: |
| 366 | | return wd17xx_track_r(machine, offset); |
| 367 | | case 0x05f: |
| 368 | | return wd17xx_sector_r(machine, offset); |
| 369 | | case 0x07f: |
| 370 | | return wd17xx_data_r(machine, offset); |
| 371 | | case 0x0ff: |
| 372 | | return betadisk_status;*/ |
| 373 | | } |
| 374 | | return 0xff; |
| 375 | | } |
| 376 | | |
| 377 | | |
| 378 | | /* not sure if decoding is full or partial on scorpion */ |
| 379 | | /* TO BE CHECKED! */ |
| 380 | | static WRITE8_HANDLER(scorpion_port_w) |
| 381 | | { |
| 382 | | switch (offset & 0x0ff) |
| 383 | | { |
| 384 | | case 0xfe : spectrum_port_fe_w(machine, offset, data); |
| 385 | | break; |
| 386 | | default: |
| 387 | | if ((offset & 2)==0) |
| 388 | | { |
| 389 | | switch ((offset>>8) & 0xf0) |
| 390 | | { |
| 391 | | case 0x70: |
| 392 | | scorpion_port_7ffd_w(machine, offset, data); |
| 393 | | break; |
| 394 | | case 0xb0: |
| 395 | | spectrum_128_port_bffd_w(machine, offset, data); |
| 396 | | break; |
| 397 | | case 0xf0: |
| 398 | | spectrum_128_port_fffd_w(machine, offset, data); |
| 399 | | break; |
| 400 | | case 0x10: |
| 401 | | scorpion_port_1ffd_w(machine, offset, data); |
| 402 | | break; |
| 403 | | default: |
| 404 | | logerror("Write %02x to scorpion port: %04x\n", data, offset); |
| 405 | | } |
| 406 | | } |
| 407 | | else |
| 408 | | { |
| 409 | | logerror("Write %02x to scorpion port: %04x\n", data, offset); |
| 410 | | } |
| 411 | | } |
| 412 | | } |
| 413 | | |
| 414 | | |
| 415 | | |
| 326 | |
| 416 | 327 | /* ports are not decoded full. |
| 417 | 328 | The function decodes the ports appropriately */ |
| 418 | | static ADDRESS_MAP_START (scorpion_io, ADDRESS_SPACE_IO, 8) |
| 419 | | AM_RANGE(0x0000, 0xffff) AM_READWRITE(scorpion_port_r, scorpion_port_w) |
| 329 | static ADDRESS_MAP_START (scorpion_io, ADDRESS_SPACE_IO, 8) |
| 330 | ADDRESS_MAP_UNMAP_HIGH |
| 331 | AM_RANGE(0x001f, 0x001f) AM_READWRITE(betadisk_status_r,betadisk_command_w) AM_MIRROR(0xff00) |
| 332 | AM_RANGE(0x003f, 0x003f) AM_READWRITE(betadisk_track_r,betadisk_track_w) AM_MIRROR(0xff00) |
| 333 | AM_RANGE(0x005f, 0x005f) AM_READWRITE(betadisk_sector_r,betadisk_sector_w) AM_MIRROR(0xff00) |
| 334 | AM_RANGE(0x007f, 0x007f) AM_READWRITE(betadisk_data_r,betadisk_data_w) AM_MIRROR(0xff00) |
| 335 | AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) |
| 336 | AM_RANGE(0x00ff, 0x00ff) AM_READWRITE(betadisk_state_r, betadisk_param_w) AM_MIRROR(0xff00) |
| 337 | AM_RANGE(0x4000, 0x4000) AM_WRITE(scorpion_port_7ffd_w) AM_MIRROR(0x3ffd) |
| 338 | AM_RANGE(0x8000, 0x8000) AM_WRITE(AY8910_write_port_0_w) AM_MIRROR(0x3ffd) |
| 339 | AM_RANGE(0xc000, 0xc000) AM_READWRITE(AY8910_read_port_0_r,AY8910_control_port_0_w) AM_MIRROR(0x3ffd) |
| 340 | AM_RANGE(0x1000, 0x1000) AM_WRITE(scorpion_port_1ffd_w) AM_MIRROR(0x0ffd) |
| 420 | 341 | ADDRESS_MAP_END |
| 421 | 342 | |
| 422 | 343 | |
| 423 | 344 | static MACHINE_RESET( scorpion ) |
| 424 | 345 | { |
| 346 | betadisk_disable(); |
| 347 | betadisk_clear_status(); |
| 348 | |
| 349 | memory_set_opbase_handler( 0, scorpion_opbase ); |
| 350 | |
| 425 | 351 | memset(mess_ram,0,256*1024); |
| 426 | 352 | |
| 427 | 353 | /* Bank 5 is always in 0x4000 - 0x7fff */ |
| r2540 | r2541 | |
| 434 | 360 | scorpion_256_port_1ffd_data = 0; |
| 435 | 361 | |
| 436 | 362 | scorpion_update_memory(machine); |
| 363 | |
| 364 | MACHINE_RESET_CALL(spectrum); |
| 365 | |
| 366 | wd17xx_reset(); |
| 367 | |
| 368 | timer_pulse(ATTOTIME_IN_HZ(50), NULL, 0, nmi_check_callback); |
| 437 | 369 | } |
| 438 | 370 | |
| 439 | 371 | static MACHINE_DRIVER_START( scorpion ) |
| r2540 | r2541 | |
| 461 | 393 | ROM_CART_LOAD(0, "rom", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 462 | 394 | ROM_END |
| 463 | 395 | |
| 464 | | |
| 465 | 396 | SYSTEM_CONFIG_EXTERN(spectrum) |
| 466 | 397 | |
| 467 | 398 | SYSTEM_CONFIG_START(scorpion) |
| 468 | 399 | CONFIG_IMPORT_FROM(spectrum) |
| 469 | 400 | CONFIG_RAM_DEFAULT(256 * 1024) |
| 401 | CONFIG_DEVICE(beta_floppy_getinfo) |
| 470 | 402 | SYSTEM_CONFIG_END |
| 471 | 403 | |
| 472 | 404 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
src/mess/drivers/spectrum.c
| r2540 | r2541 | |
| 275 | 275 | /* kempston joystick interface */ |
| 276 | 276 | READ8_HANDLER(spectrum_port_1f_r) |
| 277 | 277 | { |
| 278 | | return input_port_read(machine, "KEMPSTON") & 0x1f; |
| 278 | return input_port_read(machine, "KEMPSTON") & 0x1f; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /* fuller joystick interface */ |
| 282 | 282 | READ8_HANDLER(spectrum_port_7f_r) |
| 283 | 283 | { |
| 284 | | return input_port_read(machine, "FULLER") | (0xff^0x8f); |
| 284 | return input_port_read(machine, "FULLER") | (0xff^0x8f); |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /* mikrogen joystick interface */ |
| 288 | 288 | READ8_HANDLER(spectrum_port_df_r) |
| 289 | 289 | { |
| 290 | | return input_port_read(machine, "MIKROGEN") | (0xff^0x1f); |
| 290 | return input_port_read(machine, "MIKROGEN") | (0xff^0x1f); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | | static READ8_HANDLER ( spectrum_port_r ) |
| 293 | static READ8_HANDLER ( spectrum_port_ula_r ) |
| 294 | 294 | { |
| 295 | | if ((offset & 1)==0) |
| 296 | | return spectrum_port_fe_r(machine, offset); |
| 297 | | |
| 298 | | if ((offset & 0xff)==0x1f) |
| 299 | | return spectrum_port_1f_r(machine, offset); |
| 300 | | |
| 301 | | if ((offset & 0xff)==0x7f) |
| 302 | | return spectrum_port_7f_r(machine, offset); |
| 303 | | |
| 304 | | if ((offset & 0xff)==0xdf) |
| 305 | | return spectrum_port_df_r(machine, offset); |
| 306 | | |
| 307 | 295 | return video_screen_get_vpos(machine->primary_screen)<193 ? spectrum_colorram[(video_screen_get_vpos(machine->primary_screen)&0xf8)<<2]:0xff; |
| 308 | 296 | } |
| 309 | 297 | |
| 310 | | static WRITE8_HANDLER ( spectrum_port_w ) |
| 311 | | { |
| 312 | | if ((offset & 1)==0) |
| 313 | | spectrum_port_fe_w(machine, offset,data); |
| 314 | | else |
| 315 | | { |
| 316 | | logerror("Write %02x to Port: %04x\n", data, offset); |
| 317 | | } |
| 318 | | } |
| 319 | | |
| 320 | 298 | /* ports are not decoded full. |
| 321 | 299 | The function decodes the ports appropriately */ |
| 322 | 300 | static ADDRESS_MAP_START (spectrum_io, ADDRESS_SPACE_IO, 8) |
| 323 | | AM_RANGE(0x0000, 0xffff) AM_READWRITE( spectrum_port_r, spectrum_port_w ) |
| 301 | AM_RANGE(0x00, 0x00) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) |
| 302 | AM_RANGE(0x1f, 0x1f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) |
| 303 | AM_RANGE(0x7f, 0x7f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00) |
| 304 | AM_RANGE(0xdf, 0xdf) AM_READ(spectrum_port_df_r) AM_MIRROR(0xff00) |
| 305 | AM_RANGE(0x01, 0x01) AM_READ(spectrum_port_ula_r) AM_MIRROR(0xfffe) |
| 324 | 306 | ADDRESS_MAP_END |
| 325 | 307 | |
| 326 | 308 | /****************************************************************************************************/ |
| r2540 | r2541 | |
| 442 | 424 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIKROGEN JOYSTICK LEFT") PORT_CODE(JOYCODE_X_LEFT_SWITCH) |
| 443 | 425 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIKROGEN JOYSTICK FIRE") PORT_CODE(JOYCODE_BUTTON1) |
| 444 | 426 | |
| 427 | PORT_START_TAG("NMI") |
| 428 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NMI") PORT_CODE(KEYCODE_F12) |
| 445 | 429 | |
| 446 | 430 | PORT_START_TAG("CONFIG") /* [16] */ |
| 447 | 431 | PORT_DIPNAME(0x80, 0x00, "Hardware Version") |
| r2540 | r2541 | |
| 499 | 483 | MDRV_QUICKLOAD_ADD(spectrum, "scr", 0) |
| 500 | 484 | MACHINE_DRIVER_END |
| 501 | 485 | |
| 502 | | |
| 503 | 486 | /*************************************************************************** |
| 504 | 487 | |
| 505 | 488 | Game driver(s) |
| r2540 | r2541 | |
| 567 | 550 | ROM_CART_LOAD(0, "rom", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 568 | 551 | ROM_END |
| 569 | 552 | |
| 553 | /* Romanian clones - added by Miodrag Milanovic */ |
| 554 | ROM_START(jet) |
| 555 | ROM_REGION(0x10000,REGION_CPU1,0) |
| 556 | ROM_LOAD("jet.rom", 0x0000, 0x4000, CRC(E56A7D11) ) |
| 557 | ROM_CART_LOAD(0, "rom", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 558 | ROM_END |
| 570 | 559 | |
| 560 | ROM_START(cip03) |
| 561 | ROM_REGION(0x10000,REGION_CPU1,0) |
| 562 | ROM_LOAD("cip03.rom", 0x0000, 0x4000, CRC(C7D0CD3C) ) |
| 563 | ROM_CART_LOAD(0, "rom", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 564 | ROM_END |
| 565 | |
| 566 | ROM_START(hc85) |
| 567 | ROM_REGION(0x10000,REGION_CPU1,0) |
| 568 | ROM_LOAD("hc85.rom", 0x0000, 0x4000, CRC(3AB60FB5) ) |
| 569 | ROM_CART_LOAD(0, "rom", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 570 | ROM_END |
| 571 | |
| 572 | ROM_START(hc90) |
| 573 | ROM_REGION(0x10000,REGION_CPU1,0) |
| 574 | ROM_LOAD("hc90.rom", 0x0000, 0x4000, CRC(78C14D9A) ) |
| 575 | ROM_CART_LOAD(0, "rom", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 576 | ROM_END |
| 577 | |
| 578 | ROM_START(hc91) |
| 579 | ROM_REGION(0x10000,REGION_CPU1,0) |
| 580 | ROM_LOAD("hc91.rom", 0x0000, 0x4000, CRC(8BF53761) ) |
| 581 | ROM_CART_LOAD(0, "rom", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 582 | ROM_END |
| 583 | |
| 571 | 584 | static void spectrum_common_cassette_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 572 | 585 | { |
| 573 | 586 | /* cassette */ |
| r2540 | r2541 | |
| 601 | 614 | COMP( 1986, inves, spectrum, 0, spectrum, spectrum, 0, spectrum, "Investronica", "Inves Spectrum 48K+" , 0) |
| 602 | 615 | COMP( 1985, tk90x, spectrum, 0, spectrum, spectrum, 0, spectrum, "Micro Digital", "TK-90x Color Computer" , 0) |
| 603 | 616 | COMP( 1986, tk95, spectrum, 0, spectrum, spectrum, 0, spectrum, "Micro Digital", "TK-95 Color Computer" , 0) |
| 617 | |
| 618 | |
| 619 | COMP( 1990, jet, spectrum, 0, spectrum, spectrum, 0, spectrum, "Electromagnetica", "JET" , 0) |
| 620 | COMP( 1982, cip03, spectrum, 0, spectrum, spectrum, 0, spectrum, "Electronica", "CIP-03" , 0) |
| 621 | COMP( 1985, hc85, spectrum, 0, spectrum, spectrum, 0, spectrum, "Ice Felix", "HC85" , 0) |
| 622 | COMP( 1990, hc90, spectrum, 0, spectrum, spectrum, 0, spectrum, "Ice Felix", "HC90" , 0) |
| 623 | COMP( 1991, hc91, spectrum, 0, spectrum, spectrum, 0, spectrum, "Ice Felix", "HC91" , 0) |
src/mess/drivers/spec128.c
| r2540 | r2541 | |
| 226 | 226 | logerror("rom switch: %02x\n", ROMSelection); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | | |
| 230 | | |
| 231 | | WRITE8_HANDLER(spectrum_128_port_bffd_w) |
| 229 | static READ8_HANDLER ( spectrum_128_ula_r ) |
| 232 | 230 | { |
| 233 | | AY8910_write_port_0_w(machine, 0, data); |
| 231 | return video_screen_get_vpos(machine->primary_screen)<193 ? spectrum_128_screen_location[0x1800|(video_screen_get_vpos(machine->primary_screen)&0xf8)<<2]:0xff; |
| 234 | 232 | } |
| 235 | 233 | |
| 236 | | WRITE8_HANDLER(spectrum_128_port_fffd_w) |
| 237 | | { |
| 238 | | AY8910_control_port_0_w(machine, 0, data); |
| 239 | | } |
| 240 | | |
| 241 | | READ8_HANDLER(spectrum_128_port_fffd_r) |
| 242 | | { |
| 243 | | return AY8910_read_port_0_r(machine, 0); |
| 244 | | } |
| 245 | | |
| 246 | | static READ8_HANDLER ( spectrum_128_port_r ) |
| 247 | | { |
| 248 | | if ((offset & 1)==0) |
| 249 | | { |
| 250 | | return spectrum_port_fe_r(machine, offset); |
| 251 | | } |
| 252 | | |
| 253 | | if ((offset & 2)==0) |
| 254 | | { |
| 255 | | switch ((offset>>14) & 0x03) |
| 256 | | { |
| 257 | | default: |
| 258 | | break; |
| 259 | | |
| 260 | | case 3: |
| 261 | | return spectrum_128_port_fffd_r(machine, offset); |
| 262 | | } |
| 263 | | } |
| 264 | | |
| 265 | | /* don't think these are correct! */ |
| 266 | | if ((offset & 0xff)==0x1f) |
| 267 | | return spectrum_port_1f_r(machine, offset); |
| 268 | | |
| 269 | | if ((offset & 0xff)==0x7f) |
| 270 | | return spectrum_port_7f_r(machine, offset); |
| 271 | | |
| 272 | | if ((offset & 0xff)==0xdf) |
| 273 | | return spectrum_port_df_r(machine, offset); |
| 274 | | |
| 275 | | return video_screen_get_vpos(machine->primary_screen)<193 ? spectrum_128_screen_location[0x1800|(video_screen_get_vpos(machine->primary_screen)&0xf8)<<2]:0xff; |
| 276 | | } |
| 277 | | |
| 278 | | static WRITE8_HANDLER ( spectrum_128_port_w ) |
| 279 | | { |
| 280 | | if ((offset & 1)==0) |
| 281 | | spectrum_port_fe_w(machine, offset,data); |
| 282 | | |
| 283 | | /* Only decodes on A15, A14 & A1 */ |
| 284 | | else if ((offset & 2)==0) |
| 285 | | { |
| 286 | | switch ((offset>>8) & 0xc0) |
| 287 | | { |
| 288 | | case 0x40: |
| 289 | | spectrum_128_port_7ffd_w(machine, offset, data); |
| 290 | | break; |
| 291 | | case 0x80: |
| 292 | | spectrum_128_port_bffd_w(machine, offset, data); |
| 293 | | break; |
| 294 | | case 0xc0: |
| 295 | | spectrum_128_port_fffd_w(machine, offset, data); |
| 296 | | break; |
| 297 | | default: |
| 298 | | logerror("Write %02x to 128 port: %04x\n", data, offset); |
| 299 | | } |
| 300 | | } |
| 301 | | else |
| 302 | | { |
| 303 | | logerror("Write %02x to 128 port: %04x\n", data, offset); |
| 304 | | } |
| 305 | | } |
| 306 | | |
| 307 | | /* ports are not decoded full. |
| 308 | | The function decodes the ports appropriately */ |
| 309 | 234 | static ADDRESS_MAP_START (spectrum_128_io, ADDRESS_SPACE_IO, 8) |
| 310 | | AM_RANGE(0x0000, 0xffff) AM_READWRITE( spectrum_128_port_r, spectrum_128_port_w ) |
| 235 | AM_RANGE(0x0000, 0x0000) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) |
| 236 | AM_RANGE(0x001f, 0x001f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) |
| 237 | AM_RANGE(0x007f, 0x007f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00) |
| 238 | AM_RANGE(0x00df, 0x00df) AM_READ(spectrum_port_df_r) AM_MIRROR(0xff00) |
| 239 | AM_RANGE(0x4000, 0x4000) AM_WRITE(spectrum_128_port_7ffd_w) AM_MIRROR(0x3ffd) |
| 240 | AM_RANGE(0x8000, 0x8000) AM_WRITE(AY8910_write_port_0_w) AM_MIRROR(0x3ffd) |
| 241 | AM_RANGE(0xc000, 0xc000) AM_READWRITE(AY8910_read_port_0_r,AY8910_control_port_0_w) AM_MIRROR(0x3ffd) |
| 242 | AM_RANGE(0x0001, 0x0001) AM_READ(spectrum_128_ula_r) AM_MIRROR(0xfffe) |
| 311 | 243 | ADDRESS_MAP_END |
| 312 | 244 | |
| 313 | 245 | static ADDRESS_MAP_START (spectrum_128_mem, ADDRESS_SPACE_PROGRAM, 8) |
| r2540 | r2541 | |
| 413 | 345 | ROM_CART_LOAD(0, "rom", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 414 | 346 | ROM_END |
| 415 | 347 | |
| 348 | ROM_START(hc128) |
| 349 | ROM_REGION(0x18000,REGION_CPU1,0) |
| 350 | ROM_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5)) |
| 351 | ROM_LOAD("hc128.rom", 0x14000, 0x4000, CRC(0241E960) ) |
| 352 | ROM_CART_LOAD(0, "rom", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 353 | ROM_END |
| 416 | 354 | SYSTEM_CONFIG_START(spec128) |
| 417 | 355 | CONFIG_IMPORT_FROM(spectrum) |
| 418 | 356 | CONFIG_RAM_DEFAULT(128 * 1024) |
| r2540 | r2541 | |
| 425 | 363 | COMP( 1986, specpls2, spec128, 0, spectrum_128, spectrum, 0, spec128, "Amstrad plc", "ZX Spectrum +2" , 0 ) |
| 426 | 364 | COMP( 1986, specp2fr, spec128, 0, spectrum_128, spectrum, 0, spec128, "Amstrad plc", "ZX Spectrum +2 (France)" , 0 ) |
| 427 | 365 | COMP( 1986, specp2sp, spec128, 0, spectrum_128, spectrum, 0, spec128, "Amstrad plc", "ZX Spectrum +2 (Spain)" , 0 ) |
| 366 | COMP( 1992, hc128, spec128, 0, spectrum_128, spectrum, 0, spec128, "Ice Felix", "HC128" , 0) |
src/mess/drivers/timex.c
| r2540 | r2541 | |
| 172 | 172 | ts2068_update_memory(machine); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | | static WRITE8_HANDLER(ts2068_port_f5_w) |
| 176 | | { |
| 177 | | AY8910_control_port_0_w(machine, 0, data); |
| 178 | | } |
| 179 | | |
| 180 | | static READ8_HANDLER(ts2068_port_f6_r) |
| 181 | | { |
| 182 | | /* TODO - Reading from register 14 reads the joystick ports |
| 183 | | set bit 8 of address to read joystick #1 |
| 184 | | set bit 9 of address to read joystick #2 |
| 185 | | if both bits are set then OR values |
| 186 | | Bit 0 up, 1 down, 2 left, 3 right, 7 fire active low. Other bits 1 |
| 187 | | */ |
| 188 | | return AY8910_read_port_0_r(machine, 0); |
| 189 | | } |
| 190 | | |
| 191 | | static WRITE8_HANDLER(ts2068_port_f6_w) |
| 192 | | { |
| 193 | | AY8910_write_port_0_w(machine, 0, data); |
| 194 | | } |
| 195 | | |
| 196 | 175 | static READ8_HANDLER(ts2068_port_ff_r) |
| 197 | 176 | { |
| 198 | 177 | return ts2068_port_ff_data; |
| r2540 | r2541 | |
| 211 | 190 | logerror("Port %04x write %02x\n", offset, data); |
| 212 | 191 | } |
| 213 | 192 | |
| 214 | | |
| 215 | | static READ8_HANDLER ( ts2068_port_r ) |
| 216 | | { |
| 217 | | switch (offset & 0xff) |
| 218 | | { |
| 219 | | /* Note: keys only decoded on port #fe not all even ports so |
| 220 | | ports #f4 & #f6 correctly read */ |
| 221 | | case 0xf4: return ts2068_port_f4_r(machine, offset); |
| 222 | | case 0xf6: return ts2068_port_f6_r(machine, offset); |
| 223 | | case 0xff: return ts2068_port_ff_r(machine, offset); |
| 224 | | |
| 225 | | case 0xfe: return spectrum_port_fe_r(machine, offset); |
| 226 | | case 0x1f: return spectrum_port_1f_r(machine, offset); |
| 227 | | case 0x7f: return spectrum_port_7f_r(machine, offset); |
| 228 | | case 0xdf: return spectrum_port_df_r(machine, offset); |
| 229 | | } |
| 230 | | logerror("Read from port: %04x\n", offset); |
| 231 | | |
| 232 | | return 0xff; |
| 233 | | } |
| 234 | | |
| 235 | | static WRITE8_HANDLER ( ts2068_port_w ) |
| 236 | | { |
| 237 | | /* Ports #fd & #fc were reserved by Timex for bankswitching and are not used |
| 238 | | by either the hardware or system software. |
| 239 | | Port #fb is the Thermal printer port and works exactly as the Sinclair |
| 240 | | Printer - ie not yet emulated. |
| 241 | | */ |
| 242 | | switch (offset & 0xff) |
| 243 | | { |
| 244 | | case 0xfe: spectrum_port_fe_w(machine, offset,data); break; |
| 245 | | case 0xf4: ts2068_port_f4_w(machine, offset,data); break; |
| 246 | | case 0xf5: ts2068_port_f5_w(machine, offset,data); break; |
| 247 | | case 0xf6: ts2068_port_f6_w(machine, offset,data); break; |
| 248 | | case 0xff: ts2068_port_ff_w(machine, offset,data); break; |
| 249 | | default: |
| 250 | | logerror("Write %02x to Port: %04x\n", data, offset); |
| 251 | | } |
| 252 | | } |
| 253 | | |
| 254 | | |
| 255 | | |
| 256 | 193 | /******************************************************************* |
| 257 | 194 | * |
| 258 | 195 | * Bank switch between the 3 internal memory banks HOME, EXROM |
| r2540 | r2541 | |
| 594 | 531 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, wh); |
| 595 | 532 | } |
| 596 | 533 | |
| 597 | | |
| 598 | | static ADDRESS_MAP_START (ts2068_io, ADDRESS_SPACE_IO, 8) |
| 599 | | AM_RANGE(0x0000, 0xffff) AM_READWRITE( ts2068_port_r, ts2068_port_w ) |
| 534 | static ADDRESS_MAP_START (ts2068_io, ADDRESS_SPACE_IO, 8) |
| 535 | AM_RANGE(0x1f, 0x1f ) AM_READ( spectrum_port_1f_r ) AM_MIRROR(0xff00) |
| 536 | AM_RANGE(0x7f, 0x7f ) AM_READ( spectrum_port_7f_r ) AM_MIRROR(0xff00) |
| 537 | AM_RANGE(0xdf, 0xdf ) AM_READ( spectrum_port_df_r ) AM_MIRROR(0xff00) |
| 538 | AM_RANGE(0xf4, 0xf4 ) AM_READWRITE( ts2068_port_f4_r,ts2068_port_f4_w ) AM_MIRROR(0xff00) |
| 539 | AM_RANGE(0xf5, 0xf5 ) AM_WRITE( AY8910_control_port_0_w ) AM_MIRROR(0xff00) |
| 540 | AM_RANGE(0xf6, 0xf6 ) AM_READWRITE( AY8910_read_port_0_r,AY8910_write_port_0_w ) AM_MIRROR(0xff00) |
| 541 | AM_RANGE(0xfe, 0xfe ) AM_READWRITE( spectrum_port_fe_r,spectrum_port_fe_w ) AM_MIRROR(0xff00) AM_MASK(0xffff) |
| 542 | AM_RANGE(0xff, 0xff ) AM_READWRITE( ts2068_port_ff_r,ts2068_port_ff_w ) AM_MIRROR(0xff00) |
| 600 | 543 | ADDRESS_MAP_END |
| 601 | 544 | |
| 602 | 545 | static ADDRESS_MAP_START (ts2068_mem, ADDRESS_SPACE_PROGRAM, 8) |
| r2540 | r2541 | |
| 625 | 568 | /* TC2048 specific functions */ |
| 626 | 569 | |
| 627 | 570 | |
| 628 | | static void tc2048_port_ff_w(int offset, int data) |
| 571 | static WRITE8_HANDLER (tc2048_port_ff_w) |
| 629 | 572 | { |
| 630 | 573 | ts2068_port_ff_data = data; |
| 631 | 574 | logerror("Port %04x write %02x\n", offset, data); |
| 632 | 575 | } |
| 633 | 576 | |
| 634 | | static READ8_HANDLER ( tc2048_port_r ) |
| 635 | | { |
| 636 | | if ((offset & 1)==0) |
| 637 | | return spectrum_port_fe_r(machine, offset); |
| 638 | | switch (offset & 0xff) |
| 639 | | { |
| 640 | | case 0xff: return ts2068_port_ff_r(machine, offset); |
| 641 | | case 0x1f: return spectrum_port_1f_r(machine, offset); |
| 642 | | case 0x7f: return spectrum_port_7f_r(machine, offset); |
| 643 | | case 0xdf: return spectrum_port_df_r(machine, offset); |
| 644 | | } |
| 645 | | |
| 646 | | logerror("Read from port: %04x\n", offset); |
| 647 | | return 0xff; |
| 648 | | } |
| 649 | | |
| 650 | | static WRITE8_HANDLER ( tc2048_port_w ) |
| 651 | | { |
| 652 | | if ((offset & 1)==0) |
| 653 | | spectrum_port_fe_w(machine, offset,data); |
| 654 | | else if ((offset & 0xff)==0xff) |
| 655 | | tc2048_port_ff_w(offset, data); |
| 656 | | else |
| 657 | | { |
| 658 | | logerror("Write %02x to Port: %04x\n", data, offset); |
| 659 | | } |
| 660 | | } |
| 661 | | |
| 662 | | /* ports are not decoded full. |
| 663 | | The function decodes the ports appropriately */ |
| 664 | 577 | static ADDRESS_MAP_START (tc2048_io, ADDRESS_SPACE_IO, 8) |
| 665 | | AM_RANGE(0x0000, 0xffff) AM_READWRITE( tc2048_port_r, tc2048_port_w ) |
| 578 | AM_RANGE(0x00, 0x00) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) |
| 579 | AM_RANGE(0x1f, 0x1f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) |
| 580 | AM_RANGE(0x7f, 0x7f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00) |
| 581 | AM_RANGE(0xdf, 0xdf) AM_READ(spectrum_port_df_r) AM_MIRROR(0xff00) |
| 582 | AM_RANGE(0xff, 0xff) AM_READWRITE(ts2068_port_ff_r,tc2048_port_ff_w) AM_MIRROR(0xff00) |
| 666 | 583 | ADDRESS_MAP_END |
| 667 | 584 | |
| 668 | 585 | static ADDRESS_MAP_START (tc2048_mem, ADDRESS_SPACE_PROGRAM, 8) |