remove binaries
This commit is contained in:
BIN
c_boot/bootsect
BIN
c_boot/bootsect
Binary file not shown.
BIN
c_boot/setup
BIN
c_boot/setup
Binary file not shown.
@ -23,6 +23,17 @@ void CGA::setpos (int x, int y) {
|
|||||||
|
|
||||||
/* Hier muess Code eingefuegt werden */
|
/* Hier muess Code eingefuegt werden */
|
||||||
|
|
||||||
|
// NOTE: The cursor addresses positions on screen, not bytes
|
||||||
|
unsigned short pos = x + y * 80;
|
||||||
|
unsigned char cursor_low = pos & 0xFF;
|
||||||
|
unsigned char cursor_high = (pos >> 8) & 0xFF;
|
||||||
|
|
||||||
|
index_port.outb(0xF); // Cursor(low)
|
||||||
|
data_port.outb(cursor_low);
|
||||||
|
|
||||||
|
index_port.outb(0xE); // Cursor(high)
|
||||||
|
data_port.outb(cursor_high);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -34,9 +45,22 @@ void CGA::setpos (int x, int y) {
|
|||||||
* Rückgabewerte: x und y *
|
* Rückgabewerte: x und y *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void CGA::getpos (int &x, int &y) {
|
void CGA::getpos (int &x, int &y) {
|
||||||
|
|
||||||
/* Hier muess Code eingefuegt werden */
|
/* Hier muess Code eingefuegt werden */
|
||||||
|
|
||||||
|
index_port.outb(0xF); // Cursor(low)
|
||||||
|
unsigned char cursor_low = data_port.inb();
|
||||||
|
|
||||||
|
index_port.outb(0xE); // Cursor(high)
|
||||||
|
unsigned char cursor_high = data_port.inb();
|
||||||
|
|
||||||
|
unsigned short cursor =
|
||||||
|
(cursor_low & 0xFF)
|
||||||
|
| ((cursor_high << 8) & 0xFF00);
|
||||||
|
|
||||||
|
x = cursor % 80;
|
||||||
|
y = (int)(cursor / 80);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -52,9 +76,15 @@ void CGA::getpos (int &x, int &y) {
|
|||||||
* attrib Attributbyte fuer das Zeichen *
|
* attrib Attributbyte fuer das Zeichen *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void CGA::show (int x, int y, char character, unsigned char attrib) {
|
void CGA::show (int x, int y, char character, unsigned char attrib) {
|
||||||
|
|
||||||
/* Hier muess Code eingefuegt werden */
|
/* Hier muess Code eingefuegt werden */
|
||||||
|
|
||||||
|
char* pos = (char*)(CGA_START + 2 * (x + y * 80)); // cast to char* to make writable
|
||||||
|
*pos = character;
|
||||||
|
*(pos + 1) = attrib;
|
||||||
|
|
||||||
|
// TODO: screen border check
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -70,9 +100,33 @@ void CGA::show (int x, int y, char character, unsigned char attrib) {
|
|||||||
* attrib Attributbyte fuer alle Zeichen der Zeichenkette *
|
* attrib Attributbyte fuer alle Zeichen der Zeichenkette *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void CGA::print (char* string, int n, unsigned char attrib) {
|
void CGA::print (char* string, int n, unsigned char attrib) {
|
||||||
|
|
||||||
/* Hier muess Code eingefuegt werden */
|
/* Hier muess Code eingefuegt werden */
|
||||||
|
|
||||||
|
int cursor_x, cursor_y;
|
||||||
|
this->getpos(cursor_x, cursor_y);
|
||||||
|
|
||||||
|
for (unsigned short byte = 0; byte < n; ++byte) {
|
||||||
|
|
||||||
|
char current = *(string + byte);
|
||||||
|
if (current == '\n') {
|
||||||
|
// TODO: Screen bounds
|
||||||
|
cursor_x = 0;
|
||||||
|
cursor_y = cursor_y + 1;
|
||||||
|
continue;
|
||||||
|
} else if (current == '\0') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->show(cursor_x, cursor_y, current, attrib);
|
||||||
|
cursor_x = cursor_x + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->setpos(cursor_x, cursor_y);
|
||||||
|
|
||||||
|
// TODO: automatic line breaking, automatic scrolling
|
||||||
|
// TODO: printing doesn't work after first newline character
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,9 +138,19 @@ void CGA::print (char* string, int n, unsigned char attrib) {
|
|||||||
* gefuellt. *
|
* gefuellt. *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void CGA::scrollup () {
|
void CGA::scrollup () {
|
||||||
|
|
||||||
/* Hier muess Code eingefuegt werden */
|
/* Hier muess Code eingefuegt werden */
|
||||||
|
|
||||||
|
// Move up
|
||||||
|
for (unsigned short byte = 2 * 80 * 1; byte < 2 * 80 * 25; ++byte) {
|
||||||
|
*((char*)(CGA_START + byte - 2 * 80 * 1)) = *(CGA_START + byte);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear last line
|
||||||
|
for (unsigned short byte = 2 * 80 * 24; byte < 2 * 80 * 25; ++byte) {
|
||||||
|
*((char*)(CGA_START + byte)) = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -96,9 +160,12 @@ void CGA::scrollup () {
|
|||||||
* Beschreibung: Lösche den Textbildschirm. *
|
* Beschreibung: Lösche den Textbildschirm. *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void CGA::clear () {
|
void CGA::clear () {
|
||||||
|
|
||||||
/* Hier muess Code eingefuegt werden */
|
/* Hier muess Code eingefuegt werden */
|
||||||
|
for (unsigned short byte = 2 * 80 * 0; byte < 2 * 80 * 25; ++byte) {
|
||||||
|
*((char*)(CGA_START + byte)) = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +182,7 @@ void CGA::clear () {
|
|||||||
* blink ywa/no *
|
* blink ywa/no *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
unsigned char CGA::attribute (CGA::color bg, CGA::color fg, bool blink) {
|
unsigned char CGA::attribute (CGA::color bg, CGA::color fg, bool blink) {
|
||||||
|
|
||||||
/* Hier muess Code eingefuegt werden */
|
/* Hier muess Code eingefuegt werden */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user