OutFile for HackAssembler

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

OutFile for HackAssembler

Zorro
Hi, I implemented the HackAssembler on Eclipse with Java so far, but instead of writing the binary to a file, I tested yet via Copy & Paste from my debug output to the console.

Creating an output file from what I have, is actually not so difficult, but I was thinking about the line format. How does the Java VM handle line feeds on different platforms?

In other words? Do I end the lines with "Cr+Lf" ? Or are there any differences wether the Assembler runs on Windows, Linux or MacOS?
Reply | Threaded
Open this post in threaded view
|

Re: OutFile for HackAssembler

WBahn
Administrator
Just use the normal newline on your machine. The JVM is pretty good about dealing with it.

If you end up having problems, then we can revisit.
Reply | Threaded
Open this post in threaded view
|

Re: OutFile for HackAssembler

ivant
You can use java.lang.System.lineSeparator() to get the line separator.

Alternatively you can use println() or %n in printf for the same effect:


System.out.println("Hello world!");

System.out.printf("This is continues%non the next line test%n");