Rename flp/mdv display name

Helpful tips and guides, also new users can ask for help here.
User avatar
Sparrowhawk
Super Gold Card
Posts: 652
Joined: Wed Dec 15, 2010 12:33 pm
Location: @131072
Contact:

Rename flp/mdv display name

Post by Sparrowhawk »

I used to know the answer to this, but time passes... Can I rename a disk/mdv display label without formatting it? if so how?

Thanks


a.k.a. Jean-Yves
Martin_Head
Aurora
Posts: 854
Joined: Tue Dec 17, 2013 1:17 pm

Re: Rename flp/mdv display name

Post by Martin_Head »

On a floppy, you could probably use direct sector access to read and edit just the first sector. But I think your stuck with a microdrive , as the medium name appears in every sector header.


User avatar
pjw
QL Wafer Drive
Posts: 1316
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Rename flp/mdv display name

Post by pjw »

RUN this in a S*BASIC console. The code is the manual! Take appropriate precautions. Use at own risk!

Code: Select all

100 CLS
110 PRINT 'Floppy disk renamer'
120 REMark On your head be it!
130 :
140 dsk$ = 'flp1_':                     REMark Alter to taste!
150 er = FTEST(dsk$)
160 IF er < 0: PRINT 'Disk error!': ERT er
170 :
180 IF DMEDIUM_TYPE(\ dsk$) <> 1 THEN
190  PRINT 'Not a floppy disk!': ERT -19
200 END IF
210 :
220 d = DMEDIUM_DENSITY(\ dsk$)
230 SELect ON d
240  = 1: dc = FOPEN(dsk$ & '*d2d')
250  = 2: dc = FOPEN(dsk$ & '*d2h')
260  = 3: dc = FOPEN(dsk$ & '*d2e')
270  = REMAINDER :PRINT 'Density not recognised!'
280    ERT -19
290 END SELect
300 IF dc < 0: PRINT 'Error opening disk!': ERT dc
310 :
320 GET#dc\ 1; a$
330 :
340 DIM n$(10)
350 n$ = a$(1 TO 4)
360 IF n$ <> 'QL5A' AND n$ <> 'QL5B' THEN
370  PRINT "Don't know about"! n$! 'disks!'
380  CLOSE#dc: ERT -19
390 END IF
400 :
410 PRINT 'Current name is:'! a$(5 TO 14)
420 INPUT 'Enter new name :'! n$
430 :
440 IF LEN(n$) = 0 THEN
450  PRINT 'Aborted!'
460  CLOSE#dc: ERT -1
470 END IF
480 :
490 n$ = n$ & FILL$(' ', 10)
500 :
510 a$(5 TO 14) = n$
520 PUT#dc\ 1; a$
530 CLOSE#dc
540 STAT dsk$
550 PRINT 'Done!'
560 :


Per
dont be happy. worry
- ?
User avatar
Sparrowhawk
Super Gold Card
Posts: 652
Joined: Wed Dec 15, 2010 12:33 pm
Location: @131072
Contact:

Re: Rename flp/mdv display name

Post by Sparrowhawk »

Thank you both.

With regards being careful, it's a disk image so i can take backups easily first.


a.k.a. Jean-Yves
martyn_hill
Aurora
Posts: 933
Joined: Sat Oct 25, 2014 9:53 am

Re: Rename flp/mdv display name

Post by martyn_hill »

Hi Jean-Ives

Just to reiterate Mr Head's reply regarding MDV volume name - as the sector-headers are only ever written once at point of formatting the cartridge and the volume name is only stored in the sector header, formatting is the only means to (re)write the volume name on MDV.

When I have hit that issue, I typically use the copy-off/reformat-with-a-new-volume-name/copy-back approach, which if you have the RAM driver that comes with the Trumpcard and, I believe Miracle's other brilliant extensions such as (S)Gold Card, can be made a bit less painful and more efficient. Details in the respective guides (see the FORMAT 'ramX_mdvY' syntax), if that is something you want to/haven't already tried :-)

Technically, it could be done with a custom-written extension to the low-level MDV driver, but timing is really tricky to overwrite an existing sector header without corrupting the following data block, and it's arguably more effort than using the above method for what is, after all, a 'cosmetic' issue :-)

Good luck!


User avatar
RalfR
Aurora
Posts: 872
Joined: Fri Jun 15, 2018 8:58 pm

Re: Rename flp/mdv display name

Post by RalfR »

To be honest....who really wants to rename an mdv_? It is more easier to copy all with the one you have mentioned, format it new and copy all back. That's the fastest way to do it.


4E75 7000
User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: Rename flp/mdv display name

Post by dilwyn »

There are a couple of disk renaming utilities on the Files page on my site. Look for Rename_Disk.zip and FLP_Renamer.zip


User avatar
pjw
QL Wafer Drive
Posts: 1316
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Rename flp/mdv display name

Post by pjw »

Re the code above: I just realised the DMEDIUM_xxxx commands are part of SMSQ/E, not TK2 as I had thought. On closer inspection it appears that a lot of the tests the code does is unnecessary anyway; they were originally part of a disk analyser program. This simple version should work safely in most cases, and the program, at least, is Qdos-compatible (with TK2):

Code: Select all

100 PRINT 'Simple floppy disk renamer'
110 REMark On your head be it!
120 :
130 dsk$ = 'flp1_':             REMark Set drive spec here
140 :
150 ch = FOPEN(dsk$ & "*d2d"):  REMark *d2d, *d2h, *d2e: all same?
160 ERT ch:                     REMark Retry with one of the above!
170 :
180 GET#ch\ 1; sec$
190 DIM n$(10)
200 n$ = sec$(1 TO 4)
210 IF n$ <> 'QL5A' AND n$ <> 'QL5B' THEN
220  PRINT "Don't know about"! n$! 'disks'
230  CLOSE#ch: ERT -19
240 END IF
250 :
260 PRINT 'Current name is:'! sec$(5 TO 14)
270 INPUT 'Enter new name:'! n$
280 IF n$ = '' THEN
290  CLOSE#ch: PRINT 'Aborted': ERT -1
300 END IF
310 :
320 n$ = n$ & FILL$(" ", 10)
330 sec$( 5 TO 14) = n$
340 PUT#ch\ 1; sec$
350 CLOSE#ch
360 STAT dsk$
370 PRINT 'Done!'
380 :
I dont have any real hardware or disks to test on, but on QPC2 and SMSQmulator it appears you can open any current QL5-type floppy for sector access with any *d2x parameter. Ie *d2d, *d2h, or *d2e makes no difference. (Please let us know if you discover otherwise!)
The inbuilt floppy drivers in QPC2 and SMSQmulator can only handle DD and HD disks (I think), and with some hardware disk interfaces none of this will work, but at least it shouldnt do any harm.. However, sensible precautions are advised! (E&OE)


Per
dont be happy. worry
- ?
User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: Rename flp/mdv display name

Post by dilwyn »

pjw wrote: Fri May 12, 2023 10:24 am I dont have any real hardware or disks to test on, but on QPC2 and SMSQmulator it appears you can open any current QL5-type floppy for sector access with any *d2x parameter. Ie *d2d, *d2h, or *d2e makes no difference. (Please let us know if you discover otherwise!)
The inbuilt floppy drivers in QPC2 and SMSQmulator can only handle DD and HD disks (I think), and with some hardware disk interfaces none of this will work, but at least it shouldnt do any harm.. However, sensible precautions are advised! (E&OE)
This is how that chunk of code came out for me - I use Blogtrottr https://blogtrottr.com/ to deliver Forum posts to my email. I think it expects CR+LF at end of lines of CODE whereas the Forum only supplied one to the feeds. Not moaning, just had to scratch my head for a bit before I realised what was going on!
Blogtrootr CODE feed
Blogtrootr CODE feed
The differences with *d2X at least keep it compatible with older systems I suppose. Wonder if SMSQ/E just hands it to Windows drivers to do with as it will (haven't looked at the SMSQ/E sources to check)?

Per's warnings re use of software like this probably comes from experience like me. Trashed a couple of disks in my time tinkering with *d2d etc. Some years ago, I learned the hard way it was always wise to backup the disk before doing this type of thing. Wonder if there's any documentation out there to record where in the QL disk interface history this direct sector access facility came into being, i.e. effectively which interfaces don't support it?


User avatar
XorA
Site Admin
Posts: 1368
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Rename flp/mdv display name

Post by XorA »

Sparrowhawk wrote: Thu May 11, 2023 4:37 pm Thank you both.

With regards being careful, it's a disk image so i can take backups easily first.
So just use a hex editor :-D


Post Reply