DASM
Private Attributes
DASMIO::Binary Class Reference

DCPU-16 assembler I/O functions for reading and writing binary files. More...

List of all members.

Private Member Functions

Public Functions
retval new (scalar proto, scalar dasm)
 Create an object upon which we can work.
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 read (scalar self, scalar content, scalar filename)
 Read a binary dump and populate our core.
retval write (scalar self, scalar filename)
 Write a binary dump from our core.

Private Attributes

scalar default_endian
 Default endian order; use 'binle' or 'binbe'.

Detailed Description

DCPU-16 assembler I/O functions for reading and writing binary files.

The specification doesn't say anything about the 8bit representation of a 16bit word output. The backstory only talks about the 16bit word ordering. Consequently, the representation could be either way around.

By default we assume little endian, although an explicit ordering can be forced by using a different file extension:

Binary dumps contain no symbols or relocation data. They are raw dumps of the content.

Definition at line 44 of file Binary.pm.


Member Function Documentation

retval DASMIO::Binary::extensions ( ) [private]

List the extensions we support.

Parameters:
[in]$selfAddress object
Returns:
arrayref of extensions
retval DASMIO::Binary::identify ( scalar  self,
scalar  filename,
scalar  type 
) [private]

Identify whether we can handle reading or writing a given file by its filename.

Parameters:
[in]$selfAddress object
[in]$filenameFilename we're accessing
[in]$type'read' or 'write'
Return values:
1if we can access it
0if we cannot access it
retval DASMIO::Binary::new ( scalar  proto,
scalar  dasm 
) [private]

Create an object upon which we can work.

Parameters:
[in]$protoPrototype object, or this class's name
[in]$dasmDASM object we're working on
Returns:
new object
retval DASMIO::Binary::read ( scalar  self,
scalar  content,
scalar  filename 
) [private]

Read a binary dump and populate our core.

Parameters:
[in]$selfAddress object
[in]$contentContent to parse
[in]$filenameFile it came from
retval DASMIO::Binary::write ( scalar  self,
scalar  filename 
) [private]

Write a binary dump from our core.

In order to write an address dump, we need to force a resolve of all of the symbols. If there are any symbols that cannot be resolved, that's a fatal error - because they would write out as 0s.

Parameters:
[in]$selfAddress object
[in]$filenameFilename we're writing
Returns:
Content to write

Member Data Documentation

Default endian order; use 'binle' or 'binbe'.

Definition at line 49 of file Binary.pm.


The documentation for this class was generated from the following file: