From b7824943dfff95b14424903f847ea39322cd6fa8 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 31 Mar 2020 19:37:33 -0700 Subject: [PATCH] DISK: Minimize the sim_disk_pdp10_attach arguments to minimize aguments The sim_disk_pdp10_... API's specifically provide 1024 byte sector interfaces for 64bit data. Customize the attach help output to be more appropriate for the devices in the running simulator and the device who's help is being displayed. --- PDP10/pdp10_rp.c | 3 +- sim_disk.c | 120 +++++++++++++++++++++++++++++------------------ sim_disk.h | 4 +- 3 files changed, 78 insertions(+), 49 deletions(-) diff --git a/PDP10/pdp10_rp.c b/PDP10/pdp10_rp.c index 82dc32f6..56c9d8f1 100644 --- a/PDP10/pdp10_rp.c +++ b/PDP10/pdp10_rp.c @@ -1177,8 +1177,7 @@ t_stat r; static const char *drives[] = {"RM03", "RP04", "RM80", "RP06", "RM05", "RP07", NULL}; uptr->capac = drv_tab[GET_DTYPE (uptr->flags)].size; -r = sim_disk_pdp10_attach (uptr, cptr, RP_NUMWD * sizeof (d10), sizeof (d10), - (uptr->flags & UNIT_AUTO) == 0, DBG_DSK, +r = sim_disk_pdp10_attach (uptr, cptr, (uptr->flags & UNIT_AUTO) == 0, DBG_DSK, drv_tab[GET_DTYPE (uptr->flags)].name, 0, (uptr->flags & UNIT_AUTO) ? drives : NULL); if (r != SCPE_OK) diff --git a/sim_disk.c b/sim_disk.c index 99a4c561..38cc708f 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -2600,6 +2600,22 @@ return SCPE_OK; t_stat sim_disk_attach_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr) { +static struct example_fields { + const char *dname; + const char *dtype; + const char *dsize; + const char *dtype2; + const char *dsize2; + const char *dtype3; + const char *dsize3; + const char *dtype4; + const char *dsize4; + } ex_data[2] = { + {"RQ", "RD54", "159MB", "RX50", "409KB", "RA81", "456MB", "RA92", "1505MB"}, + {"RP", "autosize", "39MW", "autosize", "39MW", "RP07", "110MW", "RM03", "15MW"}, + }; +struct example_fields *ex = &ex_data[0]; + fprintf (st, "%s Disk Attach Help\n\n", dptr->name); fprintf (st, "Disk container files can be one of 3 different types:\n\n"); @@ -2676,54 +2692,68 @@ fprintf (st, " -M Merge a Differencing VHD into its parent VHD disk\ fprintf (st, " -O Override consistency checks when attaching differencing disks\n"); fprintf (st, " which have unexpected parent disk GUID or timestamps\n\n"); fprintf (st, " -U Fix inconsistencies which are overridden by the -O switch\n"); -fprintf (st, " -Y Answer Yes to prompt to overwrite last track (on disk create)\n"); -fprintf (st, " -N Answer No to prompt to overwrite last track (on disk create)\n"); +if (strstr (sim_name, "PDP10") == NULL) { + fprintf (st, " -Y Answer Yes to prompt to overwrite last track (on disk create)\n"); + fprintf (st, " -N Answer No to prompt to overwrite last track (on disk create)\n"); + } +if (strstr (sim_name, "PDP10-")) { + ex = &ex_data[1]; + ex->dname = "RPA"; + } +if (strcmp (dptr->name, "RP") == 0) + ex = &ex_data[1]; fprintf (st, "Examples:\n"); -fprintf (st, " sim> show rq\n"); -fprintf (st, " RQ, address=20001468-2000146B*, no vector, 4 units\n"); -fprintf (st, " RQ0, 159MB, not attached, write enabled, RD54, autosize, SIMH format\n"); -fprintf (st, " RQ1, 159MB, not attached, write enabled, RD54, autosize, SIMH format\n"); -fprintf (st, " RQ2, 159MB, not attached, write enabled, RD54, autosize, SIMH format\n"); -fprintf (st, " RQ3, 409KB, not attached, write enabled, RX50, autosize, SIMH format\n"); -fprintf (st, " sim> atta rq0 RA81.vhd\n"); -fprintf (st, " sim> show rq0\n"); -fprintf (st, " RQ0, 456MB, attached to RA81.vhd, write enabled, RA81, autosize, VHD format\n"); -fprintf (st, " sim> set rq2 ra92\n"); -fprintf (st, " sim> att rq2 -f vhd RA92.vhd\n"); -fprintf (st, " RQ2: creating new file\n"); -fprintf (st, " sim> sho rq2\n"); -fprintf (st, " RQ2, 1505MB, attached to RA92.vhd, write enabled, RA92, autosize, VHD format\n"); -fprintf (st, " sim> dir RA92.vhd\n"); +fprintf (st, " sim> show %s\n", ex->dname); +fprintf (st, " %s, address=20001468-2000146B*, no vector, 4 units\n", ex->dname); +fprintf (st, " %s0, %s, not attached, write enabled, %s, autosize, SIMH format\n", ex->dname, ex->dsize, ex->dtype); +fprintf (st, " %s1, %s, not attached, write enabled, %s, autosize, SIMH format\n", ex->dname, ex->dsize, ex->dtype); +fprintf (st, " %s2, %s, not attached, write enabled, %s, autosize, SIMH format\n", ex->dname, ex->dsize, ex->dtype); +fprintf (st, " %s3, %s, not attached, write enabled, %s, autosize, SIMH format\n", ex->dname, ex->dsize2, ex->dtype2); +fprintf (st, " sim> # attach an existing VHD and determine its size and type automatically\n"); +fprintf (st, " sim> attach %s0 %s.vhd\n", ex->dname, ex->dtype3); +fprintf (st, " sim> show %s0\n", ex->dname); +fprintf (st, " %s0, %s, attached to %s.vhd, write enabled, %s, autosize, VHD format\n", ex->dname, ex->dsize3, ex->dtype3, ex->dtype3); +fprintf (st, " sim> # create a new %s drive type VHD\n", ex->dtype4); +fprintf (st, " sim> set %s2 %s\n", ex->dname, ex->dtype4); +fprintf (st, " sim> attach %s2 -f vhd %s.vhd\n", ex->dname, ex->dtype4); +fprintf (st, " %s2: creating new file\n", ex->dname); +fprintf (st, " sim> show %s2\n", ex->dname); +fprintf (st, " %s2, %s, attached to %s.vhd, write enabled, %s, autosize, VHD format\n", ex->dname, ex->dsize4, ex->dtype4, ex->dtype4); +fprintf (st, " sim> # examine the size consumed by the %s VHD file", ex->dsize4); +fprintf (st, " sim> dir %s.vhd\n", ex->dtype4); fprintf (st, " Directory of H:\\Data\n\n"); -fprintf (st, " 04/14/2011 12:57 PM 5,120 RA92.vhd\n"); +fprintf (st, " 04/14/2011 12:57 PM 5,120 %s.vhd\n", ex->dtype4); fprintf (st, " 1 File(s) 5,120 bytes\n"); -fprintf (st, " sim> atta rq3 -d RA92-1-Diff.vhd RA92.vhd\n"); -fprintf (st, " sim> atta rq3 -c RA92-1.vhd RA92.vhd\n"); -fprintf (st, " RQ3: creating new virtual disk 'RA92-1.vhd'\n"); -fprintf (st, " RQ3: Copied 1505MB. 99%% complete.\n"); -fprintf (st, " RQ3: Copied 1505MB. Done.\n"); -fprintf (st, " sim> sh rq3\n"); -fprintf (st, " RQ3, 1505MB, attached to RA92-1.vhd, write enabled, RA92, autosize, VHD format\n"); -fprintf (st, " sim> dir RA92*\n"); +fprintf (st, " sim> # create a differencing vhd (%s-1-Diff.vhd) with %s.vhd as parent\n", ex->dtype4, ex->dtype4); +fprintf (st, " sim> attach %s3 -d %s-1-Diff.vhd %s.vhd\n", ex->dname, ex->dtype4, ex->dtype4); +fprintf (st, " sim> # create a VHD (%s-1.vhd) which is a copy of an existing disk\n", ex->dtype4); +fprintf (st, " sim> attach %s3 -c %s-1.vhd %s.vhd\n", ex->dname, ex->dtype4, ex->dtype4); +fprintf (st, " %s3: creating new virtual disk '%s-1.vhd'\n", ex->dname, ex->dsize4); +fprintf (st, " %s3: Copied %s. 99%% complete.\n", ex->dname, ex->dsize4); +fprintf (st, " %s3: Copied %s. Done.\n", ex->dname, ex->dsize4); +fprintf (st, " sim> show %s3\n", ex->dname); +fprintf (st, " %s3, %s, attached to %s-1.vhd, write enabled, %s, autosize, VHD format\n", ex->dname, ex->dsize3, ex->dtype3, ex->dtype3); +fprintf (st, " sim> dir %s*\n", ex->dtype3); fprintf (st, " Directory of H:\\Data\n\n"); -fprintf (st, " 04/14/2011 01:12 PM 5,120 RA92-1.vhd\n"); -fprintf (st, " 04/14/2011 12:58 PM 5,120 RA92.vhd\n"); +fprintf (st, " 04/14/2011 01:12 PM 5,120 %s-1.vhd\n", ex->dtype3); +fprintf (st, " 04/14/2011 12:58 PM 5,120 %s.vhd\n", ex->dtype3); fprintf (st, " 2 File(s) 10,240 bytes\n"); -fprintf (st, " sim> sho rq2\n"); -fprintf (st, " RQ2, 1505MB, not attached, write enabled, RA92, autosize, VHD format\n"); -fprintf (st, " sim> set rq2 ra81\n"); -fprintf (st, " sim> set rq2 noauto\n"); -fprintf (st, " sim> sho rq2\n"); -fprintf (st, " RQ2, 456MB, not attached, write enabled, RA81, noautosize, VHD format\n"); -fprintf (st, " sim> set rq2 format=simh\n"); -fprintf (st, " sim> sho rq2\n"); -fprintf (st, " RQ2, 456MB, not attached, write enabled, RA81, noautosize, SIMH format\n"); -fprintf (st, " sim> atta rq2 -c RA81-Copy.vhd VMS055.dsk\n"); -fprintf (st, " RQ2: creating new virtual disk 'RA81-Copy.vhd'\n"); -fprintf (st, " RQ2: Copied 456MB. 99%% complete.\n"); -fprintf (st, " RQ2: Copied 456MB. Done.\n"); -fprintf (st, " sim> sho rq2\n"); -fprintf (st, " RQ2, 456MB, attached to RA81-Copy.vhd, write enabled, RA81, noautosize, VHD format\n"); +fprintf (st, " sim> show %s2\n", ex->dname); +fprintf (st, " %s2, %s, not attached, write enabled, %s, autosize, VHD format\n", ex->dname, ex->dsize4, ex->dtype4); +fprintf (st, " sim> set %s2 %s\n", ex->dname, ex->dtype3); +fprintf (st, " sim> set %s2 noauto\n", ex->dname); +fprintf (st, " sim> show %s2\n", ex->dname); +fprintf (st, " %s2, %s, not attached, write enabled, %s, noautosize, VHD format\n", ex->dname, ex->dsize3, ex->dtype3); +fprintf (st, " sim> set %s2 format=simh\n", ex->dname); +fprintf (st, " sim> show %s2\n", ex->dname); +fprintf (st, " %s2, %s, not attached, write enabled, %s, noautosize, SIMH format\n", ex->dname, ex->dsize3, ex->dtype3); +fprintf (st, " sim> # create a VHD from an existing SIMH format disk\n"); +fprintf (st, " sim> attach %s2 -c %s-Copy.vhd XYZZY.dsk\n", ex->dname, ex->dtype3); +fprintf (st, " %s2: creating new virtual disk '%s-Copy.vhd'\n", ex->dname, ex->dtype3); +fprintf (st, " %s2: Copied %s. 99%% complete.\n", ex->dname, ex->dsize3); +fprintf (st, " %s2: Copied %s. Done.\n", ex->dname, ex->dsize3); +fprintf (st, " sim> show %s2\n", ex->dname); +fprintf (st, " %s2, %s, attached to %s-Copy.vhd, write enabled, %s, noautosize, VHD format\n", ex->dname, ex->dsize3, ex->dtype3, ex->dtype3); return SCPE_OK; } @@ -2880,10 +2910,10 @@ if (sim_deb && (dptr->dctrl & reason)) { /* Guest specific Disk I/O support */ #define PDP10_SECTORS 2 /* PDP-10 sectors are 1024 bytes */ -t_stat sim_disk_pdp10_attach (UNIT *uptr, const char *cptr, size_t sector_size, size_t xfer_element_size, t_bool dontautosize, +t_stat sim_disk_pdp10_attach (UNIT *uptr, const char *cptr, t_bool dontautosize, uint32 dbit, const char *dtype, int completion_delay, const char **drivetypes) { -return sim_disk_attach_ex (uptr, cptr, sector_size / PDP10_SECTORS, xfer_element_size, dontautosize, dbit, dtype, 0, completion_delay, drivetypes); +return sim_disk_attach_ex (uptr, cptr, 512 * PDP10_SECTORS, sizeof (t_uint64), dontautosize, dbit, dtype, 0, completion_delay, drivetypes); } t_stat sim_disk_pdp10_rdsect (UNIT *uptr, t_lba lba, uint8 *buf, t_seccnt *sectsread, t_seccnt sects) diff --git a/sim_disk.h b/sim_disk.h index 9307b85b..e0a8db0d 100644 --- a/sim_disk.h +++ b/sim_disk.h @@ -97,8 +97,8 @@ t_bool sim_disk_vhd_support (void); t_bool sim_disk_raw_support (void); void sim_disk_data_trace (UNIT *uptr, const uint8 *data, size_t lba, size_t len, const char* txt, int detail, uint32 reason); t_stat sim_disk_test (DEVICE *dptr); -t_stat sim_disk_pdp10_attach (UNIT *uptr, const char *cptr, size_t sector_size, size_t xfer_element_size, t_bool dontautosize, - uint32 dbit, const char *dtype, int completion_delay, const char **drivetypes); +t_stat sim_disk_pdp10_attach (UNIT *uptr, const char *cptr, t_bool dontautosize, uint32 dbit, + const char *dtype, int completion_delay, const char **drivetypes); t_stat sim_disk_pdp10_rdsect (UNIT *uptr, t_lba lba, uint8 *buf, t_seccnt *sectsread, t_seccnt sects); t_stat sim_disk_pdp10_wrsect (UNIT *uptr, t_lba lba, uint8 *buf, t_seccnt *sectswritten, t_seccnt sects);