Skip to content

Commit

Permalink
2HDの最大クラスタ数を250クラスタに変更した。
Browse files Browse the repository at this point in the history
2HDのクラスタのセクタサイズ数を16に戻した。
  • Loading branch information
BouKiCHi committed Jun 29, 2018
1 parent 2350129 commit e24b916
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ hudisk image.d88 file.bin --read 1234 --go 1234
+ [HuBASICフォーマット](doc/HuBASIC_Format.md)

## 履歴
* ver 1.15
2HDの最大クラスタ数を250クラスタに変更した。
2HDのクラスタのセクタサイズ数を16に戻した。

* ver 1.14
ファイルサイズが大きい場合の処理の修正。
2HD時のクラスタのセクタ数を26セクタに変更。
Expand Down
7 changes: 5 additions & 2 deletions doc/HuBASIC_Format.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ http://www.z88dk.org/tools/x1/XBrowser_User_Guide.pdf
## アロケーションテーブル
+ 位置: 15セクタ(トラック0)
+ 長さ: 1セクタ
+ 0クラスタ目から順番に最大80クラスタ分ある。
+ クラスタ数 : 80クラスタ

### 2DD
+ クラスタ数: 160クラスタ

### 2HD
+ 位置: 29セクタ(トラック1/3セクタ)
+ 長さ: 2セクタ
+ 0クラスタ目から順番に最大250クラスタ分ある。
+ クラスタ数: 250クラスタ

## アロケーションテーブル内容(2D)
+ 0x00は未使用(空き)を表す
Expand Down
Binary file modified hudisk.exe
Binary file not shown.
30 changes: 14 additions & 16 deletions src/HuBasicDiskImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,18 @@ namespace Disk
class HuBasicDiskImage : DiskImage
{
const int AllocationTable2DSector = 14;
const int EntrySector2D = 16;
const int MaxCluster2D = 80;

const int AllocationTable2HDSector = 28;
const int EntrySector2HD = 32;
const int MaxCluster2HD = 160;
const int ClusterPerSector2HD = 26;

const int AllocationTable2DDSector = 14;
const int AllocationTable2HDSector = 28;
const int EntrySector2D = 16;
const int EntrySector2DD = 16;
const int EntrySector2HD = 32;
const int MaxCluster2D = 80;
const int MaxCluster2DD = 160;


const int MaxCluster2HD = 250;
const int ClusterPerSector2D = 16;
const int SectorSize = 256;
const int ClusterPerSector2HD = 16;

const int SectorBytes = 256;

const int BinaryFileMode = 0x01;
const int DirectoryFileMode = 0x80;
Expand Down Expand Up @@ -433,7 +430,8 @@ public override void ListFiles(string Directory = "")
}

public override void DisplayFreeSpace() {
Console.WriteLine("Free:{0} Cluster(s)",GetFreeClusters());
var fc = GetFreeClusters();
Console.WriteLine("Free:{0} byte(s) / {1} cluster(s)",fc * ClusterPerSector * SectorBytes , fc);
}

public void ExtractFileFromCluster(string OutputFile,int StartCluster,int Size) {
Expand All @@ -459,9 +457,9 @@ public void ExtractFileFromCluster(string OutputFile,int StartCluster,int Size)
var FillLength = end ? (next & 0x0f) + 1 : ClusterPerSector;

for(var i=0; i < FillLength; i++) {
var Length = SectorSize;
var Length = SectorBytes;
if (end && (i + 1) == FillLength) {
Length = Size % SectorSize;
Length = Size % SectorBytes;
}
fs.Write(GetSectorDataForWrite((c*ClusterPerSector)+i),0,Length);
}
Expand All @@ -487,7 +485,7 @@ public void WriteFileToImage(string InputFile,int StartCluster,int Filesize) {
var s = (c*ClusterPerSector);
var LastSector = 0;
for(sc=0; sc < ClusterPerSector; sc++,s++) {
var Length = Size < SectorSize ? Size : SectorSize;
var Length = Size < SectorBytes ? Size : SectorBytes;
Sectors[s].Fill(0x00);
if (Size == 0) continue;
fs.Read(GetSectorDataForWrite(s),0,Length);
Expand Down Expand Up @@ -548,7 +546,7 @@ public override bool AddFile(string FilePath,string EntryName) {

int fc = -1;
if (IplMode) {
int Cluster = (fe.Size / (ClusterPerSector * SectorSize)) + 1;
int Cluster = (fe.Size / (ClusterPerSector * SectorBytes)) + 1;
fc = GetNextFreeSerialCluster(Cluster);
} else {
fc = GetNextFreeCluster();
Expand Down
2 changes: 1 addition & 1 deletion src/HuDisk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Disk
{
class HuDisk : DiskManager {
const string ProgramTitle = "HuDisk";
const string ProgramVersion = "1.14";
const string ProgramVersion = "1.15";

string IplName = "";
bool IplMode = false;
Expand Down

0 comments on commit e24b916

Please sign in to comment.