Previous 199869 Revisions Next

r21846 Thursday 14th March, 2013 at 03:10:13 UTC by Barry Rodewald
fmtowns: set UX and Marty drivers to use 386SX CPU. (no whatsnew)
[src/mess/drivers]fmtowns.c
[src/mess/includes]fmtowns.h
[src/mess/video]fmtowns.c

trunk/src/mess/video/fmtowns.c
r21845r21846
574574   logerror("VGA: VRAM wplane select (I/O) = 0x%02x\n",m_video.towns_vram_wplane);
575575}
576576
577READ32_MEMBER(towns_state::towns_video_unknown_r)
577READ8_MEMBER(towns_state::towns_video_unknown_r)
578578{
579   return 0x00000000;
579   return 0x00;
580580}
581581
582582/*
trunk/src/mess/includes/fmtowns.h
r21845r21846
7878   public:
7979   towns_state(const machine_config &mconfig, device_type type, const char *tag)
8080      : driver_device(mconfig, type, tag),
81         m_nvram(*this, "nvram")
81         m_nvram(*this, "nvram"),
82         m_nvram16(*this, "nvram16")
8283   { }
8384
8485   /* devices */
r21845r21846
159160   UINT8 m_prev_x;
160161   UINT8 m_prev_y;
161162
162   required_shared_ptr<UINT32> m_nvram;
163   optional_shared_ptr<UINT32> m_nvram;
164   optional_shared_ptr<UINT16> m_nvram16;
163165
164166   virtual void driver_start();
165167   virtual void machine_reset();
r21845r21846
183185   DECLARE_WRITE8_MEMBER(towns_keyboard_w);
184186   DECLARE_READ8_MEMBER(towns_port60_r);
185187   DECLARE_WRITE8_MEMBER(towns_port60_w);
186   DECLARE_READ32_MEMBER(towns_sys5e8_r);
187   DECLARE_WRITE32_MEMBER(towns_sys5e8_w);
188   DECLARE_READ8_MEMBER(towns_sys5e8_r);
189   DECLARE_WRITE8_MEMBER(towns_sys5e8_w);
188190   DECLARE_READ8_MEMBER(towns_sound_ctrl_r);
189191   DECLARE_WRITE8_MEMBER(towns_sound_ctrl_w);
190   DECLARE_READ32_MEMBER(towns_padport_r);
191   DECLARE_WRITE32_MEMBER(towns_pad_mask_w);
192   DECLARE_READ8_MEMBER(towns_padport_r);
193   DECLARE_WRITE8_MEMBER(towns_pad_mask_w);
192194   DECLARE_READ8_MEMBER(towns_cmos8_r);
193195   DECLARE_WRITE8_MEMBER(towns_cmos8_w);
194196   DECLARE_READ8_MEMBER(towns_cmos_low_r);
r21845r21846
197199   DECLARE_WRITE8_MEMBER(towns_cmos_w);
198200   DECLARE_READ8_MEMBER(towns_sys480_r);
199201   DECLARE_WRITE8_MEMBER(towns_sys480_w);
200   DECLARE_READ32_MEMBER(towns_video_404_r);
201   DECLARE_WRITE32_MEMBER(towns_video_404_w);
202   DECLARE_READ8_MEMBER(towns_video_404_r);
203   DECLARE_WRITE8_MEMBER(towns_video_404_w);
202204   DECLARE_READ8_MEMBER(towns_cdrom_r);
203205   DECLARE_WRITE8_MEMBER(towns_cdrom_w);
204   DECLARE_READ32_MEMBER(towns_rtc_r);
205   DECLARE_WRITE32_MEMBER(towns_rtc_w);
206   DECLARE_WRITE32_MEMBER(towns_rtc_select_w);
206   DECLARE_READ8_MEMBER(towns_rtc_r);
207   DECLARE_WRITE8_MEMBER(towns_rtc_w);
208   DECLARE_WRITE8_MEMBER(towns_rtc_select_w);
207209   DECLARE_READ8_MEMBER(towns_volume_r);
208210   DECLARE_WRITE8_MEMBER(towns_volume_w);
209211   DECLARE_READ8_MEMBER(towns_41ff_r);
r21845r21846
223225   DECLARE_READ8_MEMBER(towns_video_fd90_r);
224226   DECLARE_WRITE8_MEMBER(towns_video_fd90_w);
225227   DECLARE_READ8_MEMBER(towns_video_ff81_r);
226   DECLARE_READ32_MEMBER(towns_video_unknown_r);
228   DECLARE_READ8_MEMBER(towns_video_unknown_r);
227229   DECLARE_WRITE8_MEMBER(towns_video_ff81_w);
228230   DECLARE_READ8_MEMBER(towns_spriteram_low_r);
229231   DECLARE_WRITE8_MEMBER(towns_spriteram_low_w);
r21845r21846
278280   IRQ_CALLBACK_MEMBER(towns_irq_callback);
279281};
280282
283class towns16_state : public towns_state
284{
285   public:
286   towns16_state(const machine_config &mconfig, device_type type, const char *tag)
287      : towns_state(mconfig, type, tag)
288   { }
289};
290
281291class marty_state : public towns_state
282292{
283293   public:
trunk/src/mess/drivers/fmtowns.c
r21845r21846
810810   //logerror("PIT: wrote 0x%02x to port 0x60\n",data);
811811}
812812
813READ32_MEMBER(towns_state::towns_sys5e8_r)
813READ8_MEMBER(towns_state::towns_sys5e8_r)
814814{
815815   switch(offset)
816816   {
817817      case 0x00:
818         if(ACCESSING_BITS_0_7)
819         {
820            logerror("SYS: read RAM size port (%i)\n",m_ram->size());
821            return m_ram->size()/1048576;
822         }
823         break;
824      case 0x01:
825         if(ACCESSING_BITS_0_7)
826         {
827            logerror("SYS: read port 5ec\n");
828            return m_compat_mode & 0x01;
829         }
830         break;
818         logerror("SYS: read RAM size port (%i)\n",m_ram->size());
819         return m_ram->size()/1048576;
820      case 0x02:
821         logerror("SYS: read port 5ec\n");
822         return m_compat_mode & 0x01;
831823   }
832824   return 0x00;
833825}
834826
835WRITE32_MEMBER(towns_state::towns_sys5e8_w)
827WRITE8_MEMBER(towns_state::towns_sys5e8_w)
836828{
837829   switch(offset)
838830   {
839831      case 0x00:
840         if(ACCESSING_BITS_0_7)
841         {
842            logerror("SYS: wrote 0x%02x to port 5e8\n",data);
843         }
832         logerror("SYS: wrote 0x%02x to port 5e8\n",data);
844833         break;
845      case 0x01:
846         if(ACCESSING_BITS_0_7)
847         {
848            logerror("SYS: wrote 0x%02x to port 5ec\n",data);
849            m_compat_mode = data & 0x01;
850         }
834      case 0x02:
835         logerror("SYS: wrote 0x%02x to port 5ec\n",data);
836         m_compat_mode = data & 0x01;
851837         break;
852838   }
853839}
r21845r21846
904890   m_towns_mouse_output = MOUSE_START;  // reset mouse data
905891}
906892
907READ32_MEMBER(towns_state::towns_padport_r)
893READ8_MEMBER(towns_state::towns_padport_r)
908894{
909   UINT32 ret = 0;
895   UINT8 ret = 0x00;
910896   UINT32 porttype = space.machine().root_device().ioport("ctrltype")->read();
911897   UINT8 extra1;
912898   UINT8 extra2;
913899   UINT32 state;
914900
915   if((porttype & 0x0f) == 0x00)
916      ret |= 0x000000ff;
917   if((porttype & 0xf0) == 0x00)
918      ret |= 0x00ff0000;
919   if((porttype & 0x0f) == 0x01)
901   if(offset == 0)
920902   {
921      extra1 = space.machine().root_device().ioport("joy1_ex")->read();
903      if((porttype & 0x0f) == 0x01)
904      {
905         extra1 = space.machine().root_device().ioport("joy1_ex")->read();
922906
923      if(m_towns_pad_mask & 0x10)
924         ret |= (space.machine().root_device().ioport("joy1")->read() & 0x3f) | 0x00000040;
925      else
926         ret |= (space.machine().root_device().ioport("joy1")->read() & 0x0f) | 0x00000030;
907         if(m_towns_pad_mask & 0x10)
908            ret |= (space.machine().root_device().ioport("joy1")->read() & 0x3f) | 0x40;
909         else
910            ret |= (space.machine().root_device().ioport("joy1")->read() & 0x0f) | 0x30;
927911
928      if(extra1 & 0x01) // Run button = left+right
929         ret &= ~0x0000000c;
930      if(extra1 & 0x02) // Select button = up+down
931         ret &= ~0x00000003;
912         if(extra1 & 0x01) // Run button = left+right
913            ret &= ~0x0c;
914         if(extra1 & 0x02) // Select button = up+down
915            ret &= ~0x03;
932916
933      if((extra1 & 0x10) && (m_towns_pad_mask & 0x01))
934         ret &= ~0x00000010;
935      if((extra1 & 0x20) && (m_towns_pad_mask & 0x02))
936         ret &= ~0x00000020;
937   }
938   if((porttype & 0xf0) == 0x10)
939   {
940      extra2 = space.machine().root_device().ioport("joy2_ex")->read();
917         if((extra1 & 0x10) && (m_towns_pad_mask & 0x01))
918            ret &= ~0x10;
919         if((extra1 & 0x20) && (m_towns_pad_mask & 0x02))
920            ret &= ~0x20;
921      }
922      if((porttype & 0x0f) == 0x04)  // 6-button joystick
923      {
924         extra1 = space.machine().root_device().ioport("6b_joy1_ex")->read();
941925
942      if(m_towns_pad_mask & 0x20)
943         ret |= ((space.machine().root_device().ioport("joy2")->read() & 0x3f) << 16) | 0x00400000;
944      else
945         ret |= ((space.machine().root_device().ioport("joy2")->read() & 0x0f) << 16) | 0x00300000;
926         if(m_towns_pad_mask & 0x10)
927            ret |= 0x7f;
928         else
929            ret |= (space.machine().root_device().ioport("6b_joy1")->read() & 0x0f) | 0x70;
946930
947      if(extra2 & 0x01)
948         ret &= ~0x000c0000;
949      if(extra2 & 0x02)
950         ret &= ~0x00030000;
951
952      if((extra2 & 0x10) && (m_towns_pad_mask & 0x04))
953         ret &= ~0x00100000;
954      if((extra2 & 0x20) && (m_towns_pad_mask & 0x08))
955         ret &= ~0x00200000;
956   }
957   if((porttype & 0x0f) == 0x04)  // 6-button joystick
958   {
959      extra1 = space.machine().root_device().ioport("6b_joy1_ex")->read();
960
961      if(m_towns_pad_mask & 0x10)
962         ret |= 0x0000007f;
963      else
964         ret |= (space.machine().root_device().ioport("6b_joy1")->read() & 0x0f) | 0x00000070;
965
966      if(!(m_towns_pad_mask & 0x10))
967      {
968         if(extra1 & 0x01) // Run button = left+right
969            ret &= ~0x0000000c;
970         if(extra1 & 0x02) // Select button = up+down
971            ret &= ~0x00000003;
972         if((extra1 & 0x04) && (m_towns_pad_mask & 0x01))
973            ret &= ~0x00000010;
974         if((extra1 & 0x08) && (m_towns_pad_mask & 0x02))
975            ret &= ~0x00000020;
931         if(!(m_towns_pad_mask & 0x10))
932         {
933            if(extra1 & 0x01) // Run button = left+right
934               ret &= ~0x0c;
935            if(extra1 & 0x02) // Select button = up+down
936               ret &= ~0x03;
937            if((extra1 & 0x04) && (m_towns_pad_mask & 0x01))
938               ret &= ~0x10;
939            if((extra1 & 0x08) && (m_towns_pad_mask & 0x02))
940               ret &= ~0x20;
941         }
942         if(m_towns_pad_mask & 0x10)
943         {
944            if(extra1 & 0x10)
945               ret &= ~0x08;
946            if(extra1 & 0x20)
947               ret &= ~0x04;
948            if(extra1 & 0x40)
949               ret &= ~0x02;
950            if(extra1 & 0x80)
951               ret &= ~0x01;
952         }
976953      }
977      if(m_towns_pad_mask & 0x10)
954      if((porttype & 0x0f) == 0x02)  // mouse
978955      {
979         if(extra1 & 0x10)
980            ret &= ~0x00000008;
981         if(extra1 & 0x20)
982            ret &= ~0x00000004;
983         if(extra1 & 0x40)
984            ret &= ~0x00000002;
985         if(extra1 & 0x80)
986            ret &= ~0x00000001;
956         switch(m_towns_mouse_output)
957         {
958            case MOUSE_X_HIGH:
959               ret |= ((m_towns_mouse_x & 0xf0) >> 4);
960               break;
961            case MOUSE_X_LOW:
962               ret |= (m_towns_mouse_x & 0x0f);
963               break;
964            case MOUSE_Y_HIGH:
965               ret |= ((m_towns_mouse_y & 0xf0) >> 4);
966               break;
967            case MOUSE_Y_LOW:
968               ret |= (m_towns_mouse_y & 0x0f);
969               break;
970            case MOUSE_START:
971            case MOUSE_SYNC:
972            default:
973               if(m_towns_mouse_output < MOUSE_Y_LOW)
974                  ret |= 0x0f;
975         }
976
977         // button states are always visible
978         state = space.machine().root_device().ioport("mouse1")->read();
979         if(!(state & 0x01))
980            ret |= 0x10;
981         if(!(state & 0x02))
982            ret |= 0x20;
983         if(m_towns_pad_mask & 0x10)
984            ret |= 0x40;
987985      }
986
988987   }
989   if((porttype & 0xf0) == 0x40)  // 6-button joystick
988   if(offset == 1)  // second joystick port
990989   {
991      extra2 = space.machine().root_device().ioport("6b_joy2_ex")->read();
990      if((porttype & 0xf0) == 0x10)
991      {
992         extra2 = space.machine().root_device().ioport("joy2_ex")->read();
992993
993      if(m_towns_pad_mask & 0x20)
994         ret |= 0x007f0000;
995      else
996         ret |= ((space.machine().root_device().ioport("6b_joy2")->read() & 0x0f) << 16) | 0x00700000;
994         if(m_towns_pad_mask & 0x20)
995            ret |= ((space.machine().root_device().ioport("joy2")->read() & 0x3f)) | 0x40;
996         else
997            ret |= ((space.machine().root_device().ioport("joy2")->read() & 0x0f)) | 0x30;
997998
998      if(!(m_towns_pad_mask & 0x10))
999      {
1000999         if(extra2 & 0x01)
1001            ret &= ~0x000c0000;
1000            ret &= ~0x0c;
10021001         if(extra2 & 0x02)
1003            ret &= ~0x00030000;
1002            ret &= ~0x03;
1003
10041004         if((extra2 & 0x10) && (m_towns_pad_mask & 0x04))
1005            ret &= ~0x00100000;
1005            ret &= ~0x10;
10061006         if((extra2 & 0x20) && (m_towns_pad_mask & 0x08))
1007            ret &= ~0x00200000;
1007            ret &= ~0x20;
10081008      }
1009      if(m_towns_pad_mask & 0x20)
1009      if((porttype & 0xf0) == 0x40)  // 6-button joystick
10101010      {
1011         if(extra2 & 0x10)
1012            ret &= ~0x00080000;
1013         if(extra2 & 0x20)
1014            ret &= ~0x00040000;
1015         if(extra2 & 0x40)
1016            ret &= ~0x00020000;
1017         if(extra2 & 0x80)
1018            ret &= ~0x00010000;
1011         extra2 = space.machine().root_device().ioport("6b_joy2_ex")->read();
1012
1013         if(m_towns_pad_mask & 0x20)
1014            ret |= 0x7f;
1015         else
1016            ret |= ((space.machine().root_device().ioport("6b_joy2")->read() & 0x0f)) | 0x70;
1017
1018         if(!(m_towns_pad_mask & 0x10))
1019         {
1020            if(extra2 & 0x01)
1021               ret &= ~0x0c;
1022            if(extra2 & 0x02)
1023               ret &= ~0x03;
1024            if((extra2 & 0x10) && (m_towns_pad_mask & 0x04))
1025               ret &= ~0x10;
1026            if((extra2 & 0x20) && (m_towns_pad_mask & 0x08))
1027               ret &= ~0x20;
1028         }
1029         if(m_towns_pad_mask & 0x20)
1030         {
1031            if(extra2 & 0x10)
1032               ret &= ~0x08;
1033            if(extra2 & 0x20)
1034               ret &= ~0x04;
1035            if(extra2 & 0x40)
1036               ret &= ~0x02;
1037            if(extra2 & 0x80)
1038               ret &= ~0x01;
1039         }
10191040      }
1020   }
1021   if((porttype & 0x0f) == 0x02)  // mouse
1022   {
1023      switch(m_towns_mouse_output)
1041      if((porttype & 0xf0) == 0x20)  // mouse
10241042      {
1025         case MOUSE_X_HIGH:
1026            ret |= ((m_towns_mouse_x & 0xf0) >> 4);
1027            break;
1028         case MOUSE_X_LOW:
1029            ret |= (m_towns_mouse_x & 0x0f);
1030            break;
1031         case MOUSE_Y_HIGH:
1032            ret |= ((m_towns_mouse_y & 0xf0) >> 4);
1033            break;
1034         case MOUSE_Y_LOW:
1035            ret |= (m_towns_mouse_y & 0x0f);
1036            break;
1037         case MOUSE_START:
1038         case MOUSE_SYNC:
1039         default:
1040            if(m_towns_mouse_output < MOUSE_Y_LOW)
1041               ret |= 0x0000000f;
1042      }
1043         switch(m_towns_mouse_output)
1044         {
1045            case MOUSE_X_HIGH:
1046               ret |= ((m_towns_mouse_x & 0xf0));
1047               break;
1048            case MOUSE_X_LOW:
1049               ret |= ((m_towns_mouse_x & 0x0f));
1050               break;
1051            case MOUSE_Y_HIGH:
1052               ret |= ((m_towns_mouse_y & 0xf0));
1053               break;
1054            case MOUSE_Y_LOW:
1055               ret |= ((m_towns_mouse_y & 0x0f));
1056               break;
1057            case MOUSE_START:
1058            case MOUSE_SYNC:
1059            default:
1060               if(m_towns_mouse_output < MOUSE_Y_LOW)
1061                  ret |= 0x0f;
1062         }
10431063
1044      // button states are always visible
1045      state = space.machine().root_device().ioport("mouse1")->read();
1046      if(!(state & 0x01))
1047         ret |= 0x00000010;
1048      if(!(state & 0x02))
1049         ret |= 0x00000020;
1050      if(m_towns_pad_mask & 0x10)
1051         ret |= 0x00000040;
1052   }
1053   if((porttype & 0xf0) == 0x20)  // mouse
1054   {
1055      switch(m_towns_mouse_output)
1056      {
1057         case MOUSE_X_HIGH:
1058            ret |= ((m_towns_mouse_x & 0xf0) << 12);
1059            break;
1060         case MOUSE_X_LOW:
1061            ret |= ((m_towns_mouse_x & 0x0f) << 16);
1062            break;
1063         case MOUSE_Y_HIGH:
1064            ret |= ((m_towns_mouse_y & 0xf0) << 12);
1065            break;
1066         case MOUSE_Y_LOW:
1067            ret |= ((m_towns_mouse_y & 0x0f) << 16);
1068            break;
1069         case MOUSE_START:
1070         case MOUSE_SYNC:
1071         default:
1072            if(m_towns_mouse_output < MOUSE_Y_LOW)
1073               ret |= 0x000f0000;
1064         // button states are always visible
1065         state = space.machine().root_device().ioport("mouse1")->read();
1066         if(!(state & 0x01))
1067            ret |= 0x10;
1068         if(!(state & 0x02))
1069            ret |= 0x20;
1070         if(m_towns_pad_mask & 0x20)
1071            ret |= 0x40;
10741072      }
1075
1076      // button states are always visible
1077      state = space.machine().root_device().ioport("mouse1")->read();
1078      if(!(state & 0x01))
1079         ret |= 0x00100000;
1080      if(!(state & 0x02))
1081         ret |= 0x00200000;
1082      if(m_towns_pad_mask & 0x20)
1083         ret |= 0x00400000;
10841073   }
10851074
10861075   return ret;
10871076}
10881077
1089WRITE32_MEMBER(towns_state::towns_pad_mask_w)
1078WRITE8_MEMBER(towns_state::towns_pad_mask_w)
10901079{
10911080   UINT8 current_x,current_y;
10921081   UINT32 type = space.machine().root_device().ioport("ctrltype")->read();
10931082
1094   if(ACCESSING_BITS_16_23)
1083   m_towns_pad_mask = (data & 0xff);
1084   if((type & 0x0f) == 0x02)  // mouse
10951085   {
1096      m_towns_pad_mask = (data & 0x00ff0000) >> 16;
1097      if((type & 0x0f) == 0x02)  // mouse
1086      if((m_towns_pad_mask & 0x10) != 0 && (m_prev_pad_mask & 0x10) == 0)
10981087      {
1099         if((m_towns_pad_mask & 0x10) != 0 && (m_prev_pad_mask & 0x10) == 0)
1088         if(m_towns_mouse_output == MOUSE_START)
11001089         {
1101            if(m_towns_mouse_output == MOUSE_START)
1102            {
1103               m_towns_mouse_output = MOUSE_X_HIGH;
1104               current_x = space.machine().root_device().ioport("mouse2")->read();
1105               current_y = space.machine().root_device().ioport("mouse3")->read();
1106               m_towns_mouse_x = m_prev_x - current_x;
1107               m_towns_mouse_y = m_prev_y - current_y;
1108               m_prev_x = current_x;
1109               m_prev_y = current_y;
1110            }
1111            else
1112               m_towns_mouse_output++;
1113            m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero);
1090            m_towns_mouse_output = MOUSE_X_HIGH;
1091            current_x = space.machine().root_device().ioport("mouse2")->read();
1092            current_y = space.machine().root_device().ioport("mouse3")->read();
1093            m_towns_mouse_x = m_prev_x - current_x;
1094            m_towns_mouse_y = m_prev_y - current_y;
1095            m_prev_x = current_x;
1096            m_prev_y = current_y;
11141097         }
1115         if((m_towns_pad_mask & 0x10) == 0 && (m_prev_pad_mask & 0x10) != 0)
1098         else
1099            m_towns_mouse_output++;
1100         m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero);
1101      }
1102      if((m_towns_pad_mask & 0x10) == 0 && (m_prev_pad_mask & 0x10) != 0)
1103      {
1104         if(m_towns_mouse_output == MOUSE_START)
11161105         {
1117            if(m_towns_mouse_output == MOUSE_START)
1118            {
1119               m_towns_mouse_output = MOUSE_SYNC;
1120               current_x = space.machine().root_device().ioport("mouse2")->read();
1121               current_y = space.machine().root_device().ioport("mouse3")->read();
1122               m_towns_mouse_x = m_prev_x - current_x;
1123               m_towns_mouse_y = m_prev_y - current_y;
1124               m_prev_x = current_x;
1125               m_prev_y = current_y;
1126            }
1127            else
1128               m_towns_mouse_output++;
1129            m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero);
1106            m_towns_mouse_output = MOUSE_SYNC;
1107            current_x = space.machine().root_device().ioport("mouse2")->read();
1108            current_y = space.machine().root_device().ioport("mouse3")->read();
1109            m_towns_mouse_x = m_prev_x - current_x;
1110            m_towns_mouse_y = m_prev_y - current_y;
1111            m_prev_x = current_x;
1112            m_prev_y = current_y;
11301113         }
1131         m_prev_pad_mask = m_towns_pad_mask;
1114         else
1115            m_towns_mouse_output++;
1116         m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero);
11321117      }
1133      if((type & 0xf0) == 0x20)  // mouse
1118      m_prev_pad_mask = m_towns_pad_mask;
1119   }
1120   if((type & 0xf0) == 0x20)  // mouse
1121   {
1122      if((m_towns_pad_mask & 0x20) != 0 && (m_prev_pad_mask & 0x20) == 0)
11341123      {
1135         if((m_towns_pad_mask & 0x20) != 0 && (m_prev_pad_mask & 0x20) == 0)
1124         if(m_towns_mouse_output == MOUSE_START)
11361125         {
1137            if(m_towns_mouse_output == MOUSE_START)
1138            {
1139               m_towns_mouse_output = MOUSE_X_HIGH;
1140               current_x = space.machine().root_device().ioport("mouse2")->read();
1141               current_y = space.machine().root_device().ioport("mouse3")->read();
1142               m_towns_mouse_x = m_prev_x - current_x;
1143               m_towns_mouse_y = m_prev_y - current_y;
1144               m_prev_x = current_x;
1145               m_prev_y = current_y;
1146            }
1147            else
1148               m_towns_mouse_output++;
1149            m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero);
1126            m_towns_mouse_output = MOUSE_X_HIGH;
1127            current_x = space.machine().root_device().ioport("mouse2")->read();
1128            current_y = space.machine().root_device().ioport("mouse3")->read();
1129            m_towns_mouse_x = m_prev_x - current_x;
1130            m_towns_mouse_y = m_prev_y - current_y;
1131            m_prev_x = current_x;
1132            m_prev_y = current_y;
11501133         }
1151         if((m_towns_pad_mask & 0x20) == 0 && (m_prev_pad_mask & 0x20) != 0)
1134         else
1135            m_towns_mouse_output++;
1136         m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero);
1137      }
1138      if((m_towns_pad_mask & 0x20) == 0 && (m_prev_pad_mask & 0x20) != 0)
1139      {
1140         if(m_towns_mouse_output == MOUSE_START)
11521141         {
1153            if(m_towns_mouse_output == MOUSE_START)
1154            {
1155               m_towns_mouse_output = MOUSE_SYNC;
1156               current_x = space.machine().root_device().ioport("mouse2")->read();
1157               current_y = space.machine().root_device().ioport("mouse3")->read();
1158               m_towns_mouse_x = m_prev_x - current_x;
1159               m_towns_mouse_y = m_prev_y - current_y;
1160               m_prev_x = current_x;
1161               m_prev_y = current_y;
1162            }
1163            else
1164               m_towns_mouse_output++;
1165            m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero);
1142            m_towns_mouse_output = MOUSE_SYNC;
1143            current_x = space.machine().root_device().ioport("mouse2")->read();
1144            current_y = space.machine().root_device().ioport("mouse3")->read();
1145            m_towns_mouse_x = m_prev_x - current_x;
1146            m_towns_mouse_y = m_prev_y - current_y;
1147            m_prev_x = current_x;
1148            m_prev_y = current_y;
11661149         }
1167         m_prev_pad_mask = m_towns_pad_mask;
1150         else
1151            m_towns_mouse_output++;
1152         m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero);
11681153      }
1154      m_prev_pad_mask = m_towns_pad_mask;
11691155   }
11701156}
11711157
r21845r21846
11741160   if(m_towns_mainmem_enable != 0)
11751161      return m_messram->pointer()[offset + 0xd8000];
11761162
1177   return m_nvram[offset];
1163   if(m_nvram)
1164      return m_nvram[offset];
1165   else
1166      return m_nvram16[offset];
11781167}
11791168
11801169WRITE8_MEMBER( towns_state::towns_cmos_low_w )
r21845r21846
11821171   if(m_towns_mainmem_enable != 0)
11831172      m_messram->pointer()[offset+0xd8000] = data;
11841173   else
1185      m_nvram[offset] = data;
1174      if(m_nvram)
1175         m_nvram[offset] = data;
1176      else
1177         m_nvram16[offset] = data;
11861178}
11871179
11881180READ8_MEMBER( towns_state::towns_cmos_r )
11891181{
1190   return m_nvram[offset];
1182   if(m_nvram)
1183      return m_nvram[offset];
1184   else
1185      return m_nvram16[offset];
11911186}
11921187
11931188WRITE8_MEMBER( towns_state::towns_cmos_w )
11941189{
1195   m_nvram[offset] = data;
1190   if(m_nvram)
1191      m_nvram[offset] = data;
1192   else
1193      m_nvram16[offset] = data;
11961194}
11971195
11981196void towns_state::towns_update_video_banks(address_space& space)
r21845r21846
12611259   towns_update_video_banks(space);
12621260}
12631261
1264WRITE32_MEMBER( towns_state::towns_video_404_w )
1262WRITE8_MEMBER( towns_state::towns_video_404_w )
12651263{
1266   if(ACCESSING_BITS_0_7)
1267   {
1268      m_towns_mainmem_enable = data & 0x80;
1269      towns_update_video_banks(space);
1270   }
1264   m_towns_mainmem_enable = data & 0x80;
1265   towns_update_video_banks(space);
12711266}
12721267
1273READ32_MEMBER( towns_state::towns_video_404_r )
1268READ8_MEMBER( towns_state::towns_video_404_r )
12741269{
1275   if(ACCESSING_BITS_0_7)
1276   {
1277      if(m_towns_mainmem_enable != 0)
1278         return 0x00000080;
1279   }
1280   return 0;
1270   if(m_towns_mainmem_enable != 0)
1271      return 0x80;
1272   else
1273      return 0x00;
12811274}
12821275
12831276/*
r21845r21846
19211914 * 0x70: Data port
19221915 * 0x80: Register select
19231916 */
1924READ32_MEMBER(towns_state::towns_rtc_r)
1917READ8_MEMBER(towns_state::towns_rtc_r)
19251918{
1926   if(ACCESSING_BITS_0_7)
1927      return 0x80 | m_towns_rtc_reg[m_towns_rtc_select];
1928
1929   return 0x00;
1919   return 0x80 | m_towns_rtc_reg[m_towns_rtc_select];
19301920}
19311921
1932WRITE32_MEMBER(towns_state::towns_rtc_w)
1922WRITE8_MEMBER(towns_state::towns_rtc_w)
19331923{
1934   if(ACCESSING_BITS_0_7)
1935      m_towns_rtc_data = data;
1924   m_towns_rtc_data = data;
19361925}
19371926
1938WRITE32_MEMBER(towns_state::towns_rtc_select_w)
1927WRITE8_MEMBER(towns_state::towns_rtc_select_w)
19391928{
1940   if(ACCESSING_BITS_0_7)
1929   if(data & 0x80)
19411930   {
1942      if(data & 0x80)
1943      {
1944         if(data & 0x01)
1945            m_towns_rtc_select = m_towns_rtc_data & 0x0f;
1946      }
1931      if(data & 0x01)
1932         m_towns_rtc_select = m_towns_rtc_data & 0x0f;
19471933   }
19481934}
19491935
r21845r21846
21862172   AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
21872173ADDRESS_MAP_END
21882174
2189static ADDRESS_MAP_START(marty_mem, AS_PROGRAM, 32, towns_state)
2190   ADDRESS_MAP_GLOBAL_MASK(0x00ffffff)  // 386SX has only a 24-bit address range
2175static ADDRESS_MAP_START(marty_mem, AS_PROGRAM, 16, towns_state)
21912176   AM_RANGE(0x00000000, 0x000bffff) AM_RAM
2192   AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffffffff)
2193   AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffffffff)
2177   AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffff)
2178   AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffff)
21942179   AM_RANGE(0x000cb000, 0x000cbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7")
21952180   AM_RANGE(0x000cc000, 0x000cff7f) AM_RAM
2196   AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffffffff)
2181   AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffff)
21972182   AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM
2198   AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffffffff) AM_SHARE("nvram") // CMOS? RAM
2183   AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffff) AM_SHARE("nvram16") // CMOS? RAM
21992184   AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11))
22002185   AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12))
22012186   AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12")
22022187//  AM_RANGE(0x00100000, 0x005fffff) AM_RAM  // some extra RAM - the Marty has 6MB RAM (not upgradable)
22032188   AM_RANGE(0x00600000, 0x0067ffff) AM_ROM AM_REGION("user",0x000000)  // OS
22042189   AM_RANGE(0x00680000, 0x0087ffff) AM_ROM AM_REGION("user",0x280000)  // EX ROM
2205   AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM
2190   AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffff) AM_MIRROR(0x180000) // VRAM
22062191   AM_RANGE(0x00b00000, 0x00b7ffff) AM_ROM AM_REGION("user",0x180000)  // FONT
2207   AM_RANGE(0x00c00000, 0x00c1ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffffffff) // Sprite RAM
2192   AM_RANGE(0x00c00000, 0x00c1ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffff) // Sprite RAM
22082193   AM_RANGE(0x00d00000, 0x00dfffff) AM_RAM // IC Memory Card (is this usable on the Marty?)
22092194   AM_RANGE(0x00e80000, 0x00efffff) AM_ROM AM_REGION("user",0x100000)  // DIC ROM
22102195   AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000)  // FONT
2211   AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffffffff)  // WAVE RAM
2196   AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffff)  // WAVE RAM
22122197   AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
22132198   AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
22142199ADDRESS_MAP_END
22152200
2216static ADDRESS_MAP_START(ux_mem, AS_PROGRAM, 32, towns_state)
2217   ADDRESS_MAP_GLOBAL_MASK(0x00ffffff)  // 386SX has only a 24-bit address range
2201static ADDRESS_MAP_START(ux_mem, AS_PROGRAM, 16, towns_state)
22182202   AM_RANGE(0x00000000, 0x000bffff) AM_RAM
2219   AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffffffff)
2220   AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffffffff)
2203   AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffff)
2204   AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffff)
22212205   AM_RANGE(0x000cb000, 0x000cbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7")
22222206   AM_RANGE(0x000cc000, 0x000cff7f) AM_RAM
2223   AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffffffff)
2207   AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffff)
22242208   AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM
2225   AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffffffff) AM_SHARE("nvram") // CMOS? RAM
2209   AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffff) AM_SHARE("nvram16") // CMOS? RAM
22262210   AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11))
22272211   AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12))
22282212   AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12")
2229//  AM_RANGE(0x00100000, 0x005fffff) AM_RAM  // some extra RAM - the Marty has 6MB RAM (not upgradable)
22302213//  AM_RANGE(0x00680000, 0x0087ffff) AM_ROM AM_REGION("user",0x280000)  // EX ROM
2231   AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM
2214   AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffff) AM_MIRROR(0x180000) // VRAM
22322215   AM_RANGE(0x00b00000, 0x00b7ffff) AM_ROM AM_REGION("user",0x180000)  // FONT
2233   AM_RANGE(0x00c00000, 0x00c1ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffffffff) // Sprite RAM
2216   AM_RANGE(0x00c00000, 0x00c1ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffff) // Sprite RAM
22342217   AM_RANGE(0x00d00000, 0x00dfffff) AM_RAM // IC Memory Card
22352218   AM_RANGE(0x00e00000, 0x00e7ffff) AM_ROM AM_REGION("user",0x000000)  // OS
22362219   AM_RANGE(0x00e80000, 0x00efffff) AM_ROM AM_REGION("user",0x100000)  // DIC ROM
22372220   AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000)  // FONT
2238   AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffffffff)  // WAVE RAM
2221   AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffff)  // WAVE RAM
22392222   AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
22402223   AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000)  // SYSTEM ROM
22412224ADDRESS_MAP_END
r21845r21846
22532236   AM_RANGE(0x0068,0x006b) AM_READWRITE8(towns_intervaltimer2_r, towns_intervaltimer2_w, 0xffffffff)
22542237   AM_RANGE(0x006c,0x006f) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x000000ff)
22552238   // 0x0070/0x0080 - CMOS RTC
2256   AM_RANGE(0x0070,0x0073) AM_READWRITE(towns_rtc_r,towns_rtc_w)
2257   AM_RANGE(0x0080,0x0083) AM_WRITE(towns_rtc_select_w)
2239   AM_RANGE(0x0070,0x0073) AM_READWRITE8(towns_rtc_r,towns_rtc_w,0x000000ff)
2240   AM_RANGE(0x0080,0x0083) AM_WRITE8(towns_rtc_select_w,0x000000ff)
22582241   // DMA controllers (uPD71071)
22592242   AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffffffff)
22602243   AM_RANGE(0x00b0,0x00bf) AM_READWRITE8(towns_dma2_r, towns_dma2_w, 0xffffffff)
22612244   // Floppy controller
22622245   AM_RANGE(0x0200,0x020f) AM_READWRITE8(towns_floppy_r, towns_floppy_w, 0xffffffff)
22632246   // CRTC / Video
2264   AM_RANGE(0x0400,0x0403) AM_READ(towns_video_unknown_r)  // R/O (0x400)
2265   AM_RANGE(0x0404,0x0407) AM_READWRITE(towns_video_404_r, towns_video_404_w)  // R/W (0x404)
2247   AM_RANGE(0x0400,0x0403) AM_READ8(towns_video_unknown_r, 0x000000ff)  // R/O (0x400)
2248   AM_RANGE(0x0404,0x0407) AM_READWRITE8(towns_video_404_r, towns_video_404_w, 0x000000ff)  // R/W (0x404)
22662249   AM_RANGE(0x0440,0x045f) AM_READWRITE8(towns_video_440_r, towns_video_440_w, 0xffffffff)
22672250   // System port
22682251   AM_RANGE(0x0480,0x0483) AM_READWRITE8(towns_sys480_r,towns_sys480_w,0x000000ff)  // R/W (0x480)
22692252   // CD-ROM
22702253   AM_RANGE(0x04c0,0x04cf) AM_READWRITE8(towns_cdrom_r,towns_cdrom_w,0x00ff00ff)
22712254   // Joystick / Mouse ports
2272   AM_RANGE(0x04d0,0x04d3) AM_READ(towns_padport_r)
2273   AM_RANGE(0x04d4,0x04d7) AM_WRITE(towns_pad_mask_w)
2255   AM_RANGE(0x04d0,0x04d3) AM_READ8(towns_padport_r, 0x00ff00ff)
2256   AM_RANGE(0x04d4,0x04d7) AM_WRITE8(towns_pad_mask_w, 0x00ff0000)
22742257   // Sound (YM3438 [FM], RF5c68 [PCM])
22752258   AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8_LEGACY("fm",ym3438_r,ym3438_w,0x00ff00ff)
22762259   AM_RANGE(0x04e0,0x04e3) AM_READWRITE8(towns_volume_r,towns_volume_w,0xffffffff)  // R/W  -- volume ports
r21845r21846
22792262   // CRTC / Video
22802263   AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0xffffffff)
22812264   // System ports
2282   AM_RANGE(0x05e8,0x05ef) AM_READWRITE(towns_sys5e8_r, towns_sys5e8_w)
2265   AM_RANGE(0x05e8,0x05ef) AM_READWRITE8(towns_sys5e8_r, towns_sys5e8_w, 0x00ff00ff)
22832266   // Keyboard (8042 MCU)
22842267   AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff00ff)
22852268   // SCSI controller
r21845r21846
22912274   // CRTC / Video (again)
22922275   AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffffffff)
22932276   AM_RANGE(0xff80,0xffff) AM_READWRITE8(towns_video_cff80_r,towns_video_cff80_w,0xffffffff)
2277ADDRESS_MAP_END
22942278
2279static ADDRESS_MAP_START( towns16_io , AS_IO, 16, towns_state)  // for the 386SX based systems
2280   // System ports
2281   ADDRESS_MAP_UNMAP_HIGH
2282   AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0x00ff)
2283   AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0x00ff)
2284   AM_RANGE(0x0020,0x0033) AM_READWRITE8(towns_system_r,towns_system_w, 0xffff)
2285   AM_RANGE(0x0040,0x0047) AM_DEVREADWRITE8_LEGACY("pit",pit8253_r, pit8253_w, 0x00ff)
2286   AM_RANGE(0x0050,0x0057) AM_DEVREADWRITE8_LEGACY("pit2",pit8253_r, pit8253_w, 0x00ff)
2287   AM_RANGE(0x0060,0x0061) AM_READWRITE8(towns_port60_r, towns_port60_w, 0x00ff)
2288   AM_RANGE(0x0068,0x006b) AM_READWRITE8(towns_intervaltimer2_r, towns_intervaltimer2_w, 0xffff)
2289   AM_RANGE(0x006c,0x006d) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x00ff)
2290   // 0x0070/0x0080 - CMOS RTC
2291   AM_RANGE(0x0070,0x0071) AM_READWRITE8(towns_rtc_r,towns_rtc_w,0x00ff)
2292   AM_RANGE(0x0080,0x0081) AM_WRITE8(towns_rtc_select_w,0x00ff)
2293   // DMA controllers (uPD71071)
2294   AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffff)
2295   AM_RANGE(0x00b0,0x00bf) AM_READWRITE8(towns_dma2_r, towns_dma2_w, 0xffff)
2296   // Floppy controller
2297   AM_RANGE(0x0200,0x020f) AM_READWRITE8(towns_floppy_r, towns_floppy_w, 0xffff)
2298   // CRTC / Video
2299   AM_RANGE(0x0400,0x0401) AM_READ8(towns_video_unknown_r, 0x00ff)  // R/O (0x400)
2300   AM_RANGE(0x0404,0x0407) AM_READWRITE8(towns_video_404_r, towns_video_404_w, 0xffff)  // R/W (0x404)
2301   AM_RANGE(0x0440,0x045f) AM_READWRITE8(towns_video_440_r, towns_video_440_w, 0xffff)
2302   // System port
2303   AM_RANGE(0x0480,0x0481) AM_READWRITE8(towns_sys480_r,towns_sys480_w,0x00ff)  // R/W (0x480)
2304   // CD-ROM
2305   AM_RANGE(0x04c0,0x04cf) AM_READWRITE8(towns_cdrom_r,towns_cdrom_w,0x00ff)
2306   // Joystick / Mouse ports
2307   AM_RANGE(0x04d0,0x04d3) AM_READ8(towns_padport_r, 0x00ff)
2308   AM_RANGE(0x04d6,0x04d7) AM_WRITE8(towns_pad_mask_w, 0x00ff)
2309   // Sound (YM3438 [FM], RF5c68 [PCM])
2310   AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8_LEGACY("fm",ym3438_r,ym3438_w,0x00ff)
2311   AM_RANGE(0x04e0,0x04e3) AM_READWRITE8(towns_volume_r,towns_volume_w,0xffff)  // R/W  -- volume ports
2312   AM_RANGE(0x04e8,0x04ef) AM_READWRITE8(towns_sound_ctrl_r,towns_sound_ctrl_w,0xffff)
2313   AM_RANGE(0x04f0,0x04fb) AM_DEVWRITE8("pcm", rf5c68_device, rf5c68_w, 0xffff)
2314   // CRTC / Video
2315   AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0xffff)
2316   // System ports
2317   AM_RANGE(0x05e8,0x05ef) AM_READWRITE8(towns_sys5e8_r, towns_sys5e8_w, 0x00ff)
2318   // Keyboard (8042 MCU)
2319   AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff)
2320   // SCSI controller
2321   AM_RANGE(0x0c30,0x0c37) AM_DEVREADWRITE8("scsi:fm",fmscsi_device,fmscsi_r,fmscsi_w,0x00ff)
2322   // CMOS
2323   AM_RANGE(0x3000,0x4fff) AM_READWRITE8(towns_cmos_r, towns_cmos_w,0x00ff)
2324   // Something (MS-DOS wants this 0x41ff to be 1)
2325   //AM_RANGE(0x41fc,0x41ff) AM_READ8(towns_41ff_r,0xff000000)
2326   // CRTC / Video (again)
2327   AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffff)
2328   AM_RANGE(0xff80,0xffff) AM_READWRITE8(towns_video_cff80_r,towns_video_cff80_w,0xffff)
22952329ADDRESS_MAP_END
22962330
22972331/* Input ports */
r21845r21846
28302864   MCFG_UPD71071_ADD("dma_1",towns_dma_config)
28312865   MCFG_UPD71071_ADD("dma_2",towns_dma_config)
28322866
2833   MCFG_NVRAM_ADD_0FILL("nvram")
2834
28352867   //MCFG_VIDEO_START_OVERRIDE(towns_state,towns)
28362868
28372869   /* internal ram */
r21845r21846
28412873MACHINE_CONFIG_END
28422874
28432875static MACHINE_CONFIG_START( towns, towns_state )
2844
28452876   MCFG_FRAGMENT_ADD(towns_base)
2846
2877   MCFG_NVRAM_ADD_0FILL("nvram")
28472878MACHINE_CONFIG_END
28482879
2849static MACHINE_CONFIG_DERIVED( townsux, towns )
2880static MACHINE_CONFIG_START( townsux, towns16_state )
2881   MCFG_FRAGMENT_ADD(towns_base)
28502882
2851   MCFG_CPU_REPLACE("maincpu",I386, 16000000)
2883   MCFG_CPU_REPLACE("maincpu",I386SX, 16000000)
28522884   MCFG_CPU_PROGRAM_MAP(ux_mem)
2853   MCFG_CPU_IO_MAP(towns_io)
2885   MCFG_CPU_IO_MAP(towns16_io)
28542886   MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state,  towns_vsync_irq)
28552887
28562888   MCFG_RAM_MODIFY(RAM_TAG)
28572889   MCFG_RAM_DEFAULT_SIZE("2M")
28582890   MCFG_RAM_EXTRA_OPTIONS("10M")
2891
2892   MCFG_NVRAM_ADD_0FILL("nvram16")
28592893MACHINE_CONFIG_END
28602894
28612895static MACHINE_CONFIG_DERIVED( townssj, towns )
r21845r21846
28712905MACHINE_CONFIG_END
28722906
28732907static MACHINE_CONFIG_DERIVED( townshr, towns )
2874
28752908   MCFG_CPU_REPLACE("maincpu",I486, 20000000)
28762909   MCFG_CPU_PROGRAM_MAP(towns_mem)
28772910   MCFG_CPU_IO_MAP(towns_io)
r21845r21846
28852918static MACHINE_CONFIG_START( marty, marty_state )
28862919   MCFG_FRAGMENT_ADD(towns_base)
28872920
2888   MCFG_CPU_REPLACE("maincpu",I386, 16000000)
2921   MCFG_CPU_REPLACE("maincpu",I386SX, 16000000)
28892922   MCFG_CPU_PROGRAM_MAP(marty_mem)
2890   MCFG_CPU_IO_MAP(towns_io)
2923   MCFG_CPU_IO_MAP(towns16_io)
28912924   MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state,  towns_vsync_irq)
28922925
28932926   MCFG_RAM_MODIFY(RAM_TAG)
28942927   MCFG_RAM_DEFAULT_SIZE("6M")
2928
2929   MCFG_NVRAM_ADD_0FILL("nvram16")
28952930MACHINE_CONFIG_END
28962931
28972932/* ROM definitions */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team