Disk module¶
- class Disk.Disk(size, filename)[source]¶
Bases:
objectClass emulating a Disk.
- __init__(size, filename)[source]¶
Class constructor. Initialize the vdisk object.
- Parameters:
size (int) – Size in bytes of the vdisk.
filename (str) – Real filename of the vdisk in the filesystem.
- get_size() int[source]¶
Get the size of the virtual disk.
- Returns:
Size in bytes of the virtual disk.
- Return type:
int
- __str__() str[source]¶
Overload of the str() function.
- Returns:
A string with the filename and size of the disk.
- Return type:
str
- size() int[source]¶
Size of the virtual disk.
- Returns:
Size in bytes of the virtual disk.
- Return type:
int
- filename(name: str) None[source]¶
Set the filename of the virtual disk.
- Parameters:
name (str) – Name of the file.
- write(sector: int, value: int) bool[source]¶
Write bytes to the virtual disk.
- Parameters:
sector – Sector where the byte is written.
value – The byte to be written.
- Returns:
True if successful, False if not.
- Return type:
bool
- read(sector: int) int[source]¶
Read a virtual disk sector.
- Parameters:
sector (int) – Sector to be read.
- Returns:
the read byte or -1 if there were any problem.
- Return type:
int