branches/code_cleanup/src/devices/machine/timekpr.cpp
| r250281 | r250282 | |
| 120 | 120 | //------------------------------------------------- |
| 121 | 121 | |
| 122 | 122 | timekeeper_device::timekeeper_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) |
| 123 | | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 124 | | device_nvram_interface(mconfig, *this) |
| 123 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source) |
| 124 | , device_nvram_interface(mconfig, *this) |
| 125 | , m_default_data(NULL) |
| 125 | 126 | { |
| 126 | 127 | } |
| 127 | 128 | |
| r250281 | r250282 | |
| 230 | 231 | m_century = make_bcd( systime.local_time.year / 100 ); |
| 231 | 232 | m_data.resize( m_size ); |
| 232 | 233 | |
| 233 | | m_default_data = region()->base(); |
| 234 | | if (m_default_data) |
| 234 | if (region()) |
| 235 | 235 | { |
| 236 | | assert( region()->bytes() == m_size ); |
| 236 | m_default_data = region()->base(); |
| 237 | if (m_default_data) |
| 238 | { |
| 239 | assert( region()->bytes() == m_size ); |
| 240 | } |
| 237 | 241 | } |
| 238 | 242 | |
| 239 | 243 | save_item( NAME(m_control) ); |
branches/code_cleanup/src/devices/sound/2610intf.cpp
| r250281 | r250282 | |
| 16 | 16 | #include "2610intf.h" |
| 17 | 17 | #include "fm.h" |
| 18 | 18 | |
| 19 | const char* YM2610_TAG = "ymsnd"; |
| 20 | const char* YM2610_DELTAT_TAG = "ymsnd.deltat"; |
| 21 | |
| 19 | 22 | static void psg_set_clock(void *param, int clock) |
| 20 | 23 | { |
| 21 | 24 | ym2610_device *ym2610 = (ym2610_device *) param; |
| r250281 | r250282 | |
| 143 | 146 | ay8910_device::device_start(); |
| 144 | 147 | |
| 145 | 148 | int rate = clock()/72; |
| 146 | | void *pcmbufa,*pcmbufb; |
| 147 | | int pcmsizea,pcmsizeb; |
| 148 | | std::string name(tag()); |
| 149 | 149 | |
| 150 | 150 | m_irq_handler.resolve(); |
| 151 | 151 | |
| r250281 | r250282 | |
| 156 | 156 | /* stream system initialize */ |
| 157 | 157 | m_stream = machine().sound().stream_alloc(*this,0,2,rate, stream_update_delegate(FUNC(ym2610_device::stream_generate),this)); |
| 158 | 158 | /* setup adpcm buffers */ |
| 159 | | pcmbufa = region()->base(); |
| 160 | | pcmsizea = region()->bytes(); |
| 161 | | name.append(".deltat"); |
| 162 | | pcmbufb = (void *)(machine().root_device().memregion(name.c_str())->base()); |
| 163 | | pcmsizeb = machine().root_device().memregion(name.c_str())->bytes(); |
| 164 | | if (pcmbufb == NULL || pcmsizeb == 0) |
| 159 | void *pcmbufa = region()->base(); |
| 160 | int pcmsizea = region()->bytes(); |
| 161 | |
| 162 | std::string name = tag() + std::string(".deltat"); |
| 163 | memory_region *deltat_region = machine().root_device().memregion(name.c_str()); |
| 164 | void *pcmbufb = pcmbufa; |
| 165 | int pcmsizeb = pcmsizea; |
| 166 | if (deltat_region != NULL && deltat_region->base() != NULL && deltat_region->bytes() != 0) |
| 165 | 167 | { |
| 166 | | pcmbufb = pcmbufa; |
| 167 | | pcmsizeb = pcmsizea; |
| 168 | pcmbufb = deltat_region->base(); |
| 169 | pcmsizeb = deltat_region->bytes(); |
| 168 | 170 | } |
| 169 | 171 | |
| 170 | 172 | /**** initialize YM2610 ****/ |
| r250281 | r250282 | |
| 207 | 209 | const device_type YM2610 = &device_creator<ym2610_device>; |
| 208 | 210 | |
| 209 | 211 | ym2610_device::ym2610_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 210 | | : ay8910_device(mconfig, YM2610, "YM2610", tag, owner, clock, PSG_TYPE_YM, 1, 0, "ym2610", __FILE__), |
| 211 | | m_irq_handler(*this) |
| 212 | : ay8910_device(mconfig, YM2610, "YM2610", tag, owner, clock, PSG_TYPE_YM, 1, 0, "ym2610", __FILE__) |
| 213 | , m_irq_handler(*this) |
| 212 | 214 | { |
| 213 | 215 | } |
| 214 | 216 | |
| 215 | 217 | ym2610_device::ym2610_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) |
| 216 | | : ay8910_device(mconfig, type, name, tag, owner, clock, PSG_TYPE_YM, 1, 0, shortname, source), |
| 217 | | m_irq_handler(*this) |
| 218 | : ay8910_device(mconfig, type, name, tag, owner, clock, PSG_TYPE_YM, 1, 0, shortname, source) |
| 219 | , m_irq_handler(*this) |
| 218 | 220 | { |
| 219 | 221 | } |
| 220 | 222 | |
branches/code_cleanup/src/devices/sound/upd7759.cpp
| r250281 | r250282 | |
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | upd775x_device::upd775x_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) |
| 148 | | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 149 | | device_sound_interface(mconfig, *this), |
| 150 | | m_channel(NULL), |
| 151 | | m_sample_offset_shift(0), |
| 152 | | m_pos(0), |
| 153 | | m_step(0), |
| 154 | | m_fifo_in(0), |
| 155 | | m_reset(0), |
| 156 | | m_start(0), |
| 157 | | m_drq(0), |
| 158 | | m_state(0), |
| 159 | | m_clocks_left(0), |
| 160 | | m_nibbles_left(0), |
| 161 | | m_repeat_count(0), |
| 162 | | m_post_drq_state(0), |
| 163 | | m_post_drq_clocks(0), |
| 164 | | m_req_sample(0), |
| 165 | | m_last_sample(0), |
| 166 | | m_block_header(0), |
| 167 | | m_sample_rate(0), |
| 168 | | m_first_valid_header(0), |
| 169 | | m_offset(0), |
| 170 | | m_repeat_offset(0), |
| 171 | | m_adpcm_state(0), |
| 172 | | m_adpcm_data(0), |
| 173 | | m_sample(0), |
| 174 | | m_rom(NULL), |
| 175 | | m_rombase(NULL), |
| 176 | | m_romoffset(0), |
| 177 | | m_rommask(0), |
| 178 | | m_drqcallback(*this) |
| 148 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source) |
| 149 | , device_sound_interface(mconfig, *this) |
| 150 | , m_channel(NULL) |
| 151 | , m_sample_offset_shift(0) |
| 152 | , m_pos(0) |
| 153 | , m_step(0) |
| 154 | , m_fifo_in(0) |
| 155 | , m_reset(0) |
| 156 | , m_start(0) |
| 157 | , m_drq(0) |
| 158 | , m_state(0) |
| 159 | , m_clocks_left(0) |
| 160 | , m_nibbles_left(0) |
| 161 | , m_repeat_count(0) |
| 162 | , m_post_drq_state(0) |
| 163 | , m_post_drq_clocks(0) |
| 164 | , m_req_sample(0) |
| 165 | , m_last_sample(0) |
| 166 | , m_block_header(0) |
| 167 | , m_sample_rate(0) |
| 168 | , m_first_valid_header(0) |
| 169 | , m_offset(0) |
| 170 | , m_repeat_offset(0) |
| 171 | , m_adpcm_state(0) |
| 172 | , m_adpcm_data(0) |
| 173 | , m_sample(0) |
| 174 | , m_rom_region(*this, tag) |
| 175 | , m_rom(NULL) |
| 176 | , m_rombase(NULL) |
| 177 | , m_romoffset(0) |
| 178 | , m_rommask(0) |
| 179 | , m_drqcallback(*this) |
| 179 | 180 | { |
| 180 | 181 | } |
| 181 | 182 | |
| 182 | 183 | const device_type UPD7759 = &device_creator<upd7759_device>; |
| 183 | 184 | |
| 184 | 185 | upd7759_device::upd7759_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 185 | | : upd775x_device(mconfig, UPD7759, "uPD7759", tag, owner, clock, "upd7759", __FILE__), |
| 186 | | m_timer(NULL) |
| 186 | : upd775x_device(mconfig, UPD7759, "uPD7759", tag, owner, clock, "upd7759", __FILE__) |
| 187 | , m_timer(NULL) |
| 187 | 188 | { |
| 188 | 189 | } |
| 189 | 190 | |
| 190 | 191 | |
| 191 | 192 | upd7759_device::upd7759_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) |
| 192 | | : upd775x_device(mconfig, type, name, tag, owner, clock, shortname, source), |
| 193 | | m_timer(NULL) |
| 193 | : upd775x_device(mconfig, type, name, tag, owner, clock, shortname, source) |
| 194 | , m_timer(NULL) |
| 194 | 195 | { |
| 195 | 196 | } |
| 196 | 197 | |
| r250281 | r250282 | |
| 231 | 232 | |
| 232 | 233 | /* compute the ROM base or allocate a timer */ |
| 233 | 234 | m_romoffset = 0; |
| 234 | | m_rom = m_rombase = region()->base(); |
| 235 | | if (m_rombase == NULL) |
| 235 | if (m_rom_region != NULL) |
| 236 | 236 | { |
| 237 | m_rom = m_rombase = m_rom_region->base(); |
| 238 | |
| 239 | UINT32 romsize = m_rom_region->bytes(); |
| 240 | if (romsize >= 0x20000) |
| 241 | { |
| 242 | m_rommask = 0x1ffff; |
| 243 | } |
| 244 | else |
| 245 | { |
| 246 | m_rommask = romsize - 1; |
| 247 | } |
| 248 | |
| 249 | m_drqcallback.set_callback(DEVCB_NULL); |
| 250 | } |
| 251 | else |
| 252 | { |
| 237 | 253 | assert(type() == UPD7759); // other chips do not support slave mode |
| 238 | 254 | m_timer = timer_alloc(TIMER_SLAVE_UPDATE); |
| 239 | 255 | m_rommask = 0; |
| 240 | 256 | } |
| 241 | | else |
| 242 | | { |
| 243 | | UINT32 romsize = region()->bytes(); |
| 244 | | if (romsize >= 0x20000) m_rommask = 0x1ffff; |
| 245 | | else m_rommask = romsize - 1; |
| 246 | 257 | |
| 247 | | m_drqcallback.set_callback(DEVCB_NULL); |
| 248 | | } |
| 249 | | |
| 250 | 258 | /* assume /RESET and /START are both high */ |
| 251 | 259 | m_reset = 1; |
| 252 | 260 | m_start = 1; |
| r250281 | r250282 | |
| 306 | 314 | |
| 307 | 315 | /* compute the ROM base or allocate a timer */ |
| 308 | 316 | m_romoffset = 0; |
| 309 | | m_rom = m_rombase = region()->base(); |
| 310 | | if (m_rombase == NULL) |
| 317 | if (m_rom_region != NULL) |
| 311 | 318 | { |
| 312 | | m_rommask = 0; |
| 313 | | } |
| 314 | | else |
| 315 | | { |
| 319 | m_rom = m_rombase = m_rom_region->base(); |
| 320 | |
| 316 | 321 | UINT32 romsize = region()->bytes(); |
| 317 | | if (romsize >= 0x20000) m_rommask = 0x1ffff; |
| 318 | | else m_rommask = romsize - 1; |
| 322 | if (romsize >= 0x20000) |
| 323 | { |
| 324 | m_rommask = 0x1ffff; |
| 325 | } |
| 326 | else |
| 327 | { |
| 328 | m_rommask = romsize - 1; |
| 329 | } |
| 319 | 330 | |
| 320 | 331 | m_drqcallback.set_callback(DEVCB_NULL); |
| 321 | 332 | } |
| 333 | else |
| 334 | { |
| 335 | m_rommask = 0; |
| 336 | } |
| 322 | 337 | |
| 323 | 338 | /* assume /RESET and /START are both high */ |
| 324 | 339 | m_reset = 1; |
branches/code_cleanup/src/mame/audio/dcs.cpp
| r250281 | r250282 | |
| 594 | 594 | |
| 595 | 595 | void dcs_audio_device::dcs_boot() |
| 596 | 596 | { |
| 597 | | UINT8 buffer[0x1000]; |
| 598 | | // UINT32 max_banks; |
| 599 | | UINT16 *base; |
| 600 | | int i; |
| 601 | | |
| 602 | 597 | switch (m_rev) |
| 603 | 598 | { |
| 604 | 599 | /* rev 1/1.5: use the last set data bank to boot from */ |
| 605 | 600 | case 1: |
| 606 | 601 | case 15: |
| 607 | | |
| 602 | { |
| 608 | 603 | /* determine the base */ |
| 609 | | // max_banks = m_bootrom_words / 0x1000; |
| 610 | | base = m_bootrom + ((m_sounddata_bank * 0x1000) % m_bootrom_words); |
| 604 | // max_banks = m_bootrom_words / 0x1000; |
| 605 | UINT16* base = m_bootrom + ((m_sounddata_bank * 0x1000) % m_bootrom_words); |
| 611 | 606 | |
| 612 | 607 | /* convert from 16-bit data to 8-bit data and boot */ |
| 613 | | for (i = 0; i < 0x1000; i++) |
| 608 | UINT8 buffer[0x1000]; |
| 609 | for (int i = 0; i < 0x1000; i++) |
| 610 | { |
| 614 | 611 | buffer[i] = base[i]; |
| 612 | } |
| 613 | assert(m_internal_program_ram != NULL); |
| 615 | 614 | m_cpu->load_boot_data(buffer, m_internal_program_ram); |
| 616 | 615 | break; |
| 616 | } |
| 617 | 617 | |
| 618 | 618 | /* rev 2: use the ROM page in the SDRC to boot from */ |
| 619 | 619 | case 2: |
| 620 | | |
| 620 | { |
| 621 | 621 | /* determine the base */ |
| 622 | UINT16* base; |
| 622 | 623 | if (m_bootrom == m_sounddata) |
| 623 | 624 | { |
| 624 | 625 | /* EPROM case: page is selected from the page register */ |
| r250281 | r250282 | |
| 631 | 632 | } |
| 632 | 633 | |
| 633 | 634 | /* convert from 16-bit data to 8-bit data and boot */ |
| 634 | | for (i = 0; i < 0x1000; i++) |
| 635 | UINT8 buffer[0x1000]; |
| 636 | for (int i = 0; i < 0x1000; i++) |
| 637 | { |
| 635 | 638 | buffer[i] = base[i]; |
| 639 | } |
| 640 | assert(m_internal_program_ram != NULL); |
| 636 | 641 | m_cpu->load_boot_data(buffer, m_internal_program_ram); |
| 637 | 642 | break; |
| 643 | } |
| 638 | 644 | |
| 639 | 645 | /* rev 3/4: HALT the ADSP-2181 until program is downloaded via IDMA */ |
| 640 | 646 | case 3: |
| r250281 | r250282 | |
| 665 | 671 | case 1: |
| 666 | 672 | case 15: |
| 667 | 673 | m_sounddata_bank = 0; |
| 668 | | membank("databank")->set_entry(0); |
| 674 | m_data_bank->set_entry(0); |
| 669 | 675 | break; |
| 670 | 676 | |
| 671 | 677 | /* rev 2: reset the SDRC ASIC */ |
| r250281 | r250282 | |
| 807 | 813 | m_sounddata_words(0), |
| 808 | 814 | m_sounddata_banks(0), |
| 809 | 815 | m_sounddata_bank(0), |
| 816 | m_data_bank(*this, "databank"), |
| 817 | m_rom_page(NULL), |
| 818 | m_dram_page(NULL), |
| 810 | 819 | m_auto_ack(0), |
| 811 | 820 | m_latch_control(0), |
| 812 | 821 | m_input_data(0), |
| r250281 | r250282 | |
| 845 | 854 | { |
| 846 | 855 | m_sram = NULL; |
| 847 | 856 | |
| 848 | | m_internal_program_ram = (UINT32 *)memshare("dcsint")->ptr(); |
| 849 | | m_external_program_ram = (UINT32 *)memshare("dcsext")->ptr(); |
| 857 | memory_share *internal_ram = memshare("dcsint"); |
| 858 | if (internal_ram != NULL) |
| 859 | { |
| 860 | m_internal_program_ram = (UINT32 *)internal_ram->ptr(); |
| 861 | } |
| 862 | memory_share *external_ram = memshare("dcsext"); |
| 863 | if (external_ram != NULL) |
| 864 | { |
| 865 | m_external_program_ram = (UINT32 *)external_ram->ptr(); |
| 866 | } |
| 850 | 867 | |
| 851 | 868 | /* find the DCS CPU and the sound ROMs */ |
| 852 | 869 | m_cpu = subdevice<adsp21xx_device>("dcs"); |
| r250281 | r250282 | |
| 866 | 883 | if (m_rev == 1) |
| 867 | 884 | { |
| 868 | 885 | m_sounddata_banks = m_sounddata_words / 0x1000; |
| 869 | | membank("databank")->configure_entries(0, m_sounddata_banks, m_sounddata, 0x1000*2); |
| 886 | m_data_bank->configure_entries(0, m_sounddata_banks, m_sounddata, 0x1000*2); |
| 870 | 887 | } |
| 871 | 888 | else |
| 872 | 889 | { |
| 873 | 890 | m_sounddata_banks = m_sounddata_words / 0x800; |
| 874 | | membank("databank")->configure_entries(0, m_sounddata_banks, m_sounddata, 0x800*2); |
| 891 | m_data_bank->configure_entries(0, m_sounddata_banks, m_sounddata, 0x800*2); |
| 875 | 892 | } |
| 876 | 893 | |
| 877 | 894 | /* create the timers */ |
| r250281 | r250282 | |
| 891 | 908 | { |
| 892 | 909 | int soundbank_words; |
| 893 | 910 | |
| 894 | | m_internal_program_ram = (UINT32 *)memshare("dcsint")->ptr(); |
| 895 | | m_external_program_ram = (UINT32 *)memshare("dcsext")->ptr(); |
| 911 | memory_share *internal_ram = memshare("dcsint"); |
| 912 | if (internal_ram != NULL) |
| 913 | { |
| 914 | m_internal_program_ram = (UINT32 *)internal_ram->ptr(); |
| 915 | } |
| 916 | memory_share *external_ram = memshare("dcsext"); |
| 917 | if (external_ram != NULL) |
| 918 | { |
| 919 | m_external_program_ram = (UINT32 *)external_ram->ptr(); |
| 920 | } |
| 896 | 921 | |
| 897 | 922 | /* find the DCS CPU and the sound ROMs */ |
| 898 | 923 | m_cpu = subdevice<adsp21xx_device>("dcs2"); |
| r250281 | r250282 | |
| 937 | 962 | } |
| 938 | 963 | m_sounddata_banks = m_sounddata_words / soundbank_words; |
| 939 | 964 | if (m_rev != 2) |
| 940 | | membank("databank")->configure_entries(0, m_sounddata_banks, m_sounddata, soundbank_words*2); |
| 965 | { |
| 966 | m_data_bank->configure_entries(0, m_sounddata_banks, m_sounddata, soundbank_words*2); |
| 967 | } |
| 941 | 968 | |
| 942 | 969 | /* allocate memory for the SRAM */ |
| 943 | 970 | m_sram = auto_alloc_array(machine(), UINT16, 0x8000*4/2); |
| r250281 | r250282 | |
| 982 | 1009 | |
| 983 | 1010 | READ16_MEMBER( dcs_audio_device::dcs_dataram_r ) |
| 984 | 1011 | { |
| 1012 | assert(m_external_program_ram != NULL); |
| 985 | 1013 | return m_external_program_ram[offset] >> 8; |
| 986 | 1014 | } |
| 987 | 1015 | |
| 988 | 1016 | |
| 989 | 1017 | WRITE16_MEMBER( dcs_audio_device::dcs_dataram_w ) |
| 990 | 1018 | { |
| 1019 | assert(m_external_program_ram != NULL); |
| 991 | 1020 | UINT16 val = m_external_program_ram[offset] >> 8; |
| 992 | 1021 | COMBINE_DATA(&val); |
| 993 | 1022 | m_external_program_ram[offset] = (val << 8) | (m_external_program_ram[offset] & 0x0000ff); |
| r250281 | r250282 | |
| 1001 | 1030 | else |
| 1002 | 1031 | m_sounddata_bank = (m_sounddata_bank & 0xff00) | (data & 0xff); |
| 1003 | 1032 | |
| 1004 | | membank("databank")->set_entry(m_sounddata_bank % m_sounddata_banks); |
| 1033 | m_data_bank->set_entry(m_sounddata_bank % m_sounddata_banks); |
| 1005 | 1034 | |
| 1006 | 1035 | /* bit 11 = sound board led */ |
| 1007 | 1036 | #if 0 |
| r250281 | r250282 | |
| 1014 | 1043 | { |
| 1015 | 1044 | m_sounddata_bank = (m_sounddata_bank & 0x00ff) | ((data & 0x01) << 8) | ((data & 0xfc) << 7); |
| 1016 | 1045 | |
| 1017 | | membank("databank")->set_entry(m_sounddata_bank % m_sounddata_banks); |
| 1046 | m_data_bank->set_entry(m_sounddata_bank % m_sounddata_banks); |
| 1018 | 1047 | } |
| 1019 | 1048 | |
| 1020 | 1049 | /************************************* |
| r250281 | r250282 | |
| 1034 | 1063 | { |
| 1035 | 1064 | /* ROM-based; use the memory page to select from ROM */ |
| 1036 | 1065 | if (SDRC_ROM_MS == 1 && SDRC_ROM_ST != 3) |
| 1037 | | membank("rompage")->set_base(&m_sounddata[(SDRC_EPM_PG * pagesize) % m_sounddata_words]); |
| 1066 | { |
| 1067 | m_rom_page->set_base(&m_sounddata[(SDRC_EPM_PG * pagesize) % m_sounddata_words]); |
| 1068 | } |
| 1038 | 1069 | } |
| 1039 | 1070 | else |
| 1040 | 1071 | { |
| 1041 | 1072 | /* RAM-based; use the ROM page to select from ROM, and the memory page to select from RAM */ |
| 1042 | 1073 | if (SDRC_ROM_MS == 1 && SDRC_ROM_ST != 3) |
| 1043 | | membank("rompage")->set_base(&m_bootrom[(SDRC_ROM_PG * 4096 /*pagesize*/) % m_bootrom_words]); |
| 1074 | { |
| 1075 | m_rom_page->set_base(&m_bootrom[(SDRC_ROM_PG * 4096 /*pagesize*/) % m_bootrom_words]); |
| 1076 | } |
| 1044 | 1077 | if (SDRC_DM_ST != 0) |
| 1045 | | membank("drampage")->set_base(&m_sounddata[(SDRC_DM_PG * 1024) % m_sounddata_words]); |
| 1078 | { |
| 1079 | m_dram_page->set_base(&m_sounddata[(SDRC_DM_PG * 1024) % m_sounddata_words]); |
| 1080 | } |
| 1046 | 1081 | } |
| 1047 | 1082 | } |
| 1048 | 1083 | } |
| r250281 | r250282 | |
| 1087 | 1122 | int baseaddr = (SDRC_ROM_ST == 0) ? 0x0000 : (SDRC_ROM_ST == 1) ? 0x3000 : 0x3400; |
| 1088 | 1123 | int pagesize = (SDRC_ROM_SZ == 0 && SDRC_ROM_ST != 0) ? 4096 : 1024; |
| 1089 | 1124 | m_data->install_read_bank(baseaddr, baseaddr + pagesize - 1, "rompage"); |
| 1125 | m_rom_page = membank("rompage"); |
| 1090 | 1126 | } |
| 1091 | 1127 | |
| 1092 | 1128 | /* map the DRAM page as bank 26 */ |
| r250281 | r250282 | |
| 1094 | 1130 | { |
| 1095 | 1131 | int baseaddr = (SDRC_DM_ST == 1) ? 0x0000 : (SDRC_DM_ST == 2) ? 0x3000 : 0x3400; |
| 1096 | 1132 | m_data->install_readwrite_bank(baseaddr, baseaddr + 0x3ff, "drampage"); |
| 1133 | m_dram_page = membank("drampage"); |
| 1097 | 1134 | } |
| 1098 | 1135 | |
| 1099 | 1136 | /* update the bank pointers */ |
| r250281 | r250282 | |
| 1285 | 1322 | /* offset 2 controls RAM pages */ |
| 1286 | 1323 | case 2: |
| 1287 | 1324 | dsio.reg[2] = data; |
| 1288 | | membank("databank")->set_entry(DSIO_DM_PG % m_sounddata_banks); |
| 1325 | m_data_bank->set_entry(DSIO_DM_PG % m_sounddata_banks); |
| 1289 | 1326 | break; |
| 1290 | 1327 | } |
| 1291 | 1328 | } |
| r250281 | r250282 | |
| 1352 | 1389 | /* offset 2 controls RAM pages */ |
| 1353 | 1390 | case 2: |
| 1354 | 1391 | dsio.reg[2] = data; |
| 1355 | | membank("databank")->set_entry(DENV_DM_PG % m_sounddata_banks); |
| 1392 | m_data_bank->set_entry(DENV_DM_PG % m_sounddata_banks); |
| 1356 | 1393 | break; |
| 1357 | 1394 | |
| 1358 | 1395 | /* offset 3 controls FIFO reset */ |
branches/code_cleanup/src/mame/drivers/sfbonus.cpp
| r250281 | r250282 | |
| 294 | 294 | m_2801_regs(*this, "2801_regs"), |
| 295 | 295 | m_2c01_regs(*this, "2c01_regs"), |
| 296 | 296 | m_3000_regs(*this, "3000_regs"), |
| 297 | | m_3800_regs(*this, "3800_regs") { } |
| 297 | m_3800_regs(*this, "3800_regs") |
| 298 | { |
| 299 | } |
| 298 | 300 | |
| 299 | 301 | required_device<cpu_device> m_maincpu; |
| 300 | 302 | required_device<gfxdecode_device> m_gfxdecode; |
| r250281 | r250282 | |
| 5843 | 5845 | ROM_REGION( 0x100000, "gfx2", ROMREGION_ERASE00 ) |
| 5844 | 5846 | ROM_END |
| 5845 | 5847 | |
| 5846 | | //ROM_REGION( 0x80000, "user1", 0 ) /* Z80 Code */ |
| 5847 | | //ROM_LOAD( "dummy.rom", 0x00000, 0x40000, CRC(1) SHA1(1) ) |
| 5848 | | |
| 5849 | 5848 | DRIVER_INIT_MEMBER(sfbonus_state,sfbonus_common) |
| 5850 | 5849 | { |
| 5851 | 5850 | m_tilemap_ram = auto_alloc_array(machine(), UINT8, 0x4000); |
| r250281 | r250282 | |
| 5873 | 5872 | memset(m_videoram, 0xff, 0x10000); |
| 5874 | 5873 | |
| 5875 | 5874 | save_pointer(NAME(m_videoram), 0x10000); |
| 5876 | | |
| 5877 | | // dummy.rom helper |
| 5878 | | { |
| 5879 | | UINT8 *ROM = memregion("maincpu")->base(); |
| 5880 | | int length = memregion("maincpu")->bytes(); |
| 5881 | | UINT8* ROM2 = memregion("user1")->base(); |
| 5882 | | |
| 5883 | | if (ROM2) |
| 5884 | | { |
| 5885 | | printf("X %02x %02x %02x %02x %02x %02x %02x %02x\n", ROM[0x50], ROM[0x51], ROM[0x52], ROM[0x53], ROM[0x54], ROM[0x55],ROM[0x56],ROM[0x57]); |
| 5886 | | |
| 5887 | | { |
| 5888 | | int x; |
| 5889 | | int y; |
| 5890 | | for (y = 0; y < 0x8; y++) |
| 5891 | | { |
| 5892 | | printf("@Echo Off\n"); |
| 5893 | | printf("a.exe "); |
| 5894 | | for (x = 0; x < 0x20 * 0x8; x += 0x8) |
| 5895 | | { |
| 5896 | | printf("%02x %02x ", ROM[x + y], ROM2[x + y]); |
| 5897 | | } |
| 5898 | | printf("\n"); |
| 5899 | | } |
| 5900 | | |
| 5901 | | } |
| 5902 | | |
| 5903 | | { |
| 5904 | | FILE *fp; |
| 5905 | | char filename[256]; |
| 5906 | | sprintf(filename,"decr_%s", machine().system().name); |
| 5907 | | fp = fopen(filename, "w+b"); |
| 5908 | | if (fp) |
| 5909 | | { |
| 5910 | | fwrite(ROM, length, 1, fp); |
| 5911 | | fclose(fp); |
| 5912 | | } |
| 5913 | | } |
| 5914 | | } |
| 5915 | | } |
| 5916 | 5875 | } |
| 5917 | 5876 | |
| 5918 | 5877 | void sfbonus_state::sfbonus_bitswap( |
| r250281 | r250282 | |
| 6348 | 6307 | // Known sets but no roms dumped at all for these: |
| 6349 | 6308 | // Merry Circus |
| 6350 | 6309 | // Devil Island - 14 Liner version |
| 6351 | | // Fruit Bonus 2010 (or is this on the older goldstar.c style hardware) |
| 6352 | 6310 | |
| 6353 | | |
| 6354 | 6311 | // ?? what is this |
| 6355 | 6312 | GAME( 200?, amclink, 0, sfbonus, amcoe1_reels3, sfbonus_state, sfbonus_common, ROT0, "Amcoe", "Amcoe Link Control Box (Version 2.2)", MACHINE_NOT_WORKING) |
branches/code_cleanup/src/mame/includes/btime.h
| r250281 | r250282 | |
| 10 | 10 | { |
| 11 | 11 | public: |
| 12 | 12 | btime_state(const machine_config &mconfig, device_type type, const char *tag) |
| 13 | | : driver_device(mconfig, type, tag), |
| 14 | | m_rambase(*this, "rambase"), |
| 15 | | m_videoram(*this, "videoram"), |
| 16 | | m_colorram(*this, "colorram"), |
| 17 | | m_bnj_backgroundram(*this, "bnj_bgram"), |
| 18 | | m_zoar_scrollram(*this, "zoar_scrollram"), |
| 19 | | m_lnc_charbank(*this, "lnc_charbank"), |
| 20 | | m_deco_charram(*this, "deco_charram"), |
| 21 | | m_spriteram(*this, "spriteram"), |
| 22 | | m_audio_rambase(*this, "audio_rambase"), |
| 23 | | m_maincpu(*this, "maincpu"), |
| 24 | | m_audiocpu(*this, "audiocpu"), |
| 25 | | m_gfxdecode(*this, "gfxdecode"), |
| 26 | | m_screen(*this, "screen"), |
| 27 | | m_palette(*this, "palette") { } |
| 13 | : driver_device(mconfig, type, tag) |
| 14 | , m_rambase(*this, "rambase") |
| 15 | , m_videoram(*this, "videoram") |
| 16 | , m_colorram(*this, "colorram") |
| 17 | , m_bnj_backgroundram(*this, "bnj_bgram") |
| 18 | , m_zoar_scrollram(*this, "zoar_scrollram") |
| 19 | , m_lnc_charbank(*this, "lnc_charbank") |
| 20 | , m_deco_charram(*this, "deco_charram") |
| 21 | , m_spriteram(*this, "spriteram") |
| 22 | , m_audio_rambase(*this, "audio_rambase") |
| 23 | , m_maincpu(*this, "maincpu") |
| 24 | , m_audiocpu(*this, "audiocpu") |
| 25 | , m_gfxdecode(*this, "gfxdecode") |
| 26 | , m_screen(*this, "screen") |
| 27 | , m_palette(*this, "palette") |
| 28 | , m_prom_region(*this, "proms") |
| 29 | { |
| 30 | } |
| 28 | 31 | |
| 29 | 32 | /* memory pointers */ |
| 30 | 33 | optional_shared_ptr<UINT8> m_rambase; |
| r250281 | r250282 | |
| 62 | 65 | required_device<gfxdecode_device> m_gfxdecode; |
| 63 | 66 | required_device<screen_device> m_screen; |
| 64 | 67 | required_device<palette_device> m_palette; |
| 68 | optional_memory_region m_prom_region; |
| 65 | 69 | |
| 66 | 70 | DECLARE_WRITE8_MEMBER(audio_nmi_enable_w); |
| 67 | 71 | DECLARE_WRITE8_MEMBER(lnc_w); |
branches/code_cleanup/src/mame/video/btime.cpp
| r250281 | r250282 | |
| 32 | 32 | |
| 33 | 33 | PALETTE_INIT_MEMBER(btime_state,btime) |
| 34 | 34 | { |
| 35 | | const UINT8 *color_prom = memregion("proms")->base(); |
| 36 | | int i; |
| 37 | | |
| 38 | | |
| 39 | 35 | /* Burger Time doesn't have a color PROM, but Hamburge has. */ |
| 40 | 36 | /* This function is also used by Eggs. */ |
| 41 | | if (color_prom == 0) return; |
| 37 | if (m_prom_region == NULL) |
| 38 | { |
| 39 | return; |
| 40 | } |
| 42 | 41 | |
| 43 | | for (i = 0; i < palette.entries(); i++) |
| 42 | const UINT8 *color_prom = m_prom_region->base(); |
| 43 | |
| 44 | for (int i = 0; i < palette.entries(); i++) |
| 44 | 45 | { |
| 45 | | int bit0, bit1, bit2, r, g, b; |
| 46 | /* red component */ |
| 47 | int bit0 = (color_prom[i] >> 0) & 0x01; |
| 48 | int bit1 = (color_prom[i] >> 1) & 0x01; |
| 49 | int bit2 = (color_prom[i] >> 2) & 0x01; |
| 50 | int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; |
| 46 | 51 | |
| 47 | | /* red component */ |
| 48 | | bit0 = (color_prom[i] >> 0) & 0x01; |
| 49 | | bit1 = (color_prom[i] >> 1) & 0x01; |
| 50 | | bit2 = (color_prom[i] >> 2) & 0x01; |
| 51 | | r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; |
| 52 | 52 | /* green component */ |
| 53 | 53 | bit0 = (color_prom[i] >> 3) & 0x01; |
| 54 | 54 | bit1 = (color_prom[i] >> 4) & 0x01; |
| 55 | 55 | bit2 = (color_prom[i] >> 5) & 0x01; |
| 56 | | g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; |
| 56 | int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; |
| 57 | |
| 57 | 58 | /* blue component */ |
| 58 | 59 | bit0 = 0; |
| 59 | 60 | bit1 = (color_prom[i] >> 6) & 0x01; |
| 60 | 61 | bit2 = (color_prom[i] >> 7) & 0x01; |
| 61 | | b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; |
| 62 | int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; |
| 62 | 63 | |
| 63 | 64 | palette.set_pen_color(i, rgb_t(r,g,b)); |
| 64 | 65 | } |
| r250281 | r250282 | |
| 84 | 85 | PALETTE_INIT_MEMBER(btime_state,lnc) |
| 85 | 86 | { |
| 86 | 87 | const UINT8 *color_prom = memregion("proms")->base(); |
| 87 | | int i; |
| 88 | 88 | |
| 89 | | for (i = 0; i < palette.entries(); i++) |
| 89 | for (int i = 0; i < palette.entries(); i++) |
| 90 | 90 | { |
| 91 | | int bit0, bit1, bit2, r, g, b; |
| 91 | /* red component */ |
| 92 | int bit0 = (color_prom[i] >> 7) & 0x01; |
| 93 | int bit1 = (color_prom[i] >> 6) & 0x01; |
| 94 | int bit2 = (color_prom[i] >> 5) & 0x01; |
| 95 | int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; |
| 92 | 96 | |
| 93 | | /* red component */ |
| 94 | | bit0 = (color_prom[i] >> 7) & 0x01; |
| 95 | | bit1 = (color_prom[i] >> 6) & 0x01; |
| 96 | | bit2 = (color_prom[i] >> 5) & 0x01; |
| 97 | | r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; |
| 98 | 97 | /* green component */ |
| 99 | 98 | bit0 = (color_prom[i] >> 4) & 0x01; |
| 100 | 99 | bit1 = (color_prom[i] >> 3) & 0x01; |
| 101 | 100 | bit2 = (color_prom[i] >> 2) & 0x01; |
| 102 | | g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; |
| 101 | int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; |
| 102 | |
| 103 | 103 | /* blue component */ |
| 104 | 104 | bit0 = 0; |
| 105 | 105 | bit1 = (color_prom[i] >> 1) & 0x01; |
| 106 | 106 | bit2 = (color_prom[i] >> 0) & 0x01; |
| 107 | | b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; |
| 107 | int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; |
| 108 | 108 | |
| 109 | 109 | palette.set_pen_color(i, rgb_t(r,g,b)); |
| 110 | 110 | } |