Skip to content

Commit

Permalink
fix bug;
Browse files Browse the repository at this point in the history
  • Loading branch information
VipinindKumar committed Aug 29, 2017
1 parent d149d94 commit 3ca4678
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions CodeWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,10 @@ public void writeCall(String funcName, String nArgs) {


// goto funcName
writeGoto(funcName);
out.write("@" + funcName.toUpperCase());
out.newLine();
out.write("0;JMP");
out.newLine();


// (returnAddress)
Expand Down Expand Up @@ -676,7 +679,7 @@ public void writeFunction(String funcName, String nLocals) {
out.newLine();

// while(n > 0)
writeLabel(funcName + "$LOOP");
writeLabel("LOOP");
out.write("@n");
out.newLine();
out.write("D = M");
Expand All @@ -696,10 +699,10 @@ public void writeFunction(String funcName, String nLocals) {
out.newLine();

// goto LOOP
writeGoto(funcName + "$LOOP");
writeGoto("LOOP");

// (END_LOOPi)
writeLabel(funcName + "$END_LOOP");
writeLabel("END_LOOP");

i++;
}
Expand Down

0 comments on commit 3ca4678

Please sign in to comment.