trunk/src/devices/sound/es5506.cpp
| r252872 | r252873 | |
| 195 | 195 | m_stream = machine().sound().stream_alloc(*this, 0, 2 * channels, clock() / (16*32)); |
| 196 | 196 | |
| 197 | 197 | /* initialize the regions */ |
| 198 | | m_region_base[0] = m_region0 ? (UINT16 *)machine().root_device().memregion(m_region0)->base() : nullptr; |
| 199 | | m_region_base[1] = m_region1 ? (UINT16 *)machine().root_device().memregion(m_region1)->base() : nullptr; |
| 200 | | m_region_base[2] = m_region2 ? (UINT16 *)machine().root_device().memregion(m_region2)->base() : nullptr; |
| 201 | | m_region_base[3] = m_region3 ? (UINT16 *)machine().root_device().memregion(m_region3)->base() : nullptr; |
| 198 | m_region_base[0] = m_region_base[1] = m_region_base[2] = m_region_base[3] = nullptr; |
| 199 | if (m_region0) |
| 200 | { |
| 201 | memory_region *region0 = machine().root_device().memregion(m_region0); |
| 202 | if (region0 != nullptr) |
| 203 | { |
| 204 | m_region_base[0] = (UINT16 *)region0->base(); |
| 205 | } |
| 206 | } |
| 207 | if (m_region1) |
| 208 | { |
| 209 | memory_region *region1 = machine().root_device().memregion(m_region1); |
| 210 | if (region1 != nullptr) |
| 211 | { |
| 212 | m_region_base[1] = (UINT16 *)region1->base(); |
| 213 | } |
| 214 | } |
| 215 | if (m_region2) |
| 216 | { |
| 217 | memory_region *region2 = machine().root_device().memregion(m_region2); |
| 218 | if (region2 != nullptr) |
| 219 | { |
| 220 | m_region_base[2] = (UINT16 *)region2->base(); |
| 221 | } |
| 222 | } |
| 223 | if (m_region3) |
| 224 | { |
| 225 | memory_region *region3 = machine().root_device().memregion(m_region3); |
| 226 | if (region3 != nullptr) |
| 227 | { |
| 228 | m_region_base[3] = (UINT16 *)region3->base(); |
| 229 | } |
| 230 | } |
| 202 | 231 | |
| 203 | 232 | /* initialize the rest of the structure */ |
| 204 | 233 | m_master_clock = clock(); |
trunk/src/devices/sound/namco.cpp
| r252872 | r252873 | |
| 37 | 37 | |
| 38 | 38 | namco_audio_device::namco_audio_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 39 | 39 | : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), |
| 40 | | device_sound_interface(mconfig, *this), |
| 41 | | m_last_channel(nullptr), |
| 42 | | m_soundregs(nullptr), |
| 43 | | m_wavedata(nullptr), |
| 44 | | m_wave_size(0), |
| 45 | | m_sound_enable(0), |
| 46 | | m_stream(nullptr), |
| 47 | | m_namco_clock(0), |
| 48 | | m_sample_rate(0), |
| 49 | | m_f_fracbits(0), |
| 50 | | m_voices(0), |
| 51 | | m_stereo(0) |
| 40 | , device_sound_interface(mconfig, *this) |
| 41 | , m_wave_region(*this, tag) |
| 42 | , m_last_channel(nullptr) |
| 43 | , m_soundregs(nullptr) |
| 44 | , m_wavedata(nullptr) |
| 45 | , m_wave_size(0) |
| 46 | , m_sound_enable(0) |
| 47 | , m_stream(nullptr) |
| 48 | , m_namco_clock(0) |
| 49 | , m_sample_rate(0) |
| 50 | , m_f_fracbits(0) |
| 51 | , m_voices(0) |
| 52 | , m_stereo(0) |
| 52 | 53 | { |
| 53 | 54 | } |
| 54 | 55 | |
| r252872 | r252873 | |
| 95 | 96 | logerror("Namco: freq fractional bits = %d: internal freq = %d, output freq = %d\n", m_f_fracbits, m_namco_clock, m_sample_rate); |
| 96 | 97 | |
| 97 | 98 | /* build the waveform table */ |
| 98 | | build_decoded_waveform(region()->base()); |
| 99 | build_decoded_waveform(m_wave_region != NULL ? m_wave_region->base() : NULL); |
| 99 | 100 | |
| 100 | 101 | /* get stream channels */ |
| 101 | 102 | if (m_stereo) |
| r252872 | r252873 | |
| 109 | 110 | /* register with the save state system */ |
| 110 | 111 | save_pointer(NAME(m_soundregs), 0x400); |
| 111 | 112 | |
| 113 | <<<<<<< HEAD |
| 112 | 114 | if (region() == nullptr) |
| 115 | ======= |
| 116 | if (m_wave_region == NULL) |
| 117 | >>>>>>> Yet more this==NULL fixes |
| 113 | 118 | save_pointer(NAME(m_wavedata), 0x400); |
| 114 | 119 | |
| 115 | 120 | save_item(NAME(m_voices)); |
trunk/src/devices/sound/tms5110.cpp
| r252872 | r252873 | |
| 1049 | 1049 | |
| 1050 | 1050 | void tms5110_device::device_start() |
| 1051 | 1051 | { |
| 1052 | | m_table = region()->base(); |
| 1052 | m_table = NULL; |
| 1053 | if (m_table_region != NULL) |
| 1054 | { |
| 1055 | m_table = m_table_region->base(); |
| 1056 | } |
| 1053 | 1057 | |
| 1054 | 1058 | set_variant(TMS5110_IS_TMS5110A); |
| 1055 | 1059 | |
| r252872 | r252873 | |
| 1532 | 1536 | |
| 1533 | 1537 | tms5110_device::tms5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1534 | 1538 | : device_t(mconfig, TMS5110, "TMS5110", tag, owner, clock, "tms5110", __FILE__), |
| 1535 | | device_sound_interface(mconfig, *this), |
| 1536 | | m_m0_cb(*this), |
| 1537 | | m_m1_cb(*this), |
| 1538 | | m_addr_cb(*this), |
| 1539 | | m_data_cb(*this), |
| 1540 | | m_romclk_cb(*this) |
| 1539 | , device_sound_interface(mconfig, *this) |
| 1540 | , m_table_region(*this, tag) |
| 1541 | , m_m0_cb(*this) |
| 1542 | , m_m1_cb(*this) |
| 1543 | , m_addr_cb(*this) |
| 1544 | , m_data_cb(*this) |
| 1545 | , m_romclk_cb(*this) |
| 1541 | 1546 | { |
| 1542 | 1547 | } |
| 1543 | 1548 | |
| 1544 | 1549 | tms5110_device::tms5110_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 1545 | | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 1546 | | device_sound_interface(mconfig, *this), |
| 1547 | | m_m0_cb(*this), |
| 1548 | | m_m1_cb(*this), |
| 1549 | | m_addr_cb(*this), |
| 1550 | | m_data_cb(*this), |
| 1551 | | m_romclk_cb(*this) |
| 1550 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source) |
| 1551 | , device_sound_interface(mconfig, *this) |
| 1552 | , m_table_region(*this, tag) |
| 1553 | , m_m0_cb(*this) |
| 1554 | , m_m1_cb(*this) |
| 1555 | , m_addr_cb(*this) |
| 1556 | , m_data_cb(*this) |
| 1557 | , m_romclk_cb(*this) |
| 1552 | 1558 | { |
| 1553 | 1559 | } |
| 1554 | 1560 | |
trunk/src/mame/drivers/cps3.cpp
| r252872 | r252873 | |
| 788 | 788 | m_altEncryption = altEncryption; |
| 789 | 789 | |
| 790 | 790 | // cache pointers to regions |
| 791 | | m_user4region = memregion("user4")->base(); |
| 792 | | m_user5region = memregion("user5")->base(); |
| 791 | if (m_user4_region) |
| 792 | { |
| 793 | m_user4 = m_user4_region->base(); |
| 794 | } |
| 795 | else |
| 796 | { |
| 797 | m_user4 = auto_alloc_array(machine(), UINT8, USER4REGION_LENGTH); |
| 798 | } |
| 793 | 799 | |
| 794 | | if (!m_user4region) m_user4region = auto_alloc_array(machine(), UINT8, USER4REGION_LENGTH); |
| 795 | | if (!m_user5region) m_user5region = auto_alloc_array(machine(), UINT8, USER5REGION_LENGTH); |
| 796 | | m_cps3sound->set_base((INT8*)m_user5region); |
| 800 | if (m_user5_region) |
| 801 | { |
| 802 | m_user5 = m_user5_region->base(); |
| 803 | } |
| 804 | else |
| 805 | { |
| 806 | m_user5 = auto_alloc_array(machine(), UINT8, USER5REGION_LENGTH); |
| 807 | } |
| 797 | 808 | |
| 809 | m_cps3sound->set_base((INT8*)m_user5); |
| 810 | |
| 798 | 811 | // set strict verify |
| 799 | 812 | m_maincpu->sh2drc_set_options(SH2DRC_STRICT_VERIFY); |
| 800 | 813 | m_maincpu->sh2drc_add_fastram(0x02000000, 0x0207ffff, 0, &m_mainram[0]); |
| r252872 | r252873 | |
| 1468 | 1481 | |
| 1469 | 1482 | /* make a copy in the linear memory region we actually use for drawing etc. having it stored in interleaved flash roms isnt' very useful */ |
| 1470 | 1483 | { |
| 1471 | | UINT32* romdata = (UINT32*)m_user5region; |
| 1484 | UINT32* romdata = (UINT32*)m_user5; |
| 1472 | 1485 | int real_offset = 0; |
| 1473 | 1486 | UINT32 newdata; |
| 1474 | 1487 | |
| r252872 | r252873 | |
| 1575 | 1588 | |
| 1576 | 1589 | /* copy data into regions to execute from */ |
| 1577 | 1590 | { |
| 1578 | | UINT32* romdata = (UINT32*)m_user4region; |
| 1591 | UINT32* romdata = (UINT32*)m_user4; |
| 1579 | 1592 | UINT32* romdata2 = (UINT32*)m_decrypted_gamerom; |
| 1580 | 1593 | int real_offset = 0; |
| 1581 | 1594 | UINT32 newdata; |
| r252872 | r252873 | |
| 1799 | 1812 | if (data & 0x0002) |
| 1800 | 1813 | { |
| 1801 | 1814 | int i; |
| 1802 | | UINT16* src = (UINT16*)m_user5region; |
| 1815 | UINT16* src = (UINT16*)m_user5; |
| 1803 | 1816 | // if(DEBUG_PRINTF) printf("CPS3 pal dma start %08x (real: %08x) dest %08x fade %08x other2 %08x (length %04x)\n", m_paldma_source, m_paldma_realsource, m_paldma_dest, m_paldma_fade, m_paldma_other2, m_paldma_length); |
| 1804 | 1817 | |
| 1805 | 1818 | for (i=0;i<m_paldma_length;i++) |
| r252872 | r252873 | |
| 1873 | 1886 | |
| 1874 | 1887 | void cps3_state::cps3_do_char_dma( UINT32 real_source, UINT32 real_destination, UINT32 real_length ) |
| 1875 | 1888 | { |
| 1876 | | UINT8* sourcedata = (UINT8*)m_user5region; |
| 1889 | UINT8* sourcedata = (UINT8*)m_user5; |
| 1877 | 1890 | int length_remaining; |
| 1878 | 1891 | |
| 1879 | 1892 | m_last_normal_byte = 0; |
| r252872 | r252873 | |
| 1956 | 1969 | |
| 1957 | 1970 | void cps3_state::cps3_do_alt_char_dma( UINT32 src, UINT32 real_dest, UINT32 real_length ) |
| 1958 | 1971 | { |
| 1959 | | UINT8* px = (UINT8*)m_user5region; |
| 1972 | UINT8* px = (UINT8*)m_user5; |
| 1960 | 1973 | UINT32 start = real_dest; |
| 1961 | 1974 | UINT32 ds = real_dest; |
| 1962 | 1975 | |
| r252872 | r252873 | |
| 2299 | 2312 | // make a copy in the regions we execute code / draw gfx from |
| 2300 | 2313 | void cps3_state::copy_from_nvram() |
| 2301 | 2314 | { |
| 2302 | | UINT32* romdata = (UINT32*)m_user4region; |
| 2315 | UINT32* romdata = (UINT32*)m_user4; |
| 2303 | 2316 | UINT32* romdata2 = (UINT32*)m_decrypted_gamerom; |
| 2304 | 2317 | int i; |
| 2305 | 2318 | /* copy + decrypt program roms which have been loaded from flashroms/nvram */ |
| r252872 | r252873 | |
| 2336 | 2349 | int flashnum = 0; |
| 2337 | 2350 | int countoffset = 0; |
| 2338 | 2351 | |
| 2339 | | romdata = (UINT32*)m_user5region; |
| 2352 | romdata = (UINT32*)m_user5; |
| 2340 | 2353 | for (thebase = 0;thebase < len/2; thebase+=0x200000) |
| 2341 | 2354 | { |
| 2342 | 2355 | // printf("flashnums %d. %d\n",flashnum, flashnum+1); |
trunk/src/mame/drivers/jaguar.cpp
| r252872 | r252873 | |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | /* configure banks for gfx/sound ROMs */ |
| 430 | | UINT8 *romboard = memregion("romboard")->base(); |
| 431 | | if (romboard != nullptr) |
| 430 | if (m_romboard_region != nullptr) |
| 432 | 431 | { |
| 432 | UINT8 *romboard = m_romboard_region->base(); |
| 433 | |
| 433 | 434 | /* graphics banks */ |
| 434 | 435 | if (m_is_r3000) |
| 435 | 436 | { |
| r252872 | r252873 | |
| 617 | 618 | } |
| 618 | 619 | |
| 619 | 620 | /* adjust banking */ |
| 620 | | if (memregion("romboard")->base()) |
| 621 | if (m_romboard_region != NULL) |
| 621 | 622 | { |
| 622 | 623 | membank("mainsndbank")->set_entry((data >> 1) & 7); |
| 623 | 624 | membank("dspsndbank")->set_entry((data >> 1) & 7); |
| r252872 | r252873 | |
| 776 | 777 | logerror("%08X:latch_w(%X)\n", space.device().safe_pcbase(), data); |
| 777 | 778 | |
| 778 | 779 | /* adjust banking */ |
| 779 | | if (memregion("romboard")->base()) |
| 780 | if (m_romboard_region != NULL) |
| 780 | 781 | { |
| 781 | 782 | if (m_is_r3000) |
| 783 | { |
| 782 | 784 | membank("maingfxbank")->set_entry(data & 1); |
| 785 | } |
| 783 | 786 | membank("gpugfxbank")->set_entry(data & 1); |
| 784 | 787 | } |
| 785 | 788 | } |
| r252872 | r252873 | |
| 1915 | 1918 | |
| 1916 | 1919 | void jaguar_state::fix_endian( UINT32 addr, UINT32 size ) |
| 1917 | 1920 | { |
| 1918 | | UINT8 j[4], *ram = memregion("maincpu")->base(); |
| 1921 | UINT8 j[4]; |
| 1922 | UINT8 *ram = memregion("maincpu")->base(); |
| 1919 | 1923 | UINT32 i; |
| 1920 | 1924 | size += addr; |
| 1921 | 1925 | logerror("File Loaded to address range %X to %X\n",addr,size-1); |
trunk/src/mame/drivers/segac2.cpp
| r252872 | r252873 | |
| 98 | 98 | { |
| 99 | 99 | public: |
| 100 | 100 | segac2_state(const machine_config &mconfig, device_type type, const char *tag) |
| 101 | | : md_base_state(mconfig, type, tag), |
| 102 | | m_paletteram(*this, "paletteram"), |
| 103 | | m_upd7759(*this, "upd"), |
| 104 | | m_screen(*this, "screen"), |
| 105 | | m_palette(*this, "palette") { } |
| 101 | : md_base_state(mconfig, type, tag) |
| 102 | , m_paletteram(*this, "paletteram") |
| 103 | , m_upd_region(*this, "upd") |
| 104 | , m_upd7759(*this, "upd") |
| 105 | , m_screen(*this, "screen") |
| 106 | , m_palette(*this, "palette") |
| 107 | { |
| 108 | } |
| 106 | 109 | |
| 107 | 110 | // for Print Club only |
| 108 | 111 | int m_cam_data; |
| r252872 | r252873 | |
| 110 | 113 | int m_segac2_enable_display; |
| 111 | 114 | |
| 112 | 115 | required_shared_ptr<UINT16> m_paletteram; |
| 116 | optional_memory_region m_upd_region; |
| 113 | 117 | |
| 114 | 118 | /* protection-related tracking */ |
| 115 | 119 | segac2_prot_delegate m_prot_func; /* emulation of protection chip */ |
| r252872 | r252873 | |
| 244 | 248 | |
| 245 | 249 | /* determine how many sound banks */ |
| 246 | 250 | m_sound_banks = 0; |
| 247 | | if (memregion("upd")->base()) |
| 248 | | m_sound_banks = memregion("upd")->bytes() / 0x20000; |
| 251 | if (m_upd_region != NULL) |
| 252 | { |
| 253 | m_sound_banks = m_upd_region->bytes() / 0x20000; |
| 254 | } |
| 249 | 255 | |
| 250 | 256 | /* reset the protection */ |
| 251 | 257 | m_prot_write_buf = 0; |
| r252872 | r252873 | |
| 934 | 940 | |
| 935 | 941 | static INPUT_PORTS_START( wwmarine ) |
| 936 | 942 | PORT_INCLUDE( systemc_generic ) |
| 937 | | |
| 943 | |
| 938 | 944 | PORT_MODIFY("P1") |
| 939 | 945 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) // Button 1 |
| 940 | 946 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) // Button 2 |
trunk/src/mame/includes/cps3.h
| r252872 | r252873 | |
| 14 | 14 | class cps3_state : public driver_device |
| 15 | 15 | { |
| 16 | 16 | public: |
| 17 | <<<<<<< HEAD |
| 17 | 18 | cps3_state(const machine_config &mconfig, device_type type, const char *tag) |
| 18 | | : driver_device(mconfig, type, tag), |
| 19 | | m_maincpu(*this, "maincpu"), |
| 20 | | m_gfxdecode(*this, "gfxdecode"), |
| 21 | | m_palette(*this, "palette"), |
| 22 | | m_cps3sound(*this, "cps3sound"), |
| 23 | | m_mainram(*this, "mainram"), |
| 24 | | m_spriteram(*this, "spriteram"), |
| 25 | | m_colourram(*this, "colourram"), |
| 26 | | m_tilemap20_regs_base(*this, "tmap20_regs"), |
| 27 | | m_tilemap30_regs_base(*this, "tmap30_regs"), |
| 28 | | m_tilemap40_regs_base(*this, "tmap40_regs"), |
| 29 | | m_tilemap50_regs_base(*this, "tmap50_regs"), |
| 30 | | m_fullscreenzoom(*this, "fullscreenzoom"), |
| 31 | | m_0xc0000000_ram(*this, "0xc0000000_ram"), |
| 32 | | m_decrypted_gamerom(*this, "decrypted_gamerom"), |
| 33 | | m_0xc0000000_ram_decrypted(*this, "0xc0000000_ram_decrypted") |
| 34 | | { } |
| 19 | : driver_device(mconfig, type, tag) |
| 20 | , m_maincpu(*this, "maincpu") |
| 21 | , m_gfxdecode(*this, "gfxdecode") |
| 22 | , m_palette(*this, "palette") |
| 23 | , m_cps3sound(*this, "cps3sound") |
| 24 | , m_mainram(*this, "mainram") |
| 25 | , m_spriteram(*this, "spriteram") |
| 26 | , m_colourram(*this, "colourram") |
| 27 | , m_tilemap20_regs_base(*this, "tmap20_regs") |
| 28 | , m_tilemap30_regs_base(*this, "tmap30_regs") |
| 29 | , m_tilemap40_regs_base(*this, "tmap40_regs") |
| 30 | , m_tilemap50_regs_base(*this, "tmap50_regs") |
| 31 | , m_fullscreenzoom(*this, "fullscreenzoom") |
| 32 | , m_0xc0000000_ram(*this, "0xc0000000_ram") |
| 33 | , m_decrypted_gamerom(*this, "decrypted_gamerom") |
| 34 | , m_0xc0000000_ram_decrypted(*this, "0xc0000000_ram_decrypted") |
| 35 | , m_user4_region(*this, "user4") |
| 36 | , m_user5_region(*this, "user5") |
| 37 | { |
| 38 | } |
| 35 | 39 | |
| 36 | 40 | required_device<sh2_device> m_maincpu; |
| 37 | 41 | required_device<gfxdecode_device> m_gfxdecode; |
| r252872 | r252873 | |
| 50 | 54 | required_shared_ptr<UINT32> m_decrypted_gamerom; |
| 51 | 55 | required_shared_ptr<UINT32> m_0xc0000000_ram_decrypted; |
| 52 | 56 | |
| 57 | optional_memory_region m_user4_region; |
| 58 | optional_memory_region m_user5_region; |
| 59 | |
| 53 | 60 | fujitsu_29f016a_device *m_simm[7][8]; |
| 54 | 61 | UINT32 m_cram_gfxflash_bank; |
| 55 | 62 | std::unique_ptr<UINT32[]> m_char_ram; |
| r252872 | r252873 | |
| 61 | 68 | std::unique_ptr<UINT32[]> m_mame_colours; |
| 62 | 69 | bitmap_rgb32 m_renderbuffer_bitmap; |
| 63 | 70 | rectangle m_renderbuffer_clip; |
| 64 | | UINT8* m_user4region; |
| 71 | UINT8* m_user4; |
| 65 | 72 | UINT32 m_key1; |
| 66 | 73 | UINT32 m_key2; |
| 67 | 74 | int m_altEncryption; |
| r252872 | r252873 | |
| 81 | 88 | int m_last_normal_byte; |
| 82 | 89 | unsigned short m_lastb; |
| 83 | 90 | unsigned short m_lastb2; |
| 84 | | UINT8* m_user5region; |
| 91 | UINT8* m_user5; |
| 85 | 92 | |
| 86 | 93 | DECLARE_READ32_MEMBER(cps3_ssram_r); |
| 87 | 94 | DECLARE_WRITE32_MEMBER(cps3_ssram_w); |
trunk/src/mame/machine/amstrad.cpp
| r252872 | r252873 | |
| 1106 | 1106 | amstrad_state *state = machine.driver_data<amstrad_state>(); |
| 1107 | 1107 | cpc_expansion_slot_device* exp_port = state->m_exp; |
| 1108 | 1108 | |
| 1109 | | while(exp_port != nullptr) |
| 1109 | while (exp_port != nullptr) |
| 1110 | 1110 | { |
| 1111 | 1111 | device_t* temp; |
| 1112 | 1112 | |
| r252872 | r252873 | |
| 1117 | 1117 | |
| 1118 | 1118 | // if it's not what we're looking for, then check the expansion port on this expansion device. if it exists. |
| 1119 | 1119 | temp = dynamic_cast<device_t*>(exp_port->get_card_device()); |
| 1120 | | if(temp == nullptr) |
| 1120 | if (temp == nullptr) |
| 1121 | { |
| 1121 | 1122 | return nullptr; // no device attached |
| 1123 | } |
| 1124 | |
| 1122 | 1125 | exp_port = temp->subdevice<cpc_expansion_slot_device>("exp"); |
| 1123 | | if(exp_port == nullptr) |
| 1126 | if (exp_port == nullptr) |
| 1127 | { |
| 1124 | 1128 | return nullptr; // we're at the end of the chain |
| 1129 | } |
| 1125 | 1130 | } |
| 1126 | 1131 | return nullptr; |
| 1127 | 1132 | } |
| r252872 | r252873 | |
| 2000 | 2005 | // expansion devices know the selected ROM by monitoring I/O writes to DFxx |
| 2001 | 2006 | // there are no signals related to which ROM is selected |
| 2002 | 2007 | cpc_expansion_slot_device* exp_port = m_exp; |
| 2003 | | while(exp_port != nullptr) |
| 2008 | while (exp_port != nullptr) |
| 2004 | 2009 | { |
| 2005 | 2010 | device_cpc_expansion_card_interface* temp; |
| 2006 | 2011 | device_t* temp_dev; |
| 2007 | 2012 | |
| 2008 | 2013 | temp = dynamic_cast<device_cpc_expansion_card_interface*>(exp_port->get_card_device()); |
| 2009 | 2014 | temp_dev = dynamic_cast<device_t*>(exp_port->get_card_device()); |
| 2010 | | if(temp != nullptr) |
| 2015 | if (temp != nullptr) |
| 2011 | 2016 | { |
| 2012 | 2017 | temp->set_rom_bank(data); |
| 2018 | exp_port = temp_dev->subdevice<cpc_expansion_slot_device>("exp"); |
| 2013 | 2019 | } |
| 2014 | | exp_port = temp_dev->subdevice<cpc_expansion_slot_device>("exp"); |
| 2020 | else |
| 2021 | { |
| 2022 | exp_port = NULL; |
| 2023 | } |
| 2015 | 2024 | } |
| 2016 | 2025 | |
| 2017 | 2026 | amstrad_rethinkMemory(); |
| r252872 | r252873 | |
| 2906 | 2915 | void amstrad_state::enumerate_roms() |
| 2907 | 2916 | { |
| 2908 | 2917 | UINT8 m_rom_count = 1; |
| 2909 | | device_t* romexp; |
| 2910 | | rom_image_device* romimage; |
| 2911 | 2918 | UINT8 *rom = m_region_maincpu->base(); |
| 2912 | | char str[20]; |
| 2913 | | int i; |
| 2914 | | bool slot3 = false,slot7 = false; |
| 2915 | 2919 | |
| 2920 | bool slot7 = false; |
| 2916 | 2921 | if (m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000) |
| 2917 | 2922 | { |
| 2918 | 2923 | UINT8 *crt = m_region_cart->base(); |
| 2919 | 2924 | int bank_mask = (m_cart->get_rom_size() / 0x4000) - 1; |
| 2920 | 2925 | |
| 2921 | 2926 | /* ROMs are stored on the inserted cartridge in the Plus/GX4000 */ |
| 2922 | | for(i=0; i<128; i++) // fill ROM table |
| 2927 | for (int i = 0; i < 128; i++) // fill ROM table |
| 2928 | { |
| 2923 | 2929 | m_Amstrad_ROM_Table[i] = &crt[0x4000]; |
| 2924 | | for(i=128;i<160;i++) |
| 2930 | } |
| 2931 | |
| 2932 | for(int i = 128; i < 160; i++) |
| 2933 | { |
| 2925 | 2934 | m_Amstrad_ROM_Table[i] = &crt[((i - 128) & bank_mask) * 0x4000]; |
| 2935 | } |
| 2926 | 2936 | m_Amstrad_ROM_Table[7] = &crt[0xc000]; |
| 2927 | 2937 | slot7 = true; |
| 2928 | 2938 | } |
| 2929 | 2939 | else |
| 2930 | 2940 | { |
| 2931 | 2941 | /* slot 0 is always BASIC, as is any unused slot */ |
| 2932 | | for(i=0; i<256; i++) |
| 2942 | for (int i = 0; i<256; i++) |
| 2943 | { |
| 2933 | 2944 | m_Amstrad_ROM_Table[i] = &rom[0x014000]; |
| 2945 | } |
| 2946 | |
| 2934 | 2947 | /* AMSDOS ROM -- TODO: exclude from 464 unless a DDI-1 device is connected */ |
| 2935 | 2948 | m_Amstrad_ROM_Table[7] = &rom[0x018000]; |
| 2936 | 2949 | slot7 = true; |
| 2937 | 2950 | } |
| 2938 | 2951 | |
| 2939 | 2952 | /* MSX-DOS BIOS - Aleste MSX emulation */ |
| 2953 | bool slot3 = false; |
| 2940 | 2954 | if(m_system_type == SYSTEM_ALESTE) |
| 2941 | 2955 | { |
| 2942 | 2956 | m_Amstrad_ROM_Table[3] = &rom[0x01c000]; |
| r252872 | r252873 | |
| 2955 | 2969 | temp = dynamic_cast<device_t*>(exp_port->get_card_device()); |
| 2956 | 2970 | if(temp != nullptr) |
| 2957 | 2971 | { |
| 2958 | | if(temp->memregion("exp_rom")->base() != nullptr) |
| 2972 | memory_region *temp_region = temp->memregion("exp_rom"); |
| 2973 | if(temp_region != nullptr && temp_region->base() != nullptr) |
| 2959 | 2974 | { |
| 2960 | | int num = temp->memregion("exp_rom")->bytes() / 0x4000; |
| 2961 | | for(i=0;i<num;i++) |
| 2975 | int num = temp_region->bytes() / 0x4000; |
| 2976 | for (int i = 0; i < num; i++) |
| 2962 | 2977 | { |
| 2963 | | m_Amstrad_ROM_Table[m_rom_count] = temp->memregion("exp_rom")->base()+0x4000*i; |
| 2978 | m_Amstrad_ROM_Table[m_rom_count] = temp_region->base()+0x4000*i; |
| 2964 | 2979 | NEXT_ROM_SLOT |
| 2965 | 2980 | } |
| 2966 | 2981 | } |
| 2982 | exp_port = temp->subdevice<cpc_expansion_slot_device>("exp"); |
| 2967 | 2983 | } |
| 2968 | | exp_port = temp->subdevice<cpc_expansion_slot_device>("exp"); |
| 2984 | else |
| 2985 | { |
| 2986 | exp_port = NULL; |
| 2987 | } |
| 2969 | 2988 | } |
| 2970 | 2989 | |
| 2971 | 2990 | |
| 2972 | 2991 | /* add ROMs from ROMbox expansion */ |
| 2973 | | romexp = get_expansion_device(machine(),"rom"); |
| 2992 | device_t* romexp = get_expansion_device(machine(),"rom"); |
| 2974 | 2993 | if(romexp) |
| 2975 | 2994 | { |
| 2976 | | for(i=0;i<8;i++) |
| 2995 | for(int i = 0; i < 8; i++) |
| 2977 | 2996 | { |
| 2978 | | sprintf(str,"rom%i",i+1); |
| 2979 | | romimage = romexp->subdevice<rom_image_device>(str); |
| 2980 | | if(romimage->base() != nullptr) |
| 2997 | char str[20]; |
| 2998 | sprintf(str, "rom%i", i + 1); |
| 2999 | rom_image_device* romimage = romexp->subdevice<rom_image_device>(str); |
| 3000 | if(romimage != NULL && romimage->base() != nullptr) |
| 2981 | 3001 | { |
| 2982 | 3002 | m_Amstrad_ROM_Table[m_rom_count] = romimage->base(); |
| 2983 | 3003 | NEXT_ROM_SLOT |
| 2984 | 3004 | } |
| 2985 | 3005 | } |
| 2986 | 3006 | } |
| 2987 | | |
| 2988 | 3007 | } |
| 2989 | 3008 | |
| 2990 | 3009 | void amstrad_state::amstrad_common_init() |
| r252872 | r252873 | |
| 3106 | 3125 | std::string region_tag; |
| 3107 | 3126 | m_region_cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); |
| 3108 | 3127 | if (!m_region_cart) // this should never happen, since we make carts mandatory! |
| 3128 | { |
| 3109 | 3129 | m_region_cart = memregion("maincpu"); |
| 3130 | } |
| 3110 | 3131 | } |
| 3111 | 3132 | |
| 3112 | 3133 | |