Skip to content

Commit

Permalink
ファイルサイズが大きい場合の処理の修正。
Browse files Browse the repository at this point in the history
2HD時のクラスタのセクタ数を26セクタに変更。
  • Loading branch information
BouKiCHi committed Jun 28, 2018
1 parent d64c666 commit 2350129
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 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.14
ファイルサイズが大きい場合の処理の修正。
2HD時のクラスタのセクタ数を26セクタに変更。

* ver 1.13
ファイル追加時のバグ修正。
ディレクトリに仮対応。
Expand Down
9 changes: 6 additions & 3 deletions doc/HuBASIC_Format.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,12 @@ http://www.z88dk.org/tools/x1/XBrowser_User_Guide.pdf
| 日付 | 0x18 | 6 |
| 開始クラスタ | 0x1D | 3 |

### ディレクトリで管理できるエントリ数
+ 2D = 78
+ 2HD = 247
### エントリ数
+ 8エントリ / 1セクタ

### ディレクトリで管理できるエントリ数?
+ 2D = 78?
+ 2HD = 247?

### 詳細
* パスワードの値は未指定時、0x20になる
Expand Down
Binary file modified hudisk.exe
Binary file not shown.
13 changes: 11 additions & 2 deletions src/HuBasicDiskImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ class HuBasicDiskImage : DiskImage
const int AllocationTable2HDSector = 28;
const int EntrySector2HD = 32;
const int MaxCluster2HD = 160;
const int ClusterPerSector2HD = 26;

const int AllocationTable2DDSector = 14;
const int EntrySector2DD = 16;
const int MaxCluster2DD = 160;


const int ClusterPerSector = 16;
const int ClusterPerSector2D = 16;
const int SectorSize = 256;

const int BinaryFileMode = 0x01;
Expand All @@ -35,6 +36,7 @@ class HuBasicDiskImage : DiskImage
public int AllocationTableStart;
public int EntrySector = 0;
public int MaxCluster = 0;
public int ClusterPerSector = 0;


DataController[] AllocationController;
Expand Down Expand Up @@ -111,18 +113,20 @@ private void SetDiskParameter() {
AllocationTableStart = AllocationTable2DSector;
EntrySector = EntrySector2D;
MaxCluster = MaxCluster2D;
ClusterPerSector = ClusterPerSector2D;
break;
case DiskType.Disk2HD:
AllocationTableStart = AllocationTable2HDSector;
EntrySector = EntrySector2HD;
MaxCluster = MaxCluster2HD;
ClusterPerSector = ClusterPerSector2HD;
break;
case DiskType.Disk2DD:
AllocationTableStart = AllocationTable2DDSector;
EntrySector = EntrySector2DD;
MaxCluster = MaxCluster2DD;
ClusterPerSector = ClusterPerSector2D;
break;

}
}

Expand Down Expand Up @@ -499,6 +503,11 @@ public void WriteFileToImage(string InputFile,int StartCluster,int Filesize) {
break;
}
var next = GetNextFreeCluster(2);
if (next < 0) {
Console.WriteLine("Too big filesize!: LastClaster=" + c.ToString());
SetClusterValue(c,LastSector,true);
break;
}
SetClusterValue(c,next);
c = next;
}
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.13";
const string ProgramVersion = "1.14";

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

0 comments on commit 2350129

Please sign in to comment.