trunk/src/emu/bus/centronics/epson_lx810l.c
| r242422 | r242423 | |
| 160 | 160 | |
| 161 | 161 | /* 256-bit eeprom */ |
| 162 | 162 | MCFG_EEPROM_SERIAL_93C06_ADD("eeprom") |
| 163 | |
| 164 | /* steppers */ |
| 165 | MCFG_DEVICE_ADD("pf_stepper", STEPPER, 0) |
| 166 | MCFG_DEVICE_ADD("cr_stepper", STEPPER, 0) |
| 163 | 167 | MACHINE_CONFIG_END |
| 164 | 168 | |
| 165 | 169 | //------------------------------------------------- |
| r242422 | r242423 | |
| 278 | 282 | device_t(mconfig, EPSON_LX810L, "Epson LX-810L", tag, owner, clock, "lx810l", __FILE__), |
| 279 | 283 | device_centronics_peripheral_interface(mconfig, *this), |
| 280 | 284 | m_maincpu(*this, "maincpu"), |
| 285 | m_pf_stepper(*this, "pf_stepper"), |
| 286 | m_cr_stepper(*this, "cr_stepper"), |
| 281 | 287 | m_eeprom(*this, "eeprom"), |
| 282 | 288 | m_speaker(*this, "speaker"), |
| 283 | 289 | m_e05a30(*this, "e05a30"), |
| r242422 | r242423 | |
| 296 | 302 | device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), |
| 297 | 303 | device_centronics_peripheral_interface(mconfig, *this), |
| 298 | 304 | m_maincpu(*this, "maincpu"), |
| 305 | m_pf_stepper(*this, "pf_stepper"), |
| 306 | m_cr_stepper(*this, "cr_stepper"), |
| 299 | 307 | m_eeprom(*this, "eeprom"), |
| 300 | 308 | m_speaker(*this, "speaker"), |
| 301 | 309 | m_e05a30(*this, "e05a30"), |
| r242422 | r242423 | |
| 339 | 347 | |
| 340 | 348 | void epson_lx810l_t::device_start() |
| 341 | 349 | { |
| 342 | | stepper_config(machine(), 0, &lx810l_pf_stepper); |
| 343 | | stepper_config(machine(), 1, &lx810l_cr_stepper); |
| 350 | m_pf_stepper->configure(&lx810l_pf_stepper); |
| 351 | m_cr_stepper->configure(&lx810l_cr_stepper); |
| 344 | 352 | } |
| 345 | 353 | |
| 346 | 354 | |
| r242422 | r242423 | |
| 515 | 523 | |
| 516 | 524 | WRITE8_MEMBER( epson_lx810l_t::pf_stepper ) |
| 517 | 525 | { |
| 518 | | stepper_update(0, data); |
| 519 | | m_pf_pos_abs = 200 - stepper_get_absolute_position(0); |
| 526 | m_pf_stepper->update(data); |
| 527 | m_pf_pos_abs = 200 - m_pf_stepper->get_absolute_position(); |
| 520 | 528 | |
| 521 | 529 | LX810LLOG("%s: %s(%02x); abs %d\n", machine().describe_context(), __func__, data, m_pf_pos_abs); |
| 522 | 530 | } |
| r242422 | r242423 | |
| 525 | 533 | { |
| 526 | 534 | int m_cr_pos_abs_prev = m_cr_pos_abs; |
| 527 | 535 | |
| 528 | | stepper_update(1, data); |
| 529 | | m_cr_pos_abs = 200 - stepper_get_absolute_position(1); |
| 536 | m_cr_stepper->update(data); |
| 537 | m_cr_pos_abs = 200 - m_cr_stepper->get_absolute_position(); |
| 530 | 538 | |
| 531 | 539 | if (m_cr_pos_abs > m_cr_pos_abs_prev) { |
| 532 | 540 | /* going right */ |
trunk/src/emu/machine/steppers.c
| r242422 | r242423 | |
| 28 | 28 | // 05-03-2004: Re-Animator // |
| 29 | 29 | // // |
| 30 | 30 | // TODO: add further types of stepper motors if needed (Konami/IGT?) // |
| 31 | | // Someone who understands the device system may want to convert // |
| 32 | | // this // |
| 33 | 31 | // 200 Step reels can alter their relative opto tab position, // |
| 34 | 32 | // may be worth adding the phase setting to the interface // |
| 35 | 33 | // There are reports that some games use a pulse that is too short// |
| r242422 | r242423 | |
| 41 | 39 | #include "emu.h" |
| 42 | 40 | #include "steppers.h" |
| 43 | 41 | |
| 44 | | /* local prototypes */ |
| 45 | | |
| 46 | | static void update_optic(int which); |
| 47 | | |
| 48 | | /* local vars */ |
| 49 | | |
| 50 | | struct stepper |
| 51 | | { |
| 52 | | const stepper_interface *intf; |
| 53 | | UINT8 pattern, /* coil pattern */ |
| 54 | | old_pattern, /* old coil pattern */ |
| 55 | | initphase, |
| 56 | | phase, /* motor phase */ |
| 57 | | old_phase, /* old phase */ |
| 58 | | type; /* reel type */ |
| 59 | | INT16 step_pos, /* step position 0 - max_steps */ |
| 60 | | max_steps; /* maximum step position */ |
| 61 | | INT32 abs_step_pos; /* absolute step position */ |
| 62 | | |
| 63 | | INT16 index_start, /* start position of index (in half steps) */ |
| 64 | | index_end, /* end position of index (in half steps) */ |
| 65 | | index_patt; /* pattern needed on coils (0=don't care) */ |
| 66 | | |
| 67 | | UINT8 optic; |
| 68 | | }; |
| 69 | | |
| 70 | | static stepper step[MAX_STEPPERS]; |
| 71 | | |
| 72 | 42 | /* useful interfaces (Starpoint is a very common setup)*/ |
| 73 | 43 | const stepper_interface starpoint_interface_48step = |
| 74 | 44 | { |
| r242422 | r242423 | |
| 108 | 78 | |
| 109 | 79 | |
| 110 | 80 | /////////////////////////////////////////////////////////////////////////// |
| 111 | | void stepper_config(running_machine &machine, int which, const stepper_interface *intf) |
| 81 | void stepper_device::configure(const stepper_interface *intf) |
| 112 | 82 | { |
| 113 | | assert_always(machine.phase() == MACHINE_PHASE_INIT, "Can only call stepper_config at init time!"); |
| 114 | | assert_always((which >= 0) && (which < MAX_STEPPERS), "stepper_config called on an invalid stepper motor!"); |
| 115 | | assert_always(intf, "stepper_config called with an invalid interface!"); |
| 83 | assert_always(machine().phase() == MACHINE_PHASE_INIT, "Can only call configure at init time!"); |
| 84 | assert_always(intf, "configure called with an invalid interface!"); |
| 116 | 85 | |
| 117 | | step[which].intf = intf; |
| 86 | m_type = intf->type; |
| 87 | m_index_start = intf->index_start; /* location of first index value in half steps */ |
| 88 | m_index_end = intf->index_end; /* location of last index value in half steps */ |
| 89 | m_index_patt = intf->index_patt; /* hex value of coil pattern (0 if not needed)*/ |
| 90 | m_initphase = intf->initphase; /* Phase at 0 steps, for alignment) */ |
| 118 | 91 | |
| 119 | | step[which].type = intf->type; |
| 120 | | step[which].index_start = intf->index_start;/* location of first index value in half steps */ |
| 121 | | step[which].index_end = intf->index_end; /* location of last index value in half steps */ |
| 122 | | step[which].index_patt = intf->index_patt; /* hex value of coil pattern (0 if not needed)*/ |
| 123 | | step[which].initphase = intf->initphase; /* Phase at 0 steps, for alignment) */ |
| 124 | 92 | |
| 93 | m_pattern = 0; |
| 94 | m_old_pattern = 0; |
| 95 | m_step_pos = 0; |
| 96 | m_abs_step_pos = 0; |
| 97 | m_phase = m_initphase; |
| 98 | m_old_phase = m_initphase; |
| 125 | 99 | |
| 126 | | step[which].pattern = 0; |
| 127 | | step[which].old_pattern = 0; |
| 128 | | step[which].step_pos = 0; |
| 129 | | step[which].abs_step_pos= 0; |
| 130 | | step[which].phase = step[which].initphase; |
| 131 | | step[which].old_phase = step[which].initphase; |
| 132 | 100 | |
| 133 | | |
| 134 | | switch ( step[which].type ) |
| 101 | switch ( m_type ) |
| 135 | 102 | { default: |
| 136 | 103 | case STARPOINT_48STEP_REEL: /* STARPOINT RMxxx */ |
| 137 | 104 | case BARCREST_48STEP_REEL : /* Barcrest Reel unit */ |
| 138 | 105 | case MPU3_48STEP_REEL : |
| 139 | 106 | case GAMESMAN_48STEP_REEL : /* Gamesman GMxxxx */ |
| 140 | 107 | case PROJECT_48STEP_REEL : |
| 141 | | step[which].max_steps = (48*2); |
| 108 | m_max_steps = (48*2); |
| 142 | 109 | break; |
| 143 | 110 | case GAMESMAN_100STEP_REEL : |
| 144 | | step[which].max_steps = (100*2); |
| 111 | m_max_steps = (100*2); |
| 145 | 112 | break; |
| 146 | 113 | case STARPOINT_144STEP_DICE :/* STARPOINT 1DCU DICE mechanism */ |
| 147 | 114 | //Dice reels are 48 step motors, but complete three full cycles between opto updates |
| 148 | | step[which].max_steps = ((48*3)*2); |
| 115 | m_max_steps = ((48*3)*2); |
| 149 | 116 | break; |
| 150 | 117 | case STARPOINT_200STEP_REEL : |
| 151 | 118 | case GAMESMAN_200STEP_REEL : |
| 152 | 119 | case ECOIN_200STEP_REEL : |
| 153 | | step[which].max_steps = (200*2); |
| 120 | m_max_steps = (200*2); |
| 154 | 121 | break; |
| 155 | 122 | } |
| 156 | | |
| 157 | | state_save_register_item(machine, "stepper", NULL, which, step[which].index_start); |
| 158 | | state_save_register_item(machine, "stepper", NULL, which, step[which].index_end); |
| 159 | | state_save_register_item(machine, "stepper", NULL, which, step[which].index_patt); |
| 160 | | state_save_register_item(machine, "stepper", NULL, which, step[which].initphase); |
| 161 | | state_save_register_item(machine, "stepper", NULL, which, step[which].phase); |
| 162 | | state_save_register_item(machine, "stepper", NULL, which, step[which].old_phase); |
| 163 | | state_save_register_item(machine, "stepper", NULL, which, step[which].pattern); |
| 164 | | state_save_register_item(machine, "stepper", NULL, which, step[which].old_pattern); |
| 165 | | state_save_register_item(machine, "stepper", NULL, which, step[which].step_pos); |
| 166 | | state_save_register_item(machine, "stepper", NULL, which, step[which].abs_step_pos); |
| 167 | | state_save_register_item(machine, "stepper", NULL, which, step[which].max_steps); |
| 168 | | state_save_register_item(machine, "stepper", NULL, which, step[which].type); |
| 169 | 123 | } |
| 170 | 124 | |
| 171 | 125 | /////////////////////////////////////////////////////////////////////////// |
| 172 | | int stepper_get_position(int which) |
| 173 | | { |
| 174 | | return step[which].step_pos; |
| 175 | | } |
| 176 | 126 | |
| 177 | | /////////////////////////////////////////////////////////////////////////// |
| 178 | | int stepper_get_absolute_position(int which) |
| 127 | void stepper_device::update_optic() |
| 179 | 128 | { |
| 180 | | return step[which].abs_step_pos; |
| 181 | | } |
| 129 | int pos = m_step_pos, |
| 130 | start = m_index_start, |
| 131 | end = m_index_end; |
| 182 | 132 | |
| 183 | | /////////////////////////////////////////////////////////////////////////// |
| 184 | | |
| 185 | | int stepper_get_max(int which) |
| 186 | | { |
| 187 | | return step[which].max_steps; |
| 188 | | } |
| 189 | | |
| 190 | | /////////////////////////////////////////////////////////////////////////// |
| 191 | | |
| 192 | | static void update_optic(int which) |
| 193 | | { |
| 194 | | int pos = step[which].step_pos, |
| 195 | | start = step[which].index_start, |
| 196 | | end = step[which].index_end; |
| 197 | | |
| 198 | 133 | if (start > end) // cope with index patterns that wrap around |
| 199 | 134 | { |
| 200 | 135 | if ( (( pos > start ) || ( pos < end )) && |
| 201 | | ( ( step[which].pattern == step[which].index_patt || step[which].index_patt==0) || |
| 202 | | ( step[which].pattern == 0 && |
| 203 | | (step[which].old_pattern == step[which].index_patt || step[which].index_patt==0) |
| 136 | ( ( m_pattern == m_index_patt || m_index_patt==0) || |
| 137 | ( m_pattern == 0 && |
| 138 | (m_old_pattern == m_index_patt || m_index_patt==0) |
| 204 | 139 | ) ) ) |
| 205 | 140 | { |
| 206 | | step[which].optic = 1; |
| 141 | m_optic = 1; |
| 207 | 142 | } |
| 208 | | else step[which].optic = 0; |
| 143 | else m_optic = 0; |
| 209 | 144 | } |
| 210 | 145 | else |
| 211 | 146 | { |
| 212 | 147 | if ( (( pos > start ) && ( pos < end )) && |
| 213 | | ( ( step[which].pattern == step[which].index_patt || step[which].index_patt==0) || |
| 214 | | ( step[which].pattern == 0 && |
| 215 | | (step[which].old_pattern == step[which].index_patt || step[which].index_patt==0) |
| 148 | ( ( m_pattern == m_index_patt || m_index_patt==0) || |
| 149 | ( m_pattern == 0 && |
| 150 | (m_old_pattern == m_index_patt || m_index_patt==0) |
| 216 | 151 | ) ) ) |
| 217 | 152 | { |
| 218 | | step[which].optic = 1; |
| 153 | m_optic = 1; |
| 219 | 154 | } |
| 220 | | else step[which].optic = 0; |
| 155 | else m_optic = 0; |
| 221 | 156 | } |
| 157 | |
| 158 | m_optic_cb(m_optic); |
| 222 | 159 | } |
| 223 | 160 | /////////////////////////////////////////////////////////////////////////// |
| 224 | 161 | |
| 225 | | void stepper_reset_position(int which) |
| 162 | void stepper_device::device_start() |
| 226 | 163 | { |
| 227 | | step[which].step_pos = 0x00; |
| 228 | | step[which].abs_step_pos= 0x00; |
| 229 | | step[which].pattern = 0x00; |
| 230 | | step[which].old_pattern = 0x00; |
| 231 | | step[which].phase = step[which].initphase; |
| 232 | | step[which].old_phase = step[which].initphase; |
| 233 | | update_optic(which); |
| 164 | /* resolve callbacks */ |
| 165 | m_optic_cb.resolve_safe(); |
| 166 | |
| 167 | /* register for state saving */ |
| 168 | save_item(NAME(m_index_start)); |
| 169 | save_item(NAME(m_index_end)); |
| 170 | save_item(NAME(m_index_patt)); |
| 171 | save_item(NAME(m_initphase)); |
| 172 | save_item(NAME(m_phase)); |
| 173 | save_item(NAME(m_old_phase)); |
| 174 | save_item(NAME(m_pattern)); |
| 175 | save_item(NAME(m_old_pattern)); |
| 176 | save_item(NAME(m_step_pos)); |
| 177 | save_item(NAME(m_abs_step_pos)); |
| 178 | save_item(NAME(m_max_steps)); |
| 179 | save_item(NAME(m_type)); |
| 234 | 180 | } |
| 235 | 181 | |
| 236 | 182 | /////////////////////////////////////////////////////////////////////////// |
| 237 | 183 | |
| 238 | | int stepper_optic_state(int which) |
| 184 | void stepper_device::device_reset() |
| 239 | 185 | { |
| 240 | | int result = 0; |
| 241 | | |
| 242 | | if ( which < MAX_STEPPERS ) |
| 243 | | { |
| 244 | | result = step[which].optic; |
| 245 | | } |
| 246 | | |
| 247 | | return result; |
| 186 | m_step_pos = 0x00; |
| 187 | m_abs_step_pos = 0x00; |
| 188 | m_pattern = 0x00; |
| 189 | m_old_pattern = 0x00; |
| 190 | m_phase = m_initphase; |
| 191 | m_old_phase = m_initphase; |
| 192 | update_optic(); |
| 248 | 193 | } |
| 249 | 194 | |
| 250 | 195 | /////////////////////////////////////////////////////////////////////////// |
| 251 | 196 | |
| 252 | | int stepper_update(int which, UINT8 pattern) |
| 197 | int stepper_device::update(UINT8 pattern) |
| 253 | 198 | { |
| 254 | 199 | int changed = 0; |
| 255 | 200 | |
| r242422 | r242423 | |
| 271 | 216 | */ |
| 272 | 217 | |
| 273 | 218 | int pos,steps=0; |
| 274 | | step[which].pattern = pattern; |
| 275 | | switch ( step[which].type ) |
| 219 | m_pattern = pattern; |
| 220 | switch ( m_type ) |
| 276 | 221 | { |
| 277 | 222 | default: |
| 278 | | logerror("No reel type specified for %x!\n",which); |
| 223 | logerror("No reel type specified!\n"); |
| 279 | 224 | break; |
| 280 | 225 | case STARPOINT_48STEP_REEL : /* STARPOINT RMxxx */ |
| 281 | 226 | case GAMESMAN_200STEP_REEL : /* Gamesman GMxxxx */ |
| r242422 | r242423 | |
| 287 | 232 | switch (pattern) |
| 288 | 233 | { //Black Blue Red Yellow |
| 289 | 234 | case 0x02:// 0 0 1 0 |
| 290 | | step[which].phase = 7; |
| 235 | m_phase = 7; |
| 291 | 236 | break; |
| 292 | 237 | case 0x06:// 0 1 1 0 |
| 293 | | step[which].phase = 6; |
| 238 | m_phase = 6; |
| 294 | 239 | break; |
| 295 | 240 | case 0x04:// 0 1 0 0 |
| 296 | | step[which].phase = 5; |
| 241 | m_phase = 5; |
| 297 | 242 | break; |
| 298 | 243 | case 0x05:// 0 1 0 1 |
| 299 | | step[which].phase = 4; |
| 244 | m_phase = 4; |
| 300 | 245 | break; |
| 301 | 246 | case 0x01:// 0 0 0 1 |
| 302 | | step[which].phase = 3; |
| 247 | m_phase = 3; |
| 303 | 248 | break; |
| 304 | 249 | case 0x09:// 1 0 0 1 |
| 305 | | step[which].phase = 2; |
| 250 | m_phase = 2; |
| 306 | 251 | break; |
| 307 | 252 | case 0x08:// 1 0 0 0 |
| 308 | | step[which].phase = 1; |
| 253 | m_phase = 1; |
| 309 | 254 | break; |
| 310 | 255 | case 0x0A:// 1 0 1 0 |
| 311 | | step[which].phase = 0; |
| 256 | m_phase = 0; |
| 312 | 257 | break; |
| 313 | 258 | // Black Blue Red Yellow |
| 314 | 259 | case 0x03:// 0 0 1 1 |
| 315 | 260 | { |
| 316 | | if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now |
| 261 | if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now |
| 317 | 262 | { |
| 318 | | step[which].phase = 7; |
| 263 | m_phase = 7; |
| 319 | 264 | } |
| 320 | 265 | else //otherwise it will line up due south |
| 321 | 266 | { |
| 322 | | step[which].phase = 3; |
| 267 | m_phase = 3; |
| 323 | 268 | } |
| 324 | 269 | } |
| 325 | 270 | break; |
| 326 | 271 | case 0x0C:// 1 1 0 0 |
| 327 | 272 | { |
| 328 | | if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now |
| 273 | if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now |
| 329 | 274 | { |
| 330 | | step[which].phase = 5; |
| 275 | m_phase = 5; |
| 331 | 276 | } |
| 332 | 277 | else //otherwise it will line up due west |
| 333 | 278 | { |
| 334 | | step[which].phase = 1; |
| 279 | m_phase = 1; |
| 335 | 280 | } |
| 336 | 281 | } |
| 337 | 282 | break; |
| r242422 | r242423 | |
| 347 | 292 | { |
| 348 | 293 | // Yellow Brown Orange Black |
| 349 | 294 | case 0x01:// 0 0 0 1 |
| 350 | | step[which].phase = 7; |
| 295 | m_phase = 7; |
| 351 | 296 | break; |
| 352 | 297 | case 0x03:// 0 0 1 1 |
| 353 | | step[which].phase = 6; |
| 298 | m_phase = 6; |
| 354 | 299 | break; |
| 355 | 300 | case 0x02:// 0 0 1 0 |
| 356 | | step[which].phase = 5; |
| 301 | m_phase = 5; |
| 357 | 302 | break; |
| 358 | 303 | case 0x06:// 0 1 1 0 |
| 359 | | step[which].phase = 4; |
| 304 | m_phase = 4; |
| 360 | 305 | break; |
| 361 | 306 | case 0x04:// 0 1 0 0 |
| 362 | | step[which].phase = 3; |
| 307 | m_phase = 3; |
| 363 | 308 | break; |
| 364 | 309 | case 0x0C:// 1 1 0 0 |
| 365 | | step[which].phase = 2; |
| 310 | m_phase = 2; |
| 366 | 311 | break; |
| 367 | 312 | case 0x08:// 1 0 0 0 |
| 368 | | step[which].phase = 1; |
| 313 | m_phase = 1; |
| 369 | 314 | break;//YOLB |
| 370 | 315 | case 0x09:// 1 0 0 1 |
| 371 | | step[which].phase = 0; |
| 316 | m_phase = 0; |
| 372 | 317 | break; |
| 373 | 318 | |
| 374 | 319 | // The below values should not be used by anything sane, as they effectively ignore one stator side entirely |
| 375 | 320 | // Yellow Brown Orange Black |
| 376 | 321 | case 0x05:// 0 1 0 1 |
| 377 | 322 | { |
| 378 | | if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now |
| 323 | if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now |
| 379 | 324 | { |
| 380 | | step[which].phase = 7; |
| 325 | m_phase = 7; |
| 381 | 326 | } |
| 382 | 327 | else //otherwise it will line up due south |
| 383 | 328 | { |
| 384 | | step[which].phase = 3; |
| 329 | m_phase = 3; |
| 385 | 330 | } |
| 386 | 331 | } |
| 387 | 332 | break; |
| 388 | 333 | |
| 389 | 334 | case 0x0A:// 1 0 1 0 |
| 390 | 335 | { |
| 391 | | if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now |
| 336 | if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now |
| 392 | 337 | { |
| 393 | | step[which].phase = 5; |
| 338 | m_phase = 5; |
| 394 | 339 | } |
| 395 | 340 | else //otherwise it will line up due west |
| 396 | 341 | { |
| 397 | | step[which].phase = 1; |
| 342 | m_phase = 1; |
| 398 | 343 | } |
| 399 | 344 | } |
| 400 | 345 | break; |
| r242422 | r242423 | |
| 410 | 355 | { |
| 411 | 356 | // Yellow(2) Brown(1) Orange(!2) Black(!1) |
| 412 | 357 | case 0x00 :// 0 0 1 1 |
| 413 | | step[which].phase = 6; |
| 358 | m_phase = 6; |
| 414 | 359 | break; |
| 415 | 360 | case 0x01 :// 0 1 1 0 |
| 416 | | step[which].phase = 4; |
| 361 | m_phase = 4; |
| 417 | 362 | break; |
| 418 | 363 | case 0x03 :// 1 1 0 0 |
| 419 | | step[which].phase = 2; |
| 364 | m_phase = 2; |
| 420 | 365 | break; |
| 421 | 366 | case 0x02 :// 1 0 0 1 |
| 422 | | step[which].phase = 0; |
| 367 | m_phase = 0; |
| 423 | 368 | break; |
| 424 | 369 | } |
| 425 | 370 | break; |
| r242422 | r242423 | |
| 431 | 376 | switch (pattern) |
| 432 | 377 | { |
| 433 | 378 | case 0x08:// 0 0 1 0 |
| 434 | | step[which].phase = 7; |
| 379 | m_phase = 7; |
| 435 | 380 | break; |
| 436 | 381 | case 0x0c:// 0 1 1 0 |
| 437 | | step[which].phase = 6; |
| 382 | m_phase = 6; |
| 438 | 383 | break; |
| 439 | 384 | case 0x04:// 0 1 0 0 |
| 440 | | step[which].phase = 5; |
| 385 | m_phase = 5; |
| 441 | 386 | break; |
| 442 | 387 | case 0x06:// 0 1 0 1 |
| 443 | | step[which].phase = 4; |
| 388 | m_phase = 4; |
| 444 | 389 | break; |
| 445 | 390 | case 0x02:// 0 0 0 1 |
| 446 | | step[which].phase = 3; |
| 391 | m_phase = 3; |
| 447 | 392 | break; |
| 448 | 393 | case 0x03:// 1 0 0 1 |
| 449 | | step[which].phase = 2; |
| 394 | m_phase = 2; |
| 450 | 395 | break; |
| 451 | 396 | case 0x01:// 1 0 0 0 |
| 452 | | step[which].phase = 1; |
| 397 | m_phase = 1; |
| 453 | 398 | break; |
| 454 | 399 | case 0x09:// 1 0 1 0 |
| 455 | | step[which].phase = 0; |
| 400 | m_phase = 0; |
| 456 | 401 | break; |
| 457 | 402 | case 0x0a:// 0 0 1 1 |
| 458 | 403 | { |
| 459 | | if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now |
| 404 | if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now |
| 460 | 405 | { |
| 461 | | step[which].phase = 7; |
| 406 | m_phase = 7; |
| 462 | 407 | } |
| 463 | 408 | else //otherwise it will line up due south |
| 464 | 409 | { |
| 465 | | step[which].phase = 3; |
| 410 | m_phase = 3; |
| 466 | 411 | } |
| 467 | 412 | } |
| 468 | 413 | break; |
| 469 | 414 | case 0x07:// 1 1 0 0 |
| 470 | 415 | { |
| 471 | | if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now |
| 416 | if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now |
| 472 | 417 | { |
| 473 | | step[which].phase = 5; |
| 418 | m_phase = 5; |
| 474 | 419 | } |
| 475 | 420 | else //otherwise it will line up due west |
| 476 | 421 | { |
| 477 | | step[which].phase = 1; |
| 422 | m_phase = 1; |
| 478 | 423 | } |
| 479 | 424 | } |
| 480 | 425 | break; |
| r242422 | r242423 | |
| 488 | 433 | switch (pattern) |
| 489 | 434 | { |
| 490 | 435 | case 0x08:// 0 0 1 0 |
| 491 | | step[which].phase = 7; |
| 436 | m_phase = 7; |
| 492 | 437 | break; |
| 493 | 438 | case 0x0c:// 0 1 1 0 |
| 494 | | step[which].phase = 6; |
| 439 | m_phase = 6; |
| 495 | 440 | break; |
| 496 | 441 | case 0x04:// 0 1 0 0 |
| 497 | | step[which].phase = 5; |
| 442 | m_phase = 5; |
| 498 | 443 | break; |
| 499 | 444 | case 0x05:// 0 1 0 1 |
| 500 | | step[which].phase = 4; |
| 445 | m_phase = 4; |
| 501 | 446 | break; |
| 502 | 447 | case 0x01:// 0 0 0 1 |
| 503 | | step[which].phase = 3; |
| 448 | m_phase = 3; |
| 504 | 449 | break; |
| 505 | 450 | case 0x03:// 1 0 0 1 |
| 506 | | step[which].phase = 2; |
| 451 | m_phase = 2; |
| 507 | 452 | break; |
| 508 | 453 | case 0x02:// 1 0 0 0 |
| 509 | | step[which].phase = 1; |
| 454 | m_phase = 1; |
| 510 | 455 | break; |
| 511 | 456 | case 0x0a:// 1 0 1 0 |
| 512 | | step[which].phase = 0; |
| 457 | m_phase = 0; |
| 513 | 458 | break; |
| 514 | 459 | case 0x09:// 0 0 1 1 |
| 515 | 460 | { |
| 516 | | if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now |
| 461 | if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now |
| 517 | 462 | { |
| 518 | | step[which].phase = 7; |
| 463 | m_phase = 7; |
| 519 | 464 | } |
| 520 | 465 | else //otherwise it will line up due south |
| 521 | 466 | { |
| 522 | | step[which].phase = 3; |
| 467 | m_phase = 3; |
| 523 | 468 | } |
| 524 | 469 | } |
| 525 | 470 | break; |
| 526 | 471 | case 0x06:// 1 1 0 0 |
| 527 | 472 | { |
| 528 | | if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now |
| 473 | if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now |
| 529 | 474 | { |
| 530 | | step[which].phase = 5; |
| 475 | m_phase = 5; |
| 531 | 476 | } |
| 532 | 477 | else //otherwise it will line up due west |
| 533 | 478 | { |
| 534 | | step[which].phase = 1; |
| 479 | m_phase = 1; |
| 535 | 480 | } |
| 536 | 481 | } |
| 537 | 482 | break; |
| r242422 | r242423 | |
| 542 | 487 | |
| 543 | 488 | } |
| 544 | 489 | |
| 545 | | steps = step[which].old_phase - step[which].phase; |
| 490 | steps = m_old_phase - m_phase; |
| 546 | 491 | |
| 547 | 492 | if (steps < -4) |
| 548 | 493 | { |
| r242422 | r242423 | |
| 553 | 498 | steps = steps -8; |
| 554 | 499 | } |
| 555 | 500 | |
| 556 | | step[which].old_phase = step[which].phase; |
| 557 | | step[which].old_pattern = step[which].pattern; |
| 501 | m_old_phase = m_phase; |
| 502 | m_old_pattern = m_pattern; |
| 558 | 503 | |
| 559 | | int max = step[which].max_steps; |
| 504 | int max = m_max_steps; |
| 560 | 505 | pos = 0; |
| 561 | 506 | |
| 562 | 507 | if (max!=0) |
| 563 | 508 | { |
| 564 | | step[which].abs_step_pos += steps; |
| 565 | | pos = (step[which].step_pos + steps + max) % max; |
| 509 | m_abs_step_pos += steps; |
| 510 | pos = (m_step_pos + steps + max) % max; |
| 566 | 511 | } |
| 567 | | else |
| 568 | | { |
| 569 | | logerror("step[%x].max_steps == 0\n",which); |
| 570 | | } |
| 571 | 512 | |
| 572 | | if (pos != step[which].step_pos) |
| 513 | if (pos != m_step_pos) |
| 573 | 514 | { |
| 574 | 515 | changed++; |
| 575 | 516 | } |
| 576 | 517 | |
| 577 | | step[which].step_pos = pos; |
| 578 | | update_optic(which); |
| 518 | m_step_pos = pos; |
| 519 | update_optic(); |
| 579 | 520 | |
| 580 | 521 | return changed; |
| 581 | 522 | } |
trunk/src/emu/machine/steppers.h
| r242422 | r242423 | |
| 7 | 7 | // // |
| 8 | 8 | // // |
| 9 | 9 | // TODO: add further types of stepper motors if needed (Konami/IGT?) // |
| 10 | | // Someone who understands the device system may want to convert // |
| 11 | | // this // |
| 12 | 10 | /////////////////////////////////////////////////////////////////////////// |
| 13 | 11 | |
| 14 | 12 | |
| r242422 | r242423 | |
| 49 | 47 | extern const stepper_interface starpoint_interface_200step_reel; |
| 50 | 48 | extern const stepper_interface ecoin_interface_200step_reel; |
| 51 | 49 | |
| 52 | | void stepper_config(running_machine &machine, int which, const stepper_interface *intf); |
| 53 | 50 | |
| 54 | | void stepper_reset_position(int id); /* reset a motor to position 0 */ |
| 51 | #define MCFG_STEPPER_OPTIC_CALLBACK(_write) \ |
| 52 | devcb = &stepper_device::set_optic_handler(*device, DEVCB_##_write); |
| 55 | 53 | |
| 56 | | int stepper_optic_state( int id); /* read a motor's optics */ |
| 54 | class stepper_device; |
| 55 | const device_type STEPPER = &device_creator<stepper_device>; |
| 57 | 56 | |
| 58 | | int stepper_update(int id, UINT8 pattern); /* update a motor */ |
| 57 | class stepper_device : public device_t |
| 58 | { |
| 59 | public: |
| 60 | stepper_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 61 | : device_t(mconfig, STEPPER, "Stepper Motor", tag, owner, clock, "stepper", __FILE__), |
| 62 | m_optic_cb(*this) |
| 63 | { } |
| 59 | 64 | |
| 60 | | int stepper_get_position(int id); /* get current position in half steps */ |
| 65 | template<class _Object> static devcb_base &set_optic_handler(device_t &device, _Object object) { return downcast<stepper_device &>(device).m_optic_cb.set_callback(object); } |
| 61 | 66 | |
| 62 | | int stepper_get_absolute_position(int id); /* get current absolute position in half steps */ |
| 67 | void configure(const stepper_interface *intf); |
| 63 | 68 | |
| 64 | | int stepper_get_max(int id); /* get maximum position in half steps */ |
| 69 | /* update a motor */ |
| 70 | int update(UINT8 pattern); |
| 71 | |
| 72 | /* get current position in half steps */ |
| 73 | int get_position() { return m_step_pos; } |
| 74 | /* get current absolute position in half steps */ |
| 75 | int get_absolute_position() { return m_abs_step_pos; } |
| 76 | /* get maximum position in half steps */ |
| 77 | int get_max() { return m_max_steps; } |
| 78 | |
| 79 | protected: |
| 80 | // device-level overrides |
| 81 | virtual void device_start(); |
| 82 | virtual void device_reset(); |
| 83 | |
| 84 | private: |
| 85 | UINT8 m_pattern; /* coil pattern */ |
| 86 | UINT8 m_old_pattern; /* old coil pattern */ |
| 87 | UINT8 m_initphase; |
| 88 | UINT8 m_phase; /* motor phase */ |
| 89 | UINT8 m_old_phase; /* old phase */ |
| 90 | UINT8 m_type; /* reel type */ |
| 91 | INT16 m_step_pos; /* step position 0 - max_steps */ |
| 92 | INT16 m_max_steps; /* maximum step position */ |
| 93 | INT32 m_abs_step_pos; /* absolute step position */ |
| 94 | INT16 m_index_start; /* start position of index (in half steps) */ |
| 95 | INT16 m_index_end; /* end position of index (in half steps) */ |
| 96 | INT16 m_index_patt; /* pattern needed on coils (0=don't care) */ |
| 97 | UINT8 m_optic; |
| 98 | |
| 99 | void update_optic(); |
| 100 | devcb_write_line m_optic_cb; |
| 101 | }; |
| 102 | |
| 65 | 103 | #endif |
trunk/src/mame/drivers/aces1.c
| r242422 | r242423 | |
| 38 | 38 | aces1_state(const machine_config &mconfig, device_type type, const char *tag) |
| 39 | 39 | : driver_device(mconfig, type, tag), |
| 40 | 40 | m_maincpu(*this, "maincpu"), |
| 41 | m_reel0(*this, "reel0"), |
| 42 | m_reel1(*this, "reel1"), |
| 43 | m_reel2(*this, "reel2"), |
| 44 | m_reel3(*this, "reel3"), |
| 41 | 45 | m_io1_port(*this, "IO1"), |
| 42 | 46 | m_io2_port(*this, "IO2"), |
| 43 | 47 | m_io3_port(*this, "IO3"), |
| r242422 | r242423 | |
| 53 | 57 | int m_reel_clock[4]; |
| 54 | 58 | int m_reel_phase[4]; |
| 55 | 59 | int m_reel_count[4]; |
| 60 | int m_optic_pattern; |
| 61 | DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; } |
| 62 | DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; } |
| 63 | DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; } |
| 64 | DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; } |
| 56 | 65 | |
| 57 | 66 | DECLARE_READ8_MEMBER( aces1_unk_r ) |
| 58 | 67 | { |
| r242422 | r242423 | |
| 148 | 157 | { |
| 149 | 158 | int sense = ((data & (4 + (1<<reel))) ? -2:2); |
| 150 | 159 | m_reel_phase[reel] = ((m_reel_phase[reel] + sense + 8) % 8); |
| 151 | | stepper_update(reel, phases[m_reel_phase[reel]]); |
| 160 | switch (reel) |
| 161 | { |
| 162 | case 0: m_reel0->update(phases[m_reel_phase[reel]]); break; |
| 163 | case 1: m_reel1->update(phases[m_reel_phase[reel]]); break; |
| 164 | case 2: m_reel2->update(phases[m_reel_phase[reel]]); break; |
| 165 | case 3: m_reel3->update(phases[m_reel_phase[reel]]); break; |
| 166 | } |
| 152 | 167 | m_reel_clock[reel] = clock; |
| 153 | 168 | if ( m_reel_phase[reel] % 4 ==0) |
| 154 | 169 | { |
| r242422 | r242423 | |
| 187 | 202 | |
| 188 | 203 | DECLARE_READ8_MEMBER( ic37_read_c ) |
| 189 | 204 | { |
| 190 | | int pattern =0; |
| 191 | 205 | int action =0; |
| 192 | 206 | for (int reel = 0; reel < 4; reel++) |
| 193 | 207 | { |
| 194 | | if (stepper_optic_state(reel)) pattern |= 1<<reel; |
| 195 | 208 | if (m_reel_count[reel]) action |= 1<<reel; |
| 196 | 209 | } |
| 197 | 210 | |
| 198 | | return ((pattern << 4) | action); |
| 211 | return ((m_optic_pattern << 4) | action); |
| 199 | 212 | } |
| 200 | 213 | |
| 201 | 214 | // devices |
| 202 | 215 | required_device<cpu_device> m_maincpu; |
| 216 | required_device<stepper_device> m_reel0; |
| 217 | required_device<stepper_device> m_reel1; |
| 218 | required_device<stepper_device> m_reel2; |
| 219 | required_device<stepper_device> m_reel3; |
| 203 | 220 | required_ioport m_io1_port; |
| 204 | 221 | required_ioport m_io2_port; |
| 205 | 222 | required_ioport m_io3_port; |
| r242422 | r242423 | |
| 236 | 253 | |
| 237 | 254 | void aces1_state::machine_start() |
| 238 | 255 | { |
| 239 | | stepper_config(machine(), 0, &starpoint_interface_48step); |
| 240 | | stepper_config(machine(), 1, &starpoint_interface_48step); |
| 241 | | stepper_config(machine(), 2, &starpoint_interface_48step); |
| 242 | | stepper_config(machine(), 3, &starpoint_interface_48step); |
| 256 | m_reel0->configure(&starpoint_interface_48step); |
| 257 | m_reel1->configure(&starpoint_interface_48step); |
| 258 | m_reel2->configure(&starpoint_interface_48step); |
| 259 | m_reel3->configure(&starpoint_interface_48step); |
| 243 | 260 | |
| 244 | 261 | for (int reel=0; reel <4; reel++) |
| 245 | 262 | { |
| r242422 | r242423 | |
| 452 | 469 | MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSWA")) |
| 453 | 470 | MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSWB")) |
| 454 | 471 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 472 | |
| 473 | /* steppers */ |
| 474 | MCFG_DEVICE_ADD("reel0", STEPPER, 0) |
| 475 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(aces1_state, reel0_optic_cb)) |
| 476 | MCFG_DEVICE_ADD("reel1", STEPPER, 0) |
| 477 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(aces1_state, reel1_optic_cb)) |
| 478 | MCFG_DEVICE_ADD("reel2", STEPPER, 0) |
| 479 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(aces1_state, reel2_optic_cb)) |
| 480 | MCFG_DEVICE_ADD("reel3", STEPPER, 0) |
| 481 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(aces1_state, reel3_optic_cb)) |
| 455 | 482 | MACHINE_CONFIG_END |
| 456 | 483 | |
| 457 | 484 | |
trunk/src/mame/drivers/bfm_sc1.c
| r242422 | r242423 | |
| 111 | 111 | : driver_device(mconfig, type, tag), |
| 112 | 112 | m_vfd0(*this, "vfd0"), |
| 113 | 113 | m_maincpu(*this, "maincpu"), |
| 114 | m_reel0(*this, "reel0"), |
| 115 | m_reel1(*this, "reel1"), |
| 116 | m_reel2(*this, "reel2"), |
| 117 | m_reel3(*this, "reel3"), |
| 118 | m_reel4(*this, "reel4"), |
| 119 | m_reel5(*this, "reel5"), |
| 114 | 120 | m_upd7759(*this, "upd") { } |
| 115 | 121 | |
| 116 | 122 | optional_device<bfm_bd1_t> m_vfd0; |
| r242422 | r242423 | |
| 120 | 126 | int m_vfd_latch; |
| 121 | 127 | int m_irq_status; |
| 122 | 128 | int m_optic_pattern; |
| 129 | DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; } |
| 130 | DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; } |
| 131 | DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; } |
| 132 | DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; } |
| 133 | DECLARE_WRITE_LINE_MEMBER(reel4_optic_cb) { if (state) m_optic_pattern |= 0x10; else m_optic_pattern &= ~0x10; } |
| 134 | DECLARE_WRITE_LINE_MEMBER(reel5_optic_cb) { if (state) m_optic_pattern |= 0x20; else m_optic_pattern &= ~0x20; } |
| 123 | 135 | int m_acia_status; |
| 124 | 136 | int m_locked; |
| 125 | 137 | int m_is_timer_enabled; |
| r242422 | r242423 | |
| 181 | 193 | int Scorpion1_GetSwitchState(int strobe, int data); |
| 182 | 194 | int sc1_find_project_string( ); |
| 183 | 195 | required_device<cpu_device> m_maincpu; |
| 196 | required_device<stepper_device> m_reel0; |
| 197 | required_device<stepper_device> m_reel1; |
| 198 | required_device<stepper_device> m_reel2; |
| 199 | required_device<stepper_device> m_reel3; |
| 200 | required_device<stepper_device> m_reel4; |
| 201 | required_device<stepper_device> m_reel5; |
| 184 | 202 | optional_device<upd7759_device> m_upd7759; |
| 185 | 203 | }; |
| 186 | 204 | |
| r242422 | r242423 | |
| 251 | 269 | } |
| 252 | 270 | else |
| 253 | 271 | { |
| 254 | | stepper_update(0, (data>>4)&0x0f); |
| 255 | | stepper_update(1, data&0x0f ); |
| 256 | | |
| 257 | | if ( stepper_optic_state(0) ) m_optic_pattern |= 0x01; |
| 258 | | else m_optic_pattern &= ~0x01; |
| 259 | | if ( stepper_optic_state(1) ) m_optic_pattern |= 0x02; |
| 260 | | else m_optic_pattern &= ~0x02; |
| 272 | m_reel0->update((data>>4)&0x0f); |
| 273 | m_reel1->update( data &0x0f); |
| 261 | 274 | } |
| 262 | | awp_draw_reel(0); |
| 263 | | awp_draw_reel(1); |
| 275 | awp_draw_reel(0, m_reel0); |
| 276 | awp_draw_reel(1, m_reel1); |
| 264 | 277 | } |
| 265 | 278 | |
| 266 | 279 | /////////////////////////////////////////////////////////////////////////// |
| r242422 | r242423 | |
| 273 | 286 | } |
| 274 | 287 | else |
| 275 | 288 | { |
| 276 | | stepper_update(2, (data>>4)&0x0f); |
| 277 | | stepper_update(3, data&0x0f ); |
| 278 | | |
| 279 | | if ( stepper_optic_state(2) ) m_optic_pattern |= 0x04; |
| 280 | | else m_optic_pattern &= ~0x04; |
| 281 | | if ( stepper_optic_state(3) ) m_optic_pattern |= 0x08; |
| 282 | | else m_optic_pattern &= ~0x08; |
| 289 | m_reel2->update((data>>4)&0x0f); |
| 290 | m_reel3->update( data &0x0f); |
| 283 | 291 | } |
| 284 | | awp_draw_reel(2); |
| 285 | | awp_draw_reel(3); |
| 292 | awp_draw_reel(2, m_reel2); |
| 293 | awp_draw_reel(3, m_reel3); |
| 286 | 294 | } |
| 287 | 295 | |
| 288 | 296 | /////////////////////////////////////////////////////////////////////////// |
| 289 | 297 | |
| 290 | 298 | WRITE8_MEMBER(bfm_sc1_state::reel56_w) |
| 291 | 299 | { |
| 292 | | stepper_update(4, (data>>4)&0x0f); |
| 293 | | stepper_update(5, data&0x0f ); |
| 300 | m_reel4->update((data>>4)&0x0f); |
| 301 | m_reel5->update( data &0x0f); |
| 294 | 302 | |
| 295 | | if ( stepper_optic_state(4) ) m_optic_pattern |= 0x10; |
| 296 | | else m_optic_pattern &= ~0x10; |
| 297 | | if ( stepper_optic_state(5) ) m_optic_pattern |= 0x20; |
| 298 | | else m_optic_pattern &= ~0x20; |
| 299 | | awp_draw_reel(5); |
| 300 | | awp_draw_reel(6); |
| 303 | awp_draw_reel(4, m_reel4); |
| 304 | awp_draw_reel(5, m_reel5); |
| 301 | 305 | } |
| 302 | 306 | |
| 303 | 307 | /////////////////////////////////////////////////////////////////////////// |
| r242422 | r242423 | |
| 612 | 616 | |
| 613 | 617 | m_vfd0->reset(); |
| 614 | 618 | |
| 615 | | // reset stepper motors ///////////////////////////////////////////////////////////// |
| 616 | | { |
| 617 | | int pattern =0, i; |
| 618 | | |
| 619 | | for ( i = 0; i < 6; i++) |
| 620 | | { |
| 621 | | stepper_reset_position(i); |
| 622 | | if ( stepper_optic_state(i) ) pattern |= 1<<i; |
| 623 | | } |
| 624 | | |
| 625 | | m_optic_pattern = pattern; |
| 626 | | |
| 627 | | } |
| 628 | | |
| 629 | 619 | m_acia_status = 0x02; // MC6850 transmit buffer empty !!! |
| 630 | 620 | m_locked = 0x07; // hardware is locked |
| 631 | 621 | |
| r242422 | r242423 | |
| 1061 | 1051 | |
| 1062 | 1052 | MCFG_NVRAM_ADD_0FILL("nvram") |
| 1063 | 1053 | MCFG_DEFAULT_LAYOUT(layout_sc1_vfd) |
| 1054 | |
| 1055 | MCFG_DEVICE_ADD("reel0", STEPPER, 0) |
| 1056 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc1_state, reel0_optic_cb)) |
| 1057 | MCFG_DEVICE_ADD("reel1", STEPPER, 0) |
| 1058 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc1_state, reel1_optic_cb)) |
| 1059 | MCFG_DEVICE_ADD("reel2", STEPPER, 0) |
| 1060 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc1_state, reel2_optic_cb)) |
| 1061 | MCFG_DEVICE_ADD("reel3", STEPPER, 0) |
| 1062 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc1_state, reel3_optic_cb)) |
| 1063 | MCFG_DEVICE_ADD("reel4", STEPPER, 0) |
| 1064 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc1_state, reel4_optic_cb)) |
| 1065 | MCFG_DEVICE_ADD("reel5", STEPPER, 0) |
| 1066 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc1_state, reel5_optic_cb)) |
| 1064 | 1067 | MACHINE_CONFIG_END |
| 1065 | 1068 | |
| 1066 | 1069 | ///////////////////////////////////////////////////////////////////////////////////// |
| r242422 | r242423 | |
| 1092 | 1095 | |
| 1093 | 1096 | void bfm_sc1_state::sc1_common_init(int reels, int decrypt, int defaultbank) |
| 1094 | 1097 | { |
| 1095 | | UINT8 i; |
| 1096 | | |
| 1097 | 1098 | memset(m_sc1_Inputs, 0, sizeof(m_sc1_Inputs)); |
| 1098 | 1099 | |
| 1099 | 1100 | // setup n default 96 half step reels /////////////////////////////////////////// |
| 1100 | | for ( i = 0; i < reels; i++ ) |
| 1101 | switch (reels) |
| 1101 | 1102 | { |
| 1102 | | stepper_config(machine(), i, &starpoint_interface_48step); |
| 1103 | case 6: m_reel5->configure(&starpoint_interface_48step); |
| 1104 | case 5: m_reel4->configure(&starpoint_interface_48step); |
| 1105 | case 4: m_reel3->configure(&starpoint_interface_48step); |
| 1106 | case 3: m_reel2->configure(&starpoint_interface_48step); |
| 1107 | case 2: m_reel1->configure(&starpoint_interface_48step); |
| 1108 | case 1: m_reel0->configure(&starpoint_interface_48step); |
| 1103 | 1109 | } |
| 1104 | 1110 | if (decrypt) bfm_decode_mainrom(machine(),"maincpu", m_codec_data); // decode main rom |
| 1105 | 1111 | |
trunk/src/mame/drivers/bfm_sc2.c
| r242422 | r242423 | |
| 181 | 181 | bfm_sc2_state(const machine_config &mconfig, device_type type, const char *tag) |
| 182 | 182 | : driver_device(mconfig, type, tag), |
| 183 | 183 | m_maincpu(*this, "maincpu"), |
| 184 | m_reel0(*this, "reel0"), |
| 185 | m_reel1(*this, "reel1"), |
| 186 | m_reel2(*this, "reel2"), |
| 187 | m_reel3(*this, "reel3"), |
| 188 | m_reel4(*this, "reel4"), |
| 189 | m_reel5(*this, "reel5"), |
| 184 | 190 | m_upd7759(*this, "upd"), |
| 185 | 191 | m_vfd0(*this, "vfd0"), |
| 186 | 192 | m_vfd1(*this, "vfd1"), |
| 187 | 193 | m_dm01(*this, "dm01") { } |
| 188 | 194 | |
| 189 | 195 | required_device<cpu_device> m_maincpu; |
| 196 | required_device<stepper_device> m_reel0; |
| 197 | required_device<stepper_device> m_reel1; |
| 198 | required_device<stepper_device> m_reel2; |
| 199 | required_device<stepper_device> m_reel3; |
| 200 | required_device<stepper_device> m_reel4; |
| 201 | required_device<stepper_device> m_reel5; |
| 190 | 202 | required_device<upd7759_device> m_upd7759; |
| 191 | 203 | optional_device<bfm_bd1_t> m_vfd0; |
| 192 | 204 | optional_device<bfm_bd1_t> m_vfd1; |
| r242422 | r242423 | |
| 199 | 211 | int m_mmtr_latch; |
| 200 | 212 | int m_irq_status; |
| 201 | 213 | int m_optic_pattern; |
| 214 | DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; } |
| 215 | DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; } |
| 216 | DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; } |
| 217 | DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; } |
| 218 | DECLARE_WRITE_LINE_MEMBER(reel4_optic_cb) { if (state) m_optic_pattern |= 0x10; else m_optic_pattern &= ~0x10; } |
| 219 | DECLARE_WRITE_LINE_MEMBER(reel5_optic_cb) { if (state) m_optic_pattern |= 0x20; else m_optic_pattern &= ~0x20; } |
| 202 | 220 | int m_uart1_data; |
| 203 | 221 | int m_uart2_data; |
| 204 | 222 | int m_data_to_uart1; |
| r242422 | r242423 | |
| 386 | 404 | |
| 387 | 405 | machine().device("ymsnd")->reset(); |
| 388 | 406 | |
| 389 | | // reset stepper motors ///////////////////////////////////////////////// |
| 390 | | { |
| 391 | | int pattern =0, i; |
| 392 | | |
| 393 | | for ( i = 0; i < m_reels; i++) |
| 394 | | { |
| 395 | | stepper_reset_position(i); |
| 396 | | if ( stepper_optic_state(i) ) pattern |= 1<<i; |
| 397 | | } |
| 398 | | |
| 399 | | m_optic_pattern = pattern; |
| 400 | | |
| 401 | | } |
| 402 | | |
| 403 | 407 | // make sure no inputs are overidden //////////////////////////////////// |
| 404 | 408 | memset(m_input_override, 0, sizeof(m_input_override)); |
| 405 | 409 | |
| r242422 | r242423 | |
| 546 | 550 | { |
| 547 | 551 | m_reel12_latch = data; |
| 548 | 552 | |
| 549 | | stepper_update(0, data&0x0f ); |
| 550 | | stepper_update(1, (data>>4)&0x0f ); |
| 553 | m_reel0->update( data &0x0f); |
| 554 | m_reel1->update((data>>4)&0x0f); |
| 551 | 555 | |
| 552 | | if ( stepper_optic_state(0) ) m_optic_pattern |= 0x01; |
| 553 | | else m_optic_pattern &= ~0x01; |
| 554 | | if ( stepper_optic_state(1) ) m_optic_pattern |= 0x02; |
| 555 | | else m_optic_pattern &= ~0x02; |
| 556 | | |
| 557 | | awp_draw_reel(0); |
| 558 | | awp_draw_reel(1); |
| 556 | awp_draw_reel(0, m_reel0); |
| 557 | awp_draw_reel(1, m_reel1); |
| 559 | 558 | } |
| 560 | 559 | |
| 561 | 560 | WRITE8_MEMBER(bfm_sc2_state::reel34_w) |
| 562 | 561 | { |
| 563 | 562 | m_reel34_latch = data; |
| 564 | 563 | |
| 565 | | stepper_update(2, data&0x0f ); |
| 566 | | stepper_update(3, (data>>4)&0x0f); |
| 564 | m_reel2->update( data &0x0f); |
| 565 | m_reel3->update((data>>4)&0x0f); |
| 567 | 566 | |
| 568 | | if ( stepper_optic_state(2) ) m_optic_pattern |= 0x04; |
| 569 | | else m_optic_pattern &= ~0x04; |
| 570 | | if ( stepper_optic_state(3) ) m_optic_pattern |= 0x08; |
| 571 | | else m_optic_pattern &= ~0x08; |
| 572 | | |
| 573 | | awp_draw_reel(2); |
| 574 | | awp_draw_reel(3); |
| 567 | awp_draw_reel(2, m_reel2); |
| 568 | awp_draw_reel(3, m_reel3); |
| 575 | 569 | } |
| 576 | 570 | |
| 577 | 571 | /////////////////////////////////////////////////////////////////////////// |
| r242422 | r242423 | |
| 580 | 574 | { |
| 581 | 575 | m_reel56_latch = data; |
| 582 | 576 | |
| 583 | | stepper_update(4, data&0x0f ); |
| 584 | | stepper_update(5, (data>>4)&0x0f); |
| 577 | m_reel4->update( data &0x0f); |
| 578 | m_reel5->update((data>>4)&0x0f); |
| 585 | 579 | |
| 586 | | if ( stepper_optic_state(4) ) m_optic_pattern |= 0x10; |
| 587 | | else m_optic_pattern &= ~0x10; |
| 588 | | if ( stepper_optic_state(5) ) m_optic_pattern |= 0x20; |
| 589 | | else m_optic_pattern &= ~0x20; |
| 590 | | |
| 591 | | awp_draw_reel(4); |
| 592 | | awp_draw_reel(5); |
| 580 | awp_draw_reel(4, m_reel4); |
| 581 | awp_draw_reel(5, m_reel5); |
| 593 | 582 | } |
| 594 | 583 | |
| 595 | 584 | |
| r242422 | r242423 | |
| 2174 | 2163 | |
| 2175 | 2164 | MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_3_579545MHz) |
| 2176 | 2165 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 2166 | |
| 2167 | MCFG_DEVICE_ADD("reel0", STEPPER, 0) |
| 2168 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel0_optic_cb)) |
| 2169 | MCFG_DEVICE_ADD("reel1", STEPPER, 0) |
| 2170 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel1_optic_cb)) |
| 2171 | MCFG_DEVICE_ADD("reel2", STEPPER, 0) |
| 2172 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel2_optic_cb)) |
| 2173 | MCFG_DEVICE_ADD("reel3", STEPPER, 0) |
| 2174 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel3_optic_cb)) |
| 2175 | MCFG_DEVICE_ADD("reel4", STEPPER, 0) |
| 2176 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel4_optic_cb)) |
| 2177 | MCFG_DEVICE_ADD("reel5", STEPPER, 0) |
| 2178 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel5_optic_cb)) |
| 2179 | |
| 2177 | 2180 | MACHINE_CONFIG_END |
| 2178 | 2181 | |
| 2179 | 2182 | |
| r242422 | r242423 | |
| 3664 | 3667 | |
| 3665 | 3668 | void bfm_sc2_state::sc2awp_common_init(int reels, int decrypt) |
| 3666 | 3669 | { |
| 3667 | | int n; |
| 3668 | 3670 | sc2_common_init(decrypt); |
| 3669 | 3671 | /* setup n default 96 half step reels */ |
| 3670 | 3672 | |
| 3671 | 3673 | m_reels=reels; |
| 3672 | 3674 | |
| 3673 | | for ( n = 0; n < reels; n++ ) |
| 3675 | switch (reels) |
| 3674 | 3676 | { |
| 3675 | | stepper_config(machine(), n, &starpoint_interface_48step); |
| 3677 | case 6: m_reel5->configure(&starpoint_interface_48step); |
| 3678 | case 5: m_reel4->configure(&starpoint_interface_48step); |
| 3679 | case 4: m_reel3->configure(&starpoint_interface_48step); |
| 3680 | case 3: m_reel2->configure(&starpoint_interface_48step); |
| 3681 | case 2: m_reel1->configure(&starpoint_interface_48step); |
| 3682 | case 1: m_reel0->configure(&starpoint_interface_48step); |
| 3676 | 3683 | } |
| 3677 | 3684 | } |
| 3678 | 3685 | |
| 3679 | 3686 | void bfm_sc2_state::sc2awpdmd_common_init(int reels, int decrypt) |
| 3680 | 3687 | { |
| 3681 | | int n; |
| 3682 | 3688 | sc2_common_init(decrypt); |
| 3683 | 3689 | /* setup n default 96 half step reels */ |
| 3684 | 3690 | |
| 3685 | 3691 | m_reels=reels; |
| 3686 | 3692 | |
| 3687 | | for ( n = 0; n < reels; n++ ) |
| 3693 | switch (reels) |
| 3688 | 3694 | { |
| 3689 | | stepper_config(machine(), n, &starpoint_interface_48step); |
| 3695 | case 6: m_reel5->configure(&starpoint_interface_48step); |
| 3696 | case 5: m_reel4->configure(&starpoint_interface_48step); |
| 3697 | case 4: m_reel3->configure(&starpoint_interface_48step); |
| 3698 | case 3: m_reel2->configure(&starpoint_interface_48step); |
| 3699 | case 2: m_reel1->configure(&starpoint_interface_48step); |
| 3700 | case 1: m_reel0->configure(&starpoint_interface_48step); |
| 3690 | 3701 | } |
| 3691 | 3702 | } |
| 3692 | 3703 | |
trunk/src/mame/drivers/bfm_sc4h.c
| r242422 | r242423 | |
| 517 | 517 | { |
| 518 | 518 | m_reel12_latch = data; |
| 519 | 519 | |
| 520 | | stepper_update(0, data&0x0f ); |
| 521 | | stepper_update(1, (data>>4)&0x0f ); |
| 520 | m_reel0->update( data &0x0f); |
| 521 | m_reel1->update((data>>4)&0x0f); |
| 522 | 522 | |
| 523 | | if ( stepper_optic_state(0) ) m_optic_pattern |= 0x01; |
| 524 | | else m_optic_pattern &= ~0x01; |
| 525 | | if ( stepper_optic_state(1) ) m_optic_pattern |= 0x02; |
| 526 | | else m_optic_pattern &= ~0x02; |
| 527 | | |
| 528 | | awp_draw_reel(0); |
| 529 | | awp_draw_reel(1); |
| 523 | awp_draw_reel(0, m_reel0); |
| 524 | awp_draw_reel(1, m_reel1); |
| 530 | 525 | } |
| 531 | 526 | |
| 532 | 527 | WRITE8_MEMBER( sc4_state::bfm_sc4_reel3_w ) |
| 533 | 528 | { |
| 534 | 529 | m_reel3_latch = data; |
| 535 | 530 | |
| 536 | | stepper_update(2, data&0x0f ); |
| 531 | m_reel2->update(data&0x0f); |
| 537 | 532 | |
| 538 | | if ( stepper_optic_state(2) ) m_optic_pattern |= 0x04; |
| 539 | | else m_optic_pattern &= ~0x04; |
| 540 | | |
| 541 | | awp_draw_reel(2); |
| 533 | awp_draw_reel(2, m_reel2); |
| 542 | 534 | } |
| 543 | 535 | |
| 544 | 536 | WRITE8_MEMBER( sc4_state::bfm_sc4_reel4_w ) |
| 545 | 537 | { |
| 546 | 538 | m_reel4_latch = data; |
| 547 | 539 | |
| 548 | | stepper_update(3, data&0x0f ); |
| 540 | m_reel3->update(data&0x0f ); |
| 549 | 541 | |
| 550 | | if ( stepper_optic_state(3) ) m_optic_pattern |= 0x08; |
| 551 | | else m_optic_pattern &= ~0x08; |
| 552 | | |
| 553 | | awp_draw_reel(3); |
| 542 | awp_draw_reel(3, m_reel3); |
| 554 | 543 | } |
| 555 | 544 | |
| 556 | 545 | void sc4_state::bfm_sc4_68307_portb_w(address_space &space, bool dedicated, UINT16 data, UINT16 line_mask) |
| r242422 | r242423 | |
| 591 | 580 | |
| 592 | 581 | MACHINE_RESET_MEMBER(sc4_state,sc4) |
| 593 | 582 | { |
| 594 | | int pattern =0, i; |
| 595 | | |
| 596 | | for ( i = 0; i < m_reels; i++) |
| 597 | | { |
| 598 | | stepper_reset_position(i); |
| 599 | | if ( stepper_optic_state(i) ) pattern |= 1<<i; |
| 600 | | } |
| 601 | | |
| 602 | 583 | m_dochk41 = true; |
| 603 | 584 | |
| 604 | | m_optic_pattern = pattern; |
| 605 | 585 | sec.reset(); |
| 606 | 586 | } |
| 607 | 587 | |
| r242422 | r242423 | |
| 620 | 600 | int reels = 6; |
| 621 | 601 | m_reels=reels; |
| 622 | 602 | |
| 623 | | for ( int n = 0; n < reels; n++ ) |
| 624 | | { |
| 625 | | if (m_reel_setup[n]) stepper_config(machine(), n, m_reel_setup[n]); |
| 626 | | } |
| 603 | if (m_reel_setup[0]) m_reel0->configure(m_reel_setup[0]); |
| 604 | if (m_reel_setup[1]) m_reel1->configure(m_reel_setup[1]); |
| 605 | if (m_reel_setup[2]) m_reel2->configure(m_reel_setup[2]); |
| 606 | if (m_reel_setup[3]) m_reel3->configure(m_reel_setup[3]); |
| 607 | if (m_reel_setup[4]) m_reel4->configure(m_reel_setup[4]); |
| 608 | if (m_reel_setup[5]) m_reel5->configure(m_reel_setup[5]); |
| 627 | 609 | } |
| 628 | 610 | |
| 629 | 611 | |
| r242422 | r242423 | |
| 663 | 645 | // logerror("bfm_sc4_duart_output_w\n"); |
| 664 | 646 | m_reel56_latch = data; |
| 665 | 647 | |
| 666 | | stepper_update(4, data&0x0f ); |
| 667 | | stepper_update(5, (data>>4)&0x0f); |
| 648 | m_reel4->update( data &0x0f); |
| 649 | m_reel5->update((data>>4)&0x0f); |
| 668 | 650 | |
| 669 | | if ( stepper_optic_state(4) ) m_optic_pattern |= 0x10; |
| 670 | | else m_optic_pattern &= ~0x10; |
| 671 | | if ( stepper_optic_state(5) ) m_optic_pattern |= 0x20; |
| 672 | | else m_optic_pattern &= ~0x20; |
| 673 | | |
| 674 | | awp_draw_reel(4); |
| 675 | | awp_draw_reel(5); |
| 651 | awp_draw_reel(4, m_reel4); |
| 652 | awp_draw_reel(5, m_reel5); |
| 676 | 653 | } |
| 677 | 654 | |
| 678 | 655 | |
| r242422 | r242423 | |
| 728 | 705 | MCFG_SOUND_ADD("ymz", YMZ280B, 16000000) // ?? Mhz |
| 729 | 706 | MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(sc4_state, bfm_sc4_irqhandler)) |
| 730 | 707 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 708 | |
| 709 | MCFG_DEVICE_ADD("reel0", STEPPER, 0) |
| 710 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel0_optic_cb)) |
| 711 | MCFG_DEVICE_ADD("reel1", STEPPER, 0) |
| 712 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb)) |
| 713 | MCFG_DEVICE_ADD("reel2", STEPPER, 0) |
| 714 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel2_optic_cb)) |
| 715 | MCFG_DEVICE_ADD("reel3", STEPPER, 0) |
| 716 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb)) |
| 717 | MCFG_DEVICE_ADD("reel4", STEPPER, 0) |
| 718 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb)) |
| 719 | MCFG_DEVICE_ADD("reel5", STEPPER, 0) |
| 720 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb)) |
| 731 | 721 | MACHINE_CONFIG_END |
| 732 | 722 | |
| 733 | 723 | |
trunk/src/mame/drivers/bfmsys85.c
| r242422 | r242423 | |
| 74 | 74 | bfmsys85_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), |
| 75 | 75 | m_vfd(*this, "vfd"), |
| 76 | 76 | m_maincpu(*this, "maincpu"), |
| 77 | m_reel0(*this, "reel0"), |
| 78 | m_reel1(*this, "reel1"), |
| 79 | m_reel2(*this, "reel2"), |
| 80 | m_reel3(*this, "reel3"), |
| 77 | 81 | m_acia6850_0(*this, "acia6850_0") |
| 78 | 82 | { |
| 79 | 83 | } |
| r242422 | r242423 | |
| 84 | 88 | int m_alpha_clock; |
| 85 | 89 | int m_irq_status; |
| 86 | 90 | int m_optic_pattern; |
| 91 | DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; } |
| 92 | DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; } |
| 93 | DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; } |
| 94 | DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; } |
| 87 | 95 | int m_locked; |
| 88 | 96 | int m_is_timer_enabled; |
| 89 | 97 | int m_coin_inhibits; |
| r242422 | r242423 | |
| 117 | 125 | INTERRUPT_GEN_MEMBER(timer_irq); |
| 118 | 126 | int b85_find_project_string( ); |
| 119 | 127 | required_device<cpu_device> m_maincpu; |
| 128 | required_device<stepper_device> m_reel0; |
| 129 | required_device<stepper_device> m_reel1; |
| 130 | required_device<stepper_device> m_reel2; |
| 131 | required_device<stepper_device> m_reel3; |
| 120 | 132 | required_device<acia6850_device> m_acia6850_0; |
| 121 | 133 | }; |
| 122 | 134 | |
| r242422 | r242423 | |
| 158 | 170 | |
| 159 | 171 | m_vfd->reset(); // reset display1 |
| 160 | 172 | |
| 161 | | // reset stepper motors /////////////////////////////////////////////////// |
| 162 | | { |
| 163 | | int pattern =0, i; |
| 164 | | |
| 165 | | for ( i = 0; i < 6; i++) |
| 166 | | { |
| 167 | | stepper_reset_position(i); |
| 168 | | if ( stepper_optic_state(i) ) pattern |= 1<<i; |
| 169 | | } |
| 170 | | m_optic_pattern = pattern; |
| 171 | | } |
| 172 | 173 | m_locked = 0x00; // hardware is open |
| 173 | 174 | } |
| 174 | 175 | |
| r242422 | r242423 | |
| 204 | 205 | |
| 205 | 206 | WRITE8_MEMBER(bfmsys85_state::reel12_w) |
| 206 | 207 | { |
| 207 | | stepper_update(0, (data>>4)&0x0f); |
| 208 | | stepper_update(1, data&0x0f ); |
| 208 | m_reel0->update((data>>4)&0x0f); |
| 209 | m_reel1->update( data &0x0f); |
| 209 | 210 | |
| 210 | | if ( stepper_optic_state(0) ) m_optic_pattern |= 0x01; |
| 211 | | else m_optic_pattern &= ~0x01; |
| 212 | | if ( stepper_optic_state(1) ) m_optic_pattern |= 0x02; |
| 213 | | else m_optic_pattern &= ~0x02; |
| 214 | | awp_draw_reel(0); |
| 215 | | awp_draw_reel(1); |
| 211 | awp_draw_reel(0, m_reel0); |
| 212 | awp_draw_reel(1, m_reel1); |
| 216 | 213 | } |
| 217 | 214 | |
| 218 | 215 | /////////////////////////////////////////////////////////////////////////// |
| 219 | 216 | |
| 220 | 217 | WRITE8_MEMBER(bfmsys85_state::reel34_w) |
| 221 | 218 | { |
| 222 | | stepper_update(2, (data>>4)&0x0f); |
| 223 | | stepper_update(3, data&0x0f ); |
| 219 | m_reel2->update((data>>4)&0x0f); |
| 220 | m_reel3->update( data &0x0f); |
| 224 | 221 | |
| 225 | | if ( stepper_optic_state(2) ) m_optic_pattern |= 0x04; |
| 226 | | else m_optic_pattern &= ~0x04; |
| 227 | | if ( stepper_optic_state(3) ) m_optic_pattern |= 0x08; |
| 228 | | else m_optic_pattern &= ~0x08; |
| 229 | | awp_draw_reel(2); |
| 230 | | awp_draw_reel(3); |
| 222 | awp_draw_reel(2, m_reel2); |
| 223 | awp_draw_reel(3, m_reel3); |
| 231 | 224 | } |
| 232 | 225 | |
| 233 | 226 | /////////////////////////////////////////////////////////////////////////// |
| r242422 | r242423 | |
| 353 | 346 | |
| 354 | 347 | void bfmsys85_state::machine_start() |
| 355 | 348 | { |
| 356 | | int i; |
| 357 | | for ( i = 0; i < 4; i++ ) |
| 358 | | { |
| 359 | | stepper_config(machine(), i, &starpoint_interface_48step); |
| 360 | | } |
| 361 | | |
| 349 | m_reel0->configure(&starpoint_interface_48step); |
| 350 | m_reel1->configure(&starpoint_interface_48step); |
| 351 | m_reel2->configure(&starpoint_interface_48step); |
| 352 | m_reel3->configure(&starpoint_interface_48step); |
| 362 | 353 | } |
| 363 | 354 | |
| 364 | 355 | // memory map for bellfruit system85 board //////////////////////////////// |
| r242422 | r242423 | |
| 415 | 406 | |
| 416 | 407 | MCFG_NVRAM_ADD_0FILL("nvram") // load/save nv RAM |
| 417 | 408 | |
| 409 | MCFG_DEVICE_ADD("reel0", STEPPER, 0) |
| 410 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfmsys85_state, reel0_optic_cb)) |
| 411 | MCFG_DEVICE_ADD("reel1", STEPPER, 0) |
| 412 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfmsys85_state, reel1_optic_cb)) |
| 413 | MCFG_DEVICE_ADD("reel2", STEPPER, 0) |
| 414 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfmsys85_state, reel2_optic_cb)) |
| 415 | MCFG_DEVICE_ADD("reel3", STEPPER, 0) |
| 416 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfmsys85_state, reel3_optic_cb)) |
| 417 | |
| 418 | 418 | MCFG_DEFAULT_LAYOUT(layout_bfmsys85) |
| 419 | 419 | MACHINE_CONFIG_END |
| 420 | 420 | |
trunk/src/mame/drivers/ecoinf2.c
| r242422 | r242423 | |
| 22 | 22 | ecoinf2_state(const machine_config &mconfig, device_type type, const char *tag) |
| 23 | 23 | : driver_device(mconfig, type, tag), |
| 24 | 24 | m_maincpu(*this, "maincpu"), |
| 25 | m_reel0(*this, "reel0"), |
| 26 | m_reel1(*this, "reel1"), |
| 27 | m_reel2(*this, "reel2"), |
| 28 | m_reel3(*this, "reel3"), |
| 25 | 29 | m_coins(*this, "COINS"), |
| 26 | 30 | m_key(*this, "PERKEY"), |
| 27 | 31 | m_panel(*this, "PANEL") |
| r242422 | r242423 | |
| 31 | 35 | } |
| 32 | 36 | |
| 33 | 37 | required_device<cpu_device> m_maincpu; |
| 38 | required_device<stepper_device> m_reel0; |
| 39 | required_device<stepper_device> m_reel1; |
| 40 | required_device<stepper_device> m_reel2; |
| 41 | required_device<stepper_device> m_reel3; |
| 34 | 42 | required_ioport m_coins; |
| 35 | 43 | required_ioport m_key; |
| 36 | 44 | required_ioport m_panel; |
| r242422 | r242423 | |
| 40 | 48 | //UINT16 m_chars[14]; |
| 41 | 49 | // void update_display(); |
| 42 | 50 | int m_optic_pattern; |
| 51 | DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; } |
| 52 | DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; } |
| 53 | DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; } |
| 54 | DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; } |
| 43 | 55 | int strobe_addr; |
| 44 | 56 | int strobe_amount; |
| 45 | 57 | |
| r242422 | r242423 | |
| 187 | 199 | |
| 188 | 200 | DECLARE_WRITE8_MEMBER(ppi8255_ic23_write_a_reel01) |
| 189 | 201 | { |
| 190 | | stepper_update(0, data&0x0f); |
| 191 | | stepper_update(1, (data>>4)&0x0f); |
| 202 | m_reel0->update( data &0x0f); |
| 203 | m_reel1->update((data>>4)&0x0f); |
| 192 | 204 | |
| 193 | | if ( stepper_optic_state(0) ) m_optic_pattern |= 0x10; |
| 194 | | else m_optic_pattern &= ~0x10; |
| 195 | | if ( stepper_optic_state(1) ) m_optic_pattern |= 0x20; |
| 196 | | else m_optic_pattern &= ~0x20; |
| 197 | | |
| 198 | | awp_draw_reel(0); |
| 199 | | awp_draw_reel(1); |
| 205 | awp_draw_reel(0, m_reel0); |
| 206 | awp_draw_reel(1, m_reel1); |
| 200 | 207 | } |
| 201 | 208 | |
| 202 | 209 | DECLARE_WRITE8_MEMBER(ppi8255_ic23_write_b_reel23) |
| 203 | 210 | { |
| 204 | | stepper_update(2, data&0x0f); |
| 205 | | stepper_update(3, (data>>4)&0x0f); |
| 211 | m_reel2->update( data &0x0f); |
| 212 | m_reel3->update((data>>4)&0x0f); |
| 206 | 213 | |
| 207 | | if ( stepper_optic_state(2) ) m_optic_pattern |= 0x40; |
| 208 | | else m_optic_pattern &= ~0x40; |
| 209 | | if ( stepper_optic_state(3) ) m_optic_pattern |= 0x80; |
| 210 | | else m_optic_pattern &= ~0x80; |
| 211 | | |
| 212 | | awp_draw_reel(2); |
| 213 | | awp_draw_reel(3); |
| 214 | awp_draw_reel(2, m_reel2); |
| 215 | awp_draw_reel(3, m_reel3); |
| 214 | 216 | } |
| 215 | 217 | |
| 216 | 218 | DECLARE_READ8_MEMBER(ppi8255_ic23_read_c_key) |
| r242422 | r242423 | |
| 498 | 500 | MACHINE_START_MEMBER(ecoinf2_state,ecoinf2) |
| 499 | 501 | { |
| 500 | 502 | MechMtr_config(machine(),8); |
| 501 | | for ( int n = 0; n < 4; n++ ) |
| 502 | | { |
| 503 | | stepper_config(machine(), n, &ecoin_interface_200step_reel); |
| 504 | | } |
| 503 | m_reel0->configure(&ecoin_interface_200step_reel); |
| 504 | m_reel1->configure(&ecoin_interface_200step_reel); |
| 505 | m_reel2->configure(&ecoin_interface_200step_reel); |
| 506 | m_reel3->configure(&ecoin_interface_200step_reel); |
| 505 | 507 | } |
| 506 | 508 | |
| 507 | 509 | |
| r242422 | r242423 | |
| 541 | 543 | MCFG_I8255_OUT_PORTB_CB(WRITE8(ecoinf2_state, ppi8255_ic13_write_b_strobedat1)) |
| 542 | 544 | MCFG_I8255_IN_PORTC_CB(READ8(ecoinf2_state, ppi8255_ic13_read_c_panel)) |
| 543 | 545 | |
| 546 | MCFG_DEVICE_ADD("reel0", STEPPER, 0) |
| 547 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf2_state, reel0_optic_cb)) |
| 548 | MCFG_DEVICE_ADD("reel1", STEPPER, 0) |
| 549 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf2_state, reel1_optic_cb)) |
| 550 | MCFG_DEVICE_ADD("reel2", STEPPER, 0) |
| 551 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf2_state, reel2_optic_cb)) |
| 552 | MCFG_DEVICE_ADD("reel3", STEPPER, 0) |
| 553 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf2_state, reel3_optic_cb)) |
| 554 | |
| 544 | 555 | // MCFG_DEVICE_ADD("ic25_dips", I8255, 0) |
| 545 | 556 | MACHINE_CONFIG_END |
| 546 | 557 | |
trunk/src/mame/drivers/ecoinf3.c
| r242422 | r242423 | |
| 23 | 23 | public: |
| 24 | 24 | ecoinf3_state(const machine_config &mconfig, device_type type, const char *tag) |
| 25 | 25 | : driver_device(mconfig, type, tag), |
| 26 | | m_maincpu(*this, "maincpu") |
| 26 | m_maincpu(*this, "maincpu"), |
| 27 | m_reel0(*this, "reel0"), |
| 28 | m_reel1(*this, "reel1"), |
| 29 | m_reel2(*this, "reel2"), |
| 30 | m_reel3(*this, "reel3") |
| 27 | 31 | { |
| 28 | 32 | strobe_amount = 0; |
| 29 | 33 | strobe_addr = 0; |
| r242422 | r242423 | |
| 31 | 35 | } |
| 32 | 36 | |
| 33 | 37 | required_device<z180_device> m_maincpu; |
| 38 | required_device<stepper_device> m_reel0; |
| 39 | required_device<stepper_device> m_reel1; |
| 40 | required_device<stepper_device> m_reel2; |
| 41 | required_device<stepper_device> m_reel3; |
| 34 | 42 | |
| 35 | 43 | UINT16 m_lamps[16]; |
| 36 | 44 | UINT16 m_chars[14]; |
| r242422 | r242423 | |
| 39 | 47 | int strobe_addr; |
| 40 | 48 | int strobe_amount; |
| 41 | 49 | int m_optic_pattern; |
| 50 | DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; } |
| 51 | DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; } |
| 52 | DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; } |
| 53 | DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; } |
| 54 | |
| 42 | 55 | int m_percent_mux; |
| 43 | 56 | |
| 44 | 57 | DECLARE_READ8_MEMBER(ppi8255_intf_a_read_a) { int ret = 0x00; logerror("%04x - ppi8255_intf_a_read_a %02x\n", m_maincpu->pcbase(), ret); return ret; } |
| r242422 | r242423 | |
| 211 | 224 | DECLARE_WRITE8_MEMBER(ppi8255_intf_d_write_a_reel01) |
| 212 | 225 | { |
| 213 | 226 | // logerror("%04x - ppi8255_intf_d_(used)write_a %02x\n", m_maincpu->pcbase(), data); |
| 214 | | stepper_update(0, data&0x0f); |
| 215 | | stepper_update(1, (data>>4)&0x0f); |
| 227 | m_reel0->update( data &0x0f); |
| 228 | m_reel1->update((data>>4)&0x0f); |
| 216 | 229 | |
| 217 | | if ( stepper_optic_state(0) ) m_optic_pattern |= 0x10; |
| 218 | | else m_optic_pattern &= ~0x10; |
| 219 | | if ( stepper_optic_state(1) ) m_optic_pattern |= 0x20; |
| 220 | | else m_optic_pattern &= ~0x20; |
| 221 | | |
| 222 | | awp_draw_reel(0); |
| 223 | | awp_draw_reel(1); |
| 230 | awp_draw_reel(0, m_reel0); |
| 231 | awp_draw_reel(1, m_reel1); |
| 224 | 232 | } |
| 225 | 233 | |
| 226 | 234 | DECLARE_WRITE8_MEMBER(ppi8255_intf_d_write_b_reel23) |
| 227 | 235 | { |
| 228 | 236 | // logerror("%04x - ppi8255_intf_d_(used)write_b %02x\n", m_maincpu->pcbase(), data); |
| 229 | 237 | |
| 230 | | stepper_update(2, data&0x0f); |
| 231 | | stepper_update(3, (data>>4)&0x0f); |
| 238 | m_reel2->update( data &0x0f); |
| 239 | m_reel3->update((data>>4)&0x0f); |
| 232 | 240 | |
| 233 | | if ( stepper_optic_state(2) ) m_optic_pattern |= 0x40; |
| 234 | | else m_optic_pattern &= ~0x40; |
| 235 | | if ( stepper_optic_state(3) ) m_optic_pattern |= 0x80; |
| 236 | | else m_optic_pattern &= ~0x80; |
| 237 | | |
| 238 | | awp_draw_reel(2); |
| 239 | | awp_draw_reel(3); |
| 241 | awp_draw_reel(2, m_reel2); |
| 242 | awp_draw_reel(3, m_reel3); |
| 240 | 243 | } |
| 241 | 244 | |
| 242 | 245 | DECLARE_WRITE8_MEMBER(ppi8255_intf_d_write_c) { logerror("%04x - ppi8255_intf_d_(used)write_c %02x\n", m_maincpu->pcbase(), data);} |
| r242422 | r242423 | |
| 654 | 657 | |
| 655 | 658 | MACHINE_START_MEMBER(ecoinf3_state,ecoinf3) |
| 656 | 659 | { |
| 657 | | for ( int n = 0; n < 4; n++ ) |
| 658 | | { |
| 659 | | stepper_config(machine(), n, &ecoin_interface_200step_reel); |
| 660 | | } |
| 660 | m_reel0->configure(&ecoin_interface_200step_reel); |
| 661 | m_reel1->configure(&ecoin_interface_200step_reel); |
| 662 | m_reel2->configure(&ecoin_interface_200step_reel); |
| 663 | m_reel3->configure(&ecoin_interface_200step_reel); |
| 661 | 664 | } |
| 662 | 665 | |
| 663 | 666 | static MACHINE_CONFIG_START( ecoinf3_pyramid, ecoinf3_state ) |
| r242422 | r242423 | |
| 740 | 743 | MCFG_I8255_OUT_PORTB_CB(WRITE8(ecoinf3_state, ppi8255_intf_h_write_b)) |
| 741 | 744 | MCFG_I8255_IN_PORTC_CB(READ8(ecoinf3_state, ppi8255_intf_h_read_c)) |
| 742 | 745 | MCFG_I8255_OUT_PORTC_CB(WRITE8(ecoinf3_state, ppi8255_intf_h_write_c)) |
| 746 | |
| 747 | MCFG_DEVICE_ADD("reel0", STEPPER, 0) |
| 748 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel0_optic_cb)) |
| 749 | MCFG_DEVICE_ADD("reel1", STEPPER, 0) |
| 750 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel1_optic_cb)) |
| 751 | MCFG_DEVICE_ADD("reel2", STEPPER, 0) |
| 752 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel2_optic_cb)) |
| 753 | MCFG_DEVICE_ADD("reel3", STEPPER, 0) |
| 754 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel3_optic_cb)) |
| 743 | 755 | MACHINE_CONFIG_END |
| 744 | 756 | |
| 745 | 757 | |
trunk/src/mame/drivers/ecoinfr.c
| r242422 | r242423 | |
| 53 | 53 | public: |
| 54 | 54 | ecoinfr_state(const machine_config &mconfig, device_type type, const char *tag) |
| 55 | 55 | : driver_device(mconfig, type, tag), |
| 56 | | m_maincpu(*this, "maincpu") { } |
| 56 | m_maincpu(*this, "maincpu"), |
| 57 | m_reel0(*this, "reel0"), |
| 58 | m_reel1(*this, "reel1"), |
| 59 | m_reel2(*this, "reel2"), |
| 60 | m_reel3(*this, "reel3") |
| 61 | { } |
| 57 | 62 | |
| 58 | 63 | int irq_toggle; |
| 59 | 64 | int m_optic_pattern; |
| 65 | DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; } |
| 66 | DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; } |
| 67 | DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; } |
| 68 | DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; } |
| 60 | 69 | |
| 61 | 70 | UINT8 port09_value; |
| 62 | 71 | UINT8 port10_value; |
| r242422 | r242423 | |
| 108 | 117 | |
| 109 | 118 | DECLARE_MACHINE_START(ecoinfr); |
| 110 | 119 | required_device<cpu_device> m_maincpu; |
| 120 | required_device<stepper_device> m_reel0; |
| 121 | required_device<stepper_device> m_reel1; |
| 122 | required_device<stepper_device> m_reel2; |
| 123 | required_device<stepper_device> m_reel3; |
| 111 | 124 | }; |
| 112 | 125 | |
| 113 | 126 | |
| r242422 | r242423 | |
| 151 | 164 | printf("ec_port0a_out_w (reel 1 port) unk bits used %02x\n", data); |
| 152 | 165 | } |
| 153 | 166 | |
| 154 | | stepper_update(0, data&0x0f); |
| 167 | m_reel0->update(data&0x0f); |
| 155 | 168 | |
| 156 | | if ( stepper_optic_state(0) ) m_optic_pattern |= 0x01; |
| 157 | | else m_optic_pattern &= ~0x01; |
| 158 | | |
| 159 | | awp_draw_reel(0); |
| 169 | awp_draw_reel(0, m_reel0); |
| 160 | 170 | } |
| 161 | 171 | |
| 162 | 172 | WRITE8_MEMBER(ecoinfr_state::ec_port01_out_w) |
| r242422 | r242423 | |
| 166 | 176 | printf("ec_port01_out_w (reel 2 port) unk bits used %02x\n", data); |
| 167 | 177 | } |
| 168 | 178 | |
| 169 | | stepper_update(1, data&0x0f); |
| 179 | m_reel1->update(data&0x0f); |
| 170 | 180 | |
| 171 | | if ( stepper_optic_state(1) ) m_optic_pattern |= 0x02; |
| 172 | | else m_optic_pattern &= ~0x02; |
| 173 | | |
| 174 | | awp_draw_reel(1); |
| 181 | awp_draw_reel(1, m_reel1); |
| 175 | 182 | } |
| 176 | 183 | |
| 177 | 184 | WRITE8_MEMBER(ecoinfr_state::ec_port02_out_w) |
| r242422 | r242423 | |
| 181 | 188 | printf("ec_port02_out_w (reel 3 port) unk bits used %02x\n", data); |
| 182 | 189 | } |
| 183 | 190 | |
| 184 | | stepper_update(2, data&0x0f); |
| 191 | m_reel2->update(data&0x0f); |
| 185 | 192 | |
| 186 | | if ( stepper_optic_state(2) ) m_optic_pattern |= 0x04; |
| 187 | | else m_optic_pattern &= ~0x04; |
| 188 | | |
| 189 | | awp_draw_reel(2); |
| 193 | awp_draw_reel(2, m_reel2); |
| 190 | 194 | } |
| 191 | 195 | |
| 192 | 196 | |
| r242422 | r242423 | |
| 766 | 770 | |
| 767 | 771 | MACHINE_START_MEMBER(ecoinfr_state,ecoinfr) |
| 768 | 772 | { |
| 769 | | for ( int n = 0; n < 4; n++ ) |
| 770 | | { |
| 771 | | stepper_config(machine(), n, &ecoin_interface_200step_reel); |
| 772 | | } |
| 773 | m_reel0->configure(&ecoin_interface_200step_reel); |
| 774 | m_reel1->configure(&ecoin_interface_200step_reel); |
| 775 | m_reel2->configure(&ecoin_interface_200step_reel); |
| 776 | m_reel3->configure(&ecoin_interface_200step_reel); |
| 773 | 777 | } |
| 774 | 778 | |
| 775 | 779 | static MACHINE_CONFIG_START( ecoinfr, ecoinfr_state ) |
| r242422 | r242423 | |
| 784 | 788 | MCFG_MACHINE_START_OVERRIDE(ecoinfr_state, ecoinfr ) |
| 785 | 789 | |
| 786 | 790 | MCFG_DEVICE_ADD(UPD8251_TAG, I8251, 0) |
| 791 | |
| 792 | MCFG_DEVICE_ADD("reel0", STEPPER, 0) |
| 793 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel0_optic_cb)) |
| 794 | MCFG_DEVICE_ADD("reel1", STEPPER, 0) |
| 795 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel1_optic_cb)) |
| 796 | MCFG_DEVICE_ADD("reel2", STEPPER, 0) |
| 797 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel2_optic_cb)) |
| 787 | 798 | MACHINE_CONFIG_END |
| 788 | 799 | |
| 789 | 800 | |
trunk/src/mame/drivers/maygay1b.c
| r242422 | r242423 | |
| 81 | 81 | // called if board is reset /////////////////////////////////////////////// |
| 82 | 82 | /////////////////////////////////////////////////////////////////////////// |
| 83 | 83 | |
| 84 | | void maygay1b_state::m1_stepper_reset() |
| 85 | | { |
| 86 | | int pattern = 0,i; |
| 87 | | for ( i = 0; i < 6; i++) |
| 88 | | { |
| 89 | | stepper_reset_position(i); |
| 90 | | if ( stepper_optic_state(i) ) pattern |= 1<<i; |
| 91 | | } |
| 92 | | m_optic_pattern = pattern; |
| 93 | | } |
| 94 | | |
| 95 | 84 | void maygay1b_state::machine_reset() |
| 96 | 85 | { |
| 97 | 86 | m_vfd->reset(); // reset display1 |
| 98 | | m1_stepper_reset(); |
| 99 | 87 | m_Vmm=false; |
| 100 | 88 | } |
| 101 | 89 | |
| r242422 | r242423 | |
| 293 | 281 | |
| 294 | 282 | void maygay1b_state::machine_start() |
| 295 | 283 | { |
| 296 | | int i; |
| 297 | | |
| 298 | 284 | // setup 8 mechanical meters //////////////////////////////////////////// |
| 299 | 285 | MechMtr_config(machine(),8); |
| 300 | 286 | |
| 301 | 287 | // setup 6 default 96 half step reels /////////////////////////////////// |
| 302 | | for ( i = 0; i < 6; i++ ) |
| 303 | | { |
| 304 | | stepper_config(machine(), i, &starpoint_interface_48step); |
| 305 | | } |
| 288 | m_reel0->configure(&starpoint_interface_48step); |
| 289 | m_reel1->configure(&starpoint_interface_48step); |
| 290 | m_reel2->configure(&starpoint_interface_48step); |
| 291 | m_reel3->configure(&starpoint_interface_48step); |
| 292 | m_reel4->configure(&starpoint_interface_48step); |
| 293 | m_reel5->configure(&starpoint_interface_48step); |
| 306 | 294 | |
| 307 | 295 | } |
| 308 | 296 | WRITE8_MEMBER(maygay1b_state::reel12_w) |
| 309 | 297 | { |
| 310 | | stepper_update(0, data & 0x0F ); |
| 311 | | stepper_update(1, (data>>4) & 0x0F ); |
| 298 | m_reel0->update( data & 0x0F); |
| 299 | m_reel1->update((data>>4) & 0x0F); |
| 312 | 300 | |
| 313 | | if ( stepper_optic_state(0) ) m_optic_pattern |= 0x01; |
| 314 | | else m_optic_pattern &= ~0x01; |
| 315 | | if ( stepper_optic_state(1) ) m_optic_pattern |= 0x02; |
| 316 | | else m_optic_pattern &= ~0x02; |
| 317 | | |
| 318 | | awp_draw_reel(0); |
| 319 | | awp_draw_reel(1); |
| 301 | awp_draw_reel(0, m_reel0); |
| 302 | awp_draw_reel(1, m_reel1); |
| 320 | 303 | } |
| 321 | 304 | |
| 322 | 305 | WRITE8_MEMBER(maygay1b_state::reel34_w) |
| 323 | 306 | { |
| 324 | | stepper_update(2, data & 0x0F ); |
| 325 | | stepper_update(3, (data>>4) & 0x0F ); |
| 307 | m_reel2->update( data & 0x0F); |
| 308 | m_reel3->update((data>>4) & 0x0F); |
| 326 | 309 | |
| 327 | | if ( stepper_optic_state(2) ) m_optic_pattern |= 0x04; |
| 328 | | else m_optic_pattern &= ~0x04; |
| 329 | | if ( stepper_optic_state(3) ) m_optic_pattern |= 0x08; |
| 330 | | else m_optic_pattern &= ~0x08; |
| 331 | | |
| 332 | | awp_draw_reel(2); |
| 333 | | awp_draw_reel(3); |
| 310 | awp_draw_reel(2, m_reel2); |
| 311 | awp_draw_reel(3, m_reel3); |
| 334 | 312 | } |
| 335 | 313 | |
| 336 | 314 | WRITE8_MEMBER(maygay1b_state::reel56_w) |
| 337 | 315 | { |
| 338 | | stepper_update(4, data & 0x0F ); |
| 339 | | stepper_update(5, (data>>4) & 0x0F ); |
| 316 | m_reel4->update( data & 0x0F); |
| 317 | m_reel5->update((data>>4) & 0x0F); |
| 340 | 318 | |
| 341 | | if ( stepper_optic_state(4) ) m_optic_pattern |= 0x10; |
| 342 | | else m_optic_pattern &= ~0x10; |
| 343 | | if ( stepper_optic_state(5) ) m_optic_pattern |= 0x20; |
| 344 | | else m_optic_pattern &= ~0x20; |
| 345 | | |
| 346 | | awp_draw_reel(4); |
| 347 | | awp_draw_reel(5); |
| 319 | awp_draw_reel(4, m_reel4); |
| 320 | awp_draw_reel(5, m_reel5); |
| 348 | 321 | } |
| 349 | 322 | |
| 350 | 323 | READ8_MEMBER(maygay1b_state::m1_duart_r) |
| r242422 | r242423 | |
| 651 | 624 | MCFG_DEVICE_ADD("i8279_2", I8279, M1_MASTER_CLOCK/4) // unknown clock |
| 652 | 625 | MCFG_I8279_OUT_DISP_CB(WRITE8(maygay1b_state, lamp_data_2_w)) // display A&B |
| 653 | 626 | |
| 627 | MCFG_DEVICE_ADD("reel0", STEPPER, 0) |
| 628 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel0_optic_cb)) |
| 629 | MCFG_DEVICE_ADD("reel1", STEPPER, 0) |
| 630 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel1_optic_cb)) |
| 631 | MCFG_DEVICE_ADD("reel2", STEPPER, 0) |
| 632 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel2_optic_cb)) |
| 633 | MCFG_DEVICE_ADD("reel3", STEPPER, 0) |
| 634 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel3_optic_cb)) |
| 635 | MCFG_DEVICE_ADD("reel4", STEPPER, 0) |
| 636 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel4_optic_cb)) |
| 637 | MCFG_DEVICE_ADD("reel5", STEPPER, 0) |
| 638 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel5_optic_cb)) |
| 639 | |
| 654 | 640 | MCFG_NVRAM_ADD_0FILL("nvram") |
| 655 | 641 | |
| 656 | 642 | MCFG_DEFAULT_LAYOUT(layout_maygay1b) |
trunk/src/mame/drivers/mpu3.c
| r242422 | r242423 | |
| 132 | 132 | mpu3_state(const machine_config &mconfig, device_type type, const char *tag) |
| 133 | 133 | : driver_device(mconfig, type, tag), |
| 134 | 134 | m_vfd(*this, "vfd"), |
| 135 | | m_maincpu(*this, "maincpu") { } |
| 135 | m_maincpu(*this, "maincpu"), |
| 136 | m_reel0(*this, "reel0"), |
| 137 | m_reel1(*this, "reel1"), |
| 138 | m_reel2(*this, "reel2"), |
| 139 | m_reel3(*this, "reel3") |
| 140 | { } |
| 136 | 141 | optional_device<roc10937_t> m_vfd; |
| 137 | 142 | |
| 138 | 143 | |
| r242422 | r242423 | |
| 165 | 170 | |
| 166 | 171 | int m_optic_pattern; |
| 167 | 172 | |
| 173 | DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; } |
| 174 | DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; } |
| 175 | DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; } |
| 176 | DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; } |
| 177 | |
| 168 | 178 | emu_timer *m_ic21_timer; |
| 169 | 179 | DECLARE_WRITE8_MEMBER(characteriser_w); |
| 170 | 180 | DECLARE_READ8_MEMBER(characteriser_r); |
| r242422 | r242423 | |
| 198 | 208 | TIMER_DEVICE_CALLBACK_MEMBER(gen_50hz); |
| 199 | 209 | TIMER_DEVICE_CALLBACK_MEMBER(ic10_callback); |
| 200 | 210 | void update_triacs(); |
| 201 | | void mpu3_stepper_reset(); |
| 202 | 211 | void ic11_update(); |
| 203 | 212 | void ic21_output(int data); |
| 204 | 213 | void ic21_setup(); |
| 205 | 214 | void mpu3_config_common(); |
| 206 | 215 | required_device<cpu_device> m_maincpu; |
| 216 | required_device<stepper_device> m_reel0; |
| 217 | required_device<stepper_device> m_reel1; |
| 218 | required_device<stepper_device> m_reel2; |
| 219 | required_device<stepper_device> m_reel3; |
| 207 | 220 | }; |
| 208 | 221 | |
| 209 | 222 | #define DISPLAY_PORT 0 |
| r242422 | r242423 | |
| 224 | 237 | } |
| 225 | 238 | |
| 226 | 239 | /* called if board is reset */ |
| 227 | | void mpu3_state::mpu3_stepper_reset() |
| 228 | | { |
| 229 | | int pattern = 0,reel; |
| 230 | | for (reel = 0; reel < 6; reel++) |
| 231 | | { |
| 232 | | stepper_reset_position(reel); |
| 233 | | if (stepper_optic_state(reel)) pattern |= 1<<reel; |
| 234 | | } |
| 235 | | m_optic_pattern = pattern; |
| 236 | | } |
| 237 | | |
| 238 | 240 | void mpu3_state::machine_reset() |
| 239 | 241 | { |
| 240 | 242 | m_vfd->reset(); |
| 241 | 243 | |
| 242 | | mpu3_stepper_reset(); |
| 243 | | |
| 244 | 244 | m_lamp_strobe = 0; |
| 245 | 245 | m_led_strobe = 0; |
| 246 | 246 | |
| r242422 | r242423 | |
| 509 | 509 | WRITE8_MEMBER(mpu3_state::pia_ic5_porta_w) |
| 510 | 510 | { |
| 511 | 511 | LOG(("%s: IC5 PIA Port A Set to %2x (Reel)\n", machine().describe_context(),data)); |
| 512 | | stepper_update(0, data & 0x03 ); |
| 513 | | stepper_update(1, (data>>2) & 0x03 ); |
| 514 | | stepper_update(2, (data>>4) & 0x03 ); |
| 515 | | stepper_update(3, (data>>6) & 0x03 ); |
| 516 | | awp_draw_reel(0); |
| 517 | | awp_draw_reel(1); |
| 518 | | awp_draw_reel(2); |
| 519 | | awp_draw_reel(3); |
| 520 | | |
| 521 | | { |
| 522 | | if ( stepper_optic_state(0) ) m_optic_pattern |= 0x01; |
| 523 | | else m_optic_pattern &= ~0x01; |
| 524 | | |
| 525 | | if ( stepper_optic_state(1) ) m_optic_pattern |= 0x02; |
| 526 | | else m_optic_pattern &= ~0x02; |
| 527 | | if ( stepper_optic_state(2) ) m_optic_pattern |= 0x04; |
| 528 | | else m_optic_pattern &= ~0x04; |
| 529 | | |
| 530 | | if ( stepper_optic_state(3) ) m_optic_pattern |= 0x08; |
| 531 | | else m_optic_pattern &= ~0x08; |
| 532 | | |
| 533 | | } |
| 534 | | |
| 512 | m_reel0->update( data & 0x03); |
| 513 | m_reel1->update((data>>2) & 0x03); |
| 514 | m_reel2->update((data>>4) & 0x03); |
| 515 | m_reel3->update((data>>6) & 0x03); |
| 516 | awp_draw_reel(0, m_reel0); |
| 517 | awp_draw_reel(1, m_reel1); |
| 518 | awp_draw_reel(2, m_reel2); |
| 519 | awp_draw_reel(3, m_reel3); |
| 535 | 520 | } |
| 536 | 521 | |
| 537 | 522 | READ8_MEMBER(mpu3_state::pia_ic5_portb_r) |
| r242422 | r242423 | |
| 723 | 708 | MechMtr_config(machine(),8); |
| 724 | 709 | |
| 725 | 710 | /* setup 4 reels */ |
| 726 | | stepper_config(machine(), 0, &mpu3_reel_interface); |
| 727 | | stepper_config(machine(), 1, &mpu3_reel_interface); |
| 728 | | stepper_config(machine(), 2, &mpu3_reel_interface); |
| 729 | | stepper_config(machine(), 3, &mpu3_reel_interface); |
| 711 | m_reel0->configure(&mpu3_reel_interface); |
| 712 | m_reel1->configure(&mpu3_reel_interface); |
| 713 | m_reel2->configure(&mpu3_reel_interface); |
| 714 | m_reel3->configure(&mpu3_reel_interface); |
| 730 | 715 | |
| 731 | 716 | } |
| 732 | 717 | /* |
| r242422 | r242423 | |
| 871 | 856 | MCFG_PIA_IRQA_HANDLER(WRITELINE(mpu3_state, cpu0_irq)) |
| 872 | 857 | MCFG_PIA_IRQB_HANDLER(WRITELINE(mpu3_state, cpu0_irq)) |
| 873 | 858 | |
| 859 | MCFG_DEVICE_ADD("reel0", STEPPER, 0) |
| 860 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu3_state, reel0_optic_cb)) |
| 861 | MCFG_DEVICE_ADD("reel1", STEPPER, 0) |
| 862 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu3_state, reel1_optic_cb)) |
| 863 | MCFG_DEVICE_ADD("reel2", STEPPER, 0) |
| 864 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu3_state, reel2_optic_cb)) |
| 865 | MCFG_DEVICE_ADD("reel3", STEPPER, 0) |
| 866 | MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu3_state, reel3_optic_cb)) |
| 867 | |
| 874 | 868 | MCFG_NVRAM_ADD_0FILL("nvram") |
| 875 | 869 | |
| 876 | 870 | MCFG_DEFAULT_LAYOUT(layout_mpu3) |
trunk/src/mame/drivers/mpu4hw.c
| r242422 | r242423 | |
| 375 | 375 | break; |
| 376 | 376 | |
| 377 | 377 | case FIVE_REEL_5TO8: |
| 378 | | stepper_update(4, ((data >> 4) & 0x0f)); |
| 378 | m_reel4->update(((data >> 4) & 0x0f)); |
| 379 | 379 | data = (data & 0x0F); //Strip reel data from meter drives, leaving active elements |
| 380 | | awp_draw_reel(4); |
| 380 | awp_draw_reel(4, m_reel4); |
| 381 | 381 | break; |
| 382 | 382 | |
| 383 | 383 | case FIVE_REEL_8TO5: |
| 384 | | stepper_update(4, (((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ; |
| 384 | m_reel4->update((((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ; |
| 385 | 385 | data = 0x00; //Strip all reel data from meter drives, nothing is connected |
| 386 | | awp_draw_reel(4); |
| 386 | awp_draw_reel(4, m_reel4); |
| 387 | 387 | break; |
| 388 | 388 | |
| 389 | 389 | case FIVE_REEL_3TO6: |
| 390 | | stepper_update(4, ((data >> 2) & 0x0f)); |
| 390 | m_reel4->update(((data >> 2) & 0x0f)); |
| 391 | 391 | data = 0x00; //Strip all reel data from meter drives |
| 392 | | awp_draw_reel(4); |
| 392 | awp_draw_reel(4, m_reel4); |
| 393 | 393 | break; |
| 394 | 394 | |
| 395 | 395 | case SIX_REEL_1TO8: |
| 396 | | stepper_update(4, (data & 0x0f)); |
| 397 | | stepper_update(5, ((data >> 4) & 0x0f)); |
| 396 | m_reel4->update( data & 0x0f); |
| 397 | m_reel5->update((data >> 4) & 0x0f); |
| 398 | 398 | data = 0x00; //Strip all reel data from meter drives |
| 399 | | awp_draw_reel(4); |
| 400 | | awp_draw_reel(5); |
| 399 | awp_draw_reel(4, m_reel4); |
| 400 | awp_draw_reel(5, m_reel5); |
| 401 | 401 | break; |
| 402 | 402 | |
| 403 | 403 | case SIX_REEL_5TO8: |
| 404 | | stepper_update(4, ((data >> 4) & 0x0f)); |
| 404 | m_reel4->update(((data >> 4) & 0x0f)); |
| 405 | 405 | data = 0x00; //Strip all reel data from meter drives |
| 406 | | awp_draw_reel(4); |
| 406 | awp_draw_reel(4, m_reel4); |
| 407 | 407 | break; |
| 408 | 408 | |
| 409 | 409 | case SEVEN_REEL: |
| 410 | | stepper_update(0, (((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ; |
| 410 | m_reel0->update((((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ; |
| 411 | 411 | data = 0x00; //Strip all reel data from meter drives |
| 412 | | awp_draw_reel(0); |
| 412 | awp_draw_reel(0, m_reel0); |
| 413 | 413 | break; |
| 414 | 414 | |
| 415 | 415 | case FLUTTERBOX: //The backbox fan assembly fits in a reel unit sized box, wired to the remote meter pin, so we can handle it here |
| r242422 | r242423 | |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /* called if board is reset */ |
| 436 | | void mpu4_state::mpu4_stepper_reset() |
| 437 | | { |
| 438 | | int pattern = 0,reel; |
| 439 | | for (reel = 0; reel < 6; reel++) |
| 440 | | { |
| 441 | | stepper_reset_position(reel); |
| 442 | | if(!m_reel_mux) |
| 443 | | { |
| 444 | | if (stepper_optic_state(reel)) pattern |= 1<<reel; |
| 445 | | } |
| 446 | | } |
| 447 | | m_optic_pattern = pattern; |
| 448 | | } |
| 449 | | |
| 450 | | |
| 451 | 436 | MACHINE_RESET_MEMBER(mpu4_state,mpu4) |
| 452 | 437 | { |
| 453 | 438 | m_vfd->reset(); |
| 454 | 439 | |
| 455 | | mpu4_stepper_reset(); |
| 456 | | |
| 457 | 440 | m_lamp_strobe = 0; |
| 458 | 441 | m_lamp_strobe2 = 0; |
| 459 | 442 | m_led_strobe = 0; |
| r242422 | r242423 | |
| 788 | 771 | } |
| 789 | 772 | else |
| 790 | 773 | { |
| 791 | | if (stepper_optic_state(m_active_reel)) |
| 774 | if (m_optic_pattern & (1<<m_active_reel)) |
| 792 | 775 | { |
| 793 | 776 | m_ic4_input_b |= 0x08; |
| 794 | 777 | } |
| r242422 | r242423 | |
| 915 | 898 | } |
| 916 | 899 | if (m_reel_mux == SIX_REEL_5TO8) |
| 917 | 900 | { |
| 918 | | stepper_update(4, data&0x0F); |
| 919 | | stepper_update(5, (data >> 4)&0x0F); |
| 920 | | awp_draw_reel(4); |
| 921 | | awp_draw_reel(5); |
| 901 | m_reel4->update( data &0x0F); |
| 902 | m_reel5->update((data >> 4)&0x0F); |
| 903 | awp_draw_reel(4, m_reel4); |
| 904 | awp_draw_reel(5, m_reel5); |
| 922 | 905 | } |
| 923 | 906 | else |
| 924 | 907 | if (m_reel_mux == SEVEN_REEL) |
| 925 | 908 | { |
| 926 | | stepper_update(1, data&0x0F); |
| 927 | | stepper_update(2, (data >> 4)&0x0F); |
| 928 | | awp_draw_reel(1); |
| 929 | | awp_draw_reel(2); |
| 909 | m_reel1->update( data &0x0F); |
| 910 | m_reel2->update((data >> 4)&0x0F); |
| 911 | awp_draw_reel(1, m_reel1); |
| 912 | awp_draw_reel(2, m_reel2); |
| 930 | 913 | } |
| 931 | 914 | |
| 932 | 915 | if (core_stricmp(machine().system().name, "m4gambal") == 0) |
| r242422 | r242423 | |
| 1139 | 1122 | |
| 1140 | 1123 | if (m_reel_mux == SEVEN_REEL) |
| 1141 | 1124 | { |
| 1142 | | stepper_update(3, data&0x0F); |
| 1143 | | stepper_update(4, (data >> 4)&0x0F); |
| 1144 | | awp_draw_reel(3); |
| 1145 | | awp_draw_reel(4); |
| 1125 | m_reel3->update( data &0x0F); |
| 1126 | m_reel4->update((data >> 4)&0x0F); |
| 1127 | awp_draw_reel(3, m_reel3); |
| 1128 | awp_draw_reel(4, m_reel4); |
| 1146 | 1129 | } |
| 1147 | 1130 | else if (m_reels) |
| 1148 | 1131 | { |
| 1149 | | stepper_update(0, data & 0x0F ); |
| 1150 | | stepper_update(1, (data>>4) & 0x0F ); |
| 1151 | | awp_draw_reel(0); |
| 1152 | | awp_draw_reel(1); |
| 1132 | m_reel0->update( data &0x0F); |
| 1133 | m_reel1->update((data >> 4)&0x0F); |
| 1134 | awp_draw_reel(0, m_reel0); |
| 1135 | awp_draw_reel(1, m_reel1); |
| 1153 | 1136 | } |
| 1154 | | |
| 1155 | | if (m_reel_flag && (m_reel_mux == STANDARD_REEL) && m_reels) |
| 1156 | | { |
| 1157 | | if ( stepper_optic_state(0) ) m_optic_pattern |= 0x01; |
| 1158 | | else m_optic_pattern &= ~0x01; |
| 1159 | | |
| 1160 | | if ( stepper_optic_state(1) ) m_optic_pattern |= 0x02; |
| 1161 | | else m_optic_pattern &= ~0x02; |
| 1162 | | } |
| 1163 | 1137 | } |
| 1164 | 1138 | |
| 1165 | 1139 | |
| r242422 | r242423 | |
| 1204 | 1178 | LOG(("%s: IC7 PIA Port A Set to %2x (Reel C and D)\n", machine().describe_context(),data)); |
| 1205 | 1179 | if (m_reel_mux == SEVEN_REEL) |
| 1206 | 1180 | { |
| 1207 | | stepper_update(5, data&0x0F); |
| 1208 | | stepper_update(6, (data >> 4)&0x0F); |
| 1209 | | awp_draw_reel(5); |
| 1210 | | awp_draw_reel(6); |
| 1181 | m_reel5->update( data &0x0F); |
| 1182 | m_reel6->update((data >> 4)&0x0F); |
| 1183 | awp_draw_reel(5, m_reel5); |
| 1184 | awp_draw_reel(6, m_reel6); |
| 1211 | 1185 | } |
| 1212 | 1186 | else if (m_reels) |
| 1213 | 1187 | { |
| 1214 | | stepper_update(2, data & 0x0F ); |
| 1215 | | stepper_update(3, (data>>4) & 0x0F ); |
| 1216 | | awp_draw_reel(2); |
| 1217 | | awp_draw_reel(3); |
| 1188 | m_reel2->update( data &0x0F); |
| 1189 | m_reel3->update((data >> 4)&0x0F); |
| 1190 | awp_draw_reel(2, m_reel2); |
| 1191 | awp_draw_reel(3, m_reel3); |
| 1218 | 1192 | } |
| 1219 | | |
| 1220 | | if (m_reel_flag && (m_reel_mux == STANDARD_REEL) && m_reels) |
| 1221 | | { |
| 1222 | | if ( stepper_optic_state(2) ) m_optic_pattern |= 0x04; |
| 1223 | | else m_optic_pattern &= ~0x04; |
| 1224 | | if ( stepper_optic_state(3) ) m_optic_pattern |= 0x08; |
| 1225 | | else m_optic_pattern &= ~0x08; |
| 1226 | | } |
| 1227 | 1193 | } |
| 1228 | 1194 | |
| 1229 | 1195 | WRITE8_MEMBER(mpu4_state::pia_ic7_portb_w) |
| r242422 | r242423 | |
| 2230 | 2196 | |
| 2231 | 2197 | } |
| 2232 | 2198 | |
| 2233 | | void mpu4_state::mpu4_config_common_reels(int reels) |
| 2234 | | { |
| 2235 | | int n; |
| 2236 | | /* setup n default 96 half step reels, using the standard optic flag */ |
| 2237 | | for ( n = 0; n < reels; n++ ) |
| 2238 | | { |
| 2239 | | stepper_config(machine(), n, &barcrest_reel_interface); |
| 2240 | | } |
| 2241 | | } |
| 2242 | | |
| 2243 | 2199 | MACHINE_START_MEMBER(mpu4_state,mod2) |
| 2244 | 2200 | { |
| 2245 | 2201 | mpu4_config_common(); |
| r242422 | r242423 | |
| 2368 | 2324 | m_reel_mux=SIX_REEL_1TO8; |
| 2369 | 2325 | m_reels = 6; |
| 2370 | 2326 | |
| 2371 | | stepper_config(machine(), 0, &barcrest_opto1_interface); |
| 2372 | | stepper_config(machine(), 1, &barcrest_opto1_interface); |
| 2373 | | stepper_config(machine(), 2, &barcrest_opto1_interface); |
| 2374 | | stepper_config(machine(), 3, &barcrest_opto1_interface); |
| 2375 | | stepper_config(machine(), 4, &barcrest_opto1_interface); |
| 2376 | | stepper_config(machine(), 5, &barcrest_opto1_interface); |
| 2327 | m_reel0->configure(&barcrest_opto1_interface); |
| 2328 | m_reel1->configure(&barcrest_opto1_interface); |
| 2329 | m_reel2->configure(&barcrest_opto1_interface); |
| 2330 | m_reel3->configure(&barcrest_opto1_interface); |
| 2331 | m_reel4->configure(&barcrest_opto1_interface); |
| 2332 | m_reel5->configure(&barcrest_opto1_interface); |
| 2377 | 2333 | DRIVER_INIT_CALL(m4default_banks); |
| 2378 | 2334 | |
| 2379 | 2335 | m_current_chr_table = oldtmr_data; |
| r242422 | r242423 | |
| 2384 | 2340 | m_reel_mux=SIX_REEL_1TO8; |
| 2385 | 2341 | m_reels = 6; |
| 2386 | 2342 | |
| 2387 | | stepper_config(machine(), 0, &barcrest_opto1_interface); |
| 2388 | | stepper_config(machine(), 1, &barcrest_opto1_interface); |
| 2389 | | stepper_config(machine(), 2, &barcrest_opto1_interface); |
| 2390 | | stepper_config(machine(), 3, &barcrest_opto1_interface); |
| 2391 | | stepper_config(machine(), 4, &barcrest_opto1_interface); |
| 2392 | | stepper_config(machine(), 5, &barcrest_opto1_interface); |
| 2343 | m_reel0->configure(&barcrest_opto1_interface); |
| 2344 | m_reel1->configure(&barcrest_opto1_interface); |
| 2345 | m_reel2->configure(&barcrest_opto1_interface); |
| 2346 | m_reel3->configure(&barcrest_opto1_interface); |
| 2347 | m_reel4->configure(&barcrest_opto1_interface); |
| 2348 | m_reel5->configure(&barcrest_opto1_interface); |
| 2393 | 2349 | DRIVER_INIT_CALL(m4default_banks); |
| 2394 | 2350 | } |
| 2395 | 2351 | |
| r242422 | r242423 | |
| 2412 | 2368 | m_reels = 5; |
| 2413 | 2369 | m_lamp_extender=SMALL_CARD; |
| 2414 | 2370 | // setup 4 default 96 half step reels with the mux board |
| 2415 | | mpu4_config_common_reels(5); |
| 2371 | m_reel0->configure(&barcrest_reel_interface); |
| 2372 | m_reel1->configure(&barcrest_reel_interface); |
| 2373 | m_reel2->configure(&barcrest_reel_interface); |
| 2374 | m_reel3->configure(&barcrest_reel_interface); |
| 2375 | m_reel4->configure(&barcrest_reel_interface); |
| 2416 | 2376 | DRIVER_INIT_CALL(m4default_banks); |
| 2417 | 2377 | |
| 2418 | 2378 | m_current_chr_table = grtecp_data; |
| r242422 | r242423 | |
| 2423 | 2383 | m_bwb_bank=1; |
| 2424 | 2384 | m_reel_mux=FIVE_REEL_5TO8; |
| 2425 | 2385 | m_reels = 5; |
| 2426 | | stepper_config(machine(), 0, &bwb_opto1_interface); |
| 2427 | | stepper_config(machine(), 1, &bwb_opto1_interface); |
| 2428 | | stepper_config(machine(), 2, &bwb_opto1_interface); |
| 2429 | | stepper_config(machine(), 3, &bwb_opto1_interface); |
| 2430 | | stepper_config(machine(), 4, &bwb_opto1_interface); |
| 2386 | m_reel0->configure(&bwb_opto1_interface); |
| 2387 | m_reel1->configure(&bwb_opto1_interface); |
| 2388 | m_reel2->configure(&bwb_opto1_interface); |
| 2389 | m_reel3->configure(&bwb_opto1_interface); |
| 2390 | m_reel4->configure(&bwb_opto1_interface); |
| 2431 | 2391 | m_bwb_chr_table1 = blsbys_data1; |
| 2432 | 2392 | m_current_chr_table = blsbys_data; |
| 2433 | 2393 | DRIVER_INIT_CALL(m4default_big); |
| r242422 | r242423 | |
| 2437 | 2397 | { |
| 2438 | 2398 | m_reel_mux=STANDARD_REEL; |
| 2439 | 2399 | m_reels = 4; |
| 2440 | | mpu4_config_common_reels(4); |
| 2400 | m_reel0->configure(&barcrest_reel_interface); |
| 2401 | m_reel1->configure(&barcrest_reel_interface); |
| 2402 | m_reel2->configure(&barcrest_reel_interface); |
| 2403 | m_reel3->configure(&barcrest_reel_interface); |
| 2441 | 2404 | m_bwb_bank=0; |
| 2442 | 2405 | } |
| 2443 | 2406 | |
| r242422 | r242423 | |
| 2453 | 2416 | { |
| 2454 | 2417 | m_reel_mux=STANDARD_REEL; |
| 2455 | 2418 | m_reels = 8; |
| 2456 | | stepper_config(machine(), 0, &barcrest_opto2_interface); |
| 2457 | | stepper_config(machine(), 1, &barcrest_opto2_interface); |
| 2458 | | stepper_config(machine(), 2, &barcrest_opto2_interface); |
| 2459 | | stepper_config(machine(), 3, &barcrest_opto2_interface); |
| 2460 | | stepper_config(machine(), 4, &barcrest_opto2_interface); |
| 2461 | | stepper_config(machine(), 5, &barcrest_opto2_interface); |
| 2462 | | stepper_config(machine(), 6, &barcrest_opto2_interface); |
| 2463 | | stepper_config(machine(), 7, &barcrest_opto2_interface); |
| 2419 | m_reel0->configure(&barcrest_opto2_interface); |
| 2420 | m_reel1->configure(&barcrest_opto2_interface); |
| 2421 | m_reel2->configure(&barcrest_opto2_interface); |
| 2422 | m_reel3->configure(&barcrest_opto2_interface); |
| 2423 | m_reel4->configure(&barcrest_opto2_interface); |
| 2424 | m_reel5->configure(&barcrest_opto2_interface); |
| 2425 | m_reel6->configure(&barcrest_opto2_interface); |
| 2426 | m_reel7->configure(&barcrest_opto2_interface); |
| 2464 | 2427 | DRIVER_INIT_CALL(m4default_banks); |
| 2465 | 2428 | |
| 2466 | 2429 | m_bwb_bank=0; |