public
Last active

I feel bad that I wrote this. Also featuring a sad attempt at injecting comments into terrible code.

  • Download Gist
oh my god it's full of loops.java
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
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));
}
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.