src/mess/devices/ti99cart.c
| r8275 | r8276 | |
| 23 | 23 | #define TI99_CARTRIDGE_PCB_MBX DEVICE_GET_INFO_NAME(ti99_cartridge_pcb_mbx) |
| 24 | 24 | #define TI99_CARTRIDGE_PCB_PAGED379I DEVICE_GET_INFO_NAME(ti99_cartridge_pcb_paged379i) |
| 25 | 25 | #define TI99_CARTRIDGE_PCB_PAGEDCRU DEVICE_GET_INFO_NAME(ti99_cartridge_pcb_pagedcru) |
| 26 | #define TI99_CARTRIDGE_PCB_GRAMKRACKER DEVICE_GET_INFO_NAME(ti99_cartridge_pcb_gramkracker) |
| 26 | 27 | |
| 27 | 28 | /* Generic TI99 cartridge structure. */ |
| 28 | 29 | struct _cartridge_t |
| 29 | 30 | { |
| 30 | | /* PCB device associated to this cartridge. If NULL, the slot is empty. */ |
| 31 | // PCB device associated to this cartridge. If NULL, the slot is empty. |
| 31 | 32 | running_device *pcb; |
| 32 | 33 | |
| 33 | | /* GROM buffer size. */ |
| 34 | // GROM buffer size. |
| 34 | 35 | int grom_size; |
| 35 | | |
| 36 | | /* ROM page. */ |
| 36 | |
| 37 | // ROM page. |
| 37 | 38 | int rom_page; |
| 38 | | /* RAM page. */ |
| 39 | |
| 40 | // RAM page. |
| 39 | 41 | int ram_page; |
| 40 | | |
| 41 | | /* ROM buffer size. All banks have equal sizes. */ |
| 42 | |
| 43 | // ROM buffer size. All banks have equal sizes. |
| 42 | 44 | int rom_size; |
| 43 | | /* RAM buffer size. All banks have equal sizes. */ |
| 45 | // RAM buffer size. All banks have equal sizes. |
| 44 | 46 | int ram_size; |
| 45 | | |
| 46 | | /* pointer to GROM data. */ |
| 47 | |
| 48 | // pointer to GROM data. |
| 47 | 49 | UINT8 *grom_ptr; |
| 48 | | |
| 49 | | /* GROM buffered data output. */ |
| 50 | | /* UINT8 grom_buffer; */ /* Now handled by the multicart system. */ |
| 51 | | |
| 52 | | /* ROM buffer. We are using this for both 16 bit (99/4a) and 8 bit |
| 53 | | (99/8) access. */ |
| 50 | |
| 51 | // ROM buffer. We are using this for both 16 bit (99/4a) and 8 bit |
| 52 | // (99/8) access. |
| 54 | 53 | void *rom_ptr; |
| 55 | | |
| 56 | | /* ROM buffer for the second bank of paged cartridges. Other cartridges |
| 57 | | usually store their ROM in one large file. */ |
| 54 | |
| 55 | // ROM buffer for the second bank of paged cartridges. Other cartridges |
| 56 | // usually store their ROM in one large file. |
| 58 | 57 | void *rom2_ptr; |
| 59 | | |
| 60 | | /* RAM buffer. The persistence service is done by the cartridge system. |
| 61 | | The RAM space is a consecutive space; all banks are in one buffer. */ |
| 58 | |
| 59 | // RAM buffer. The persistence service is done by the cartridge system. |
| 60 | // The RAM space is a consecutive space; all banks are in one buffer. |
| 62 | 61 | void *ram_ptr; |
| 63 | 62 | }; |
| 64 | 63 | typedef struct _cartridge_t cartridge_t; |
| r8275 | r8276 | |
| 86 | 85 | |
| 87 | 86 | struct _ti99_multicart_state |
| 88 | 87 | { |
| 89 | | /* Reserves space for all cartridges. This is also used in the legacy |
| 90 | | cartridge system, but only for slot 0. */ |
| 88 | // Reserves space for all cartridges. This is also used in the legacy |
| 89 | // cartridge system, but only for slot 0. |
| 91 | 90 | cartridge_t cartridge[NUMBER_OF_CARTRIDGE_SLOTS]; |
| 92 | 91 | |
| 93 | | /* Determines which slot is currently active. This value is changed when there |
| 94 | | are accesses to other GROM base addresses. */ |
| 92 | // Determines which slot is currently active. This value is changed when |
| 93 | // there are accesses to other GROM base addresses. |
| 95 | 94 | int active_slot; |
| 96 | 95 | |
| 97 | | /* Used in order to enforce a special slot. This value is retrieved |
| 98 | | from the dipswitch setting. A value of -1 means automatic, that is, |
| 99 | | the grom base switch is used. Values 0 .. max refer to the |
| 100 | | respective slot. */ |
| 96 | // Used in order to enforce a special slot. This value is retrieved |
| 97 | // from the dipswitch setting. A value of -1 means automatic, that is, |
| 98 | // the grom base switch is used. Values 0 .. max refer to the |
| 99 | // respective slot. |
| 101 | 100 | int fixed_slot; |
| 102 | 101 | |
| 103 | | /* Holds the highest index of a cartridge being plugged in plus one. |
| 104 | | If we only have one cartridge inserted, we don't want to get a |
| 105 | | selection option, so we just mirror the memory contents. */ |
| 102 | // Contains the slot number of the GRAM Kracker |
| 103 | int gk_slot; |
| 104 | |
| 105 | // Contains the slot number of the GK guest (which is the cartridge |
| 106 | // plugged into the GK) |
| 107 | int gk_guest_slot; |
| 108 | |
| 109 | // Holds the highest index of a cartridge being plugged in plus one. |
| 110 | // If we only have one cartridge inserted, we don't want to get a |
| 111 | // selection option, so we just mirror the memory contents. |
| 106 | 112 | int next_free_slot; |
| 107 | 113 | |
| 108 | | /* Counts the number of slots which currently contain legacy format |
| 109 | | cartridge images. */ |
| 114 | // Counts the number of slots which currently contain legacy format |
| 115 | // cartridge images. |
| 110 | 116 | int legacy_slots; |
| 111 | 117 | |
| 112 | | /* Counts the number of slots which currently contain new format |
| 113 | | cartridge images. */ |
| 118 | // Counts the number of slots which currently contain new format |
| 119 | // cartridge images. |
| 114 | 120 | int multi_slots; |
| 115 | 121 | |
| 116 | | /* Legacy mode. Stores the slot number where the cartridge part is mounted. |
| 117 | | Index is from slotc_type_t. */ |
| 122 | // Legacy mode. Stores the slot number where the cartridge part is |
| 123 | // mounted. Index is from slotc_type_t. |
| 118 | 124 | int legacy_slotnumber[5]; |
| 119 | 125 | |
| 120 | | /* current address pointer for the active GROM in port (16 bits) */ |
| 126 | // Current address pointer for the active GROM in port (16 bits) |
| 121 | 127 | UINT16 grom_address; |
| 122 | | /* GROM data buffer */ |
| 128 | |
| 129 | // GROM data buffer |
| 123 | 130 | UINT8 grom_buffer; |
| 124 | 131 | |
| 125 | | /* internal flip-flops that are set after the first access to the GROM |
| 126 | | address so that next access is mapped to the LSB, and cleared after each |
| 127 | | data access */ |
| 132 | // Hack for GRAM Kracker. Flag to remember whether we switched the |
| 133 | // loader area. (The GK utility assumes that it is not important whether |
| 134 | // the GROM address is set before or after the loader bank has been |
| 135 | // manually switched, but this will fail here.) |
| 136 | int loader_on; |
| 137 | |
| 138 | // Internal flip-flops that are set after the first access to the GROM |
| 139 | // address so that next access is mapped to the LSB, and cleared after |
| 140 | // each data access |
| 128 | 141 | char raddr_LSB, waddr_LSB; |
| 129 | 142 | }; |
| 130 | 143 | typedef struct _ti99_multicart_state ti99_multicart_state; |
| r8275 | r8276 | |
| 146 | 159 | static void unload_legacy(running_device *image); |
| 147 | 160 | static int load_legacy(running_device *image); |
| 148 | 161 | |
| 162 | static int cartridge_gram_kracker_readg(running_device *cartsys); |
| 163 | static void cartridge_gram_kracker_writeg(running_device *cartsys, UINT8 data); |
| 164 | |
| 149 | 165 | /* Access to the pcb. Contained in the token of the pcb instance. */ |
| 150 | 166 | struct _ti99_pcb_t |
| 151 | 167 | { |
| r8275 | r8276 | |
| 257 | 273 | cart->rom2_ptr = NULL; |
| 258 | 274 | cart->ram_ptr = NULL; |
| 259 | 275 | cart->grom_ptr = NULL; |
| 276 | |
| 277 | if (slotnumber==cartslots->gk_guest_slot) |
| 278 | cartslots->gk_guest_slot = -1; |
| 260 | 279 | } |
| 261 | 280 | |
| 262 | 281 | static void grom_write_address(ti99_multicart_state *cartslots, UINT8 data) |
| r8275 | r8276 | |
| 286 | 305 | { |
| 287 | 306 | ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token; |
| 288 | 307 | |
| 289 | | /* Set the cart slot. Note that the port must be adjusted for 16-bit |
| 290 | | systems, i.e. it should be shifted left by 1. |
| 291 | | // 1001 1wbb bbbb bbr0 |
| 292 | | */ |
| 308 | // Set the cart slot. Note that the port must be adjusted for 16-bit |
| 309 | // systems, i.e. it should be shifted left by 1. |
| 310 | // 1001 1wbb bbbb bbr0 |
| 311 | |
| 293 | 312 | cartridge_slot_set(device, (offset>>2) & 0x00ff); |
| 294 | 313 | |
| 295 | 314 | if (offset & 0x0002) |
| 296 | 315 | grom_write_address(cartslots, data); |
| 297 | 316 | else |
| 317 | { |
| 298 | 318 | cartslots->raddr_LSB = cartslots->waddr_LSB = FALSE; |
| 299 | | /* TODO: write to GRAM */ |
| 319 | |
| 320 | // Handle the GRAM Kracker |
| 321 | if ((cartslots->gk_slot != -1) && (input_port_read(device->machine, "CARTSLOT")==CART_GK)) |
| 322 | cartridge_gram_kracker_writeg(device,data); |
| 323 | } |
| 300 | 324 | } |
| 301 | 325 | |
| 302 | 326 | /* |
| r8275 | r8276 | |
| 306 | 330 | static UINT8 grom_read_address(ti99_multicart_state *cartslots) |
| 307 | 331 | { |
| 308 | 332 | UINT8 reply; |
| 309 | | /* When reading, reset the hi/lo flag byte for writing. |
| 310 | | TODO: Verify this with a real machine. */ |
| 333 | // When reading, reset the hi/lo flag byte for writing. |
| 334 | // TODO: Verify this with a real machine. |
| 311 | 335 | cartslots->waddr_LSB = FALSE; |
| 312 | 336 | |
| 313 | | /* Address reading is done in two steps; first, the high byte |
| 314 | | is transferred, then the low byte. */ |
| 337 | // Address reading is done in two steps; first, the high byte |
| 338 | // is transferred, then the low byte. |
| 315 | 339 | if (cartslots->raddr_LSB) |
| 316 | 340 | { |
| 317 | 341 | /* second pass */ |
| r8275 | r8276 | |
| 348 | 372 | cartridge_t *cartridge; |
| 349 | 373 | ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token; |
| 350 | 374 | |
| 351 | | /* Set the cart slot. Note that the port must be adjusted for 16-bit |
| 352 | | systems, i.e. it should be shifted left by 1. |
| 353 | | 1001 1wbb bbbb bbr0 |
| 354 | | */ |
| 375 | // Set the cart slot. Note that the port must be adjusted for 16-bit |
| 376 | // systems, i.e. it should be shifted left by 1. |
| 377 | // 1001 1wbb bbbb bbr0 |
| 378 | |
| 355 | 379 | cartridge_slot_set(device, (offset>>2) & 0x00ff); |
| 356 | 380 | |
| 357 | 381 | if (offset & 0x0002) |
| 358 | 382 | return grom_read_address(cartslots); |
| 359 | 383 | |
| 384 | // Handle the GRAM Kracker |
| 385 | if ((cartslots->gk_slot != -1) && (input_port_read(device->machine, "CARTSLOT")==CART_GK)) |
| 386 | return cartridge_gram_kracker_readg(device); |
| 387 | |
| 360 | 388 | /* Handle the legacy mode. */ |
| 361 | 389 | if (in_legacy_mode(device)) |
| 362 | 390 | return cartridge_grom_read_legacy(device); |
| 363 | 391 | |
| 364 | 392 | slot = cartslots->active_slot; |
| 365 | | /* |
| 366 | | This fixes a minor issue: The selection mechanism of the console |
| 367 | | concludes that there are multiple cartridges plugged in when it |
| 368 | | checks the different GROM bases and finds different data. Empty |
| 369 | | slots should return 0 at all addresses, but when we have only |
| 370 | | one cartridge, this entails that the second cartridge is |
| 371 | | different (all zeros), and so we get a meaningless selection |
| 372 | | option between cartridge 1 and 1 and 1 ... |
| 373 | 393 | |
| 374 | | So if next_free_slot==1, we have one cartridge in slot 0. |
| 375 | | In that case we trick the OS to believe that the addressed |
| 376 | | cartridge appears at all locations which causes it to assume a |
| 377 | | standard single cartslot. |
| 378 | | */ |
| 394 | // This fixes a minor issue: The selection mechanism of the console |
| 395 | // concludes that there are multiple cartridges plugged in when it |
| 396 | // checks the different GROM bases and finds different data. Empty |
| 397 | // slots should return 0 at all addresses, but when we have only |
| 398 | // one cartridge, this entails that the second cartridge is |
| 399 | // different (all zeros), and so we get a meaningless selection |
| 400 | // option between cartridge 1 and 1 and 1 ... |
| 401 | // |
| 402 | // So if next_free_slot==1, we have one cartridge in slot 0. |
| 403 | // In that case we trick the OS to believe that the addressed |
| 404 | // cartridge appears at all locations which causes it to assume a |
| 405 | // standard single cartslot. |
| 406 | |
| 379 | 407 | if (cartslots->fixed_slot==AUTO && cartslots->next_free_slot==1) |
| 380 | 408 | slot=0; |
| 381 | 409 | |
| r8275 | r8276 | |
| 386 | 414 | cartridge = &cartslots->cartridge[slot]; |
| 387 | 415 | if ((cartridge->grom_size>0) && (cartridge->pcb!=NULL)) |
| 388 | 416 | { |
| 389 | | /* This is the reason why we need the image size: Read |
| 390 | | access beyond the image size must be detected. */ |
| 417 | // This is the reason why we need the image size: Read |
| 418 | // access beyond the image size must be detected. */ |
| 391 | 419 | /* TODO: replace this using a bitmap of the available GROMs */ |
| 392 | 420 | if ((cartslots->grom_address < 0x6000) || (cartslots->grom_address > (cartridge->grom_size+0x6000))) |
| 393 | 421 | value = 0; |
| r8275 | r8276 | |
| 411 | 439 | /* so 0x5fff + 1 = 0x4000. */ |
| 412 | 440 | /* The address must be increased even if there is no cartridge slot */ |
| 413 | 441 | cartslots->grom_address = ((cartslots->grom_address + 1) & 0x1FFF) | (cartslots->grom_address & 0xE000); |
| 414 | | |
| 442 | |
| 415 | 443 | /* Reset the read and write address flipflops. */ |
| 416 | 444 | cartslots->raddr_LSB = cartslots->waddr_LSB = FALSE; |
| 417 | 445 | |
| r8275 | r8276 | |
| 458 | 486 | } |
| 459 | 487 | cartridge = &cartslots->cartridge[slotnumber]; |
| 460 | 488 | |
| 461 | | /* Get the socket which is retrieved by the multicart instance in |
| 462 | | the state of the cartslot instance. */ |
| 489 | // Get the socket which is retrieved by the multicart instance in |
| 490 | // the state of the cartslot instance. |
| 463 | 491 | socketcont = cartslot_get_socket(cartslot, "grom_socket"); |
| 464 | 492 | reslength = cartslot_get_resource_length(cartslot, "grom_socket"); |
| 465 | 493 | if (socketcont != NULL) |
| r8275 | r8276 | |
| 512 | 540 | cont16b[i] = BIG_ENDIANIZE_INT16(cont16b[i]); |
| 513 | 541 | } |
| 514 | 542 | } |
| 543 | |
| 544 | // If the GRAM Kracker is plugged in, this cartridge may become the |
| 545 | // guest |
| 546 | if (cartslots->gk_slot != -1) |
| 547 | { |
| 548 | for (i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++) |
| 549 | { |
| 550 | if (!slot_is_empty(cartsys, i) && (i != cartslots->gk_slot)) |
| 551 | { |
| 552 | cartslots->gk_guest_slot = i; |
| 553 | break; |
| 554 | } |
| 555 | } |
| 556 | } |
| 515 | 557 | return cartridge; |
| 516 | 558 | } |
| 517 | 559 | |
| r8275 | r8276 | |
| 543 | 585 | static DEVICE_START(ti99_pcb_none) |
| 544 | 586 | { |
| 545 | 587 | /* device is ti99_cartslot:cartridge:pcb */ |
| 546 | | // printf("DEVICE_START(ti99_pcb_none), tag of device=%s\n", device->tag()); |
| 547 | 588 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 548 | 589 | } |
| 549 | 590 | |
| r8275 | r8276 | |
| 556 | 597 | static DEVICE_START(ti99_pcb_std) |
| 557 | 598 | { |
| 558 | 599 | /* device is ti99_cartslot:cartridge:pcb */ |
| 559 | | // printf("DEVICE_START(ti99_pcb_std), tag of device=%s\n", device->tag()); |
| 560 | 600 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 561 | 601 | } |
| 562 | 602 | |
| r8275 | r8276 | |
| 573 | 613 | |
| 574 | 614 | if (cartridge->rom_ptr==NULL) |
| 575 | 615 | { |
| 576 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 577 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 578 | 616 | value = 0; |
| 579 | 617 | } |
| 580 | 618 | else |
| 581 | 619 | { |
| 582 | 620 | value = ((UINT16 *)cartridge->rom_ptr)[offset]; |
| 583 | | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); |
| 584 | 621 | } |
| 585 | | // printf("accessed cartridge rom[%02x:%04x] = %04x\n", 0, 0x6000+offset*2, value); |
| 586 | 622 | return value; |
| 587 | 623 | } |
| 588 | 624 | |
| 589 | 625 | static WRITE16_DEVICE_HANDLER( write_cart_std ) |
| 590 | 626 | { |
| 591 | | logerror("Write access to cartridge ROM at address %04x ignored", 0x6000 + 2*offset); |
| 627 | logerror("Write access to cartridge ROM at address %04x ignored\n", 0x6000 + 2*offset); |
| 592 | 628 | } |
| 593 | 629 | |
| 594 | 630 | /* |
| r8275 | r8276 | |
| 625 | 661 | */ |
| 626 | 662 | static int assemble_std(running_device *image) |
| 627 | 663 | { |
| 628 | | // cartridge_t *cart; |
| 629 | | // printf("assemble_std, %s\n", image->tag); |
| 630 | | /*cart = */assemble_common(image); |
| 631 | | |
| 664 | assemble_common(image); |
| 632 | 665 | return INIT_PASS; |
| 633 | 666 | } |
| 634 | 667 | |
| r8275 | r8276 | |
| 648 | 681 | ti99_multicart_state *cartslots = (ti99_multicart_state *)cartsys->token; |
| 649 | 682 | |
| 650 | 683 | slotnumber = get_index_from_tagname(image)-1; |
| 651 | | // printf("Disassemble cartridge %d\n", slotnumber); |
| 652 | 684 | |
| 653 | 685 | /* Search the highest remaining cartridge. */ |
| 654 | 686 | cartslots->next_free_slot = 0; |
| r8275 | r8276 | |
| 659 | 691 | if (!slot_is_empty(cartsys, i)) |
| 660 | 692 | { |
| 661 | 693 | cartslots->next_free_slot = i+1; |
| 662 | | // printf("Setting new next_free_slot to %d\n", cartslots->next_free_slot); |
| 663 | 694 | break; |
| 664 | 695 | } |
| 665 | 696 | } |
| r8275 | r8276 | |
| 690 | 721 | static DEVICE_START(ti99_pcb_paged) |
| 691 | 722 | { |
| 692 | 723 | /* device is ti99_cartslot:cartridge:pcb */ |
| 693 | | // printf("DEVICE_START(ti99_pcb_paged), tag of device=%s\n", device->tag()); |
| 694 | 724 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 695 | 725 | } |
| 696 | 726 | |
| r8275 | r8276 | |
| 713 | 743 | |
| 714 | 744 | if (rombank==NULL) |
| 715 | 745 | { |
| 716 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 717 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 718 | 746 | /* TODO: Check for consistency with the GROM memory handling. */ |
| 719 | 747 | value = 0; |
| 720 | 748 | } |
| 721 | 749 | else |
| 722 | 750 | { |
| 723 | 751 | value = rombank[offset]; |
| 724 | | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); |
| 725 | 752 | } |
| 726 | | // printf("accessed cartridge rom[%02x:%04x] = %04x\n", rompage, 0x6000+offset*2, value); |
| 727 | 753 | return value; |
| 728 | 754 | } |
| 729 | 755 | |
| r8275 | r8276 | |
| 738 | 764 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 739 | 765 | cartridge_t *cartridge = pcb->cartridge; |
| 740 | 766 | cartridge->rom_page = offset & 1; |
| 741 | | // printf("setting rompage to %d\n", cartridge->rom_page); |
| 742 | 767 | } |
| 743 | 768 | |
| 744 | 769 | /* |
| r8275 | r8276 | |
| 781 | 806 | { |
| 782 | 807 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 783 | 808 | cartridge_t *cartridge = pcb->cartridge; |
| 784 | | // printf("offset = %04x\n", offset); |
| 785 | 809 | cartridge->rom_page = (offset>>1) & 1; |
| 786 | 810 | } |
| 787 | 811 | |
| r8275 | r8276 | |
| 792 | 816 | { |
| 793 | 817 | cartridge_t *cart; |
| 794 | 818 | |
| 795 | | // printf("assemble_paged, %s\n", image->tag); |
| 796 | 819 | cart = assemble_common(image); |
| 797 | 820 | if (cart->rom_ptr==NULL) |
| 798 | 821 | { |
| r8275 | r8276 | |
| 817 | 840 | |
| 818 | 841 | static DEVICE_START(ti99_pcb_minimem) |
| 819 | 842 | { |
| 820 | | // printf("TI99 pcb minimem start\n"); |
| 821 | 843 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 822 | 844 | } |
| 823 | 845 | |
| r8275 | r8276 | |
| 832 | 854 | { |
| 833 | 855 | if (cartridge->rom_ptr==NULL) |
| 834 | 856 | { |
| 835 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 836 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 837 | 857 | value = 0; |
| 838 | 858 | } |
| 839 | 859 | else |
| 840 | 860 | { |
| 841 | 861 | value = ((UINT16 *)cartridge->rom_ptr)[offset]; |
| 842 | | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); |
| 843 | 862 | } |
| 844 | | // printf("accessed cartridge rom[%02x:%04x] = %04x\n", rompage, 0x6000+offset*2, value); |
| 845 | 863 | } |
| 846 | 864 | else |
| 847 | 865 | { |
| 848 | 866 | if (cartridge->ram_ptr==NULL) |
| 849 | 867 | { |
| 850 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 851 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 852 | 868 | value = 0; |
| 853 | 869 | } |
| 854 | 870 | else |
| 855 | 871 | { |
| 856 | 872 | value = ((UINT16 *)cartridge->ram_ptr)[offset-0x800]; |
| 857 | | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); |
| 858 | 873 | } |
| 859 | | // printf("accessed cartridge rom[%02x:%04x] = %04x\n", rompage, 0x6000+offset*2, value); |
| 860 | 874 | } |
| 861 | 875 | return value; |
| 862 | 876 | } |
| r8275 | r8276 | |
| 879 | 893 | if (cartridge->ram_ptr==NULL) |
| 880 | 894 | { |
| 881 | 895 | logerror("No cartridge RAM at address %04x", 0x6000 + 2*offset); |
| 882 | | |
| 883 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 884 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 885 | 896 | /* TODO: Check for consistency with the GROM memory handling. */ |
| 886 | 897 | } |
| 887 | 898 | else |
| r8275 | r8276 | |
| 945 | 956 | if (cartridge->ram_ptr==NULL) |
| 946 | 957 | { |
| 947 | 958 | logerror("No cartridge RAM at address %04x", 0x6000 + offset); |
| 948 | | |
| 949 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 950 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 951 | 959 | /* TODO: Check for consistency with the GROM memory handling. */ |
| 952 | 960 | } |
| 953 | 961 | else |
| r8275 | r8276 | |
| 962 | 970 | { |
| 963 | 971 | cartridge_t *cart; |
| 964 | 972 | |
| 965 | | // printf("assemble_minimem, %s\n", image->tag); |
| 966 | 973 | cart = assemble_common(image); |
| 967 | 974 | if (cart->grom_size==0) |
| 968 | 975 | { |
| 969 | 976 | logerror("Missing GROM for Mini Memory"); |
| 970 | | return INIT_FAIL; |
| 977 | // should not fail here because there may be variations of |
| 978 | // cartridges which do not use all parts |
| 979 | // return INIT_FAIL; |
| 971 | 980 | } |
| 972 | 981 | if (cart->rom_size==0) |
| 973 | 982 | { |
| 974 | 983 | logerror("Missing ROM for Mini Memory"); |
| 975 | | return INIT_FAIL; |
| 984 | // return INIT_FAIL; |
| 976 | 985 | } |
| 977 | 986 | if (cart->ram_size==0) |
| 978 | 987 | { |
| 979 | 988 | logerror("Missing RAM for Mini Memory"); |
| 980 | | return INIT_FAIL; |
| 989 | // return INIT_FAIL; |
| 981 | 990 | } |
| 982 | 991 | |
| 983 | 992 | return INIT_PASS; |
| r8275 | r8276 | |
| 1003 | 1012 | |
| 1004 | 1013 | static DEVICE_START(ti99_pcb_super) |
| 1005 | 1014 | { |
| 1006 | | // printf("TI99 pcb super start\n"); |
| 1007 | 1015 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 1008 | 1016 | } |
| 1009 | 1017 | |
| r8275 | r8276 | |
| 1015 | 1023 | { |
| 1016 | 1024 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 1017 | 1025 | cartridge_t *cartridge = pcb->cartridge; |
| 1018 | | /* offset is the bit number. The CRU base address is already divided |
| 1019 | | by 2. */ |
| 1020 | | int reply = 0; |
| 1026 | // offset is the bit number. The CRU base address is already divided by 2. |
| 1027 | int reply = 0; |
| 1021 | 1028 | |
| 1022 | | /* ram_page contains the bank number. We have a maximum of |
| 1023 | | 4 banks; the Super Space II manual says: |
| 1029 | // ram_page contains the bank number. We have a maximum of |
| 1030 | // 4 banks; the Super Space II manual says: |
| 1031 | // |
| 1032 | // Banks are selected by writing a bit pattern to CRU address >0800: |
| 1033 | // |
| 1034 | // Bank # Value |
| 1035 | // 0 >02 = 0000 0010 |
| 1036 | // 1 >08 = 0000 1000 |
| 1037 | // 2 >20 = 0010 0000 |
| 1038 | // 3 >80 = 1000 0000 |
| 1039 | // |
| 1040 | // With the bank number (0, 1, 2, or 3) in R0: |
| 1041 | // |
| 1042 | // BNKSW LI R12,>0800 Set CRU address |
| 1043 | // LI R1,2 Load Shift Bit |
| 1044 | // SLA R0,1 Align Bank Number |
| 1045 | // JEQ BNKS1 Skip shift if Bank 0 |
| 1046 | // SLA R1,0 Align Shift Bit |
| 1047 | // BNKS1 LDCR R1,0 Switch Banks |
| 1048 | // SRL R0,1 Restore Bank Number (optional) |
| 1049 | // RT |
| 1024 | 1050 | |
| 1025 | | Banks are selected by writing a bit pattern to CRU address >0800: |
| 1026 | | |
| 1027 | | Bank # Value |
| 1028 | | 0 >02 = 0000 0010 |
| 1029 | | 1 >08 = 0000 1000 |
| 1030 | | 2 >20 = 0010 0000 |
| 1031 | | 3 >80 = 1000 0000 |
| 1032 | | |
| 1033 | | With the bank number (0, 1, 2, or 3) in R0: |
| 1034 | | |
| 1035 | | BNKSW LI R12,>0800 Set CRU address |
| 1036 | | LI R1,2 Load Shift Bit |
| 1037 | | SLA R0,1 Align Bank Number |
| 1038 | | JEQ BNKS1 Skip shift if Bank 0 |
| 1039 | | SLA R1,0 Align Shift Bit |
| 1040 | | BNKS1 LDCR R1,0 Switch Banks |
| 1041 | | SRL R0,1 Restore Bank Number (optional) |
| 1042 | | RT |
| 1043 | | */ |
| 1044 | 1051 | if ((offset & 1) == 0 || offset > 7) |
| 1045 | 1052 | reply = 0; |
| 1046 | 1053 | |
| 1047 | | /* CRU addresses are only 1 bit wide. Bytes are transferred from LSB |
| 1048 | | to MSB. That is, 8 bit are eight consecutive addresses. */ |
| 1054 | // CRU addresses are only 1 bit wide. Bytes are transferred from LSB |
| 1055 | // to MSB. That is, 8 bit are eight consecutive addresses. */ |
| 1049 | 1056 | reply = (cartridge->ram_page == (offset-1)/2); |
| 1050 | 1057 | |
| 1051 | 1058 | return reply; |
| r8275 | r8276 | |
| 1057 | 1064 | cartridge_t *cartridge = pcb->cartridge; |
| 1058 | 1065 | // data is bit |
| 1059 | 1066 | // offset is address |
| 1060 | | if (offset < 8) |
| 1067 | if (offset < 8) |
| 1061 | 1068 | { |
| 1062 | 1069 | if (data != 0) |
| 1063 | 1070 | cartridge->ram_page = (offset-1)/2; |
| r8275 | r8276 | |
| 1078 | 1085 | |
| 1079 | 1086 | if (cartridge->ram_ptr==NULL) |
| 1080 | 1087 | { |
| 1081 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 1082 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 1083 | 1088 | value = 0; |
| 1084 | 1089 | } |
| 1085 | 1090 | else |
| 1086 | 1091 | { |
| 1087 | 1092 | boffset = cartridge->ram_page * 0x1000 + offset; |
| 1088 | 1093 | value = ((UINT16 *)cartridge->ram_ptr)[boffset]; |
| 1089 | | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); |
| 1090 | 1094 | } |
| 1091 | | // printf("accessed cartridge ram[%02x:%04x] = %04x\n", cartridge->ram_page, 0x6000+offset*2, value); |
| 1092 | 1095 | return value; |
| 1093 | 1096 | } |
| 1094 | 1097 | |
| r8275 | r8276 | |
| 1106 | 1109 | if (cartridge->ram_ptr==NULL) |
| 1107 | 1110 | { |
| 1108 | 1111 | logerror("No cartridge RAM at address %04x", 0x6000 + 2*offset); |
| 1109 | | |
| 1110 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 1111 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 1112 | 1112 | } |
| 1113 | 1113 | else |
| 1114 | 1114 | { |
| r8275 | r8276 | |
| 1132 | 1132 | |
| 1133 | 1133 | if (cartridge->ram_ptr==NULL) |
| 1134 | 1134 | { |
| 1135 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 1136 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 1137 | 1135 | value = 0; |
| 1138 | 1136 | } |
| 1139 | 1137 | else |
| 1140 | 1138 | { |
| 1141 | 1139 | boffset = cartridge->ram_page * 0x2000 + offset; |
| 1142 | 1140 | value = ((UINT8 *)cartridge->ram_ptr)[boffset]; |
| 1143 | | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); |
| 1144 | 1141 | } |
| 1145 | | // printf("accessed cartridge ram[%02x:%04x] = %04x\n", cartridge->ram_page, 0x6000+offset*2, value); |
| 1146 | 1142 | return value; |
| 1147 | 1143 | } |
| 1148 | 1144 | |
| r8275 | r8276 | |
| 1159 | 1155 | if (cartridge->ram_ptr==NULL) |
| 1160 | 1156 | { |
| 1161 | 1157 | logerror("No cartridge RAM at address %04x", 0x6000 + offset); |
| 1162 | | |
| 1163 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 1164 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 1165 | 1158 | } |
| 1166 | 1159 | else |
| 1167 | 1160 | { |
| r8275 | r8276 | |
| 1174 | 1167 | static int assemble_super(running_device *image) |
| 1175 | 1168 | { |
| 1176 | 1169 | cartridge_t *cart; |
| 1177 | | // printf("assemble_super, %s\n", image->tag); |
| 1178 | 1170 | |
| 1179 | 1171 | cart = assemble_common(image); |
| 1180 | 1172 | if (cart->ram_size==0) |
| r8275 | r8276 | |
| 1191 | 1183 | ROM: up to 16 KiB (in up to 2 banks of 8KiB each) |
| 1192 | 1184 | RAM: 1022 B (0x6c00-0x6ffd, overrides ROM in that area) |
| 1193 | 1185 | ROM mapper: 6ffe |
| 1186 | |
| 1187 | Note that some MBX cartridges assume the presence of the MBX system |
| 1188 | (additional console) and will not run without it. The MBX hardware is |
| 1189 | not emulated yet. |
| 1194 | 1190 | ******************************************************************************/ |
| 1195 | 1191 | |
| 1196 | 1192 | static DEVICE_START(ti99_pcb_mbx) |
| 1197 | 1193 | { |
| 1198 | | // printf("TI99 pcb mbx start\n"); |
| 1199 | 1194 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 1200 | 1195 | } |
| 1201 | 1196 | |
| r8275 | r8276 | |
| 1208 | 1203 | |
| 1209 | 1204 | if ((offset >= 0x0600) && (offset <= 0x07fe)) |
| 1210 | 1205 | { |
| 1211 | | /* This is the RAM area which overrides any ROM. There is no |
| 1212 | | known banking behavior for the RAM, so we must assume that |
| 1213 | | there is only one bank. */ |
| 1206 | // This is the RAM area which overrides any ROM. There is no |
| 1207 | // known banking behavior for the RAM, so we must assume that |
| 1208 | // there is only one bank. |
| 1214 | 1209 | if (cartridge->ram_ptr != NULL) |
| 1215 | 1210 | value = ((UINT16 *)cartridge->ram_ptr)[offset - 0x0600]; |
| 1216 | 1211 | } |
| r8275 | r8276 | |
| 1258 | 1253 | |
| 1259 | 1254 | if ((offset >= 0x0c00) && (offset <= 0x0ffd)) |
| 1260 | 1255 | { |
| 1261 | | /* This is the RAM area which overrides any ROM. There is no |
| 1262 | | known banking behavior for the RAM, so we must assume that |
| 1263 | | there is only one bank. */ |
| 1256 | // This is the RAM area which overrides any ROM. There is no |
| 1257 | // known banking behavior for the RAM, so we must assume that |
| 1258 | // there is only one bank. |
| 1264 | 1259 | if (cartridge->ram_ptr != NULL) |
| 1265 | 1260 | value = ((UINT8 *)cartridge->ram_ptr)[offset - 0x0c00]; |
| 1266 | 1261 | } |
| r8275 | r8276 | |
| 1297 | 1292 | |
| 1298 | 1293 | static int assemble_mbx(running_device *image) |
| 1299 | 1294 | { |
| 1300 | | // cartridge_t *cart; |
| 1301 | | |
| 1302 | | // printf("assemble_mbx, %s\n", image->tag); |
| 1303 | | /*cart = */assemble_common(image); |
| 1295 | assemble_common(image); |
| 1304 | 1296 | return INIT_PASS; |
| 1305 | 1297 | } |
| 1306 | 1298 | |
| 1307 | 1299 | /***************************************************************************** |
| 1308 | 1300 | Cartridge type: paged379i |
| 1309 | | This cartridge consists of one 16 KiB, 32 KiB, 64 KiB, or 128 KiB EEPROM |
| 1310 | | which is organised in 2, 4, 8, or 16 pages of 8 KiB each. The complete |
| 1301 | This cartridge consists of one 16 KiB, 32 KiB, 64 KiB, or 128 KiB EEPROM |
| 1302 | which is organised in 2, 4, 8, or 16 pages of 8 KiB each. The complete |
| 1311 | 1303 | memory contents must be stored in one dump file. |
| 1312 | 1304 | The pages are selected by writing a value to some memory locations. Due to |
| 1313 | 1305 | using the inverted outputs of the LS379 latch, setting the inputs of the |
| r8275 | r8276 | |
| 1338 | 1330 | static DEVICE_START(ti99_pcb_paged379i) |
| 1339 | 1331 | { |
| 1340 | 1332 | /* device is ti99_cartslot:cartridge:pcb */ |
| 1341 | | // printf("DEVICE_START(ti99_pcb_paged379i), tag of device=%s\n", device->tag()); |
| 1342 | 1333 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 1343 | 1334 | } |
| 1344 | 1335 | |
| r8275 | r8276 | |
| 1356 | 1347 | |
| 1357 | 1348 | if (cartridge->rom_ptr==NULL) |
| 1358 | 1349 | { |
| 1359 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 1360 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 1361 | 1350 | value = 0; |
| 1362 | 1351 | } |
| 1363 | 1352 | else |
| r8275 | r8276 | |
| 1366 | 1355 | // 16bit access -> multiply by 0x1000 |
| 1367 | 1356 | boffset = cartridge->rom_page * 0x1000 + offset; |
| 1368 | 1357 | value = ((UINT16 *)cartridge->rom_ptr)[boffset]; |
| 1369 | | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); |
| 1370 | 1358 | } |
| 1371 | | // printf("accessed cartridge rom[%02x:%04x] = %04x\n", cartridge->rom_page, 0x6000+offset*2, value); |
| 1372 | 1359 | return value; |
| 1373 | 1360 | } |
| 1374 | 1361 | |
| r8275 | r8276 | |
| 1391 | 1378 | mask = 1; |
| 1392 | 1379 | |
| 1393 | 1380 | cartridge->rom_page = rompage & mask; |
| 1394 | | // printf("setting rompage to %d\n", cartridge->rom_page); |
| 1395 | 1381 | } |
| 1396 | 1382 | |
| 1397 | 1383 | /* |
| r8275 | r8276 | |
| 1406 | 1392 | { |
| 1407 | 1393 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 1408 | 1394 | cartridge_t *cartridge = pcb->cartridge; |
| 1409 | | /* |
| 1410 | | Bits: 011x xxxx xxxb bbbx |
| 1411 | | x = don't care, bbbb = bank |
| 1412 | | 16bit access -> drop rightmost bit |
| 1413 | | */ |
| 1395 | |
| 1396 | // Bits: 011x xxxx xxxb bbbx |
| 1397 | // x = don't care, bbbb = bank |
| 1398 | // 16bit access -> drop rightmost bit |
| 1414 | 1399 | set_paged379i_bank(cartridge, 15 - (offset & 15)); |
| 1415 | 1400 | } |
| 1416 | 1401 | |
| r8275 | r8276 | |
| 1428 | 1413 | |
| 1429 | 1414 | if (cartridge->rom_ptr==NULL) |
| 1430 | 1415 | { |
| 1431 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 1432 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 1433 | 1416 | value = 0; |
| 1434 | 1417 | } |
| 1435 | 1418 | else |
| r8275 | r8276 | |
| 1438 | 1421 | // 8bit access -> multiply by 0x2000 |
| 1439 | 1422 | boffset = cartridge->rom_page * 0x2000 + offset; |
| 1440 | 1423 | value = ((UINT8 *)cartridge->rom_ptr)[boffset]; |
| 1441 | | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); |
| 1442 | 1424 | } |
| 1443 | | // printf("accessed cartridge rom[%02x:%04x] = %04x\n", cartridge->rom_page, 0x6000+offset*2, value); |
| 1444 | 1425 | return value; |
| 1445 | 1426 | |
| 1446 | 1427 | } |
| r8275 | r8276 | |
| 1452 | 1433 | { |
| 1453 | 1434 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 1454 | 1435 | cartridge_t *cartridge = pcb->cartridge; |
| 1455 | | /* |
| 1456 | | Bits: 011x xxxx xxxb bbbx |
| 1457 | | x = don't care, bbbb = bank |
| 1458 | | */ |
| 1436 | |
| 1437 | // Bits: 011x xxxx xxxb bbbx |
| 1438 | // x = don't care, bbbb = bank |
| 1459 | 1439 | set_paged379i_bank(cartridge, 15 - ((offset>>1) & 15)); |
| 1460 | 1440 | } |
| 1461 | 1441 | |
| r8275 | r8276 | |
| 1466 | 1446 | { |
| 1467 | 1447 | cartridge_t *cart; |
| 1468 | 1448 | |
| 1469 | | // printf("assemble_paged379i, %s\n", image->tag); |
| 1470 | 1449 | cart = assemble_common(image); |
| 1471 | 1450 | if (cart->rom_ptr==NULL) |
| 1472 | 1451 | { |
| r8275 | r8276 | |
| 1486 | 1465 | similar to the one used for the SuperSpace cartridge, with the exception |
| 1487 | 1466 | that we are using ROM only, and we can have up to 8 pages. |
| 1488 | 1467 | |
| 1489 | | Bank Value written to CRU>0800 |
| 1468 | Bank Value written to CRU>0800 |
| 1490 | 1469 | 0 >0002 = 0000 0000 0000 0010 |
| 1491 | 1470 | 1 >0008 = 0000 0000 0000 1000 |
| 1492 | 1471 | 2 >0020 = 0000 0000 0010 0000 |
| r8275 | r8276 | |
| 1501 | 1480 | static DEVICE_START(ti99_pcb_pagedcru) |
| 1502 | 1481 | { |
| 1503 | 1482 | /* device is ti99_cartslot:cartridge:pcb */ |
| 1504 | | // printf("DEVICE_START(ti99_pcb_pagedcru), tag of device=%s\n", device->tag()); |
| 1505 | 1483 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 1506 | 1484 | } |
| 1507 | 1485 | |
| r8275 | r8276 | |
| 1519 | 1497 | |
| 1520 | 1498 | if (cartridge->rom_ptr==NULL) |
| 1521 | 1499 | { |
| 1522 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 1523 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 1524 | 1500 | value = 0; |
| 1525 | 1501 | } |
| 1526 | 1502 | else |
| r8275 | r8276 | |
| 1529 | 1505 | // 16bit access -> multiply by 0x1000 |
| 1530 | 1506 | boffset = cartridge->rom_page * 0x1000 + offset; |
| 1531 | 1507 | value = ((UINT16 *)cartridge->rom_ptr)[boffset]; |
| 1532 | | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); |
| 1533 | 1508 | } |
| 1534 | | // printf("accessed cartridge rom[%02x:%04x] = %04x\n", cartridge->rom_page, 0x6000+offset*2, value); |
| 1535 | 1509 | return value; |
| 1536 | 1510 | } |
| 1537 | 1511 | |
| r8275 | r8276 | |
| 1558 | 1532 | |
| 1559 | 1533 | if (cartridge->rom_ptr==NULL) |
| 1560 | 1534 | { |
| 1561 | | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); |
| 1562 | | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); |
| 1563 | 1535 | value = 0; |
| 1564 | 1536 | } |
| 1565 | 1537 | else |
| r8275 | r8276 | |
| 1568 | 1540 | // 8bit access -> multiply by 0x2000 |
| 1569 | 1541 | boffset = cartridge->rom_page * 0x2000 + offset; |
| 1570 | 1542 | value = ((UINT8 *)cartridge->rom_ptr)[boffset]; |
| 1571 | | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); |
| 1572 | 1543 | } |
| 1573 | | // printf("accessed cartridge rom[%02x:%04x] = %04x\n", cartridge->rom_page, 0x6000+offset*2, value); |
| 1574 | 1544 | return value; |
| 1575 | | |
| 1576 | 1545 | } |
| 1577 | 1546 | |
| 1578 | 1547 | /* |
| r8275 | r8276 | |
| 1594 | 1563 | { |
| 1595 | 1564 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 1596 | 1565 | cartridge_t *cartridge = pcb->cartridge; |
| 1597 | | int reply = 0; |
| 1566 | int reply = 0; |
| 1598 | 1567 | |
| 1599 | 1568 | if ((offset & 1) == 0 || offset > 15) |
| 1600 | 1569 | reply = 0; |
| r8275 | r8276 | |
| 1610 | 1579 | cartridge_t *cartridge = pcb->cartridge; |
| 1611 | 1580 | // data is bit |
| 1612 | 1581 | // offset is address |
| 1613 | | /* Note that CRU >0F00 also gets in here ... should check |
| 1614 | | whether it is intended to go somewhere else */ |
| 1615 | | if (offset < 16) |
| 1582 | |
| 1583 | //Note that CRU >0F00 also gets in here ... should check |
| 1584 | // whether it is intended to go somewhere else |
| 1585 | if (offset < 16) |
| 1616 | 1586 | { |
| 1617 | 1587 | if (data != 0) |
| 1618 | 1588 | { |
| 1619 | 1589 | cartridge->rom_page = (offset-1)/2; |
| 1620 | | // printf("Setting bit %4x of CRU base >0800\n", offset); |
| 1621 | 1590 | } |
| 1622 | 1591 | } |
| 1623 | | // printf("setting rompage to %d\n", cartridge->rom_page); |
| 1624 | 1592 | } |
| 1625 | 1593 | |
| 1626 | 1594 | /* |
| r8275 | r8276 | |
| 1630 | 1598 | { |
| 1631 | 1599 | cartridge_t *cart; |
| 1632 | 1600 | |
| 1633 | | // printf("assemble_pagedcru, %s\n", image->tag); |
| 1634 | 1601 | cart = assemble_common(image); |
| 1635 | 1602 | if (cart->rom_ptr==NULL) |
| 1636 | 1603 | { |
| r8275 | r8276 | |
| 1642 | 1609 | } |
| 1643 | 1610 | |
| 1644 | 1611 | /***************************************************************************** |
| 1612 | Cartridge type: gramkracker |
| 1613 | ******************************************************************************/ |
| 1614 | |
| 1615 | static DEVICE_START(ti99_pcb_gramkracker) |
| 1616 | { |
| 1617 | /* device is ti99_cartslot:cartridge:pcb */ |
| 1618 | // printf("DEVICE_START(ti99_pcb_pagedcru), tag of device=%s\n", device->tag()); |
| 1619 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 1620 | } |
| 1621 | |
| 1622 | /* |
| 1623 | The GRAM Kracker contains one GROM and several buffered RAM chips |
| 1624 | */ |
| 1625 | static int assemble_gramkracker(running_device *image) |
| 1626 | { |
| 1627 | cartridge_t *cart; |
| 1628 | int id,i; |
| 1629 | |
| 1630 | running_device *cartsys = image->owner; |
| 1631 | ti99_multicart_state *cartslots = (ti99_multicart_state *)cartsys->token; |
| 1632 | |
| 1633 | cart = assemble_common(image); |
| 1634 | |
| 1635 | if (cart->grom_ptr==NULL) |
| 1636 | { |
| 1637 | logerror("Missing loader GROM for GRAM Kracker system"); |
| 1638 | return INIT_FAIL; |
| 1639 | } |
| 1640 | |
| 1641 | if (cart->ram_size < 81920) |
| 1642 | { |
| 1643 | logerror("Missing or insufficient RAM for GRAM Kracker system"); |
| 1644 | return INIT_FAIL; |
| 1645 | } |
| 1646 | |
| 1647 | // Caution: We are using the ram_socket for both grom and direct access. |
| 1648 | // So we get the GROM (first 64 KiB) contents swapped. Need to undo. |
| 1649 | if (!ti99_is_99_8()) |
| 1650 | { |
| 1651 | /* Undo the bigendianization for the GROM area. */ |
| 1652 | UINT16 *cont16b = (UINT16 *)cart->ram_ptr; |
| 1653 | for (i = 0; i < 32768; i++) |
| 1654 | cont16b[i] = BIG_ENDIANIZE_INT16(cont16b[i]); |
| 1655 | } |
| 1656 | |
| 1657 | // Get slot number |
| 1658 | id = get_index_from_tagname(image); |
| 1659 | cartslots->gk_slot = id-1; |
| 1660 | cartslots->gk_guest_slot = -1; |
| 1661 | // The first cartridge that is still plugged in is the "guest" of the |
| 1662 | // GRAM Kracker |
| 1663 | for (i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++) |
| 1664 | { |
| 1665 | if (!slot_is_empty(cartsys, i) && (i != cartslots->gk_slot)) |
| 1666 | { |
| 1667 | cartslots->gk_guest_slot = i; |
| 1668 | break; |
| 1669 | } |
| 1670 | } |
| 1671 | return INIT_PASS; |
| 1672 | } |
| 1673 | |
| 1674 | /* |
| 1675 | Unplugs the GRAM Kracker. The "guest" is still plugged in, but will be |
| 1676 | treated as normal. |
| 1677 | */ |
| 1678 | static int disassemble_gramkracker(running_device *cartslot) |
| 1679 | { |
| 1680 | running_device *cartsys = cartslot->owner; |
| 1681 | ti99_multicart_state *cartslots = (ti99_multicart_state *)cartsys->token; |
| 1682 | int i; |
| 1683 | |
| 1684 | int slotnumber = get_index_from_tagname(cartslot)-1; |
| 1685 | assert(slotnumber>=0 && slotnumber<NUMBER_OF_CARTRIDGE_SLOTS); |
| 1686 | cartridge_t *cart = &cartslots->cartridge[slotnumber]; |
| 1687 | |
| 1688 | // We'll undo the undo of the bigendianization for saving (only for |
| 1689 | // the GROM part) |
| 1690 | if (!ti99_is_99_8()) |
| 1691 | { |
| 1692 | /* Undo the bigendianization for the GROM area. */ |
| 1693 | UINT16 *cont16b = (UINT16 *)cart->ram_ptr; |
| 1694 | for (i = 0; i < 32768; i++) |
| 1695 | cont16b[i] = BIG_ENDIANIZE_INT16(cont16b[i]); |
| 1696 | } |
| 1697 | |
| 1698 | cartslots->gk_slot = -1; |
| 1699 | cartslots->gk_guest_slot = -1; |
| 1700 | |
| 1701 | return disassemble_std(cartslot); |
| 1702 | } |
| 1703 | |
| 1704 | |
| 1705 | /***************************************************************************** |
| 1645 | 1706 | Device metadata |
| 1646 | 1707 | ******************************************************************************/ |
| 1647 | 1708 | |
| r8275 | r8276 | |
| 1968 | 2029 | } |
| 1969 | 2030 | } |
| 1970 | 2031 | |
| 2032 | static DEVICE_GET_INFO(ti99_cartridge_pcb_gramkracker) |
| 2033 | { |
| 2034 | switch(state) |
| 2035 | { |
| 2036 | case DEVINFO_FCT_START: |
| 2037 | info->start = DEVICE_START_NAME(ti99_pcb_gramkracker); |
| 2038 | break; |
| 2039 | |
| 2040 | case TI99CART_FCT_ASSM: |
| 2041 | info->f = (genf *) assemble_gramkracker; |
| 2042 | break; |
| 2043 | |
| 2044 | case TI99CART_FCT_DISASSM: |
| 2045 | info->f = (genf *) disassemble_gramkracker; |
| 2046 | break; |
| 2047 | |
| 2048 | case DEVINFO_STR_NAME: |
| 2049 | strcpy(info->s, "TI99 GRAM Kracker system"); |
| 2050 | break; |
| 2051 | |
| 2052 | default: |
| 2053 | DEVICE_GET_INFO_CALL(ti99_cart_common); |
| 2054 | break; |
| 2055 | } |
| 2056 | } |
| 2057 | |
| 2058 | |
| 1971 | 2059 | /***************************************************************************** |
| 1972 | 2060 | The cartridge handling of the multi-cartridge system. |
| 1973 | 2061 | Every cartridge contains a PCB device. The memory handlers delegate the calls |
| r8275 | r8276 | |
| 2010 | 2098 | cartslot_t *cart = (cartslot_t *)image->token; |
| 2011 | 2099 | |
| 2012 | 2100 | /* try opening this as a multicart */ |
| 2013 | | /* This line requires that cartslot_t be included in cartslot.h, |
| 2014 | | otherwise one cannot make use of multicart handling within such a |
| 2015 | | custom LOAD function. */ |
| 2101 | // This line requires that cartslot_t be included in cartslot.h, |
| 2102 | // otherwise one cannot make use of multicart handling within such a |
| 2103 | // custom LOAD function. |
| 2016 | 2104 | multicart_open_error me = multicart_open(image_filename(image), image->machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc); |
| 2017 | 2105 | |
| 2018 | | /* Now that we have loaded the image files, let the PCB put them all |
| 2019 | | together. This means we put the images in a structure which allows |
| 2020 | | for a quick access by the memory handlers. Every PCB defines an |
| 2021 | | own assembly method. */ |
| 2106 | // Now that we have loaded the image files, let the PCB put them all |
| 2107 | // together. This means we put the images in a structure which allows |
| 2108 | // for a quick access by the memory handlers. Every PCB defines an |
| 2109 | // own assembly method. |
| 2022 | 2110 | if (me == MCERR_NONE) |
| 2023 | 2111 | result = pcb->assemble(image); |
| 2024 | 2112 | else |
| 2025 | 2113 | fatalerror("Error loading multicart: %s", multicart_error_text(me)); |
| 2026 | 2114 | |
| 2027 | | /* This is for legacy support. If we have no multicart left |
| 2028 | | but there are still legacy dumps, we switch to legacy mode. */ |
| 2115 | // This is for legacy support. If we have no multicart left |
| 2116 | // but there are still legacy dumps, we switch to legacy mode. |
| 2029 | 2117 | if (result != INIT_FAIL) |
| 2030 | 2118 | cartslots->multi_slots++; |
| 2031 | 2119 | } |
| r8275 | r8276 | |
| 2048 | 2136 | |
| 2049 | 2137 | if (image->token == NULL) |
| 2050 | 2138 | { |
| 2051 | | /* This means something went wrong during the pcb |
| 2052 | | identification (e.g. one of the cartridge files was not |
| 2053 | | found). We do not need to (and cannot) unload the cartridge. */ |
| 2139 | // This means something went wrong during the pcb |
| 2140 | // identification (e.g. one of the cartridge files was not |
| 2141 | // found). We do not need to (and cannot) unload the cartridge. |
| 2054 | 2142 | return; |
| 2055 | 2143 | } |
| 2056 | 2144 | pcbdev = cartslot_get_pcb(image); |
| r8275 | r8276 | |
| 2060 | 2148 | ti99_pcb_t *pcb = (ti99_pcb_t *)pcbdev->token; |
| 2061 | 2149 | cartslot_t *cart = (cartslot_t *)image->token; |
| 2062 | 2150 | |
| 2063 | | // printf("unload\n"); |
| 2064 | 2151 | if (cart->mc != NULL) |
| 2065 | 2152 | { |
| 2066 | 2153 | /* Remove pointers and de-big-endianize RAM contents. */ |
| 2067 | 2154 | pcb->disassemble(image); |
| 2068 | 2155 | |
| 2069 | | /* Close the multicart; all RAM resources will be |
| 2070 | | written to disk */ |
| 2156 | // Close the multicart; all RAM resources will be |
| 2157 | // written to disk |
| 2071 | 2158 | multicart_close(cart->mc); |
| 2072 | 2159 | cart->mc = NULL; |
| 2073 | 2160 | |
| r8275 | r8276 | |
| 2122 | 2209 | |
| 2123 | 2210 | if (cartridge->grom_size>0) |
| 2124 | 2211 | { |
| 2125 | | /* This is the reason why we need the image size: Read |
| 2126 | | access beyond the image size must be detected. */ |
| 2212 | // This is the reason why we need the image size: Read |
| 2213 | // access beyond the image size must be detected. |
| 2127 | 2214 | if ((cartslots->grom_address < 0x6000) || (cartslots->grom_address > (cartridge->grom_size+0x6000))) |
| 2128 | 2215 | return 0; |
| 2129 | 2216 | |
| r8275 | r8276 | |
| 2131 | 2218 | /* read ahead */ |
| 2132 | 2219 | cartslots->grom_buffer = cartridge->grom_ptr[cartslots->grom_address-0x6000]; |
| 2133 | 2220 | // printf("GROM address = %04x, reply = %02x\n", console_GROMs.addr, reply>>8); |
| 2134 | | /* The program counter wraps at each GROM chip size (8K), |
| 2135 | | so 0x5fff + 1 = 0x4000. */ |
| 2221 | // The program counter wraps at each GROM chip size (8K), |
| 2222 | // so 0x5fff + 1 = 0x4000. |
| 2136 | 2223 | cartslots->grom_address = ((cartslots->grom_address + 1) & 0x1FFF) | (cartslots->grom_address & 0xE000); |
| 2137 | 2224 | |
| 2138 | 2225 | /* Reset the read and write address flipflops. */ |
| r8275 | r8276 | |
| 2152 | 2239 | int slotmbx, slotmini, slotebr2, slotrom; |
| 2153 | 2240 | ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token; |
| 2154 | 2241 | |
| 2155 | | #if 0 |
| 2156 | | if (hsgpl_crdena) |
| 2157 | | return ti99_hsgpl_rom6_r(space, offset, mem_mask); |
| 2158 | | #endif |
| 2159 | | |
| 2160 | 2242 | slotmbx = cartslots->legacy_slotnumber[SLOTC_MBX]; |
| 2161 | 2243 | |
| 2162 | 2244 | if ((slotmbx != -1) && (offset >= 0x0600) && (offset <= 0x07fe)) |
| r8275 | r8276 | |
| 2188 | 2270 | else |
| 2189 | 2271 | return (((UINT16 *)cartslots->cartridge[slotrom].rom_ptr)[offset]); |
| 2190 | 2272 | } |
| 2191 | | /* SuperSpace, paged379i, and pagedcru are not supported in |
| 2192 | | legacy mode. */ |
| 2273 | |
| 2274 | /* SuperSpace, paged379i, and pagedcru are not supported in legacy mode. */ |
| 2193 | 2275 | } |
| 2194 | 2276 | |
| 2195 | 2277 | static WRITE16_DEVICE_HANDLER( ti99_cart_w_legacy ) |
| r8275 | r8276 | |
| 2197 | 2279 | int slotmbx, slotmini, slotebr2, slotrom; |
| 2198 | 2280 | ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token; |
| 2199 | 2281 | |
| 2200 | | #if 0 |
| 2201 | | if (hsgpl_crdena) |
| 2202 | | { |
| 2203 | | ti99_hsgpl_rom6_w(space, offset, data, mem_mask); |
| 2204 | | return; |
| 2205 | | } |
| 2206 | | #endif |
| 2207 | 2282 | slotmbx = cartslots->legacy_slotnumber[SLOTC_MBX]; |
| 2208 | 2283 | slotrom = cartslots->legacy_slotnumber[SLOTC_CROM]; |
| 2209 | 2284 | slotebr2 = cartslots->legacy_slotnumber[SLOTC_DROM]; |
| r8275 | r8276 | |
| 2251 | 2326 | int slotmbx, slotmini, slotebr2, slotrom; |
| 2252 | 2327 | ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token; |
| 2253 | 2328 | |
| 2254 | | #if 0 |
| 2255 | | if (hsgpl_crdena) |
| 2256 | | return ti99_hsgpl_rom6_r(space, offset, mem_mask); |
| 2257 | | #endif |
| 2258 | | |
| 2259 | 2329 | slotmbx = cartslots->legacy_slotnumber[SLOTC_MBX]; |
| 2260 | 2330 | |
| 2261 | 2331 | if ((slotmbx != -1) && (offset >= 0x0c00) && (offset <= 0x0ffd)) |
| r8275 | r8276 | |
| 2287 | 2357 | else |
| 2288 | 2358 | return (((UINT8 *)cartslots->cartridge[slotrom].rom_ptr)[offset]); |
| 2289 | 2359 | } |
| 2290 | | /* Super Space, paged379i, and pagedcru are not supported in |
| 2291 | | legacy mode. */ |
| 2360 | /* Super Space, paged379i, and pagedcru are not supported in legacy mode. */ |
| 2292 | 2361 | } |
| 2293 | 2362 | |
| 2294 | 2363 | /* |
| r8275 | r8276 | |
| 2299 | 2368 | int slotmbx, slotmini, slotebr2, slotrom; |
| 2300 | 2369 | ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token; |
| 2301 | 2370 | |
| 2302 | | #if 0 |
| 2303 | | if (hsgpl_crdena) |
| 2304 | | { |
| 2305 | | ti99_hsgpl_rom6_w(space, offset, data, mem_mask); |
| 2306 | | return; |
| 2307 | | } |
| 2308 | | #endif |
| 2309 | 2371 | slotmbx = cartslots->legacy_slotnumber[SLOTC_MBX]; |
| 2310 | 2372 | slotrom = cartslots->legacy_slotnumber[SLOTC_CROM]; |
| 2311 | 2373 | slotebr2 = cartslots->legacy_slotnumber[SLOTC_DROM]; |
| r8275 | r8276 | |
| 2354 | 2416 | /* Some comments originally in machine/ti99_4x.c */ |
| 2355 | 2417 | |
| 2356 | 2418 | /* We identify file types according to their extension */ |
| 2357 | | /* Note that if we do not recognize the extension, we revert to the |
| 2358 | | slot location <-> type scheme. */ |
| 2419 | // Note that if we do not recognize the extension, we revert to the |
| 2420 | // slot location <-> type scheme. |
| 2359 | 2421 | int id = 0; |
| 2360 | 2422 | int i; |
| 2361 | 2423 | int filesize; |
| r8275 | r8276 | |
| 2377 | 2439 | |
| 2378 | 2440 | type = SLOTC_EMPTY; |
| 2379 | 2441 | |
| 2380 | | /* There is a circuitry in TI99/4(a) that resets the console when a |
| 2381 | | cartridge is inserted or removed. We emulate this instead of resetting |
| 2382 | | the emulator (which is the default in MESS). */ |
| 2383 | | #if 0 |
| 2384 | | cpu_set_input_line(machine->firstcpu, INPUT_LINE_RESET, PULSE_LINE); |
| 2385 | | tms9901_reset(0); |
| 2386 | | if (! has_evpc) |
| 2387 | | TMS9928A_reset(); |
| 2388 | | if (has_evpc) |
| 2389 | | v9938_reset(0); |
| 2390 | | #endif |
| 2391 | | |
| 2392 | 2442 | ch = strrchr(name, '.'); |
| 2393 | 2443 | ch2 = (ch-1 >= name) ? ch-1 : ""; |
| 2394 | 2444 | |
| r8275 | r8276 | |
| 2433 | 2483 | |
| 2434 | 2484 | savembx = FALSE; |
| 2435 | 2485 | |
| 2436 | | /* We will use the already allocated buffers in the memory regions, |
| 2437 | | and the pointers in the cartridge structure will point to them. */ |
| 2486 | // We will use the already allocated buffers in the memory regions, |
| 2487 | // and the pointers in the cartridge structure will point to them. |
| 2438 | 2488 | switch (type) |
| 2439 | 2489 | { |
| 2440 | 2490 | case SLOTC_EMPTY: |
| r8275 | r8276 | |
| 2451 | 2501 | maxrom = 0x2000; |
| 2452 | 2502 | if (cartslots->legacy_slotnumber[SLOTC_MINIMEM] != -1) |
| 2453 | 2503 | { |
| 2454 | | /* This means the NVRAM has already been loaded. |
| 2455 | | So we just load 4K of ROM to avoid overwriting |
| 2456 | | the NVRAM. */ |
| 2504 | // This means the NVRAM has already been loaded. |
| 2505 | // So we just load 4K of ROM to avoid |
| 2506 | // overwriting the NVRAM. |
| 2457 | 2507 | maxrom = 0x1000; |
| 2458 | 2508 | } |
| 2459 | 2509 | |
| 2460 | 2510 | if (cartslots->legacy_slotnumber[SLOTC_MBX] != -1) |
| 2461 | 2511 | { |
| 2462 | | /* This means the NVRAM has already been loaded. |
| 2463 | | We need to temporarily save the RAM contents and |
| 2464 | | write them back because the RAM overrides the |
| 2465 | | ROM in an intermediate area. */ |
| 2512 | // This means the NVRAM has already been loaded. |
| 2513 | // We need to temporarily save the RAM contents |
| 2514 | // and write them back because the RAM overrides |
| 2515 | // the ROM in an intermediate area. |
| 2466 | 2516 | savembx = TRUE; |
| 2467 | 2517 | } |
| 2468 | 2518 | |
| r8275 | r8276 | |
| 2504 | 2554 | break; |
| 2505 | 2555 | |
| 2506 | 2556 | case SLOTC_MINIMEM: |
| 2507 | | /* Load the NVRAM. Need to BIG_ENDIANIZE it. |
| 2508 | | MiniMemory has only one cartridge page. */ |
| 2557 | // Load the NVRAM. Need to BIG_ENDIANIZE it. |
| 2558 | // MiniMemory has only one cartridge page. |
| 2509 | 2559 | if (ti99_is_99_8()) |
| 2510 | 2560 | { |
| 2511 | 2561 | // printf("** is 99/8\n"); |
| r8275 | r8276 | |
| 2603 | 2653 | } |
| 2604 | 2654 | else |
| 2605 | 2655 | { |
| 2606 | | /* We BIG_ENDIANIZE before saving. This is |
| 2607 | | consistent with the cartridge save format. */ |
| 2656 | // We BIG_ENDIANIZE before saving. This is |
| 2657 | // consistent with the cartridge save format. |
| 2608 | 2658 | UINT16 *ramcont = (UINT16 *)cartslots->cartridge[slot].ram_ptr; |
| 2609 | 2659 | for (i = 0; i < 0x0800; i++) |
| 2610 | 2660 | ramcont[i] = BIG_ENDIANIZE_INT16(ramcont[i]); |
| r8275 | r8276 | |
| 2621 | 2671 | } |
| 2622 | 2672 | else |
| 2623 | 2673 | { |
| 2624 | | /* We BIG_ENDIANIZE before saving. This is |
| 2625 | | consistent with the cartridge save format. */ |
| 2674 | // We BIG_ENDIANIZE before saving. This is |
| 2675 | // consistent with the cartridge save format. |
| 2626 | 2676 | UINT16 *ramcont = (UINT16 *)cartslots->cartridge[slot].ram_ptr; |
| 2627 | 2677 | for (i = 0; i < 0x0200; i++) |
| 2628 | 2678 | ramcont[i] = BIG_ENDIANIZE_INT16(ramcont[i]); |
| r8275 | r8276 | |
| 2659 | 2709 | Actually, the name of the device should be changed (however, the device name |
| 2660 | 2710 | length is limited) |
| 2661 | 2711 | ******************************************************************************/ |
| 2712 | |
| 2713 | /* GRAM Kracker support */ |
| 2714 | static WRITE16_DEVICE_HANDLER( ti99_cart_w_gk ); |
| 2715 | static READ16_DEVICE_HANDLER( ti99_cart_r_gk ); |
| 2716 | static WRITE16_DEVICE_HANDLER( ti99_cart_w_gk ); |
| 2717 | static READ8_DEVICE_HANDLER( ti99_cart_crur_gk ); |
| 2718 | static WRITE8_DEVICE_HANDLER( ti99_cart_cruw_gk ); |
| 2719 | static READ8_DEVICE_HANDLER( ti99_cart_r_gk8 ); |
| 2720 | static WRITE8_DEVICE_HANDLER( ti99_cart_w_gk8 ); |
| 2721 | |
| 2662 | 2722 | /* |
| 2663 | 2723 | Instantiation of a multicart system for the TI family. |
| 2664 | 2724 | */ |
| r8275 | r8276 | |
| 2687 | 2747 | cartslots->legacy_slots = 0; |
| 2688 | 2748 | cartslots->multi_slots = 0; |
| 2689 | 2749 | |
| 2690 | | /* The cartslot system is initialized now. The cartridges themselves |
| 2691 | | need to check whether their parts are available. */ |
| 2750 | cartslots->gk_slot = -1; |
| 2751 | cartslots->gk_guest_slot = -1; |
| 2752 | |
| 2753 | // The cartslot system is initialized now. The cartridges themselves |
| 2754 | // need to check whether their parts are available. |
| 2692 | 2755 | } |
| 2693 | 2756 | |
| 2694 | 2757 | static DEVICE_STOP(ti99_multicart) |
| r8275 | r8276 | |
| 2698 | 2761 | |
| 2699 | 2762 | static DEVICE_RESET(ti99_multicart) |
| 2700 | 2763 | { |
| 2701 | | /* Consider to propagate RESET to cartridges. |
| 2702 | | However, schematics do not reveal any pin for resetting a cartridge; |
| 2703 | | the reset line is an input used when plugging in a cartridge. */ |
| 2764 | // Consider to propagate RESET to cartridges. |
| 2765 | // However, schematics do not reveal any pin for resetting a cartridge; |
| 2766 | // the reset line is an input used when plugging in a cartridge. |
| 2704 | 2767 | |
| 2705 | | /* Allows to manually lock the cartslot system to a specific slot. |
| 2706 | | We take slot numbers from 0 (automatic mode) to the maximum. */ |
| 2707 | | |
| 2708 | 2768 | ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token; |
| 2709 | 2769 | int slotnumber = input_port_read(device->machine, "CARTSLOT"); |
| 2710 | 2770 | assert(slotnumber>=0 && slotnumber<=255); |
| 2711 | 2771 | cartslots->fixed_slot = slotnumber-1; /* auto = -1 */ |
| 2712 | 2772 | cartslots->grom_address = 0x0000; |
| 2713 | 2773 | cartslots->grom_buffer = 0x00; |
| 2774 | cartslots->loader_on = FALSE; |
| 2714 | 2775 | cartslots->raddr_LSB = cartslots->waddr_LSB = FALSE; |
| 2715 | 2776 | } |
| 2716 | 2777 | |
| 2717 | 2778 | /* |
| 2718 | 2779 | Accesses the ROM regions of the cartridge for reading. |
| 2719 | | This is the area from 0x6000 to 0x7fff. Each cartridge is reponsible |
| 2780 | This is the area from 0x6000 to 0x7fff. Each cartridge is responsible |
| 2720 | 2781 | for all kinds of magic which is done inside this area, like swapping |
| 2721 | 2782 | banks or doing other control actions. These activities beyond simple |
| 2722 | 2783 | reading are cartridge-specific. Each kind of cartridge requires a |
| r8275 | r8276 | |
| 2730 | 2791 | int slot = cartslots->active_slot; |
| 2731 | 2792 | cartridge_t *cart; |
| 2732 | 2793 | |
| 2794 | /* Idle the CPU */ |
| 2795 | cpu_adjust_icount(devtag_get_device(device->machine, "maincpu"),-4); |
| 2796 | // Alternatively: |
| 2797 | // cpu_spinuntil_time(device->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 2798 | |
| 2799 | // Handle GRAM Kracker |
| 2800 | // We could also consider to use a flag, but input_port_read uses |
| 2801 | // a hashtable, so this should not be too slow |
| 2802 | if ((cartslots->gk_slot != -1) && (input_port_read(device->machine, "CARTSLOT")==CART_GK)) |
| 2803 | return ti99_cart_r_gk(device, offset, mem_mask); |
| 2804 | |
| 2733 | 2805 | /* Sanity check. Higher slots are always empty. */ |
| 2734 | 2806 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) |
| 2735 | 2807 | return 0; |
| 2736 | 2808 | |
| 2737 | | /* Same as above (GROM read): If there is only one cartridge there |
| 2738 | | is no use of trying other banks. There is one issue with the |
| 2739 | | selection mechanism: When the console probes the GROM banks and |
| 2740 | | we have a ROM-only cartridge plugged in, it checks bank 0 and bank 1, |
| 2741 | | finds no GROM, and then fails to dummy-check bank 0 again which would |
| 2742 | | have set our cartridge expander to slot 0. But in slot 1 there is no |
| 2743 | | ROM cartridge, so nothing shows up in the selection list. We work |
| 2744 | | around this with the following line. */ |
| 2809 | // Same as above (GROM read): If there is only one cartridge there |
| 2810 | // is no use of trying other banks. There is one issue with the |
| 2811 | // selection mechanism: When the console probes the GROM banks and |
| 2812 | // we have a ROM-only cartridge plugged in, it checks bank 0 and bank 1, |
| 2813 | // finds no GROM, and then fails to dummy-check bank 0 again which would |
| 2814 | // have set our cartridge expander to slot 0. But in slot 1 there is no |
| 2815 | // ROM cartridge, so nothing shows up in the selection list. We work |
| 2816 | // around this with the following line. |
| 2745 | 2817 | if (cartslots->fixed_slot==AUTO && cartslots->next_free_slot==1) |
| 2746 | 2818 | slot=0; |
| 2747 | 2819 | |
| 2748 | 2820 | cart = &cartslots->cartridge[slot]; |
| 2749 | 2821 | |
| 2750 | | /* Idle the CPU */ |
| 2751 | | cpu_adjust_icount(devtag_get_device(device->machine, "maincpu"),-4); |
| 2752 | | |
| 2753 | | // Alternatively: |
| 2754 | | // cpu_spinuntil_time(device->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 2755 | | |
| 2756 | | // printf("rpk = %d, bin = %d\n", cartslots->multi_slots,cartslots->legacy_slots); |
| 2757 | | |
| 2758 | 2822 | /* Handle legacy mode. */ |
| 2759 | 2823 | if (in_legacy_mode(device)) |
| 2760 | 2824 | { |
| r8275 | r8276 | |
| 2777 | 2841 | |
| 2778 | 2842 | /* |
| 2779 | 2843 | Accesses the ROM regions of the cartridge for writing. |
| 2780 | | This is the area from 0x6000 to 0x7fff. Each cartridge is reponsible |
| 2844 | This is the area from 0x6000 to 0x7fff. Each cartridge is responsible |
| 2781 | 2845 | for all kinds of magic which is done inside this area. Specifically, |
| 2782 | 2846 | writing is often used to swap banks for subsequent reads. The actual |
| 2783 | 2847 | effect of writing (beyond setting values in a RAM chip) are |
| r8275 | r8276 | |
| 2791 | 2855 | int slot = cartslots->active_slot; |
| 2792 | 2856 | cartridge_t *cart; |
| 2793 | 2857 | |
| 2858 | /* Idle the CPU */ |
| 2859 | cpu_adjust_icount(devtag_get_device(device->machine, "maincpu"),-4); |
| 2860 | // cpu_spinuntil_time(device->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 2861 | |
| 2862 | // Handle GRAM Kracker |
| 2863 | if ((cartslots->gk_slot != -1) && (input_port_read(device->machine, "CARTSLOT")==CART_GK)) |
| 2864 | ti99_cart_w_gk(device, offset, data, mem_mask); |
| 2865 | |
| 2794 | 2866 | /* Sanity check. Higher slots are always empty. */ |
| 2795 | 2867 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) |
| 2796 | 2868 | return; |
| r8275 | r8276 | |
| 2801 | 2873 | |
| 2802 | 2874 | cart = &cartslots->cartridge[slot]; |
| 2803 | 2875 | |
| 2804 | | /* Idle the CPU */ |
| 2805 | | cpu_adjust_icount(devtag_get_device(device->machine, "maincpu"),-4); |
| 2806 | | // cpu_spinuntil_time(device->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 2807 | | |
| 2808 | 2876 | /* Handle legacy mode. */ |
| 2809 | 2877 | if (in_legacy_mode(device)) |
| 2810 | 2878 | { |
| r8275 | r8276 | |
| 2824 | 2892 | /* |
| 2825 | 2893 | CRU interface to cartridges, used only by SuperSpace and Pagedcru |
| 2826 | 2894 | style cartridges. |
| 2827 | | The SuperSpace has a CRU-based memory mapper. It is accessed via the |
| 2828 | | cartridge slot on CRU base >0800. |
| 2895 | The SuperSpace has a CRU-based memory mapper. It is accessed via the |
| 2896 | cartridge slot on CRU base >0800. |
| 2829 | 2897 | */ |
| 2830 | 2898 | READ8_DEVICE_HANDLER( ti99_multicart_cru_r ) |
| 2831 | 2899 | { |
| r8275 | r8276 | |
| 2838 | 2906 | if (in_legacy_mode(device)) |
| 2839 | 2907 | return 0; |
| 2840 | 2908 | |
| 2909 | // Handle GRAM Kracker |
| 2910 | if ((cartslots->gk_slot != -1) && (input_port_read(device->machine, "CARTSLOT")==CART_GK)) |
| 2911 | return ti99_cart_crur_gk(device, offset); |
| 2912 | |
| 2841 | 2913 | /* Sanity check. Higher slots are always empty. */ |
| 2842 | 2914 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) |
| 2843 | 2915 | return 0; |
| r8275 | r8276 | |
| 2858 | 2930 | } |
| 2859 | 2931 | |
| 2860 | 2932 | /* |
| 2861 | | Write cartridge mapper CRU interface (SuperSpace, Pagedcru) |
| 2933 | Write cartridge mapper CRU interface (SuperSpace, Pagedcru) |
| 2862 | 2934 | */ |
| 2863 | 2935 | WRITE8_DEVICE_HANDLER( ti99_multicart_cru_w ) |
| 2864 | 2936 | { |
| r8275 | r8276 | |
| 2871 | 2943 | if (in_legacy_mode(device)) |
| 2872 | 2944 | return; |
| 2873 | 2945 | |
| 2946 | // Handle GRAM Kracker |
| 2947 | if ((cartslots->gk_slot != -1) && (input_port_read(device->machine, "CARTSLOT")==CART_GK)) |
| 2948 | ti99_cart_cruw_gk(device, offset, data); |
| 2949 | |
| 2874 | 2950 | /* Sanity check. Higher slots are always empty. */ |
| 2875 | 2951 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) |
| 2876 | 2952 | return; |
| r8275 | r8276 | |
| 2896 | 2972 | READ8_DEVICE_HANDLER(ti99_multicart8_r) |
| 2897 | 2973 | { |
| 2898 | 2974 | ti99_multicart_state *cartslots = (ti99_multicart_state *) device->token; |
| 2975 | int slot = cartslots->active_slot; |
| 2899 | 2976 | cartridge_t *cart; |
| 2900 | 2977 | |
| 2901 | | int slot = cartslots->active_slot; |
| 2978 | /* Idle the CPU. TODO: Check whether this is correct for this machine. */ |
| 2979 | cpu_adjust_icount(devtag_get_device(device->machine, "maincpu"),-4); |
| 2902 | 2980 | |
| 2981 | // Handle GRAM Kracker |
| 2982 | if ((cartslots->gk_slot != -1) && (input_port_read(device->machine, "CARTSLOT")==CART_GK)) |
| 2983 | return ti99_cart_r_gk8(device, offset); |
| 2984 | |
| 2903 | 2985 | /* Sanity check. Higher slots are always empty. */ |
| 2904 | 2986 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) |
| 2905 | 2987 | return 0; |
| r8275 | r8276 | |
| 2910 | 2992 | |
| 2911 | 2993 | cart = &cartslots->cartridge[slot]; |
| 2912 | 2994 | |
| 2913 | | /* Idle the CPU. TODO: Check whether this is correct for this machine. */ |
| 2914 | | cpu_adjust_icount(devtag_get_device(device->machine, "maincpu"),-4); |
| 2915 | | |
| 2916 | 2995 | /* Handle legacy mode. */ |
| 2917 | 2996 | if (in_legacy_mode(device)) |
| 2918 | 2997 | { |
| r8275 | r8276 | |
| 2936 | 3015 | { |
| 2937 | 3016 | ti99_multicart_state *cartslots = (ti99_multicart_state *) device->token; |
| 2938 | 3017 | cartridge_t *cart; |
| 2939 | | |
| 2940 | 3018 | int slot = cartslots->active_slot; |
| 2941 | 3019 | |
| 3020 | /* Idle the CPU. TODO: Check whether this is correct for this machine. */ |
| 3021 | cpu_adjust_icount(devtag_get_device(device->machine, "maincpu"),-4); |
| 3022 | |
| 3023 | // Handle GRAM Kracker |
| 3024 | if ((cartslots->gk_slot != -1) && (input_port_read(device->machine, "CARTSLOT")==CART_GK)) |
| 3025 | ti99_cart_w_gk8(device, offset, data); |
| 3026 | |
| 2942 | 3027 | /* Sanity check. Higher slots are always empty. */ |
| 2943 | 3028 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) |
| 2944 | 3029 | return; |
| r8275 | r8276 | |
| 2949 | 3034 | |
| 2950 | 3035 | cart = &cartslots->cartridge[slot]; |
| 2951 | 3036 | |
| 2952 | | /* Idle the CPU. TODO: Check whether this is correct for this machine. */ |
| 2953 | | cpu_adjust_icount(devtag_get_device(device->machine, "maincpu"),-4); |
| 2954 | | |
| 2955 | 3037 | /* Handle legacy mode. */ |
| 2956 | 3038 | if (in_legacy_mode(device)) |
| 2957 | 3039 | { |
| r8275 | r8276 | |
| 2966 | 3048 | } |
| 2967 | 3049 | } |
| 2968 | 3050 | } |
| 3051 | |
| 3052 | /***************************************************************************** |
| 3053 | GramKracker support |
| 3054 | The 80 KiB of the GK are allocated as follows |
| 3055 | 00000 - 01fff: GRAM 0 |
| 3056 | 02000 - 03fff: GRAM 1 (alternatively, the loader GROM appears here) |
| 3057 | 04000 - 05fff: GRAM 2 |
| 3058 | 06000 - 0ffff: GRAM 3-7 (alternatively, the guest GROMs appear here) |
| 3059 | 10000 - 11fff: RAM 1 |
| 3060 | 12000 - 13fff: RAM 2 |
| 3061 | ******************************************************************************/ |
| 3062 | /* |
| 3063 | Reads from the GRAM space of the GRAM Kracker. |
| 3064 | */ |
| 3065 | static int cartridge_gram_kracker_readg(running_device *cartsys) |
| 3066 | { |
| 3067 | // gk_slot is the slot where the GK module is plugged in |
| 3068 | // gk_guest_slot is the slot where the cartridge is plugged in |
| 3069 | UINT8 value; |
| 3070 | cartridge_t *gkcartridge, *gkguestcart; |
| 3071 | ti99_multicart_state *cartslots = (ti99_multicart_state *)cartsys->token; |
| 3072 | |
| 3073 | // This is only called when there is really a GK module |
| 3074 | gkcartridge = &cartslots->cartridge[cartslots->gk_slot]; |
| 3075 | |
| 3076 | // Buffered value |
| 3077 | value = (UINT8)cartslots->grom_buffer; |
| 3078 | |
| 3079 | if (cartslots->grom_address >= 0x6000) |
| 3080 | { |
| 3081 | // When a cartridge is installed, it overrides the GK contents |
| 3082 | // but only if it has GROMs |
| 3083 | // So we first get the values and then have them replaced if applicable |
| 3084 | if (get_gk_switch(1)==GK_NORMAL) |
| 3085 | { |
| 3086 | // Read ahead |
| 3087 | cartslots->grom_buffer = ((UINT8 *)gkcartridge->ram_ptr)[cartslots->grom_address]; |
| 3088 | } |
| 3089 | else |
| 3090 | { |
| 3091 | // GK is turned off |
| 3092 | cartslots->grom_buffer = 0; |
| 3093 | } |
| 3094 | if (cartslots->gk_guest_slot != -1) |
| 3095 | { |
| 3096 | gkguestcart = &cartslots->cartridge[cartslots->gk_guest_slot]; |
| 3097 | // So if the cartridge has GROM, have it overwrite the value |
| 3098 | // if it is in its range |
| 3099 | if ((gkguestcart->grom_ptr != NULL) |
| 3100 | && (cartslots->grom_address < (0x6000 + gkguestcart->grom_size))) |
| 3101 | cartslots->grom_buffer = gkguestcart->grom_ptr[cartslots->grom_address-0x6000]; |
| 3102 | } |
| 3103 | } |
| 3104 | else |
| 3105 | { |
| 3106 | if ((cartslots->grom_address >= 0x2000) && (cartslots->grom_address < 0x4000)) |
| 3107 | { |
| 3108 | // Loader area |
| 3109 | if (get_gk_switch(5)==GK_LDOFF) |
| 3110 | { |
| 3111 | // Loader off |
| 3112 | cartslots->loader_on = FALSE; |
| 3113 | cartslots->grom_buffer = ((UINT8 *)gkcartridge->ram_ptr)[cartslots->grom_address]; |
| 3114 | } |
| 3115 | else |
| 3116 | { |
| 3117 | // Loader on |
| 3118 | if (!cartslots->loader_on) |
| 3119 | { |
| 3120 | // Hack for GRAM Kracker: The device tells the user to |
| 3121 | // turn on the loader, but it sets the GROM address before! |
| 3122 | // So we have read the value from the earlier setting. |
| 3123 | value = gkcartridge->grom_ptr[cartslots->grom_address-0x2001]; |
| 3124 | cartslots->loader_on = TRUE; |
| 3125 | } |
| 3126 | cartslots->grom_buffer = gkcartridge->grom_ptr[cartslots->grom_address-0x2000]; |
| 3127 | } |
| 3128 | } |
| 3129 | else |
| 3130 | { |
| 3131 | // GRAM 0 or GRAM 2. Note that we deliver a value, but the console may |
| 3132 | // ignore it according to the switch setting. |
| 3133 | cartslots->grom_buffer = ((UINT8 *)gkcartridge->ram_ptr)[cartslots->grom_address]; |
| 3134 | } |
| 3135 | } |
| 3136 | |
| 3137 | // The program counter wraps at each GROM chip size (8K), |
| 3138 | // so 0x5fff + 1 = 0x4000. |
| 3139 | // The address must be increased even if there is no cartridge slot |
| 3140 | cartslots->grom_address = ((cartslots->grom_address + 1) & 0x1FFF) | (cartslots->grom_address & 0xE000); |
| 3141 | |
| 3142 | /* Reset the read and write address flipflops. */ |
| 3143 | cartslots->raddr_LSB = cartslots->waddr_LSB = FALSE; |
| 3144 | |
| 3145 | return value; |
| 3146 | } |
| 3147 | |
| 3148 | /* |
| 3149 | Writes to the GRAM space of the GRAM Kracker. |
| 3150 | */ |
| 3151 | static void cartridge_gram_kracker_writeg(running_device *cartsys, UINT8 data) |
| 3152 | { |
| 3153 | // gk_slot is the slot where the GK module is plugged in |
| 3154 | // gk_guest_slot is the slot where the cartridge is plugged in |
| 3155 | cartridge_t *gkcartridge; |
| 3156 | ti99_multicart_state *cartslots = (ti99_multicart_state *)cartsys->token; |
| 3157 | |
| 3158 | // This is only called when there is really a GK module |
| 3159 | gkcartridge = &cartslots->cartridge[cartslots->gk_slot]; |
| 3160 | |
| 3161 | // We need to rewind by 1 because the read address has already advanced. |
| 3162 | UINT16 write_addr = ((cartslots->grom_address + 0x1fff) & 0x1FFF) | (cartslots->grom_address & 0xE000); |
| 3163 | |
| 3164 | if (get_gk_switch(4)!=GK_WP) |
| 3165 | { |
| 3166 | // Write protection off |
| 3167 | if (((cartslots->grom_address < 0x2000) |
| 3168 | && (get_gk_switch(2)==GK_GRAM0)) |
| 3169 | || ((cartslots->grom_address >= 0x2000) && (cartslots->grom_address < 0x4000) |
| 3170 | && (get_gk_switch(3)==GK_GRAM12) |
| 3171 | && (get_gk_switch(5)==GK_LDOFF)) |
| 3172 | || ((cartslots->grom_address >= 0x4000) && (cartslots->grom_address < 0x6000) |
| 3173 | && (get_gk_switch(3)==GK_GRAM12)) |
| 3174 | || ((cartslots->grom_address >= 0x6000) && (cartslots->gk_guest_slot==-1) |
| 3175 | && (get_gk_switch(1)==GK_NORMAL))) |
| 3176 | { |
| 3177 | ((UINT8 *)gkcartridge->ram_ptr)[write_addr] = data; |
| 3178 | } |
| 3179 | // There is no GRAM in cartridges |
| 3180 | |
| 3181 | } |
| 3182 | cartslots->grom_address = ((cartslots->grom_address + 1) & 0x1FFF) | (cartslots->grom_address & 0xE000); |
| 3183 | |
| 3184 | /* Reset the read and write address flipflops. */ |
| 3185 | cartslots->raddr_LSB = cartslots->waddr_LSB = FALSE; |
| 3186 | } |
| 3187 | |
| 3188 | /* |
| 3189 | Reads from the RAM space of the GRAM Kracker. |
| 3190 | */ |
| 3191 | static READ16_DEVICE_HANDLER( ti99_cart_r_gk ) |
| 3192 | { |
| 3193 | // gk_slot is the slot where the GK module is plugged in |
| 3194 | // gk_guest_slot is the slot where the cartridge is plugged in |
| 3195 | cartridge_t *gkcartridge, *gkguestcart; |
| 3196 | ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token; |
| 3197 | |
| 3198 | gkcartridge = &cartslots->cartridge[cartslots->gk_slot]; |
| 3199 | |
| 3200 | if (cartslots->gk_guest_slot != -1) |
| 3201 | { |
| 3202 | gkguestcart = &cartslots->cartridge[cartslots->gk_guest_slot]; |
| 3203 | // Legacy mode is not supported with the GK |
| 3204 | if (in_legacy_mode(device)) |
| 3205 | { |
| 3206 | return 0; |
| 3207 | } |
| 3208 | // printf("accessing cartridge in slot %d\n", slot); |
| 3209 | ti99_pcb_t *pcbdef = (ti99_pcb_t *)gkguestcart->pcb->token; |
| 3210 | // printf("address=%lx, offset=%lx\n", pcbdef, offset); |
| 3211 | return (*pcbdef->read)(gkguestcart->pcb, offset, mem_mask); |
| 3212 | } |
| 3213 | else |
| 3214 | { |
| 3215 | if (get_gk_switch(1)==GK_OFF) |
| 3216 | return 0; |
| 3217 | |
| 3218 | if (get_gk_switch(4)==GK_BANK1) |
| 3219 | return ((UINT16 *)gkcartridge->ram_ptr)[offset+0x8000]; |
| 3220 | else |
| 3221 | { |
| 3222 | if (get_gk_switch(4)==GK_BANK2) |
| 3223 | return ((UINT16 *)gkcartridge->ram_ptr)[offset+0x9000]; |
| 3224 | else |
| 3225 | { |
| 3226 | // Write protection on |
| 3227 | if (gkcartridge->ram_page==0) |
| 3228 | { |
| 3229 | return ((UINT16 *)gkcartridge->ram_ptr)[offset+0x8000]; |
| 3230 | } |
| 3231 | else |
| 3232 | { |
| 3233 | return ((UINT16 *)gkcartridge->ram_ptr)[offset+0x9000]; |
| 3234 | } |
| 3235 | } |
| 3236 | } |
| 3237 | } |
| 3238 | } |
| 3239 | |
| 3240 | /* |
| 3241 | Writes to the RAM space of the GRAM Kracker. |
| 3242 | */ |
| 3243 | static WRITE16_DEVICE_HANDLER( ti99_cart_w_gk ) |
| 3244 | { |
| 3245 | // gk_slot is the slot where the GK module is plugged in |
| 3246 | // gk_guest_slot is the slot where the cartridge is plugged in |
| 3247 | cartridge_t *gkcartridge, *gkguestcart; |
| 3248 | ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token; |
| 3249 | |
| 3250 | gkcartridge = &cartslots->cartridge[cartslots->gk_slot]; |
| 3251 | |
| 3252 | if (cartslots->gk_guest_slot != -1) |
| 3253 | { |
| 3254 | gkguestcart = &cartslots->cartridge[cartslots->gk_guest_slot]; |
| 3255 | // Legacy mode is not supported with the GK |
| 3256 | if (in_legacy_mode(device)) |
| 3257 | { |
| 3258 | return; |
| 3259 | } |
| 3260 | |
| 3261 | ti99_pcb_t *pcbdef = (ti99_pcb_t *)gkguestcart->pcb->token; |
| 3262 | (*pcbdef->write)(gkguestcart->pcb, offset, data, mem_mask); |
| 3263 | } |
| 3264 | else |
| 3265 | { |
| 3266 | if (get_gk_switch(1)==GK_OFF) |
| 3267 | return; |
| 3268 | |
| 3269 | if (get_gk_switch(4)==GK_BANK1) |
| 3270 | { |
| 3271 | UINT16 *pos = ((UINT16 *)gkcartridge->ram_ptr) + offset + 0x8000; |
| 3272 | COMBINE_DATA(pos); |
| 3273 | } |
| 3274 | else |
| 3275 | { |
| 3276 | if (get_gk_switch(4)==GK_BANK2) |
| 3277 | { |
| 3278 | UINT16 *pos = ((UINT16 *)gkcartridge->ram_ptr) + offset + 0x9000; |
| 3279 | COMBINE_DATA(pos); |
| 3280 | } |
| 3281 | else |
| 3282 | { |
| 3283 | // Write protection on |
| 3284 | // This is handled like in Extended Basic |
| 3285 | gkcartridge->ram_page = offset & 1; |
| 3286 | } |
| 3287 | } |
| 3288 | } |
| 3289 | } |
| 3290 | |
| 3291 | /* |
| 3292 | Read cartridge mapper CRU interface (Guest in GRAM Kracker) |
| 3293 | */ |
| 3294 | static READ8_DEVICE_HANDLER( ti99_cart_crur_gk ) |
| 3295 | { |
| 3296 | ti99_multicart_state *cartslots = (ti99_multicart_state *) device->token; |
| 3297 | cartridge_t *gkguestcart; |
| 3298 | |
| 3299 | if (cartslots->gk_guest_slot != -1) |
| 3300 | { |
| 3301 | gkguestcart = &cartslots->cartridge[cartslots->gk_guest_slot]; |
| 3302 | ti99_pcb_t *pcbdef = (ti99_pcb_t *)gkguestcart->pcb->token; |
| 3303 | if (pcbdef->cruread != NULL) |
| 3304 | return (*pcbdef->cruread)(gkguestcart->pcb, offset); |
| 3305 | } |
| 3306 | return 0; |
| 3307 | } |
| 3308 | |
| 3309 | /* |
| 3310 | Write cartridge mapper CRU interface (Guest in GRAM Kracker) |
| 3311 | */ |
| 3312 | static WRITE8_DEVICE_HANDLER( ti99_cart_cruw_gk ) |
| 3313 | { |
| 3314 | ti99_multicart_state *cartslots = (ti99_multicart_state *) device->token; |
| 3315 | cartridge_t *gkguestcart; |
| 3316 | |
| 3317 | if (cartslots->gk_guest_slot != -1) |
| 3318 | { |
| 3319 | gkguestcart = &cartslots->cartridge[cartslots->gk_guest_slot]; |
| 3320 | ti99_pcb_t *pcbdef = (ti99_pcb_t *)gkguestcart->pcb->token; |
| 3321 | if (pcbdef->cruwrite != NULL) |
| 3322 | (*pcbdef->cruwrite)(gkguestcart->pcb, offset, data); |
| 3323 | } |
| 3324 | } |
| 3325 | |
| 3326 | /* |
| 3327 | TI-99/8 support |
| 3328 | */ |
| 3329 | static READ8_DEVICE_HANDLER( ti99_cart_r_gk8 ) |
| 3330 | { |
| 3331 | // gk_slot is the slot where the GK module is plugged in |
| 3332 | // gk_guest_slot is the slot where the cartridge is plugged in |
| 3333 | cartridge_t *gkcartridge, *gkguestcart; |
| 3334 | ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token; |
| 3335 | |
| 3336 | gkcartridge = &cartslots->cartridge[cartslots->gk_slot]; |
| 3337 | |
| 3338 | if (cartslots->gk_guest_slot != -1) |
| 3339 | { |
| 3340 | gkguestcart = &cartslots->cartridge[cartslots->gk_guest_slot]; |
| 3341 | // Legacy mode is not supported with the GK |
| 3342 | if (in_legacy_mode(device)) |
| 3343 | { |
| 3344 | return 0; |
| 3345 | } |
| 3346 | // printf("accessing cartridge in slot %d\n", slot); |
| 3347 | ti99_pcb_t *pcbdef = (ti99_pcb_t *)gkguestcart->pcb->token; |
| 3348 | // printf("address=%lx, offset=%lx\n", pcbdef, offset); |
| 3349 | return (*pcbdef->read8)(gkguestcart->pcb, offset); |
| 3350 | } |
| 3351 | else |
| 3352 | { |
| 3353 | if (get_gk_switch(1)==GK_OFF) |
| 3354 | return 0; |
| 3355 | |
| 3356 | if (get_gk_switch(4)==GK_BANK1) |
| 3357 | return ((UINT8 *)gkcartridge->ram_ptr)[offset+0x10000]; |
| 3358 | else |
| 3359 | { |
| 3360 | if (get_gk_switch(4)==GK_BANK2) |
| 3361 | return ((UINT8 *)gkcartridge->ram_ptr)[offset+0x12000]; |
| 3362 | else |
| 3363 | { |
| 3364 | // Write protection on |
| 3365 | if (gkcartridge->ram_page==0) |
| 3366 | return ((UINT8 *)gkcartridge->ram_ptr)[offset+0x10000]; |
| 3367 | else |
| 3368 | return ((UINT8 *)gkcartridge->ram_ptr)[offset+0x12000]; |
| 3369 | } |
| 3370 | } |
| 3371 | } |
| 3372 | } |
| 3373 | |
| 3374 | static WRITE8_DEVICE_HANDLER( ti99_cart_w_gk8 ) |
| 3375 | { |
| 3376 | // gk_slot is the slot where the GK module is plugged in |
| 3377 | // gk_guest_slot is the slot where the cartridge is plugged in |
| 3378 | cartridge_t *gkcartridge, *gkguestcart; |
| 3379 | ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token; |
| 3380 | |
| 3381 | gkcartridge = &cartslots->cartridge[cartslots->gk_slot]; |
| 3382 | |
| 3383 | if (cartslots->gk_guest_slot != -1) |
| 3384 | { |
| 3385 | gkguestcart = &cartslots->cartridge[cartslots->gk_guest_slot]; |
| 3386 | // Legacy mode is not supported with the GK |
| 3387 | if (in_legacy_mode(device)) |
| 3388 | { |
| 3389 | return; |
| 3390 | } |
| 3391 | |
| 3392 | ti99_pcb_t *pcbdef = (ti99_pcb_t *)gkguestcart->pcb->token; |
| 3393 | (*pcbdef->write8)(gkguestcart->pcb, offset, data); |
| 3394 | } |
| 3395 | else |
| 3396 | { |
| 3397 | if (get_gk_switch(1)==GK_OFF) |
| 3398 | return; |
| 3399 | |
| 3400 | if (get_gk_switch(4)==GK_BANK1) |
| 3401 | ((UINT8 *)gkcartridge->ram_ptr)[offset+0x10000] = data; |
| 3402 | else |
| 3403 | { |
| 3404 | if (get_gk_switch(4)==GK_BANK2) |
| 3405 | ((UINT8 *)gkcartridge->ram_ptr)[offset+0x12000] = data; |
| 3406 | else |
| 3407 | { |
| 3408 | // Write protection on |
| 3409 | // This is handled like in Extended Basic |
| 3410 | gkcartridge->ram_page = (offset>>1) & 1; |
| 3411 | } |
| 3412 | } |
| 3413 | } |
| 3414 | } |
| 3415 | |
| 3416 | /*****************************************************************************/ |
| 2969 | 3417 | #define TI99_CARTRIDGE_SLOT(p) MDRV_CARTSLOT_ADD(p) \ |
| 2970 | | MDRV_CARTSLOT_EXTENSION_LIST("rpk,bin") \ |
| 2971 | | MDRV_CARTSLOT_PCBTYPE(0, "none", TI99_CARTRIDGE_PCB_NONE) \ |
| 2972 | | MDRV_CARTSLOT_PCBTYPE(1, "standard", TI99_CARTRIDGE_PCB_STD) \ |
| 2973 | | MDRV_CARTSLOT_PCBTYPE(2, "paged", TI99_CARTRIDGE_PCB_PAGED) \ |
| 2974 | | MDRV_CARTSLOT_PCBTYPE(3, "minimem", TI99_CARTRIDGE_PCB_MINIMEM) \ |
| 2975 | | MDRV_CARTSLOT_PCBTYPE(4, "super", TI99_CARTRIDGE_PCB_SUPER) \ |
| 2976 | | MDRV_CARTSLOT_PCBTYPE(5, "mbx", TI99_CARTRIDGE_PCB_MBX) \ |
| 2977 | | MDRV_CARTSLOT_PCBTYPE(6, "paged379i", TI99_CARTRIDGE_PCB_PAGED379I) \ |
| 2978 | | MDRV_CARTSLOT_PCBTYPE(7, "pagedcru", TI99_CARTRIDGE_PCB_PAGEDCRU) \ |
| 2979 | | MDRV_CARTSLOT_START(ti99_cartridge) \ |
| 2980 | | MDRV_CARTSLOT_LOAD(ti99_cartridge) \ |
| 2981 | | MDRV_CARTSLOT_UNLOAD(ti99_cartridge) |
| 3418 | MDRV_CARTSLOT_EXTENSION_LIST("rpk,bin") \ |
| 3419 | MDRV_CARTSLOT_PCBTYPE(0, "none", TI99_CARTRIDGE_PCB_NONE) \ |
| 3420 | MDRV_CARTSLOT_PCBTYPE(1, "standard", TI99_CARTRIDGE_PCB_STD) \ |
| 3421 | MDRV_CARTSLOT_PCBTYPE(2, "paged", TI99_CARTRIDGE_PCB_PAGED) \ |
| 3422 | MDRV_CARTSLOT_PCBTYPE(3, "minimem", TI99_CARTRIDGE_PCB_MINIMEM) \ |
| 3423 | MDRV_CARTSLOT_PCBTYPE(4, "super", TI99_CARTRIDGE_PCB_SUPER) \ |
| 3424 | MDRV_CARTSLOT_PCBTYPE(5, "mbx", TI99_CARTRIDGE_PCB_MBX) \ |
| 3425 | MDRV_CARTSLOT_PCBTYPE(6, "paged379i", TI99_CARTRIDGE_PCB_PAGED379I) \ |
| 3426 | MDRV_CARTSLOT_PCBTYPE(7, "pagedcru", TI99_CARTRIDGE_PCB_PAGEDCRU) \ |
| 3427 | MDRV_CARTSLOT_PCBTYPE(8, "gramkracker", TI99_CARTRIDGE_PCB_GRAMKRACKER) \ |
| 3428 | MDRV_CARTSLOT_START(ti99_cartridge) \ |
| 3429 | MDRV_CARTSLOT_LOAD(ti99_cartridge) \ |
| 3430 | MDRV_CARTSLOT_UNLOAD(ti99_cartridge) |
| 2982 | 3431 | |
| 2983 | 3432 | static MACHINE_DRIVER_START(ti99_multicart) |
| 2984 | | TI99_CARTRIDGE_SLOT("cartridge1") |
| 2985 | | TI99_CARTRIDGE_SLOT("cartridge2") |
| 2986 | | TI99_CARTRIDGE_SLOT("cartridge3") |
| 2987 | | TI99_CARTRIDGE_SLOT("cartridge4") |
| 3433 | TI99_CARTRIDGE_SLOT("cartridge1") |
| 3434 | TI99_CARTRIDGE_SLOT("cartridge2") |
| 3435 | TI99_CARTRIDGE_SLOT("cartridge3") |
| 3436 | TI99_CARTRIDGE_SLOT("cartridge4") |
| 2988 | 3437 | MACHINE_DRIVER_END |
| 2989 | 3438 | |
| 2990 | 3439 | static const char DEVTEMPLATE_SOURCE[] = __FILE__; |
src/mess/drivers/ti99_4x.c
| r8275 | r8276 | |
| 56 | 56 | AM_RANGE(0x2000, 0x3fff) AM_READWRITE(ti99_nop_8_r, ti99_nop_8_w) /*lower 8kb of RAM extension - installed dynamically*/ |
| 57 | 57 | AM_RANGE(0x4000, 0x5fff) AM_READWRITE(ti99_4x_peb_r, ti99_4x_peb_w) /*DSR ROM space*/ |
| 58 | 58 | AM_RANGE(0x6000, 0x7fff) AM_READWRITE(ti99_cart_r, ti99_cart_w) /*cartridge memory*/ |
| 59 | | // AM_RANGE(0x6000, 0x7fff) AM_DEVREADWRITE("ti99_multicart", ti99_multicart_r, ti99_multicart_w) |
| 59 | // AM_RANGE(0x6000, 0x7fff) AM_DEVREADWRITE("ti99_multicart", ti99_multicart_r, ti99_multicart_w) |
| 60 | 60 | AM_RANGE(0x8000, 0x80ff) AM_MIRROR(0x0300) AM_RAMBANK("bank1") /*RAM PAD, mirrored 4 times*/ |
| 61 | 61 | AM_RANGE(0x8400, 0x87ff) AM_READWRITE(ti99_nop_8_r, ti99_wsnd_w) /*soundchip write*/ |
| 62 | 62 | AM_RANGE(0x8800, 0x8bff) AM_READWRITE(ti99_rvdp_r, ti99_nop_8_w) /*vdp read*/ |
| r8275 | r8276 | |
| 74 | 74 | AM_RANGE(0x2000, 0x3fff) AM_READWRITE(ti99_nop_8_r, ti99_nop_8_w) /*lower 8kb of RAM extension - installed dynamically*/ |
| 75 | 75 | AM_RANGE(0x4000, 0x5fff) AM_READWRITE(ti99_4x_peb_r, ti99_4x_peb_w) /*DSR ROM space*/ |
| 76 | 76 | AM_RANGE(0x6000, 0x7fff) AM_READWRITE(ti99_cart_r, ti99_cart_w) /*cartridge memory*/ |
| 77 | | // AM_RANGE(0x6000, 0x7fff) AM_DEVREADWRITE("ti99_multicart", ti99_multicart_r, ti99_multicart_w) |
| 77 | // AM_RANGE(0x6000, 0x7fff) AM_DEVREADWRITE("ti99_multicart", ti99_multicart_r, ti99_multicart_w) |
| 78 | 78 | AM_RANGE(0x8000, 0x80ff) AM_MIRROR(0x0300) AM_RAMBANK("bank1") /*RAM PAD, mirrored 4 times*/ |
| 79 | 79 | AM_RANGE(0x8400, 0x87ff) AM_READWRITE(ti99_nop_8_r, ti99_wsnd_w) /*soundchip write*/ |
| 80 | 80 | AM_RANGE(0x8800, 0x8bff) AM_READWRITE(ti99_rv38_r, ti99_nop_8_w) /*vdp read*/ |
| r8275 | r8276 | |
| 133 | 133 | PORT_START( "HDCTRL" ) |
| 134 | 134 | PORT_CONFNAME( 0x03, 0x00, "HD controller" ) |
| 135 | 135 | PORT_CONFSETTING( 0x00, DEF_STR( None ) ) |
| 136 | | // PORT_CONFSETTING( 0x01, "Nouspikel IDE Controller" ) |
| 136 | // PORT_CONFSETTING( 0x01, "Nouspikel IDE Controller" ) |
| 137 | 137 | // PORT_CONFSETTING( 0x02, "WHTech SCSI Controller" ) |
| 138 | 138 | PORT_CONFNAME( 0x04, 0x00, "USB-SM card" ) |
| 139 | 139 | PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) |
| r8275 | r8276 | |
| 144 | 144 | PORT_CONFSETTING( 0x00, DEF_STR( None ) ) |
| 145 | 145 | PORT_CONFSETTING( 0x01, "TI RS-232 card" ) |
| 146 | 146 | |
| 147 | | /* Flash setting is used to flash an empty HSGPL DSR ROM */ |
| 147 | /* Flash setting is used to flash an empty HSGPL DSR ROM */ |
| 148 | 148 | PORT_START( "EXTCARD" ) |
| 149 | 149 | PORT_CONFNAME( 0x03, 0x00, "HSGPL extension" ) PORT_CHANGED( hsgpl_changed, NULL) |
| 150 | 150 | PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) |
| r8275 | r8276 | |
| 160 | 160 | PORT_CONFSETTING( 0x01, "Mechatronics Mouse" ) |
| 161 | 161 | |
| 162 | 162 | PORT_START( "CARTSLOT" ) |
| 163 | | PORT_DIPNAME( 0x07, 0x00, "Cartridge slot" ) |
| 163 | PORT_DIPNAME( 0x0f, 0x00, "Cartridge slot" ) |
| 164 | 164 | PORT_DIPSETTING( 0x00, "Auto" ) |
| 165 | 165 | PORT_DIPSETTING( 0x01, "Slot 1" ) |
| 166 | 166 | PORT_DIPSETTING( 0x02, "Slot 2" ) |
| 167 | 167 | PORT_DIPSETTING( 0x03, "Slot 3" ) |
| 168 | 168 | PORT_DIPSETTING( 0x04, "Slot 4" ) |
| 169 | | // PORT_DIPSETTING( 0x05, "GRAM Kracker" ) |
| 169 | PORT_DIPSETTING( 0x0f, "GRAM Kracker" ) |
| 170 | 170 | |
| 171 | /* GRAM Kracker Support */ |
| 172 | PORT_START( "GKSWITCH1" ) |
| 173 | PORT_DIPNAME( 0x01, 0x01, "GK switch 1" ) PORT_CONDITION( "CARTSLOT", 0x0f, PORTCOND_EQUALS, 0x0f ) PORT_CHANGED( gk_changed, (void *)1) |
| 174 | PORT_DIPSETTING( 0x00, "GK Off" ) |
| 175 | PORT_DIPSETTING( 0x01, DEF_STR( Normal ) ) |
| 176 | |
| 177 | PORT_START( "GKSWITCH2" ) |
| 178 | PORT_DIPNAME( 0x01, 0x01, "GK switch 2" ) PORT_CONDITION( "CARTSLOT", 0x0f, PORTCOND_EQUALS, 0x0f ) PORT_CHANGED( gk_changed, (void *)2) |
| 179 | PORT_DIPSETTING( 0x00, "GRAM 0" ) |
| 180 | PORT_DIPSETTING( 0x01, "Op Sys" ) |
| 181 | |
| 182 | PORT_START( "GKSWITCH3" ) |
| 183 | PORT_DIPNAME( 0x01, 0x01, "GK switch 3" ) PORT_CONDITION( "CARTSLOT", 0x0f, PORTCOND_EQUALS, 0x0f ) PORT_CHANGED( gk_changed, (void *)3) |
| 184 | PORT_DIPSETTING( 0x00, "GRAM 1-2" ) |
| 185 | PORT_DIPSETTING( 0x01, "TI BASIC" ) |
| 186 | |
| 187 | PORT_START( "GKSWITCH4" ) |
| 188 | PORT_DIPNAME( 0x03, 0x01, "GK switch 4" ) PORT_CONDITION( "CARTSLOT", 0x0f, PORTCOND_EQUALS, 0x0f ) PORT_CHANGED( gk_changed, (void *)4) |
| 189 | PORT_DIPSETTING( 0x00, "Bank 1" ) |
| 190 | PORT_DIPSETTING( 0x01, "W/P" ) |
| 191 | PORT_DIPSETTING( 0x02, "Bank 2" ) |
| 192 | |
| 193 | PORT_START( "GKSWITCH5" ) |
| 194 | PORT_DIPNAME( 0x01, 0x00, "GK switch 5" ) PORT_CONDITION( "CARTSLOT", 0x0f, PORTCOND_EQUALS, 0x0f ) PORT_CHANGED( gk_changed, (void *)5) |
| 195 | PORT_DIPSETTING( 0x00, "Loader On" ) |
| 196 | PORT_DIPSETTING( 0x01, "Loader Off" ) |
| 197 | |
| 171 | 198 | PORT_START( "HFDCDIP" ) |
| 172 | 199 | PORT_DIPNAME( 0xff, 0x55, "HFDC drive config" ) PORT_CONDITION( "DISKCTRL", 0x07, PORTCOND_EQUALS, 0x03 ) |
| 173 | 200 | PORT_DIPSETTING( 0x00, "40 track, 16 ms") |
| r8275 | r8276 | |
| 306 | 333 | PORT_START( "HDCTRL" ) |
| 307 | 334 | PORT_CONFNAME( 0x03, 0x00, "HD controller" ) |
| 308 | 335 | PORT_CONFSETTING( 0x00, DEF_STR( None ) ) |
| 309 | | // PORT_CONFSETTING( 0x01, "Nouspikel IDE Controller" ) |
| 336 | // PORT_CONFSETTING( 0x01, "Nouspikel IDE Controller" ) |
| 310 | 337 | // PORT_CONFSETTING( 0x02, "WHTech SCSI Controller" ) |
| 311 | 338 | PORT_CONFNAME( 0x08, 0x00, "USB-SM card" ) |
| 312 | 339 | PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) |
| r8275 | r8276 | |
| 335 | 362 | PORT_CONFSETTING( 0x04, DEF_STR( On ) ) |
| 336 | 363 | |
| 337 | 364 | PORT_START( "CARTSLOT" ) |
| 338 | | PORT_DIPNAME( 0x07, 0x00, "Cartridge slot" ) |
| 365 | PORT_DIPNAME( 0x0f, 0x00, "Cartridge slot" ) |
| 339 | 366 | PORT_DIPSETTING( 0x00, "Auto" ) |
| 340 | 367 | PORT_DIPSETTING( 0x01, "Slot 1" ) |
| 341 | 368 | PORT_DIPSETTING( 0x02, "Slot 2" ) |
| 342 | 369 | PORT_DIPSETTING( 0x03, "Slot 3" ) |
| 343 | 370 | PORT_DIPSETTING( 0x04, "Slot 4" ) |
| 344 | | // PORT_DIPSETTING( 0x05, "GRAM Kracker" ) |
| 371 | PORT_DIPSETTING( 0x0f, "GRAM Kracker" ) |
| 345 | 372 | |
| 373 | /* GRAM Kracker Support */ |
| 374 | PORT_START( "GKSWITCH1" ) |
| 375 | PORT_DIPNAME( 0x01, 0x01, "GK switch 1" ) PORT_CONDITION( "CARTSLOT", 0x0f, PORTCOND_EQUALS, 0x0f ) PORT_CHANGED( gk_changed, (void *)1) |
| 376 | PORT_DIPSETTING( 0x00, "GK Off" ) |
| 377 | PORT_DIPSETTING( 0x01, DEF_STR( Normal ) ) |
| 378 | |
| 379 | PORT_START( "GKSWITCH2" ) |
| 380 | PORT_DIPNAME( 0x01, 0x01, "GK switch 2" ) PORT_CONDITION( "CARTSLOT", 0x0f, PORTCOND_EQUALS, 0x0f ) PORT_CHANGED( gk_changed, (void *)2) |
| 381 | PORT_DIPSETTING( 0x00, "GRAM 0" ) |
| 382 | PORT_DIPSETTING( 0x01, "Op Sys" ) |
| 383 | |
| 384 | PORT_START( "GKSWITCH3" ) |
| 385 | PORT_DIPNAME( 0x01, 0x01, "GK switch 3" ) PORT_CONDITION( "CARTSLOT", 0x0f, PORTCOND_EQUALS, 0x0f ) PORT_CHANGED( gk_changed, (void *)3) |
| 386 | PORT_DIPSETTING( 0x00, "GRAM 1-2" ) |
| 387 | PORT_DIPSETTING( 0x01, "TI BASIC" ) |
| 388 | |
| 389 | PORT_START( "GKSWITCH4" ) |
| 390 | PORT_DIPNAME( 0x03, 0x01, "GK switch 4" ) PORT_CONDITION( "CARTSLOT", 0x0f, PORTCOND_EQUALS, 0x0f ) PORT_CHANGED( gk_changed, (void *)4) |
| 391 | PORT_DIPSETTING( 0x00, "Bank 1" ) |
| 392 | PORT_DIPSETTING( 0x01, "W/P" ) |
| 393 | PORT_DIPSETTING( 0x02, "Bank 2" ) |
| 394 | |
| 395 | PORT_START( "GKSWITCH5" ) |
| 396 | PORT_DIPNAME( 0x01, 0x00, "GK switch 5" ) PORT_CONDITION( "CARTSLOT", 0x0f, PORTCOND_EQUALS, 0x0f ) PORT_CHANGED( gk_changed, (void *)5) |
| 397 | PORT_DIPSETTING( 0x00, "Loader On" ) |
| 398 | PORT_DIPSETTING( 0x01, "Loader Off" ) |
| 399 | |
| 346 | 400 | PORT_START( "HFDCDIP" ) |
| 347 | 401 | PORT_DIPNAME( 0xff, 0x55, "HFDC drive config" ) PORT_CONDITION( "DISKCTRL", 0x07, PORTCOND_EQUALS, 0x03 ) |
| 348 | 402 | PORT_DIPSETTING( 0x00, "40 track, 16 ms") |
| r8275 | r8276 | |
| 688 | 742 | |
| 689 | 743 | /* For HSGPL */ |
| 690 | 744 | MDRV_NVRAM_HANDLER( ti99 ) |
| 691 | | |
| 745 | |
| 692 | 746 | /* video hardware */ |
| 693 | 747 | MDRV_IMPORT_FROM(tms9928a) |
| 694 | 748 | MDRV_SCREEN_MODIFY("screen") |
| r8275 | r8276 | |
| 709 | 763 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 710 | 764 | |
| 711 | 765 | /* devices */ |
| 712 | | /* MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt ) |
| 713 | | MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */ |
| 766 | // MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt ) |
| 767 | // MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) |
| 714 | 768 | |
| 715 | 769 | MDRV_CASSETTE_ADD( "cassette1", default_cassette_config ) |
| 716 | 770 | MDRV_CASSETTE_ADD( "cassette2", default_cassette_config ) |
| r8275 | r8276 | |
| 747 | 801 | |
| 748 | 802 | /* For HSGPL */ |
| 749 | 803 | MDRV_NVRAM_HANDLER( ti99 ) |
| 750 | | |
| 804 | |
| 751 | 805 | /* video hardware */ |
| 752 | 806 | MDRV_IMPORT_FROM(tms9928a) |
| 753 | 807 | MDRV_SCREEN_MODIFY("screen") |
| r8275 | r8276 | |
| 766 | 820 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 767 | 821 | |
| 768 | 822 | /* devices */ |
| 769 | | /* MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt ) |
| 770 | | MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */ |
| 823 | // MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt |
| 824 | // MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) |
| 771 | 825 | |
| 772 | 826 | MDRV_CASSETTE_ADD( "cassette1", default_cassette_config ) |
| 773 | 827 | MDRV_CASSETTE_ADD( "cassette2", default_cassette_config ) |
| r8275 | r8276 | |
| 804 | 858 | |
| 805 | 859 | /* For HSGPL */ |
| 806 | 860 | MDRV_NVRAM_HANDLER( ti99 ) |
| 807 | | |
| 861 | |
| 808 | 862 | /* video hardware */ |
| 809 | 863 | MDRV_IMPORT_FROM(tms9928a) |
| 810 | 864 | MDRV_SCREEN_MODIFY("screen") |
| r8275 | r8276 | |
| 823 | 877 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 824 | 878 | |
| 825 | 879 | /* devices */ |
| 826 | | /* MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt ) |
| 827 | | MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */ |
| 880 | // MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt ) |
| 881 | // MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) |
| 828 | 882 | |
| 829 | 883 | MDRV_CASSETTE_ADD( "cassette1", default_cassette_config ) |
| 830 | 884 | MDRV_CASSETTE_ADD( "cassette2", default_cassette_config ) |
| r8275 | r8276 | |
| 863 | 917 | |
| 864 | 918 | /* For HSGPL */ |
| 865 | 919 | MDRV_NVRAM_HANDLER( ti99 ) |
| 866 | | |
| 920 | |
| 867 | 921 | /* video hardware */ |
| 868 | 922 | MDRV_IMPORT_FROM(tms9928a) |
| 869 | 923 | MDRV_SCREEN_MODIFY("screen") |
| r8275 | r8276 | |
| 882 | 936 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 883 | 937 | |
| 884 | 938 | /* devices */ |
| 885 | | /* MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt ) |
| 886 | | MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */ |
| 939 | // MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt ) |
| 940 | // MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */ |
| 887 | 941 | |
| 888 | 942 | MDRV_CASSETTE_ADD( "cassette1", default_cassette_config ) |
| 889 | 943 | MDRV_CASSETTE_ADD( "cassette2", default_cassette_config ) |
| r8275 | r8276 | |
| 921 | 975 | |
| 922 | 976 | /* For HSGPL */ |
| 923 | 977 | MDRV_NVRAM_HANDLER( ti99 ) |
| 924 | | |
| 978 | |
| 925 | 979 | /* video hardware */ |
| 926 | 980 | MDRV_SCREEN_ADD("screen", RASTER) |
| 927 | 981 | MDRV_SCREEN_REFRESH_RATE(60) /* or 50Hz */ |
| r8275 | r8276 | |
| 948 | 1002 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 949 | 1003 | |
| 950 | 1004 | /* devices */ |
| 951 | | /* MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt ) |
| 952 | | MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */ |
| 1005 | // MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt ) |
| 1006 | // MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */ |
| 953 | 1007 | |
| 954 | 1008 | MDRV_CASSETTE_ADD( "cassette1", default_cassette_config ) |
| 955 | 1009 | MDRV_CASSETTE_ADD( "cassette2", default_cassette_config ) |