Example #1
0
bool saveAnim (personaAnimation * p, FILE * fp) {
	put2bytes (p -> numFrames, fp);
	if (p -> numFrames) {
		put4bytes (p -> theSprites -> ID, fp);

		for (int a = 0; a < p -> numFrames; a ++) {
			put4bytes (p -> frames[a].frameNum, fp);
			put4bytes (p -> frames[a].howMany, fp);
			put4bytes (p -> frames[a].noise, fp);
		}
	}
	return true;
}
Example #2
0
void and_imm_rm32(int size, int reg)
{
	/*
	 * imm is ok because it is sign extended
	 * unlike add and sub when reg==eax
	 */
	//check if size is an imm8
	if(0x0<=size && size <=0xff) {
		//check if register
		if(isreg(reg)) {
			//special case for accumulator register eax
/*			if(reg==EAX) {
 				//add imm8 to r8
				putbyte(0x24);
				putbyte(size);
			}
			else {*/
				//add sign extended imm8 to r32
				putbyte(0x83);
				putbyte(0xe0+reg);
				putbyte(size);
//			}
		}
		//memory location
		else {
			putbyte(0x83);
			putbyte(0x20+reg-0x8);
			putbyte(size);
		}
	}
	//size is bigger than imm8
	else {
		if(isreg(reg)) {
			//special case for accumulator register eax
			if(reg==EAX) {
				putbyte(0x25);
				put4bytes(size);
			}
			else {
				putbyte(0x81);
				putbyte(0xe0+reg);
				put4bytes(size);
			}
		}
		else {
			putbyte(0x81);
			putbyte(0x20+reg-0x8);
			put4bytes(size);
		}
	}
}
Example #3
0
void cmp_imm_r32(int size, int reg)
{
	//sign extended imm
	if(0<=size && size<=255) {
		if(isreg(reg)) {
			putbyte(0x83);
			putbyte(0xf8+reg);
			putbyte(size);
		}
		else aerror("Error: not reg in cmp_imm_r32");
	}
	else {
		//imm32
		if(isreg(reg)) {
			putbyte(0x81);
			putbyte(0xf8+reg);
			put4bytes(size);
		}
		else aerror("Error: not reg in cmp_imm_r32");
	}
}