mirror of
https://github.com/tjboldt/ProDOS-Utilities.git
synced 2024-12-01 01:49:59 +00:00
Fix comments for documentation
This commit is contained in:
parent
e590b82196
commit
7f727a6377
@ -39,11 +39,17 @@ type DirectoryHeader struct {
|
||||
}
|
||||
|
||||
const (
|
||||
// File is deleted
|
||||
StorageDeleted = 0
|
||||
// File is <= 512 bytes
|
||||
StorageSeedling = 1
|
||||
// File is > 512 bytes and <= 128 KB
|
||||
StorageSapling = 2
|
||||
// File is > 128 KB and <= 16 MB
|
||||
StorageTree = 3
|
||||
// Pacal storage area
|
||||
StoragePascal = 4
|
||||
// Directory
|
||||
StorageDirectory = 13
|
||||
)
|
||||
|
||||
|
@ -6,20 +6,24 @@
|
||||
|
||||
package prodos
|
||||
|
||||
// MemoryFile containts file data and size
|
||||
type MemoryFile struct {
|
||||
data []byte
|
||||
size int
|
||||
}
|
||||
|
||||
// NewMemoryFile creates an in-memory file of the specified size in bytes
|
||||
func NewMemoryFile(size int) *MemoryFile {
|
||||
return &MemoryFile{make([]byte, size), size}
|
||||
}
|
||||
|
||||
// WriteAt writes data to the specified offset in the file
|
||||
func (memoryFile *MemoryFile) WriteAt(data []byte, offset int64) (int, error) {
|
||||
copy(memoryFile.data[int(offset):], data)
|
||||
return len(data), nil
|
||||
}
|
||||
|
||||
// ReadAt reads data from the specified offset in the file
|
||||
func (memoryFile *MemoryFile) ReadAt(data []byte, offset int64) (int, error) {
|
||||
copy(data, memoryFile.data[int(offset):])
|
||||
return len(data), nil
|
||||
|
Loading…
Reference in New Issue
Block a user