DASM
|
DCPU-16 execution environment - hardware profile initialisation. More...
Private Member Functions | |
Public Functions | |
retval | new (scalar proto, scalar dasm) |
Create an object upon which we can work. | |
retval | register (scalar self, scalar address, scalar device, scalar args) |
Register a region of memory with a device. | |
retval | identify (scalar self, scalar filename, scalar type) |
Identify whether we can handle reading or writing a given file by its filename. | |
retval | extensions () |
List the extensions we support. | |
retval | parseline (scalar self, scalar line) |
Parse an instruction line. | |
Private Attributes | |
scalar | debug_reg |
Whether we debug the registrations. |
DCPU-16 execution environment - hardware profile initialisation.
This module provides the initialisation of the hardware mapped devices in the core of the DCPU-16 emulation. The mappings are defined in a hardware profile which describes the base address of the devices.
Each device is implemented by a device module in the directory DExecHW. An instance of the devices is created and attached to the addresses through a DExecHWAdapter. The adapter supplies the offset parameter to the device object, allowing multiple registers to be easily implemented in the device, despite not being known to the execution environment.
The hardware profiles take the form of lines in a file of the form:
<address> <device> [ '(' <arguments> ')' ]
<address> : a 4 character hexadecimal address that the hardware is mapped to
<device> : device, as a module in the DExecHW directory.
<arguments> : comma separated arguments to pass to the deviceComments are prefixed by a '#' character.
Devices may be registered in multiple locations with different arguments.
Each device has a window size, which it defines. This is the number of registers it provides and which will be allocated in the core.
Definition at line 75 of file Hardware.pm.
retval DASMIO::Hardware::extensions | ( | ) | [private] |
List the extensions we support.
[in] | $self | Our object |
retval DASMIO::Hardware::identify | ( | scalar | self, |
scalar | filename, | ||
scalar | type | ||
) | [private] |
Identify whether we can handle reading or writing a given file by its filename.
[in] | $self | Our object |
[in] | $filename | Filename we're accessing |
[in] | $type | 'read' or 'write' |
1 | if we can access it |
0 | if we cannot access it |
retval DASMIO::Hardware::new | ( | scalar | proto, |
scalar | dasm | ||
) | [private] |
Create an object upon which we can work.
[in] | $proto | Prototype object, or this class's name |
[in] | $dasm | DASM object we're working on |
retval DASMIO::Hardware::parseline | ( | scalar | self, |
scalar | line | ||
) | [private] |
Parse an instruction line.
[in] | $self | IO object |
[in] | $line | Line to process |
retval DASMIO::Hardware::register | ( | scalar | self, |
scalar | address, | ||
scalar | device, | ||
scalar | args | ||
) | [private] |
Register a region of memory with a device.
[in] | $self | This hardware object |
[in] | $address | The address to assign the device at |
[in] | $device | The device name |
[in] | $args | arrayref of arguments for the device |
scalar DASMIO::Hardware::debug_reg [private] |
Whether we debug the registrations.
Definition at line 80 of file Hardware.pm.