Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const char hexTable[16] = "0123456789ABCDEF";
- void print32Bit(unsigned int value, unsigned char x, unsigned char y){
- unsigned char shiftVal = 28;
- unsigned int andVal = 0xF0000000;
- unsigned int tempVal = 0;
- unsigned char tempX = x;
- char* vidMem = (char*)0xB8000;
- for(int counter = 0; counter < 8; counter++){
- tempVal = value & andVal;
- tempVal = tempVal >> shiftVal;
- vidMem[((y * 80) + tempX) * 2] = hexTable[tempVal];
- vidMem[(((y * 80) + tempX) * 2) + 1] = 0x0F;
- shiftVal -= 4;
- andVal = andVal >> 4;
- tempX++;
- }
- vidMem[((y * 80) + tempX) * 2] = 'H';
- vidMem[(((y * 80) + tempX) * 2) + 1] = 0x0F;
- }
- void placeText(char* text, unsigned char x, unsigned char y, unsigned char attribute){
- char* vidMem = (char*)0xB8000;
- unsigned char tempX = x;
- unsigned int tempPointer = 0;
- while(text[tempPointer] != '\0'){
- vidMem[((y * 80) + tempX) * 2] = text[tempPointer];
- vidMem[(((y * 80) + tempX) * 2) + 1] = attribute;
- tempX++;
- tempPointer++;
- }
- }
Add Comment
Please, Sign In to add comment