Re: [hatari-devel] New stream by Cybernetics - write floppy disk issue

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On lauantai 16 elokuu 2014, Konador, Cyprian wrote:
> > As to writing tracks to ST image...  Disk image geometry obviously
> > needs to match what the writer is trying/going to put put to the disk
> > (so that it doesn't try to overwrite past image size), but if
> > that is true, I think Hatari could just extract sector contents
> > from track data and write them to places that would correspond
> > to the them with current disk geometry.
> 
> I know that this is not a good excuse, but Steem somehow cope with this
> problem, and WRITER.PRG works fine there.

That particular demo works fine because it doesn't need the extra
info in the track which cannot be stored to ST/MSA disks.  Some
other programs won't work fine, but user is left with the impression
that everything went fine.  Or does STeem warn on every write track
call that it's doing an approximation which result might or might not work?

Attached is a trivial Python script which can be used to do convert
the IMG file to .ST floppy image.  It seems to work also with
other demo by this same crew:
	http://www.pouet.net/prod.php?which=14457

(Is the glitch at the bottom of the plasma on second disk an issue
in the demo itself?)


	- Eero


#!/usr/bin/python
import os, sys
offset=8

def usage(msg):
    name = os.path.basename(sys.argv[0])
    sys.stderr.write("usage: %s <img file with %d-byte header to remove>\n\n" % (name, offset))
    sys.stderr.write("ERROR: %s!\n" % msg)
    sys.exit(1)

def main(argv):
    if len(argv) != 2:
        usage("wrong number of arguments")
    inname = argv[1]
    outname = inname.lower()
    if not outname.endswith(".img"):
        usage("'%s' doesn't end in '.img'" % inname)
    outname = outname.replace(".img", ".st")
    try:
        infile = open(inname, 'rb')
    except IOError:
        usage("opening '%s' failed!" % inname)
    infile.seek(offset)
    open(outname, 'wb').write(infile.read())
    print "Wrote '%s' from '%s' with first %d bytes removed." % (outname, inname, offset)

main(sys.argv)


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/