eight_bit_computer.assembly_validity module

Validity checks on the processed assembly lines

eight_bit_computer.assembly_validity.check_structure_validity(asm_line_infos, variable_start_offset)[source]

Check the processed assembly lines for consistency/correctness.

Parameters:asm_line_infos (list(dict)) – List of dictionaries (conforming to get_assembly_line_template()) with information about all the lines in the assembly file.
eight_bit_computer.assembly_validity.check_multiple_label_defs(asm_line_infos)[source]

Check if the same label been defined more than once.

Parameters:asm_line_infos (list(dict)) – List of dictionaries (conforming to get_assembly_line_template()) with information about all the lines in the assembly file.
Raises:AssemblyError – If the same label been defined more than once.
eight_bit_computer.assembly_validity.check_multiple_label_assignment(asm_line_infos)[source]

Check if a single line been assigned more than one label.

Parameters:asm_line_infos (list(dict)) – List of dictionaries (conforming to get_assembly_line_template()) with information about all the lines in the assembly file.
Raises:AssemblyError – If a single line been assigned more than one label.
eight_bit_computer.assembly_validity.check_undefined_label_ref(asm_line_infos)[source]

Check if an operation is using a label that hasn’t been defined.

Parameters:asm_line_infos (list(dict)) – List of dictionaries (conforming to get_assembly_line_template()) with information about all the lines in the assembly file.
Raises:AssemblyError – If an operation is using a label that hasn’t been defined.
eight_bit_computer.assembly_validity.check_multiple_variable_def(asm_line_infos)[source]

Has the same variable been defined multiple times.

Parameters:asm_line_infos (list(dict)) – List of dictionaries (conforming to get_assembly_line_template()) with information about all the lines in the assembly file.
Raises:AssemblyError – If a variable has been defined more than once.
eight_bit_computer.assembly_validity.check_num_variables(asm_line_infos, variable_start_offset)[source]

Check there are more variables defined than will fit in data mem.

There are 255 bytes of data memory available and the start offset may eat into this.

Parameters:
  • asm_line_infos (list(dict)) – List of dictionaries (conforming to get_assembly_line_template()) with information about all the lines in the assembly file.
  • variable_start_offset (int) – How far in memory to offset when defining the first variable.
Raises:

AssemblyError – If there are more variables defined than will fit in data memory.

eight_bit_computer.assembly_validity.check_num_instruction_bytes(assembly_lines)[source]

Check there aren’t too many instruction_bytes.

Parameters:asm_line_infos (list(dict)) – List of dictionaries (conforming to get_assembly_line_template()) with information about all the lines in the assembly file.
Raises:AssemblyError – If there are more instruction bytes than will fit in program memory.