VOGONS


First post, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

DOS shows volume labels as part of the DIR command. I've been interested in seeing if DOSBox could show them that way as well, so I poked at the 0.74 source code a bit and added/changed the following:

shell_cmds.cpp:

/* Command uses dta so set it to our internal dta */ RealPt save_dta=dos.dta(); dos.dta(dos.tables.tempdta); DOS_DTA dta(dos. […]
Show full quote

/* Command uses dta so set it to our internal dta */
RealPt save_dta=dos.dta();
dos.dta(dos.tables.tempdta);
DOS_DTA dta(dos.dta());
bool ret=DOS_FindFirst(args,0xffff);// & ~DOS_ATTR_VOLUME);

if (!ret) {
if (!optB) WriteOut(MSG_Get("SHELL_CMD_FILE_NOT_FOUND"),args);
dos.dta(save_dta);
return;
}

do { /* File name and extension */
char name[DOS_NAMELENGTH_ASCII];Bit32u size;Bit16u date;Bit16u time;Bit8u attr;
dta.GetResult(name,size,date,time,attr);

if(attr&DOS_ATTR_VOLUME) {
if(!optB) {
if(strlen(name) > 0) {
WriteOut(MSG_Get("SHELL_CMD_DIR_LABEL"), path[0], name);
} else {
WriteOut(MSG_Get("SHELL_CMD_DIR_NOLABEL"), path[0]);
}
}
continue;
}

/* Skip non-directories if option AD is present */
if(optAD && !(attr&DOS_ATTR_DIRECTORY) ) continue;

shell.cpp:

MSG_Add("SHELL_CMD_DIR_INTRO","Directory of %s.\n"); MSG_Add("SHELL_CMD_DIR_LABEL","Volume in drive %c is %s.\n"); MSG_Add("SH […]
Show full quote

MSG_Add("SHELL_CMD_DIR_INTRO","Directory of %s.\n");
MSG_Add("SHELL_CMD_DIR_LABEL","Volume in drive %c is %s.\n");
MSG_Add("SHELL_CMD_DIR_NOLABEL","Volume in drive %c has no label.\n");

MSG_Add("SHELL_CMD_DIR_BYTES_USED","%5d File(s) %17s Bytes.\n");

It sort of works as a hack, but there are a lot of issues:
- Volume label is output after pathname, while in real DOS it's the other way around.
- Label is shown for directories MOUNTed with no parameters or with -t floppy, but not -t cdrom.
- Label is shown for IMGMOUNTed CD-ROM image files, but seems to be displayed as an 8.3 filename.
- Label is not shown for IMGMOUNTed floppy images.

On a somewhat unrelated note, it seems weird that IMGMOUNT takes a -label argument in conjunction with -t iso, but when you try to use -label with -t floppy you get a nonsensical "Image file not found." message from DOSBox.

Reply 1 of 2, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The attached patch performs a separate search for the volume label. Could also make a VOL command with a similar approach.

Attachments

  • Filename
    dir_volume.diff
    File size
    2.07 KiB
    Downloads
    535 downloads
    File license
    Fair use/fair dealing exception

Reply 2 of 2, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I was thinking of having mount print the volume label if you call it without parameters.

Water flows down the stream
How to ask questions the smart way!