#!/usr/bin/python # # File: mk_zicog_floppy.py # # Author: Michael Rychlik # # Version: 0.1 # # Convert a SIMH AltairZ80 floppy disk image into an ZiCog floppy image # # SORRY to anyone reading this, this is a quick hack, no error checking etc etc. input_file = 'cpm2.dsk' output_file_name = 'zicog_floppy.img' # Open the output image file zicog_dsk = open(output_file_name, 'wb') print "Processing:", input_file # Open the input file simh_dsk = open(input_file, 'rb') tracks = 255 sectors_per_track = 32 sector_size = 128 for sector in range(0, (tracks * sectors_per_track) - 1): # Read and discard the first three bytes of the sector junk = simh_dsk.read(3) # Read the sectors data bytes into the sector buffer sector = simh_dsk.read(sector_size); # Read and dispose of the sectors trailing junk junk = simh_dsk.read(6) # Write a sd block to the output file zicog_dsk.write(sector) # Close this input file simh_dsk.close # Close the output file. zicog_dsk.close