HDRen

So often you see hard disk container files, or QXL.WIN files, as they are sometimes refered to, stupidly named "WIN2" or something equally inappropriate and unimaginative. WINx is the default name given by the driver, depending on the slot in which the drive was first formatted. It is simple enough to give it a suitable name: For example, use the routine below!

While the QLWA hard disk standard allows for names of up to 20 characters, in practice, the rest of the OS expects names to be no more than 10 characters long. So that is the limit used in this program. (But see this note, if you like)

Note: As of SMSQ/E V3.36 this issue has been resolved and HDRen now uses up to 20 character names. Older versions of SMSQ/E, and Qdos/Minerva, may, however, still only display the first 10 characters of the name.

Ensure there are no open files on the drive you wish to name, or the operation will fail. Some programs (like QDT) always have a channel open to their home drive while they are up and running, so youll have to shut them down before you can rename that drive. Then, just LRUN HDRen_bas in the S*BASIC console and follow the prompts.

100 REMark WIN hard disk rename
110 REMark pjwitte 1998, 2o2o
120 REMark V0.05, Set length word debugged
130 :
140 ch = 1: namel% = 20: esc$ = CHR$(27)
150 CLS#ch
160 PRINT#ch; '      Rename harddisk'
170 PRINT#ch; 'Note: No other application'
180 PRINT#ch; 'may access the hard disk'
190 PRINT#ch; 'during this call'
200 PRINT#ch\\ 'Enter drive number <1..8> ';
210 CURSEN#ch
220 REPeat
230  n$ = INKEY$(#ch; -1)
240  IF n$ INSTR '12345678' & esc$: EXIT
250  BEEP 2000, 200
260 END REPeat
270 CURDIS#ch: BEEP 2000, 2
280 IF n$ = esc$: PRINT#ch; '^ESC': STOP
290 PRINT#ch; n$
300 w = FOPEN("win" & n$ & '_*D2d')
310 IF w = -9 THEN
320  PRINT#ch; 'HD is in use. Close all open'
330  PRINT#ch; 'channels on this drive and'
340  PRINT#ch; 'then try again.': STOP
350  ELSE : IF w < 0: ERT w
360 END IF
370 GET#w\ 0; sec$
380 IF sec$(1 TO 4) <> 'QLWA' THEN
390  PRINT#ch; 'Unsupported hard disk format:' !n$: CLOSE#w: STOP
400 END IF
410 n$ = sec$(7 TO 6 + namel%)
420 PRINT#ch\\ 'Current name is "'; n$; '"'
430 PRINT#ch\\'Enter new name (max'! namel%! 'chars)'
440 INPUT#ch;, n$: n% = LEN(n$)
450 IF n% = 0: PRINT#ch; 'Aborted': CLOSE#w: STOP
460 IF n% < namel% THEN
470  n$ = n$ & FILL$(' ', namel% - n%)
480 ELSE
490  IF n% > namel%: n$ = n$(1 TO namel%): n% = namel%
500 END IF
510 sec$ = 'QLWA' & CHR$(0) & CHR$(n%) & n$ & sec$(27 TO 512)
520 PRINT#ch; 'Writing...'
530 PUT#w\ 0; sec$: CLOSE#w
540 PRINT#ch\\ 'Done': BEEP 2000, 2
550 :

  
Generated with sb2htm on 2019 Apr 01
©pjwitte March 2oi9