⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dosboxxds510patch

📁 软件模拟ti公司的dsp硬件仿真器dos版
💻
📖 第 1 页 / 共 3 页
字号:
diff -urN d:\Devel\BP\DosBoxXDS510\downloads\dosbox-0.65.tar\dosbox-0.65/src/dosbox.cpp c:\MinGW\projects\dosbox-0.65/src/dosbox.cpp
--- d:\Devel\BP\DosBoxXDS510\downloads\dosbox-0.65.tar\dosbox-0.65/src/dosbox.cpp	2006-03-28 13:30:52.000000000 +0200
+++ c:\MinGW\projects\dosbox-0.65/src/dosbox.cpp	2006-07-07 16:55:02.435160300 +0200
@@ -82,6 +82,8 @@
 void DISNEY_Init(Section*);
 void SERIAL_Init(Section*); 
 
+void EMULATOR_Init(Section*);
+void XDS510_Init(Section*);
 
 #if C_IPX
 void IPX_Init(Section*);
@@ -391,6 +393,34 @@
 		"disney -- Enable Disney Sound Source emulation.\n"
 	);
 
+	secprop=control->AddSection_prop("emulator",&EMULATOR_Init,true);//done
+	secprop->AddInitFunction(&XDS510_Init,true);//done
+	secprop->Add_bool("xds510",true);
+	secprop->Add_hex("printerport",0x378);
+	secprop->Add_hex("base",0x240);
+	secprop->Add_hex("defaultstate",0x10);
+	secprop->Add_hex("tdi",1);
+	secprop->Add_bool("tdiinverted",false);
+	secprop->Add_hex("tdo",0x10);
+	secprop->Add_bool("tdoinverted",false);
+	secprop->Add_hex("tms",4);
+	secprop->Add_bool("tmsinverted",false);
+	secprop->Add_hex("tck",2);
+	secprop->Add_bool("tckinverted",false);
+	secprop->Add_hex("trst",0);
+	secprop->Add_bool("trstinverted",false);
+	
+	MSG_Add("EMULATOR_CONFIGFILE_HELP",
+		"xds510 -- Enable XDS510 emulator.\n"
+		"base -- XDS510 emulator port.\n"
+		"printerport -- Local printer port.\n"
+		"defaultstate -- default state of outputs (16 bits : 0 to 7 for Data port and 8 to 15 for Control Port).\n"
+		"tdi, tck, tms -- bits to activate on Data port for TDI, TCK and TMS signals (8 bits).\n"
+		"trst -- bits to activate TRST (16 bits : 0 to 7 for Data port and 8 to 15 for Control Port).\n"
+		"tdo -- bits to read on Status port for TDO (8 bits).\n"
+		"tdiinverted, ... -- true or false to invert signal.\n"
+	);
+
 	secprop=control->AddSection_prop("bios",&BIOS_Init,false);//done
 	MSG_Add("BIOS_CONFIGFILE_HELP",
 	        "joysticktype -- Type of joystick to emulate: none, 2axis, 4axis,\n"
diff -urN d:\Devel\BP\DosBoxXDS510\downloads\dosbox-0.65.tar\dosbox-0.65/src/hardware/Makefile.am c:\MinGW\projects\dosbox-0.65/src/hardware/Makefile.am
--- d:\Devel\BP\DosBoxXDS510\downloads\dosbox-0.65.tar\dosbox-0.65/src/hardware/Makefile.am	2006-01-30 11:16:48.000000000 +0100
+++ c:\MinGW\projects\dosbox-0.65/src/hardware/Makefile.am	2006-07-10 09:40:42.740124900 +0200
@@ -2,7 +2,7 @@
 
 SUBDIRS = serialport
 
-EXTRA_DIST = fmopl.c fmopl.h ymf262.h ymf262.c
+EXTRA_DIST = fmopl.c fmopl.h ymf262.h ymf262.c xds510.c xds510_io.c xds510.h xds510_io.h
 
 noinst_LIBRARIES = libhardware.a
 
@@ -10,6 +10,7 @@
                         memory.cpp mixer.cpp pcspeaker.cpp pic.cpp sblaster.cpp tandy_sound.cpp timer.cpp \
 			vga.cpp vga_attr.cpp vga_crtc.cpp vga_dac.cpp vga_draw.cpp vga_gfx.cpp vga_other.cpp \
 			vga_memory.cpp vga_misc.cpp vga_seq.cpp vga_xga.cpp vga_s3.cpp \
-			cmos.cpp disney.cpp gus.cpp mpu401.cpp ipx.cpp ipxserver.cpp
+			cmos.cpp disney.cpp gus.cpp mpu401.cpp ipx.cpp ipxserver.cpp \
+			xds510c.cpp
 
 
diff -urN d:\Devel\BP\DosBoxXDS510\downloads\dosbox-0.65.tar\dosbox-0.65/src/hardware/Makefile.in c:\MinGW\projects\dosbox-0.65/src/hardware/Makefile.in
--- d:\Devel\BP\DosBoxXDS510\downloads\dosbox-0.65.tar\dosbox-0.65/src/hardware/Makefile.in	2006-03-29 14:55:32.000000000 +0200
+++ c:\MinGW\projects\dosbox-0.65/src/hardware/Makefile.in	2006-07-10 09:40:56.427537300 +0200
@@ -64,7 +64,8 @@
 	vga_other.$(OBJEXT) vga_memory.$(OBJEXT) vga_misc.$(OBJEXT) \
 	vga_seq.$(OBJEXT) vga_xga.$(OBJEXT) vga_s3.$(OBJEXT) \
 	cmos.$(OBJEXT) disney.$(OBJEXT) gus.$(OBJEXT) mpu401.$(OBJEXT) \
-	ipx.$(OBJEXT) ipxserver.$(OBJEXT)
+	ipx.$(OBJEXT) ipxserver.$(OBJEXT) \
+  xds510c.$(OBJEXT)
 libhardware_a_OBJECTS = $(am_libhardware_a_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -188,13 +189,14 @@
 target_vendor = @target_vendor@
 AM_CPPFLAGS = -I$(top_srcdir)/include
 SUBDIRS = serialport
-EXTRA_DIST = fmopl.c fmopl.h ymf262.h ymf262.c
+EXTRA_DIST = fmopl.c fmopl.h ymf262.h ymf262.c xds510.c xds510_io.c xds510.h xds510_io.h
 noinst_LIBRARIES = libhardware.a
 libhardware_a_SOURCES = adlib.cpp dma.cpp gameblaster.cpp hardware.cpp iohandler.cpp joystick.cpp keyboard.cpp \
                         memory.cpp mixer.cpp pcspeaker.cpp pic.cpp sblaster.cpp tandy_sound.cpp timer.cpp \
 			vga.cpp vga_attr.cpp vga_crtc.cpp vga_dac.cpp vga_draw.cpp vga_gfx.cpp vga_other.cpp \
 			vga_memory.cpp vga_misc.cpp vga_seq.cpp vga_xga.cpp vga_s3.cpp \
-			cmos.cpp disney.cpp gus.cpp mpu401.cpp ipx.cpp ipxserver.cpp
+			cmos.cpp disney.cpp gus.cpp mpu401.cpp ipx.cpp ipxserver.cpp \
+			xds510c.cpp
 
 all: all-recursive
 
@@ -275,6 +277,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vga_s3.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vga_seq.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vga_xga.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xds510c.Po@am__quote@
 
 .cpp.o:
 @am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
diff -urN d:\Devel\BP\DosBoxXDS510\downloads\dosbox-0.65.tar\dosbox-0.65/src/hardware/xds510.c c:\MinGW\projects\dosbox-0.65/src/hardware/xds510.c
--- d:\Devel\BP\DosBoxXDS510\downloads\dosbox-0.65.tar\dosbox-0.65/src/hardware/xds510.c	1970-01-01 01:00:00.000000000 +0100
+++ c:\MinGW\projects\dosbox-0.65/src/hardware/xds510.c	2006-07-10 09:59:28.686043800 +0200
@@ -0,0 +1,629 @@
+/*
+ * xds510 simulator for Wine
+ * Copyright (c) 2001 Blaise Gassend (blaise.gassend@m4x.org)
+ * Modified for DOSBox by Guillaume Zin (guillaume.zin@teleca.fr)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details. You should have received a
+ * copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ * */
+
+// This code assumes at least 32-bit ints as does wine.
+
+#include <stdio.h>
+
+#include "xds510.h"
+#include "xds510_io.h"
+//#include "debugtools.h"
+
+#define FIXME 
+//DECLARE_DEBUG_CHANNEL(xds510);
+//DEFAULT_DEBUG_CHANNEL(xds510);
+
+#define BTAB "\t\t\t\t"
+ 
+#define INTERFACE_VERSION (6)
+static int interface_interrupt;
+//static int read800;
+static int interface_reset;
+static int counter1;
+static int counter1_update;
+static int counter1_capture;
+static int active_command;
+
+#define NUM_LOW_REGISTERS (0xC)
+#define NUM_STATUS_REGISTERS (4)
+static int low_register_val[NUM_LOW_REGISTERS];
+static int status_register[NUM_STATUS_REGISTERS];
+
+static int fifo_buffer;
+static unsigned int read_buffer;
+static int read_buffer_pos;
+static unsigned int write_buffer;
+static int write_buffer_pos;
+
+#define TAP_TEST_LOGIC_RESET (0)
+#define TAP_RUN_TEST_IDLE (2)
+#define TAP_SHIFT_DR (4)
+#define TAP_SHIFT_IR (5)
+#define TAP_PAUSE_DR (6)
+#define TAP_PAUSE_IR (7)
+
+static int tap_state;
+
+//static FILE *debugf; // ####
+//static int outdata, indata, indatap, outdatap, databitsp;
+
+int get_outbit()
+{
+  int outbit;
+  
+  switch (low_register_val[4] & 0x0300)
+  {
+    default:
+    case 0x0000:
+      outbit = 0;
+      break;
+      
+    case 0x0100:
+      outbit = 1;
+      break;
+      
+    case 0x0200:
+      outbit = fifo_buffer & 1;
+      break;
+
+    case 0x0300:
+      outbit = write_buffer & 1;
+      break;
+  }
+  
+  return outbit;
+}
+
+/*static void tap_log(int tms, int tdo, int tdi)
+{
+  void printbuff(unsigned char *buff, int len)
+  {
+    int i;
+    int bytes = len / 8;
+    int bits = len % 8;
+    int mask = 1 << bits;
+    
+    for (i = 0; i < bytes; i++)
+    {
+      fprintf(debugf, "%02x", (int) buff[i]);
+    }
+
+    if (bits > 0)
+    {
+      buff[bytes] &= mask - 1;
+      fprintf(debugf, "%0*x", (bits + 3) / 4, buff[bytes]);
+    }
+  }
+  
+  static unsigned char inbuff[256];
+  static unsigned char outbuff[256];
+  static int buffp = 0;
+  static int state = 0; // 0 reset, 1 run, then DR top to bot, ir top to bot.
+  static int trans[2][16] = 
+  { { 1, 1, 3, 4, 4, 6, 6, 4, 1, 10, 11, 11, 13, 13, 11, 1 },
+    { 0, 2, 9, 5, 5, 8, 7, 8, 2, 0, 12, 12, 15, 14, 15, 2 } };
+
+  if (state == 4 || state == 11) // Shifting
+  {
+    int byte = buffp / 8;
+    int bit = buffp % 8;
+    int mask = 1 << bit;
+    if (buffp < 2048)
+    {
+      inbuff[byte] = (inbuff[byte] & (mask - 1)) | (tdi ? mask : 0);
+      outbuff[byte] = (outbuff[byte] & (mask - 1)) | (tdo ? mask : 0);
+      buffp++;
+    }
+  }
+  
+  state = trans[tms][state & 0xF];
+
+  switch (state)
+  {
+    case 0: // reset
+      fputs("RESET ", debugf);
+      break;
+
+    case 1: // run
+      fputs("RUN ", debugf);
+      break;
+
+    case 8: // update dr
+      fprintf(debugf, "\n              DRU %i ", buffp);
+      printbuff(outbuff, buffp);
+      fputs(" -> ", debugf);
+      printbuff(inbuff, buffp);
+      fputc(' ', debugf);
+      fflush(debugf);
+      buffp = 0;
+      break;
+       
+    case 15: // update ir
+      fprintf(debugf, "\nIRU %i ", buffp - 16);
+      printbuff(outbuff + 2, buffp - 16);
+      fputs(" -> ", debugf);
+      printbuff(inbuff, buffp - 16);
+      fputc(' ', debugf);
+      fflush(debugf);
+      buffp = 0;
+      break;
+  }
+}
+*/
+static int io_cycle(int tms)
+{
+  int tdo = get_outbit();
+  int tdi = xds510_io_write_cycle(tdo, tms);
+
+//  tap_log(tms, tdo, tdi);
+  
+  return tdi;
+}
+
+static void XDS510_reset()
+{
+  int i;
+  
+  LOG(LOG_MISC,LOG_NORMAL)("XDS510 :XDS510_reset\n");
+
+  counter1 = 0;
+  counter1_update = 0;
+  counter1_capture = 0;
+  interface_interrupt = 0;
+//  read800 = 0;
+  active_command = 0;
+  
+  fifo_buffer = 0xFFFFFFFF;
+  read_buffer = 0;
+  read_buffer_pos = 0;
+  write_buffer = 0;
+  write_buffer_pos = 0;
+
+/*  for (i = 0; i < 6; i++)
+  {
+    io_cycle(1); 
+  }
+  io_cycle(0); */
+  tap_state = TAP_TEST_LOGIC_RESET;
+  
+  for (i = 0; i < NUM_LOW_REGISTERS; i++)
+    low_register_val[i] = 0;    
+  
+  for (i = 0; i < NUM_STATUS_REGISTERS; i++)
+    status_register[i] = 0;    
+
+  LOG(LOG_MISC,LOG_NORMAL)("XDS510: returning\n\n");
+}
+
+int state_id(int s)
+{
+  s &= 0x7;
+  if (s < 4) 
+    return s / 2;
+  else 
+    return s - 2;
+}
+  
+static void go_tap_state(int state)
+{
+  // The order is RESET, RUN, S-DR, S-IR, P-DR, P-IR
+  
+  static const char *transitions[6][6] = { // [from][to]
+    { "11111", "0",   "0100",  "01100",  "01010",  "011010"  },
+    { "11111", "0",   "100",   "1100",   "1010",   "11010"   },
+    { "11111", "110", "0",     "111100", "10",     "1111010" },
+    { "11111", "110", "11100", "0",      "111010", "10"      },
+    { "11111", "110", "10",    "111100", "0",      "1111010" },
+    { "11111", "110", "11100", "10",     "111010", "0"    }  };
+  int i;
+
+  const char *trans = transitions[state_id(tap_state)][state_id(state)];
+  
+//  printf("Goto Tap %i From %i\n", state, tap_state);
+  
+  while (*trans)
+  {
+    io_cycle(*trans - '0');
+    trans++;
+  }
+
+  if ((state & 0x6) == 2)
+    for (i = 0; i < 10; i++)
+      io_cycle(0);  
+
+  tap_state = state & 0x7;
+}
+
+static void go_tap_state2(int state)
+{
+  // The order is RESET, RUN, S-DR, S-IR, P-DR, P-IR
+  
+  static const char *transitions[6][6] = { // [from][to]
+    { "11111", "0",   "0100",  "01100",  "01010",  "011010"  },
+    { "11111", "0",   "100",   "1100",   "1010",   "11010"   },
+    { "11111", "110", "0",     "111100", "10",     "1111010" },
+    { "11111", "110", "11100", "0",      "111010", "10"      },
+    { "11111", "110", "10",    "111100", "111010", "1111010" },
+    { "11111", "110", "11100", "10",     "111010", "1111010" }  };
+  int i;
+  
+  const char *trans = transitions[state_id(tap_state)][state_id(state)];
+  
+//  printf("Goto Tap 2 %i From %i\n", state, tap_state);
+  
+  while (*trans)
+  {
+    io_cycle(*trans - '0');
+    trans++;
+  }
+
+  if ((state & 0x6) == 2)
+    for (i = 0; i < 10; i++)
+      io_cycle(0);  
+
+  tap_state = state & 0x7;
+}
+
+static void minor_command(int value)
+{
+  int cmd = (value >> 12) & 0xF;
+
+  switch (cmd)
+  {
+    case 4:
+    case 5:
+      if (value & 0x0080)
+      {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -