#include <stdlib.h>
#include <vm.h>
#include <extension.h>


int InitVM(){
   /* for now this only creates the register table */
   return( 1 );
}

int AddRegTableEntry(int index, char *mnemonic, int size){
   if (index >= ext_arch->sz_regtable) return(0);
   ext_arch->reg_table[index].size = size;
   strncpy(ext_arch->reg_table[index].mnemonic, mnemonic, 8);
   return(1);
}

char * GetRegMnemonic(int index){
   if (index >= ext_arch->sz_regtable) return(0);
   return( ext_arch->reg_table[index].mnemonic );
}

int GetRegSize(int index){
   if (index >= ext_arch->sz_regtable) return(0);
   return( ext_arch->reg_table[index].size );
}

void CleanupVM(){
   return;
}

void *RegisterOperation(int reg, int op, void *operand){

   /*switch (op){
      case REGOP_READ:
         break;
      case REGOP_WRITE:
         break;
      case REGOP_ADD:
         break;
      case REGOP_SUBTRACT:
         break;
      case REGOP_R_SHIFT:
         break;
      case REGOP_L_SHIFT:
         break;
      default:
         break;
   }*/
   return(operand);
}
