easier68k.core.models package

Submodules

easier68k.core.models.assembly_parameter module

Assembly Parameter

Represents a single parameter in assembly code this is the new ‘EAMode’ class

class easier68k.core.models.assembly_parameter.AssemblyParameter(mode: easier68k.core.enum.ea_mode.EAMode, data: int)[source]

Constructor

Checks that the mode and the data are considered to be valid, like registers are within the correct bounds and addresses are not out of bounds.

get_value(simulator: easier68k.simulator.m68k.M68K, length: easier68k.core.enum.op_size.OpSize = <OpSize.WORD: 2>) → easier68k.core.models.memory_value.MemoryValue[source]

Gets the value for this EAMode from the simulator :param simulator: reference to the 68k simulator :param length: the length in bytes associated with this operation, must be 1 2 or 4 :return: the value associated with this assembly parameter

set_value(simulator: easier68k.simulator.m68k.M68K, value: easier68k.core.models.memory_value.MemoryValue)[source]

Sets the value of a destination mode :param simulator: the reference to the simulator :param value: the value to set for this assembly parameter :param length: the number of bits associated for this instruction, must be 1 2 or 4 :return:

easier68k.core.models.list_file module

class easier68k.core.models.list_file.ListFile[source]

Represents assembled instructions and their locations in memory

Constructor

clear_location(location: int)[source]

Clears the data at the given location :param location: :return:

clear_symbol(name: str)[source]

Clears a label :param name: :return:

define_symbol(name: str, location: int)[source]

Defines a label and it’s associated location :param name: :param location: :return:

get_starting_data(location: int) → int[source]

Gets the data starting at the given location :param location: :return:

get_starting_execution_address()[source]

Gets the starting execution address :return:

get_symbol_data(name: str) → str[source]

Get the data for the given label Only works for the start of data This is not for reading in the middle of a set of data :param name: :return:

get_symbol_location(name: str) → int[source]

Gets the associated location for a label :param name: :return: the location associated to the label, if it exists

insert_data(location: int, data: str)[source]

Inserts the data at the given location into the list file This data should be a string of hexadecimal data :param location: :param data: :return:

insert_data_at_symbol(name: str, data: str)[source]

Inserts the data at the location for the given symbol :param name: :param data: :return:

load_from_json(json_str: str)[source]

Populates this object from a json str :param json_str: :return:

read_s_record_filename(filepath: str)[source]

Read the S record at the given file path, builds the content of this list file from it :param filepath: {str} Path to an S record :return: None

set_starting_execution_address(location: int)[source]

Sets the starting execution address :param location: :return:

to_json() → str[source]

Dumps the current object into a JSON string :return:

easier68k.core.models.memory_value module

Memory Value

Representation of some value in memory with a length of a Byte, Word or Long Word, which can either be an array of bytes, an integer number, a single character or an array of characters.

Supports operations like adding, subtracting, shift left, shift right, bitwise OR AND XOR, equals

Supports getting the most significant bit, determining the signed or unsigned integer values, the value as a array of bytes, the value as a hex string.

This was done to keep the interal handling of memory values consistent, instead of conversions back and forth between integers, hex strings and byte arrays.

class easier68k.core.models.memory_value.MemoryValue(len: easier68k.core.enum.op_size.OpSize = <OpSize.WORD: 2>, *, signed_int: int = None, unsigned_int: int = None, bytes: bytearray = None)[source]

Representation of some value in memory

Constructor

Sets the initial value to zero with a length of OpSize.Wordprint :param len the length in bytes of this memory value :param signed_int the value to set as a signed int :param unsigned_int the value to set as an unsigned int :param bytes the value to set as a bytearray

get_msb(size: easier68k.core.enum.op_size.OpSize = None)[source]

Get the most significant bit indicating that the value is negative :return:

get_negative()[source]

Gets the negative flag for the memory value :return:

get_size() → easier68k.core.enum.op_size.OpSize[source]

Gets the length of this memory value as an OpSize :return: the length in bytes of this value as defined by an OpSize

get_value_bytearray() → bytearray[source]

Get the value as a bytearray :return:

get_value_bytes() → bytes[source]

Get the bytes value :return:

get_value_signed()[source]

Gets the signed value :return:

get_value_unsigned()[source]

Gets the unsigned value :return:

lsl(other)[source]

logical shift left, allows for the msb to be set when shifted left :param other: :return:

lsr(other)[source]

logical shift right, the msb will always be 0 :param other: :return:

set_size(size: easier68k.core.enum.op_size.OpSize)[source]

Sets the length of this memory value :param size: the length in bytes of this value, defined by OpSize :return: None

set_value_bytes(bytes_value: bytes)[source]

Sets the value of this MemoryValue from an array of bytes :param bytes_value: :return:

set_value_signed_int(signed_int: int)[source]

Sets the value of this MemoryValue from a signed int :param signed_int: :return:

set_value_unsigned_int(unsigned_int: int)[source]

Sets the value of this MemoryValue from an unsigned int :param unsigned_int: :return:

easier68k.core.models.memory_value.mask_value_for_length(size: easier68k.core.enum.op_size.OpSize, unsigned_value: int) → int[source]

Masks an unsigned value to a certain size :param size: :param unsigned_value: :return:

easier68k.core.models.trap_vector module

Trap Vector

Represents the data type used by the TRAP opcode in ASM looks just like an immediate value

class easier68k.core.models.trap_vector.TrapVector(value: int)[source]
get_value() → int[source]
static parse(asm_str: str) → easier68k.core.models.trap_vector.TrapVector[source]

Parses a trap vector value from a string and returns a new TrapVector

Parameters:asm_str
Returns: