📄 dosboxxds510patch
字号:
+/* if (low_register_val[0xB] >> 12 == 3)
+ {
+ fprintf(debugf, "i %0*x o %0*x\nExecute %04X, count = %i ",
+ (databitsp + 3) / 4, indata & ~(-1 << (indatap - 16)),
+ (databitsp + 3) / 4, outdata >> 16,
+ low_register_val[0xB], counter1 - 15);
+ fflush(debugf);
+ outdata = 0;
+ indata = 0;
+ indatap = 0;
+ outdatap = 0;
+ databitsp = counter1 - 15;
+ }*/
+ active_command = 1;
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: Just activated a command.\n");
+ }
+ if (value & 0xF7F)
+ {
+ FIXME("XDS510: Unsupported bits in minor command 4\n");
+
+ }
+ break;
+
+ case 6:
+ if (value & 0x001)
+ {
+ counter1 = counter1_update;
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: counter1 loaded with : %08x\n", counter1);
+ }
+
+ if (value & 0x004)
+ {
+ counter1_capture = counter1;
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: counter1 captured with : %08x\n", counter1);
+ }
+
+ if (value & 0x040)
+ {
+ status_register[0] = 0xF; // ####
+ status_register[1] = (active_command ? 0x8000 : 0);
+ status_register[2] = tap_state & 0x7;
+ if (read_buffer_pos >= 16) status_register[2] |= 0x1000;
+ if (read_buffer_pos >= 32) status_register[2] |= 0x2000;
+ if (write_buffer_pos > 0) status_register[2] |= 0x0100;
+ if (write_buffer_pos > 16) status_register[2] |= 0x0200;
+ status_register[3] = 0;
+ }
+
+ if (value & (0x002 | 0x030 | 0xF88))
+ {
+ FIXME("XDS510: Unsupported bits in minor command 6\n");
+ }
+ break;
+
+ case 7:
+ if (value & 0x0001)
+ {
+ XDS510_reset();
+ }
+
+ if (value & 0x0FFE)
+ {
+ FIXME("XDS510: Unsupported bits in minor command 7\n");
+ }
+
+ break;
+
+ default:
+ FIXME("XDS510: Unknown minor command %04x\n", value);
+ }
+
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: minor_command(%04x)\n", value);
+}
+
+static int scannable_bits()
+{
+ int rslt = counter1 + 1;
+ if (rslt > 32 - read_buffer_pos && (low_register_val[4] & 0x0400))
+ {
+ rslt = 32 - read_buffer_pos;
+ }
+ if (rslt > write_buffer_pos &&
+ (low_register_val[4] & 0x0300) == 0x0300)
+ {
+ rslt = write_buffer_pos;
+ }
+ return rslt;
+}
+
+static void shift_bit(int tdi0)
+{
+ if (!(low_register_val[4] & 0x0080))
+ {
+ tdi0 = get_outbit();
+ }
+
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: s4 : %04x tdi : %i w : %08x f : %04x r : %08x\n",
+ low_register_val[4], tdi0, write_buffer, fifo_buffer, read_buffer);
+
+ if (low_register_val[4] & 0x0400)
+ {
+ read_buffer = (read_buffer & ~(-1 << read_buffer_pos)) |
+ ((fifo_buffer & 1) << read_buffer_pos);
+ read_buffer_pos++;
+ }
+
+ fifo_buffer >>= 1;
+ {
+ int mask = (low_register_val[4] & 0x0020) ? 0x80000000 : 0x8000;
+ if (tdi0)
+ fifo_buffer |= mask;
+ else
+ fifo_buffer &= ~mask;
+ }
+
+ if ((low_register_val[4] & 0x0300) == 0x0300)
+ {
+ write_buffer >>= 1;
+ write_buffer_pos--;
+ }
+}
+
+static void scan_bits(int pause_state)
+{
+ int bits = scannable_bits();
+
+ if (bits > 0)
+ {
+ go_tap_state(pause_state);
+
+ io_cycle(1); // Switch to scan state
+ io_cycle(0);
+
+ while (bits > 1)
+ {
+ counter1--;
+ bits--;
+ shift_bit(io_cycle(0));
+ }
+
+ counter1--;
+ shift_bit(io_cycle(1)); // Return to pause state
+ io_cycle(0);
+ }
+}
+
+static void execute_command()
+{
+ if (active_command)
+ {
+ int fcmd = low_register_val[0xB];
+ int cmd = (fcmd >> 12) & 0xF;
+
+ switch (cmd)
+ {
+ case 1:
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: STATE command to TAP state %i.\n", fcmd & 0x7);
+ active_command = 0;
+ go_tap_state2(fcmd & 0x7);
+ if (fcmd & 0x0FF8)
+ {
+ FIXME("XDS510: Unsupported bits in major command 1.\n");
+ }
+ break;
+
+ case 3:
+ scan_bits((fcmd & 0x0008) ? TAP_PAUSE_IR : TAP_PAUSE_DR);
+
+ if (fcmd & 0xF80)
+ {
+ FIXME("XDS510: Unsupported bits in major command 3.\n");
+ }
+
+ if (counter1 < 0)
+ {
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: SCAN command finished.\n");
+ go_tap_state(fcmd & 0x7);
+ active_command = 0;
+ read_buffer_pos = (read_buffer_pos + 15) & 0xFFF0;
+ write_buffer_pos &= 0xFFF0;
+ }
+ break;
+
+ default:
+ active_command = 0;
+ FIXME("XDS510: Tried to execute unsupported major command %04x\n", fcmd);
+ break;
+ }
+ }
+}
+
+int XDS510_read(int port)
+{
+ int retval = 0xFFFF;
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: XDS510_read(%03x)\n", port);
+
+ switch (port)
+ {
+ case 0x18: // counter1 low
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: Read counter1 capture low\n");
+ retval = counter1_capture & 0xFFFF;
+ break;
+
+ case 0x1A: // counter1 high
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: Read counter1 capture high\n");
+ retval = (counter1_capture >> 16) & 0xFFFF;
+ break;
+
+ case 0x40C: // Read buffer
+ retval = read_buffer & 0xFFFF;
+// outdata |= retval << outdatap;
+// outdatap += 16;
+ read_buffer >>= 16;
+ read_buffer_pos -= 16;
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: Read %04x from read buffer.\n", retval);
+ if (read_buffer_pos < 0)
+ {
+ FIXME("XDS510: Read buffer underflow.\n");
+ read_buffer_pos = 0;
+ }
+ break;
+
+ case 0x800: // The interface word
+/* if (read800)
+ {
+ fprintf(debugf, "\nread800 %i\n", interface_interrupt);
+ interface_interrupt = (interface_interrupt + 1) & 0x1FF;
+ }*/
+ retval = (((-INTERFACE_VERSION) & 0x7) << 5) |
+ /*(read800 && interface_interrupt == 0) |*/ 0x10 |
+ (!!interface_reset << 8);
+/* if (retval & 0x0001)
+ FIXME("XDS510: interrupt flag %i\n", interface_interrupt);
+ read800 = !read800;*/
+ break;
+
+ default:
+ if (port >= 0 && port < 2 * NUM_LOW_REGISTERS)
+ {
+ retval = low_register_val[port / 2];
+ }
+ else if (port >= 0x400 && port < 0x400 + 2 * NUM_STATUS_REGISTERS)
+ {
+ retval = status_register[(port - 0x400) / 2];
+ }
+ else
+ {
+ FIXME("XDS510: Unhandled port %03x.\n", port);
+ }
+ break;
+ }
+
+ execute_command();
+
+/* if (port != 0x800)
+ read800 = 0;*/
+
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: returning %04x\n\n", retval);
+ return retval;
+}
+
+void XDS510_write(int port, int value, int mask)
+{
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: XDS510_write(%03x, %04x)\n", port, value);
+ static int current_minor_command = 0;
+ static int current_control5 = 0;
+
+// read800 = 0;
+
+ if (port >= 0 && port < 2 * NUM_LOW_REGISTERS)
+ low_register_val[port / 2] = ((value & mask) | low_register_val[port / 2] & ~mask) & 0xffff;
+
+ switch (port)
+ {
+ case 0x0A: //Control 5
+ current_control5 = (current_control5 & ~mask) | (value & mask) & 0xffff;
+ FIXME("XDS510: Write of %04x to 00A -> emu = %i\n", current_control5, !!(current_control5 & 0x0004));
+ xds510_io_write_trst(current_control5 & 0x0004);
+ go_tap_state(tap_state);
+ go_tap_state(tap_state);
+ break;
+
+ case 0x14: // Minor command
+ current_minor_command = (current_minor_command & ~mask) | (value & mask) & 0xffff;
+ minor_command(current_minor_command);
+ break;
+
+ case 0x8:
+ case 0x16: // Major command
+// major_command(value); // #### Useless
+ break;
+
+ case 0x18: // Counter1 low
+ counter1_update = (counter1_update & ~mask) | (value & mask);
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: Write counter1 update low. New value : %08x\n", counter1_update);
+ break;
+
+ case 0x1A: // Counter1 high
+ counter1_update = (counter1_update & ~(mask << 16)) | ((value & mask) << 16);
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: Write counter1 update high. New value : %08x\n", counter1_update);
+ break;
+
+ case 0x40E: // Write buffer
+ write_buffer = (value << write_buffer_pos) |
+ (write_buffer & ~(-1 << write_buffer_pos));
+ write_buffer_pos += (mask == 0xffff) ? 16 : 8;
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: Wrote %04x to write buffer.\n", value);
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: Total bits in buffer : %i\n", write_buffer_pos);
+ if (write_buffer_pos > 32)
+ {
+ LOG(LOG_MISC,LOG_WARN)("XDS510: Write buffer overflow.\n");
+ write_buffer_pos = 32;
+ }
+// indata |= (value & 0xFFFF) << indatap;
+// indatap += 16;
+ break;
+
+ case 0x800: // The interface word
+ if ((mask & 0x100) != 0) {
+ if (!!(value & 0x100) != interface_reset)
+ {
+ interface_reset = !!(value & 0x100);
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: New unknown pin value is %i\n", interface_reset);
+ // xds510_io_write_trst(!interface_reset);
+ }
+ }
+ break;
+
+ default:
+ FIXME("XDS510: Unhandled port %03x. (writing %4x)\n", port, value);
+ break;
+ }
+
+ execute_command();
+
+ LOG(LOG_MISC,LOG_NORMAL)("XDS510: returning\n\n");
+}
diff -urN d:\Devel\BP\DosBoxXDS510\downloads\dosbox-0.65.tar\dosbox-0.65/src/hardware/xds510.h c:\MinGW\projects\dosbox-0.65/src/hardware/xds510.h
--- d:\Devel\BP\DosBoxXDS510\downloads\dosbox-0.65.tar\dosbox-0.65/src/hardware/xds510.h 1970-01-01 01:00:00.000000000 +0100
+++ c:\MinGW\projects\dosbox-0.65/src/hardware/xds510.h 2006-07-07 13:04:09.398820300 +0200
@@ -0,0 +1,29 @@
+/*
+ * xds510 simulator for Wine
+ * Copyright (c) 2001 Blaise Gassend (blaise.gassend@m4x.org)
+ *
+ * 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.
+ * */
+
+#ifndef __XDS510_H__
+#define __XDS510_H__
+
+#define XDS510_BASE (0x240)
+#define XDS510(x) ((XDS510_BASE) + (x))
+
+void XDS510_init();
+int XDS510_read(int port);
+void XDS510_write(int port, int value, int mask);
+
+#endif
diff -urN d:\Devel\BP\DosBoxXDS510\downloads\dosbox-0.65.tar\dosbox-0.65/src/hardware/xds510_io.c c:\MinGW\projects\dosbox-0.65/src/hardware/xds510_io.c
--- d:\Devel\BP\DosBoxXDS510\downloads\dosbox-0.65.tar\dosbox-0.65/src/hardware/xds510_io.c 1970-01-01 01:00:00.000000000 +0100
+++ c:\MinGW\projects\dosbox-0.65/src/hardware/xds510_io.c 2006-07-07 17:53:54.975051900 +0200
@@ -0,0 +1,150 @@
+/*
+ * 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.
+ * */
+
+#include <stdio.h>
+//#include <sys/io.h>
+#include "xds510_io.h"
+
+static int baseport = -1;
+
+static unsigned short xdefault_state = 0x10;
+static unsigned char xtdi = 0x1;
+static unsigned char xtck = 0x2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -