71 lines
1.1 KiB
C++
71 lines
1.1 KiB
C++
#include "./memPrint.hpp"
|
|
|
|
//Constructor
|
|
memPrint::memPrint(){
|
|
|
|
//Initialise position
|
|
this->m_cursorX=0;
|
|
this->m_cursorY=0;
|
|
|
|
//Initialise color
|
|
this->setBackground(BLACK);
|
|
this->setForeground(WHITE);
|
|
|
|
}
|
|
|
|
//Destructor
|
|
memPrint::~memPrint(){
|
|
|
|
}
|
|
|
|
|
|
//Move cursor
|
|
void memPrint::updateCursor(){
|
|
this->m_cursorX++;
|
|
|
|
if(this->m_cursorX > MAXCURSORX){
|
|
this->m_cursorX=0;
|
|
this->m_cursorY++;
|
|
|
|
if(this->m_cursorY > MAXCURSORY){
|
|
//Scroll screen
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
void memPrint::setBackground(colorBios color){
|
|
u8 newColor= (color << 4);
|
|
this->m_colors= newColor | ((this->m_colors << 4) >> 4);
|
|
}
|
|
|
|
void memPrint::setForeground(colorBios color){
|
|
u8 newColor= color;
|
|
this->m_colors= newColor | ((this->m_colors >> 4) << 4);
|
|
}
|
|
|
|
//Print a char
|
|
|
|
void memPrint::putChar(u8 character){
|
|
|
|
char *adress= ((char *) MEMPRINTSTARTADR) + (this->m_cursorX * 2) + (this->m_cursorY * 80 * 2);
|
|
|
|
*adress=character;
|
|
|
|
adress++;
|
|
|
|
*adress=this->m_colors;
|
|
|
|
this->updateCursor();
|
|
|
|
}
|
|
|
|
void memPrint::print(char *str){
|
|
while(*str!=0x0){
|
|
this->putChar(*str);
|
|
str++;
|
|
}
|
|
}
|