void StateSystem::VertexEnableState::applyGL(GLbitfield changed) const
{
  for (GLuint i = 0; i < MAX_VERTEXATTRIBS; i++){
    if (isBitSet(changed,i)){
      if (isBitSet(enabled,i))  glEnableVertexAttribArray(i);
      else                      glDisableVertexAttribArray(i);
    }
  }
}
void StateSystem::EnableStateDepr::applyGL(GLbitfield changedBits) const
{
  for (GLuint i = 0; i < NUM_STATEBITSDEPR; i++){
    if (isBitSet(changedBits,i)){
      if (isBitSet(stateBitsDepr,i))  glEnable  (s_stateEnumsDepr[i]);
      else                            glDisable (s_stateEnumsDepr[i]);
    }
  }
}
Beispiel #3
0
// Attempt to open the specified joystick device
//
static GLFWbool openJoystickDevice(const char* path)
{
    int jid, code;
    char name[256] = "";
    char guid[33] = "";
    char evBits[(EV_CNT + 7) / 8] = {0};
    char keyBits[(KEY_CNT + 7) / 8] = {0};
    char absBits[(ABS_CNT + 7) / 8] = {0};
    int axisCount = 0, buttonCount = 0, hatCount = 0;
    struct input_id id;
    _GLFWjoystickLinux linjs = {0};
    _GLFWjoystick* js = NULL;

    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
    {
        if (!_glfw.joysticks[jid].present)
            continue;
        if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
            return GLFW_FALSE;
    }

    linjs.fd = open(path, O_RDONLY | O_NONBLOCK);
    if (linjs.fd == -1)
        return GLFW_FALSE;

    if (ioctl(linjs.fd, EVIOCGBIT(0, sizeof(evBits)), evBits) < 0 ||
        ioctl(linjs.fd, EVIOCGBIT(EV_KEY, sizeof(keyBits)), keyBits) < 0 ||
        ioctl(linjs.fd, EVIOCGBIT(EV_ABS, sizeof(absBits)), absBits) < 0 ||
        ioctl(linjs.fd, EVIOCGID, &id) < 0)
    {
        _glfwInputError(GLFW_PLATFORM_ERROR,
                        "Linux: Failed to query input device: %s",
                        strerror(errno));
        close(linjs.fd);
        return GLFW_FALSE;
    }

    // Ensure this device supports the events expected of a joystick
    if (!isBitSet(EV_KEY, evBits) || !isBitSet(EV_ABS, evBits))
    {
        close(linjs.fd);
        return GLFW_FALSE;
    }

    if (ioctl(linjs.fd, EVIOCGNAME(sizeof(name)), name) < 0)
        strncpy(name, "Unknown", sizeof(name));

    // Generate a joystick GUID that matches the SDL 2.0.5+ one
    if (id.vendor && id.product && id.version)
    {
        sprintf(guid, "%02x%02x0000%02x%02x0000%02x%02x0000%02x%02x0000",
                id.bustype & 0xff, id.bustype >> 8,
                id.vendor & 0xff,  id.vendor >> 8,
                id.product & 0xff, id.product >> 8,
                id.version & 0xff, id.version >> 8);
    }
Beispiel #4
0
// =======================================================
int CBlocksUseBitmap::readBitmap(DWORD dwPos, bool *bUsed, DWORD *dwBitsCount)
{
  if (m_cBitmap == NULL)
    RETURN_int(-1);
  
  // is the next bit used or free ?
  *bUsed = isBitSet(dwPos++);
  *dwBitsCount = 1; // currently, 1 bit has been read

  // copy all the bits which are in the same state than the first one
  // TODO: use the real bits count in the bitmap insted of (8*m_dwBitmapSize)
  
  //showDebug(0, "m_dwMaxUsedBlocksCopiedPerOper=%lu\n",m_dwMaxUsedBlocksCopiedPerOper);

  //showDebug(0, "TTT: used=%d, state(+1)=%d,state(+2)=%d,state(+3)=%d\n",(int)*bUsed,(int)isBitSet(dwPos),isBitSet(dwPos+1),isBitSet(dwPos+2),isBitSet(dwPos+3));

  // If we have used bits
  if (*bUsed)
    while ((dwPos < (8*m_dwBitmapSize)) && (*dwBitsCount < m_dwMaxUsedBlocksCopiedPerOper) && (isBitSet(dwPos) == true))
    {
      (*dwBitsCount)++;
      dwPos++;
    }
  else // if free
    while ((dwPos < (8*m_dwBitmapSize)) && (*dwBitsCount < m_dwMaxFreeBlocksCopiedPerOper) && (isBitSet(dwPos) == false))
    {
      (*dwBitsCount)++;
      dwPos++;
    }

  return 0; // success
}
Beispiel #5
0
static void sendErrorInterrupt(Uns32 chNum)
{
    if (isBitSet(chReg->EEI.value, chNum))
    {
        ppmWriteNet(handles.errorInterrupt, 1);
    }
}
Beispiel #6
0
unsigned int wt_access(bitRankW32Int** wtree, unsigned int idx, unsigned int
alphabet) {
  unsigned int lls = 0; // Lower limit of the sequence
  unsigned int uls = lenght_in_bits(wtree[0]) - 1; ; // Upper limit of the sequence

  int levels = log2(alphabet);
  unsigned int lla = 0; // Lower limit of the alphabet
  unsigned int ula = alphabet - 1; // Upper limit of the alphabet

  unsigned int crank = 0;
  unsigned int partial_crank = 0;

  unsigned int i = 0;
  for (i = 0; i < levels; i++) {
    if(isBitSet(wtree[i], idx + lls) != 1) {
      crank = _wt_rank_0(wtree[i], lls + idx) - _wt_rank_0(wtree[i], lls-1);
      idx = crank - 1;
      ula = (lla + ula) / 2;
      uls -= _wt_rank_1(wtree[i], uls) - _wt_rank_1(wtree[i], lls-1);

    } else {
      crank = _wt_rank_1(wtree[i], lls + idx) - _wt_rank_1(wtree[i], lls - 1);
      idx = crank - 1;
      lla = ((lla + ula) / 2) + 1;
      lls += _wt_rank_0(wtree[i], uls) - _wt_rank_0(wtree[i], lls - 1);
    }
  }
  return lla;
}
void StateSystem::ClipDistanceState::applyGL() const
{
  for (GLuint i = 0; i < MAX_CLIPPLANES; i++){
    if (isBitSet(enabled,i))  glEnable  (GL_CLIP_DISTANCE0 + i);
    else                      glDisable (GL_CLIP_DISTANCE0 + i);
  }
}
void StateSystem::ScissorEnableState::applyGL() const
{
  if (separateEnable){
    for (GLuint i = 0; i < MAX_VIEWPORTS; i++){
      if (isBitSet(separateEnable,i))  glEnablei (GL_SCISSOR_TEST,i);
      else                                    glDisablei(GL_SCISSOR_TEST,i);
    }
  }

}
Beispiel #9
0
/**
 * Realiza una conversión y devuelve el valor del conversor analógico/digital
 * para el canal seleccionado.
 * @return Valor de 8 bits resultante de la conversión.
 * @see configADC(), setADChannel()
 */
uint8_t getADCValue(void)
{
    // Disparar una conversión (ADSC=1)
    setBit(ADCSRA, 6);
    
    // Esperar hasta que la conversión termine
    while (isBitSet(ADCSRA, 6));
    
    // Retornar el registro de 8 bits
    return ADCH;
}
Beispiel #10
0
string byteToString(const unsigned char byte)
{
  string strByte="";
  for (int i=7;i>=0;i--)
  {
    if (isBitSet(byte,i))
      strByte+='1';
    else
      strByte+='0';
  }
  return strByte;
}
Beispiel #11
0
GfxElement * GfxDecoder::decode(const struct GfxEncoding *enc, const UINT8 *pRawGfx)
{
	assert(enc->bpp <= 8);

	int entrySize = enc->sizeX*enc->sizeY;

	// allocate memory for the decoded graphics (1 pixel -> 1 byte)
	UINT8 **decodedGfx = new UINT8*[4];
	for (int i = 0; i < 4; i++){
		decodedGfx[i] = new UINT8[enc->numEntries*entrySize];
		memset(decodedGfx[i], 0, enc->numEntries*entrySize);
	}

	// for each tile
	for (int num = 0; num < enc->numEntries; num++){
		// for each bitplane
		for (int plane = 0; plane < enc->bpp; plane++){

			// get bit to test (order 01234567 instead of the usual 76543210)
			int currBit = 1 << (enc->bpp - 1 - plane);

			// get offset to the starting of the current bitplane (in bits)
			int offs = enc->planeOffsets[plane] + num*enc->entryBitSize;

			for (int y = 0; y < enc->sizeY; y++){
				// get start of this line (in bits)
				int lineOffset = offs + enc->yOffs[y];

				for (int x = 0; x < enc->sizeX; x++){
					// check bit in the final position
					if (isBitSet(pRawGfx, lineOffset + enc->xOffs[x])){
						decodedGfx[NO_FLIP][entrySize*num + (y*enc->sizeX + x)] |= currBit;
						decodedGfx[FLIP_X] [entrySize*num + (y*enc->sizeX + (enc->sizeX - x - 1))] |= currBit;
						decodedGfx[FLIP_Y] [entrySize*num + ((enc->sizeY - y - 1)*enc->sizeX + x)] |= currBit;
						decodedGfx[FLIP_XY][entrySize*num + ((enc->sizeY - y - 1)*enc->sizeX + (enc->sizeX - x - 1))] |= currBit;
					}
				}
			}
		}
	}

	// return GfxElement struc
	GfxElement *g = new GfxElement();
	g->sizeX = enc->sizeX;
	g->sizeY = enc->sizeY;
	g->numEntries = enc->numEntries;
	g->entrySize = entrySize;
	g->bpp = enc->bpp;
	g->data = decodedGfx;

	return g;
}
Beispiel #12
0
/*
 * Return the next bit in the input stream.  This is
 * used to extract 2D tag values and the color tag
 * at the end of a terminating uncompressed data code.
 */
static int
DECLARE1(nextbit, TIFF*, tif)
{
    Fax3DecodeState *sp = &fax;
    int bit;

    if (sp->b.bit == 0 && fax.cc > 0)
        sp->b.data = fetchByte(tif, sp);
    bit = isBitSet(sp);
    if (++(sp->b.bit) > 7)
        sp->b.bit = 0;
    return (bit);
}
Beispiel #13
0
void StateSystem::VertexFormatState::applyGL(GLbitfield changedFormat, GLbitfield changedBinding) const
{
  for (GLuint i = 0; i < MAX_VERTEXATTRIBS; i++){
    if (!isBitSet(changedFormat,i)) continue;

    switch(formats[i].mode){
    case VERTEXMODE_FLOAT:
      glVertexAttribFormat(i, formats[i].size, formats[i].type, formats[i].normalized, formats[i].relativeoffset);
      break;
    case VERTEXMODE_INT:
    case VERTEXMODE_UINT:
      glVertexAttribIFormat(i, formats[i].size, formats[i].type, formats[i].relativeoffset);
      break;
    }
    glVertexAttribBinding(i,formats[i].binding);
  }

  for (GLuint i = 0; i < MAX_VERTEXBINDINGS; i++){
    if (!isBitSet(changedBinding,i)) continue;

    glVertexBindingDivisor(i,bindings[i].divisor);
    glBindVertexBuffer(i,0,0,bindings[i].stride);
  }
}
Beispiel #14
0
uint32_t BitString::getSetCount( uint32_t i_pos, uint32_t i_len ) const
{
    uint32_t endPos = i_pos + i_len;

    PRDF_ASSERT( endPos <= getBitLen() );

    uint32_t count = 0;

    for ( uint32_t i = i_pos; i < endPos; i++ )
    {
        if ( isBitSet(i) ) count++;
    }

    return count;
}
Beispiel #15
0
static void doCoincidenceFlag(struct gameboy * gameboy)
{
	if (gameboy->screen.currentScanline == readByte(gameboy, LY_COMPARE)){
		//current scanline == the values stored at 0xFF45
		//if this is true, set bit 2 of the status reg. Otherwise, reset it.
		setBit(&gameboy->screen.status, COINCIDENCE_BIT, true);
		if (isBitSet(gameboy->screen.status, COINCIDENCE_ENABLE_BIT)){
			requestInterrupt(gameboy, lcdStat);
		}
	}
	else {
		setBit(&gameboy->screen.status, COINCIDENCE_BIT, false);
	}
			
}
short * DistanceSensorPacket::getSensorValues(){
	// TODO
	short * values = new short[6];

	for (int i = 0; i < 6; i++)
		values[i] = 0;

	char mask = this->getCharData();
	
	// Get mask for data values
	for (int i = 0; i < 6; i++) {
		if (isBitSet(mask, i)) {
			values[i] = this->getShortData();
		}
	}

	return values;

/*
 * 	short * values = new short[6];

	for (int i = 0; i < 6; i++)
		values[i] = 0;

	int dataLength = this->getDataLength();
	char * data = this->getData();
	
	if (dataLength < 1)
		return values;

	char mask = data[0];
	
	// Skip mask
	data++;
	
	// Get mask for data values
	for (int i = 0; i < 6; i++) {
		if (isBitSet(mask, i)) {
			values[i] = *((short*)data);
			// Go to next value...
			data += 2;
		}
	}

	return values;

*/
}
Beispiel #17
0
	bool GenericDataTypeStruct::exportCode( GenericDataExportData& targetData, GenericDataTypeMode mode ) const
	{
		static const char* s_pBaseFormat		= "\n"
												  "\tstruct %s%s\n"
												  "\t{\n"
												  "%s"
												  "\t};\n";

		static const char* s_pBaseTypeFormat	= " : public %s";
		static const char* s_pFieldFormat		= "\t\t%s %s;\n";

		string fieldsCode;
		for (uint i = 0u; i < m_fields.getCount(); ++i)
		{
			const GenericDataStructField& field = m_fields[ i ];
			if ( !isBitSet( field.mode, mode ) || field.isInherited )
			{
				continue;
			}

			targetData.containsArray	|= (field.pType->getType() == GenericDataTypeType_Array);
			targetData.containsString	|= (field.pType->getName() == "string");
			
			if (field.pType->getType() == GenericDataTypeType_Reference)
			{
				const GenericDataTypeReference* pRefType = (const GenericDataTypeReference*)field.pType;
				if ( !targetData.references.contains( pRefType ) )
				{
					targetData.references.add( pRefType );
				}				
			}

			fieldsCode += formatString( s_pFieldFormat, field.pType->getExportName().cStr(), field.name.cStr() );
		}

		string baseTypeCode;
		if ( m_pBaseType != nullptr )
		{
			baseTypeCode = formatString( s_pBaseTypeFormat, m_pBaseType->getExportName().cStr() );
		}

		targetData.code += formatString( s_pBaseFormat, getExportName().cStr(), baseTypeCode.cStr(), fieldsCode.cStr() );

		return true;
	}
Beispiel #18
0
void StateSystem::VertexImmediateState::applyGL(GLbitfield changed) const
{
  for (GLuint i = 0; i < MAX_VERTEXATTRIBS; i++){
    if (!isBitSet(changed,i)) continue;

    switch(data[i].mode){
    case VERTEXMODE_FLOAT:
      glVertexAttrib4fv(i,data[i].floats);
      break;
    case VERTEXMODE_INT:
      glVertexAttribI4iv(i,data[i].ints);
      break;
    case VERTEXMODE_UINT:
      glVertexAttribI4uiv(i,data[i].uints);
      break;
    }
  }
}
Beispiel #19
0
QueryData genCPUID(QueryContext& context) {
  QueryData results;

  if (!genVendorString(results).ok()) {
    return results;
  }

  // Get the CPU meta-data about the model, stepping, family.
  genFamily(results);

  int regs[4] = {-1};
  int feature_register, feature_bit;
  for (auto& feature_set : kCPUFeatures) {
    int eax = feature_set.first;
    cpuid(eax, 0, regs);

    for (auto& feature : feature_set.second) {
      Row r;

      r["feature"] = feature.first;

      // Get the return register holding the feature bit.
      feature_register = 0;
      if (feature.second.first == "edx") {
        feature_register = 3;
      } else if (feature.second.first == "ebx") {
        feature_register = 1;
      } else if (feature.second.first == "ecx") {
        feature_register = 2;
      }

      feature_bit = feature.second.second;
      r["value"] = isBitSet(feature_bit, regs[feature_register]) ? "1" : "0";
      r["output_register"] = feature.second.first;
      r["output_bit"] = INTEGER(feature_bit);
      r["input_eax"] = boost::lexical_cast<std::string>(eax);
      results.push_back(r);
    }
  }

  return results;
}
Beispiel #20
0
void StateSystem::BlendState::applyGL() const
{
  if (separateEnable){
    for (GLuint i = 0; i < MAX_DRAWBUFFERS; i++){
      if (isBitSet(separateEnable,i)) glEnablei(GL_BLEND,i);
      else                            glDisablei(GL_BLEND,i);
    }
  }

  if (useSeparate){
    for (GLuint i = 0; i < MAX_DRAWBUFFERS; i++){
      glBlendFuncSeparatei(i,blends[i].rgb.srcw,blends[i].rgb.dstw,blends[i].alpha.srcw,blends[i].alpha.dstw);
      glBlendEquationSeparatei(i,blends[i].rgb.equ,blends[i].alpha.equ);
    }
  }
  else{
    glBlendFuncSeparate(blends[0].rgb.srcw,blends[0].rgb.dstw,blends[0].alpha.srcw,blends[0].alpha.dstw);
    glBlendEquationSeparate(blends[0].rgb.equ,blends[0].alpha.equ);
  }

  //glBlendColor(color[0],color[1],color[2],color[3]);
}
static int getWarningState(quint16 errorValue, int bit)
{
	return isBitSet(errorValue, bit) ? 1 : 0;
}
Beispiel #22
0
//do some refactoring here
static void handleVBlank(struct gameboy * gameboy)
{
	setBit(&gameboy->screen.status, 1, false);
	setBit(&gameboy->screen.status, 0, true); //set lower 2 bits to 01 (mode 1)
	gameboy->screen.currentLCDInterruptEnabled = isBitSet(gameboy->screen.status, VBLANK_ENABLE_BIT);
}
Beispiel #23
0
bool Gpio::SystemModule::level(const Gpio::InternalPinId & pin_id) {
    return isBitSet(pin_id, LVL_OFFSET);
}
Beispiel #24
0
static void handleSpriteSearch(struct gameboy * gameboy)
{
	setBit(&gameboy->screen.status, 1, true);
	setBit(&gameboy->screen.status, 0, false); //set lower 2 bits to 10
	gameboy->screen.currentLCDInterruptEnabled = isBitSet(gameboy->screen.status, SPRITE_ENABLE_BIT);
}
Beispiel #25
0
void StateSystem::applyDiffGL( const StateDiff& diff, const State &state, bool skipFboBinding )
{
  if (isBitSet(diff.changedContentBits,StateDiff::ENABLE))
    state.enable.applyGL(diff.changedStateBits);
  if (!m_coreonly && isBitSet(diff.changedContentBits,StateDiff::ENABLE_DEPR))
    state.enableDepr.applyGL(diff.changedStateDeprBits);
  if (isBitSet(diff.changedContentBits,StateDiff::PROGRAM))
    state.program.applyGL();
  if (isBitSet(diff.changedContentBits,StateDiff::CLIP))
    state.clip.applyGL();
  if (!m_coreonly && isBitSet(diff.changedContentBits,StateDiff::ALPHA_DEPR))
    state.alpha.applyGL();
  if (isBitSet(diff.changedContentBits,StateDiff::BLEND))
    state.blend.applyGL();
  if (isBitSet(diff.changedContentBits,StateDiff::DEPTH))
    state.depth.applyGL();
  if (isBitSet(diff.changedContentBits,StateDiff::STENCIL))
    state.stencil.applyGL();
  if (isBitSet(diff.changedContentBits,StateDiff::LOGIC))
    state.logic.applyGL();
  if (isBitSet(diff.changedContentBits,StateDiff::PRIMITIVE))
    state.primitive.applyGL();
  if (isBitSet(diff.changedContentBits,StateDiff::RASTER))
    state.raster.applyGL();
  if (!m_coreonly && isBitSet(diff.changedContentBits,StateDiff::RASTER_DEPR))
    state.rasterDepr.applyGL();
  /*if (isBitSet(diff.changedContentBits,StateDiff::VIEWPORT))
    state.viewport.applyGL();*/
  if (isBitSet(diff.changedContentBits,StateDiff::DEPTHRANGE))
    state.depthrange.applyGL();
  /*if (isBitSet(diff.changedContentBits,StateDiff::SCISSOR))
    state.scissor.applyGL();*/
  if (isBitSet(diff.changedContentBits,StateDiff::SCISSORENABLE))
    state.scissorenable.applyGL();
  if (isBitSet(diff.changedContentBits,StateDiff::MASK))
    state.mask.applyGL();
  if (isBitSet(diff.changedContentBits,StateDiff::FBO))
    state.fbo.applyGL(skipFboBinding);
  if (isBitSet(diff.changedContentBits,StateDiff::VERTEXENABLE))
    state.vertexenable.applyGL(diff.changedVertexEnable);
  if (isBitSet(diff.changedContentBits,StateDiff::VERTEXFORMAT))
    state.vertexformat.applyGL(diff.changedVertexFormat, diff.changedVertexBinding);
  if (isBitSet(diff.changedContentBits,StateDiff::VERTEXIMMEDIATE))
    state.verteximm.applyGL(diff.changedVertexImm);
}
Beispiel #26
0
static void renderSprites(struct gameboy * gameboy)
{
	//40 tiles in 0x8000 - 0x8FFF
	//scan through them all, check their attributes to find where they need to be rendered
	//sprite attributes found in the sprite attribute table 0xFE00-0xFE9F
	//each sprite has 4 bytes of attributes: y pos, x pos, sprite id, attributes

	bool use8x16 = false;
	if (isBitSet(gameboy->screen.control, 2)){
		use8x16 = true; //using sprite size of 8x16 pixels
	}
	
	for (int sprite = 0; sprite < 40; sprite++){
		//for each of the 40 sprites
		uint8_t spriteIndex = sprite * 4; //sprite occupies 4 bytes in the sprite attribute table
		uint8_t yPos = readByte(gameboy, (uint16_t)(0xFE00 + spriteIndex)) - 16; //index into sprite table, zero Y coord (offset by height)
		uint8_t xPos = readByte(gameboy, (uint16_t)(0xFE00 + spriteIndex + 1)) - 8; //index into sprite table, zero X coord (offset by width)
		uint8_t tileNum = readByte(gameboy, (uint16_t)(0xFE00 + index + 2));
		uint8_t attributes = readByte(gameboy, (uint16_t)(0xFE00 + index + 3));

		/* attributes table:
			bit 7: sprite to background priority
			bit 6: Y flip
			bit 5: x flip
			bit 4: colour palette number
			bit 3: not used in standard gameboy
			bit 2-0: not used in standard gameboy	
		*/

		//is the sprite flipped?
		bool yFlip = isBitSet(attributes, 6);
		bool xFlip = isBitSet(attributes, 5);

		uint8_t scanline = gameboy->screen.currentScanline;

		//store height of sprite
		int ySize = 8;
		if (use8x16){
			ySize = 16;
		}

		//is the scanline intercepting the sprite?
		if ((scanline >= yPos) && (scanline < (yPos + ySize))){
			//the vertical line on the sprite the scanline is at
			int line = scanline - yPos;

			if (yFlip){
				line -= ySize;
				line *= -1;
			}

			line *= 2; //two bytes, same as tiles
			uint16_t dataAddress = (0x8000 + (tileNum * 16)) + line;
			uint8_t data1 = readByte(gameboy, dataAddress);
			uint8_t data2 = readByte(gameboy, dataAddress+1);

			//read from right to left, as pixel 0 is bit 7 etc.
			for (int pixel = 7; pixel >= 0; pixel--){
				int colourBit = pixel;
				if (xFlip){
					colourBit -= 7;
					colourBit *= -1;
				}
	
				//the rest is the same as for tiles
				int colourNum = getBit(data2, colourBit);
				colourNum <<= 1;
				colourNum |= getBit(data1, colourBit);
				
				uint16_t colourAddress = isBitSet(attributes, 4) ? 0xFF49 : 0xFF48;
				enum COLOUR colour = getColourEnum(gameboy, colourNum, colourAddress);

				//white is transparent for sprites
				if (colour == WHITE){
					continue;
				}

				int red = 0;
				int green = 0;
				int blue = 0;

				switch(colour)
				{
					case WHITE: break;
					case LIGHT_GREY: red = 0xCC; green = 0xCC; blue = 0xCC; break;
					case DARK_GREY: red = 0x77; green = 0x77; blue = 0x77; break;
					case BLACK: break;
				}

				int xPix = 0 - pixel;
				xPix += 7;

				int pixel = xPos + xPix;
	
				gameboy->screen.frameBufferNew[3 * (gameboy->screen.currentScanline * X + pixel) + 0] = red;
				gameboy->screen.frameBufferNew[3 * (gameboy->screen.currentScanline * X + pixel) + 1] = green;
				gameboy->screen.frameBufferNew[3 * (gameboy->screen.currentScanline * X + pixel) + 2] = blue;
	
					
			}
		}

	}
				
}
static int getErrorState(quint16 errorValue, int bit)
{
	return isBitSet(errorValue, bit) ? 2 : 0;
}
Beispiel #28
0
static bool windowEnabled(struct gameboy * gameboy)
{
	return isBitSet(gameboy->screen.control, windowDisplayEnable) ? true : false;
}
static int getAlarmState(quint16 errorValue, quint16 warningValue, int bit)
{
	return isBitSet(errorValue, bit) ? 2 : (isBitSet(warningValue, bit) ? 1 : 0);
}
Beispiel #30
0
static void handleHBlank(struct gameboy * gameboy)
{
	setBit(&gameboy->screen.status, 1, false);
	setBit(&gameboy->screen.status, 1, true);
	gameboy->screen.currentLCDInterruptEnabled = isBitSet(gameboy->screen.status, HBLANK_ENABLE_BIT);
}