Previous 15994 Revisions Next

r5913 Tuesday 29th September, 2009 at 13:29:32 UTC by Barry Rodewald
[FMTOWNS] Added CMOS I/O ports, updated memory map to pass some early RAM tests.
[src/mess/drivers]fmtowns.c

src/mess/drivers/fmtowns.c
r5912r5913
8282static UINT8 ftimer;
8383static UINT8 nmi_mask;
8484static UINT8 compat_mode;
85static UINT8 towns_system_port;
86static UINT32* towns_vram;
87static UINT32* towns_cmos;
88static UINT32* towns_gfxvram;
89static UINT32* towns_txtvram;
8590
8691static READ8_HANDLER(towns_system_r)
8792{
r5912r5913
297302   }
298303}
299304
305static READ32_HANDLER(towns_padport_r)
306{
307   if(ACCESSING_BITS_0_7)
308      return 0x7f;
309
310   return 0x00;
311}
312
313static READ8_HANDLER( towns_cmos8_r )
314{
315   UINT8* cmos = (UINT8*)towns_cmos;
316
317   return cmos[offset];
318}
319
320static WRITE8_HANDLER( towns_cmos8_w )
321{
322   UINT8* cmos = (UINT8*)towns_cmos;
323   
324   cmos[offset] = data;
325}
326
327static READ32_HANDLER( towns_cmos_r )
328{
329   return towns_cmos[offset];
330}
331
332static WRITE32_HANDLER( towns_cmos_w )
333{
334   COMBINE_DATA(towns_cmos+offset);
335}
336
337static READ8_HANDLER( towns_sys480_r )
338{
339   if(towns_system_port & 0x02)
340      return 0x02;
341   else
342      return 0x00;
343}
344
345static WRITE8_HANDLER( towns_sys480_w )
346{
347   towns_system_port = data;
348}
349
300350static ADDRESS_MAP_START(towns_mem, ADDRESS_SPACE_PROGRAM, 32)
301351  // memory map based on FM-Towns/Bochs (Bochs modified to emulate the FM-Towns)
302352  // may not be (and probably is not) correct
303353  AM_RANGE(0x00000000, 0x000bffff) AM_RAM
304  AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM  // GVRAM
305  AM_RANGE(0x000c8000, 0x000cffff) AM_RAM  // TVRAM
306  AM_RANGE(0x000d0000, 0x000d7fff) AM_ROM AM_REGION("user",0x100000)  // DIC ROM
307  AM_RANGE(0x000d8000, 0x000d9fff) AM_RAM  // CMOS? RAM
354  AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_BASE(&towns_gfxvram)  // GVRAM
355  AM_RANGE(0x000c8000, 0x000cffff) AM_RAM AM_BASE(&towns_txtvram) // TVRAM
356//  AM_RANGE(0x000ca000, 0x000cafff) AM_RAM AM_BASE(&towns_txtvram) // TVRAM
357  AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM
358  AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE(towns_cmos_r,towns_cmos_w) // CMOS? RAM
308359  AM_RANGE(0x000da000, 0x000effff) AM_RAM
309360  AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM
310  AM_RANGE(0x000f8000, 0x000fffff) AM_ROM AM_REGION("user",0x238000)  // BOOT (SYSTEM) ROM
361  AM_RANGE(0x000f8000, 0x000fffff) AM_RAM AM_REGION("user",0x238000)  // BOOT (SYSTEM) ROM
311362  AM_RANGE(0x00100000, 0x005fffff) AM_RAM  // some extra RAM - seems to be needed to boot
312  AM_RANGE(0x80000000, 0x8007ffff) AM_RAM  // VRAM
313  AM_RANGE(0x80100000, 0x8017ffff) AM_RAM  // VRAM (mirror? second page?)
363  AM_RANGE(0x80000000, 0x8003ffff) AM_RAM AM_MIRROR(0x1c0000) AM_BASE(&towns_vram) // VRAM
314364  AM_RANGE(0x81000000, 0x8101ffff) AM_RAM  // Sprite RAM
315365  AM_RANGE(0xc2000000, 0xc207ffff) AM_ROM AM_REGION("user",0x000000)  // OS ROM
316366  AM_RANGE(0xc2080000, 0xc20fffff) AM_ROM AM_REGION("user",0x100000)  // DIC ROM
317367  AM_RANGE(0xc2100000, 0xc213ffff) AM_ROM AM_REGION("user",0x180000)  // FONT ROM
318  AM_RANGE(0xc2140000, 0xc2141fff) AM_NOP // CMOS (mirror?)
368  AM_RANGE(0xc2140000, 0xc2141fff) AM_READWRITE(towns_cmos_r,towns_cmos_w) // CMOS (mirror?)
319369  AM_RANGE(0xc2200000, 0xc2200fff) AM_NOP  // WAVE RAM
320370  AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
321371ADDRESS_MAP_END
r5912r5913
340390  AM_RANGE(0x0404,0x0407) AM_NOP  // R/W (0x404)
341391  AM_RANGE(0x0440,0x045f) AM_READWRITE8(towns_video_440_r, towns_video_440_w, 0xffffffff)
342392  // System port
343  AM_RANGE(0x0480,0x0483) AM_NOP  // R/W (0x480)
393  AM_RANGE(0x0480,0x0483) AM_READWRITE8(towns_sys480_r,towns_sys480_w,0xff000000)  // R/W (0x480)
344394  // CD-ROM
345395  AM_RANGE(0x04c0,0x04cf) AM_NOP
396  // Joystick / Mouse ports(?)
397  AM_RANGE(0x04d0,0x04d3) AM_READ(towns_padport_r)
346398  // Sound (YM3438 [FM], RF5c68 [PCM])
347399  AM_RANGE(0x04d4,0x04d7) AM_NOP  // R/W  -- (0x4d5) mute?
348400  AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8("fm",ym3438_r,ym3438_w,0x00ff00ff)
r5912r5913
359411  // Keyboard (8042 MCU)
360412  AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff00ff)
361413  // CMOS
362  AM_RANGE(0x3000,0x3fff) AM_RAM
414  AM_RANGE(0x3000,0x3fff) AM_READWRITE8(towns_cmos8_r, towns_cmos8_w,0x00ff00ff)
363415  // CRTC / Video (again)
364416  AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffffffff)
365417  AM_RANGE(0xff80,0xff83) AM_READWRITE8(towns_video_ff81_r, towns_video_ff81_w, 0x0000ff00)
r5912r5913
370422static INPUT_PORTS_START( towns )
371423INPUT_PORTS_END
372424
425static DRIVER_INIT( towns )
426{
427   towns_vram = auto_alloc_array(machine,UINT32,0x20000);
428   towns_cmos = auto_alloc_array(machine,UINT32,0x2000/(sizeof(UINT32)));
429   towns_gfxvram = auto_alloc_array(machine,UINT32,0x8000/(sizeof(UINT32)));
430   towns_txtvram = auto_alloc_array(machine,UINT32,0x8000/(sizeof(UINT32)));
431}
373432
374433static MACHINE_RESET( towns )
375434{
r5912r5913
384443
385444static VIDEO_UPDATE( towns )
386445{
446   int x,y;
447   int pixel = 0;
448   
449   for(y=0;y<480;y++)
450   {
451      for(x=0;x<640;x++)
452      {
453         *BITMAP_ADDR32(bitmap,y,x) = towns_vram[pixel++];
454         if(pixel >= 0x20000)
455            pixel = 0;
456      }
457   }
458   
387459    return 0;
388460}
389461
r5912r5913
479551/* Driver */
480552
481553/*    YEAR  NAME    PARENT  COMPAT  MACHINE     INPUT    INIT    CONFIG COMPANY      FULLNAME            FLAGS */
482COMP( 1989, fmtowns,  0,    0,       towns,       towns,     0,      0,     "Fujitsu",   "FM-Towns",       GAME_NOT_WORKING)
483COMP( 1989, fmtownsa, fmtowns, 0,    towns,       towns,     0,      0,     "Fujitsu",   "FM-Towns (alternate)", GAME_NOT_WORKING)
484CONS( 1993, fmtmarty, 0,    0,       towns,       towns,     0,      0,     "Fujitsu",   "FM-Towns Marty",    GAME_NOT_WORKING)
554COMP( 1989, fmtowns,  0,    0,       towns,       towns,     towns,      0,     "Fujitsu",   "FM-Towns",       GAME_NOT_WORKING)
555COMP( 1989, fmtownsa, fmtowns, 0,    towns,       towns,     towns,      0,     "Fujitsu",   "FM-Towns (alternate)", GAME_NOT_WORKING)
556CONS( 1993, fmtmarty, 0,    0,       towns,       towns,     towns,      0,     "Fujitsu",   "FM-Towns Marty",    GAME_NOT_WORKING)
485557

Previous 15994 Revisions Next


© 1998-2018 The MESS Team