Rename flp/mdv display name

Helpful tips and guides, also new users can ask for help here.
User avatar
pjw
QL Wafer Drive
Posts: 1315
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Rename flp/mdv display name

Post by pjw »

dilwyn wrote: Fri May 12, 2023 11:23 am <>
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!
blogtrottr_code.jpg
The same happens with the RSS email version. I mentioned this problem a couple of times in the beginning but to no avail.
dilwyn wrote: Fri May 12, 2023 11:23 am 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)?
SMSQmulator runs under many other systems than Windows, so I dont see why it should.
dilwyn wrote: Fri May 12, 2023 11:23 am 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?
Yes, its possible to trash a disk using direct sector access. However, the ancestry of this code comes out of the pre-nineties and personally Ive never had a problem doing it this way (although I cant remember whether the letter after *d2 is important. With hard disks too you use *d2d). Basically it should work with all systems that use TT-derived drivers.


Per
dont be happy. worry
- ?
User avatar
pjw
QL Wafer Drive
Posts: 1315
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Rename flp/mdv display name

Post by pjw »

XorA wrote: Fri May 12, 2023 1:27 pm
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
Sure but this code should work just as well with real hardware. And you dont need to know anything about floppies to use it. For example a hex editor wont tell the user that the name must be limited to ten char..


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

Re: Rename flp/mdv display name

Post by Sparrowhawk »

I wasn't expecting this question to blow up like it has, but I'm glad it has! :D
Fascinating stuff. Thanks everyone.


a.k.a. Jean-Yves
User avatar
pjw
QL Wafer Drive
Posts: 1315
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Rename flp/mdv display name

Post by pjw »

pjw wrote: Fri May 12, 2023 1:56 pm
XorA wrote: Fri May 12, 2023 1:27 pm
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
Sure but this code should work just as well with real hardware. And you dont need to know anything about floppies to use it. For example a hex editor wont tell the user that the name must be limited to ten char..
I just cant help myself when Im having fun! :)
Virtual disks are another matter. They can be treated like just any ordinary file. The code below is a no-nonsense routine to rename virtual QL5-type floppy files of any density - S, D, H, and E. The usual caveats and precautions apply!

Code: Select all

100 REMark Rename virtual QL5-type floppy of any density
110 :
120 ERT  VirtualFlpRen("dos1_tmp_flpE.img", "New name")
130 PRINT 'Done!'
140 :
150 DEFine FuNction VirtualFlpRen(filename$, newname$)
160 LOCal ch, n$(10)
170 ch = FOPEN(filename$): IF ch < 0: RETurn ch
180 IF FLEN(#ch) < 1024: CLOSE#ch: RETurn -16
190 :
200 BGET#ch; n$(1 TO 4): n$(0) = 4
210 IF n$ <> 'QL5A' AND n$ <> 'QL5B' THEN
220  CLOSE#ch: RETurn -19
230 END IF
240 :
250 n$ = newname$ & FILL$(" ", 10): REMark Pad to 10 char, if needed
260 BPUT#ch\ 4, n$
270 CLOSE#ch: RETurn 0
280 END DEFine VirtualFlpRen
290 :
Just take care you dont try to mount an Extended virtual floppy into QPC2 with the built-in driver: It crashes the system!
To use Extended virtual floppies in QPC2 and SMSQmulator you could try Martin Head's FDI floppy driver (from Dr Dilwyn's). That allows you to create, format and use virtual drives of all "legal" densities.


Per
dont be happy. worry
- ?
Post Reply