Disk_sector_reader

Developer(s): Howard Clase
Date: 1993
Type: Diskette
Platform(s): QL

Shows the contents of disk sectors on QL disks (DD, HD and ED) and PC disks (DD and HD). Give the drive (1 or 2), the format (D, H or E) and the first and last tracks; each sector is printed in turn, and pressing D shows it byte by byte with the position, character and code.

It needs Toolkit II (FLP_SEC, FOPEN, PRINT_USING) and a disk interface with direct sector access. Settings such as the columns of the detailed display are in the Set_up procedure, for you to change; the defaults suit a TV.

Published in Sinc-Link November-December 1993 (Howard Clase plays with Disks).

Related Articles

Formats – Formatting IBM disks – Sector reader – Renaming – Listings included. Playing with disks.

Related Content

Source Code

5 nm$=        "Disk_sector_reader"
10 REMark PD H.J. Clase 1993.09.09 ver1.3
15 REMark Displays contents of disk sectors
20 REMark of QL (DD,HD&ED) and MSDOS (DD&HD only)
25 REMark disks.
30 REMark N.B. Requires SuperToolkit II
35 Set_up: Read_sectors: Finish
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 Get_tracks Ftrack,Ltrack
135 REMark For "detailed" display, TV values
140 REMark for wider screens try 6 & 64
145 cols=3: batch = 32 :REMark <--- <--- <--- <---
150 END DEFine
200 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
205 DEFine PROCedure                  Read_sectors
210 LOCal a$,k$,si,se,tr
215 ch%=FOPEN(dev$&fmt$)
220 FOR tr=Ftrack TO Ltrack
225   FOR si=0,1
230    FOR se = 1 TO maxsec
235     GET#ch%(se+256*si+2^16*tr),a$
240     PRINT"Track"!tr!"side"!si!"sector"!sea$
245     PRINT\"Press D for detailed display"
250     PRINT"or any other key to continue"\
255     IF INKEY$(5000)=="d": Details
260 END FOR se:END FOR si: END FOR tr
265 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.":Bip
440 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.":Bip
540 END REPeat lp
545 f = CODE(f$): SELect ON f
550   = 68,100: r$="*D2D": maxsec=9
555   = 69,101: r$="*D4E": maxsec=18
560   = 72,104: r$="*D2H": maxsec=10
565 END SELect : RETurn r$: END DEFine
600 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
605 DEFine PROCedure             Get_tracks(Ft,Lt)
610 LOCal lp
615 REPeat lp
620   INPUT"First track (0-79)",,,Ft
625   IF Ft<80 AND Ft>=0: Pip: EXIT lp
630   PRINT "0-79 only, try again!": Bip
635 END REPeat lp
640 REPeat lp
645   INPUT"Last track ("&Ft&"-79)",,,Lt
650   IF Lt<80 AND Lt>=Ft: Pip: EXIT lp
655   PRINT Ft;"-79 only, try again!": Bip
660 END REPeat lp: END DEFine
700 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
705 DEFine PROCedure Pip: BEEP 100,30: END DEFine
710 DEFine PROCedure Bip: BEEP 4000,40: END DEFine
800 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
805 DEFine PROCedure                       Details
810 LOCal c$,i,l$,mb,n%: l$=CHR$(10): mb=256: n%=1
815 IF maxsec=10: mb=2048
820     PRINT"Position, character, code"\
825 FOR i=1 TO mb
830   f$='### # ###   '
835   c$=a$(i): IF c$=l$:c$=" ":    REMark LF trap
840   PRINT_USING f$,i,c$,CODE(a$(i))
845   IF NOT n% MOD cols: PRINT
850   IF NOT n% MOD 32
855     PRINT\"Press any key when ready."
860     PRINT"Position, character, code"\
865     PAUSE(2000)
870   END IF :n%=n%+1
875 END FOR i: PRINT \: END DEFine

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.