homelan/acorn-disk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

homelan/acorn-disk

Composer 安装命令:

composer create-project homelan/acorn-disk

包简介

Provides class for reading disk images for 8-bit Acorn machines (dfs/adfs)

README 文档

README

This package allows the reading of DFS and ADFS disk images.

Features

  • PSR-4 autoloading compliant structure
  • Unit-Testing with PHPUnit
  • Disk Image can be read from files, or passed in as a string

Install

composer requre homelan/acorn-disk

Overview

The DfsReader class, allows files and metadata to be read from a DFS disk image stored in the .ssd format. In DFS directorys are not hierarchical like modern fs, rather they can only exist as the top level, and dirnames can only be 1 char in length. Another querk of DFS is that the default dir is '$', and while on later filing systems for the 8-bit Acorn range '$' was the root of the filing system in DFS directorys are more like a file name prefix with '$' being the default.

The DfsReader class can working to two ways, in can directly read bits of the disk image as needed by openin a file handle on demand, or the entire disk can be read in as a string and passed to the DfsReader. The former is more efficent for lots of file access, while the later is more memory efficent.

The AdfsReader class, allows files and metadata to be read from a ADFS floppy disk images stored in the .adl format. ADFS filing systems are like modern filing systems in that there is a hierarchical directory structure, with '$' being the root of the fs. There are limits on the number of files per dir in ADFS

The AdfsReaderHD class, does the same as the AdfsReader class, only is read hardisk images stored in the scsi.dat format used by Beebem.

DfsReader Usage

Creating a DfsReader Object to directly open a file on disk

$oDfs = new \HomeLan\Retro\Acorn\Disk\DfsReader('disk_image.ssd');

Creating a DfsReader Object to read from a disk image held in a binary string

$sDiskImage = file_get_contents('disk_image.ssd');

$oDfs = new  \HomeLan\Retro\Acorn\Disk\DfsReader(null,$sDiskImage);

Once the DfsReader object exists a few simple methods can be used to read data from it.

$oDfs->getTitle()

Reads the title of the disk

$aCatalogue = $oDfs->getCatalogue();

Gets the catalogue of what is on the disk *CAT

e.g.

$aCatalogue = $oDfs->getCatalogue();
foreach($aCatalogue as $sDirectoy=>$aDir)
{
	echo $sDirectoy."\n==============\n";
	foreach($aDir as $sFileName=>$aEntryMetadata){
		echo $sFileName."  [".$aEntryMetadata['loadaddr'].' '.$aEntryMetadata['execaddr'].' '.$aEntryMetadata['size'].' '.$aEntryMetadata['startsector']."\n";
		
	}
}


$oDfs->getFile('$.!BOOT');

The the contents of a give file

e.g.

$sFileContents = $oDfs->getFile('$.!BOOT');


$oDfs->getStat('$.!BOOT');

Stats a file

$oDfs->isFile('$.!BOOT');

Test if a given path is a file or not

e.g.

$bFile = $oDfs->isFile('$.!BOOT');
if($bFile){
	echo "!BOOT is file.\n" 
}

$oDfs->isDir('A');

Test if a given path is a file or not

$bDir = $oDfs->isDir('D');
if($bDir){
	echo "D is a dir.\n" 
}

AdfsReader Usage

Creating a AdfsReader Object to directly open a file on disk

$oDfs = new \HomeLan\Retro\Acorn\Disk\AdfsReader('disk_image.adl');

Creating a AdfsReader Object to read from a disk image held in a binary string

$sDiskImage = file_get_contents('disk_image.adl');

$oDfs = new  \HomeLan\Retro\Acorn\Disk\AdfsReader(null,$sDiskImage);

Once the AdfsReader object exists a few simple methods can be used to read data from it.

$oAdfs->getTitle()

Reads the title of the disk

$aCatalogue = $oAdfs->getCatalogue();

Gets the catalogue of what is on the disk *CAT

e.g.

$aCatalogue = $oAdfs->getCatalogue();
foreach($aCatalogue as $sDirectoy=>$aDir)
{
	echo $sDirectoy."\n==============\n";
	foreach($aDir as $sFileName=>$aEntryMetadata){
		echo $sFileName."  [".$aEntryMetadata['loadaddr'].' '.$aEntryMetadata['execaddr'].' '.$aEntryMetadata['size'].' '.$aEntryMetadata['startsector'].' '$aEntryMetadata['type']."\n";
		
	}
}


$oAdfs->getFile('$.!BOOT');

The the contents of a give file

e.g.

$sFileContents = $oAdfs->getFile('$.!BOOT');


$oAdfs->getStat('$.!BOOT');

Stats a file

$oAdfs->isFile('$.!BOOT');

Test if a given path is a file or not

e.g.

$bFile = $oAdfs->isFile('$.!BOOT');
if($bFile){
	echo "!BOOT is file.\n" 
}

$oDfs->isDir('A');

Test if a given path is a file or not

$bDir = $oAdfs->isDir('D');
if($bDir){
	echo "D is a dir.\n" 
}

AdfsReaderHD Usage

This operates exactly the same as the AdfsReader class only the constuctor is different, as it does not support reading the disk image from a binary string.
As that is a some what negative feature with the significantly larger disk image sizes involved.

$oDfs = new \HomeLan\Retro\Acorn\Disk\AdfsReaderHD('scsi0.dat');

homelan/acorn-disk 适用场景与选型建议

homelan/acorn-disk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 325 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 09 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「SSD」 「ADL」 「adfs」 「DFS」 「acorn」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 homelan/acorn-disk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 homelan/acorn-disk 我们能提供哪些服务?
定制开发 / 二次开发

基于 homelan/acorn-disk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 325
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-25