int main(int argc, char **argv) { initializeDebug(); int i = 1; while (i < argc) { if (parseArgument(argv[i++]) == -1) exit(0); } initializeRegisters(); run(isTimerEnabled()); }
int main (int argc, char* argv[]) { (void)argc; (void)argv; initializeRegisters(registers, numReg); testConditionalMove(); testAddition(); testMultiplication(); testDivision(); testBitwiseNAND(); testLoadVal(); testIO(); //testHalt(); //printf("Failure! Did not halt.\n"); return 0; }
int main() { printf("Start Computer \n"); //initialize all data structures initializeInstructionMemory(); memory = (int*) calloc(sizeOfMemory, sizeof(int)); initializeRegisters(); //Alarm as clock signal(SIGALRM, clockTick); alarm(1); while(flag == 0) { pause(); } freeArrays(); printf("\nThe End\n\n"); return 0; }
/* * Creates memeory for the program to run and gets the instruction code along * with the registers. */ void build_and_execute_um(FILE* program){ memorySegments = newMem(); instantiateMem(memorySegments, INITIAL_SET_SIZE); initializeRegisters(registers, numRegisters); mapProgram(program); programCounter = 0; numInstructions = instructionLength(); //programPointer = getInstructions(memorySegments); while(programCounter < numInstructions){ UM_Word instruction = getInstruction(programCounter); Instruction instr = parseInstruction(instruction); execute_instruction(instr); if(instr.op == HALT) break; } freeMem(memorySegments); }