structures
c64tools - c64 Python helper.
Some classes that represent c64 structures. This file can also be imported as a module. It contains the following classes:
- Window - a basic pygame window for displaying stuff
- Memory - a basic pygame window for displaying stuff
- Bitmap - A c64 bitmap representation
- Char - The representation of a single c64 character
- Screen - The representation of c64 screen
- Methods for writing binary contents
Char
A single c64 character
__init__(data=None)
Constructor, allocates memory.
Assigns the given data. If no data is given, the data (character) is initialiased with zeros.
| Parameters: |
|
|---|
draw_at(surface, x, y, fgColor=(255, 255, 255, 255), bgColor=(0, 0, 0, 255))
Draws this character (in hires) at the given surface and the given position.
| Parameters: |
|
|---|
draw_at_multicolor(surface, x, y, fgColor=(255, 255, 255, 255), bgColor=(0, 0, 0, 255), multi1Color=(192, 192, 192, 255), multi2Color=(128, 128, 128, 255))
Draws this character in multicolor at the given surface and the given position.
| Parameters: |
|
|---|
same(c)
Returns whether the given character is same as this one.
| Parameters: |
|
|---|
| Returns: |
|
|---|
write(f)
Writes this character to a file.
| Parameters: |
|
|---|
inverse()
Inverses this character.
Window
Bases: object
A plain pygame window. Nothing special about it.
__init__(w, h, title='c64 draw')
Generates and shows a pygame window.
| Parameters: |
|
|---|
run()
Processes the pygame window events.
Should be called in a loop to process the occuring events. Sets the self.show flag to False when being closed.
Memory
The representation of a c64 memory.
__init__(data=None)
Constructor
Assigns the given data. If no data is given, the data (memory) is initialiased with zeros.
| Parameters: |
|
|---|
load(filename)
Loads the given files as a memory dump.
Reads the first two bytes as destination (starting address). Reads the reminder starting at this address, the rest of the memory is filled with zeros.
Loading assures that the memory is complete (is 65536 bytes long)
| Parameters: |
|
|---|
TODO: check destination byte order (not spent a thought on it)
draw_at(surface, x, y, cols, fgColor=(255, 255, 255, 255), bgColor=(0, 0, 0, 255))
Draws this memory at the given surface and the given position.
| Parameters: |
|
|---|
char_at(addr)
Returns the eight bytes at the given address as a char
| Parameters: |
|
|---|
| Returns: |
|
|---|
Bitmap
The representation of a c64 bitmap.
__init__(data=None)
Constructor
Assigns the given data. If no data is given, the data (bitmap) is initialiased with zeros.
| Parameters: |
|
|---|
char_at(col, row)
Returns the Char representation of the character at the given position.
| Parameters: |
|
|---|
| Returns: |
|
|---|
draw_at(surface, x, y, fgColor=(255, 255, 255, 255), bgColor=(0, 0, 0, 255))
Draws this bitmap at the given surface and the given position.
| Parameters: |
|
|---|
from_surface(surface, x, y)
Generates the Bitmap from the given surface, starting at the given position.
Please note that only white pixels are assumed to be set
| Parameters: |
|
|---|
Screen
The representation of a c64 screen
__init__(data=None)
Constructor, allocates memory.
Assigns the given data. If no data is given, the data (screen) is initialiased with zeros.
| Parameters: |
|
|---|
char_at(col, row)
Returns the caracter at the given position
| Parameters: |
|
|---|
| Returns: |
|
|---|
set_char_at(col, row, char)
Sets the given character at the given position
| Parameters: |
|
|---|