eight_bit_computer.main module¶
Top level interface for the module
-
eight_bit_computer.main.
assemble
(input_filepath, output_filename_base=None, output_dir=None, output_format='logisim')[source]¶ Read an assembly file and write out equivalent machine code.
Parameters: - input_filepath (str) – The location of the assembly file.
- output_filename_base (str) (optional) – The location to write out the machine code (without extension). If nothing is passed, the output path will be the input filename with the extension changed to mc.
- output_dir (str) (optional) – The directory to write the assembled code into.
- output_format (str) (optional) – How to format the output.
logisim
orarduino
.
-
eight_bit_computer.main.
write_bitstrings_to_logisim
(assembly_line_infos, output_dir, output_filename_base)[source]¶ Write machine code and variable bitstrings to logisim format.
Parameters: - assembly_line_infos (list(dict)) – List of dictionaries of information about the parsed assembly.
- output_dir (str) – The directory to write the assembled code into.
- output_filename_base (str) – the basename (no extension) for the logisim file.
-
eight_bit_computer.main.
write_bitstrings_to_arduino
(assembly_line_infos, output_dir, output_filename_base)[source]¶ Write machine code and variable bitstrings to arduino format.
Parameters: - assembly_line_infos (list(dict)) – List of dictionaries of information about the parsed assembly.
- output_dir (str) – The directory to write the assembled code into.
- output_filename_base (str) – The filename (with no extension) for the file.
-
eight_bit_computer.main.
filepath_to_lines
(input_filepath)[source]¶ Take a filepath and get all the lines of the file.
The lines returned have the newline stripped.
Parameters: input_filepath (str) – Path to the file of disk to read. Returns: Lines of the file. Return type: list(str)
-
eight_bit_computer.main.
get_mc_filename
(asm_path)[source]¶ Get the filename for the machine code.
This is the assembly filename with .asm replaced with .mc
Parameters: asm_path (str) – Path to the assembly file. Returns: Path to the machine code file. Return type: str
-
eight_bit_computer.main.
gen_roms
(output_dir='.', file_prefix=None, output_format='logisim')[source]¶ Write files containing microcode for drive the roms.
Parameters: - output_dir (str) (optional) – The directory to write the roms into.
- file_prefix (str) (optional) – The prefix for the rom files.
- output_format (str) (optional) – How to format the output.
logisim
orarduino
.