trunk/src/mess/machine/gamecom.c
| r32430 | r32431 | |
| 16 | 16 | void gamecom_state::machine_reset() |
| 17 | 17 | { |
| 18 | 18 | UINT8 *rom = m_region_kernel->base(); |
| 19 | | m_bank1->set_base( rom ); |
| 20 | | m_bank2->set_base( rom ); |
| 21 | | m_bank3->set_base( rom ); |
| 22 | | m_bank4->set_base( rom ); |
| 19 | m_bank1->set_base(rom); |
| 20 | m_bank2->set_base(rom); |
| 21 | m_bank3->set_base(rom); |
| 22 | m_bank4->set_base(rom); |
| 23 | 23 | |
| 24 | | m_cartridge = NULL; |
| 24 | m_cart_ptr = NULL; |
| 25 | 25 | m_lch_reg = 0x07; |
| 26 | 26 | m_lcv_reg = 0x27; |
| 27 | 27 | m_lcdc_reg = 0xb0; |
| 28 | |
| 29 | astring region_tag; |
| 30 | m_cart1_rom = memregion(region_tag.cpy(m_cart1->tag()).cat(GENERIC_ROM_REGION_TAG)); |
| 31 | m_cart2_rom = memregion(region_tag.cpy(m_cart2->tag()).cat(GENERIC_ROM_REGION_TAG)); |
| 28 | 32 | } |
| 29 | 33 | |
| 30 | | void gamecom_state::gamecom_set_mmu(UINT8 mmu, UINT8 data ) |
| 34 | void gamecom_state::gamecom_set_mmu(UINT8 mmu, UINT8 data) |
| 31 | 35 | { |
| 32 | 36 | if (data < 0x20) |
| 33 | 37 | { |
| 34 | 38 | /* select internal ROM bank */ |
| 35 | | switch ( mmu ) |
| 39 | switch (mmu) |
| 36 | 40 | { |
| 37 | | case 1: m_bank1->set_base( m_region_kernel->base() + (data << 13) ); break; |
| 38 | | case 2: m_bank2->set_base( m_region_kernel->base() + (data << 13) ); break; |
| 39 | | case 3: m_bank3->set_base( m_region_kernel->base() + (data << 13) ); break; |
| 40 | | case 4: m_bank4->set_base( m_region_kernel->base() + (data << 13) ); break; |
| 41 | case 1: m_bank1->set_base(m_region_kernel->base() + (data << 13)); break; |
| 42 | case 2: m_bank2->set_base(m_region_kernel->base() + (data << 13)); break; |
| 43 | case 3: m_bank3->set_base(m_region_kernel->base() + (data << 13)); break; |
| 44 | case 4: m_bank4->set_base(m_region_kernel->base() + (data << 13)); break; |
| 41 | 45 | } |
| 42 | 46 | } |
| 43 | 47 | else |
| 44 | 48 | { |
| 45 | 49 | /* select cartridge bank */ |
| 46 | | if ( m_cartridge ) |
| 50 | if (m_cart_ptr) |
| 47 | 51 | { |
| 48 | | switch ( mmu ) |
| 52 | switch (mmu) |
| 49 | 53 | { |
| 50 | | case 1: m_bank1->set_base( m_cartridge + ( data << 13 ) ); break; |
| 51 | | case 2: m_bank2->set_base( m_cartridge + ( data << 13 ) ); break; |
| 52 | | case 3: m_bank3->set_base( m_cartridge + ( data << 13 ) ); break; |
| 53 | | case 4: m_bank4->set_base( m_cartridge + ( data << 13 ) ); break; |
| 54 | case 1: m_bank1->set_base(m_cart_ptr + (data << 13)); break; |
| 55 | case 2: m_bank2->set_base(m_cart_ptr + (data << 13)); break; |
| 56 | case 3: m_bank3->set_base(m_cart_ptr + (data << 13)); break; |
| 57 | case 4: m_bank4->set_base(m_cart_ptr + (data << 13)); break; |
| 54 | 58 | } |
| 55 | 59 | } |
| 56 | 60 | } |
| r32430 | r32431 | |
| 175 | 179 | { |
| 176 | 180 | offset += 0x14; |
| 177 | 181 | m_p_ram[offset] = data; |
| 178 | | switch( offset ) |
| 182 | switch (offset) |
| 179 | 183 | { |
| 180 | 184 | case SM8521_P1: |
| 181 | 185 | case SM8521_P2: |
| r32430 | r32431 | |
| 184 | 188 | case SM8521_P3: |
| 185 | 189 | /* P3 bit7 clear, bit6 set -> enable cartridge port #0? */ |
| 186 | 190 | /* P3 bit6 clear, bit7 set -> enable cartridge port #1? */ |
| 187 | | switch( data & 0xc0 ) |
| 191 | switch (data & 0xc0) |
| 188 | 192 | { |
| 189 | | case 0x40: m_cartridge = m_cartridge1; break; |
| 190 | | case 0x80: m_cartridge = m_cartridge2; break; |
| 191 | | default: m_cartridge = NULL; break; |
| 193 | case 0x40: m_cart_ptr = m_cart1_rom->base(); break; |
| 194 | case 0x80: m_cart_ptr = m_cart2_rom->base(); break; |
| 195 | default: m_cart_ptr = NULL; break; |
| 192 | 196 | } |
| 193 | 197 | return; |
| 194 | 198 | } |
| r32430 | r32431 | |
| 481 | 485 | // logerror( "DMA DMBR = %X\n", RAM[SM8521_DMBR] ); |
| 482 | 486 | m_dma.source_width = 64; |
| 483 | 487 | m_dma.source_mask = 0x3FFF; |
| 484 | | if ( RAM[SM8521_DMBR] < 16 ) |
| 485 | | { |
| 488 | if (RAM[SM8521_DMBR] < 16) |
| 486 | 489 | m_dma.source_bank = m_region_kernel->base() + (RAM[SM8521_DMBR] << 14); |
| 487 | | } |
| 488 | | else |
| 489 | | { |
| 490 | | if (m_cartridge) |
| 491 | | { |
| 492 | | m_dma.source_bank = m_cartridge + (RAM[SM8521_DMBR] << 14); |
| 493 | | } |
| 494 | | } |
| 490 | else if (m_cart_ptr) |
| 491 | m_dma.source_bank = m_cart_ptr + (RAM[SM8521_DMBR] << 14); |
| 495 | 492 | |
| 496 | 493 | m_dma.dest_bank = &m_p_videoram[(RAM[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; |
| 497 | 494 | break; |
| r32430 | r32431 | |
| 637 | 634 | m_p_ram = m_region_maincpu->base(); // required here because pio_w gets called before machine_reset |
| 638 | 635 | } |
| 639 | 636 | |
| 640 | | DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart1 ) |
| 637 | int gamecom_state::common_load(device_image_interface &image, generic_slot_device *slot) |
| 641 | 638 | { |
| 642 | | UINT32 filesize; |
| 639 | UINT32 size = slot->common_get_size("rom"); |
| 643 | 640 | UINT32 load_offset = 0; |
| 644 | 641 | |
| 645 | | m_cartridge1 = memregion("cart1")->base(); |
| 646 | | |
| 647 | | if (image.software_entry() == NULL) |
| 648 | | filesize = image.length(); |
| 649 | | else |
| 650 | | filesize = image.get_software_region_length("rom"); |
| 651 | | |
| 652 | | switch(filesize) |
| 642 | if (size != 0x008000 && size != 0x040000 && size != 0x080000 |
| 643 | && size != 0x100000 && size != 0x1c0000 && size != 0x200000) |
| 653 | 644 | { |
| 654 | | case 0x008000: load_offset = 0; break; /* 32 KB */ |
| 655 | | case 0x040000: load_offset = 0; break; /* 256KB */ |
| 656 | | case 0x080000: load_offset = 0; break; /* 512KB */ |
| 657 | | case 0x100000: load_offset = 0; break; /* 1 MB */ |
| 658 | | case 0x1c0000: load_offset = 0x040000; break; /* 1.8MB */ |
| 659 | | case 0x200000: load_offset = 0; break; /* 2 MB */ |
| 660 | | default: /* otherwise */ |
| 661 | | logerror("Error loading cartridge: Invalid file size 0x%X\n", filesize); |
| 662 | | image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unhandled cart size"); |
| 663 | | return IMAGE_INIT_FAIL; |
| 645 | image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); |
| 646 | return IMAGE_INIT_FAIL; |
| 664 | 647 | } |
| 665 | | |
| 666 | | if (image.software_entry() == NULL) |
| 667 | | { |
| 668 | | if (image.fread( m_cartridge1 + load_offset, filesize) != filesize) |
| 669 | | { |
| 670 | | image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to load all of the cart"); |
| 671 | | return IMAGE_INIT_FAIL; |
| 672 | | } |
| 673 | | } |
| 674 | | else |
| 675 | | memcpy(m_cartridge1 + load_offset, image.get_software_region("rom"), filesize); |
| 676 | | |
| 677 | | if (filesize < 0x010000) { memcpy(m_cartridge1 + 0x008000, m_cartridge1, 0x008000); } /* ->64KB */ |
| 678 | | if (filesize < 0x020000) { memcpy(m_cartridge1 + 0x010000, m_cartridge1, 0x010000); } /* ->128KB */ |
| 679 | | if (filesize < 0x040000) { memcpy(m_cartridge1 + 0x020000, m_cartridge1, 0x020000); } /* ->256KB */ |
| 680 | | if (filesize < 0x080000) { memcpy(m_cartridge1 + 0x040000, m_cartridge1, 0x040000); } /* ->512KB */ |
| 681 | | if (filesize < 0x100000) { memcpy(m_cartridge1 + 0x080000, m_cartridge1, 0x080000); } /* ->1MB */ |
| 682 | | if (filesize < 0x1c0000) { memcpy(m_cartridge1 + 0x100000, m_cartridge1, 0x100000); } /* -> >=1.8MB */ |
| 648 | |
| 649 | if (size == 0x1c0000) |
| 650 | load_offset = 0x40000; |
| 651 | |
| 652 | // in order to simplify banked access from the driver, we always allocate 0x200000, |
| 653 | slot->rom_alloc(0x200000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); |
| 654 | // we load what we have |
| 655 | slot->common_load_rom(slot->get_rom_base() + load_offset, size, "rom"); |
| 656 | // and then we mirror the content, instead of masking out larger accesses |
| 657 | UINT8 *crt = slot->get_rom_base(); |
| 658 | if (size < 0x010000) { memcpy(crt + 0x008000, crt, 0x008000); } /* ->64KB */ |
| 659 | if (size < 0x020000) { memcpy(crt + 0x010000, crt, 0x010000); } /* ->128KB */ |
| 660 | if (size < 0x040000) { memcpy(crt + 0x020000, crt, 0x020000); } /* ->256KB */ |
| 661 | if (size < 0x080000) { memcpy(crt + 0x040000, crt, 0x040000); } /* ->512KB */ |
| 662 | if (size < 0x100000) { memcpy(crt + 0x080000, crt, 0x080000); } /* ->1MB */ |
| 663 | if (size < 0x1c0000) { memcpy(crt + 0x100000, crt, 0x100000); } /* -> >=1.8MB */ |
| 664 | |
| 683 | 665 | return IMAGE_INIT_PASS; |
| 684 | 666 | } |
| 685 | 667 | |
| 686 | | DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart2 ) |
| 668 | DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart1 ) |
| 687 | 669 | { |
| 688 | | UINT32 filesize; |
| 689 | | UINT32 load_offset = 0; |
| 670 | return common_load(image, m_cart1); |
| 671 | } |
| 690 | 672 | |
| 691 | | m_cartridge2 = memregion("cart2")->base(); |
| 692 | | |
| 693 | | // if (image.software_entry() == NULL) |
| 694 | | filesize = image.length(); |
| 695 | | // else |
| 696 | | // filesize = image.get_software_region_length("rom"); |
| 697 | | |
| 698 | | switch(filesize) |
| 699 | | { |
| 700 | | case 0x008000: load_offset = 0; break; /* 32 KB */ |
| 701 | | case 0x040000: load_offset = 0; break; /* 256KB */ |
| 702 | | case 0x080000: load_offset = 0; break; /* 512KB */ |
| 703 | | case 0x100000: load_offset = 0; break; /* 1 MB */ |
| 704 | | case 0x1c0000: load_offset = 0x040000; break; /* 1.8MB */ |
| 705 | | case 0x200000: load_offset = 0; break; /* 2 MB */ |
| 706 | | default: /* otherwise */ |
| 707 | | logerror("Error loading cartridge: Invalid file size 0x%X\n", filesize); |
| 708 | | image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unhandled cart size"); |
| 709 | | return IMAGE_INIT_FAIL; |
| 710 | | } |
| 711 | | |
| 712 | | // if (image.software_entry() == NULL) |
| 713 | | { |
| 714 | | if (image.fread( m_cartridge2 + load_offset, filesize) != filesize) |
| 715 | | { |
| 716 | | image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to load all of the cart"); |
| 717 | | return IMAGE_INIT_FAIL; |
| 718 | | } |
| 719 | | } |
| 720 | | // else |
| 721 | | // memcpy(state->m_cartridge2 + load_offset, image.get_software_region("rom"), filesize); |
| 722 | | |
| 723 | | if (filesize < 0x010000) { memcpy(m_cartridge2 + 0x008000, m_cartridge2, 0x008000); } /* ->64KB */ |
| 724 | | if (filesize < 0x020000) { memcpy(m_cartridge2 + 0x010000, m_cartridge2, 0x010000); } /* ->128KB */ |
| 725 | | if (filesize < 0x040000) { memcpy(m_cartridge2 + 0x020000, m_cartridge2, 0x020000); } /* ->256KB */ |
| 726 | | if (filesize < 0x080000) { memcpy(m_cartridge2 + 0x040000, m_cartridge2, 0x040000); } /* ->512KB */ |
| 727 | | if (filesize < 0x100000) { memcpy(m_cartridge2 + 0x080000, m_cartridge2, 0x080000); } /* ->1MB */ |
| 728 | | if (filesize < 0x1c0000) { memcpy(m_cartridge2 + 0x100000, m_cartridge2, 0x100000); } /* -> >=1.8MB */ |
| 729 | | return IMAGE_INIT_PASS; |
| 673 | DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart2 ) |
| 674 | { |
| 675 | return common_load(image, m_cart2); |
| 730 | 676 | } |
trunk/src/mess/drivers/pc6001.c
| r32430 | r32431 | |
| 134 | 134 | #include "sound/wave.h" |
| 135 | 135 | |
| 136 | 136 | #include "imagedev/cassette.h" |
| 137 | | #include "imagedev/cartslot.h" |
| 137 | #include "bus/generic/slot.h" |
| 138 | #include "bus/generic/carts.h" |
| 138 | 139 | #include "formats/p6001_cas.h" |
| 139 | 140 | |
| 140 | 141 | |
| r32430 | r32431 | |
| 147 | 148 | m_ram(*this, "ram"), |
| 148 | 149 | m_maincpu(*this, "maincpu"), |
| 149 | 150 | m_cassette(*this, "cassette"), |
| 151 | m_cas_hack(*this, "cas_hack"), |
| 152 | m_cart(*this, "cartslot"), |
| 150 | 153 | m_region_maincpu(*this, "maincpu"), |
| 151 | 154 | m_region_gfx1(*this, "gfx1"), |
| 152 | | m_region_cas(*this, "cas"), |
| 153 | | m_region_cart_img(*this, "cart_img"), |
| 154 | 155 | m_io_mode4_dsw(*this, "MODE4_DSW"), |
| 155 | 156 | m_io_p1(*this, "P1"), |
| 156 | 157 | m_io_p2(*this, "P2"), |
| r32430 | r32431 | |
| 266 | 267 | DECLARE_WRITE8_MEMBER(pc6001_8255_portb_w); |
| 267 | 268 | DECLARE_WRITE8_MEMBER(pc6001_8255_portc_w); |
| 268 | 269 | DECLARE_READ8_MEMBER(pc6001_8255_portc_r); |
| 269 | | DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pc6001_cass); |
| 270 | 270 | IRQ_CALLBACK_MEMBER(pc6001_irq_callback); |
| 271 | 271 | protected: |
| 272 | 272 | required_device<cpu_device> m_maincpu; |
| 273 | | required_device<device_t> m_cassette; |
| 273 | optional_device<cassette_image_device> m_cassette; |
| 274 | optional_device<generic_slot_device> m_cas_hack; |
| 275 | required_device<generic_slot_device> m_cart; |
| 274 | 276 | required_memory_region m_region_maincpu; |
| 275 | 277 | required_memory_region m_region_gfx1; |
| 276 | | required_memory_region m_region_cas; |
| 277 | | required_memory_region m_region_cart_img; |
| 278 | 278 | required_ioport m_io_mode4_dsw; |
| 279 | 279 | required_ioport m_io_p1; |
| 280 | 280 | required_ioport m_io_p2; |
| r32430 | r32431 | |
| 292 | 292 | optional_memory_bank m_bank8; |
| 293 | 293 | required_device<palette_device> m_palette; |
| 294 | 294 | |
| 295 | memory_region *m_cart_rom; |
| 296 | |
| 295 | 297 | void draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr); |
| 296 | 298 | void draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &cliprect, int attr); |
| 297 | 299 | void draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr); |
| r32430 | r32431 | |
| 906 | 908 | m_port_c_8255 |= 0xa8; |
| 907 | 909 | |
| 908 | 910 | { |
| 909 | | UINT8 *gfx_data = m_region_gfx1->base(); |
| 910 | | UINT8 *ext_rom = m_region_cart_img->base(); |
| 911 | | |
| 912 | 911 | //printf("%02x\n",data); |
| 913 | 912 | |
| 914 | | if((data & 0x0f) == 0x05) |
| 915 | | m_bank1->set_base(&ext_rom[0x2000]); |
| 916 | | if((data & 0x0f) == 0x04) |
| 917 | | m_bank1->set_base(&gfx_data[0]); |
| 913 | if ((data & 0x0f) == 0x05 && m_cart_rom) |
| 914 | m_bank1->set_base(m_cart_rom->base() + 0x2000); |
| 915 | if ((data & 0x0f) == 0x04) |
| 916 | m_bank1->set_base(m_region_gfx1->base()); |
| 918 | 917 | } |
| 919 | 918 | } |
| 920 | 919 | m_ppi->write(space,offset,data); |
| r32430 | r32431 | |
| 923 | 922 | static ADDRESS_MAP_START(pc6001_map, AS_PROGRAM, 8, pc6001_state ) |
| 924 | 923 | ADDRESS_MAP_UNMAP_HIGH |
| 925 | 924 | AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP |
| 926 | | AM_RANGE(0x4000, 0x5fff) AM_ROM AM_REGION("cart_img",0) |
| 925 | //AM_RANGE(0x4000, 0x5fff) // mapped by the cartslot |
| 927 | 926 | AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1") |
| 928 | 927 | AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("ram") |
| 929 | 928 | ADDRESS_MAP_END |
| r32430 | r32431 | |
| 1639 | 1638 | |
| 1640 | 1639 | if(0) |
| 1641 | 1640 | { |
| 1642 | | UINT8 *gfx_data = m_region_gfx1->base(); |
| 1643 | | UINT8 *ext_rom = m_region_cart_img->base(); |
| 1644 | | |
| 1645 | 1641 | //printf("%02x\n",data); |
| 1646 | | |
| 1647 | | if((data & 0x0f) == 0x05) |
| 1648 | | m_bank1->set_base(&ext_rom[0x2000]); |
| 1649 | | if((data & 0x0f) == 0x04) |
| 1650 | | m_bank1->set_base(&gfx_data[0]); |
| 1642 | |
| 1643 | if ((data & 0x0f) == 0x05 && m_cart_rom) |
| 1644 | m_bank1->set_base(m_cart_rom->base() + 0x2000); |
| 1645 | if ((data & 0x0f) == 0x04) |
| 1646 | m_bank1->set_base(m_region_gfx1->base()); |
| 1651 | 1647 | } |
| 1652 | 1648 | } |
| 1653 | 1649 | m_ppi->write(space,offset,data); |
| r32430 | r32431 | |
| 1994 | 1990 | if(m_cas_switch == 1) |
| 1995 | 1991 | { |
| 1996 | 1992 | #if 0 |
| 1997 | | static UINT8 cas_data_i = 0x80,cas_data_poll; |
| 1998 | | //m_cur_keycode = gfx_data[m_cas_offset++]; |
| 1999 | | if(m_cassette->input() > 0.03) |
| 2000 | | cas_data_poll|= cas_data_i; |
| 2001 | | else |
| 2002 | | cas_data_poll&=~cas_data_i; |
| 2003 | | if(cas_data_i == 1) |
| 2004 | | { |
| 2005 | | m_cur_keycode = cas_data_poll; |
| 2006 | | cas_data_i = 0x80; |
| 2007 | | /* data ready, poll irq */ |
| 2008 | | m_irq_vector = 0x08; |
| 2009 | | m_maincpu->set_input_line(0, ASSERT_LINE); |
| 2010 | | } |
| 2011 | | else |
| 2012 | | cas_data_i>>=1; |
| 1993 | static UINT8 cas_data_i = 0x80,cas_data_poll; |
| 1994 | //m_cur_keycode = gfx_data[m_cas_offset++]; |
| 1995 | if(m_cassette->input() > 0.03) |
| 1996 | cas_data_poll|= cas_data_i; |
| 1997 | else |
| 1998 | cas_data_poll&=~cas_data_i; |
| 1999 | if(cas_data_i == 1) |
| 2000 | { |
| 2001 | m_cur_keycode = cas_data_poll; |
| 2002 | cas_data_i = 0x80; |
| 2003 | /* data ready, poll irq */ |
| 2004 | m_irq_vector = 0x08; |
| 2005 | m_maincpu->set_input_line(0, ASSERT_LINE); |
| 2006 | } |
| 2007 | else |
| 2008 | cas_data_i>>=1; |
| 2013 | 2009 | #else |
| 2014 | | UINT8 *cas_data = m_region_cas->base(); |
| 2015 | | |
| 2016 | | m_cur_keycode = cas_data[m_cas_offset++]; |
| 2017 | | popmessage("%04x %04x",m_cas_offset,m_cas_maxsize); |
| 2010 | address_space &space = m_maincpu->space(AS_PROGRAM); |
| 2011 | m_cur_keycode = m_cas_hack->read_rom(space, m_cas_offset++); |
| 2012 | popmessage("%04x %04x", m_cas_offset, m_cas_maxsize); |
| 2018 | 2013 | if(m_cas_offset > m_cas_maxsize) |
| 2019 | 2014 | { |
| 2020 | 2015 | m_cas_offset = 0; |
| r32430 | r32431 | |
| 2078 | 2073 | |
| 2079 | 2074 | void pc6001_state::machine_reset() |
| 2080 | 2075 | { |
| 2081 | | UINT8 *work_ram = m_region_maincpu->base(); |
| 2076 | m_video_ram = m_region_maincpu->base() + 0xc000; |
| 2077 | |
| 2078 | if (m_cart->exists()) |
| 2079 | m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); |
| 2082 | 2080 | |
| 2083 | | m_video_ram = work_ram + 0xc000; |
| 2084 | | |
| 2081 | astring region_tag; |
| 2082 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); |
| 2083 | |
| 2085 | 2084 | m_port_c_8255=0; |
| 2086 | 2085 | |
| 2087 | 2086 | m_cas_switch = 0; |
| 2088 | 2087 | m_cas_offset = 0; |
| 2088 | m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0; |
| 2089 | 2089 | m_timer_irq_mask = 1; |
| 2090 | 2090 | m_timer_irq_mask2 = 1; |
| 2091 | 2091 | m_timer_irq_vector = 0x06; // actually vector is fixed in plain PC-6001 |
| r32430 | r32431 | |
| 2094 | 2094 | |
| 2095 | 2095 | MACHINE_RESET_MEMBER(pc6001_state,pc6001m2) |
| 2096 | 2096 | { |
| 2097 | | UINT8 *work_ram = m_region_maincpu->base(); |
| 2098 | | |
| 2099 | | m_video_ram = work_ram + 0xc000 + 0x28000; |
| 2100 | | |
| 2097 | m_video_ram = m_region_maincpu->base() + 0xc000 + 0x28000; |
| 2098 | |
| 2099 | astring region_tag; |
| 2100 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); |
| 2101 | // hackish way to simplify bankswitch handling |
| 2102 | if (m_cart_rom) |
| 2103 | memcpy(m_region_maincpu->base() + 0x48000, m_cart_rom->base(), 0x4000); |
| 2104 | |
| 2101 | 2105 | m_port_c_8255=0; |
| 2102 | 2106 | |
| 2103 | 2107 | m_cas_switch = 0; |
| 2104 | 2108 | m_cas_offset = 0; |
| 2109 | m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0; |
| 2105 | 2110 | |
| 2106 | 2111 | /* set default bankswitch */ |
| 2107 | 2112 | { |
| r32430 | r32431 | |
| 2128 | 2133 | |
| 2129 | 2134 | MACHINE_RESET_MEMBER(pc6001_state,pc6001sr) |
| 2130 | 2135 | { |
| 2131 | | UINT8 *work_ram = m_region_maincpu->base(); |
| 2132 | | |
| 2133 | | m_video_ram = work_ram + 0x70000; |
| 2134 | | |
| 2136 | m_video_ram = m_region_maincpu->base() + 0x70000; |
| 2137 | |
| 2138 | astring region_tag; |
| 2139 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); |
| 2140 | // should this be mirrored into the EXROM regions? hard to tell without an actual cart dump... |
| 2141 | |
| 2135 | 2142 | m_port_c_8255=0; |
| 2136 | 2143 | |
| 2137 | 2144 | m_cas_switch = 0; |
| 2138 | 2145 | m_cas_offset = 0; |
| 2146 | m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0; |
| 2139 | 2147 | |
| 2140 | 2148 | /* set default bankswitch */ |
| 2141 | 2149 | { |
| r32430 | r32431 | |
| 2235 | 2243 | }; |
| 2236 | 2244 | #endif |
| 2237 | 2245 | |
| 2238 | | DEVICE_IMAGE_LOAD_MEMBER( pc6001_state,pc6001_cass ) |
| 2239 | | { |
| 2240 | | UINT8 *cas = m_region_cas->base(); |
| 2241 | | UINT32 size; |
| 2242 | | |
| 2243 | | size = image.length(); |
| 2244 | | if (image.fread( cas, size) != size) |
| 2245 | | { |
| 2246 | | image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file"); |
| 2247 | | return IMAGE_INIT_FAIL; |
| 2248 | | } |
| 2249 | | |
| 2250 | | m_cas_maxsize = size; |
| 2251 | | |
| 2252 | | return IMAGE_INIT_PASS; |
| 2253 | | } |
| 2254 | | |
| 2255 | 2246 | static const gfx_layout char_layout = |
| 2256 | 2247 | { |
| 2257 | 2248 | 8, 16, |
| r32430 | r32431 | |
| 2318 | 2309 | /* uart */ |
| 2319 | 2310 | MCFG_DEVICE_ADD("uart", I8251, 0) |
| 2320 | 2311 | |
| 2321 | | MCFG_CARTSLOT_ADD("cart") |
| 2322 | | MCFG_CARTSLOT_EXTENSION_LIST("bin") |
| 2323 | | MCFG_CARTSLOT_NOT_MANDATORY |
| 2312 | MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pc6001_cart") |
| 2324 | 2313 | |
| 2325 | | // MCFG_CASSETTE_ADD("cassette",pc6001_cassette_interface) |
| 2326 | | MCFG_CARTSLOT_ADD("cassette") |
| 2327 | | MCFG_CARTSLOT_EXTENSION_LIST("cas,p6") |
| 2328 | | MCFG_CARTSLOT_NOT_MANDATORY |
| 2329 | | MCFG_CARTSLOT_INTERFACE("pc6001_cass") |
| 2330 | | MCFG_CARTSLOT_LOAD(pc6001_state,pc6001_cass) |
| 2314 | // MCFG_CASSETTE_ADD("cassette", pc6001_cassette_interface) |
| 2315 | MCFG_GENERIC_CARTSLOT_ADD("cas_hack", generic_plain_slot, "pc6001_cass") |
| 2316 | MCFG_GENERIC_EXTENSIONS("cas,p6") |
| 2331 | 2317 | |
| 2332 | 2318 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 2333 | 2319 | MCFG_SOUND_ADD("ay8910", AY8910, PC6001_MAIN_CLOCK/4) |
| r32430 | r32431 | |
| 2405 | 2391 | ROM_RELOAD( 0x1000, 0x1000 ) |
| 2406 | 2392 | |
| 2407 | 2393 | ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF ) |
| 2408 | | |
| 2409 | | ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF ) |
| 2410 | | |
| 2411 | | ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 ) |
| 2412 | | ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_OPTIONAL | ROM_MIRROR) |
| 2413 | 2394 | ROM_END |
| 2414 | 2395 | |
| 2415 | 2396 | ROM_START( pc6001a ) |
| r32430 | r32431 | |
| 2423 | 2404 | ROM_LOAD( "cgrom60.60a", 0x0000, 0x1000, CRC(49c21d08) SHA1(9454d6e2066abcbd051bad9a29a5ca27b12ec897) ) |
| 2424 | 2405 | |
| 2425 | 2406 | ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF ) |
| 2426 | | |
| 2427 | | ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF ) |
| 2428 | | |
| 2429 | | ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 ) |
| 2430 | | ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_OPTIONAL | ROM_MIRROR) |
| 2431 | 2407 | ROM_END |
| 2432 | 2408 | |
| 2433 | 2409 | ROM_START( pc6001mk2 ) |
| r32430 | r32431 | |
| 2439 | 2415 | ROM_LOAD( "kanjirom.62", 0x20000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) ) |
| 2440 | 2416 | // work ram 0x28000,0x10000 |
| 2441 | 2417 | // extended work ram 0x38000,0x10000 |
| 2442 | | ROM_CART_LOAD("cart", 0x48000, 0x4000, ROM_OPTIONAL | ROM_MIRROR) |
| 2418 | // exrom 0x48000, 0x4000 |
| 2443 | 2419 | // <invalid> 0x4c000, 0x4000 |
| 2444 | 2420 | |
| 2445 | 2421 | ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) |
| r32430 | r32431 | |
| 2450 | 2426 | |
| 2451 | 2427 | ROM_REGION( 0x8000, "gfx2", 0 ) |
| 2452 | 2428 | ROM_COPY( "maincpu", 0x20000, 0x00000, 0x8000 ) |
| 2453 | | |
| 2454 | | ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF ) |
| 2455 | | |
| 2456 | | ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 ) |
| 2457 | | ROM_COPY( "maincpu", 0x48000, 0x0000, 0x4000 ) |
| 2458 | 2429 | ROM_END |
| 2459 | 2430 | |
| 2460 | 2431 | ROM_START( pc6601 ) /* Variant of pc6001m2 */ |
| r32430 | r32431 | |
| 2464 | 2435 | ROM_LOAD( "cgrom60.66", 0x1c000, 0x2000, CRC(d2434f29) SHA1(a56d76f5cbdbcdb8759abe601eab68f01b0a8fe8) ) |
| 2465 | 2436 | ROM_LOAD( "cgrom66.66", 0x1e000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) ) |
| 2466 | 2437 | ROM_LOAD( "kanjirom.66", 0x20000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) ) |
| 2467 | | ROM_CART_LOAD("cart", 0x48000, 0x4000, ROM_OPTIONAL | ROM_MIRROR) |
| 2438 | // exrom 0x48000, 0x4000 |
| 2468 | 2439 | |
| 2469 | 2440 | ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) |
| 2470 | 2441 | ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP ) |
| r32430 | r32431 | |
| 2474 | 2445 | |
| 2475 | 2446 | ROM_REGION( 0x8000, "gfx2", 0 ) |
| 2476 | 2447 | ROM_COPY( "maincpu", 0x20000, 0x00000, 0x8000 ) |
| 2477 | | |
| 2478 | | ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF ) |
| 2479 | | |
| 2480 | | ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 ) |
| 2481 | | ROM_COPY( "maincpu", 0x48000, 0x0000, 0x4000 ) |
| 2482 | 2448 | ROM_END |
| 2483 | 2449 | |
| 2484 | 2450 | ROM_START( pc6001sr ) |
| r32430 | r32431 | |
| 2500 | 2466 | |
| 2501 | 2467 | ROM_REGION( 0x8000, "gfx2", 0 ) |
| 2502 | 2468 | ROM_COPY( "maincpu", 0x28000, 0x00000, 0x8000 ) |
| 2503 | | |
| 2504 | | ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF ) |
| 2505 | | |
| 2506 | | ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 ) |
| 2507 | | ROM_COPY( "maincpu", 0x48000, 0x0000, 0x4000 ) |
| 2508 | 2469 | ROM_END |
| 2509 | 2470 | |
| 2510 | 2471 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
trunk/src/mess/drivers/socrates.c
| r32430 | r32431 | |
| 106 | 106 | #include "emu.h" |
| 107 | 107 | #include "cpu/z80/z80.h" |
| 108 | 108 | #include "audio/socrates.h" |
| 109 | | #include "imagedev/cartslot.h" |
| 109 | #include "bus/generic/slot.h" |
| 110 | #include "bus/generic/carts.h" |
| 110 | 111 | |
| 111 | | |
| 112 | 112 | class socrates_state : public driver_device |
| 113 | 113 | { |
| 114 | 114 | public: |
| r32430 | r32431 | |
| 122 | 122 | : driver_device(mconfig, type, tag), |
| 123 | 123 | m_maincpu(*this, "maincpu"), |
| 124 | 124 | m_sound(*this, "soc_snd"), |
| 125 | | m_screen(*this, "screen") |
| 125 | m_screen(*this, "screen"), |
| 126 | m_cart(*this, "cartslot"), |
| 127 | m_bios_reg(*this, "maincpu"), |
| 128 | m_vram_reg(*this, "vram") |
| 126 | 129 | { } |
| 127 | 130 | required_device<cpu_device> m_maincpu; |
| 128 | 131 | required_device<socrates_snd_device> m_sound; |
| 129 | 132 | required_device<screen_device> m_screen; |
| 133 | required_device<generic_slot_device> m_cart; |
| 130 | 134 | |
| 131 | 135 | rgb_t m_palette_val[256]; |
| 132 | 136 | |
| 137 | required_memory_region m_bios_reg; |
| 138 | required_memory_region m_vram_reg; |
| 139 | memory_region *m_cart_reg; |
| 140 | |
| 133 | 141 | UINT8 m_data[8]; |
| 134 | 142 | UINT8 m_rom_bank; |
| 135 | 143 | UINT8 m_ram_bank; |
| 136 | 144 | UINT16 m_scroll_offset; |
| 137 | | UINT8* m_videoram; |
| 138 | 145 | UINT8 m_kb_latch_low[2]; |
| 139 | 146 | UINT8 m_kb_latch_high[2]; |
| 140 | 147 | UINT8 m_kb_latch_mouse; |
| r32430 | r32431 | |
| 235 | 242 | |
| 236 | 243 | /* Devices */ |
| 237 | 244 | |
| 238 | | void socrates_state::socrates_set_rom_bank( ) |
| 245 | void socrates_state::socrates_set_rom_bank() |
| 239 | 246 | { |
| 240 | | membank( "bank1" )->set_base( memregion("maincpu")->base() + ( m_rom_bank * 0x4000 )); |
| 247 | if (m_cart_reg && m_rom_bank >= 0x10) |
| 248 | { |
| 249 | int bank = m_rom_bank % (m_cart->get_rom_size() / 0x4000); |
| 250 | membank("bank1")->set_base(m_cart_reg->base() + (bank * 0x4000)); |
| 251 | } |
| 252 | else |
| 253 | membank("bank1")->set_base(m_bios_reg->base() + (m_rom_bank * 0x4000)); |
| 241 | 254 | } |
| 242 | 255 | |
| 243 | | void socrates_state::socrates_set_ram_bank( ) |
| 256 | void socrates_state::socrates_set_ram_bank() |
| 244 | 257 | { |
| 245 | | membank( "bank2" )->set_base( memregion("vram")->base() + ( (m_ram_bank&0x3) * 0x4000 )); // window 0 |
| 246 | | membank( "bank3" )->set_base( memregion("vram")->base() + ( ((m_ram_bank&0xC)>>2) * 0x4000 )); // window 1 |
| 258 | membank("bank2")->set_base(m_vram_reg->base() + ( (m_ram_bank & 0x3) * 0x4000)); // window 0 |
| 259 | membank("bank3")->set_base(m_vram_reg->base() + (((m_ram_bank & 0xc) >> 2) * 0x4000)); // window 1 |
| 247 | 260 | } |
| 248 | 261 | |
| 249 | 262 | void socrates_state::socrates_update_kb( ) |
| r32430 | r32431 | |
| 304 | 317 | |
| 305 | 318 | void socrates_state::machine_reset() |
| 306 | 319 | { |
| 320 | astring region_tag; |
| 321 | m_cart_reg = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); |
| 322 | |
| 307 | 323 | m_rom_bank = 0xF3; // actually set semi-randomly on real console but we need to initialize it somewhere... |
| 308 | 324 | socrates_set_rom_bank(); |
| 309 | 325 | m_ram_bank = 0; // the actual console sets it semi randomly on power up, and the bios cleans it up. |
| r32430 | r32431 | |
| 343 | 359 | DRIVER_INIT_MEMBER(socrates_state,socrates) |
| 344 | 360 | { |
| 345 | 361 | UINT8 *gfx = memregion("vram")->base(); |
| 346 | | int i; |
| 362 | |
| 347 | 363 | /* fill vram with its init powerup bit pattern, so startup has the checkerboard screen */ |
| 348 | | for (i = 0; i < 0x10000; i++) |
| 364 | for (int i = 0; i < 0x10000; i++) |
| 349 | 365 | gfx[i] = (((i&0x1)?0x00:0xFF)^((i&0x100)?0x00:0xff)); |
| 350 | 366 | // init sound channels to both be on lowest pitch and max volume |
| 351 | 367 | m_maincpu->set_clock_scale(0.45f); /* RAM access waitstates etc. aren't emulated - slow the CPU to compensate */ |
| r32430 | r32431 | |
| 714 | 730 | |
| 715 | 731 | void socrates_state::video_start() |
| 716 | 732 | { |
| 717 | | m_videoram = memregion("vram")->base(); |
| 718 | 733 | m_scroll_offset = 0; |
| 719 | 734 | } |
| 720 | 735 | |
| r32430 | r32431 | |
| 724 | 739 | { |
| 725 | 740 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0xF7 |
| 726 | 741 | }; |
| 742 | UINT8 *videoram = m_vram_reg->base(); |
| 727 | 743 | int x, y, colidx, color; |
| 728 | 744 | int lineoffset = 0; // if display ever tries to display data at 0xfxxx, offset line displayed by 0x1000 |
| 729 | 745 | for (y = 0; y < 228; y++) |
| r32430 | r32431 | |
| 733 | 749 | { |
| 734 | 750 | if (x < 256) |
| 735 | 751 | { |
| 736 | | colidx = m_videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff]; |
| 752 | colidx =videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff]; |
| 737 | 753 | if (x&1) colidx >>=4; |
| 738 | 754 | colidx &= 0xF; |
| 739 | | if (colidx > 7) color=m_videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; |
| 755 | if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; |
| 740 | 756 | else color=fixedcolors[colidx]; |
| 741 | 757 | bitmap.pix16(y, x) = color; |
| 742 | 758 | } |
| 743 | 759 | else |
| 744 | 760 | { |
| 745 | | colidx = m_videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff]; |
| 761 | colidx = videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff]; |
| 746 | 762 | colidx >>=4; |
| 747 | 763 | colidx &= 0xF; |
| 748 | | if (colidx > 7) color=m_videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; |
| 764 | if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; |
| 749 | 765 | else color=fixedcolors[colidx]; |
| 750 | 766 | bitmap.pix16(y, x) = color; |
| 751 | 767 | } |
| r32430 | r32431 | |
| 791 | 807 | if (index < 8) |
| 792 | 808 | return m_colors[index]; |
| 793 | 809 | else |
| 794 | | return m_videoram[0xf000 + ((index & 0x0f) << 8) + ((m_scroll_offset + y + 1) & 0xff)]; |
| 810 | return m_vram_reg->u8(0xf000 + ((index & 0x0f) << 8) + ((m_scroll_offset + y + 1) & 0xff)); |
| 795 | 811 | } |
| 796 | 812 | |
| 797 | 813 | UINT32 iqunlim_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 798 | 814 | { |
| 815 | UINT8 *videoram = m_vram_reg->base(); |
| 816 | |
| 799 | 817 | // bitmap layer |
| 800 | 818 | for (int y=0; y<224; y++) |
| 801 | 819 | { |
| 802 | 820 | if (y >= m_video_regs[0x03]) break; |
| 803 | 821 | for (int x=0; x<128; x++) |
| 804 | 822 | { |
| 805 | | UINT8 data = m_videoram[(m_scroll_offset + y) * 0x80 + x]; |
| 823 | UINT8 data = videoram[(m_scroll_offset + y) * 0x80 + x]; |
| 806 | 824 | |
| 807 | 825 | for(int b=0; b<2; b++) |
| 808 | 826 | { |
| r32430 | r32431 | |
| 819 | 837 | { |
| 820 | 838 | for (int x=0; x<line_len; x++) |
| 821 | 839 | { |
| 822 | | UINT8 c = m_videoram[0x8400 + (y - 1) * (mode_80 ? 0x80 : 0x40) + x]; |
| 823 | | UINT8 *gfx = &m_videoram[0x8000 + (c & 0x7f) * 8]; |
| 840 | UINT8 c = videoram[0x8400 + (y - 1) * (mode_80 ? 0x80 : 0x40) + x]; |
| 841 | UINT8 *gfx = &videoram[0x8000 + (c & 0x7f) * 8]; |
| 824 | 842 | |
| 825 | 843 | for (int cy=0; cy<8; cy++) |
| 826 | 844 | { |
| r32430 | r32431 | |
| 878 | 896 | |
| 879 | 897 | void iqunlim_state::machine_start() |
| 880 | 898 | { |
| 881 | | UINT8 *bios = memregion("bios")->base(); |
| 882 | | UINT8 *cart = memregion("cart")->base(); |
| 883 | | UINT8 *ram = memregion("vram")->base(); |
| 899 | astring region_tag; |
| 900 | m_cart_reg = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); |
| 901 | |
| 902 | UINT8 *bios = m_bios_reg->base(); |
| 903 | UINT8 *cart = m_cart_reg ? m_cart_reg->base() : m_bios_reg->base(); |
| 904 | UINT8 *ram = m_vram_reg->base(); |
| 905 | |
| 884 | 906 | m_bank1->configure_entries(0x00, 0x10, bios, 0x4000); |
| 885 | 907 | m_bank1->configure_entries(0x10, 0x10, cart , 0x4000); |
| 886 | 908 | m_bank1->configure_entries(0x20, 0x10, bios + 0x40000, 0x4000); |
| 887 | | m_bank1->configure_entries(0x30, 0x10, cart + 0x40000 , 0x4000); |
| 909 | m_bank1->configure_entries(0x30, 0x10, cart + 0x40000, 0x4000); |
| 888 | 910 | |
| 889 | 911 | m_bank2->configure_entries(0x00, 0x10, bios, 0x4000); |
| 890 | 912 | m_bank2->configure_entries(0x10, 0x10, cart , 0x4000); |
| 891 | 913 | m_bank2->configure_entries(0x20, 0x10, bios + 0x40000, 0x4000); |
| 892 | | m_bank2->configure_entries(0x30, 0x10, cart + 0x40000 , 0x4000); |
| 914 | m_bank2->configure_entries(0x30, 0x10, cart + 0x40000, 0x4000); |
| 893 | 915 | |
| 894 | 916 | m_bank3->configure_entries(0x00, 0x08, ram, 0x4000); |
| 895 | 917 | m_bank4->configure_entries(0x00, 0x08, ram, 0x4000); |
| r32430 | r32431 | |
| 998 | 1020 | AM_RANGE(0x00, 0x00) AM_READWRITE(socrates_rom_bank_r, socrates_rom_bank_w) AM_MIRROR(0x7) /* rom bank select - RW - 8 bits */ |
| 999 | 1021 | AM_RANGE(0x08, 0x08) AM_READWRITE(socrates_ram_bank_r, socrates_ram_bank_w) AM_MIRROR(0x7) /* ram banks select - RW - 4 low bits; Format: 0b****HHLL where LL controls whether window 0 points at ram area: 0b00: 0x0000-0x3fff; 0b01: 0x4000-0x7fff; 0b10: 0x8000-0xbfff; 0b11: 0xc000-0xffff. HH controls the same thing for window 1 */ |
| 1000 | 1022 | AM_RANGE(0x10, 0x17) AM_READWRITE(read_f3, socrates_sound_w) AM_MIRROR (0x8) /* sound section: |
| 1001 | | 0x10 - W - frequency control for channel 1 (louder channel) - 01=high pitch, ff=low; time between 1->0/0->1 transitions = (XTAL_21_4772MHz/(512+256) / (freq_reg+1)) (note that this is double the actual frequency since each full low and high squarewave pulse is two transitions) |
| 1023 | 0x10 - W - frequency control for channel 1 (louder channel) - 01=high pitch, ff=low; time between 1->0/0->1 transitions = (XTAL_21_4772MHz/(512+256) / (freq_reg+1)) (note that this is double the actual frequency since each full low and high squarewave pulse is two transitions) |
| 1002 | 1024 | 0x11 - W - frequency control for channel 2 (softer channel) - 01=high pitch, ff=low; same equation as above |
| 1003 | 1025 | 0x12 - W - 0b***EVVVV enable, volume control for channel 1 |
| 1004 | 1026 | 0x13 - W - 0b***EVVVV enable, volume control for channel 2 |
| r32430 | r32431 | |
| 1386 | 1408 | MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_21_4772MHz/(512+256)) // this is correct, as strange as it sounds. |
| 1387 | 1409 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 1388 | 1410 | |
| 1389 | | MCFG_CARTSLOT_ADD("cart") |
| 1390 | | MCFG_CARTSLOT_EXTENSION_LIST("bin") |
| 1391 | | MCFG_CARTSLOT_NOT_MANDATORY |
| 1392 | | MCFG_CARTSLOT_INTERFACE("socrates_cart") |
| 1411 | MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "socrates_cart") |
| 1393 | 1412 | |
| 1394 | 1413 | /* Software lists */ |
| 1395 | 1414 | MCFG_SOFTWARE_LIST_ADD("cart_list", "socrates") |
| r32430 | r32431 | |
| 1421 | 1440 | MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_26_601712MHz/(512+256)) // TODO: verify divider for pal mode |
| 1422 | 1441 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 1423 | 1442 | |
| 1424 | | MCFG_CARTSLOT_ADD("cart") |
| 1425 | | MCFG_CARTSLOT_EXTENSION_LIST("bin") |
| 1426 | | MCFG_CARTSLOT_NOT_MANDATORY |
| 1427 | | MCFG_CARTSLOT_INTERFACE("socrates_cart") |
| 1443 | MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "socrates_cart") |
| 1428 | 1444 | |
| 1429 | 1445 | /* Software lists */ |
| 1430 | 1446 | MCFG_SOFTWARE_LIST_ADD("cart_list", "socrates") |
| r32430 | r32431 | |
| 1468 | 1484 | MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_21_4772MHz/(512+256)) |
| 1469 | 1485 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 1470 | 1486 | |
| 1471 | | MCFG_CARTSLOT_ADD("cart") |
| 1472 | | MCFG_CARTSLOT_EXTENSION_LIST("bin") |
| 1473 | | MCFG_CARTSLOT_NOT_MANDATORY |
| 1487 | MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL) |
| 1474 | 1488 | MACHINE_CONFIG_END |
| 1475 | 1489 | |
| 1476 | 1490 | /****************************************************************************** |
| r32430 | r32431 | |
| 1514 | 1528 | if all tests passed, jump to 0x4000 (0x0000 in cart rom) |
| 1515 | 1529 | */ |
| 1516 | 1530 | ROM_LOAD("27-00817-000-000.u1", 0x00000, 0x40000, CRC(80f5aa20) SHA1(4fd1ff7f78b5dd2582d5de6f30633e4e4f34ca8f)) // Label: "(Vtech) 27-00817-000-000 // (C)1987 VIDEO TECHNOLOGY // 8811 D" |
| 1517 | | ROM_CART_LOAD( "cart", 0x40000, 0x20000, 0 ) |
| 1518 | 1531 | |
| 1519 | 1532 | ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */ |
| 1520 | 1533 | |
| r32430 | r32431 | |
| 1536 | 1549 | ROM_REGION(0x80000, "maincpu", ROMREGION_ERASEVAL(0xF3)) |
| 1537 | 1550 | /* Socrates SAITOUT (French Canadian) NTSC */ |
| 1538 | 1551 | ROM_LOAD("27-00884-001-000.u1", 0x00000, 0x40000, CRC(042d9d21) SHA1(9ffc67b2721683b2536727d0592798fbc4d061cb)) // Label: "(Vtech) 27-00884-001-000 // (C)1988 VIDEO TECHNOLOGY // 8911 D" |
| 1539 | | ROM_CART_LOAD( "cart", 0x40000, 0x20000, 0 ) |
| 1540 | 1552 | |
| 1541 | 1553 | ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */ |
| 1542 | 1554 | |
| r32430 | r32431 | |
| 1560 | 1572 | ROMX_LOAD("lh53216d.u1", 0x00000, 0x40000, CRC(6e801762) SHA1(b80574a3abacf18133dacb9d3a8d9e2916730423), ROM_BIOS(1)) // Label: "(Vtech) LH53216D // (C)1989 VIDEO TECHNOLOGY // 9119 D" |
| 1561 | 1573 | ROM_SYSTEM_BIOS(1, "88", "1988") |
| 1562 | 1574 | ROMX_LOAD("27-00885-001-000.u1", 0x00000, 0x40000, CRC(fcaf8850) SHA1(a99011ee6a1ef63461c00d062278951252f117db), ROM_BIOS(2)) // Label: "(Vtech) 27-00884-001-000 // (C)1988 VIDEO TECHNOLOGY // 8911 D" |
| 1563 | | ROM_CART_LOAD( "cart", 0x40000, 0x20000, 0 ) |
| 1564 | 1575 | |
| 1565 | 1576 | ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */ |
| 1566 | 1577 | |
| r32430 | r32431 | |
| 1576 | 1587 | ROM_END |
| 1577 | 1588 | |
| 1578 | 1589 | ROM_START( iqunlimz ) |
| 1579 | | ROM_REGION( 0x80000, "bios", 0 ) |
| 1590 | ROM_REGION( 0x80000, "maincpu", 0 ) |
| 1580 | 1591 | ROM_LOAD( "vtech.bin", 0x000000, 0x080000, CRC(f100c8a7) SHA1(6ad2a8accae2dd5c5c46ae953eef33cdd1ea3cf9) ) |
| 1581 | 1592 | |
| 1582 | | ROM_REGION( 0x80000, "cart", ROMREGION_ERASEFF ) |
| 1583 | | ROM_CART_LOAD( "cart", 0, 0x80000, 0 ) |
| 1584 | | |
| 1585 | 1593 | ROM_REGION( 0x20000, "vram", ROMREGION_ERASE ) |
| 1586 | 1594 | ROM_END |
| 1587 | 1595 | |
trunk/src/mess/drivers/beta.c
| r32430 | r32431 | |
| 25 | 25 | |
| 26 | 26 | TODO: |
| 27 | 27 | |
| 28 | | - write EPROM back to file |
| 28 | - verify whether feeding a 0xff-filled 2K binary file as cart allows |
| 29 | to write back correctly EPROM or not |
| 29 | 30 | |
| 30 | 31 | */ |
| 31 | 32 | |
| 32 | | #include "includes/beta.h" |
| 33 | #include "emu.h" |
| 34 | #include "cpu/m6502/m6502.h" |
| 35 | #include "machine/6532riot.h" |
| 36 | #include "machine/ram.h" |
| 37 | #include "sound/speaker.h" |
| 38 | |
| 39 | #include "bus/generic/slot.h" |
| 40 | #include "bus/generic/carts.h" |
| 41 | |
| 33 | 42 | #include "beta.lh" |
| 34 | 43 | |
| 44 | #define SCREEN_TAG "screen" |
| 45 | #define M6502_TAG "m6502" |
| 46 | #define M6532_TAG "m6532" |
| 47 | #define EPROM_TAG "eprom" |
| 48 | //#define SPEAKER_TAG "b237" |
| 49 | |
| 50 | class beta_state : public driver_device |
| 51 | { |
| 52 | public: |
| 53 | beta_state(const machine_config &mconfig, device_type type, const char *tag) |
| 54 | : driver_device(mconfig, type, tag), |
| 55 | m_maincpu(*this, M6502_TAG), |
| 56 | m_speaker(*this, "speaker"), |
| 57 | m_eprom(*this, EPROM_TAG), |
| 58 | m_q6(*this, "Q6"), |
| 59 | m_q7(*this, "Q7"), |
| 60 | m_q8(*this, "Q8"), |
| 61 | m_q9(*this, "Q9") |
| 62 | { } |
| 63 | |
| 64 | required_device<cpu_device> m_maincpu; |
| 65 | required_device<speaker_sound_device> m_speaker; |
| 66 | required_device<generic_slot_device> m_eprom; |
| 67 | required_ioport m_q6; |
| 68 | required_ioport m_q7; |
| 69 | required_ioport m_q8; |
| 70 | required_ioport m_q9; |
| 71 | |
| 72 | virtual void machine_start(); |
| 73 | |
| 74 | DECLARE_READ8_MEMBER( riot_pa_r ); |
| 75 | DECLARE_WRITE8_MEMBER( riot_pa_w ); |
| 76 | DECLARE_READ8_MEMBER( riot_pb_r ); |
| 77 | DECLARE_WRITE8_MEMBER( riot_pb_w ); |
| 78 | DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); |
| 79 | |
| 80 | DECLARE_DEVICE_IMAGE_LOAD_MEMBER( beta_eprom ); |
| 81 | DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( beta_eprom ); |
| 82 | |
| 83 | /* EPROM state */ |
| 84 | int m_eprom_oe; |
| 85 | int m_eprom_ce; |
| 86 | UINT16 m_eprom_addr; |
| 87 | UINT8 m_eprom_data; |
| 88 | UINT8 m_old_data; |
| 89 | dynamic_buffer m_eprom_rom; |
| 90 | |
| 91 | /* display state */ |
| 92 | UINT8 m_ls145_p; |
| 93 | UINT8 m_segment; |
| 94 | |
| 95 | emu_timer *m_led_refresh_timer; |
| 96 | TIMER_CALLBACK_MEMBER(led_refresh); |
| 97 | }; |
| 98 | |
| 99 | |
| 35 | 100 | /* Memory Maps */ |
| 36 | 101 | |
| 37 | 102 | static ADDRESS_MAP_START( beta_mem, AS_PROGRAM, 8, beta_state ) |
| r32430 | r32431 | |
| 122 | 187 | default: |
| 123 | 188 | if (!m_eprom_oe && !m_eprom_ce) |
| 124 | 189 | { |
| 125 | | data = m_eprom->base()[m_eprom_addr & 0x7ff]; |
| 190 | data = m_eprom_rom[m_eprom_addr & 0x7ff]; |
| 126 | 191 | popmessage("EPROM read %04x = %02x\n", m_eprom_addr & 0x7ff, data); |
| 127 | 192 | } |
| 128 | 193 | } |
| r32430 | r32431 | |
| 209 | 274 | if (BIT(data, 6) && (!BIT(m_old_data, 7) && BIT(data, 7))) |
| 210 | 275 | { |
| 211 | 276 | popmessage("EPROM write %04x = %02x\n", m_eprom_addr & 0x7ff, m_eprom_data); |
| 212 | | m_eprom->base()[m_eprom_addr & 0x7ff] &= m_eprom_data; |
| 277 | m_eprom_rom[m_eprom_addr & 0x7ff] &= m_eprom_data; |
| 213 | 278 | } |
| 214 | 279 | |
| 215 | 280 | m_old_data = data; |
| 216 | 281 | } |
| 217 | 282 | |
| 218 | | /* Quickload */ |
| 283 | /* EPROM socket */ |
| 219 | 284 | |
| 285 | DEVICE_IMAGE_LOAD_MEMBER( beta_state, beta_eprom ) |
| 286 | { |
| 287 | UINT32 size = m_eprom->common_get_size("rom"); |
| 288 | |
| 289 | if (size != 0x800) |
| 290 | { |
| 291 | image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); |
| 292 | return IMAGE_INIT_FAIL; |
| 293 | } |
| 294 | |
| 295 | m_eprom->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); |
| 296 | m_eprom->common_load_rom(m_eprom->get_rom_base(), size, "rom"); |
| 297 | |
| 298 | return IMAGE_INIT_PASS; |
| 299 | } |
| 300 | |
| 220 | 301 | DEVICE_IMAGE_UNLOAD_MEMBER( beta_state, beta_eprom ) |
| 221 | 302 | { |
| 222 | | UINT8 *ptr = m_eprom->base(); |
| 223 | | |
| 224 | | image.fwrite(ptr, 0x800); |
| 303 | if (image.software_entry() == NULL) |
| 304 | image.fwrite(m_eprom_rom, 0x800); |
| 225 | 305 | } |
| 226 | 306 | |
| 227 | 307 | /* Machine Initialization */ |
| r32430 | r32431 | |
| 230 | 310 | { |
| 231 | 311 | m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(beta_state::led_refresh),this)); |
| 232 | 312 | |
| 313 | m_eprom_rom.resize(0x800); |
| 314 | |
| 315 | if (!m_eprom->exists()) |
| 316 | memset(m_eprom_rom, 0xff, 0x800); |
| 317 | else |
| 318 | { |
| 319 | astring region_tag; |
| 320 | memcpy(m_eprom_rom, memregion(region_tag.cpy(m_eprom->tag()).cat(GENERIC_ROM_REGION_TAG))->base(), 0x800); |
| 321 | } |
| 322 | |
| 233 | 323 | // state saving |
| 234 | 324 | save_item(NAME(m_eprom_oe)); |
| 235 | 325 | save_item(NAME(m_eprom_ce)); |
| 236 | 326 | save_item(NAME(m_eprom_addr)); |
| 237 | 327 | save_item(NAME(m_eprom_data)); |
| 238 | 328 | save_item(NAME(m_old_data)); |
| 329 | save_item(NAME(m_eprom_rom)); |
| 239 | 330 | save_item(NAME(m_ls145_p)); |
| 240 | 331 | save_item(NAME(m_segment)); |
| 241 | 332 | } |
| r32430 | r32431 | |
| 264 | 355 | MCFG_RIOT6532_IRQ_CB(INPUTLINE(M6502_TAG, M6502_IRQ_LINE)) |
| 265 | 356 | |
| 266 | 357 | /* EPROM socket */ |
| 267 | | MCFG_CARTSLOT_ADD(EPROM_TAG) |
| 268 | | MCFG_CARTSLOT_EXTENSION_LIST("bin,rom") |
| 269 | | MCFG_CARTSLOT_NOT_MANDATORY |
| 270 | | MCFG_CARTSLOT_UNLOAD(beta_state,beta_eprom) |
| 358 | MCFG_GENERIC_CARTSLOT_ADD(EPROM_TAG, generic_plain_slot, NULL) |
| 359 | MCFG_GENERIC_EXTENSIONS("bin,rom") |
| 360 | MCFG_GENERIC_LOAD(beta_state, beta_eprom) |
| 361 | MCFG_GENERIC_UNLOAD(beta_state, beta_eprom) |
| 271 | 362 | |
| 272 | 363 | /* internal ram */ |
| 273 | 364 | MCFG_RAM_ADD(RAM_TAG) |
| r32430 | r32431 | |
| 279 | 370 | ROM_START( beta ) |
| 280 | 371 | ROM_REGION( 0x10000, M6502_TAG, 0 ) |
| 281 | 372 | ROM_LOAD( "beta.rom", 0x8000, 0x0800, CRC(d42fdb17) SHA1(595225a0cd43dd76c46b2aff6c0f27d5991cc4f0)) |
| 282 | | |
| 283 | | ROM_REGION( 0x800, EPROM_TAG, ROMREGION_ERASEFF ) |
| 284 | | ROM_CART_LOAD( EPROM_TAG, 0x0000, 0x0800, ROM_FULLSIZE ) |
| 285 | 373 | ROM_END |
| 286 | 374 | |
| 287 | 375 | /* System Drivers */ |
trunk/src/mess/drivers/pc8401a.c
| r32430 | r32431 | |
| 39 | 39 | |
| 40 | 40 | void pc8401a_state::scan_keyboard() |
| 41 | 41 | { |
| 42 | | int row, strobe = 0; |
| 42 | int strobe = 0; |
| 43 | 43 | |
| 44 | | UINT8 keydata[10] = { m_y0->read(), m_y1->read(), m_y2->read(), m_y3->read(), m_y4->read(), m_y5->read(), m_y6->read(), m_y7->read(), m_y8->read(), m_y9->read() }; |
| 45 | | |
| 46 | 44 | /* scan keyboard */ |
| 47 | | for (row = 0; row < 10; row++) |
| 45 | for (int row = 0; row < 10; row++) |
| 48 | 46 | { |
| 49 | | UINT8 data = keydata[row]; |
| 47 | UINT8 data = m_io_y[row]->read(); |
| 50 | 48 | |
| 51 | 49 | if (data != 0xff) |
| 52 | 50 | { |
| r32430 | r32431 | |
| 90 | 88 | program.unmap_write(0x0000, 0x7fff); |
| 91 | 89 | membank("bank1")->set_entry(rombank); |
| 92 | 90 | } |
| 93 | | else |
| 91 | else if (m_cart_rom) |
| 94 | 92 | { |
| 95 | 93 | /* ROM cartridge */ |
| 96 | | program.unmap_readwrite(0x0000, 0x7fff); |
| 94 | program.install_read_bank(0x0000, 0x7fff, "bank1"); |
| 95 | program.unmap_write(0x0000, 0x7fff); |
| 96 | membank("bank1")->set_entry(6); |
| 97 | 97 | } |
| 98 | else |
| 99 | program.unmap_readwrite(0x0000, 0x7fff); |
| 98 | 100 | //logerror("0x0000-0x7fff = ROM %u\n", rombank); |
| 99 | 101 | break; |
| 100 | 102 | |
| r32430 | r32431 | |
| 264 | 266 | READ8_MEMBER( pc8401a_state::io_rom_data_r ) |
| 265 | 267 | { |
| 266 | 268 | //logerror("I/O ROM read from %05x\n", m_io_addr); |
| 267 | | |
| 268 | | return m_io_rom->base()[m_io_addr]; |
| 269 | return m_io_cart->read_rom(space, m_io_addr); |
| 269 | 270 | } |
| 270 | 271 | |
| 271 | 272 | WRITE8_MEMBER( pc8401a_state::io_rom_addr_w ) |
| r32430 | r32431 | |
| 345 | 346 | static ADDRESS_MAP_START( pc8500_io, AS_IO, 8, pc8401a_state ) |
| 346 | 347 | ADDRESS_MAP_UNMAP_HIGH |
| 347 | 348 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 348 | | AM_RANGE(0x00, 0x00) AM_READ_PORT("Y0") |
| 349 | | AM_RANGE(0x01, 0x01) AM_READ_PORT("Y1") |
| 350 | | AM_RANGE(0x02, 0x02) AM_READ_PORT("Y2") |
| 351 | | AM_RANGE(0x03, 0x03) AM_READ_PORT("Y3") |
| 352 | | AM_RANGE(0x04, 0x04) AM_READ_PORT("Y4") |
| 353 | | AM_RANGE(0x05, 0x05) AM_READ_PORT("Y5") |
| 354 | | AM_RANGE(0x06, 0x06) AM_READ_PORT("Y6") |
| 355 | | AM_RANGE(0x07, 0x07) AM_READ_PORT("Y7") |
| 356 | | AM_RANGE(0x08, 0x08) AM_READ_PORT("Y8") |
| 357 | | AM_RANGE(0x09, 0x09) AM_READ_PORT("Y9") |
| 349 | AM_RANGE(0x00, 0x00) AM_READ_PORT("Y.0") |
| 350 | AM_RANGE(0x01, 0x01) AM_READ_PORT("Y.1") |
| 351 | AM_RANGE(0x02, 0x02) AM_READ_PORT("Y.2") |
| 352 | AM_RANGE(0x03, 0x03) AM_READ_PORT("Y.3") |
| 353 | AM_RANGE(0x04, 0x04) AM_READ_PORT("Y.4") |
| 354 | AM_RANGE(0x05, 0x05) AM_READ_PORT("Y.5") |
| 355 | AM_RANGE(0x06, 0x06) AM_READ_PORT("Y.6") |
| 356 | AM_RANGE(0x07, 0x07) AM_READ_PORT("Y.7") |
| 357 | AM_RANGE(0x08, 0x08) AM_READ_PORT("Y.8") |
| 358 | AM_RANGE(0x09, 0x09) AM_READ_PORT("Y.9") |
| 358 | 359 | AM_RANGE(0x10, 0x10) AM_WRITE(rtc_cmd_w) |
| 359 | 360 | AM_RANGE(0x20, 0x20) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) |
| 360 | 361 | AM_RANGE(0x21, 0x21) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) |
| r32430 | r32431 | |
| 382 | 383 | /* Input Ports */ |
| 383 | 384 | |
| 384 | 385 | static INPUT_PORTS_START( pc8401a ) |
| 385 | | PORT_START("Y0") |
| 386 | PORT_START("Y.0") |
| 386 | 387 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP")// PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 387 | 388 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 388 | 389 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| r32430 | r32431 | |
| 392 | 393 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 393 | 394 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 394 | 395 | |
| 395 | | PORT_START("Y1") |
| 396 | PORT_START("Y.1") |
| 396 | 397 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 397 | 398 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 398 | 399 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| r32430 | r32431 | |
| 402 | 403 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 403 | 404 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 404 | 405 | |
| 405 | | PORT_START("Y2") |
| 406 | PORT_START("Y.2") |
| 406 | 407 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 407 | 408 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 408 | 409 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| r32430 | r32431 | |
| 412 | 413 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 413 | 414 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 414 | 415 | |
| 415 | | PORT_START("Y3") |
| 416 | PORT_START("Y.3") |
| 416 | 417 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 417 | 418 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 418 | 419 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| r32430 | r32431 | |
| 422 | 423 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 423 | 424 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 424 | 425 | |
| 425 | | PORT_START("Y4") |
| 426 | PORT_START("Y.4") |
| 426 | 427 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('*') |
| 427 | 428 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('*') |
| 428 | 429 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('*') |
| r32430 | r32431 | |
| 432 | 433 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 433 | 434 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 434 | 435 | |
| 435 | | PORT_START("Y5") |
| 436 | PORT_START("Y.5") |
| 436 | 437 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('*') |
| 437 | 438 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('*') |
| 438 | 439 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('*') |
| r32430 | r32431 | |
| 442 | 443 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('*') |
| 443 | 444 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('*') |
| 444 | 445 | |
| 445 | | PORT_START("Y6") |
| 446 | PORT_START("Y.6") |
| 446 | 447 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('*') |
| 447 | 448 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('*') |
| 448 | 449 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('*') |
| r32430 | r32431 | |
| 452 | 453 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('*') |
| 453 | 454 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') |
| 454 | 455 | |
| 455 | | PORT_START("Y7") |
| 456 | PORT_START("Y.7") |
| 456 | 457 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 457 | 458 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ^I |
| 458 | 459 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) |
| r32430 | r32431 | |
| 462 | 463 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 463 | 464 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ^C |
| 464 | 465 | |
| 465 | | PORT_START("Y8") |
| 466 | PORT_START("Y.8") |
| 466 | 467 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 467 | 468 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) |
| 468 | 469 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) |
| r32430 | r32431 | |
| 472 | 473 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 473 | 474 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 474 | 475 | |
| 475 | | PORT_START("Y9") |
| 476 | PORT_START("Y.9") |
| 476 | 477 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) |
| 477 | 478 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) |
| 478 | 479 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) |
| r32430 | r32431 | |
| 487 | 488 | |
| 488 | 489 | void pc8401a_state::machine_start() |
| 489 | 490 | { |
| 491 | astring region_tag; |
| 492 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); |
| 493 | |
| 490 | 494 | /* initialize RTC */ |
| 491 | 495 | m_rtc->cs_w(1); |
| 492 | 496 | |
| r32430 | r32431 | |
| 498 | 502 | /* set up A0/A1 memory banking */ |
| 499 | 503 | membank("bank1")->configure_entries(0, 4, m_rom->base(), 0x8000); |
| 500 | 504 | membank("bank1")->configure_entries(4, 2, ram, 0x8000); |
| 505 | if (m_cart_rom) |
| 506 | membank("bank1")->configure_entries(6, 1, m_cart_rom->base(), 0x8000); |
| 501 | 507 | membank("bank1")->set_entry(0); |
| 502 | 508 | |
| 503 | 509 | /* set up A2 memory banking */ |
| r32430 | r32431 | |
| 515 | 521 | |
| 516 | 522 | /* bank switch */ |
| 517 | 523 | bankswitch(0); |
| 518 | | |
| 524 | |
| 519 | 525 | /* register for state saving */ |
| 520 | 526 | save_item(NAME(m_mmr)); |
| 521 | 527 | save_item(NAME(m_io_addr)); |
| r32430 | r32431 | |
| 590 | 596 | MCFG_FRAGMENT_ADD(pc8401a_video) |
| 591 | 597 | |
| 592 | 598 | /* option ROM cartridge */ |
| 593 | | MCFG_CARTSLOT_ADD("cart") |
| 594 | | MCFG_CARTSLOT_EXTENSION_LIST("rom,bin") |
| 595 | | MCFG_CARTSLOT_NOT_MANDATORY |
| 599 | MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL) |
| 600 | MCFG_GENERIC_EXTENSIONS("bin,rom") |
| 596 | 601 | |
| 597 | 602 | /* I/O ROM cartridge */ |
| 598 | | MCFG_CARTSLOT_ADD("iocart") |
| 599 | | MCFG_CARTSLOT_EXTENSION_LIST("rom,bin") |
| 600 | | MCFG_CARTSLOT_NOT_MANDATORY |
| 603 | MCFG_GENERIC_CARTSLOT_ADD("io_cart", generic_linear_slot, NULL) |
| 604 | MCFG_GENERIC_EXTENSIONS("bin,rom") |
| 601 | 605 | |
| 602 | 606 | /* internal ram */ |
| 603 | 607 | MCFG_RAM_ADD(RAM_TAG) |
| r32430 | r32431 | |
| 634 | 638 | MCFG_FRAGMENT_ADD(pc8500_video) |
| 635 | 639 | |
| 636 | 640 | /* option ROM cartridge */ |
| 637 | | MCFG_CARTSLOT_ADD("cart") |
| 638 | | MCFG_CARTSLOT_EXTENSION_LIST("rom,bin") |
| 639 | | MCFG_CARTSLOT_NOT_MANDATORY |
| 641 | MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL) |
| 642 | MCFG_GENERIC_EXTENSIONS("bin,rom") |
| 640 | 643 | |
| 641 | 644 | /* I/O ROM cartridge */ |
| 642 | | MCFG_CARTSLOT_ADD("iocart") |
| 643 | | MCFG_CARTSLOT_EXTENSION_LIST("rom,bin") |
| 644 | | MCFG_CARTSLOT_NOT_MANDATORY |
| 645 | MCFG_GENERIC_CARTSLOT_ADD("io_cart", generic_linear_slot, NULL) |
| 646 | MCFG_GENERIC_EXTENSIONS("bin,rom") |
| 645 | 647 | |
| 646 | 648 | /* internal ram */ |
| 647 | 649 | MCFG_RAM_ADD(RAM_TAG) |
| r32430 | r32431 | |
| 654 | 656 | ROM_START( pc8401a ) |
| 655 | 657 | ROM_REGION( 0x20000, Z80_TAG, ROMREGION_ERASEFF ) |
| 656 | 658 | ROM_LOAD( "pc8401a.bin", 0x0000, 0x18000, NO_DUMP ) |
| 657 | | ROM_CART_LOAD("cart", 0x18000, 0x8000, ROM_NOMIRROR | ROM_OPTIONAL) |
| 658 | 659 | |
| 659 | 660 | ROM_REGION( 0x1000, "chargen", 0 ) |
| 660 | 661 | ROM_LOAD( "pc8441a.bin", 0x0000, 0x1000, NO_DUMP ) |
| 661 | | |
| 662 | | ROM_REGION( 0x40000, "iorom", ROMREGION_ERASEFF ) |
| 663 | | ROM_CART_LOAD("iocart", 0x00000, 0x40000, ROM_NOMIRROR | ROM_OPTIONAL) |
| 664 | 662 | ROM_END |
| 665 | 663 | |
| 666 | 664 | ROM_START( pc8500 ) |
| 667 | 665 | ROM_REGION( 0x20000, Z80_TAG, ROMREGION_ERASEFF ) |
| 668 | 666 | ROM_LOAD( "pc8500.bin", 0x0000, 0x10000, CRC(c2749ef0) SHA1(f766afce9fda9ec84ed5b39ebec334806798afb3) ) |
| 669 | | ROM_CART_LOAD("cart", 0x18000, 0x8000, ROM_NOMIRROR | ROM_OPTIONAL) |
| 670 | 667 | |
| 671 | 668 | ROM_REGION( 0x1000, "chargen", 0 ) |
| 672 | 669 | ROM_LOAD( "pc8441a.bin", 0x0000, 0x1000, NO_DUMP ) |
| 673 | | |
| 674 | | ROM_REGION( 0x40000, "iorom", ROMREGION_ERASEFF ) |
| 675 | | ROM_CART_LOAD("iocart", 0x00000, 0x40000, ROM_NOMIRROR | ROM_OPTIONAL) |
| 676 | 670 | ROM_END |
| 677 | 671 | |
| 678 | 672 | /* System Drivers */ |