branches/code_cleanup/src/devices/sound/es5506.cpp
| r250301 | r250302 | |
| 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() : NULL; |
| 199 | | m_region_base[1] = m_region1 ? (UINT16 *)machine().root_device().memregion(m_region1)->base() : NULL; |
| 200 | | m_region_base[2] = m_region2 ? (UINT16 *)machine().root_device().memregion(m_region2)->base() : NULL; |
| 201 | | m_region_base[3] = m_region3 ? (UINT16 *)machine().root_device().memregion(m_region3)->base() : NULL; |
| 198 | m_region_base[0] = m_region_base[1] = m_region_base[2] = m_region_base[3] = NULL; |
| 199 | if (m_region0) |
| 200 | { |
| 201 | memory_region *region0 = machine().root_device().memregion(m_region0); |
| 202 | if (region0 != NULL) |
| 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 != NULL) |
| 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 != NULL) |
| 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 != NULL) |
| 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(); |
branches/code_cleanup/src/devices/sound/namco.cpp
| r250301 | r250302 | |
| 36 | 36 | const device_type NAMCO_CUS30 = &device_creator<namco_cus30_device>; |
| 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 | | : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), |
| 40 | | device_sound_interface(mconfig, *this), |
| 41 | | m_last_channel(NULL), |
| 42 | | m_soundregs(NULL), |
| 43 | | m_wavedata(NULL), |
| 44 | | m_wave_size(0), |
| 45 | | m_sound_enable(0), |
| 46 | | m_stream(NULL), |
| 47 | | m_namco_clock(0), |
| 48 | | m_sample_rate(0), |
| 49 | | m_f_fracbits(0), |
| 50 | | m_voices(0), |
| 51 | | m_stereo(0) |
| 39 | : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__) |
| 40 | , device_sound_interface(mconfig, *this) |
| 41 | , m_wave_region(*this, tag) |
| 42 | , m_last_channel(NULL) |
| 43 | , m_soundregs(NULL) |
| 44 | , m_wavedata(NULL) |
| 45 | , m_wave_size(0) |
| 46 | , m_sound_enable(0) |
| 47 | , m_stream(NULL) |
| 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 | |
| r250301 | r250302 | |
| 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) |
| r250301 | r250302 | |
| 109 | 110 | /* register with the save state system */ |
| 110 | 111 | save_pointer(NAME(m_soundregs), 0x400); |
| 111 | 112 | |
| 112 | | if (region() == NULL) |
| 113 | if (m_wave_region == NULL) |
| 113 | 114 | save_pointer(NAME(m_wavedata), 0x400); |
| 114 | 115 | |
| 115 | 116 | save_item(NAME(m_voices)); |
branches/code_cleanup/src/devices/sound/tms5110.cpp
| r250301 | r250302 | |
| 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 | |
| r250301 | r250302 | |
| 1531 | 1535 | const device_type TMS5110 = &device_creator<tms5110_device>; |
| 1532 | 1536 | |
| 1533 | 1537 | tms5110_device::tms5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1534 | | : 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) |
| 1538 | : device_t(mconfig, TMS5110, "TMS5110", tag, owner, clock, "tms5110", __FILE__) |
| 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 | |
branches/code_cleanup/src/mame/drivers/cps3.cpp
| r250301 | r250302 | |
| 794 | 794 | m_altEncryption = altEncryption; |
| 795 | 795 | |
| 796 | 796 | // cache pointers to regions |
| 797 | | m_user4region = memregion("user4")->base(); |
| 798 | | m_user5region = memregion("user5")->base(); |
| 797 | if (m_user4_region) |
| 798 | { |
| 799 | m_user4 = m_user4_region->base(); |
| 800 | } |
| 801 | else |
| 802 | { |
| 803 | m_user4 = auto_alloc_array(machine(), UINT8, USER4REGION_LENGTH); |
| 804 | } |
| 799 | 805 | |
| 800 | | if (!m_user4region) m_user4region = auto_alloc_array(machine(), UINT8, USER4REGION_LENGTH); |
| 801 | | if (!m_user5region) m_user5region = auto_alloc_array(machine(), UINT8, USER5REGION_LENGTH); |
| 802 | | m_cps3sound->set_base((INT8*)m_user5region); |
| 806 | if (m_user5_region) |
| 807 | { |
| 808 | m_user5 = m_user5_region->base(); |
| 809 | } |
| 810 | else |
| 811 | { |
| 812 | m_user5 = auto_alloc_array(machine(), UINT8, USER5REGION_LENGTH); |
| 813 | } |
| 803 | 814 | |
| 815 | m_cps3sound->set_base((INT8*)m_user5); |
| 816 | |
| 804 | 817 | // set strict verify |
| 805 | 818 | m_maincpu->sh2drc_set_options(SH2DRC_STRICT_VERIFY); |
| 806 | 819 | m_maincpu->sh2drc_add_fastram(0x02000000, 0x0207ffff, 0, &m_mainram[0]); |
| r250301 | r250302 | |
| 1474 | 1487 | |
| 1475 | 1488 | /* make a copy in the linear memory region we actually use for drawing etc. having it stored in interleaved flash roms isnt' very useful */ |
| 1476 | 1489 | { |
| 1477 | | UINT32* romdata = (UINT32*)m_user5region; |
| 1490 | UINT32* romdata = (UINT32*)m_user5; |
| 1478 | 1491 | int real_offset = 0; |
| 1479 | 1492 | UINT32 newdata; |
| 1480 | 1493 | |
| r250301 | r250302 | |
| 1581 | 1594 | |
| 1582 | 1595 | /* copy data into regions to execute from */ |
| 1583 | 1596 | { |
| 1584 | | UINT32* romdata = (UINT32*)m_user4region; |
| 1597 | UINT32* romdata = (UINT32*)m_user4; |
| 1585 | 1598 | UINT32* romdata2 = (UINT32*)m_decrypted_gamerom; |
| 1586 | 1599 | int real_offset = 0; |
| 1587 | 1600 | UINT32 newdata; |
| r250301 | r250302 | |
| 1805 | 1818 | if (data & 0x0002) |
| 1806 | 1819 | { |
| 1807 | 1820 | int i; |
| 1808 | | UINT16* src = (UINT16*)m_user5region; |
| 1821 | UINT16* src = (UINT16*)m_user5; |
| 1809 | 1822 | // 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); |
| 1810 | 1823 | |
| 1811 | 1824 | for (i=0;i<m_paldma_length;i++) |
| r250301 | r250302 | |
| 1879 | 1892 | |
| 1880 | 1893 | void cps3_state::cps3_do_char_dma( UINT32 real_source, UINT32 real_destination, UINT32 real_length ) |
| 1881 | 1894 | { |
| 1882 | | UINT8* sourcedata = (UINT8*)m_user5region; |
| 1895 | UINT8* sourcedata = (UINT8*)m_user5; |
| 1883 | 1896 | int length_remaining; |
| 1884 | 1897 | |
| 1885 | 1898 | m_last_normal_byte = 0; |
| r250301 | r250302 | |
| 1962 | 1975 | |
| 1963 | 1976 | void cps3_state::cps3_do_alt_char_dma( UINT32 src, UINT32 real_dest, UINT32 real_length ) |
| 1964 | 1977 | { |
| 1965 | | UINT8* px = (UINT8*)m_user5region; |
| 1978 | UINT8* px = (UINT8*)m_user5; |
| 1966 | 1979 | UINT32 start = real_dest; |
| 1967 | 1980 | UINT32 ds = real_dest; |
| 1968 | 1981 | |
| r250301 | r250302 | |
| 2305 | 2318 | // make a copy in the regions we execute code / draw gfx from |
| 2306 | 2319 | void cps3_state::copy_from_nvram() |
| 2307 | 2320 | { |
| 2308 | | UINT32* romdata = (UINT32*)m_user4region; |
| 2321 | UINT32* romdata = (UINT32*)m_user4; |
| 2309 | 2322 | UINT32* romdata2 = (UINT32*)m_decrypted_gamerom; |
| 2310 | 2323 | int i; |
| 2311 | 2324 | /* copy + decrypt program roms which have been loaded from flashroms/nvram */ |
| r250301 | r250302 | |
| 2342 | 2355 | int flashnum = 0; |
| 2343 | 2356 | int countoffset = 0; |
| 2344 | 2357 | |
| 2345 | | romdata = (UINT32*)m_user5region; |
| 2358 | romdata = (UINT32*)m_user5; |
| 2346 | 2359 | for (thebase = 0;thebase < len/2; thebase+=0x200000) |
| 2347 | 2360 | { |
| 2348 | 2361 | // printf("flashnums %d. %d\n",flashnum, flashnum+1); |
branches/code_cleanup/src/mame/drivers/jaguar.cpp
| r250301 | r250302 | |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | /* configure banks for gfx/sound ROMs */ |
| 430 | | UINT8 *romboard = memregion("romboard")->base(); |
| 431 | | if (romboard != NULL) |
| 430 | if (m_romboard_region != NULL) |
| 432 | 431 | { |
| 432 | UINT8 *romboard = m_romboard_region->base(); |
| 433 | |
| 433 | 434 | /* graphics banks */ |
| 434 | 435 | if (m_is_r3000) |
| 435 | 436 | { |
| r250301 | r250302 | |
| 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); |
| r250301 | r250302 | |
| 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 | } |
| r250301 | r250302 | |
| 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); |
branches/code_cleanup/src/mame/drivers/segac2.cpp
| r250301 | r250302 | |
| 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; |
| r250301 | r250302 | |
| 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 */ |
| r250301 | r250302 | |
| 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; |
branches/code_cleanup/src/mame/includes/cps3.h
| r250301 | r250302 | |
| 15 | 15 | { |
| 16 | 16 | public: |
| 17 | 17 | 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") |
| 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 | , m_user4_region(*this, "user4") |
| 35 | , m_user5_region(*this, "user5") |
| 34 | 36 | { } |
| 35 | 37 | |
| 36 | 38 | required_device<sh2_device> m_maincpu; |
| r250301 | r250302 | |
| 50 | 52 | required_shared_ptr<UINT32> m_decrypted_gamerom; |
| 51 | 53 | required_shared_ptr<UINT32> m_0xc0000000_ram_decrypted; |
| 52 | 54 | |
| 55 | optional_memory_region m_user4_region; |
| 56 | optional_memory_region m_user5_region; |
| 57 | |
| 53 | 58 | fujitsu_29f016a_device *m_simm[7][8]; |
| 54 | 59 | UINT32 m_cram_gfxflash_bank; |
| 55 | 60 | UINT32* m_nops; |
| r250301 | r250302 | |
| 62 | 67 | UINT32* m_mame_colours; |
| 63 | 68 | bitmap_rgb32 m_renderbuffer_bitmap; |
| 64 | 69 | rectangle m_renderbuffer_clip; |
| 65 | | UINT8* m_user4region; |
| 70 | UINT8* m_user4; |
| 66 | 71 | UINT32 m_key1; |
| 67 | 72 | UINT32 m_key2; |
| 68 | 73 | int m_altEncryption; |
| r250301 | r250302 | |
| 82 | 87 | int m_last_normal_byte; |
| 83 | 88 | unsigned short m_lastb; |
| 84 | 89 | unsigned short m_lastb2; |
| 85 | | UINT8* m_user5region; |
| 90 | UINT8* m_user5; |
| 86 | 91 | |
| 87 | 92 | DECLARE_READ32_MEMBER(cps3_ssram_r); |
| 88 | 93 | DECLARE_WRITE32_MEMBER(cps3_ssram_w); |
branches/code_cleanup/src/mame/machine/amstrad.cpp
| r250301 | r250302 | |
| 1087 | 1087 | amstrad_state *state = machine.driver_data<amstrad_state>(); |
| 1088 | 1088 | cpc_expansion_slot_device* exp_port = state->m_exp; |
| 1089 | 1089 | |
| 1090 | | while(exp_port != NULL) |
| 1090 | while (exp_port != NULL) |
| 1091 | 1091 | { |
| 1092 | 1092 | device_t* temp; |
| 1093 | 1093 | |
| r250301 | r250302 | |
| 1098 | 1098 | |
| 1099 | 1099 | // if it's not what we're looking for, then check the expansion port on this expansion device. if it exists. |
| 1100 | 1100 | temp = dynamic_cast<device_t*>(exp_port->get_card_device()); |
| 1101 | | if(temp == NULL) |
| 1101 | if (temp == NULL) |
| 1102 | { |
| 1102 | 1103 | return NULL; // no device attached |
| 1104 | } |
| 1105 | |
| 1103 | 1106 | exp_port = temp->subdevice<cpc_expansion_slot_device>("exp"); |
| 1104 | | if(exp_port == NULL) |
| 1107 | if (exp_port == NULL) |
| 1108 | { |
| 1105 | 1109 | return NULL; // we're at the end of the chain |
| 1110 | } |
| 1106 | 1111 | } |
| 1107 | 1112 | return NULL; |
| 1108 | 1113 | } |
| r250301 | r250302 | |
| 1975 | 1980 | // expansion devices know the selected ROM by monitoring I/O writes to DFxx |
| 1976 | 1981 | // there are no signals related to which ROM is selected |
| 1977 | 1982 | cpc_expansion_slot_device* exp_port = m_exp; |
| 1978 | | while(exp_port != NULL) |
| 1983 | while (exp_port != NULL) |
| 1979 | 1984 | { |
| 1980 | 1985 | device_cpc_expansion_card_interface* temp; |
| 1981 | 1986 | device_t* temp_dev; |
| 1982 | 1987 | |
| 1983 | 1988 | temp = dynamic_cast<device_cpc_expansion_card_interface*>(exp_port->get_card_device()); |
| 1984 | 1989 | temp_dev = dynamic_cast<device_t*>(exp_port->get_card_device()); |
| 1985 | | if(temp != NULL) |
| 1990 | if (temp != NULL) |
| 1986 | 1991 | { |
| 1987 | 1992 | temp->set_rom_bank(data); |
| 1993 | exp_port = temp_dev->subdevice<cpc_expansion_slot_device>("exp"); |
| 1988 | 1994 | } |
| 1989 | | exp_port = temp_dev->subdevice<cpc_expansion_slot_device>("exp"); |
| 1995 | else |
| 1996 | { |
| 1997 | exp_port = NULL; |
| 1998 | } |
| 1990 | 1999 | } |
| 1991 | 2000 | |
| 1992 | 2001 | amstrad_rethinkMemory(); |
| r250301 | r250302 | |
| 2877 | 2886 | void amstrad_state::enumerate_roms() |
| 2878 | 2887 | { |
| 2879 | 2888 | UINT8 m_rom_count = 1; |
| 2880 | | device_t* romexp; |
| 2881 | | rom_image_device* romimage; |
| 2882 | 2889 | UINT8 *rom = m_region_maincpu->base(); |
| 2883 | | char str[20]; |
| 2884 | | int i; |
| 2885 | | bool slot3 = false,slot7 = false; |
| 2886 | 2890 | |
| 2891 | bool slot7 = false; |
| 2887 | 2892 | if (m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000) |
| 2888 | 2893 | { |
| 2889 | 2894 | UINT8 *crt = m_region_cart->base(); |
| 2890 | 2895 | int bank_mask = (m_cart->get_rom_size() / 0x4000) - 1; |
| 2891 | 2896 | |
| 2892 | 2897 | /* ROMs are stored on the inserted cartridge in the Plus/GX4000 */ |
| 2893 | | for(i=0; i<128; i++) // fill ROM table |
| 2898 | for (int i = 0; i < 128; i++) // fill ROM table |
| 2899 | { |
| 2894 | 2900 | m_Amstrad_ROM_Table[i] = &crt[0x4000]; |
| 2895 | | for(i=128;i<160;i++) |
| 2901 | } |
| 2902 | |
| 2903 | for(int i = 128; i < 160; i++) |
| 2904 | { |
| 2896 | 2905 | m_Amstrad_ROM_Table[i] = &crt[((i - 128) & bank_mask) * 0x4000]; |
| 2906 | } |
| 2897 | 2907 | m_Amstrad_ROM_Table[7] = &crt[0xc000]; |
| 2898 | 2908 | slot7 = true; |
| 2899 | 2909 | } |
| 2900 | 2910 | else |
| 2901 | 2911 | { |
| 2902 | 2912 | /* slot 0 is always BASIC, as is any unused slot */ |
| 2903 | | for(i=0; i<256; i++) |
| 2913 | for (int i = 0; i<256; i++) |
| 2914 | { |
| 2904 | 2915 | m_Amstrad_ROM_Table[i] = &rom[0x014000]; |
| 2916 | } |
| 2917 | |
| 2905 | 2918 | /* AMSDOS ROM -- TODO: exclude from 464 unless a DDI-1 device is connected */ |
| 2906 | 2919 | m_Amstrad_ROM_Table[7] = &rom[0x018000]; |
| 2907 | 2920 | slot7 = true; |
| 2908 | 2921 | } |
| 2909 | 2922 | |
| 2910 | 2923 | /* MSX-DOS BIOS - Aleste MSX emulation */ |
| 2924 | bool slot3 = false; |
| 2911 | 2925 | if(m_system_type == SYSTEM_ALESTE) |
| 2912 | 2926 | { |
| 2913 | 2927 | m_Amstrad_ROM_Table[3] = &rom[0x01c000]; |
| r250301 | r250302 | |
| 2926 | 2940 | temp = dynamic_cast<device_t*>(exp_port->get_card_device()); |
| 2927 | 2941 | if(temp != NULL) |
| 2928 | 2942 | { |
| 2929 | | if(temp->memregion("exp_rom")->base() != NULL) |
| 2943 | memory_region *temp_region = temp->memregion("exp_rom"); |
| 2944 | if(temp_region != NULL && temp_region->base() != NULL) |
| 2930 | 2945 | { |
| 2931 | | int num = temp->memregion("exp_rom")->bytes() / 0x4000; |
| 2932 | | for(i=0;i<num;i++) |
| 2946 | int num = temp_region->bytes() / 0x4000; |
| 2947 | for (int i = 0; i < num; i++) |
| 2933 | 2948 | { |
| 2934 | | m_Amstrad_ROM_Table[m_rom_count] = temp->memregion("exp_rom")->base()+0x4000*i; |
| 2949 | m_Amstrad_ROM_Table[m_rom_count] = temp_region->base()+0x4000*i; |
| 2935 | 2950 | NEXT_ROM_SLOT |
| 2936 | 2951 | } |
| 2937 | 2952 | } |
| 2953 | exp_port = temp->subdevice<cpc_expansion_slot_device>("exp"); |
| 2938 | 2954 | } |
| 2939 | | exp_port = temp->subdevice<cpc_expansion_slot_device>("exp"); |
| 2955 | else |
| 2956 | { |
| 2957 | exp_port = NULL; |
| 2958 | } |
| 2940 | 2959 | } |
| 2941 | 2960 | |
| 2942 | 2961 | |
| 2943 | 2962 | /* add ROMs from ROMbox expansion */ |
| 2944 | | romexp = get_expansion_device(machine(),"rom"); |
| 2963 | device_t* romexp = get_expansion_device(machine(),"rom"); |
| 2945 | 2964 | if(romexp) |
| 2946 | 2965 | { |
| 2947 | | for(i=0;i<8;i++) |
| 2966 | for(int i = 0; i < 8; i++) |
| 2948 | 2967 | { |
| 2949 | | sprintf(str,"rom%i",i+1); |
| 2950 | | romimage = romexp->subdevice<rom_image_device>(str); |
| 2951 | | if(romimage->base() != NULL) |
| 2968 | char str[20]; |
| 2969 | sprintf(str, "rom%i", i + 1); |
| 2970 | rom_image_device* romimage = romexp->subdevice<rom_image_device>(str); |
| 2971 | if(romimage != NULL && romimage->base() != NULL) |
| 2952 | 2972 | { |
| 2953 | 2973 | m_Amstrad_ROM_Table[m_rom_count] = romimage->base(); |
| 2954 | 2974 | NEXT_ROM_SLOT |
| 2955 | 2975 | } |
| 2956 | 2976 | } |
| 2957 | 2977 | } |
| 2958 | | |
| 2959 | 2978 | } |
| 2960 | 2979 | |
| 2961 | 2980 | void amstrad_state::amstrad_common_init() |
| r250301 | r250302 | |
| 3077 | 3096 | std::string region_tag; |
| 3078 | 3097 | m_region_cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); |
| 3079 | 3098 | if (!m_region_cart) // this should never happen, since we make carts mandatory! |
| 3099 | { |
| 3080 | 3100 | m_region_cart = memregion("maincpu"); |
| 3101 | } |
| 3081 | 3102 | } |
| 3082 | 3103 | |
| 3083 | 3104 | |