Ejemplo n.º 1
0
    ArgSlot AsmJsFunctionDeclaration::GetArgByteSize(ArgSlot inArgCount) const
    {
        ArgSlot argSize = 0;
        if (AsmJsImportFunction::Is(this))
        {
            Assert(inArgCount != Constants::InvalidArgSlot);
            argSize = ArgSlotMath::Mul(inArgCount, (uint16)MachPtr);
        }
#if _M_IX86
        else
        {
            for (ArgSlot i = 0; i < GetArgCount(); i++)
            {
                if( GetArgType(i).isMaybeDouble() )
                {
                    argSize = ArgSlotMath::Add(argSize, sizeof(double));
                }
                else if (GetArgType(i).isIntish())
                {
                    argSize = ArgSlotMath::Add(argSize, sizeof(int));
                }
                else if (GetArgType(i).isFloatish())
                {
                    argSize = ArgSlotMath::Add(argSize, sizeof(float));
                }
                else
                {
                    AssertOrFailFast(UNREACHED);
                }
            }
        }
#elif _M_X64
        else
        {
Ejemplo n.º 2
0
void _main(void)
{
  ESI argptr = top_estack;
  short a = GetIntArg (argptr);
  short b = GetIntArg (argptr);
  while (GetArgType (top_estack) != END_TAG)  // Clean up arguments
    top_estack = next_expression_index (top_estack);
  top_estack--;
  push_longint (a + b);
}
Ejemplo n.º 3
0
    ArgSlot AsmJsFunctionDeclaration::GetArgByteSize(ArgSlot inArgCount) const
    {
        uint argSize = 0;
        if (GetSymbolType() == AsmJsSymbol::ImportFunction)
        {
            Assert(inArgCount != Constants::InvalidArgSlot);
            argSize = inArgCount * MachPtr;
        }
#if _M_IX86
        else
        {
            for (ArgSlot i = 0; i < GetArgCount(); i++)
            {
                if( GetArgType(i).isMaybeDouble() )
                {
                    argSize += sizeof(double);
                }
                else if (GetArgType(i).isIntish())
                {
                    argSize += sizeof(int);
                }
                else if (GetArgType(i).isFloatish())
                {
                    argSize += sizeof(float);
                }
                else if (GetArgType(i).isSIMDType())
                {
                    argSize += sizeof(AsmJsSIMDValue);
                }
                else
                {
                    Assume(UNREACHED);
                }
            }
        }
#elif _M_X64
        else
        {
            for (ArgSlot i = 0; i < GetArgCount(); i++)
Ejemplo n.º 4
0
void _main(void)
{
	short i_menu_choice;
	graph *p_graph = NULL;
	matrix *p_matrix = NULL;
	point v_key[8];

	ESI EsiPtr = top_estack;									//pointer en haut de la pile
	FontSetSys(F_6x8);
	clrscr();

	//Verifie si une matrice est passée en parametre
	if((GetArgType(EsiPtr) != LIST_TAG)||(GetArgType(EsiPtr-1) != LIST_TAG)){		//Ce n'est pas une matrice
		EsiPtr = open_file();		//Si ce n'est pas la cas, ouvrir une fenetre
	}

	//sym = DerefSym(SymFind(GetSymstrArg(EsiPtr)));

	if(! is_square_matrix(EsiPtr)){
		printf("\Error : The matrix must be a squared matrix (same height and width). ");
		ngetchx();
		exit(0);
	}
Ejemplo n.º 5
0
_main() {
  SCR_RECT SCREEN = {{0, 0, LCD_WIDTH-1, LCD_HEIGHT-1}};
  SCR_RECT rect = {{0, 0, HEIGHT-1, HEIGHT-1}};

  short attr = A_XOR; // Default replace value: A_XOR

  // Parses arguments
  ESI argptr;
  InitArgPtr(argptr);
  int argtype = GetArgType(argptr);
  if (argtype == POSINT_TAG) {
    int num = GetIntArg(argptr);
    // 2. *** YOUR CODE HERE ***
  }

  // Initializes a rectangle bitmap of HEIGHT x HEIGHT
  char mask [BITMAP_SIZE];
  int i = 0;
  while (i < BITMAP_SIZE) {
    mask[i] = 0xFF; // Change this value to get different masks!
    i++;
  }
  BitmapInit(&rect, mask);

  // Puts the rectangle onto the screen
  DRAW;

  int c;
  // Main loop for getting keyboard input
  while ((c = ngetchx()) != ENTER_KEY) {
    // Erases old bitmap
    DRAW;
    switch (c) { // Moves bitmap around
    case LEFT_KEY:
      if (rect.xy.x0 - 5 >= 0) {
        rect.xy.x0 -=5;
        rect.xy.x1 -=5;
      }
      break;
    case RIGHT_KEY:
      if (rect.xy.x1 + 5 < LCD_WIDTH) {
        rect.xy.x0 +=5;
        rect.xy.x1 +=5;
      }
      break;
    case UP_KEY:
      if (rect.xy.y0 - 5 >= 0) {
        rect.xy.y0 -=5;
        rect.xy.y1 -=5;
      }
      break;
    case DOWN_KEY:
      if (rect.xy.y1 + 5 < LCD_HEIGHT) {
        rect.xy.y0 +=5;
        rect.xy.y1 +=5;
      }
      break;
    }
    // Draws new bitmap
    DRAW;
  }
}