Previous 15994 Revisions Next

r3033 Saturday 9th August, 2008 at 09:00:12 UTC by Curt Coder
[NEWBRAIN] Fixed newbraia to start.
[src/mess/drivers]newbrain.c
[src/mess/includes]newbrain.h

src/mess/includes/newbrain.h
r3032r3033
1515   /* processor state */
1616   int pwrup;            /* power up */
1717   int userint;         /* user interrupt */
18   int userint0;         /* parallel port interrupt */
1819   int clkint;            /* clock interrupt */
1920   int aciaint;         /* ACIA interrupt */
2021   int copint;            /* COP interrupt */
src/mess/drivers/newbrain.c
r3032r3033
5757
5858*/
5959
60static int acia_irq;
6160static UINT8 acia_rxd = 1, acia_txd = 1;
6261
6362static const device_config *cassette_device_image(int index)
r3032r3033
7271#define NEWBRAIN_ENRG1_CTS   0x10
7372#define NEWBRAIN_ENRG1_DO   0x20
7473#define NEWBRAIN_ENRG1_PO   0x80
74#define NEWBRAIN_ENRG1_UST_BIT_1_MASK   0x30
75#define NEWBRAIN_ENRG1_UST_BIT_0_MASK   0xc0
7576
7677static WRITE8_HANDLER( enrg1_w )
7778{
r3032r3033
9293
9394   newbrain_state *state = machine->driver_data;
9495
96   //logerror("ENRG1: %02x\n", data);
97
9598   state->enrg1 = data;
9699}
97100
r3032r3033
123126
124127      bit      signal      description
125128
126      0     
127      1     
128      2               mains present
129      3               user status
130      4               user interrupt
131      5               clock interrupt
132      6               ACIA interrupt
129      0      variable
130      1      variable
131      2      MNS         mains present
132      3      _USRINT0   user status
133      4      _USRINT      user interrupt
134      5      _CLKINT      clock interrupt
135      6      _ACINT      ACIA interrupt
133136      7      _COPINT      COP interrupt
134137
135138   */
136139
137140   newbrain_state *state = machine->driver_data;
138141
139   UINT8 data = (state->copint << 7) | (state->aciaint << 6) | (state->clkint << 5) | (state->userint << 4) | 0x04;
142   UINT8 data = (state->copint << 7) | (state->aciaint << 6) | (state->clkint << 5) | (state->userint << 4);
140143
141   switch (state->enrg1 >> 6)
144   switch ((state->enrg1 & NEWBRAIN_ENRG1_UST_BIT_0_MASK) >> 6)
142145   {
143146   case 0:
144147      // excess, 1=24, 0=4
r3032r3033
165168      break;
166169   }
167170
168   switch (state->enrg1 >> 4)
171   switch ((state->enrg1 & NEWBRAIN_ENRG1_UST_BIT_1_MASK) >> 4)
169172   {
170173   case 0:
171174      // PWRUP, if set indicates that power is supplied to Z80 and memory
r3032r3033
320323
321324   */
322325
323   // _Z80INT = ((_CLK | _CLKINT) & _COPINT)
324   //cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, BIT(data, 0) ? HOLD_LINE : CLEAR_LINE);
325
326326   newbrain_state *state = machine->driver_data;
327327
328   cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, BIT(data, 0) ? HOLD_LINE : CLEAR_LINE);
329
328330   state->copint = BIT(data, 0);
329331
330332   /* tape motor enable */
r3032r3033
721723
722724   */
723725
724   return acia_irq << 6;
726   newbrain_state *state = machine->driver_data;
727
728   return (state->copint << 7) | (state->aciaint << 6) | (state->clkint << 5) | (state->userint << 4) | (state->userint0 << 3) | (state->pwrup) << 1;
725729}
726730
727731static READ8_HANDLER( ei_st1_r )
r3032r3033
743747
744748   newbrain_state *state = machine->driver_data;
745749
746   return (state->tvcnsl << 6);
750   return (state->tvcnsl << 6) | 0x10 | 0x08 | 0x04;
747751}
748752
749753static READ8_HANDLER( ei_st2_r )
r3032r3033
873877   AM_RANGE(0x03, 0x03) AM_MIRROR(0xffc0) AM_WRITE(user_w)
874878   AM_RANGE(0x04, 0x04) AM_MIRROR(0xffc0) AM_READWRITE(clclk_r, clclk_w)
875879   AM_RANGE(0x06, 0x06) AM_MIRROR(0xffc0) AM_READWRITE(cop_r, cop_w)
876   AM_RANGE(0x07, 0x07) AM_MIRROR(0xffc0) AM_WRITE(a_enrg1_w)
880   AM_RANGE(0x07, 0x07) AM_MIRROR(0xffc0) AM_WRITE(enrg1_w)
877881   AM_RANGE(0x08, 0x09) AM_MIRROR(0xffc2) AM_READWRITE(tvl_r, tvl_w)
878882   AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xffc3) AM_WRITE(tvctl_w)
879883   AM_RANGE(0x14, 0x14) AM_MIRROR(0xffc0) AM_READ(ust_r)
r3032r3033
10451049
10461050static void acia_interrupt(int state)
10471051{
1048   acia_irq = state;
1052   newbrain_state *driver_state = Machine->driver_data;
1053
1054   driver_state->aciaint = state;
10491055}
10501056
10511057static const struct acia6850_interface newbrain_acia_intf =
r3032r3033
10831089   NULL               /* ZC/TO2 callback */
10841090};
10851091
1092INLINE int get_reset_t(void)
1093{
1094   return RES_K(220) * CAP_U(10) * 1000; // t = R128 * C125 = 2.2s
1095}
1096
10861097static TIMER_CALLBACK( reset_tick )
10871098{
10881099   cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, CLEAR_LINE);
10891100   cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, CLEAR_LINE);
10901101}
10911102
1103INLINE int get_pwrup_t(void)
1104{
1105   return RES_K(560) * CAP_U(10) * 1000; // t = R129 * C127 = 5.6s
1106}
1107
10921108static TIMER_CALLBACK( pwrup_tick )
10931109{
10941110   newbrain_state *state = machine->driver_data;
10951111   int bank;
10961112
1097   state->pwrup = 0;
1113   state->pwrup = 1;
10981114
10991115   for (bank = 1; bank < 9; bank++)
11001116   {
r3032r3033
11031119   }
11041120}
11051121
1106INLINE int get_reset_t(void)
1107{
1108   return RES_K(220) * CAP_U(10) * 1000; // t = R128 * C125
1109}
1110
1111INLINE int get_pwrup_t(void)
1112{
1113   return RES_K(560) * CAP_U(10) * 1000; // t = R129 * C127
1114}
1115
11161122static MACHINE_START( newbrain )
11171123{
11181124   newbrain_state *state = machine->driver_data;
r3032r3033
11351141   /* allocate reset timer */
11361142   
11371143   state->reset_timer = timer_alloc(reset_tick, NULL);
1144   timer_adjust_oneshot(state->reset_timer, ATTOTIME_IN_USEC(get_reset_t()), 0);
11381145
11391146   /* allocate power up timer */
1140   
1147
11411148   state->pwrup_timer = timer_alloc(pwrup_tick, NULL);
1142   timer_adjust_oneshot(state->reset_timer, ATTOTIME_IN_MSEC(get_pwrup_t()), 0);
1143   state->pwrup = 1;
1149   timer_adjust_oneshot(state->pwrup_timer, ATTOTIME_IN_USEC(get_pwrup_t()), 0);
1150   state->pwrup = 0;
11441151
11451152   /* initialize variables */
11461153
r3032r3033
11651172   timer_adjust_oneshot(state->reset_timer, ATTOTIME_IN_MSEC(get_reset_t()), 0);
11661173}
11671174
1168static const struct z80_irq_daisy_chain newbrain_daisy_chain[] =
1169{
1170   { z80ctc_reset, z80ctc_irq_state, z80ctc_irq_ack, z80ctc_irq_reti, 0 },
1171   { 0, 0, 0, 0, -1 }
1172};
1173
11741175static INTERRUPT_GEN( newbrain_interrupt )
11751176{
11761177   newbrain_state *state = machine->driver_data;
11771178   
1178   if (state->enrg1 & NEWBRAIN_ENRG1_CLK)
1179   if (!(state->enrg1 & NEWBRAIN_ENRG1_CLK))
11791180   {
11801181      cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, HOLD_LINE);
11811182
r3032r3033
13261327ROM_END
13271328
13281329ROM_START( newbraia )
1330   ROM_REGION( 0x10000, "main", 0 )
13291331   ROM_SYSTEM_BIOS( 0, "rom20", "ROM 2.0" )
13301332   ROMX_LOAD( "aben20.rom", 0xa000, 0x2000, CRC(3d76d0c8) SHA1(753b4530a518ad832e4b81c4e5430355ba3f62e0), ROM_BIOS(1) )
13311333   ROMX_LOAD( "cd20tci.rom", 0xc000, 0x4000, CRC(f65b2350) SHA1(1ada7fbf207809537ec1ffb69808524300622ada), ROM_BIOS(1) )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team