Previous 199869 Revisions Next

r24042 Tuesday 2nd July, 2013 at 12:18:12 UTC by Barry Rodewald
de_3: improved communications with Type 1 DMD.
[src/mame/drivers]de_3.c
[src/mame/video]decodmd1.c decodmd1.h

trunk/src/mame/video/decodmd1.c
r24041r24042
2828
2929WRITE8_MEMBER( decodmd_type1_device::ctrl_w )
3030{
31   if(!(m_ctrl & 0x01) && (data & 0x01))
31   if((data | m_ctrl) & 0x01)
3232   {
3333      m_command = m_latch;
34      m_busy = 1;
35      m_cpu->set_input_line(INPUT_LINE_IRQ0,ASSERT_LINE);
34      set_busy(B_CLK,data & 0x01);
3635   }
3736   if((m_ctrl & 0x02) && !(data & 0x02))
3837   {
3938      m_rombank1->set_entry(0);
4039      m_bank = 0;
41      m_busy = 0;
40      set_busy(B_SET,0);
4241      m_rowselect = 0;
4342      m_blank = 0;
4443      m_frameswap = false;
44      m_status = 0;
4545      m_cpu->set_input_line(INPUT_LINE_RESET,PULSE_LINE);
4646   }
4747   m_ctrl = data;
r24041r24042
5454
5555READ8_MEMBER( decodmd_type1_device::status_r )
5656{
57   return (m_busy & 0x01) | ((m_ctrl) << 1);
57   return (m_busy & 0x01) | (m_status << 1);
5858}
5959
6060WRITE8_MEMBER( decodmd_type1_device::status_w )
r24041r24042
6969   if((offset & 0x84) == 0x80)
7070   {
7171      // IDAT (read only)
72      m_busy = 0;
73      m_ctrl &= ~0x01;
74      m_cpu->set_input_line(INPUT_LINE_IRQ0,CLEAR_LINE);
75      return m_latch;
72      //m_ctrl &= ~0x01;
73      set_busy(B_CLR,0);
74      set_busy(B_CLR,1);
75      return m_command;
7676   }
7777   return 0xff;
7878}
r24041r24042
129129         m_rowclock = bit;
130130         break;
131131      case 0xdc:  // Test
132         m_busy_set = bit;
133         //check_busy();
132         set_busy(B_SET,bit);
134133         break;
135134      }
136135      break;
r24041r24042
160159   }
161160}
162161
163void decodmd_type1_device::check_busy()
162void decodmd_type1_device::set_busy(UINT8 input, UINT8 val)
164163{
165   if(m_busy_clr)
166   {
164   UINT8 newval = (m_busy_lines & ~input) | (val ? input : 0);
165
166   if(~newval & m_busy_lines & B_CLR)
167167      m_busy = 0;
168      m_cpu->set_input_line(INPUT_LINE_IRQ0,CLEAR_LINE);
169   }
170   else if(!m_busy_set)
171   {
168   else if (~newval & m_busy_lines & B_SET)
172169      m_busy = 1;
173      m_cpu->set_input_line(INPUT_LINE_IRQ0,ASSERT_LINE);
174   }
175   else
170   else if ((newval & (B_CLR|B_SET)) == (B_CLR|B_SET))
176171   {
177      if(!m_busy_clk)
178      {
172      if(newval & ~m_busy_lines & B_CLK)
179173         m_busy = 1;
180         m_cpu->set_input_line(INPUT_LINE_IRQ0,ASSERT_LINE);
181      }
182174   }
183175
176   m_busy_lines = newval;
177
178   m_cpu->set_input_line(INPUT_LINE_IRQ0,m_busy ? ASSERT_LINE : CLEAR_LINE);
184179}
185180
186181TIMER_DEVICE_CALLBACK_MEMBER(decodmd_type1_device::dmd_nmi)
r24041r24042
190185
191186static ADDRESS_MAP_START( decodmd1_map, AS_PROGRAM, 8, decodmd_type1_device )
192187   AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("dmdbank2") // last 16k of ROM
193   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("dmdbank1") //AM_WRITE(status_w)
188   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("dmdbank1")
194189   AM_RANGE(0x8000, 0x9fff) AM_RAMBANK("dmdram")
195190ADDRESS_MAP_END
196191
r24041r24042
201196
202197static MACHINE_CONFIG_FRAGMENT( decodmd1 )
203198   /* basic machine hardware */
204   MCFG_CPU_ADD("dmdcpu", Z80, XTAL_4MHz)
199   MCFG_CPU_ADD("dmdcpu", Z80, XTAL_8MHz / 2)
205200   MCFG_CPU_PROGRAM_MAP(decodmd1_map)
206201   MCFG_CPU_IO_MAP(decodmd1_io_map)
207202
208   MCFG_QUANTUM_TIME(attotime::from_hz(60))
203   MCFG_QUANTUM_TIME(attotime::from_hz(50))
209204
210205   MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer",decodmd_type1_device,dmd_nmi,attotime::from_hz(2000))  // seems a lot
211206
r24041r24042
215210   MCFG_SCREEN_SIZE(128, 16)
216211   MCFG_SCREEN_VISIBLE_AREA(0, 128-1, 0, 16-1)
217212   MCFG_SCREEN_UPDATE_DRIVER(decodmd_type1_device,screen_update)
218   MCFG_SCREEN_REFRESH_RATE(60)
213   MCFG_SCREEN_REFRESH_RATE(50)
219214
220215   MCFG_RAM_ADD(RAM_TAG)
221216   MCFG_RAM_DEFAULT_SIZE("8K")
r24041r24042
247242   m_rom = memregion(m_romregion);
248243
249244   memset(RAM,0,0x2000);
245   memset(m_pixels,0,0x100);
250246
251247   ROM = m_rom->base();
252248   m_rombank1->configure_entries(0, 8, &ROM[0x0000], 0x4000);
253249   m_rombank2->configure_entry(0, &ROM[0x1c000]);
254250   m_rombank1->set_entry(0);
255251   m_rombank2->set_entry(0);
252   m_status = 0;
256253   m_bank = 0;
257254   m_busy = 0;
255   set_busy(B_CLR|B_SET,0);
258256   m_rowselect = 0;
259257   m_blank = 0;
260258   m_frameswap = false;
trunk/src/mame/video/decodmd1.h
r24041r24042
1313   MCFG_DEVICE_ADD(_tag, DECODMD1, 0) \
1414   MCFG_DEVICE_CONFIG(_intrf)
1515
16#define B_CLR 0x01
17#define B_SET 0x02
18#define B_CLK 0x04
19
1620struct decodmd_type1_intf
1721{
1822   const char* m_romregion;  // region containing display ROM
r24041r24042
6670   UINT32 m_pxdata2_latched;
6771   bool m_frameswap;
6872   UINT32 m_pixels[0x100];
69   bool m_busy_clr;
70   bool m_busy_set;
71   bool m_busy_clk;
73   UINT8 m_busy_lines;
7274
7375   void output_data();
74   void check_busy();
76   void set_busy(UINT8 input, UINT8 val);
7577};
7678
7779extern const device_type DECODMD1;
trunk/src/mame/drivers/de_3.c
r24041r24042
403403
404404READ8_MEMBER( de_3_state::pia2c_pb_r )
405405{
406   if(m_dmdtype1)
407      return m_dmdtype1->busy_r(space,offset);
406408   if(m_dmdtype2)
407409      return m_dmdtype2->busy_r(space,offset);
408410   return 0;
r24041r24042
491493
492494READ8_MEMBER( de_3_state::dmd_status_r )
493495{
494   if(m_dmdtype2)
496   if(m_dmdtype1)
495497   {
496      return m_dmdtype2->status_r(space,offset);
498      return m_dmdtype1->status_r(space,offset);
497499   }
498   else if(m_dmdtype1)
500   else if(m_dmdtype2)
499501   {
500      return m_dmdtype1->status_r(space,offset);
502      return m_dmdtype2->status_r(space,offset);
501503   }
502504   return 0;
503505}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team