Last active
December 16, 2015 20:29
-
-
Save hawkw/5493266 to your computer and use it in GitHub Desktop.
I feel bad that I wrote this. Also featuring a sad attempt at injecting comments into terrible code.
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
while (!filterQueue.empty()) { | |
// if we find a comment-closing character... | |
if (filterQueue.front().contains("(")) { | |
// ...pop until we find a comment character | |
while (!filterQueue.empty() | |
&& !filterQueue.front().contains(")")) { | |
filterQueue.dequeue(); | |
} | |
if (!filterQueue.empty()) | |
filterQueue.dequeue(); | |
// if we don't find a comment opening character... | |
} else if (filterQueue.front().contains("S\"")) { // ...but we find a string... | |
s = new StringBuilder(); | |
filterQueue.dequeue(); | |
do { | |
s.append(filterQueue.dequeue() + " "); | |
} while (!filterQueue.empty() | |
&& !filterQueue.front().contains("\"")); | |
filterQueue.dequeue(); | |
currentAddress = Integer.parseInt(filterQueue.dequeue(), 16); | |
if (verboseMode) | |
System.out.println("-> fillRAM " + Word.wordBuilder(0x14, currentAddress)); | |
engine.fillRAM(Word.wordBuilder(0x14, currentAddress)); | |
engine.writeToRAM(Word.wordBuilder(s.toString()), engine.parseHex(Integer.toHexString(currentAddress))); | |
} else { | |
// ...everything is fine and good! | |
if (getReqArgs(filterQueue.front()) == 1) { | |
currentInstruction = getOpcode(filterQueue.dequeue()); | |
currentAddress = Integer.parseInt(filterQueue.dequeue(), 16); | |
if (verboseMode) | |
System.out.println("-> fillRAM " + Word.wordBuilder(currentInstruction, currentAddress)); | |
engine.fillRAM(Word.wordBuilder(currentInstruction, currentAddress)); | |
} else if (getReqArgs(filterQueue.front()) == 0) { | |
currentInstruction = getOpcode(filterQueue.dequeue()); | |
if (verboseMode) { | |
System.out.println("-> fillRAM "+ Word.wordBuilder(currentInstruction)); | |
engine.fillRAM(Word.wordBuilder(currentInstruction)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment