mars.mips.dump
Class AsciiTextDumpFormat
java.lang.Object
mars.mips.dump.AbstractDumpFormat
mars.mips.dump.AsciiTextDumpFormat
- All Implemented Interfaces:
- DumpFormat
public class AsciiTextDumpFormat
- extends AbstractDumpFormat
Class that represents the "ASCII text" memory dump format. Memory contents
are interpreted as ASCII codes. The output
is a text file with one word of MIPS memory per line. The word is formatted
to leave three spaces for each character. Non-printing characters
rendered as period (.) as placeholder. Common escaped characters
rendered using backslash and single-character descriptor, e.g. \t for tab.
- Author:
- Pete Sanderson
Method Summary |
void |
dumpMemoryRange(File file,
int firstAddress,
int lastAddress)
Interpret MIPS memory contents as ASCII characters. |
AsciiTextDumpFormat
public AsciiTextDumpFormat()
- Constructor. There is no standard file extension for this format.
dumpMemoryRange
public void dumpMemoryRange(File file,
int firstAddress,
int lastAddress)
throws AddressErrorException,
IOException
- Interpret MIPS memory contents as ASCII characters. Each line of
text contains one memory word written in ASCII characters. Those
corresponding to tab, newline, null, etc are rendered as backslash
followed by single-character code, e.g. \t for tab, \0 for null.
Non-printing character (control code,
values above 127) is rendered as a period (.). Written
using PrintStream's println() method.
Adapted by Pete Sanderson from code written by Greg Gibeling.
- Specified by:
dumpMemoryRange
in interface DumpFormat
- Specified by:
dumpMemoryRange
in class AbstractDumpFormat
- Parameters:
file
- File in which to store MIPS memory contents.firstAddress
- first (lowest) memory address to dump. In bytes but
must be on word boundary.lastAddress
- last (highest) memory address to dump. In bytes but
must be on word boundary. Will dump the word that starts at this address.
- Throws:
AddressErrorException
- if firstAddress is invalid or not on a word boundary.
IOException
- if error occurs during file output.