Previous 15994 Revisions Next

r7466 Saturday 27th February, 2010 at 22:49:34 UTC by Barry Rodewald
[FMTOWNS] Improved per-layer vblank/hblank flags.
[src/mess/drivers]fmtowns.c
[src/mess/video]fmtowns.c

src/mess/video/fmtowns.c
r7465r7466
369369 */
370370READ8_HANDLER(towns_video_440_r)
371371{
372   UINT8 ret = 0;
373   UINT16 xpos,ypos;
374   
372375   switch(offset)
373376   {
374377      case 0x00:
375378         return towns_crtc_sel;
376379      case 0x02:
377380         logerror("CRTC: reading register %i (0x442) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]);
381         if(towns_crtc_sel == 30)
382               return 0x00;
378383         return towns_crtc_reg[towns_crtc_sel] & 0x00ff;
379384      case 0x03:
380385         logerror("CRTC: reading register %i (0x443) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]);
386         if(towns_crtc_sel == 30)
387         {
388            // check video position
389            xpos = video_screen_get_hpos(space->machine->primary_screen);
390            ypos = video_screen_get_vpos(space->machine->primary_screen);
391           
392            if(xpos < (towns_crtc_reg[0] & 0xfe))
393               ret |= 0x02;
394            if(ypos < (towns_crtc_reg[6] & 0x1f))
395               ret |= 0x04;
396            if(xpos < towns_crtc_layerscr[0].max_x && xpos > towns_crtc_layerscr[0].min_x)
397               ret |= 0x10;
398            if(xpos < towns_crtc_layerscr[1].max_x && xpos > towns_crtc_layerscr[1].min_x)
399               ret |= 0x20;
400            if(ypos < towns_crtc_layerscr[0].max_y && ypos > towns_crtc_layerscr[0].min_y)
401               ret |= 0x40;
402            if(ypos < towns_crtc_layerscr[1].max_y && ypos > towns_crtc_layerscr[1].min_y)
403               ret |= 0x80;
404               
405            return ret;
406         }
381407         return (towns_crtc_reg[towns_crtc_sel] & 0xff00) >> 8;
382408      case 0x08:
383409         return towns_video_sel;
r7465r7466
388414         if(towns_dpmd_flag != 0)
389415         {
390416            towns_dpmd_flag = 0;
391            return 0x80;
417            ret |= 0x80;
392418         }
393         else
394            return 0x00;
419         ret |= (towns_vblank_flag ? 0x02 : 0x00);  // TODO: figure out just what this bit is...         
420         return ret;
395421      case 0x10:
396422         return towns_sprite_sel;
397423      case 0x12:
r7465r7466
907933   int x;
908934   UINT8 colour;
909935   int hzoom = 1;
936   int linesize;
910937
911938   if(towns_display_page_sel != 0)
912939      off = 0x20000;
940   if(layer == 0)
941      linesize = towns_crtc_reg[20] * 4;
942   else
943      linesize = towns_crtc_reg[24] * 4;
944
913945   if(layer != 0)
914946   {
915947      if(!(towns_video_reg[0] & 0x10))
916948         return;
917      off += 0x40000;
918949      off += towns_crtc_reg[21];  // initial offset
919950      if(towns_crtc_reg[27] & 0x0100)
920951         hzoom = 2;
r7465r7466
926957         hzoom = 2;
927958   }
928959
929   off += (line * (512 / hzoom));
960   off += line * linesize;
930961
931962   if(hzoom == 1)
932963   {
933964      for(x=rect->min_x;x<rect->max_x;x++)
934965      {
935         colour = towns_gfxvram[off];
966         colour = towns_gfxvram[off+(layer*0x40000)];
936967         if(colour != 0)
937968         {
938969            *BITMAP_ADDR32(bitmap,scanline,x) =
r7465r7466
947978   {  // x2 horizontal zoom
948979      for(x=rect->min_x;x<rect->max_x;x+=2)
949980      {
950         colour = towns_gfxvram[off];
981         colour = towns_gfxvram[off+(layer*0x40000)+1];
951982         if(colour != 0)
952983         {
953984            *BITMAP_ADDR32(bitmap,scanline,x) =
src/mess/drivers/fmtowns.c
r7465r7466
4949 * 0x0200-0f: Floppy controller (MB8877A)
5050 * 0x0400   : Video / CRTC (unknown)
5151 * 0x0404   : Disable VRAM, CMOS, memory-mapped I/O (everything in low memory except the BIOS)
52 * 0x0440-5f: Video / CRTC (unknown)
52 * 0x0440-5f: Video / CRTC
5353 * 0x0480 RW: bit 1 = disable BIOS ROM
54 * 0x04c0-cf: CD-ROM controller (unknown)
54 * 0x04c0-cf: CD-ROM controller
5555 * 0x04d5   : Sound mute
5656 * 0x04d8   : YM3438 control port A / status
5757 * 0x04da   : YM3438 data port A / status
r7465r7466
738738{
739739   switch(offset)
740740   {
741      case 0x02:
741      case 0x02:  // PCM channel interrupt mask
742742         towns_pcm_channel_mask = data;
743743         break;
744744      default:
r7465r7466
16481648  // may not be (and probably is not) correct
16491649  AM_RANGE(0x00000000, 0x000bffff) AM_RAM
16501650  AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffffffff)
1651//  AM_RANGE(0x000c8000, 0x000c8fff) AM_READWRITE(SMH_BANK(2),SMH_BANK(2))
1652//  AM_RANGE(0x000c9000, 0x000c9fff) AM_READWRITE(SMH_BANK(3),SMH_BANK(3))
1653//  AM_RANGE(0x000ca000, 0x000ca7ff) AM_READWRITE(SMH_BANK(4),SMH_BANK(5))
1654//  AM_RANGE(0x000ca800, 0x000cafff) AM_READWRITE(SMH_BANK(10),SMH_BANK(10))
16551651  AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffffffff)
16561652  AM_RANGE(0x000cb000, 0x000cbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7")
16571653  AM_RANGE(0x000cc000, 0x000cff7f) AM_RAMBANK("bank8")
r7465r7466
16611657  AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11))
16621658  AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12))
16631659  AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12")
1664  AM_RANGE(0x00100000, 0x005fffff) AM_RAM  // some extra RAM - seems to be needed to boot
1660  AM_RANGE(0x00100000, 0x005fffff) AM_RAM  // some extra RAM
16651661  AM_RANGE(0x80000000, 0x8007ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM
16661662  AM_RANGE(0x81000000, 0x8101ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffffffff) // Sprite RAM
16671663  AM_RANGE(0xc2000000, 0xc207ffff) AM_ROM AM_REGION("user",0x000000)  // OS ROM
r7465r7466
16851681  AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11))
16861682  AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12))
16871683  AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12")
1688  AM_RANGE(0x00100000, 0x005fffff) AM_RAM  // some extra RAM - seems to be needed to boot
1684  AM_RANGE(0x00100000, 0x005fffff) AM_RAM  // some extra RAM - the Marty has 6MB RAM (not upgradable)
16891685  AM_RANGE(0x00600000, 0x0067ffff) AM_ROM AM_REGION("user",0x000000)  // OS
16901686  AM_RANGE(0x00680000, 0x0087ffff) AM_ROM AM_REGION("user",0x280000)  // EX ROM
16911687  AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM
r7465r7466
16951691  AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000)  // FONT
16961692  AM_RANGE(0x00f80000, 0x00f80fff) AM_DEVREADWRITE8("pcm",rf5c68_mem_r,rf5c68_mem_w,0xffffffff)  // WAVE RAM
16971693  AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
1698/*  AM_RANGE(0x80000000, 0x8007ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM
1699  AM_RANGE(0x81000000, 0x8101ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffffffff) // Sprite RAM
1700  AM_RANGE(0xc2000000, 0xc207ffff) AM_ROM AM_REGION("user",0x000000)  // OS ROM
1701  AM_RANGE(0xc2080000, 0xc20fffff) AM_ROM AM_REGION("user",0x100000)  // DIC ROM
1702  AM_RANGE(0xc2100000, 0xc213ffff) AM_ROM AM_REGION("user",0x180000)  // FONT ROM
1703  AM_RANGE(0xc2140000, 0xc2141fff) AM_READWRITE8(towns_cmos_r,towns_cmos_w,0xffffffff) // CMOS (mirror?)
1704  AM_RANGE(0xc2200000, 0xc2200fff) AM_NOP  // WAVE RAM
1705*/AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
1694  AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
17061695ADDRESS_MAP_END
17071696
17081697static ADDRESS_MAP_START( towns_io , ADDRESS_SPACE_IO, 32)
17091698  // I/O ports derived from FM Towns/Bochs, these are specific to the FM Towns
1710  // Some common PC ports are likely to also be used
17111699  // System ports
17121700  AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8("pic8259_master", pic8259_r, pic8259_w, 0x00ff00ff)
17131701  AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8("pic8259_slave", pic8259_r, pic8259_w, 0x00ff00ff)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team