Skip to content

Commit

Permalink
prodos large volumes block mapping fix
Browse files Browse the repository at this point in the history
  • Loading branch information
undefinedopcode committed Feb 19, 2019
1 parent 2ca1798 commit 086a2da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 3 additions & 5 deletions disk/diskimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ package disk

import (
"bytes"
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"strings"

"crypto/sha256"
"encoding/hex"

"fmt"
)

//import "math/rand"
Expand Down
10 changes: 7 additions & 3 deletions disk/diskimagepd.go
Original file line number Diff line number Diff line change
Expand Up @@ -1172,11 +1172,13 @@ func (d *DSKWrapper) PRODOS800ChecksumBlock(b int) string {

func (d *DSKWrapper) PRODOSGetBlockSectors(block int) (int, int, int) {

track := block / PRODOS_BLOCKS_PER_TRACK
bpt := d.Format.USPT() / 2

bo := block % PRODOS_BLOCKS_PER_TRACK
track := block / bpt

if d.Layout == SectorOrderProDOSLinear {
bo := block % bpt

if d.Layout == SectorOrderProDOSLinear || len(d.Data) >= PRODOS_800KB_DISK_BYTES {
return track, bo * 2, bo*2 + 1
}

Expand Down Expand Up @@ -1584,6 +1586,8 @@ func (fd *ProDOSFileDescriptor) Publish(dsk *DSKWrapper) error {

func (dsk *DSKWrapper) PRODOSWrite(b int, data []byte) error {

//log.Printf("====> Request to write block %.4x", b)

for len(data) < 512 {
data = append(data, 0x00)
}
Expand Down

0 comments on commit 086a2da

Please sign in to comment.