Advertisement
atm959

Parts of kernel.c

Aug 14th, 2020
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. void print32Bit(unsigned int value, unsigned char x, unsigned char y){
  2. unsigned char shiftVal = 28;
  3. unsigned int andVal = 0xF0000000;
  4. unsigned int tempVal = 0;
  5. unsigned char tempX = x;
  6.  
  7. char* vidMem = (char*)0xB8000;
  8.  
  9. for(int counter = 0; counter < 8; counter++){
  10. tempVal = value & andVal;
  11. tempVal = tempVal >> shiftVal;
  12.  
  13. vidMem[((y * 80) + tempX) * 2] = hexTable[tempVal];
  14. vidMem[(((y * 80) + tempX) * 2) + 1] = 0x0F;
  15.  
  16. shiftVal -= 4;
  17. andVal = andVal >> 4;
  18.  
  19. tempX++;
  20. }
  21.  
  22. vidMem[((y * 80) + tempX) * 2] = 'H';
  23. vidMem[(((y * 80) + tempX) * 2) + 1] = 0x0F;
  24.  
  25. }
  26.  
  27. void placeText(char* text, unsigned char x, unsigned char y, unsigned char attribute){
  28. char* vidMem = (char*)0xB8000;
  29. unsigned char tempX = x;
  30. unsigned int tempPointer = 0;
  31. while(text[tempPointer] != '\0'){
  32. vidMem[((y * 80) + tempX) * 2] = text[tempPointer];
  33. vidMem[(((y * 80) + tempX) * 2) + 1] = attribute;
  34.  
  35. tempX++;
  36. tempPointer++;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement