atm959

Parts of kernel.c

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