Previous 15994 Revisions Next

r10684 Sunday 6th March, 2011 at 01:58:42 UTC by Barry Rodewald
[FMTOWNS] Made RTC initialise to current time.
[src/mess/drivers]fmtowns.c
[src/mess/includes]fmtowns.h

src/mess/includes/fmtowns.h
r10683r10684
8585        m_nvram(*this, "nvram") { }
8686
8787   UINT8 ftimer;
88   UINT16 freerun_timer;
89   emu_timer* towns_freerun_counter;
8890   UINT8 nmi_mask;
8991   UINT8 compat_mode;
9092   UINT8 towns_system_port;
src/mess/drivers/fmtowns.c
r10683r10684
207207static void towns_init_rtc(running_machine* machine)
208208{
209209   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
211214   // 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;
214217   // 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;
217220   // 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;
220223   // weekday
221   state->towns_rtc_reg[6] = 2;
224   state->towns_rtc_reg[6] = systm.local_time.weekday;
222225   // 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;
225228   // 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;
228231   // 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;
231234}
232235
233236static READ8_HANDLER(towns_system_r)
r10683r10684
305308   }
306309}
307310
311static TIMER_CALLBACK(towns_freerun_inc)
312{
313   towns_state* state = machine->driver_data<towns_state>();
314   state->freerun_timer++;
315}
316
308317static TIMER_CALLBACK(towns_wait_end)
309318{
310319   towns_state* state = machine->driver_data<towns_state>();
r10683r10684
324333   state->ftimer -= 0x54;
325334   // halts the CPU for a period of time (exact length unknown)
326335   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);
328337}
329338
330339static READ8_HANDLER(towns_dma1_r)
r10683r10684
23102319   state->towns_kb_timer = machine->scheduler().timer_alloc(FUNC(poll_keyboard));
23112320   state->towns_mouse_timer = machine->scheduler().timer_alloc(FUNC(towns_mouse_timeout));
23122321   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));
23132323
23142324   // CD-ROM init
23152325   state->towns_cd.read_timer = machine->scheduler().timer_alloc(FUNC(towns_cdrom_read_byte), (void*)machine->device("dma_1"));
r10683r10684
23632373   state->towns_volume_select = 0;
23642374   state->towns_rtc_timer->adjust(attotime::zero,0,attotime::from_hz(1));
23652375   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));
23662378}
23672379
23682380static const struct pit8253_config towns_pit8253_config =
r10683r10684
26192631   ROM_LOAD("fmt_sys_a.rom",  0x200000, 0x040000, CRC(92f3fa67) SHA1(be21404098b23465d24c4201a81c96ac01aff7ab) )
26202632ROM_END
26212633
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 */
26232635ROM_START( fmtownsux )
26242636  ROM_REGION32_LE( 0x480000, "user", 0)
26252637   ROM_LOAD("fmt_dos_a.rom",  0x000000, 0x080000, CRC(22270e9f) SHA1(a7e97b25ff72b14121146137db8b45d6c66af2ae) )
r10683r10684
26312643    ROM_LOAD("mytownsux.rom",  0x00, 0x20, CRC(5cc7e6bc) SHA1(e245f8086df57ce6e48853f0e13525f738e5c4d8) )
26322644ROM_END
26332645
2634/* 20MHz 80486SX, 4MB RAM expandable up to 28MB */
2646/* 20MHz 80486SX, 4MB RAM expandable up to 28MB, dumped from an HR20 */
26352647ROM_START( fmtownshr )
26362648  ROM_REGION32_LE( 0x280000, "user", 0)
26372649   ROM_LOAD("fmt_dos.rom",  0x000000, 0x080000, CRC(112872ee) SHA1(57fd146478226f7f215caf63154c763a6d52165e) )
r10683r10684
26442656   ROM_LOAD("mytownshr.rom",  0x00, 0x20, CRC(c52f0e89) SHA1(634d3965606b18a99507f0a520553005661c41ff) )
26452657ROM_END
26462658
2647/* 66MHz 80486DX2, 8MB RAM expandable up to 72MB */
2659/* 66MHz 80486DX2, 8MB RAM expandable up to 72MB, dumped from an SJ26 */
26482660ROM_START( fmtownssj )
26492661  ROM_REGION32_LE( 0x280000, "user", 0)
26502662  // Assumed for now, only the serial ROM has been dumped successfully so far

Previous 15994 Revisions Next


© 1998-2018 The MESS Team