mirror of
https://github.com/simh/simh.git
synced 2026-05-05 23:34:21 +00:00
3b2: STRCPY fix, CTC and NI cleanup
- The previous fix for STRCPY introduced a new bug. STRCPY must always copy the final NULL terminator of the string, but must NOT increment the source or destination pointers for the NULL terminator. - The CTC simulation did not correctly support streaming mode, which can in some cases request reads that are not on 512-byte block boundaries. - To begin to support System V Release 4 UNIX, the NI card (called EMD under SVR4) needed to support several more CRC codes for pump code.
This commit is contained in:
@@ -2127,6 +2127,11 @@ t_stat sim_instr(void)
|
||||
break;
|
||||
case BRB:
|
||||
pc_incr = sign_extend_b(dst->embedded.b);
|
||||
/* BRB is commonly used to halt the processor in a tight
|
||||
* infinite loop. */
|
||||
if (pc_incr == 0) {
|
||||
stop_reason = STOP_LOOP;
|
||||
}
|
||||
break;
|
||||
case BSBH:
|
||||
cpu_push_word(R[NUM_PC] + pc_incr);
|
||||
@@ -2554,7 +2559,7 @@ t_stat sim_instr(void)
|
||||
}
|
||||
break;
|
||||
case STREND:
|
||||
while (read_b(R[0], ACC_AF) != 0) {
|
||||
while (read_b(R[0], ACC_AF) != '\0') {
|
||||
R[0]++;
|
||||
}
|
||||
break;
|
||||
@@ -2907,7 +2912,6 @@ t_stat sim_instr(void)
|
||||
pc_incr = 0;
|
||||
break;
|
||||
case SPOP:
|
||||
sim_debug(TRACE_DBG, &cpu_dev, "SPOP\n");
|
||||
/* Memory fault is signaled when no support processor is
|
||||
active */
|
||||
if (mau_broadcast(coprocessor_word, 0, 0) != SCPE_OK) {
|
||||
@@ -2917,7 +2921,6 @@ t_stat sim_instr(void)
|
||||
case SPOPD2:
|
||||
case SPOPS2:
|
||||
case SPOPT2:
|
||||
sim_debug(TRACE_DBG, &cpu_dev, "SPOP{D|S|T}2\n");
|
||||
a = cpu_effective_address(src1);
|
||||
b = cpu_effective_address(dst);
|
||||
if (mau_broadcast(coprocessor_word, a, b) != SCPE_OK) {
|
||||
@@ -2927,7 +2930,6 @@ t_stat sim_instr(void)
|
||||
case SPOPRD:
|
||||
case SPOPRS:
|
||||
case SPOPRT:
|
||||
sim_debug(TRACE_DBG, &cpu_dev, "SPOPR{D|S|T}\n");
|
||||
a = cpu_effective_address(src1);
|
||||
if (mau_broadcast(coprocessor_word, a, 0) != SCPE_OK) {
|
||||
cpu_abort(NORMAL_EXCEPTION, EXTERNAL_MEMORY_FAULT);
|
||||
@@ -2936,7 +2938,6 @@ t_stat sim_instr(void)
|
||||
case SPOPWD:
|
||||
case SPOPWS:
|
||||
case SPOPWT:
|
||||
sim_debug(TRACE_DBG, &cpu_dev, "SPOPW{D|S|T}\n");
|
||||
a = cpu_effective_address(dst);
|
||||
if (mau_broadcast(coprocessor_word, 0, a) != SCPE_OK) {
|
||||
cpu_abort(NORMAL_EXCEPTION, EXTERNAL_MEMORY_FAULT);
|
||||
@@ -3017,9 +3018,16 @@ t_stat sim_instr(void)
|
||||
R[NUM_FP] = R[NUM_SP];
|
||||
break;
|
||||
case STRCPY:
|
||||
a = 0;
|
||||
while ((a = read_b(R[0], ACC_AF)) != '\0') {
|
||||
/* The STRCPY instruction will always copy the NULL
|
||||
* terminator of a string. However, copying the NULL
|
||||
* terminator never increments the source or destination
|
||||
* pointer! */
|
||||
while (1) {
|
||||
a = read_b(R[0], ACC_AF);
|
||||
write_b(R[1], (uint8) a);
|
||||
if (a == '\0') {
|
||||
break;
|
||||
}
|
||||
R[0]++;
|
||||
R[1]++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user