Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,14 @@ int run_assembly()
include_dirs = NULL;

//...and if there's output, run the second pass and write it to the output file
if (mode & MODE_SYMTABLE || mode & MODE_NORMAL || mode & MODE_LIST)
if (mode & MODE_NORMAL || mode & MODE_LIST)
{
printf ("Pass two... \n");
int second_pass_session = StartSPASMErrorSession();
run_second_pass ();
ReplaySPASMErrorSession(second_pass_session);
EndSPASMErrorSession(second_pass_session);

if (mode & MODE_SYMTABLE) {
int symtable_session = StartSPASMErrorSession();
char* fileName = change_extension(output_filename, "lab");
write_labels (fileName);
free(fileName);
ReplayFatalSPASMErrorSession(symtable_session);
EndSPASMErrorSession(symtable_session);
}

//run the output through the appropriate program export and write it to a file
if (mode & MODE_NORMAL && output_filename != NULL)
Expand Down Expand Up @@ -189,6 +181,16 @@ int run_assembly()
input_files = NULL;
}

if (mode & MODE_SYMTABLE) {
printf("Outputting symbol table\n");
int symtable_session = StartSPASMErrorSession();
char* fileName = change_extension(output_filename, "lab");
write_labels(fileName);
free(fileName);
ReplayFatalSPASMErrorSession(symtable_session);
EndSPASMErrorSession(symtable_session);
}

//if there's info to be dumped, do that
if (mode & MODE_CODE_COUNTER) {
fprintf (stdout, "Size: %u\nMin. execution time: %u\nMax. execution time: %u\n",
Expand Down