#include <codefile.h>
Public Types | |
| enum | format_t { format_16segs, format_ii_1 } |
Public Member Functions | |
| virtual | ~codefile () |
| codefile (const rcstring &filename) | |
| codefile (const rcstring &filename, format_t format) | |
| void | print_library_map (output_smart_pointer &os) |
| void | disassemble (output_smart_pointer &os, int flags) |
| void | read_block (unsigned block_num, void *data, unsigned nblocks=1) |
| void | write_block (unsigned block_num, const void *data, unsigned nblocks=1) |
| unsigned | get_word (const unsigned char *data) |
| void | put_word (unsigned char *data, unsigned value) |
| format_t | get_format () const |
| segment * | new_segment (const rcstring &name, bool syscomp) |
| unsigned | allocate (unsigned nblocks) |
| void | write_segment_dictionary () |
Private Types | |
| enum | byte_sex_t { little_endian, big_endian } |
| enum | { sizeof_block = 512 } |
Private Member Functions | |
| int | next_free_segment_number (bool syscomp=false) |
| codefile () | |
| codefile (const codefile &) | |
| codefile & | operator= (const codefile &) |
Private Attributes | |
| rcstring | filename |
| int | fd |
| byte_sex_t | byte_sex |
| unsigned | maximum_segments |
| segment ** | segments |
| rcstring | notice |
| format_t | format |
| unsigned | size_in_blocks |
Definition at line 32 of file codefile.h.
| enum codefile::format_t |
enum codefile::byte_sex_t [private] |
anonymous enum [private] |
| virtual codefile::~codefile | ( | ) | [virtual] |
The destructor.
| codefile::codefile | ( | const rcstring & | filename | ) |
The constructor.
This will open the file for reading only.
| filename | The name of the file to open. |
The constructor.
This will open the file for writing. Any file already there will be discarded.
| filename | The name of the file to open. | |
| format | the style of code file to produce |
| codefile::codefile | ( | ) | [private] |
The default constructor. Do not use.
| codefile::codefile | ( | const codefile & | ) | [private] |
The copy constructor. Do not use.
| void codefile::print_library_map | ( | output_smart_pointer & | os | ) |
The print_library_map method is used to print a map of the code file onto the given output.
| os | write the map text onto this output |
| void codefile::disassemble | ( | output_smart_pointer & | os, | |
| int | flags | |||
| ) |
The disassemble method is used to print a disassembly of the code file onto the given output.
| os | write the map text onto this output | |
| flags | 0x01 -> no addresses, 0x02 -> opcode comments |
| void codefile::read_block | ( | unsigned | block_num, | |
| void * | data, | |||
| unsigned | nblocks = 1 | |||
| ) |
The read_block method is used to read a block of data from the file.
| block_num | The block number to be read (zero based). | |
| data | where to put the data once read. | |
| nblocks | now many blocks to read (defaults to just 1 block) |
| void codefile::write_block | ( | unsigned | block_num, | |
| const void * | data, | |||
| unsigned | nblocks = 1 | |||
| ) |
The write_block method is used to write a block of data to the file.
| block_num | The block number to be read (zero based). | |
| data | where to get the data to write. | |
| nblocks | now many blocks to write (defaults to just 1 block) |
| unsigned codefile::get_word | ( | const unsigned char * | data | ) |
The get_word method is used to decode a two-byte word, taking byte_sex into account.
| data | pointer to two bytes of data |
| void codefile::put_word | ( | unsigned char * | data, | |
| unsigned | value | |||
| ) |
The put_word method is used to encode a two-byte word, taking byte_sex into account.
| format_t codefile::get_format | ( | ) | const [inline] |
The get_format method is used to get the format of the code file.
Definition at line 136 of file codefile.h.
References format.
The new_segment method is used to create a new segment in the codefile. While it has a name and a number, it does not yet have a fixed location in the file, that only happens when the segment is written, via the segment::write method.
| name | The name of the new segment | |
| syscomp | If true, system segments may be used. If false, system segments are not to be used |
| unsigned codefile::allocate | ( | unsigned | nblocks | ) |
The allocate method is used to allocate more space in the codefile. It is usually used to allocate new segments.
| nblocks | The number of blocks to allocate in the codefile. |
| void codefile::write_segment_dictionary | ( | ) |
The write_segment_dictionary method is used to write out a new copy of the segment dictionary (the first block of the codefile).
| int codefile::next_free_segment_number | ( | bool | syscomp = false |
) | [private] |
The next_free_segment_number method is used to obtain the next free (unused) segment number.
| syscomp | If true, system segment numbers may be used. If false, system segment numbers shall not be used. |
rcstring codefile::filename [private] |
The filename instance variable is used to remember the name of the code file.
Definition at line 174 of file codefile.h.
int codefile::fd [private] |
The fd instance variable is used to remember the file descriptor of the open code file.
Definition at line 180 of file codefile.h.
byte_sex_t codefile::byte_sex [private] |
The byte_sex instance variable is used to remember whether the file is little-endian (LSB first) or big-endian (MSB first).
Definition at line 194 of file codefile.h.
unsigned codefile::maximum_segments [private] |
The maximum_segments instance variable is used to remember how many segments slots are at the beginning of the file.
Definition at line 200 of file codefile.h.
segment** codefile::segments [private] |
The segments instance variable is used to remember the base address of a dynamically allocated array of pointers to segments. It will have exactly maximum_segments elements.
Definition at line 207 of file codefile.h.
rcstring codefile::notice [private] |
The holds the (copyright ?) notice from the file, if one was present.
Definition at line 213 of file codefile.h.
format_t codefile::format [private] |
The format instance variable is used to remember which format is used by this code file.
Definition at line 219 of file codefile.h.
Referenced by get_format().
unsigned codefile::size_in_blocks [private] |
The size_in_blocks instance variable is used to remember the size of the code file in blocks. This is useful when it come time to grow the codefile.
Definition at line 226 of file codefile.h.
1.5.1