int Load_Wordlist() { FILE* list=fopen("latinwords.txt","rb"); if(list==NULL)return -1; int numberoflines=0; int curchar; while ((curchar=fgetc(list))!=EOF) { numberoflines+=(curchar==10)?1:0; } fseek(list,0,SEEK_SET); printf("%d words detected.\n",numberoflines); numwords=numberoflines; Words=malloc(sizeof(Word)*numberoflines); int i; for(i=0;i<numberoflines;i++) { Words[i]=Read_Word(list); if(Words[i].latin==NULL)return -1; } fclose(list); return 0; }
int main(int argc, const char *argv[]) { const char *result_dir = "/Users/zhaot/Work/V3D/neurolabi/data/align"; const char *image_dir = "/Users/zhaot/Data/nathan/2008-04-18"; char file_path[150]; char image_path[150]; char result_path[150]; char file1[100], file2[100]; char id[100]; fullpath(result_dir, "align_input.txt", file_path); FILE *fp = fopen(file_path, "r"); while ((Read_Word(fp, file1, 0) > 0) && (Read_Word(fp, file2, 0) > 0)) { align_id(file1, file2, id); strcat(id, ".txt"); fullpath(result_dir, id, result_path); if (!fexist(result_path)) { printf("%s, %s\n", file1, file2); fullpath(image_dir, file1, image_path); Stack *stack1 = Read_Stack(image_path); fullpath(image_dir, file2, image_path); Stack *stack2 = Read_Stack(image_path); // Stack_Threshold_Tp4(stack1, 0, 65535); //Stack_Threshold_Tp4(stack2, 0, 65535); int chopoff1 = estimate_chopoff(stack1); printf("%d\n", chopoff1); Stack *substack1 = Crop_Stack(stack1, 0, 0, chopoff1, stack1->width, stack1->height, stack1->depth - chopoff1, NULL); int chopoff2 = estimate_chopoff(stack2); printf("%d\n", chopoff2); Stack *substack2 = Crop_Stack(stack2, 0, 0, chopoff2, stack2->width, stack2->height, stack2->depth - chopoff2, NULL); float unnorm_maxcorr; int offset[3]; int intv[] = {3, 3, 3}; float score = Align_Stack_MR_F(substack1, substack2, intv, 1, offset, &unnorm_maxcorr); if (score <= 0.0) { printf("failed\n"); write_align_result(result_dir, file1, file2, NULL); } else { offset[2] += chopoff2; printf("(%d, %d, %d): %g\n", offset[0], offset[1], offset[2], score); write_align_result(result_dir, file1, file2, offset); } Kill_Stack(substack1); Kill_Stack(substack2); Kill_Stack(stack1); Kill_Stack(stack2); } } fclose(fp); return 0; }
int main(int argc, const char *argv[]) { const char *dir_name = "/Users/zhaot/Data/nathan/2008-04-18"; if (argc > 1) { dir_name = argv[1]; } const char *result_dir = "/Users/zhaot/Work/V3D/neurolabi/data/align"; char filelist[100]; fullpath(result_dir, "filelist.txt", filelist); printf("%s\n", filelist); char file_path[150]; char image_path[150]; /* Read all files from the directory */ FILE *fp = fopen(filelist, "r"); char id[100]; int idx = 0; int idx2 = 0; int row = 22; int col = 15; #define MAX_FILE_NUMBER 364 char all_file[MAX_FILE_NUMBER][100]; double stack_mean[MAX_FILE_NUMBER]; int available[row * col]; while (Read_Word(fp, all_file[idx++], 0) > 0) { fullpath(dir_name, all_file[idx - 1], image_path); printf("%d, %s\n", idx, image_path); } fullpath(result_dir, "stack_mean.bn", file_path); if (!fexist(file_path)) { for (idx = 1; idx <= MAX_FILE_NUMBER; idx++) { fullpath(dir_name, all_file[idx - 1], image_path); Stack *stack = Read_Stack(image_path); stack_mean[idx - 1] = Stack_Mean(stack); printf("%d, %s: %g\n", idx, image_path, stack_mean[idx - 1]); Kill_Stack(stack); } darray_write(file_path, stack_mean, MAX_FILE_NUMBER); } else { int array_length; darray_read(file_path, stack_mean, &array_length); } if (idx - 1 != MAX_FILE_NUMBER) { fprintf(stderr, "Wrong file number: %d.\n", idx); } const double threshold = 115.0; for (idx = 0; idx < MAX_FILE_NUMBER; idx++) { if (stack_mean[idx] > threshold) { available[idx] = 1; } else { available[idx] = 0; } } for (idx = MAX_FILE_NUMBER; idx < row * col; idx++) { available[idx] = 0; } fullpath(result_dir, "align_input.txt", file_path); fclose(fp); int neighbor[] = {-1, 1, -22, 22}; fp = fopen(file_path, "w"); for (idx = 1; idx < MAX_FILE_NUMBER; idx++) { if (idx % row != 0) { if (available[idx - 1] && available[idx]) { fprintf(fp, "%s %s\n", all_file[idx - 1], all_file[idx]); align_id(all_file[idx - 1], all_file[idx], id); printf("%s\n", id); } } } int i, j; int offset = 0; for (j = 0; j < col - 1; j++) { offset = row * j; for (i = 0; i < row; i++) { idx = offset + i; idx2 = idx + row; if ((available[idx]) && (available[idx2])) { fprintf(fp, "%s %s\n", all_file[idx], all_file[idx2]); align_id(all_file[idx], all_file[idx2], id); printf("%s\n", id); break; } } } fclose(fp); return 1; }
// Executes given Process void OS_Execute(Process *exe) { // TODO // - optimalization // - safe mode // - error checking // - faster // - 16 bit offset adress in block memory // - global memory // Read command number exe->Reg[9] = OS_FS_Read(exe->File, &exe->Reg[8], 1); // Important note: Only at this time reading from file operation result is checked. if(exe->Reg[9] != FS_RESULT_OK) { //ERROR #if OS_DEBUG OS_Debug_Print("Cannot read from process file!"); #endif // Terminate program OS_KillProcessParent(exe); return; } // DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Command = %d" , exe->Reg[8] ); #endif // Main switch switch(exe->Reg[8]) { ///////////////////////////////////////////////////////////////////////////////////// // [Main section] ///////////////////////////////////////////////////////////////////////////////////// // Error case 0: //ERROR #if OS_DEBUG OS_Debug_Print("No more commands or data leak!"); #endif // Terminate program OS_KillProcessParent(exe); break; // 5 bytes - start const32 case 1: // Read size exe->Reg[8] = Read_Word(exe->File); // Allocate memory exe->Reg[9] = (Word)OS_Allocate(sizeof(Block)); // Save memory usage ((Block*)exe->Reg[9])->Size = exe->Reg[8]; // Save block pointer ((Block*)exe->Reg[9])->FP = exe->File->fptr; // When block allocates memory... if(exe->Reg[8] != 0) { // Allocate block private memory ((Block*)exe->Reg[9])->Data = OS_Allocate(exe->Reg[8]); } else { // No memory usage ((Block*)exe->Reg[9])->Data = Null; } // Add block to Process blocks list OS_List_Add(&exe->Blocks, (void*)exe->Reg[9]); // Set new block as current block exe->Current = ((Block*)exe->Reg[9]); //DEBUG #if OS_DEBUG_PROCESS >= 2 OS_Debug_Print("Starting new block, Memory usage: %d bytes", exe->Reg[8]); #endif break; // 1 byte - ret case 2: // Free block private data free(exe->Current->Data); // Free block free(exe->Current); // Remove last block from collection OS_List_RemoveLast(&exe->Blocks); // Get last block from collection exe->Current = (Block*)OS_List_GetLast(&exe->Blocks); // If no blocks more kill it if(exe->Current == Null) { //DEBUG #if OS_DEBUG_PROCESS >= 1 OS_Debug_Print("No more blocks, killing process parent"); #endif // Kill process parent OS_KillProcessParent(exe); } else { // If there is more bloks just jump in file to last position of last block OS_FS_Seek(exe->File, exe->Current->FP); //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Returning to the previus block"); #endif } break; // 2 bytes - int reg case 3: // Read reg OS_FS_Read(exe->File, &exe->Reg[8], 1); // Execute interrupt OS_Interrupt(exe, exe->Reg[exe->Reg[8]]); break; // 2 bytes - int const8 case 4: // Read const8 OS_FS_Read( exe->File, &exe->Reg[8], 1); // Execute interrupt OS_Interrupt(exe, exe->Reg[8]); break; // 9+n bytes- fillmem cont32 cont32 cont8[n] case 5: // Read offset exe->Reg[8] = Read_Word(exe->File); // Read size exe->Reg[9] = Read_Word(exe->File); // Fill memory OS_FS_Read(exe->File, (Byte*)exe->Current->Data + exe->Reg[8], exe->Reg[9]); //DEBUG #if OS_DEBUG_PROCESS >= 2 OS_Debug_Print("Memory from %d, of size %d was set", exe->Reg[8], exe->Reg[9]); #endif break; // 5+n bytes- fillmem const32 cont8[n] case 6: // Read size exe->Reg[8] = Read_Word(exe->File); // Fill memory OS_FS_Read(exe->File, (Byte*)exe->Current->Data, exe->Reg[8]); //DEBUG #if OS_DEBUG_PROCESS >= 2 OS_Debug_Print("Block memory at %d, of size %d was set", exe->Current->Data, exe->Reg[8]); #endif break; ///////////////////////////////////////////////////////////////////////////////////// // [Move section] ///////////////////////////////////////////////////////////////////////////////////// // 3 bytes - mov reg reg case 20: // Read 1st register id OS_FS_Read(exe->File, &exe->Reg[8], 1); // Read 2nd register id OS_FS_Read(exe->File, &exe->Reg[9], 1); // Copy data exe->Reg[exe->Reg[8]] = exe->Reg[exe->Reg[9]]; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("To register %d was moved %d from register %d", exe->Reg[8], exe->Reg[exe->Reg[8]], exe->Reg[9]); #endif break; /* // 3 bytes - mov !byte! reg [reg] case 21: // Read reg OS_FS_Read(exe->File, &exe->Reg[8], 1); // Read reg OS_FS_Read(exe->File, &exe->Reg[9], 1); // Copy data exe->Reg[exe->Reg[8]] = *(exe->Reg[exe->Reg[9]]); //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("To register %d was moved %d from memory %d pointed by register %d", exe->Reg[8], exe->Reg[exe->Reg[8]], exe->Reg[exe->Reg[9]], exe->Reg[9]); #endif break; // 21 - 3 - mov !byte! reg [reg] - przenosi 1 bajt danych z komorki o adresie zawartym w rejestrze 2 do rejestru 1 // 22 - 3 - mov short reg [reg] - przenosi 2 bajty danych z komorki o adresie zawartym w rejestrze 2 do rejestru 1 // 23 - 3 - mov word reg [reg] - przenosi 4 bajty danych z komorki o adresie zawartym w rejestrze 2 do rejestru 1 // 24 - 3 - mov !byte! [reg] reg - przenosi 1 bajt danych z rejestru do komorki o adresie zawartym w rejestrze // 25 - 3 - mov short [reg] reg - przenosi 2 bajty danych z rejestru do komorki o adresie zawartym w rejestrze // 26 - 3 - mov word [reg] reg - przenosi 4 bajty danych z rejestru do komorki o adresie zawartym w rejestrze */ // 6 bytes - mov !byte! reg mem case 27: // Read register id OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read mem exe->Reg[9] = Read_Word( exe->File ); // Write data to reg from adress exe->Reg[exe->Reg[8]] = *((Byte*)exe->Current->Data + exe->Reg[9]); //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Register %d set %d from memory %d that has block offset %d", exe->Reg[8], exe->Reg[exe->Reg[8]], (Byte*)exe->Current->Data + exe->Reg[9], exe->Reg[9]); #endif break; // 6 bytes - mov short reg mem case 28: // Read register id OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read mem exe->Reg[9] = Read_Word( exe->File ); // Write data to reg from adress exe->Reg[exe->Reg[8]] = *((Short*)((Byte*)exe->Current->Data + exe->Reg[9])); //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Register %d set %d from memory %d that has block offset %d", exe->Reg[8], exe->Reg[exe->Reg[8]], (Short*)exe->Current->Data + exe->Reg[9], exe->Reg[9]); #endif break; // 6 bytes - mov word reg mem case 29: // Read register id OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read mem exe->Reg[9] = Read_Word( exe->File ); // Write data to reg from adress exe->Reg[exe->Reg[8]] = *((Word*)((Byte*)exe->Current->Data + exe->Reg[9])); //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Register %d set %d from memory %d that has block offset %d", exe->Reg[8], exe->Reg[exe->Reg[8]], (Word*)exe->Current->Data + exe->Reg[9], exe->Reg[9]); #endif break; // 6 bytes - mov reg [mem] case 30: // Read register id OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read [mem] exe->Reg[9] = Read_Word( exe->File ); // Write adress to reg exe->Reg[exe->Reg[8]] = ((Word)exe->Current->Data + exe->Reg[9]); //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("To register %d was written adress %d", exe->Reg[8], exe->Reg[exe->Reg[8]]); #endif break; // 6 bytes - mov !byte! mem reg case 31: // Read mem exe->Reg[8] = Read_Word(exe->File); // Read reg OS_FS_Read(exe->File, &exe->Reg[9], 1); // Write data *((Byte*)((Byte*)exe->Current->Data + exe->Reg[8])) = exe->Reg[exe->Reg[9]]; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("To memory %#x was written %d from register %d", (Byte*)((Byte*)exe->Current->Data + exe->Reg[8]), exe->Reg[exe->Reg[9]], exe->Reg[9]); #endif break; // 6 bytes - mov short mem reg case 32: // Read mem exe->Reg[8] = Read_Word(exe->File); // Read reg OS_FS_Read(exe->File, &exe->Reg[9], 1); // Write data *((Short*)((Byte*)exe->Current->Data + exe->Reg[8])) = exe->Reg[exe->Reg[9]]; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("To memory %#x was written %d from register %d", (Short*)((Byte*)exe->Current->Data + exe->Reg[8]), exe->Reg[exe->Reg[9]], exe->Reg[9]); #endif break; // 6 bytes - mov word mem reg case 33: // Read mem exe->Reg[8] = Read_Word(exe->File); // Read reg OS_FS_Read(exe->File, &exe->Reg[9], 1); // Write data *((Word*)((Byte*)exe->Current->Data + exe->Reg[8])) = exe->Reg[exe->Reg[9]]; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("To memory %#x was written %d from register %d", (Word*)((Byte*)exe->Current->Data + exe->Reg[8]), exe->Reg[exe->Reg[9]], exe->Reg[9]); #endif break; // 6 bytes - mov mem const8 case 34: // Read mem exe->Reg[8] = Read_Word( exe->File ); // Read const8 OS_FS_Read( exe->File , &exe->Reg[9] , 1 ); // Write data *(((Byte*)exe->Current->Data + exe->Reg[8])) = exe->Reg[9]; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("To memory %#x was written %d", (Byte*)exe->Current->Data + exe->Reg[8], exe->Reg[9]); #endif break; // 7 bytes - mov mem const16 case 35: // Read mem exe->Reg[8] = Read_Word( exe->File ); // Read const16 OS_FS_Read( exe->File , &exe->Reg[9] , 2 ); // Write data *((Short*)((Byte*)exe->Current->Data + exe->Reg[8])) = Make_Short(exe->Reg[9],exe->Reg[10]); //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("To memory %#x was wrtten %d", (Short*)exe->Current->Data + exe->Reg[8], Make_Short(exe->Reg[9],exe->Reg[10])); #endif break; // 9 bytes - mov mem const32 case 36: // Read mem exe->Reg[8] = Read_Word( exe->File ); // Read const32 exe->Reg[9] = Read_Word( exe->File ); // Write data *((Word*)((Byte*)exe->Current->Data + exe->Reg[8])) = exe->Reg[9]; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("To memory %d#x was written %d", (Word*)exe->Current->Data + exe->Reg[8], exe->Reg[9]); #endif break; // 3 bytes - mov reg const8 case 37: // Read register id OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read const8 OS_FS_Read( exe->File , &exe->Reg[9] , 1 ); // Write data exe->Reg[exe->Reg[8]] = exe->Reg[9]; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("To register %d was written %d", exe->Reg[8], exe->Reg[9]); #endif break; // 4 bytes - mov reg const16 case 38: // Read register id OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Create word and write it exe->Reg[exe->Reg[8]] = Read_Short(exe->File); //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("To register %d was written %d", exe->Reg[8], exe->Reg[exe->Reg[8]]); #endif break; // 6 bytes - mov reg const32 case 39: // Read register id OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read const32 exe->Reg[exe->Reg[8]] = Read_Word(exe->File); //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("To register %d was written %d", exe->Reg[8], exe->Reg[exe->Reg[8]]); #endif break; ///////////////////////////////////////////////////////////////////////////////////// // [Arithmetic section] ///////////////////////////////////////////////////////////////////////////////////// // 3 bytes - add reg reg case 50: // Read 1st register OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read 2nd register OS_FS_Read( exe->File , &exe->Reg[9] , 1 ); // Perform addition exe->Reg[exe->Reg[8]] = exe->Reg[exe->Reg[8]] + exe->Reg[exe->Reg[9]]; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Register %d + %d, equals %d", exe->Reg[8], exe->Reg[9], exe->Reg[exe->Reg[8]]); #endif break; // 3 bytes - sub reg reg case 51: // Read 1st register OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read 2nd register OS_FS_Read( exe->File , &exe->Reg[9] , 1 ); // Perform substraction exe->Reg[exe->Reg[8]] = exe->Reg[exe->Reg[8]] - exe->Reg[exe->Reg[9]]; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Register %d - %d, equals %d", exe->Reg[8], exe->Reg[9], exe->Reg[exe->Reg[8]]); #endif break; // 3 bytes - mul reg reg case 52: // Read 1st register OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read 2nd register OS_FS_Read( exe->File , &exe->Reg[9] , 1 ); // Perform multiplication exe->Reg[exe->Reg[8]] = exe->Reg[exe->Reg[8]] * exe->Reg[exe->Reg[9]]; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Register %d * %d, equals %d", exe->Reg[8], exe->Reg[9], exe->Reg[exe->Reg[8]]); #endif break; ///////////////////////////////////////////////////////////////////////////////////// // [Flow control section] ///////////////////////////////////////////////////////////////////////////////////// // 5 bytes - jump const32 case 90: // Read Adress exe->Reg[8] = Read_Word( exe->File ); // Save block pointer exe->Current->FP = exe->File->fptr; // Move file pointer of a file OS_FS_Seek (exe->File, exe->Reg[8]); //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Jump to %#x", exe->Reg[8]); #endif break; // 7 bytes - je reg reg const32 case 91: // Read 1st register OS_FS_Read(exe->File, &exe->Reg[8], 1); // Read 2nd register OS_FS_Read(exe->File, &exe->Reg[9], 1); // Read jump adress exe->Reg[10] = Read_Word( exe->File ); // Compare if(exe->Reg[exe->Reg[8]] == exe->Reg[exe->Reg[9]]) { // Move file pointer of a file OS_FS_Seek ( exe->File , exe->Reg[10] ); // Save block pointer exe->Current->FP = exe->File->fptr; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Compare register %d with %d, and jump to %#x", exe->Reg[8], exe->Reg[9], exe->Reg[10]); #endif } else { //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Compare register %d with %d, without jump", exe->Reg[8], exe->Reg[9]); #endif } break; // 7 bytes - jne reg reg const32 case 92: // Read 1st register OS_FS_Read(exe->File , &exe->Reg[8], 1); // Read 2nd register OS_FS_Read(exe->File , &exe->Reg[9], 1); // Read jump adress exe->Reg[10] = Read_Word( exe->File ); // Compare if(exe->Reg[exe->Reg[8]] != exe->Reg[exe->Reg[9]]) { // Move file pointer of a file OS_FS_Seek ( exe->File , exe->Reg[10] ); // Save block pointer exe->Current->FP = exe->File->fptr; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Compare register %d with %d, and jump to %#x", exe->Reg[8], exe->Reg[9], exe->Reg[10]); #endif } else { //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Compare register %d with %d, without jump", exe->Reg[8], exe->Reg[9]); #endif } break; // 7 bytes - jg reg reg const32 case 93: // Read 1st register OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read 2nd register OS_FS_Read( exe->File , &exe->Reg[9] , 1 ); // Read jump adress exe->Reg[10] = Read_Word( exe->File ); // Compare if(exe->Reg[exe->Reg[8]] > exe->Reg[exe->Reg[9]]) { // Move file pointer of a file OS_FS_Seek ( exe->File , exe->Reg[10] ); // Save block pointer exe->Current->FP = exe->File->fptr; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Compare register %d with %d, and jump to %#x", exe->Reg[8], exe->Reg[9], exe->Reg[10]); #endif } else { //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Compare register %d with %d, without jump", exe->Reg[8], exe->Reg[9]); #endif } break; // 7 bytes - jge reg reg const32 case 94: // Read 1st register OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read 2nd register OS_FS_Read( exe->File , &exe->Reg[9] , 1 ); // Read jump adress exe->Reg[10] = Read_Word( exe->File ); // Compare if(exe->Reg[exe->Reg[8]] >= exe->Reg[exe->Reg[9]]) { // Move file pointer of a file OS_FS_Seek ( exe->File , exe->Reg[10] ); // Save block pointer exe->Current->FP = exe->File->fptr; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Compare register %d with %d, and jump to %#x", exe->Reg[8], exe->Reg[9], exe->Reg[10]); #endif } else { //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Compare register %d with %d, without jump", exe->Reg[8], exe->Reg[9]); #endif } break; // 7 bytes - jl reg reg const32 case 95: // Read 1st register OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read 2nd register OS_FS_Read( exe->File , &exe->Reg[9] , 1 ); // Read jump adress exe->Reg[10] = Read_Word( exe->File ); // Compare if(exe->Reg[exe->Reg[8]] < exe->Reg[exe->Reg[9]]) { // Move file pointer of a file OS_FS_Seek ( exe->File , exe->Reg[10] ); // Save block pointer exe->Current->FP = exe->File->fptr; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Compare register %d with %d, and jump to %#x", exe->Reg[8], exe->Reg[9], exe->Reg[10]); #endif } else { //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Compare register %d with %d, without jump", exe->Reg[8], exe->Reg[9]); #endif } break; // 7 bytes - jle reg reg const32 case 96: // Read 1st register OS_FS_Read( exe->File , &exe->Reg[8] , 1 ); // Read 2nd register OS_FS_Read( exe->File , &exe->Reg[9] , 1 ); // Read jump adress exe->Reg[10] = Read_Word( exe->File ); // Compare if(exe->Reg[exe->Reg[8]] <= exe->Reg[exe->Reg[9]]) { // Move file pointer of a file OS_FS_Seek ( exe->File , exe->Reg[10] ); // Save block pointer exe->Current->FP = exe->File->fptr; //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Compare register %d with %d, and jump to %#x", exe->Reg[8], exe->Reg[9], exe->Reg[10]); #endif } else { //DEBUG #if OS_DEBUG_PROCESS >= 3 OS_Debug_Print("Compare register %d with %d, without jump", exe->Reg[8], exe->Reg[9]); #endif } break; //ERROR default: //ERROR #if OS_DEBUG_PROCESS >= 1 OS_Debug_Print("Unknown command!"); #endif break; } }