Jun-10-2024, 12:06 AM
Pedroski55,
first off, Thanks for the code you posted yesterday, after some monkeying around, it works just fine for what I want.
the SD is a replacement disk for a machine's old ST506 MFM type drive, first i hope to read from it and write to it from my Linux machine, then the sky is the limit, playing with these old machines is my hobby.
Curbie
curbie
first off, Thanks for the code you posted yesterday, after some monkeying around, it works just fine for what I want.
def read_sector(disk, sector_no=0): """Read a single sector of the specified disk. Keyword arguments: disk -- the physical ID of the disk to read. curbie -- or full file path to disk image file. sector_no -- the sector number to read (default: 0). """ # curbie -- defined disk sector notes # D_INFO = 0 # disk info block # D_LABEL = 1 # disk label # D_MFD = 2 # disk master file directory # File operations with `with` syntax. To reduce file handling efforts. with open(disk, 'rb') as fp: # open file read binary, get file descriptor fp.seek(sector_no * 512) # seek file to byte (sector * 512) read = fp.read(512) # read sector return read # return sector sector = read_sector("/media/curbie/0012-D687/For Curbie/Zulu/HD.IMG", 2) print(sector) # print sector as byte arrayand returns
b'\x02\x01\x19\x00\x00\x00\x00\x00\x04\x01\xa9\x00\x00\x00\x00\x00\x06\x010\n\x00\x00\x00\x00\x02\x02K\x19\x00\x00\x00\x00\x00which i recognize as BIG endian octal 1,2 on sector x19, then 4 rad50 bytes, 1,4 on sector xa9, then 4 rad50 bytes,...
the SD is a replacement disk for a machine's old ST506 MFM type drive, first i hope to read from it and write to it from my Linux machine, then the sky is the limit, playing with these old machines is my hobby.
Curbie
curbie