Use ProDOS-Utilities library

This commit is contained in:
Terence Boldt 2021-06-06 22:09:00 -04:00
parent 49f99c6c51
commit 9fddb83c94
4 changed files with 14 additions and 9 deletions

View File

@ -2,4 +2,7 @@ module github.com/tjboldt/Apple2-IO-RPi/RaspberryPi/apple2driver
go 1.16
require periph.io/x/periph v3.6.8+incompatible
require (
github.com/tjboldt/ProDOS-Utilities v0.0.0-20210607001541-fa0e76cf84c0
periph.io/x/periph v3.6.8+incompatible
)

View File

@ -1,2 +1,4 @@
github.com/tjboldt/ProDOS-Utilities v0.0.0-20210607001541-fa0e76cf84c0 h1:iH6+15jJQsUMv9yeC5m26qh8VdJeRmZiYGM1ZG4aLVI=
github.com/tjboldt/ProDOS-Utilities v0.0.0-20210607001541-fa0e76cf84c0/go.mod h1:eBQRf0U+goRbBOxzFCwRW+FZmALC8dfYaqCwcqwzi74=
periph.io/x/periph v3.6.8+incompatible h1:lki0ie6wHtvlilXhIkabdCUQMpb5QN4Fx33yNQdqnaA=
periph.io/x/periph v3.6.8+incompatible/go.mod h1:EWr+FCIU2dBWz5/wSWeiIUJTriYv9v2j2ENBmgYyy7Y=

View File

@ -5,6 +5,7 @@ import (
"os"
"github.com/tjboldt/Apple2-IO-RPi/RaspberryPi/apple2driver/a2io"
"github.com/tjboldt/ProDOS-Utilities/prodos"
)
var oldFirmware = false
@ -31,13 +32,12 @@ func ReadBlockCommand(drive1 *os.File, drive2 *os.File) {
file = drive2
}
buffer := make([]byte, 512)
var block int64
block = int64(blockHigh)*256 + int64(blockLow)
var block int
block = int(blockHigh)*256 + int(blockLow)
fmt.Printf("Read block %d\n", block)
file.ReadAt(buffer, int64(block)*512)
buffer := prodos.ReadBlock(file, block)
err = a2io.WriteBlock(buffer)
if err == nil {

View File

@ -5,6 +5,7 @@ import (
"os"
"github.com/tjboldt/Apple2-IO-RPi/RaspberryPi/apple2driver/a2io"
"github.com/tjboldt/ProDOS-Utilities/prodos"
)
func WriteBlockCommand(drive1 *os.File, drive2 *os.File) {
@ -29,13 +30,12 @@ func WriteBlockCommand(drive1 *os.File, drive2 *os.File) {
}
buffer := make([]byte, 512)
var block int64
block = int64(blockHigh)*256 + int64(blockLow)
var block int
block = int(blockHigh)*256 + int(blockLow)
fmt.Printf("Write block %d\n", block)
a2io.ReadBlock(buffer)
file.WriteAt(buffer, int64(block)*512)
file.Sync()
prodos.WriteBlock(file, block, buffer)
fmt.Printf("Write block completed\n")
}