Created
October 25, 2012 16:51
-
-
Save TheNaterz/3953985 to your computer and use it in GitHub Desktop.
End .asm file with infinite loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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