Skip to content

Commit

Permalink
fix: fix type amsdos for binary mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerome Le Saux committed Oct 28, 2023
1 parent 4e8f52d commit 417f4f9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var (
loadingAddress = flag.String("load", "", "Loading address of the inserted file. (hexadecimal #170 allowed.)")
user = flag.Int("user", 0, "User number of the inserted file.")
force = flag.Bool("force", false, "Force overwriting of the inserted file.")
fileType = flag.String("type", "", "Type of the inserted file \n\tascii : type ascii\n\tbinary : type binary\n")
fileType = flag.String("type", "", "Type of the inserted file \n\tascii : type ascii\n\tprotected : type ascii protected\n\tbinary : type binary\n")
snaPath = flag.String("sna", "", "SNA file to handle")
analyse = flag.Bool("analyze", false, "Returns the DSK header")
cpcType = flag.Int("cpctype", 2, "CPC type (sna import feature): \n\tCPC464 : 0\n\tCPC664: 1\n\tCPC6128 : 2\n\tUnknown : 3\n\tCPCPlus6128 : 4\n\tCPCPlus464 : 5\n\tGX4000 : 6\n\t")
Expand All @@ -57,7 +57,7 @@ var (
autotest = flag.Bool("autotest", false, "Executs all tests.")
autoextract = flag.String("autoextract", "", "Extract all DSK contained in the folder path")
snaVersion = flag.Int("snaversion", 1, "Set the sna version (1 or 2 available).")
appVersion = "0.18"
appVersion = "0.19"
)

func main() {
Expand Down
7 changes: 6 additions & 1 deletion dsk/dsk.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ var (

var (
MODE_ASCII uint8 = 0
MODE_BINAIRE uint8 = 1
MODE_PROTECTED uint8 = 1
MODE_BINAIRE uint8 = 2
EXTENDED_DSK_TYPE = 1
DSK_TYPE = 0
DataFormat DskFormat = 0
Expand Down Expand Up @@ -729,6 +730,10 @@ func (d *DSK) PutFile(masque string, typeModeImport uint8, loadAddress, exeAddre
buff[fileLength] = 0x1A
}

if typeModeImport == MODE_PROTECTED && fileLength%128 != 0 {
buff[fileLength] = 0x1A
}

var isAmsdos bool
//
// Regarde si le fichier contient une en-tete ou non
Expand Down
2 changes: 0 additions & 2 deletions hfe/hfe_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package hfe_test

import (
"fmt"
"os"
"testing"

Expand All @@ -28,7 +27,6 @@ func TestReadHfe(t *testing.T) {
assert.NoError(t, err)
assert.NotEmpty(t, h)
assert.Equal(t, hfe.CPC_DD_FLOPPYMODE, h.Header.FloppyInterfaceMode)
fmt.Printf("format:%v\n", hfe.String(h.Header.FloppyInterfaceMode))
})

}

0 comments on commit 417f4f9

Please sign in to comment.