Ejemplo n.º 1
0
void PrintAssembly(char inputStrings[100][MAXLENGTH])
{
 	int i;                       
	char temp[64];                                                                                                                	
 	for(i=0;i<=globals.numOfTotalInstructions;i++)
	{
			
 		sprintf(temp,"%s\t",inputStrings[i]);
		strcat(globals.buff,temp);
		memset(temp,0,sizeof(temp));

		sprintf(temp,"%d\t",insDecodeStructure[i].Address);
		strcat(globals.buff,temp);
		memset(temp,0,sizeof(temp));
		if(insDecodeStructure[i].Address<=globals.breakAddress)
		{
			PrintInstruction(i,temp);
		}
		else
		{
			sprintf(temp,"%d",insDecodeStructure[i].Value);
		}
		strcat(globals.buff,temp);
		memset(temp,0,sizeof(temp));
		fprintf(ofp_assm,"%s\n",globals.buff);
		memset(globals.buff,0,sizeof(globals.buff));
	}
}
Ejemplo n.º 2
0
void PrintInstructionList(FILE * outfile, Instruction * instr)
{
	while(instr) {
		PrintInstruction(outfile, instr);
		instr = instr->next;
	}
}
Ejemplo n.º 3
0
/*
 * Vypise celou posloupnst instrukci
 */
void PrintInstructionList(TMicroInstruction *instr)
{
	while (instr != NULL)
	{
		PrintInstruction(instr);
		instr = instr->next;
	}
}
Ejemplo n.º 4
0
void PrintInstructionList(FILE * outfile, Instruction * instr)
{
	/* YOUR CODE GOES HERE */
	while(instr != NULL){
		PrintInstruction(outfile, instr);
		instr = instr -> next;
	}
}
Ejemplo n.º 5
0
bool DisassemblyWindow::Init()
{
	vector<Program *> &Programs = TheProject.Programs[TheProject.SimISA];
	list<Segment *>::iterator SegmentIter;
	list<Element *>::iterator SequenceIter;
	Element *pElement;
	const char *sInstruction;
	unsigned int i, LineCount = 1;

	//Reorder the programs so that they are printed in order of increasing origin address
	typedef pair<unsigned int, uint64> OrderInfo;
	vector<OrderInfo> Order;
	vector<OrderInfo>::iterator OrderIter;
	for(i = 0; i < Programs.size(); i++)
	{
		for(OrderIter = Order.begin(); OrderIter != Order.end(); OrderIter++)
			if(Programs[i]->Address < OrderIter->second)
				break;
		Order.insert( OrderIter, OrderInfo(i, Programs[i]->Address) );
	}

	//Go over each program
	for(i = 0; i < Order.size(); i++)
	{
		//Go over each segment
		for(SegmentIter = Programs[Order[i].first]->Segments.begin(); SegmentIter != Programs[Order[i].first]->Segments.end(); SegmentIter++)
		{
			//Go over each element in the segment
			for(SequenceIter = (*SegmentIter)->Sequence.begin(); SequenceIter != (*SegmentIter)->Sequence.end(); SequenceIter++)
			{
				pElement = *SequenceIter;
				ostrstream strInstr;
				if(!TheSim(PrintInstruction(strInstr, pElement, pElement->Address, true, false, pMainMenu->menu()[1].value() != 0)))
					continue;
				strInstr << endl << ends;
				sInstruction = strInstr.str();
				pTextDisplay->pTextBuffer->append(strInstr.str());
				pElement->LocationID = LineCount;
				while(sInstruction[0])
				{
					LineCount++;
					sInstruction = strchr(sInstruction, '\n')+1;
				}
			}
		}
	}

	TheSim(fFirstBreak) = true;

	return true;
}
Ejemplo n.º 6
0
/////////////////////////////////////////////////////////////////////////////////////////
// Program main
int _tmain(int argc, _TCHAR* argv[])
{
	PrintInstruction();

	memset(controlWord, 0, LEG_COUNT*LEG_JDOF*sizeof(controlWord[0][0]));
	memset(statusWord, 0, LEG_COUNT*LEG_JDOF*sizeof(statusWord[0][0]));
	memset(homingStatus, 0, LEG_COUNT*LEG_JDOF*sizeof(homingStatus[0][0]));
	for (int ch = 0; ch < CAN_Ch_COUNT; ch++) {
		for (int node = 0; node < NODE_COUNT; node++)  {
			if (node == 0) homingStatus[ch][node] = HOMING_DONE;
			else homingStatus[ch][node] = HOMING_NONE;
		}
	}

	// open CAN channel:
	if (!OpenCAN())
		return -1;

	DriveReset();
	DriveInit();

	// start periodic communication:
//	printf("start periodic communication...\n");
//	StartCANListenThread();

	/*SetModeOfOperation();
	Sleep(50);
	ReadyToSwitchOn();
	Sleep(50);
	SwitchedOn();
	Sleep(50);
	OperationEnable();
	Sleep(50);*/
	/*Shutdown();
	Sleep(50);*/

	// loop wait user input:
	printf("main loop...\n");
	MainLoop();

	// stop periodic communication:
//	printf("stop periodic communication...\n");
//	StopCANListenThread();
	
	DriveOff();

	// close CAN channel:
	CloseCAN();

	return 0;
}
Ejemplo n.º 7
0
static void CodeGen(OpCode opcode, int field1, int field2, int field3)
{
	Instruction instr;

	if (!outfile) {
		ERROR("File error\n");
		exit(EXIT_FAILURE);
	}
	instr.opcode = opcode;
	instr.field1 = field1;
	instr.field2 = field2;
	instr.field3 = field3;
	PrintInstruction(outfile, &instr);
}
Ejemplo n.º 8
0
void PrintInstructionList(FILE * outfile, Instruction * instr)
{
    if (!outfile) {
        ERROR("File error\n");
        exit(EXIT_FAILURE);
    }
    if (!instr) {
        ERROR("No instructions\n");
        exit(EXIT_FAILURE);
    }
    Instruction *curr = instr;
    while(curr != NULL){
        PrintInstruction(outfile, curr);
        curr = curr->next;
    }
    /* YOUR CODE GOES HERE */
    
}
Ejemplo n.º 9
0
void PrintInstructionList(FILE * outfile, Instruction * instr)
{
	if (!outfile) {
		ERROR("File error\n");
		exit(EXIT_FAILURE);
	}
	if (!instr) {
		ERROR("No instructions\n");
		exit(EXIT_FAILURE);
	}
	Instruction *temp = instr;
	while(temp != NULL){
		if(temp->critical == 1){
			PrintInstruction(outfile, temp);
		}
		temp = temp->next;
	}
}
Ejemplo n.º 10
0
int _tmain(int argc, _TCHAR* argv[])
{
	//////////////////////////////////////////////////////////////
	// initialize communication with BioTac sensors
	if (!InitializeBioTac()) {
		printf("failed to initialize BioTac sensor.\n");
		printf("Press any key to quit...");
		getch();
		return false;
	}

	//////////////////////////////////////////////////////////////
	// print out some instructions
	PrintInstruction();

	//////////////////////////////////////////////////////////////
	// run main-loop to gather data from sensors
	bool bRun = true;
	while (bRun)
	{
		if (!_kbhit())
		{
			//fcu.Update();
#ifdef WIN32
			Sleep(100);
#else
			sleep(0.1);
#endif
		}
		else
		{
			int c = _getch();
			switch (c)
			{
			case 'p':
			case 'P':
				DumpBioTacData();
				break;
			case 's':
			case 'S':
				InitializeDAQ();
				break;
			case 'f':
			case 'F':
				TerminateDAQ();
				break;
			case 'q':
			case 'Q':
				bRun = false;
				break;
			}
		}
	}

	//////////////////////////////////////////////////////////////
	// terminate program
	TerminateDAQ();
	TerminateBioTac();
	printf("Press any key to quit...");
	getch();
	return 0;
}