(self, name, filetype, seg, offs, length)
Write a file header to the tape.
Write a file header to the tape.
Write a file header to the tape .
def open_write(self, name, filetype, seg, offs, length):
        """Write a file header to the tape."""
        self.record_num = 0
        self.record_stream = io.BytesIO()
        self.buffer_complete = False
        self.bitstream.switch_mode('w')
        self.rwmode = 'w'
        if filetype in (b'A', b'D'):
            # ASCII program files: length, seg, offset are untouched,
            # remain that of the previous file recorded!
            seg, offs, length = self.last
        else:
            self.last = seg, offs, length
        self.filetype = filetype
        # header seems to end at 0x00, 0x01, then filled out with last char
        header = struct.pack(
            '<c8sBHHHBB',
            b'\xa5', name[:8] + b' ' * (8-len(name)),
            TYPE_TO_TOKEN[filetype], length, seg, offs, 0, 1
        )
        self._write_record(header)
        self.is_open = True
def open_write ( self , name , filetype , seg , offs , length ) : self . record_num = 0 self . record_stream = io . BytesIO ( ) self . buffer_complete = False self . bitstream . switch_mode ( 'w' ) self . rwmode = 'w' if filetype in ( b'A' , b'D' ) : # ASCII program files: length, seg, offset are untouched, # remain that of the previous file recorded! seg , offs , length = self . last else : self . last = seg , offs , length self . filetype = filetype # header seems to end at 0x00, 0x01, then filled out with last char header = struct . pack ( '<c8sBHHHBB' , b'\xa5' , name [ : 8 ] + b' ' * ( 8 - len ( name ) ) , TYPE_TO_TOKEN [ filetype ] , length , seg , offs , 0 , 1 ) self . _write_record ( header ) self . is_open = True