Import backup from 2004-09-21

This commit is contained in:
josh committed 2017-07-25 22:23:48 -04:00
1 parent 78272f6bc3
commit bad7f79ed1
32 files changed
+696 -273

No files matched your search

+9 -4
View File
@@ -5,12 +5,12 @@
#include "hos_defines.h"
#include "char/keyboard.h"
#include "sys/io.h"
#include "sys/io.h" // inportb, outportb
#include "functions.h"
#include "lang/conv.h" // asciiSwitchCase()
#include "kout.h"
#include "console.h"
#include "display.h" // display_activate()
#define KBD_BUFFER_LENGTH 64
@@ -148,8 +148,13 @@ void isr_keyboard()
if (kbdAscii)
kprintf("%c", kbdAscii);
if (kbdScan >= 0x3B && kbdScan <= 0x40)
console_activate(kbdScan - 0x3A);
// if (kbdFlags & KBDF_ALT)
// {
if (kbdScan >= 0x3B && kbdScan <= 0x44)
display_activate(kbdScan - 0x3B);
if (kbdScan >= 0x57 && kbdScan <= 0x58)
display_activate(kbdScan - 0x4D);
// }
}
//Gets a key from the buffer, returns 0 if no keys available, returns immediately
+19 -13
View File
@@ -8,12 +8,11 @@
#include "fs/devices.h"
#include "mm/vmm.h"
#include "lang/asmfuncs.h"
#include "console.h"
#include "display.h"
#include "functions.h"
vconsole_t *vconsoles[VCONSOLE_MAX]; // pointer to virtual console structs
extern int activeConsole; // console subsystem active virtual console number
extern int display_activeConsole; // display subsystem active virtual console number
char ansi2vgaAttr[8] = {0, 4, 2, 6, 1, 5, 3, 7};
void vconsole_put_char(minor_t id, int c);
@@ -62,16 +61,16 @@ minor_t vconsole_new(int width, int height)
}
// called by console subsystem to draw a virtual console to the screen
// called by display subsystem to draw a virtual console to the screen
int vconsole_draw(minor_t id)
{
if (vconsoles[id])
return console_draw(id, vconsoles[id]->cursorPosition, vconsoles[id]->buffer);
return display_console_draw(id, vconsoles[id]->cursorPosition, vconsoles[id]->buffer);
return -1;
}
// called by character device driver when a character is written to device w/ minor #id
// called by character device interface when a character is written to device w/ minor #id
int vconsole_char_write(minor_t id, int c)
{
if (!vconsoles[id])
@@ -108,13 +107,13 @@ int vconsole_char_write(minor_t id, int c)
cursorY = vconsoles[id]->height - 1;
vconsole_update_cursor(id, cursorY * vconsoles[id]->width + cursorX);
break;
case 'C': // move cursor right n columns
case 'C': // move cursor left n columns
cursorX -= vconsoles[id]->escapeValue[0];
if (cursorX < 0)
cursorX = 0;
vconsole_update_cursor(id, cursorY * vconsoles[id]->width + cursorX);
break;
case 'D': // move cursor left n columns
case 'D': // move cursor right n columns
cursorX += vconsoles[id]->escapeValue[0];
if (cursorX >= vconsoles[id]->width)
cursorX = vconsoles[id]->width - 1;
@@ -250,8 +249,8 @@ void vconsole_put_char(minor_t id, int c)
break;
default:
vconsoles[id]->buffer[vconsoles[id]->cursorPosition] = c | (vconsoles[id]->attribute << 8);
if (id == activeConsole)
console_put_char(id, c | (vconsoles[id]->attribute << 8), vconsoles[id]->cursorPosition);
if (id == display_activeConsole)
display_console_put_char(id, c | (vconsoles[id]->attribute << 8), vconsoles[id]->cursorPosition);
vconsole_update_cursor(id, vconsoles[id]->cursorPosition + 1);
}
}
@@ -262,17 +261,24 @@ void vconsole_update_cursor(minor_t id, u16_t position)
vconsoles[id]->cursorPosition = position;
if (position >= (vconsoles[id]->width * vconsoles[id]->height)) // time to scroll console
{
int i;
for (i = 0; i < vconsoles[id]->cursorStackPosition; i++)
{
vconsoles[id]->cursorStack[i] -= vconsoles[id]->width;
if (vconsoles[id]->cursorStack[i] < 0)
vconsoles[id]->cursorStack[i] = 0;
}
vconsoles[id]->cursorPosition -= vconsoles[id]->width;
memcpyw(vconsoles[id]->buffer, vconsoles[id]->buffer + vconsoles[id]->width, vconsoles[id]->width * (vconsoles[id]->height - 1));
memsetw(vconsoles[id]->buffer + (vconsoles[id]->width * (vconsoles[id]->height - 1)), 0x0720, vconsoles[id]->width);
if (activeConsole == id)
if (display_activeConsole == id)
{
vconsole_draw(id);
return;
}
}
if (activeConsole == id)
console_update_cursor(id, position);
if (display_activeConsole == id)
display_console_update_cursor(id, position);
}
void vconsole_update_attribute(minor_t id)
+1 -1
View File
@@ -18,7 +18,7 @@ typedef struct
u16_t cursorPosition;
u16_t width;
u16_t height;
u16_t cursorStack[16];
short cursorStack[16];
u8_t attribute;
u8_t foreground;