src/mess/drivers/fmtowns.c
| r10683 | r10684 | |
| 207 | 207 | static void towns_init_rtc(running_machine* machine) |
| 208 | 208 | { |
| 209 | 209 | towns_state* state = machine->driver_data<towns_state>(); |
| 210 | | // for now, we'll just keep a static time stored here |
| 210 | system_time systm; |
| 211 | |
| 212 | machine->base_datetime(systm); |
| 213 | |
| 211 | 214 | // seconds |
| 212 | | state->towns_rtc_reg[0] = 0; |
| 213 | | state->towns_rtc_reg[1] = 3; |
| 215 | state->towns_rtc_reg[0] = systm.local_time.second % 10; |
| 216 | state->towns_rtc_reg[1] = systm.local_time.second / 10; |
| 214 | 217 | // minutes |
| 215 | | state->towns_rtc_reg[2] = 2; |
| 216 | | state->towns_rtc_reg[3] = 1; |
| 218 | state->towns_rtc_reg[2] = systm.local_time.minute % 10; |
| 219 | state->towns_rtc_reg[3] = systm.local_time.minute / 10; |
| 217 | 220 | // hours |
| 218 | | state->towns_rtc_reg[4] = 8; |
| 219 | | state->towns_rtc_reg[5] = 0; |
| 221 | state->towns_rtc_reg[4] = systm.local_time.hour % 10; |
| 222 | state->towns_rtc_reg[5] = systm.local_time.hour / 10; |
| 220 | 223 | // weekday |
| 221 | | state->towns_rtc_reg[6] = 2; |
| 224 | state->towns_rtc_reg[6] = systm.local_time.weekday; |
| 222 | 225 | // day |
| 223 | | state->towns_rtc_reg[7] = 1; |
| 224 | | state->towns_rtc_reg[8] = 1; |
| 226 | state->towns_rtc_reg[7] = systm.local_time.mday % 10; |
| 227 | state->towns_rtc_reg[8] = systm.local_time.mday / 10; |
| 225 | 228 | // month |
| 226 | | state->towns_rtc_reg[9] = 6; |
| 227 | | state->towns_rtc_reg[10] = 0; |
| 229 | state->towns_rtc_reg[9] = systm.local_time.month % 10; |
| 230 | state->towns_rtc_reg[10] = systm.local_time.month / 10; |
| 228 | 231 | // year |
| 229 | | state->towns_rtc_reg[11] = 9; |
| 230 | | state->towns_rtc_reg[12] = 0; |
| 232 | state->towns_rtc_reg[11] = (systm.local_time.year - 2000) % 10; |
| 233 | state->towns_rtc_reg[12] = (systm.local_time.year - 2000) / 10; |
| 231 | 234 | } |
| 232 | 235 | |
| 233 | 236 | static READ8_HANDLER(towns_system_r) |
| r10683 | r10684 | |
| 305 | 308 | } |
| 306 | 309 | } |
| 307 | 310 | |
| 311 | static TIMER_CALLBACK(towns_freerun_inc) |
| 312 | { |
| 313 | towns_state* state = machine->driver_data<towns_state>(); |
| 314 | state->freerun_timer++; |
| 315 | } |
| 316 | |
| 308 | 317 | static TIMER_CALLBACK(towns_wait_end) |
| 309 | 318 | { |
| 310 | 319 | towns_state* state = machine->driver_data<towns_state>(); |
| r10683 | r10684 | |
| 324 | 333 | state->ftimer -= 0x54; |
| 325 | 334 | // halts the CPU for a period of time (exact length unknown) |
| 326 | 335 | cpu_set_input_line(state->maincpu,INPUT_LINE_HALT,ASSERT_LINE); |
| 327 | | state->towns_wait_timer->adjust(attotime::from_usec(1),0,attotime::zero); |
| 336 | state->towns_wait_timer->adjust(attotime::from_usec(1),0,attotime::never); |
| 328 | 337 | } |
| 329 | 338 | |
| 330 | 339 | static READ8_HANDLER(towns_dma1_r) |
| r10683 | r10684 | |
| 2310 | 2319 | state->towns_kb_timer = machine->scheduler().timer_alloc(FUNC(poll_keyboard)); |
| 2311 | 2320 | state->towns_mouse_timer = machine->scheduler().timer_alloc(FUNC(towns_mouse_timeout)); |
| 2312 | 2321 | state->towns_wait_timer = machine->scheduler().timer_alloc(FUNC(towns_wait_end)); |
| 2322 | state->towns_freerun_counter = machine->scheduler().timer_alloc(FUNC(towns_freerun_inc)); |
| 2313 | 2323 | |
| 2314 | 2324 | // CD-ROM init |
| 2315 | 2325 | state->towns_cd.read_timer = machine->scheduler().timer_alloc(FUNC(towns_cdrom_read_byte), (void*)machine->device("dma_1")); |
| r10683 | r10684 | |
| 2363 | 2373 | state->towns_volume_select = 0; |
| 2364 | 2374 | state->towns_rtc_timer->adjust(attotime::zero,0,attotime::from_hz(1)); |
| 2365 | 2375 | state->towns_kb_timer->adjust(attotime::zero,0,attotime::from_msec(10)); |
| 2376 | /* Why does enabling this timer break the driver? */ |
| 2377 | // state->towns_freerun_counter->adjust(attotime::zero,0,attotime::from_usec(1)); |
| 2366 | 2378 | } |
| 2367 | 2379 | |
| 2368 | 2380 | static const struct pit8253_config towns_pit8253_config = |
| r10683 | r10684 | |
| 2619 | 2631 | ROM_LOAD("fmt_sys_a.rom", 0x200000, 0x040000, CRC(92f3fa67) SHA1(be21404098b23465d24c4201a81c96ac01aff7ab) ) |
| 2620 | 2632 | ROM_END |
| 2621 | 2633 | |
| 2622 | | /* 16MHz 80386SX, 2MB RAM expandable up to 10MB (due to the limited 24-bit address space of the CPU) */ |
| 2634 | /* 16MHz 80386SX, 2MB RAM expandable up to 10MB (due to the limited 24-bit address space of the CPU), dumped from a UX10 */ |
| 2623 | 2635 | ROM_START( fmtownsux ) |
| 2624 | 2636 | ROM_REGION32_LE( 0x480000, "user", 0) |
| 2625 | 2637 | ROM_LOAD("fmt_dos_a.rom", 0x000000, 0x080000, CRC(22270e9f) SHA1(a7e97b25ff72b14121146137db8b45d6c66af2ae) ) |
| r10683 | r10684 | |
| 2631 | 2643 | ROM_LOAD("mytownsux.rom", 0x00, 0x20, CRC(5cc7e6bc) SHA1(e245f8086df57ce6e48853f0e13525f738e5c4d8) ) |
| 2632 | 2644 | ROM_END |
| 2633 | 2645 | |
| 2634 | | /* 20MHz 80486SX, 4MB RAM expandable up to 28MB */ |
| 2646 | /* 20MHz 80486SX, 4MB RAM expandable up to 28MB, dumped from an HR20 */ |
| 2635 | 2647 | ROM_START( fmtownshr ) |
| 2636 | 2648 | ROM_REGION32_LE( 0x280000, "user", 0) |
| 2637 | 2649 | ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(112872ee) SHA1(57fd146478226f7f215caf63154c763a6d52165e) ) |
| r10683 | r10684 | |
| 2644 | 2656 | ROM_LOAD("mytownshr.rom", 0x00, 0x20, CRC(c52f0e89) SHA1(634d3965606b18a99507f0a520553005661c41ff) ) |
| 2645 | 2657 | ROM_END |
| 2646 | 2658 | |
| 2647 | | /* 66MHz 80486DX2, 8MB RAM expandable up to 72MB */ |
| 2659 | /* 66MHz 80486DX2, 8MB RAM expandable up to 72MB, dumped from an SJ26 */ |
| 2648 | 2660 | ROM_START( fmtownssj ) |
| 2649 | 2661 | ROM_REGION32_LE( 0x280000, "user", 0) |
| 2650 | 2662 | // Assumed for now, only the serial ROM has been dumped successfully so far |