trunk/src/mess/drivers/snes.c
| r21585 | r21586 | |
| 1094 | 1094 | * |
| 1095 | 1095 | *************************************/ |
| 1096 | 1096 | |
| 1097 | static MACHINE_START( snes_mess ) |
| 1098 | { |
| 1099 | snes_state *state = machine.driver_data<snes_state>(); |
| 1100 | |
| 1101 | machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(snes_machine_stop),&machine)); |
| 1102 | MACHINE_START_CALL(snes); |
| 1103 | |
| 1104 | switch (state->m_has_addon_chip) |
| 1105 | { |
| 1106 | case HAS_SDD1: |
| 1107 | sdd1_init(machine); |
| 1108 | break; |
| 1109 | case HAS_SPC7110: |
| 1110 | spc7110_init(machine); |
| 1111 | break; |
| 1112 | case HAS_SPC7110_RTC: |
| 1113 | spc7110rtc_init(machine); |
| 1114 | break; |
| 1115 | } |
| 1116 | } |
| 1117 | |
| 1118 | static MACHINE_START( snesst ) |
| 1119 | { |
| 1120 | machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sufami_machine_stop),&machine)); |
| 1121 | MACHINE_START_CALL(snes); |
| 1122 | } |
| 1123 | |
| 1097 | 1124 | static MACHINE_RESET( snes_mess ) |
| 1098 | 1125 | { |
| 1099 | 1126 | snes_state *state = machine.driver_data<snes_state>(); |
| r21585 | r21586 | |
| 1103 | 1130 | state->m_io_read = snes_input_read; |
| 1104 | 1131 | state->m_oldjoy1_read = snes_oldjoy1_read; |
| 1105 | 1132 | state->m_oldjoy2_read = snes_oldjoy2_read; |
| 1133 | |
| 1134 | // see if there's a uPD7725 DSP in the machine config |
| 1135 | state->m_upd7725 = machine.device<upd7725_device>("dsp"); |
| 1136 | |
| 1137 | // if we have a DSP, halt it for the moment |
| 1138 | if (state->m_upd7725) |
| 1139 | machine.device("dsp")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); |
| 1140 | |
| 1141 | // ditto for a uPD96050 (Seta ST-010 or ST-011) |
| 1142 | state->m_upd96050 = machine.device<upd96050_device>("setadsp"); |
| 1143 | if (state->m_upd96050) |
| 1144 | machine.device("setadsp")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); |
| 1145 | |
| 1146 | switch (state->m_has_addon_chip) |
| 1147 | { |
| 1148 | case HAS_DSP1: |
| 1149 | case HAS_DSP2: |
| 1150 | case HAS_DSP3: |
| 1151 | case HAS_DSP4: |
| 1152 | // cartridge uses the DSP, let 'er rip |
| 1153 | if (state->m_upd7725) |
| 1154 | machine.device("dsp")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 1155 | else |
| 1156 | { |
| 1157 | logerror("SNES: Game uses a DSP, but the machine driver is missing the uPD7725!\n"); |
| 1158 | state->m_has_addon_chip = HAS_NONE; // prevent crash trying to access NULL device |
| 1159 | } |
| 1160 | break; |
| 1161 | |
| 1162 | case HAS_RTC: |
| 1163 | srtc_init(machine); |
| 1164 | break; |
| 1165 | |
| 1166 | case HAS_OBC1: |
| 1167 | obc1_init(machine); |
| 1168 | break; |
| 1169 | |
| 1170 | case HAS_ST010: |
| 1171 | case HAS_ST011: |
| 1172 | // cartridge uses the DSP, let 'er rip |
| 1173 | if (state->m_upd96050) |
| 1174 | machine.device("setadsp")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 1175 | else |
| 1176 | { |
| 1177 | logerror("SNES: Game uses a Seta DSP, but the machine driver is missing the uPD96050!\n"); |
| 1178 | state->m_has_addon_chip = HAS_NONE; // prevent crash trying to access NULL device |
| 1179 | } |
| 1180 | break; |
| 1181 | |
| 1182 | default: |
| 1183 | break; |
| 1184 | } |
| 1106 | 1185 | } |
| 1107 | 1186 | |
| 1108 | 1187 | static MACHINE_CONFIG_START( snes_base, snes_state ) |
trunk/src/mess/machine/snescart.c
| r21585 | r21586 | |
| 211 | 211 | free(battery_ram); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | | static void snes_machine_stop(running_machine &machine) |
| 214 | void snes_machine_stop(running_machine &machine) |
| 215 | 215 | { |
| 216 | 216 | snes_state *state = machine.driver_data<snes_state>(); |
| 217 | 217 | |
| r21585 | r21586 | |
| 220 | 220 | snes_save_sram(machine); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | | MACHINE_START( snes_mess ) |
| 224 | | { |
| 225 | | machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(snes_machine_stop),&machine)); |
| 226 | | MACHINE_START_CALL(snes); |
| 227 | | } |
| 228 | 223 | |
| 229 | | |
| 230 | 224 | static void sufami_load_sram(running_machine &machine, const char *cart_tag) |
| 231 | 225 | { |
| 232 | 226 | UINT8 ii; |
| r21585 | r21586 | |
| 256 | 250 | free(battery_ram); |
| 257 | 251 | } |
| 258 | 252 | |
| 259 | | static void sufami_machine_stop(running_machine &machine) |
| 253 | void sufami_machine_stop(running_machine &machine) |
| 260 | 254 | { |
| 261 | 255 | snes_state *state = machine.driver_data<snes_state>(); |
| 262 | 256 | UINT8 ii; |
| r21585 | r21586 | |
| 288 | 282 | free(battery_ram); |
| 289 | 283 | } |
| 290 | 284 | |
| 291 | | MACHINE_START( snesst ) |
| 292 | | { |
| 293 | | machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sufami_machine_stop),&machine)); |
| 294 | | MACHINE_START_CALL(snes); |
| 295 | | } |
| 296 | 285 | |
| 297 | | |
| 298 | 286 | /*************************************************************************** |
| 299 | 287 | |
| 300 | 288 | Cart handling |
trunk/src/mame/machine/snes.c
| r21585 | r21586 | |
| 1183 | 1183 | // set up some known register power-up defaults |
| 1184 | 1184 | SNES_CPU_REG_STATE(WRIO) = 0xff; |
| 1185 | 1185 | |
| 1186 | | // see if there's a uPD7725 DSP in the machine config |
| 1187 | | state->m_upd7725 = machine.device<upd7725_device>("dsp"); |
| 1188 | | |
| 1189 | | // if we have a DSP, halt it for the moment |
| 1190 | | if (state->m_upd7725) |
| 1191 | | { |
| 1192 | | machine.device("dsp")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); |
| 1193 | | } |
| 1194 | | |
| 1195 | | // ditto for a uPD96050 (Seta ST-010 or ST-011) |
| 1196 | | state->m_upd96050 = machine.device<upd96050_device>("setadsp"); |
| 1197 | | if (state->m_upd96050) |
| 1198 | | { |
| 1199 | | machine.device("setadsp")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); |
| 1200 | | } |
| 1201 | | |
| 1202 | | switch (state->m_has_addon_chip) |
| 1203 | | { |
| 1204 | | case HAS_DSP1: |
| 1205 | | case HAS_DSP2: |
| 1206 | | case HAS_DSP3: |
| 1207 | | case HAS_DSP4: |
| 1208 | | // cartridge uses the DSP, let 'er rip |
| 1209 | | if (state->m_upd7725) |
| 1210 | | { |
| 1211 | | machine.device("dsp")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 1212 | | } |
| 1213 | | else |
| 1214 | | { |
| 1215 | | logerror("SNES: Game uses a DSP, but the machine driver is missing the uPD7725!\n"); |
| 1216 | | state->m_has_addon_chip = HAS_NONE; // prevent crash trying to access NULL device |
| 1217 | | } |
| 1218 | | break; |
| 1219 | | |
| 1220 | | case HAS_RTC: |
| 1221 | | srtc_init(machine); |
| 1222 | | break; |
| 1223 | | |
| 1224 | | case HAS_SDD1: |
| 1225 | | sdd1_reset(machine); |
| 1226 | | break; |
| 1227 | | |
| 1228 | | case HAS_OBC1: |
| 1229 | | obc1_init(machine); |
| 1230 | | break; |
| 1231 | | |
| 1232 | | case HAS_ST010: |
| 1233 | | case HAS_ST011: |
| 1234 | | // cartridge uses the DSP, let 'er rip |
| 1235 | | if (state->m_upd96050) |
| 1236 | | { |
| 1237 | | machine.device("setadsp")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 1238 | | } |
| 1239 | | else |
| 1240 | | { |
| 1241 | | logerror("SNES: Game uses a Seta DSP, but the machine driver is missing the uPD96050!\n"); |
| 1242 | | state->m_has_addon_chip = HAS_NONE; // prevent crash trying to access NULL device |
| 1243 | | } |
| 1244 | | break; |
| 1245 | | |
| 1246 | | default: |
| 1247 | | break; |
| 1248 | | } |
| 1249 | | |
| 1250 | 1186 | // init frame counter so first line is 0 |
| 1251 | 1187 | if (ATTOSECONDS_TO_HZ(machine.primary_screen->frame_period().attoseconds) >= 59) |
| 1252 | 1188 | state->m_ppu.m_beam.current_vert = SNES_VTOTAL_NTSC; |
| r21585 | r21586 | |
| 1286 | 1222 | // SNES_CPU_REG_STATE(WRDIVL) = 0xff; |
| 1287 | 1223 | // SNES_CPU_REG_STATE(WRDIVH) = 0xff; |
| 1288 | 1224 | |
| 1289 | | switch (state->m_has_addon_chip) |
| 1290 | | { |
| 1291 | | case HAS_SDD1: |
| 1292 | | sdd1_init(machine); |
| 1293 | | break; |
| 1294 | | case HAS_SPC7110: |
| 1295 | | spc7110_init(machine); |
| 1296 | | break; |
| 1297 | | case HAS_SPC7110_RTC: |
| 1298 | | spc7110rtc_init(machine); |
| 1299 | | break; |
| 1300 | | } |
| 1301 | | |
| 1302 | 1225 | if (state->m_cart[0].mode == SNES_MODE_BSX) |
| 1303 | 1226 | bsx_init(machine); |
| 1304 | 1227 | |
trunk/src/mame/includes/snes.h
| r21585 | r21586 | |
| 769 | 769 | // add-on chips IO |
| 770 | 770 | void srtc_write(running_machine &machine, UINT16 addr, UINT8 data); |
| 771 | 771 | UINT8 srtc_read(address_space &space, UINT16 addr); |
| 772 | void srtc_init(running_machine &machine); |
| 772 | 773 | extern DECLARE_READ8_HANDLER(obc1_read); |
| 773 | 774 | extern DECLARE_WRITE8_HANDLER(obc1_write); |
| 775 | void obc1_init(running_machine &machine); |
| 774 | 776 | UINT8 CX4_read(UINT32 addr); |
| 775 | 777 | void CX4_write(running_machine &machine, UINT32 addr, UINT8 data); |
| 776 | 778 | UINT8 sdd1_mmio_read(address_space &space, UINT32 addr); |
| 777 | 779 | void sdd1_mmio_write(address_space &space, UINT32 addr, UINT8 data); |
| 780 | void sdd1_init(running_machine& machine); |
| 778 | 781 | UINT8 sdd1_read(running_machine& machine, UINT32 addr); |
| 779 | 782 | UINT8 spc7110_mmio_read(address_space &space, UINT32 addr); |
| 780 | 783 | void spc7110_mmio_write(running_machine &machine, UINT32 addr, UINT8 data); |
| 781 | 784 | UINT8 spc7110_bank7_read(address_space &space, UINT32 offset); |
| 785 | void spc7110_init(running_machine& machine); |
| 786 | void spc7110rtc_init(running_machine& machine); |
| 782 | 787 | |
| 783 | | |
| 784 | 788 | extern struct snes_cart_info snes_cart; |
| 785 | 789 | |
| 786 | 790 | /*----------- defined in video/snes.c -----------*/ |