WIP scrolling seems to work correctly now if all you ever do is call advanceCursor()
This commit is contained in:
17
src/conio.c
17
src/conio.c
@@ -27,7 +27,7 @@ void _putch(char c)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void _cputs(char *ptr)
|
void _cputs(char *ptr)
|
||||||
{
|
{
|
||||||
if ( ptr == NULL ) {
|
if ( ptr == NULL ) {
|
||||||
return;
|
return;
|
||||||
@@ -35,12 +35,9 @@ void _cputs(char *ptr)
|
|||||||
while ((char)*ptr != 0x0) {
|
while ((char)*ptr != 0x0) {
|
||||||
_putch((char)*ptr);
|
_putch((char)*ptr);
|
||||||
if (*ptr == '\n') {
|
if (*ptr == '\n') {
|
||||||
if ( _cursor_y < 24 ) _cursor_y += 1;
|
_cursor_x = 80;
|
||||||
_cursor_x = 0;
|
|
||||||
setCursorPosition(_cursor_x, _cursor_y);
|
|
||||||
} else {
|
|
||||||
advanceCursor();
|
|
||||||
}
|
}
|
||||||
|
advanceCursor();
|
||||||
ptr += 1;
|
ptr += 1;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -81,10 +78,10 @@ char *_cgets(char *d)
|
|||||||
while ( scancode != 0 ) {
|
while ( scancode != 0 ) {
|
||||||
if ( scancode == 0x0e ) {
|
if ( scancode == 0x0e ) {
|
||||||
if ( d > orig ) {
|
if ( d > orig ) {
|
||||||
backupCursor();
|
backupCursor();
|
||||||
setCursorPosition(_cursor_x, _cursor_y);
|
setCursorPosition(_cursor_x, _cursor_y);
|
||||||
d -= 1;
|
d -= 1;
|
||||||
_putch(0x0);
|
_putch(0x0);
|
||||||
}
|
}
|
||||||
} else if ( scancode == 0x1c ) {
|
} else if ( scancode == 0x1c ) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
30
src/screen.c
30
src/screen.c
@@ -17,32 +17,6 @@ void blankScreen(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrollScreenUp(char start, char lines)
|
|
||||||
{
|
|
||||||
#ifndef __GNUC__
|
|
||||||
#asm
|
|
||||||
push bx;
|
|
||||||
mov bx, sp;
|
|
||||||
push ax;
|
|
||||||
push cx;
|
|
||||||
push dx;
|
|
||||||
mov ch, [bx+4];
|
|
||||||
mov cl, #0x00;
|
|
||||||
mov dh, #0x18;
|
|
||||||
mov dl, #0x4F;
|
|
||||||
mov al, [bx+6];
|
|
||||||
mov ah, #0x06;
|
|
||||||
mov bx, #0x0;
|
|
||||||
int 0x10;
|
|
||||||
pop dx;
|
|
||||||
pop cx;
|
|
||||||
pop ax;
|
|
||||||
pop bx;
|
|
||||||
#endasm
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void setCursorPosition(char x, char y)
|
void setCursorPosition(char x, char y)
|
||||||
{
|
{
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
@@ -79,9 +53,9 @@ void backupCursor()
|
|||||||
void advanceCursor()
|
void advanceCursor()
|
||||||
{
|
{
|
||||||
_cursor_x += 1;
|
_cursor_x += 1;
|
||||||
if ( _cursor_x > 79 ) {
|
if ( _cursor_x > 72 ) {
|
||||||
_cursor_x = 0;
|
_cursor_x = 0;
|
||||||
_cursor_y += 1;
|
if ( _cursor_y <= 23 ) _cursor_y += 1;
|
||||||
}
|
}
|
||||||
setCursorPosition(_cursor_x, _cursor_y);
|
setCursorPosition(_cursor_x, _cursor_y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,5 @@ void setCursorPosition(char x, char y);
|
|||||||
void backupCursor();
|
void backupCursor();
|
||||||
void advanceCursor();
|
void advanceCursor();
|
||||||
void blankScreen();
|
void blankScreen();
|
||||||
void scrollScreenUp(char start, char lines);
|
|
||||||
|
|
||||||
#endif /* _SCREEN_H_ */
|
#endif /* _SCREEN_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user