The extended version of Disk_rename: it asks for the drive (1 or 2) and the format (DD, HD or ED), shows the disk’s old name and writes the new one into the first sector. It needs Toolkit II.
Line 235 writes to channel #3 while the disk was opened with FOPEN as ch%. That works when FOPEN gives channel 3, the first free one when no other channels are open.
Published in Sinc-Link November-December 1993 (Howard Clase plays with Disks).
Source Code
5 nm$= "Disk_rename2"
10 REMark h.j.c. 1993.8.18 version 2.0
15 REMark N.B. Requires TK II
20 Set_up: Rename_disk: Finish: STOP
100 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105 DEFine PROCedure Set_up
110 CLS: FLP_SEC 2
115 pd$="1,2": REMark Numbers of drives available
120 pf$="D,H,E": REMark possible formats
125 dev$=Get_flp$: fmt$=Get_fmt$
130 END DEFine
200 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
205 DEFine PROCedure Rename_disk
210 LOCal a$,n$: a$="": n$=""
215 ch%=FOPEN(dev$&fmt$)
220 GET#ch%\1,a$
225 PRINT\\"Old name = ";a$(5 TO 14)
230 INPUT "New name (ENTER to keep old) = "!n$
235 IF n$<>"": a$(5 TO 14) = n$: PUT#3\1,a$
240 END DEFine
300 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
305 DEFine PROCedure Finish
310 CLOSE#ch%
315 END DEFine
400 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
405 DEFine FuNction Get_flp$
410 LOCal d$,n$,lp,p$: d$="flp1_": p$="("&pd$&")"
415 REPeat lp
420 PRINT"Which drive is the disk in? ";p$,
425 n$=INKEY$(-1): PRINT "flp";n$
430 IF n$ INSTR(pd$) AND n$<>",": Pip: EXIT lp
435 PRINT "Drive ";n$;" not available."
440 BEEP 4000,30: END REPeat lp
445 d$(4)=n$: RETurn d$: END DEFine
500 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
505 DEFine FuNction Get_fmt$
510 LOCal f,f$,p$,r$: p$="("&pf$&")"
515 REPeat lp
520 PRINT"Disk format? ";p$,,,
525 f$=INKEY$(-1):PRINT f$&"d"
530 IF f$ INSTR(pf$) AND f$<>",": Pip: EXIT lp
535 PRINT "Format ";f$;"d unknown."
540 BEEP 4000,30: END REPeat lp
545 f = CODE(f$): SELect ON f
550 = 68,100: r$="*D2D"
555 = 69,101: r$="*D4E"
560 = 72,104: r$="*D2H"
565 END SELect : RETurn r$: END DEFine
600 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
605 DEFine PROCedure Pip: BEEP 100,30:END DEFineNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.