public class HEXFileManager extends Object
| Constructor and Description |
|---|
HEXFileManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
addTable(Map<Integer,String> ha)
Keys of the HashMap have to represent adresses and values have to
represent compiled code.
|
void |
generateFile(String filename)
Generates a Intel Hex file based on the cached program map.
|
int |
getProgramStart()
Get the program starting address (the first address that has occured in
the program HashMap).
|
Map<Integer,String> |
getTable()
Get the Map representing the program hex code.
|
static int |
loadIntoMemory(File file,
MemoryContext<Short> memory) |
boolean |
loadIntoMemory(MemoryContext<Short> mem)
Method is similar to generateHex() method in that way, that compiled
program is also transformed into chunk of bytes, but not to hex file but
to the operating memory.
|
static HEXFileManager |
parseFromFile(File file) |
int |
putCode(String code)
Put a series of bytes to the code table.
|
void |
setNextAddress(int address)
Set the next address where the next value will be assigned.
|
public int putCode(String code)
0A0B10
represents 3 bytes: 0x0A, 0x0B and 0x10.
The code table is modified so that all addresses starting from the current
one up to the code length will contain corresponding byte.
The current address is then increased by the code length.
If a byte exists on an address already, it is overwritten.code - Hexadecimal representation of binary codepublic void setNextAddress(int address)
address - next addresspublic void addTable(Map<Integer,String> ha)
ha - sub-table with addresses and codespublic Map<Integer,String> getTable()
public boolean loadIntoMemory(MemoryContext<Short> mem)
mem - context of operating memorypublic void generateFile(String filename) throws IOException
filename - file name where to store the hex fileIOException - if the HEX file could not be writtenpublic int getProgramStart()
public static HEXFileManager parseFromFile(File file) throws Exception
Exceptionpublic static int loadIntoMemory(File file, MemoryContext<Short> memory) throws Exception
ExceptionCopyright © 2017. All rights reserved.