Previous 15994 Revisions Next

r4876 Friday 29th May, 2009 at 00:18:44 UTC by Barry Rodewald
[FM7] Basic implementation of VRAM access and CRT enable ports.
[src/mess/drivers]fm7.c

src/mess/drivers/fm7.c
r4875r4876
4949emu_timer* fm7_timer;  // main timer, triggered every 2.0345ms?
5050static UINT8 sub_busy;
5151static UINT8 basic_rom_en;
52static UINT8 fm7_attn_irq;
52static UINT8 attn_irq;
53static UINT8 vram_access;  // VRAM access flag
54static UINT8 crt_enable;
5355
5456/*
5557 * I/O port 0xfd02
r4875r4876
136138{
137139   UINT8 ret = 0xff;
138140   
139   if(fm7_attn_irq != 0)
141   if(attn_irq != 0)
140142   {
141143      ret &= ~0x01;
142      fm7_attn_irq = 0;
144      attn_irq = 0;
143145   }
144146   return ret;
145147}
r4875r4876
211213 */
212214READ8_HANDLER( fm7_attn_irq_r )
213215{
214   fm7_attn_irq = 1;
216   attn_irq = 1;
215217   cputag_set_input_line(space->machine,"maincpu",M6809_FIRQ_LINE,ASSERT_LINE);
216218   return 0xff;
217219}
218220
221READ8_HANDLER( fm7_vram_access_r )
222{
223   vram_access = 1;
224   return 0xff;
225}
226
227WRITE8_HANDLER( fm7_vram_access_w )
228{
229   vram_access = 0;
230}
231
232READ8_HANDLER( fm7_vram_r )
233{
234   return fm7_video_ram[offset];
235}
236
237WRITE8_HANDLER( fm7_vram_w )
238{
239   if(vram_access != 0)
240      fm7_video_ram[offset] = data;
241}
242
243READ8_HANDLER( fm7_crt_r )
244{
245   crt_enable = 1;
246   return 0xff;
247}
248
249WRITE8_HANDLER( fm7_crt_w )
250{
251   crt_enable = 0;
252}
253
219254static TIMER_CALLBACK( fm7_timer_irq )
220255{
221256   if(~irq_mask & IRQ_FLAG_TIMER)
r4875r4876
275310*/
276311
277312static ADDRESS_MAP_START( fm7_sub_mem, ADDRESS_SPACE_PROGRAM, 8 )
278   AM_RANGE(0x0000,0xbfff) AM_RAM AM_BASE(&fm7_video_ram) // VRAM
313   AM_RANGE(0x0000,0xbfff) AM_READWRITE(fm7_vram_r,fm7_vram_w) // VRAM
279314   AM_RANGE(0xc000,0xcfff) AM_RAM // Console RAM
280315   AM_RANGE(0xd000,0xd37f) AM_RAM // Work RAM
281316   AM_RANGE(0xd380,0xd3ff) AM_READWRITE(shared_r,shared_w) // shared RAM
282317   // I/O space (D400-D7FF)
283318   AM_RANGE(0xd402,0xd402) AM_READ(fm7_cancel_ack)
284319   AM_RANGE(0xd404,0xd404) AM_READ(fm7_attn_irq_r)
320   AM_RANGE(0xd408,0xd408) AM_READWRITE(fm7_crt_r,fm7_crt_w)
321   AM_RANGE(0xd409,0xd409) AM_READWRITE(fm7_vram_access_r,fm7_vram_access_w)
285322   AM_RANGE(0xd40a,0xd40a) AM_READWRITE(fm7_sub_busyflag_r,fm7_sub_busyflag_w)
286323   AM_RANGE(0xd800,0xffff) AM_ROM
287324ADDRESS_MAP_END
r4875r4876
302339static DRIVER_INIT(fm7)
303340{
304341   shared_ram = auto_alloc_array(machine,UINT8,0x80);
342   fm7_video_ram = auto_alloc_array(machine,UINT8,0xc000);
305343   fm7_timer = timer_alloc(machine,fm7_timer_irq,NULL);
306344   cpu_set_irq_callback(cputag_get_cpu(machine,"maincpu"),fm7_irq_ack);
307345   cpu_set_irq_callback(cputag_get_cpu(machine,"sub"),fm7_sub_irq_ack);
r4875r4876
326364   timer_adjust_periodic(fm7_timer,attotime_zero,0,ATTOTIME_IN_USEC(2034));
327365   irq_mask = 0xff;
328366   irq_flags = 0x00;
329   fm7_attn_irq = 0;
367   attn_irq = 0;
330368   sub_busy = 0x80;  // busy at reset
331369   basic_rom_en = 1;  // enabled at reset
370   vram_access = 0;
371   crt_enable = 0;
332372   memory_set_bankptr(machine,1,RAM+0x38000);
333373}
334374
r4875r4876
342382    UINT8 col;
343383    int y, x, b;
344384
385   if(crt_enable == 0)
386      return 0;
387
345388    for (y = 0; y < 200; y++)
346389    {
347390       for (x = 0; x < 80; x++)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team