Class Program
java.lang.Object
org.applecommander.disassembler.api.Program
Program is a state class that tracks where decoding is, what the address is, and provides
a few helper methods to assist with various data types. Note that "get" reads from an absolute
position (always from 0) while "peek" reads from a relative position (from offset).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Get the base address.int
Get the current address.int
Get the current offset.int
getUnsignedByte
(int n) Get an unsigned byte from specified offset.boolean
hasMore()
Test if there are more bytes to process.int
length()
Length of code.int
peekSignedByte
(int n) Get a *signed* byte at the current offset + n.int
Get an unsigned byte at the current offset.int
peekUnsignedByte
(int n) Get an unsigned byte at the current offset + n.int
peekUnsignedShort
(int n) Get an unsigned short (2 bytes, little endian) at the current offset + n.byte[]
read
(int n) Read n bytes.
-
Constructor Details
-
Program
public Program(byte[] code, int address)
-
-
Method Details
-
length
public int length()Length of code. -
hasMore
public boolean hasMore()Test if there are more bytes to process. -
peekUnsignedByte
public int peekUnsignedByte()Get an unsigned byte at the current offset. Does not advance the offset value. -
peekUnsignedByte
public int peekUnsignedByte(int n) Get an unsigned byte at the current offset + n. Does not advance the offset value. -
peekUnsignedShort
public int peekUnsignedShort(int n) Get an unsigned short (2 bytes, little endian) at the current offset + n. Does not advance the offset value. -
peekSignedByte
public int peekSignedByte(int n) Get a *signed* byte at the current offset + n. Does not advance the offset value. -
read
public byte[] read(int n) Read n bytes. Advances offset. Used to read all bytes that are part of an instruction. -
getUnsignedByte
public int getUnsignedByte(int n) Get an unsigned byte from specified offset. This is not relative like the others. -
currentOffset
public int currentOffset()Get the current offset. -
baseAddress
public int baseAddress()Get the base address. This is the initial address passed into the constructor. -
currentAddress
public int currentAddress()Get the current address. Note that the address is wrapped across the address space. Currently, 64K.
-