//the putString function //Parameters: string to be printed, row and col of the desired location(begining of the string), color of the string void putString(char* letter, int row, int col, int color){ int i = 0; int add = (80*(row -1) + col); while(letter[i] != '\0' ){ putInMemory(0xB000, (add + i)*2 + 0x8000, letter[i]); //calculate the address to store the character putInMemory(0xB000, (add + i)*2 + 0x8000 + 1, color); //calculate the address to store the color i++; } }
void clearscreen() { int r,c; for (c=0; c<80; c++) for (r=0; r<25; r++) { putInMemory(0xB800,(r*80+c)*2,0x20); putInMemory(0xB800,(r*80+c)*2+1,7); } }
void setstring(char* c, char color, int row, int column) { int i=0; while(c[i]!=0x0) { putInMemory(0xB800,(row*80+column+i)*2,c[i]); putInMemory(0xB800,(row*80+column+i)*2+1,color); i++; } }
void putStr(char *letter,int color, int x, int y){ int row = 0x8000 + ((80 * (x - 1)) * 2); char *character = letter; while(*character != '\0') { putInMemory(0xB000, y + row+1, color); putInMemory(0xB000, y + row, *(character)); row = row + 2; character++; } };
int main() { int i; for(i = 0; str[i] != '\0'; i++) { putInMemory(segment, base_address + i, str[i]); putInMemory(segment, base_address + i + 1, color_white); } while(1) { //todo } return 0; }
void executeProgram(char* name) { char buffer[13312]; int i=0,process,seg; setKernelDataSegment() ; readFile(name,buffer); process=0; while(process<8) { if(p[process].active==0) { p[process].active=1; seg=process+2; seg=seg * 4096; currentProcess=process; break; } process++; } while(i < 13312) { putInMemory(seg,i,buffer[i]); i++; } printString("hi"); initializeProgram(seg); printString("process initialised"); restoreDataSegment(); }
void drawBar(){ int x, y; for(y=0; y < 25; y++){ for(x=0; x < RMVA; x++){ if(y<2){ putInMemory(BASE_ADDRESS, memVideoAddr+(x)+(y*RMVA), 0x33); } if(x==RMVA-1 && y>=2){ putInMemory(BASE_ADDRESS, memVideoAddr+(x)+(y*RMVA), 0x77); } if(y>23){ putInMemory(BASE_ADDRESS, memVideoAddr+(x)+(y*RMVA), 0x77); } } } }
void kStrCopy(char *src, char *dest, int len) { int i = 0; for (i = 0; i < len; i++) { putInMemory(0x1000, dest+i, src[i]); if (src[i] == 0x00) { return; } } }
void executeProgram(char* name, int segment){ char buff[13312]; int i = 0; readFile(name,buff); while(i< 13312){ putInMemory(segment, i, buff[i]); i++; } launchProgram(segment); }
void executeProgram(char* name, int segment) { char buffer[0x1000]; int i = 0; readFile(name, buffer); while ( i < 0x1000) { putInMemory(segment, i, buffer[i]); i++; } launchProgram(segment); }
executeProgram(char* name, int segment){ int i ; char buffer[512]; readFile(name , buffer); i = 0; while(i<512){ putInMemory(segment , i , buffer[i]); i++; } launchProgram(segment); }
int executeProgram(char* name){ char buffer[13312]; int i; int freeSegment; int segment; struct PCB *pcb; setKernelDataSegment(); freeSegment = getFreeMemorySegment(); restoreDataSegment(); if(freeSegment == -1){ print("No Memory Available\0"); return -2; } // if(freeSegment == 0x0000 || freeSegment == 0x1000){ // print("Invalid Segment\0"); // return -1; // } interrupt(0x21, 0x03, name, buffer, 0); if(buffer[0] == 0x00){ print("File not found\0"); return -1; } segment = 0x1000*(freeSegment+2); for(i = 0;i<13312;i++){ putInMemory(segment, i, buffer[i]); } setKernelDataSegment(); pcb = getFreePCB(); restoreDataSegment(); if(pcb == NULL){ return -2; } kStrCopy(name,(*pcb).name, 6); setKernelDataSegment(); (*pcb).segment = segment; (*pcb).stackPointer = 0xFF00; addToReady(pcb); restoreDataSegment(); initializeProgram(segment); return 1; }
void executeProgram(char* name, int segment){ char temp[13312]; int i; printString("launching program...\r\n"); if(readFile(name,temp)==1){//means that the program file exists for(i=0;i<13312;i++){ //put temp into memory putInMemory(segment,i,temp[i]); } launchProgram(segment); } }
void executeProgram(char* name, int segment){ int counter= 0; int index = 0x0000; char buffer [13312]; readfile(name, buffer); while(counter < 13312){ putInMemory(segment, index++, buffer[counter]); counter++; } launchProgram(segment); }
void executeProgram (char* c , int seg) { char buffer[13312]; int i = 0; readFile(c,buffer); while(i < 13312) { putInMemory(seg , i , buffer[i]); i++; } launchProgram(seg); }
void executeProgram(char* name, int segment) { char file_buffer[13312]; int i = 0; readFile(name, file_buffer); while (i < 13312) { putInMemory(segment, i, file_buffer[i]); ++i; } launchProgram(segment); }
void executeProgram(char* name, int toWaitOn){ char buffer[MAXFILESIZE]; int curLoadChar; int q, found, process, charTemp; int segment = 0; found = readFile(name, buffer); if(found != 1){ return; } setKernelDataSegment(); for(q=0; q<NUMBEROFPROCESSENTRIES; q++){ if(processTable[q].active == 0){ segment = findProcessTableSegment(q); break; } } restoreDataSegment(); process = q; if(segment == 0){ printString("Too many processes"); return; } for(curLoadChar=0; curLoadChar<MAXFILESIZE; curLoadChar++){ putInMemory(segment, curLoadChar, buffer[curLoadChar]); } initializeProgram(segment); for(q=0; q<NAMELENGTH; q++){ charTemp = name[q]; setKernelDataSegment(); processTable[process].name[q] = charTemp; restoreDataSegment(); } setKernelDataSegment(); processTable[process].name[q] = '\0'; if(toWaitOn != NOONE){ processTable[toWaitOn].waitingOn = process; } processTable[process].active = 1; processTable[process].stackPointer = INTITALSTACKLOCATION; restoreDataSegment(); return; }
void runProgram(char *name, int segment){ // load file into buffer char buffer[13312]; int size; int base_location = segment*4096; int index=0; readFile(name,buffer,&size); /*loads in memory segment location and then loads in buffer info */ while (index!=13312){ putInMemory(base_location,index,buffer[index]); ++index; } /*launches program */ launchProgram(base_location); }
int executeProgram(char* name){ int i = 0; int offset = 0x0000; char buffer[512]; int sectors; int segment; struct PCB *pcb; setKernelDataSegment(); pcb = getFreePCB(); restoreDataSegment(); setKernelDataSegment(); segment = getFreeMemorySegment() restoreDataSegment(); if(segment == -1){ return -2; } sectors = readfile(name, buffer); if(sectors == -1){ return -1; } for (i; i < sectors*512 ; i++) { putInMemory(segment,offset,buffer[i]); offset++; } // pcb->name[0] = name[0]; // pcb->name[1] = name[1]; // pcb->name[2] = name[2]; // pcb->name[3] = name[3]; // pcb->name[4] = name[4]; // pcb->name[5] = name[5]; kStrCopy(name, pcb->name, 6); setKernelDataSegment(); pcb->state = STARTING; pcb->segment = segment; pcb->stackPointer = 0xFF00; restoreDataSegment(); initializeProgram(segment); return 1; }
/* Will run both single and multi-sector programs */ void runProgram(char* name, int segment) { char programBuffer[13312]; int programSize = 0; int baseLocation; int offset; if(!readFile(name,&programBuffer,&programSize)) return; baseLocation = 0x1000 * segment; for(offset = 0; offset != programSize; ++offset) { putInMemory(baseLocation,offset,programBuffer[offset]); } launchProgram(baseLocation); }
void executeProgram(char* name, int segment){ int i ; char buffer[13312]; readFile(name,buffer); //printString("heree"); for(i=0;i<13312;i++){ // if(buffer[i] != 0x0){ // printString("buffer"); // } //printString("here2"); putInMemory(segment,0x0000+i,buffer[i]); //}else{ //break; //} } launchProgram(segment); }
executeProgram(char* name, int segment) { int i; char buffer[13312]; //printString("executeProgram\r\n"); readFile(name, buffer); if (buffer[0] == 0x00) { //Check with Ramy interrupt(0x21, 0, "File not found!\0", 0, 0); interrupt(0x21, 5, 0, 0, 0); } //printString("executeProgram READ\r\n"); for(i=0; i<13312; i++) { putInMemory(segment, i, buffer[i]); } //printString("executeProgram MEM\r\n"); launchProgram(segment); }
void executeProgram(char * name, int segment){ char buffer[13312]; int counter = 0; int i; readFile(name, buffer); for(i = 0x0000; counter < 5; i++){ putInMemory(segment, i, buffer[i]); if(buffer[i] == 0x00){ counter++; } else { counter = 0; } } i++; launchProgram(segment); printString("tettsetse\n\0"); }
void runProgram(char* name, int segment) { char buffer[512]; int size = 0, baseLoc = segment * 4096; int offset; // Read program file into buffer readFile(name, buffer, &size); if(size == 0) { // Return if file is not found return; } for(offset = 0; offset < size * 512; offset += 1) { // Put each char in the buffer into memory putInMemory(baseLoc, offset, buffer[offset]); } // Launch the program launchProgram(baseLoc); }
int runProgram(char* name, int dirID) { char errorMessage[10]; char number[10]; char newline[3]; char programBuffer[13312]; int i, t, current, curProcUser; int segment2; readFile(name, programBuffer, ROOT_SECTOR); setKernelDataSegment(); for (i = 0; i < PROC_ENTRY_NUM; i++) { if (procTable[i].active == 0 && procTable[i].waiting == -1) { procTable[i].sp = 0xFF00; t = i; break; } } restoreDataSegment(); /* convertIntToString(number, t); */ /* number[1] = ' '; */ /* number[2] = '\0'; */ /* printString(number); */ segment2 = (t + 2) * 0x1000; for (i = 0; i <= 13312; i++) { putInMemory(segment2, i, programBuffer[i]); } initializeProgram(segment2); setKernelDataSegment(); procTable[t].active = 1; restoreDataSegment(); return t; }
int main(){ makeInterrupt21(); putInMemory(0xB000, 0x8000, 'H'); putInMemory(0xB000, 0x8001, 0x4); putInMemory(0xB000, 0x8002, 'e'); putInMemory(0xB000, 0x8003, 0x4); putInMemory(0xB000, 0x8004, 'l'); putInMemory(0xB000, 0x8005, 0x4); putInMemory(0xB000, 0x8006, 'l'); putInMemory(0xB000, 0x8007, 0x4); putInMemory(0xB000, 0x8008, 'o'); putInMemory(0xB000, 0x8009, 0x4); putInMemory(0xB000, 0x800A, ' '); putInMemory(0xB000, 0x800B, 0x4); putInMemory(0xB000, 0x800C, 'W'); putInMemory(0xB000, 0x800D, 0x4); putInMemory(0xB000, 0x800E, 'o'); putInMemory(0xB000, 0x800F, 0x4); putInMemory(0xB000, 0x8010, 'r'); putInMemory(0xB000, 0x8011, 0x4); putInMemory(0xB000, 0x8012, 'l'); putInMemory(0xB000, 0x8013, 0x4); putInMemory(0xB000, 0x8014, 'd'); putInMemory(0xB000, 0x8015, 0x4); interrupt(0x21,1,line,0,0); interrupt(0x21,0,line,0,0); //readSector(buffer, 30); //printString(buffer); //printString("Enter a line: \0"); //readString(line); //printString(line); // printString("A7massy Nagad!\0"); while(1){ } }
int main(){ putInMemory(0xB000, 0x8140, 'H'); putInMemory(0xB000, 0x8141, 0x7); putInMemory(0xB000, 0x8140, 'E'); putInMemory(0xB000, 0x8141, 0x7); putInMemory(0xB000, 0x8140, 'L'); putInMemory(0xB000, 0x8141, 0x7); putInMemory(0xB000, 0x8140, 'L'); putInMemory(0xB000, 0x8141, 0x7); putInMemory(0xB000, 0x8140, 'O'); putInMemory(0xB000, 0x8141, 0x7); putInMemory(0xB000, 0x8140, ' '); putInMemory(0xB000, 0x8141, 0x7); putInMemory(0xB000, 0x8140, 'W'); putInMemory(0xB000, 0x8141, 0x7); putInMemory(0xB000, 0x8140, 'O'); putInMemory(0xB000, 0x8141, 0x7); putInMemory(0xB000, 0x8140, 'R'); putInMemory(0xB000, 0x8141, 0x7); putInMemory(0xB000, 0x8140, 'L'); putInMemory(0xB000, 0x8141, 0x7); putInMemory(0xB000, 0x8140, 'D'); putInMemory(0xB000, 0x8141, 0x7); putInMemory(0xB000, 0x8140, '!'); putInMemory(0xB000, 0x8141, 0x7); while (1){ // todo } return 0; }
//the putChar function //Parameters: letter to be printed, row and col of the desired location, color of the letters void putChar(char letter, int row, int col, int color){ int letterAddress = (80*(row -1) + col)*2 + 0x8000; // calculate the address to store the character putInMemory(0xB000, letterAddress, letter); //calculate the address to store the color putInMemory(0xB000, letterAddress + 1, color); }
void putChar(char letter,int color, int x, int y){ int row = 0x8000 + ((80 * (x - 1)) * 2); putInMemory(0xB000, y + row+1, color); putInMemory(0xB000, y + row, letter); };
void setchar(char c, char color, int row, int column) { putInMemory(0xB800,(row*80+column)*2,c); putInMemory(0xB800,(row*80+column)*2+1,color); }