src/mess/includes/prof80.h
| r14842 | r14843 | |
| 51 | 51 | required_device<device_t> m_floppy1; |
| 52 | 52 | required_device<ecbbus_device> m_ecb; |
| 53 | 53 | |
| 54 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 54 | 55 | virtual void machine_start(); |
| 55 | 56 | virtual void machine_reset(); |
| 56 | 57 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 57 | 58 | |
| 59 | enum |
| 60 | { |
| 61 | TIMER_ID_MOTOR |
| 62 | }; |
| 63 | |
| 58 | 64 | DECLARE_WRITE8_MEMBER( flr_w ); |
| 59 | 65 | DECLARE_READ8_MEMBER( status_r ); |
| 60 | 66 | DECLARE_READ8_MEMBER( status2_r ); |
src/mess/includes/newbrain.h
| r14842 | r14843 | |
| 70 | 70 | required_device<cassette_image_device> m_cassette1; |
| 71 | 71 | required_device<cassette_image_device> m_cassette2; |
| 72 | 72 | |
| 73 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 73 | 74 | virtual void machine_start(); |
| 74 | 75 | virtual void machine_reset(); |
| 75 | 76 | |
| 76 | 77 | virtual void video_start(); |
| 77 | 78 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 78 | 79 | |
| 80 | enum |
| 81 | { |
| 82 | TIMER_ID_RESET, |
| 83 | TIMER_ID_PWRUP |
| 84 | }; |
| 85 | |
| 79 | 86 | DECLARE_WRITE8_MEMBER( enrg1_w ); |
| 80 | 87 | DECLARE_WRITE8_MEMBER( a_enrg1_w ); |
| 81 | 88 | DECLARE_READ8_MEMBER( ust_r ); |
| r14842 | r14843 | |
| 145 | 152 | // user bus state |
| 146 | 153 | UINT8 m_user; |
| 147 | 154 | |
| 148 | | // timers |
| 149 | | emu_timer *m_reset_timer; // power on reset timer |
| 150 | | emu_timer *m_pwrup_timer; // power up timer |
| 151 | | |
| 152 | 155 | // devices |
| 153 | 156 | UINT8 m_copdata; |
| 154 | 157 | int m_copstate; |
src/mess/includes/comx35.h
| r14842 | r14843 | |
| 58 | 58 | required_device<ram_device> m_ram; |
| 59 | 59 | required_device<comx_expansion_slot_device> m_expansion; |
| 60 | 60 | |
| 61 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 61 | 62 | virtual void machine_start(); |
| 62 | 63 | virtual void machine_reset(); |
| 63 | 64 | |
| 64 | 65 | virtual void video_start(); |
| 65 | 66 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 66 | 67 | |
| 68 | enum |
| 69 | { |
| 70 | TIMER_ID_RESET |
| 71 | }; |
| 72 | |
| 67 | 73 | void check_interrupt(); |
| 68 | 74 | |
| 69 | 75 | DECLARE_READ8_MEMBER( mem_r ); |
| r14842 | r14843 | |
| 94 | 100 | |
| 95 | 101 | // video state |
| 96 | 102 | UINT8 *m_charram; // character memory |
| 97 | | |
| 98 | | // timers |
| 99 | | emu_timer *m_reset_timer; // power on reset timer |
| 100 | 103 | }; |
| 101 | 104 | |
| 102 | 105 | // ---------- defined in video/comx35.c ---------- |
src/mess/drivers/newbrain.c
| r14842 | r14843 | |
| 1240 | 1240 | return RES_K(220) * CAP_U(10) * 1000; // t = R128 * C125 = 2.2s |
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | | static TIMER_CALLBACK( reset_tick ) |
| 1244 | | { |
| 1245 | | newbrain_state *state = machine.driver_data<newbrain_state>(); |
| 1246 | | |
| 1247 | | state->m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 1248 | | state->m_copcpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 1249 | | } |
| 1250 | | |
| 1251 | 1243 | inline int newbrain_state::get_pwrup_t() |
| 1252 | 1244 | { |
| 1253 | 1245 | return RES_K(560) * CAP_U(10) * 1000; // t = R129 * C127 = 5.6s |
| 1254 | 1246 | } |
| 1255 | 1247 | |
| 1256 | | static TIMER_CALLBACK( pwrup_tick ) |
| 1248 | //------------------------------------------------- |
| 1249 | // device_timer - handler timer events |
| 1250 | //------------------------------------------------- |
| 1251 | |
| 1252 | void newbrain_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 1257 | 1253 | { |
| 1258 | | newbrain_state *state = machine.driver_data<newbrain_state>(); |
| 1254 | switch (id) |
| 1255 | { |
| 1256 | case TIMER_ID_RESET: |
| 1257 | m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 1258 | m_copcpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 1259 | break; |
| 1259 | 1260 | |
| 1260 | | state->m_pwrup = 0; |
| 1261 | | state->bankswitch(); |
| 1261 | case TIMER_ID_PWRUP: |
| 1262 | m_pwrup = 0; |
| 1263 | bankswitch(); |
| 1264 | break; |
| 1265 | } |
| 1262 | 1266 | } |
| 1263 | 1267 | |
| 1264 | 1268 | void newbrain_state::machine_start() |
| 1265 | 1269 | { |
| 1266 | 1270 | m_copregint = 1; |
| 1267 | 1271 | |
| 1268 | | /* allocate reset timer */ |
| 1269 | | m_reset_timer = machine().scheduler().timer_alloc(FUNC(reset_tick)); |
| 1270 | | m_reset_timer->adjust(attotime::from_usec(get_reset_t())); |
| 1272 | /* set power up timer */ |
| 1273 | timer_set(attotime::from_usec(get_pwrup_t()), TIMER_ID_PWRUP); |
| 1271 | 1274 | |
| 1272 | | /* allocate power up timer */ |
| 1273 | | m_pwrup_timer = machine().scheduler().timer_alloc(FUNC(pwrup_tick)); |
| 1274 | | m_pwrup_timer->adjust(attotime::from_usec(get_pwrup_t())); |
| 1275 | | |
| 1276 | 1275 | /* initialize variables */ |
| 1277 | 1276 | m_pwrup = 1; |
| 1278 | 1277 | m_userint = 1; |
| r14842 | r14843 | |
| 1328 | 1327 | |
| 1329 | 1328 | void newbrain_state::machine_reset() |
| 1330 | 1329 | { |
| 1331 | | m_reset_timer->adjust(attotime::from_msec(get_reset_t())); |
| 1330 | timer_set(attotime::from_usec(get_reset_t()), TIMER_ID_RESET); |
| 1332 | 1331 | } |
| 1333 | 1332 | |
| 1334 | 1333 | static INTERRUPT_GEN( newbrain_interrupt ) |
src/mess/drivers/comx35.c
| r14842 | r14843 | |
| 445 | 445 | //************************************************************************** |
| 446 | 446 | |
| 447 | 447 | //------------------------------------------------- |
| 448 | | // MACHINE_START( comx35 ) |
| 448 | // device_timer - handler timer events |
| 449 | 449 | //------------------------------------------------- |
| 450 | 450 | |
| 451 | | static TIMER_CALLBACK( reset_tick ) |
| 451 | void comx35_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 452 | 452 | { |
| 453 | | comx35_state *state = machine.driver_data<comx35_state>(); |
| 454 | | |
| 455 | | state->m_clear = 1; |
| 453 | switch (id) |
| 454 | { |
| 455 | case TIMER_ID_RESET: |
| 456 | m_clear = 1; |
| 457 | break; |
| 458 | } |
| 456 | 459 | } |
| 457 | 460 | |
| 461 | |
| 462 | //------------------------------------------------- |
| 463 | // MACHINE_START( comx35 ) |
| 464 | //------------------------------------------------- |
| 465 | |
| 458 | 466 | void comx35_state::machine_start() |
| 459 | 467 | { |
| 460 | | // allocate reset timer |
| 461 | | m_reset_timer = machine().scheduler().timer_alloc(FUNC(reset_tick)); |
| 462 | | |
| 463 | 468 | // clear the RAM since DOS card will go crazy if RAM is not all zeroes |
| 464 | 469 | UINT8 *ram = m_ram->pointer(); |
| 465 | 470 | memset(ram, 0, 0x8000); |
| r14842 | r14843 | |
| 491 | 496 | m_int = CLEAR_LINE; |
| 492 | 497 | m_prd = CLEAR_LINE; |
| 493 | 498 | |
| 494 | | m_reset_timer->adjust(attotime::from_msec(t)); |
| 499 | timer_set(attotime::from_msec(t), TIMER_ID_RESET); |
| 495 | 500 | } |
| 496 | 501 | |
| 497 | 502 | |
src/mess/drivers/prof80.c
| r14842 | r14843 | |
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | //------------------------------------------------- |
| 114 | | // TIMER_CALLBACK( floppy_motor_off_tick ) |
| 115 | | //------------------------------------------------- |
| 116 | | |
| 117 | | static TIMER_CALLBACK( floppy_motor_off_tick ) |
| 118 | | { |
| 119 | | prof80_state *state = machine.driver_data<prof80_state>(); |
| 120 | | |
| 121 | | state->floppy_motor_off(); |
| 122 | | } |
| 123 | | |
| 124 | | |
| 125 | | //------------------------------------------------- |
| 126 | 114 | // ls259_w - |
| 127 | 115 | //------------------------------------------------- |
| 128 | 116 | |
| r14842 | r14843 | |
| 164 | 152 | // trigger floppy motor off NE555 timer |
| 165 | 153 | int t = 110 * RES_M(10) * CAP_U(6.8); // t = 1.1 * R8 * C6 |
| 166 | 154 | |
| 167 | | m_floppy_motor_off_timer->adjust(attotime::from_msec(t)); |
| 155 | timer_set(attotime::from_msec(t), TIMER_ID_MOTOR); |
| 168 | 156 | } |
| 169 | 157 | else |
| 170 | 158 | { |
| r14842 | r14843 | |
| 177 | 165 | m_motor = 1; |
| 178 | 166 | |
| 179 | 167 | // reset floppy motor off NE555 timer |
| 180 | | m_floppy_motor_off_timer->enable(0); |
| 168 | timer_set(attotime::never, TIMER_ID_MOTOR); |
| 181 | 169 | } |
| 182 | 170 | break; |
| 183 | 171 | |
| r14842 | r14843 | |
| 204 | 192 | if (!fb) |
| 205 | 193 | { |
| 206 | 194 | // immediately turn off floppy motor |
| 207 | | m_floppy_motor_off_timer->adjust(attotime::zero); |
| 195 | synchronize(TIMER_ID_MOTOR); |
| 208 | 196 | } |
| 209 | 197 | break; |
| 210 | 198 | |
| r14842 | r14843 | |
| 570 | 558 | //************************************************************************** |
| 571 | 559 | |
| 572 | 560 | //------------------------------------------------- |
| 561 | // device_timer - handler timer events |
| 562 | //------------------------------------------------- |
| 563 | |
| 564 | void prof80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 565 | { |
| 566 | switch (id) |
| 567 | { |
| 568 | case TIMER_ID_MOTOR: |
| 569 | floppy_motor_off(); |
| 570 | break; |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | |
| 575 | //------------------------------------------------- |
| 573 | 576 | // MACHINE_START( prof80 ) |
| 574 | 577 | //------------------------------------------------- |
| 575 | 578 | |
| r14842 | r14843 | |
| 579 | 582 | m_rtc->cs_w(1); |
| 580 | 583 | m_rtc->oe_w(1); |
| 581 | 584 | |
| 582 | | // allocate floppy motor off timer |
| 583 | | m_floppy_motor_off_timer = machine().scheduler().timer_alloc(FUNC(floppy_motor_off_tick)); |
| 584 | | |
| 585 | 585 | // bank switch |
| 586 | 586 | bankswitch(); |
| 587 | 587 | |