projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed a missing space in a Am2900Teaching's description
[Mograsim.git]
/
plugins
/
net.mograsim.machine
/
src
/
net
/
mograsim
/
machine
/
standard
/
memory
/
MainMemoryParser.java
diff --git
a/plugins/net.mograsim.machine/src/net/mograsim/machine/standard/memory/MainMemoryParser.java
b/plugins/net.mograsim.machine/src/net/mograsim/machine/standard/memory/MainMemoryParser.java
index
ea87296
..
c3b0d68
100644
(file)
--- a/
plugins/net.mograsim.machine/src/net/mograsim/machine/standard/memory/MainMemoryParser.java
+++ b/
plugins/net.mograsim.machine/src/net/mograsim/machine/standard/memory/MainMemoryParser.java
@@
-6,6
+6,7
@@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import net.mograsim.logic.core.types.BitVector;
import net.mograsim.machine.MainMemory;
import net.mograsim.logic.core.types.BitVector;
import net.mograsim.machine.MainMemory;
@@
-50,7
+51,7
@@
public class MainMemoryParser
*/
public static void parseMemory(final MainMemory memory, InputStream input) throws IOException
{
*/
public static void parseMemory(final MainMemory memory, InputStream input) throws IOException
{
- try (BufferedReader reader = new BufferedReader(new InputStreamReader(input)))
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(input
, StandardCharsets.UTF_8
)))
{
MainMemoryDefinition def = memory.getDefinition();
{
MainMemoryDefinition def = memory.getDefinition();
@@
-63,7
+64,7
@@
public class MainMemoryParser
{
for (; i <= maxAddr && reader.ready() && !"".equals((line = reader.readLine())); i++)
{
{
for (; i <= maxAddr && reader.ready() && !"".equals((line = reader.readLine())); i++)
{
- memory.setCell(i, BitVector.parse(line));
+ memory.setCell(i, BitVector.parse
Bitstring
(line));
}
}
catch (IOException e)
}
}
catch (IOException e)
@@
-86,7
+87,8
@@
public class MainMemoryParser
int val = instStream.read();
if (val == -1 && instIndex <= maxAddress)
{
int val = instStream.read();
if (val == -1 && instIndex <= maxAddress)
{
- instStream = new ByteArrayInputStream((memory.getCell(instIndex++).toString() + lineSeparator).getBytes());
+ instStream = new ByteArrayInputStream(
+ (memory.getCell(instIndex++).toBitstring() + lineSeparator).getBytes(StandardCharsets.UTF_8));
val = instStream.read();
}
return val;
val = instStream.read();
}
return val;