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 them 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.

If possible, ensure there are no files open 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
120 REMark V0.03
130 :
140 ch = 1: namel% = 10: 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 999, 999
260 END REPeat
270 CURDIS#ch: BEEP 2, 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 n$ = sec$(1 TO 4)
390 IF n$ <> 'QLWA' THEN
400  PRINT#ch; 'Unsupported hard disk format:' !n$: CLOSE#w: STOP
410 END IF
420 n$ = sec$(7 TO 6 + namel%)
430 PRINT#ch\\ 'Current name is "'; n$; '"'
440 PRINT#ch\\'Enter new name (max'! namel%! 'chars)'
450 INPUT#ch;, n$: n% = LEN(n$)
460 IF n% = 0: PRINT#ch; 'Aborted': CLOSE#w: STOP
470 IF n% < namel%: n$ = n$ & FILL$(' ', namel% - LEN(n$))
480 FOR i% = 1 TO namel%: sec$(6 + i%) = n$(i%)
490 PRINT#ch; 'Writing...'
500 PUT#w\ 0; sec$: CLOSE#w
510 PRINT#ch\\ 'Done': BEEP 2, 2
520 :
  
Generated with sb2htm on 2019 Apr 01
©pjwitte March 2oi9