ScummVM API documentation
Gamos::VM Class Reference

Classes

class  Context
 
struct  MemAccess
 
struct  MemoryBlock
 
struct  OpLog
 
struct  ValAddr
 

Public Types

enum  OP {
  OP_EXIT = 0 , OP_CMP_EQ = 1 , OP_CMP_NE = 2 , OP_CMP_LE = 3 ,
  OP_CMP_LEQ = 4 , OP_CMP_GR = 5 , OP_CMP_GREQ = 6 , OP_CMP_NAE = 7 ,
  OP_CMP_NA = 8 , OP_CMP_A = 9 , OP_CMP_AE = 10 , OP_BRANCH = 11 ,
  OP_JMP = 12 , OP_SP_ADD = 13 , OP_MOV_EDI_ECX_AL = 14 , OP_MOV_EBX_ECX_AL = 15 ,
  OP_MOV_EDI_ECX_EAX = 16 , OP_MOV_EBX_ECX_EAX = 17 , OP_RET = 18 , OP_RETX = 19 ,
  OP_MOV_EDX_EAX = 20 , OP_ADD_EAX_EDX = 21 , OP_MUL = 22 , OP_OR = 23 ,
  OP_XOR = 24 , OP_AND = 25 , OP_NEG = 26 , OP_SAR = 27 ,
  OP_SHL = 28 , OP_LOAD = 29 , OP_INC = 30 , OP_DEC = 31 ,
  OP_XCHG = 32 , OP_PUSH_EAX = 33 , OP_POP_EDX = 34 , OP_LOAD_OFFSET_EDI = 35 ,
  OP_LOAD_OFFSET_EDI2 = 36 , OP_LOAD_OFFSET_EBX = 37 , OP_LOAD_OFFSET_ESP = 38 , OP_MOV_PTR_EDX_AL = 39 ,
  OP_MOV_PTR_EDX_EAX = 40 , OP_SHL_2 = 41 , OP_ADD_4 = 42 , OP_SUB_4 = 43 ,
  OP_XCHG_ESP = 44 , OP_NEG_ADD = 45 , OP_DIV = 46 , OP_MOV_EAX_BPTR_EDI = 47 ,
  OP_MOV_EAX_BPTR_EBX = 48 , OP_MOV_EAX_DPTR_EDI = 49 , OP_MOV_EAX_DPTR_EBX = 50 , OP_MOV_EAX_BPTR_EAX = 51 ,
  OP_MOV_EAX_DPTR_EAX = 52 , OP_PUSH_ESI_ADD_EDI = 53 , OP_CALL_FUNC = 54 , OP_PUSH_ESI_SET_EDX_EDI = 55 ,
  OP_MAX
}
 
enum  MEMREF { REF_UNK = 0 , REF_STACK = 1 , REF_EBX = 2 , REF_EDI = 3 }
 
typedef void(* CallDispatcher) (void *object, Context *state, uint32 funcID)
 

Public Member Functions

 VM (void *obj, CallDispatcher dispatcher)
 
MemAccess & memory ()
 
void clearMemory ()
 
void writeMemory (uint32 address, const byte *data, uint32 dataSize)
 
void zeroMemory (uint32 address, uint32 count)
 
MemoryBlock * findMemoryBlock (uint32 address)
 
MemoryBlock * createBlock (uint32 address)
 
Common::Array< byte > readMemBlocks (uint32 address, uint32 count)
 
void readMemBlocks (byte *dst, uint32 address, uint32 count)
 
Common::String readMemString (uint32 address, uint32 maxLen=256)
 
uint32 doScript (uint32 scriptAddress, byte *storage=nullptr)
 
Common::String decodeOp (uint32 address, int *size=nullptr)
 
Common::String disassembly (uint32 address)
 
Common::String opLog (const Common::Array< OpLog > &log)
 
void printDisassembly (uint32 address)
 

Static Public Member Functions

static int32 getS32 (const void *)
 
static uint32 getU32 (const void *)
 
static void setU32 (void *, uint32 val)
 

Public Attributes

bool _interrupt = false
 

Static Public Attributes

static constexpr const uint THREADS_COUNT = 2
 
static constexpr const uint STACK_SIZE = 0x100
 
static constexpr const uint STACK_POS = 0x80
 
static constexpr const uint MEMTYPE_SHIFT = 30
 
static constexpr const uint ADDRESS_MASK = (1 << MEMTYPE_SHIFT) - 1
 

Protected Attributes

Common::HashMap< uint32, MemoryBlock > _memMap
 
MemAccess _memAccess
 
Context _threads [THREADS_COUNT]
 
CallDispatcher const _callFuncs = nullptr
 
void *const _callingObject = nullptr
 

The documentation for this class was generated from the following file: