1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-02-27 00:59:57 +00:00

Sim_card: Fixed errors in processing of CBN & BCD format.

This commit is contained in:
Richard Cornwell
2017-06-11 21:50:00 -04:00
parent 5e5ea995cb
commit 3b05584b76
2 changed files with 16 additions and 11 deletions

View File

@@ -3894,20 +3894,21 @@ cpu_set_size(UNIT * uptr, int32 val, CONST char *cptr, void *desc)
{
t_uint64 mc = 0;
uint32 i;
int32 v;
v = val >> UNIT_V_MSIZE;
v = (v + 1) * 4096;
if ((v < 0) || (v > MAXMEMSIZE))
return SCPE_ARG;
for (i = v-1; i < MEMSIZE; i++)
mc |= M[i];
if ((mc != 0) && (!get_yn("Really truncate memory [N]?", FALSE)))
return SCPE_OK;
cpu_unit[0].flags &= ~UNIT_MSIZE;
cpu_unit[0].flags |= val;
cpu_unit[1].flags &= ~UNIT_MSIZE;
cpu_unit[1].flags |= val;
val >>= UNIT_V_MSIZE;
val = (val + 1) * 4096;
if ((val < 0) || (val > MAXMEMSIZE))
return SCPE_ARG;
for (i = val; i < MEMSIZE; i++)
mc |= M[i];
if ((mc != 0) && (!get_yn("Really truncate memory [N]?", FALSE)))
return SCPE_OK;
MEMSIZE = val;
MEMSIZE = v;
for (i = MEMSIZE; i < MAXMEMSIZE; i++)
M[i] = 0;
return SCPE_OK;

View File

@@ -708,7 +708,9 @@ sim_read_card(UNIT * uptr)
case MODE_CBN:
sim_debug(DEBUG_CARD, dptr, "cbn\n");
/* Check if first character is a tape mark */
if (size == 1 && ((uint8)data->cbuff[0]) == 0217) {
if (((uint8)data->cbuff[0]) == 0217 &&
(size == 1 || (((uint8)data->cbuff[0]) & 0200) != 0)) {
i = 1;
r = SCPE_EOF;
break;
}
@@ -748,7 +750,9 @@ sim_read_card(UNIT * uptr)
case MODE_BCD:
sim_debug(DEBUG_CARD, dptr, "bcd [");
/* Check if first character is a tape mark */
if (size == 1 && ((uint8)data->cbuff[0]) == 0217) {
if (((uint8)data->cbuff[0]) == 0217 &&
(size == 1 || (((uint8)data->cbuff[0]) & 0200) != 0)) {
i = 1;
r = SCPE_EOF;
break;
}