prodos large volumes block mapping fix

This commit is contained in:
April Ayres-Griffiths 2019-02-19 22:38:03 +11:00
parent 2ca1798d95
commit 086a2da973
2 changed files with 10 additions and 8 deletions

View File

@ -2,16 +2,14 @@ package disk
import ( import (
"bytes" "bytes"
"crypto/sha256"
"encoding/hex"
"errors" "errors"
"fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"strings" "strings"
"crypto/sha256"
"encoding/hex"
"fmt"
) )
//import "math/rand" //import "math/rand"

View File

@ -1172,11 +1172,13 @@ func (d *DSKWrapper) PRODOS800ChecksumBlock(b int) string {
func (d *DSKWrapper) PRODOSGetBlockSectors(block int) (int, int, int) { 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 return track, bo * 2, bo*2 + 1
} }
@ -1584,6 +1586,8 @@ func (fd *ProDOSFileDescriptor) Publish(dsk *DSKWrapper) error {
func (dsk *DSKWrapper) PRODOSWrite(b int, data []byte) error { func (dsk *DSKWrapper) PRODOSWrite(b int, data []byte) error {
//log.Printf("====> Request to write block %.4x", b)
for len(data) < 512 { for len(data) < 512 {
data = append(data, 0x00) data = append(data, 0x00)
} }