1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-10 06:30:41 +00:00

Use file extension for sector order

This commit is contained in:
dschmenk 2016-08-16 18:53:44 -07:00
parent 29afb2e607
commit 10618711b8
2 changed files with 56 additions and 10 deletions

View File

@ -9,9 +9,15 @@ const COPY_BLK_CNT = COPY_BLK_SIZE-1
const DRIVE1 = $60 // drive 1, slot 6
const DRIVE2 = $D0 // drive 2, slot 6
const LOWER_DIFF = 'a' - 'A'
//
// Track sector order
//
const ORDER_DOS = 0
const ORDER_PRODOS = 1
word arg, image
byte unit = DRIVE1
byte order
//
// DOS to ProDOS sector ordering
//
@ -109,7 +115,7 @@ def bigFatWrite(buf, len)
return xferLen
end
def fatReadImage(src, drv)
def fatReadImage(src, drv, order)
word inBuf, outBuf, copyLen, freeAddr
word blocknum, bufblk
@ -118,7 +124,11 @@ def fatReadImage(src, drv)
puts("Not enough free memory!\n"); putln
return -1
fin
outBuf = inBuf + COPY_BUF_SIZE
if order == ORDER_DOS
outBuf = inBuf + COPY_BUF_SIZE
else
outBuf = inBuf
fin
//
// Copy FAT image over one track at a time
//
@ -135,7 +145,9 @@ def fatReadImage(src, drv)
fin
next
fin
trkSecToBlk(inBuf, outBuf)
if order == ORDER_DOS
trkSecToBlk(inBuf, outBuf)
fin
copyLen = bigFatWrite(outBuf, COPY_BUF_SIZE)
if copyLen <> COPY_BUF_SIZE
puts("Write image file error\n");
@ -174,8 +186,19 @@ if ^arg
else
puts("Speed test writing 143K to SD card");
fin
if getYN("\nContinue? (Y/N)")
fatReadImage(image, unit)
//
// Figure sector ordering from filename
//
puts("\nUsing ")
if charUpper(^(image + ^image)) == 'O' and charUpper(^(image + ^image - 1)) == 'P'
order = ORDER_PRODOS
puts("ProDOS")
else
order = ORDER_DOS
puts("DOS 3.3")
fin
if getYN(" order. Continue? (Y/N)")
fatReadImage(image, unit, order)
fin
else
puts("Read DSK image from floppy disk drive\n")

View File

@ -9,9 +9,15 @@ const COPY_BLK_CNT = COPY_BLK_SIZE-1
const DRIVE1 = $60 // drive 1, slot 6
const DRIVE2 = $D0 // drive 2, slot 6
const LOWER_DIFF = 'a' - 'A'
//
// Track sector order
//
const ORDER_DOS = 0
const ORDER_PRODOS = 1
word arg, image
byte unit = DRIVE1
byte order
//
// DOS to ProDOS sector ordering
@ -110,7 +116,7 @@ def bigFatRead(buf, len)
return xferLen
end
def fatWriteImage(src, drv)
def fatWriteImage(src, drv, order)
word inBuf, outBuf, copyLen, freeAddr
word blocknum, bufblk
@ -119,7 +125,11 @@ def fatWriteImage(src, drv)
puts("Not enough free memory!\n"); putln
return -1
fin
inBuf = outBuf + COPY_BUF_SIZE
if order == ORDER_DOS
inBuf = outBuf + COPY_BUF_SIZE
else
inBuf = outBuf
fin
//
// Copy FAT image over one track at a time
//
@ -131,7 +141,9 @@ def fatWriteImage(src, drv)
if drv
^$24=^$20 // Move cursor to left edge
puts("Writing blocks: "); puti(blocknum)
trkSecToBlk(inBuf, outBuf)
if order == ORDER_DOS
trkSecToBlk(inBuf, outBuf)
fin
for bufblk = 0 to COPY_BLK_CNT
if writeblock(drv, outBuf + (bufblk << 9), blocknum + bufblk)
puts("Write disk error: $"); putb(perr); putln
@ -176,8 +188,19 @@ if ^arg
else
puts("Speed test reading 143K from SD card");
fin
if getYN("\nContinue? (Y/N)")
fatWriteImage(image, unit)
//
// Figure sector ordering from filename
//
puts("\nUsing ")
if charUpper(^(image + ^image)) == 'O' and charUpper(^(image + ^image - 1)) == 'P'
order = ORDER_PRODOS
puts("ProDOS")
else
order = ORDER_DOS
puts("DOS 3.3")
fin
if getYN(" order. Continue? (Y/N)")
fatWriteImage(image, unit, order)
fin
else
puts("Write DSK image to floppy disk drive\n")