Skip to content

Commit

Permalink
VAX: Mask QBus addresses to 22 bits for ka630/ka65x
Browse files Browse the repository at this point in the history
  • Loading branch information
crwolff authored and pkoning2 committed Sep 4, 2024
1 parent 4b73c8d commit 0e83a37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 4 additions & 4 deletions VAX/vax630_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ int32 Map_ReadB (uint32 ba, int32 bc, uint8 *buf)
int32 i;
uint32 ma, dat;

ba = ba & 0x00FFFFFF;
ba = ba & QBMAMASK;
if ((ba | bc) & 03) { /* check alignment */
for (i = ma = 0; i < bc; i++, buf++) { /* by bytes */
if ((ma & VA_M_OFF) == 0) { /* need map? */
Expand Down Expand Up @@ -652,7 +652,7 @@ int32 Map_ReadW (uint32 ba, int32 bc, uint16 *buf)
int32 i;
uint32 ma,dat;

ba = ba & 0x00FFFFFE;
ba = ba & QBMAMASK & ~01;
bc = bc & ~01;
if ((ba | bc) & 03) { /* check alignment */
for (i = ma = 0; i < bc; i = i + 2, buf++) { /* by words */
Expand Down Expand Up @@ -684,7 +684,7 @@ int32 Map_WriteB (uint32 ba, int32 bc, const uint8 *buf)
int32 i;
uint32 ma, dat;

ba = ba & 0x00FFFFFF;
ba = ba & QBMAMASK;
if ((ba | bc) & 03) { /* check alignment */
for (i = ma = 0; i < bc; i++, buf++) { /* by bytes */
if ((ma & VA_M_OFF) == 0) { /* need map? */
Expand Down Expand Up @@ -717,7 +717,7 @@ int32 Map_WriteW (uint32 ba, int32 bc, const uint16 *buf)
int32 i;
uint32 ma, dat;

ba = ba & 0x00FFFFFE;
ba = ba & QBMAMASK & ~01;
bc = bc & ~01;
if ((ba | bc) & 03) { /* check alignment */
for (i = ma = 0; i < bc; i = i + 2, buf++) { /* by words */
Expand Down
12 changes: 10 additions & 2 deletions VAX/vax_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@

#define QB_VEC_MASK 0x1FC /* Interrupt Vector value mask */

/* Qbus memory space */

#define QBMAWIDTH 22 /* Qmem addr width */
#define QBMSIZE (1u << QBMAWIDTH) /* Qmem length */
#define QBMAMASK (QBMSIZE - 1) /* Qmem addr mask */

int32 int_req[IPL_HLVL] = { 0 }; /* intr, IPL 14-17 */
int32 int_vec_set[IPL_HLVL][32] = { 0 }; /* bits to set in vector */
int32 cq_scr = 0; /* SCR */
Expand Down Expand Up @@ -765,6 +771,7 @@ int32 Map_ReadB (uint32 ba, int32 bc, uint8 *buf)
int32 i;
uint32 ma, dat;

ba = ba & QBMAMASK;
if ((ba | bc) & 03) { /* check alignment */
for (i = ma = 0; i < bc; i++, buf++) { /* by bytes */
if ((ma & VA_M_OFF) == 0) { /* need map? */
Expand Down Expand Up @@ -797,7 +804,7 @@ int32 Map_ReadW (uint32 ba, int32 bc, uint16 *buf)
int32 i;
uint32 ma,dat;

ba = ba & ~01;
ba = ba & QBMAMASK & ~01;
bc = bc & ~01;
if ((ba | bc) & 03) { /* check alignment */
for (i = ma = 0; i < bc; i = i + 2, buf++) { /* by words */
Expand Down Expand Up @@ -829,6 +836,7 @@ int32 Map_WriteB (uint32 ba, int32 bc, const uint8 *buf)
int32 i;
uint32 ma, dat;

ba = ba & QBMAMASK;
if ((ba | bc) & 03) { /* check alignment */
for (i = ma = 0; i < bc; i++, buf++) { /* by bytes */
if ((ma & VA_M_OFF) == 0) { /* need map? */
Expand Down Expand Up @@ -861,7 +869,7 @@ int32 Map_WriteW (uint32 ba, int32 bc, const uint16 *buf)
int32 i;
uint32 ma, dat;

ba = ba & ~01;
ba = ba & QBMAMASK & ~01;
bc = bc & ~01;
if ((ba | bc) & 03) { /* check alignment */
for (i = ma = 0; i < bc; i = i + 2, buf++) { /* by words */
Expand Down

0 comments on commit 0e83a37

Please sign in to comment.