Skip to content

Commit 2e5b0d5

Browse files
committed
Generalized the sim_disk layer to support large file disk devices (simh, VHD and RAW formats) with out requiring USE_ADDR64, and enhanced the pdp11_rq device to use this capability.
1 parent 60e8558 commit 2e5b0d5

File tree

10 files changed

+145
-128
lines changed

10 files changed

+145
-128
lines changed

AltairZ80/sim_imd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ t_stat sectRead(DISK_INFO *myDisk,
543543

544544
DBG_PRINT(("Reading C:%d/H:%d/S:%d, len=%d, offset=0x%08x" NLP, Cyl, Head, Sector, buflen, sectorFileOffset));
545545

546-
sim_fseek(myDisk->file, sectorFileOffset-1, 0);
546+
sim_fseek(myDisk->file, sectorFileOffset-1, SEEK_SET);
547547

548548
sectRecordType = fgetc(myDisk->file);
549549
switch(sectRecordType) {
@@ -642,7 +642,7 @@ t_stat sectWrite(DISK_INFO *myDisk,
642642

643643
sectorFileOffset = myDisk->track[Cyl][Head].sectorOffsetMap[Sector-start_sect];
644644

645-
sim_fseek(myDisk->file, sectorFileOffset-1, 0);
645+
sim_fseek(myDisk->file, sectorFileOffset-1, SEEK_SET);
646646

647647
if (*flags & IMD_DISK_IO_ERROR_GENERAL) {
648648
sectRecordType = SECT_RECORD_UNAVAILABLE;

PDP11/pdp11_rq.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ struct drvtyp {
654654
d##_GPC, d##_XBN, d##_DBN, d##_LBN, \
655655
d##_RCTS, d##_RCTC, d##_RBN, d##_MOD, \
656656
d##_MED, d##_FLGS
657-
#define RQ_SIZE(d) (d##_LBN * RQ_NUMBY)
657+
#define RQ_SIZE(d) d##_LBN
658658

659659
static struct drvtyp drv_tab[] = {
660660
{ RQ_DRV (RX50), "RX50" },
@@ -1011,7 +1011,7 @@ DEVICE rq_dev = {
10111011
RQ_NUMDR + 2, DEV_RDX, T_ADDR_W, 2, DEV_RDX, 16,
10121012
NULL, NULL, &rq_reset,
10131013
&rq_boot, &rq_attach, &rq_detach,
1014-
&rq_dib, DEV_DISABLE | DEV_UBUS | DEV_QBUS | DEV_DEBUG | DEV_DISK,
1014+
&rq_dib, DEV_DISABLE | DEV_UBUS | DEV_QBUS | DEV_DEBUG | DEV_DISK | DEV_SECTORS,
10151015
0, rq_debug, NULL, NULL, &rq_help, NULL, NULL,
10161016
&rq_description
10171017
};
@@ -1086,7 +1086,7 @@ DEVICE rqb_dev = {
10861086
RQ_NUMDR + 2, DEV_RDX, T_ADDR_W, 2, DEV_RDX, 16,
10871087
NULL, NULL, &rq_reset,
10881088
&rq_boot, &rq_attach, &rq_detach,
1089-
&rqb_dib, DEV_DISABLE | DEV_DIS | DEV_UBUS | DEV_QBUS | DEV_DEBUG | DEV_DISK,
1089+
&rqb_dib, DEV_DISABLE | DEV_DIS | DEV_UBUS | DEV_QBUS | DEV_DEBUG | DEV_DISK | DEV_SECTORS,
10901090
0, rq_debug, NULL, NULL, &rq_help, NULL, NULL,
10911091
&rq_description
10921092
};
@@ -1161,7 +1161,7 @@ DEVICE rqc_dev = {
11611161
RQ_NUMDR + 2, DEV_RDX, T_ADDR_W, 2, DEV_RDX, 16,
11621162
NULL, NULL, &rq_reset,
11631163
&rq_boot, &rq_attach, &rq_detach,
1164-
&rqc_dib, DEV_DISABLE | DEV_DIS | DEV_UBUS | DEV_QBUS | DEV_DEBUG | DEV_DISK,
1164+
&rqc_dib, DEV_DISABLE | DEV_DIS | DEV_UBUS | DEV_QBUS | DEV_DEBUG | DEV_DISK | DEV_SECTORS,
11651165
0, rq_debug, NULL, NULL, &rq_help, NULL, NULL,
11661166
&rq_description
11671167
};
@@ -1236,7 +1236,7 @@ DEVICE rqd_dev = {
12361236
RQ_NUMDR + 2, DEV_RDX, T_ADDR_W, 2, DEV_RDX, 16,
12371237
NULL, NULL, &rq_reset,
12381238
&rq_boot, &rq_attach, &rq_detach,
1239-
&rqd_dib, DEV_DISABLE | DEV_DIS | DEV_UBUS | DEV_QBUS | DEV_DEBUG | DEV_DISK,
1239+
&rqd_dib, DEV_DISABLE | DEV_DIS | DEV_UBUS | DEV_QBUS | DEV_DEBUG | DEV_DISK | DEV_SECTORS,
12401240
0, rq_debug, NULL, NULL, &rq_help, NULL, NULL,
12411241
&rq_description
12421242
};
@@ -1915,7 +1915,7 @@ int32 rq_rw_valid (MSC *cp, int32 pkt, UNIT *uptr, uint32 cmd)
19151915
uint32 dtyp = GET_DTYPE (uptr->flags); /* get drive type */
19161916
uint32 lbn = GETP32 (pkt, RW_LBNL); /* get lbn */
19171917
uint32 bc = GETP32 (pkt, RW_BCL); /* get byte cnt */
1918-
uint32 maxlbn = (uint32) (uptr->capac / RQ_NUMBY); /* get max lbn */
1918+
uint32 maxlbn = (uint32)uptr->capac; /* get max lbn */
19191919

19201920
if ((uptr->flags & UNIT_ATT) == 0) /* not attached? */
19211921
return (ST_OFL | SB_OFL_NV); /* offl no vol */
@@ -2549,7 +2549,7 @@ return;
25492549
void rq_putr_unit (MSC *cp, int32 pkt, UNIT *uptr, uint32 lu, t_bool all)
25502550
{
25512551
uint32 dtyp = GET_DTYPE (uptr->flags); /* get drive type */
2552-
uint32 maxlbn = (uint32) (uptr->capac / RQ_NUMBY); /* get max lbn */
2552+
uint32 maxlbn = (uint32)uptr->capac; /* get max lbn */
25532553

25542554
sim_debug (DBG_TRC, rq_devmap[cp->cnum], "rq_putr_unit\n");
25552555

@@ -2723,7 +2723,7 @@ if (cptr) {
27232723
drv_tab[val].lbn = cap;
27242724
}
27252725
uptr->flags = (uptr->flags & ~UNIT_DTYPE) | (val << UNIT_V_DTYPE);
2726-
uptr->capac = ((t_addr) drv_tab[val].lbn) * RQ_NUMBY;
2726+
uptr->capac = (t_addr)drv_tab[val].lbn;
27272727
return SCPE_OK;
27282728
}
27292729

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
RQ has new disk types: RC25, RCF25, RA80
2121
RQ device has a settable controller type (RQDX3, UDA50, KLESI, RUX50)
2222
RQ disks default to Autosize without regard to disk type
23+
RQ disks on PDP11 can have RAUSER size beyond 2GB
2324
DMC11 DDCMP DECnet device simulation from Rob Jarratt. Up to 4 DMC11 devices are supported.
2425
DZ on Unibus systems can have up to 256 ports (default of 32), on
2526
Qbus systems 128 port limit (default of 16).

scp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2710,6 +2710,10 @@ t_addr mval = kval * kval;
27102710
t_addr psize = uptr->capac;
27112711
char scale, width;
27122712

2713+
if (dptr->flags & DEV_SECTORS) {
2714+
kval = kval / 512;
2715+
mval = mval / 512;
2716+
}
27132717
if ((dptr->dwidth / dptr->aincr) > 8)
27142718
width = 'W';
27152719
else width = 'B';
@@ -2753,7 +2757,6 @@ if (flag) {
27532757
fprintf (st, "\n\t\t%s", sim_snet);
27542758
idle_capable = sim_timer_idle_capable (&os_tick_size);
27552759
fprintf (st, "\n\t\tIdle/Throttling support is %savailable", ((idle_capable == 0) ? "NOT " : ""));
2756-
fprintf (st, "\n\t\t%s", sim_taddr_64 ? "Large File (>2GB) support" : "No Large File support");
27572760
if (sim_disk_vhd_support())
27582761
fprintf (st, "\n\t\tVirtual Hard Disk (VHD) support");
27592762
if (sim_disk_raw_support())
@@ -2770,6 +2773,7 @@ if (flag) {
27702773
fprintf (st, "\n\tHost Platform:");
27712774
fprintf (st, "\n\t\tMemory Access: %s Endian", sim_end ? "Little" : "Big");
27722775
fprintf (st, "\n\t\tMemory Pointer Size: %d bits", (int)sizeof(dptr)*8);
2776+
fprintf (st, "\n\t\t%s", sim_toffset_64 ? "Large File (>2GB) support" : "No Large File support");
27732777
#if defined(__VMS)
27742778
fprintf (st, "\n\t\tOS: VMS");
27752779
#elif defined(_WIN32)

sim_defs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ struct sim_device {
358358
#define DEV_V_DEBUG 3 /* debug capability */
359359
#define DEV_V_TYPE 4 /* Attach type */
360360
#define DEV_S_TYPE 3 /* Width of Type Field */
361+
#define DEV_V_SECTORS 7 /* Unit Capacity is in 512byte sectors */
361362
#define DEV_V_UF_31 12 /* user flags, V3.1 */
362363
#define DEV_V_UF 16 /* user flags */
363364
#define DEV_V_RSV 31 /* reserved */
@@ -366,6 +367,7 @@ struct sim_device {
366367
#define DEV_DISABLE (1 << DEV_V_DISABLE) /* device is currently disabled */
367368
#define DEV_DYNM (1 << DEV_V_DYNM) /* device requires call on msize routine to change memory size */
368369
#define DEV_DEBUG (1 << DEV_V_DEBUG) /* device supports SET DEBUG command */
370+
#define DEV_SECTORS (1 << DEV_V_SECTORS) /* capacity is 512 byte sectors */
369371
#define DEV_NET 0 /* Deprecated - meaningless */
370372

371373

0 commit comments

Comments
 (0)