eight_bit_computer.assembly_summary module

Extract information from a list of assembly line info dictionaries.

eight_bit_computer.assembly_summary.generate_assembly_summary(asm_line_infos)[source]

Produce a summary that combines assembly and machine code.

The summary will be like this:

 1 $variable0              |
 2 @label1                 |
 3     LOAD [$variable1] A |  0 00 00000000 - @label1 255 FF 11111111
                           |  1 01 00000001 -           1 01 00000001 $variable1
 4                         |
 5 @label2                 |
 6     LOAD [$variable2] A |  2 02 00000010 - @label2 255 FF 11111111
                           |  3 03 00000011 -           2 02 00000010 $variable2
 7     JUMP @label1        |  4 04 00000100 -         255 FF 11111111
                           |  5 05 00000101 -           0 00 00000000 @label1
 8                         |
 9     STORE A [#123]      |  6 06 00000110 -         255 FF 11111111
                           |  7 07 00000111 -         123 7B 01111011 #123
10 @label3                 |
11     LOAD [$variable3] B |  8 08 00001000 - @label3 255 FF 11111111
                           |  9 09 00001001 -           3 03 00000011 $variable3
12     LOAD [$variable0] C | 10 0A 00001010 -         255 FF 11111111
                           | 11 0B 00001011 -           0 00 00000000 $variable0
13 $variable4              |
14 // comment
Parameters:asm_line_infos (list(dict)) – List of dictionaries of information about the parsed assembly.
Returns:Printable summary.
Return type:str
eight_bit_computer.assembly_summary.generate_assembly_summary_lines(asm_line_infos)[source]

Generate list of lines for an assembly summary

Parameters:asm_line_infos (list(dict)) – List of dictionaries of information about the parsed assembly.
Returns:List of lines for the summary.
Return type:list(str)
eight_bit_computer.assembly_summary.get_assembly_summary_data(asm_line_infos)[source]

Process assembly data to make formatting easier for the summary.

Parameters:asm_line_infos (list(dict)) – List of line info dictionaries as returned by process_assembly_lines() .
Returns:List of entries for the assembly summary print out
Return type:list
eight_bit_computer.assembly_summary.get_widest_column_values(assembly_summary_data)[source]

Find widest values in the columns of the output.

Required for the eventual printed table to line up correctly.

Parameters:assembly_summary_data (list(dict)) – List of dictionaries (as returned by get_assembly_summary_data()) with all the summary information data.
Returns:Mapping of columns for widest values.
Return type:dict