Merge pull request #3 from chris-torrence/master

Add to go other direction
This commit is contained in:
Paul Hagstrom 2021-05-02 18:27:07 -04:00 committed by GitHub
commit 2f199f601c
No known key found for this signature in database
2 changed files with 43 additions and 4 deletions

View File

@ -6,15 +6,19 @@ into those of a .po (ProDOS-order) file. Most Apple II emulators can handle bot
but certain utilities (with which I wanted to use existing .dsk images) assume
ProDOS-ordered files.
Usage is just (assuming you've done chmod 755, else precede with python command):
Usage is just (assuming you've done `chmod 755`, else precede with python command):
./ image.dsk
./ image.dsk
This will create image.dsk.po alongside it. Pretty much no checking is done.
It just goes through 35 tracks and converts them, then ends.
This can be used as an action for find, like so:
find imagefolders/\*/\*.dsk -exec ./ {} \;
find imagefolders/\*/\*.dsk -exec ./ {} \;
...which was mostly the point.
...which was mostly the point.
You can also go the opposite direction:
./ image.po

35 Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env python3
# scramble po back into dsk
# Chris Torrence, Oct 2020
import sys, getopt, re
from dsk2po import dsk2po
def main(argv=None):
print("po2dsk - convert po files to dsk files")
opts, args = getopt.getopt(sys.argv[1:], '')
except getopt.GetoptError as err:
return 1
filenameIn = args[0]
print('You need to provide the name of a PO file to begin.')
return 1
tracks = []
# Note that the same algorithm can be used to convert in either direction
with open(filenameIn, mode="rb") as fileIn:
for track in range(35):
trackbuffer =
dskfilename = re.sub('\.po$', '', filenameIn, flags=re.IGNORECASE) + ".dsk"
print('Writing dsk image to {}'.format(dskfilename))
with open(dskfilename, mode="wb") as file:
for track in tracks:
return 1
if __name__ == "__main__":