Skip to content

Instantly share code, notes, and snippets.

@TheNaterz
Created October 25, 2012 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheNaterz/3953985 to your computer and use it in GitHub Desktop.
Save TheNaterz/3953985 to your computer and use it in GitHub Desktop.
End .asm file with infinite loop
# Checking if the command type is a label in my driver loop
end_condition = true
if index != instruction_array.length-1
end_condition = false
end
code_writer.write_label(end_condition, arg_1)
# At the end of my driver loop
# If the last instruction isn't a label, an infinite loop is still made
if index == instruction_array.length-1 && command_type != :C_LABEL
code_writer.write_label()
end
# In my write_label method
@asm_file << "(" + arg_1 + ")\n" #arg_1 is given a default value
if end_condition #end_condition is given a default true
@asm_file << "@" + arg_1 + "\n0;JMP\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment