QPC2: How to set/change medium name for WINn_ ?

Discussion and advice about emulating the QL on other machines.
User avatar
ql_freak
Gold Card
Posts: 354
Joined: Sun Jan 18, 2015 1:29 am

QPC2: How to set/change medium name for WINn_ ?

Post by ql_freak »

How can I set the medium name when formatting a new WIN file?

I have tried: FORMAT 'WIN2_132_QPCqclub1' which creates the file "QPCqclub1.WIN", when I now enter:

DIR'WIN2_'

The result is:

Code: Select all

WIN2    lu QDOS
270115/270335 sectors
When I enter

DIR'WIN1_'

for the QPCDEMO WIN file supplied with QPC2 I get:

Code: Select all

QPCDemo QDOS
592/8192 sectors
I have already another WIN file but this always shows "WIN2 QDOS". E. g. when mapped as "WIN3_" and I enter "DIR'win3_'", which is irritating.

Is there a command with which I can rename the medium name shown with the "DIR" command?

EDIT:

I have found a solution: Just open the "*.WIN" file with an hex (capable) editor (e. g. Ultra Edit will do it) and then edit the name starting at offset 6 (start counting from 0!) but don't change the "04" in front (it is not the string length), the name should be followed by spaces (hex 20), the trailing spaces will not be printed.


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
User avatar
pjw
QL Wafer Drive
Posts: 1298
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QPC2: How to set/change medium name for WINn_ ?

Post by pjw »

Code: Select all

10 REMark Rename QLWA-type Hard drive
11 REMark V0.00, pjw
12 REMark No channels must be open on hard drive!
13 :
14 win% = 8 : REMark Drive number 1..8
15 name$ = 'TEST' : REMark New name
16 :
17 name$ = name$ & FILL$(' ', 10)
18 cw = FOPEN("win" & win% & '_*D2d'): ERT cw
19 GET#cw\ 0; sec$
20 IF sec$(1 TO 4) <> 'QLWA': CLOSE#cw: ERT -12
21 :
22 sec$ = sec$(1 TO 6) & name$(1 TO 10) & sec$(17 TO LEN(sec$))
23 PUT#cw\ 0; sec$
24 CLOSE#cw
25 :


Per
dont be happy. worry
- ?
User avatar
ql_freak
Gold Card
Posts: 354
Joined: Sun Jan 18, 2015 1:29 am

Re: QPC2: How to set/change medium name for WINn_ ?

Post by ql_freak »

Thank You pjw!

But I think my solution is in this case easier. Your solution is surely good, if you are working on a real QL. But if you are working on an emulator, I think my solution is easier (if you have an hex editor or an editor which is capable of hex editing for Windows available - like e.g. UltraEdit).

I must just open the *.WIN-file (with a Windows hex editor) and patch the name. No need to adjust the string length, as it seems the medium name is limited to 20 chars and trailing spaces (HEX 20) are ignored.

Of course it would be very usefull if there would be a S(uper)BASIC command, with which you can set the medium name of a directory device.


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
User avatar
pjw
QL Wafer Drive
Posts: 1298
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QPC2: How to set/change medium name for WINn_ ?

Post by pjw »

ql_freak wrote: But I think my solution is in this case easier. Your solution is surely good, if you are working on a real QL. But if you are working on an emulator, I think my solution is easier (if you have an hex editor or an editor which is capable of hex editing for Windows available - like e.g. UltraEdit).

I must just open the *.WIN-file (with a Windows hex editor) and patch the name. No need to adjust the string length, as it seems the medium name is limited to 20 chars and trailing spaces (HEX 20) are ignored.

Of course it would be very usefull if there would be a S(uper)BASIC command, with which you can set the medium name of a directory device.
IMHO It doesnt get much easier than LRUNning the little utility above. If you want it as a S(uper)BASIC command to use in your programs then just do something like:

Code: Select all

10 INPUT 'Enter win drive number (1..8)'! n%
11 INPUT 'Enter new name (max 10 char)'! name$
12 PRINT HDREN("win" & n% & '_' & name$)
13 :
14 REMark Or: PRINT HDREN("win8_TEST")
15 :
100 DEFine FuNction HDREN(name$)
101 LOCal cw, n$(10), sec$(512)
102 REMark Rename QLWA-type Hard drive
103 REMark V0.01 pjw
104 REMark No channels must be open on hard drive!
105 :
106 IF LEN(name$) < 5: RETurn -12: REMark Not a valid name
107 :
108 IF FTEST(name$(1 TO 5)) < 0: RETurn -7: REMark No device here
109 :
110 cw = FOPEN(name$(1 TO 5) & "*D2d"): IF cw < 0: RETurn cw
111 :
112 GET#cw\ 0; sec$
113 IF sec$(1 TO 4) <> 'QLWA': CLOSE#cw: RETurn -16: REMark Wrong format
114 :
115 n$ = name$(6 TO LEN(name$)) & "          "
116 sec$ = sec$(1 TO 6) & n$ & sec$(17 TO 512)
117 PUT#cw\ 0; sec$
118 CLOSE#cw
119 :
120 RETurn 0
121 END DEFine HDREN
122 :
Using a hex editor its easy to make a mistake. This method is safer.
Ive only tested it on QPC2 and SMSQmulator. (In the latter case the emulator has to be reset before the name change is registered in the emulation.) But in theory it should work with all hard drives and WIN containers that adhere to the QLWA standard.
Per


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

Re: QPC2: How to set/change medium name for WINn_ ?

Post by pjw »

You may wonder at the discrepancy between the specification length of the medium name, 20 char, and the 10 char I allow. I wondered myself, as the reasoning behind it had become lost in the mists of time. Having looked into it, it seems it may have to do with the limitation of the DD1 or DV1 driver which only allowed for 10 char, viz FORMAT flp1_0123456789. Also the STAT and DIR commands, as well as DMEDIUM_NAME$, all truncate the medium name to 10 char. QPCA2 Files assumes the same. The rule for QLWA medium names then seems to be: Up to 20 char, normally only 10 char shown. No length word, but terminates before last space or at 20 char.


Per
dont be happy. worry
- ?
Derek_Stewart
Font of All Knowledge
Posts: 3957
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: QPC2: How to set/change medium name for WINn_ ?

Post by Derek_Stewart »

pjw wrote:You may wonder at the discrepancy between the specification length of the medium name, 20 char, and the 10 char I allow. I wondered myself, as the reasoning behind it had become lost in the mists of time. Having looked into it, it seems it may have to do with the limitation of the DD1 or DV1 driver which only allowed for 10 char, viz FORMAT flp1_0123456789. Also the STAT and DIR commands, as well as DMEDIUM_NAME$, all truncate the medium name to 10 char. QPCA2 Files assumes the same. The rule for QLWA medium names then seems to be: Up to 20 char, normally only 10 char shown. No length word, but terminates before last space or at 20 char.
Hi Per,

I was looking at QWIRC not long ago and thought the solution to this maybe in there, but QWIRC only gives read only access. Is it possible to allow write access the WIN file.

I tried QWIRC on SMSQmulator and did not work.


Regards,

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

Re: QPC2: How to set/change medium name for WINn_ ?

Post by pjw »

Derek_Stewart wrote:I was looking at QWIRC not long ago and thought the solution to this maybe in there, but QWIRC only gives read only access. Is it possible to allow write access the WIN file.
Im not sure I understand what youre asking. Qwirc allows you to attach WIN container files (virtual hard disks) to the QPC2 WIN devices. These may be set to ReadOnly or ReadWrite in the Qwirc application. If you arent able to write to a device, despite setting the ReadWrite status in Qwirc, this is most likely due to the WIN file being set to ReadOnly at the Windows file level. This, as I explain in the Readme, cant be changed from Qwirc, or anywhere inside the QPC2 emulation, but must be done from Windows. Did that answer the question?
Derek_Stewart wrote:I tried QWIRC on SMSQmulator and did not work.
It doesnt work in SMSQmulator because, due to some deep wisdom, inaccessable to me, the designer of the latter has chosen to use a different command for, basically, the identical function in the former, to wit, QPC2: WIN_DRIVE; SMSQmulator: WIN_USE. This implies that modifications would have to be made to Qwirc to accommodate the anomaly. I would gladly have modified Qwirc for Qx0 or Atari (which have real hard disks, and therefore of necessity require different parameters) had any interest been shown in the program, but none has, so I havent. Regarding SMSQmulator, I cant be asked to pander to individual designer whims if Im not able to understand their reasons, and besides SMSQmulator has adequate built-in facilities to cater for managing diverse WIN container files, so I cant feel any urge.

PS: An update to QWIRC is in the pipeline. The main new feature is the replacement of the MRU list with a small DOS device browser and file selector. The DOS browser is finished, but QWIRC itself needs a makeover before the twain can be joined. This will take a little while..

Per


Per
dont be happy. worry
- ?
Derek_Stewart
Font of All Knowledge
Posts: 3957
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: QPC2: How to set/change medium name for WINn_ ?

Post by Derek_Stewart »

Hi Per,

My apologies for not reading all the manual.

I read the manual again and tried QWIRC with QPC2 v4.04, by just selecting the WIN name allows editing of the .WIN file title.

I am using QPC2 on Linux under Wine, all seems to work fine.

A very nice piece of software.


Regards,

Derek
User avatar
ql_freak
Gold Card
Posts: 354
Joined: Sun Jan 18, 2015 1:29 am

Re: QPC2: How to set/change medium name for WINn_ ?

Post by ql_freak »

Wow! I wonder that my message has so much answers. But my intention was:

Is there really no S(uper)BASIC command (or similar), with which you can set the medium name. Like:

SET_MED_NAME "DEV-name" , "MED-Name"


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
User avatar
pjw
QL Wafer Drive
Posts: 1298
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QPC2: How to set/change medium name for WINn_ ?

Post by pjw »

ql_freak wrote:Wow! I wonder that my message has so much answers. But my intention was:

Is there really no S(uper)BASIC command (or similar), with which you can set the medium name. Like:

SET_MED_NAME "DEV-name" , "MED-Name"
No

Per


Per
dont be happy. worry
- ?
Post Reply