VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
AnyCollection.h
1// -----------------------------------------------------------------------------
2// This file is part of VirtualC64
3//
4// Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de
5// This FILE is dual-licensed. You are free to choose between:
6//
7// - The GNU General Public License v3 (or any later version)
8// - The Mozilla Public License v2
9//
10// SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0
11// -----------------------------------------------------------------------------
12
13#pragma once
14
15#include "AnyFile.h"
16
17namespace vc64 {
18
19class AnyCollection : public AnyFile {
20
21public:
22
23 AnyCollection() : AnyFile() { }
24 AnyCollection(isize capacity) : AnyFile(capacity) { }
25 virtual ~AnyCollection() = default;
26
27 // Returns the name of this collection
28 virtual PETName<16> collectionName() = 0;
29
30 // Returns the number of items stored in this collection
31 virtual isize collectionCount() const = 0;
32
33 // Returns the name of a certain item
34 virtual PETName<16> itemName(isize nr) const = 0;
35
36 // Returns the size of a certain in bytes
37 virtual isize itemSize(isize nr) const = 0;
38
39 // Reads a byte from a certain item
40 virtual u8 readByte(isize nr, isize pos) const = 0;
41
42
43 //
44 // Derived functions
45 //
46
47 // Reads a word from a certain item in little endian or big endian format
48 u16 readWordBE(isize nr, isize pos) const;
49 u16 readWordLE(isize nr, isize pos) const;
50
51 // Return the load address of this item
52 u16 itemLoadAddr(isize nr) const;
53
54 // Copies an item into a buffer
55 virtual void copyItem(isize nr, u8 *buf, isize len, isize offset = 0) const;
56};
57
58}
VirtualC64 project namespace.
Definition CmdQueue.cpp:16