add CSI JKST
This commit is contained in:
parent
4bd7c1e46d
commit
618be86f31
@ -18,7 +18,7 @@
|
|||||||
* @struct posix_tar_header
|
* @struct posix_tar_header
|
||||||
* Borrowed from GNU `tar'
|
* Borrowed from GNU `tar'
|
||||||
*/
|
*/
|
||||||
//added by mingxuan 2019-5-18
|
// added by mingxuan 2019-5-18
|
||||||
struct posix_tar_header
|
struct posix_tar_header
|
||||||
{ /* byte offset */
|
{ /* byte offset */
|
||||||
char name[100]; /* 0 */
|
char name[100]; /* 0 */
|
||||||
@ -49,85 +49,92 @@ struct posix_tar_header
|
|||||||
*
|
*
|
||||||
* @param filename The tar file.
|
* @param filename The tar file.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static void untar(const char * filename)
|
static void untar(const char *filename)
|
||||||
{
|
{
|
||||||
printf("[extract %s \n", filename);
|
printf("[extract %s \n", filename);
|
||||||
int fd = do_vopen(filename, O_RDWR);//modified by mingxuan 2019-5-20
|
int fd = do_vopen(filename, O_RDWR); // modified by mingxuan 2019-5-20
|
||||||
|
|
||||||
char buf[512 * 16];
|
char buf[512 * 16];
|
||||||
int chunk = sizeof(buf);
|
int chunk = sizeof(buf);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1)
|
||||||
do_vread(fd, buf, 512); //modified by mingxuan 2019-5-21
|
{
|
||||||
if (buf[0] == 0) {
|
do_vread(fd, buf, 512); // modified by mingxuan 2019-5-21
|
||||||
|
if (buf[0] == 0)
|
||||||
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
printf(" need not unpack the file.\n");
|
printf(" need not unpack the file.\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
struct posix_tar_header * phdr = (struct posix_tar_header *)buf;
|
struct posix_tar_header *phdr = (struct posix_tar_header *)buf;
|
||||||
|
|
||||||
/* calculate the file size */
|
/* calculate the file size */
|
||||||
char * p = phdr->size;
|
char *p = phdr->size;
|
||||||
int f_len = 0;
|
int f_len = 0;
|
||||||
while (*p)
|
while (*p)
|
||||||
f_len = (f_len * 8) + (*p++ - '0'); /* octal */
|
f_len = (f_len * 8) + (*p++ - '0'); /* octal */
|
||||||
|
|
||||||
int bytes_left = f_len;
|
int bytes_left = f_len;
|
||||||
char full_name[30] = "orange/";
|
char full_name[30] = "orange/";
|
||||||
strcat(full_name,phdr->name);
|
strcat(full_name, phdr->name);
|
||||||
int fdout = do_vopen(full_name, O_CREAT | O_RDWR ); //modified by mingxuan 2019-5-20
|
int fdout = do_vopen(full_name, O_CREAT | O_RDWR); // modified by mingxuan 2019-5-20
|
||||||
if (fdout == -1) {
|
if (fdout == -1)
|
||||||
|
{
|
||||||
printf(" failed to extract file: %s\n", phdr->name);
|
printf(" failed to extract file: %s\n", phdr->name);
|
||||||
printf(" aborted]\n");
|
printf(" aborted]\n");
|
||||||
do_vclose(fd); //modified by mingxuan 2019-5-20
|
do_vclose(fd); // modified by mingxuan 2019-5-20
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf(" %s \n", phdr->name); //deleted by mingxuan 2019-5-22
|
printf(" %s \n", phdr->name); // deleted by mingxuan 2019-5-22
|
||||||
while (bytes_left) {
|
while (bytes_left)
|
||||||
|
{
|
||||||
int iobytes = min(chunk, bytes_left);
|
int iobytes = min(chunk, bytes_left);
|
||||||
|
|
||||||
do_vread(fd, buf, ((iobytes - 1) / 512 + 1) * 512); //modified by mingxuan 2019-5-21
|
do_vread(fd, buf, ((iobytes - 1) / 512 + 1) * 512); // modified by mingxuan 2019-5-21
|
||||||
|
|
||||||
do_vwrite(fdout, buf, iobytes); //modified by mingxuan 2019-5-21
|
do_vwrite(fdout, buf, iobytes); // modified by mingxuan 2019-5-21
|
||||||
bytes_left -= iobytes;
|
bytes_left -= iobytes;
|
||||||
}
|
}
|
||||||
do_vclose(fdout); //modified by mingxuan 2019-5-20
|
do_vclose(fdout); // modified by mingxuan 2019-5-20
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i) {
|
if (i)
|
||||||
do_vlseek(fd, 0, SEEK_SET); //modified by mingxuan 2019-5-20
|
{
|
||||||
|
do_vlseek(fd, 0, SEEK_SET); // modified by mingxuan 2019-5-20
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
do_vwrite(fd, buf, 1); //modified by mingxuan 2019-5-20
|
do_vwrite(fd, buf, 1); // modified by mingxuan 2019-5-20
|
||||||
}
|
}
|
||||||
|
|
||||||
do_vclose(fd); //modified by mingxuan 2019-5-21
|
do_vclose(fd); // modified by mingxuan 2019-5-21
|
||||||
|
|
||||||
printf(" done, %d files extracted]\n", i);
|
printf(" done, %d files extracted]\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void initial()
|
void initial()
|
||||||
{
|
{
|
||||||
|
|
||||||
int stdin = do_vopen("dev_tty0",O_RDWR);
|
int stdin = do_vopen("dev_tty0", O_RDWR);
|
||||||
int stdout= do_vopen("dev_tty0",O_RDWR);
|
int stdout = do_vopen("dev_tty0", O_RDWR);
|
||||||
int stderr= do_vopen("dev_tty0",O_RDWR);
|
int stderr = do_vopen("dev_tty0", O_RDWR);
|
||||||
|
|
||||||
//untar(INSTALL_FILENAME);
|
// untar(INSTALL_FILENAME);
|
||||||
//modified by mingxuan 2019-5-21
|
// modified by mingxuan 2019-5-21
|
||||||
char full_name[30]="orange/";;
|
char full_name[30] = "orange/";
|
||||||
printf("untar:%s\n",full_name);
|
;
|
||||||
strcat(full_name,INSTALL_FILENAME);
|
printf("untar:%s\n", full_name);
|
||||||
|
strcat(full_name, INSTALL_FILENAME);
|
||||||
untar(full_name);
|
untar(full_name);
|
||||||
|
|
||||||
do_vclose(stdin);
|
do_vclose(stdin);
|
||||||
do_vclose(stdout);
|
do_vclose(stdout);
|
||||||
do_vclose(stderr);
|
do_vclose(stderr);
|
||||||
|
|
||||||
exec("orange/shell_0.bin");
|
// exec("orange/shell_0.bin");
|
||||||
|
exec("orange/test.bin");
|
||||||
|
|
||||||
while(1);
|
while (1)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
209
kernel/vga.c
209
kernel/vga.c
@ -121,13 +121,14 @@ static inline void vga_flush_blankline(int line_no)
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static u16 pagebuf[3][SCR_BUFSIZE];
|
static u16 pagebuf[3][SCR_BUFSIZE];
|
||||||
|
|
||||||
void vga_tty_init(NTTY* tty) {
|
void vga_tty_init(NTTY *tty)
|
||||||
|
{
|
||||||
static int _cnt = 0;
|
static int _cnt = 0;
|
||||||
assert(tty->driver_type == 1);
|
assert(tty->driver_type == 1);
|
||||||
assert(tty->output_buf);
|
assert(tty->output_buf);
|
||||||
vga_buf *vga = tty->output_buf;
|
vga_buf *vga = tty->output_buf;
|
||||||
// vga->buf = (void*)do_kmalloc(sizeof(u16) * SCR_BUFSIZE);
|
// vga->buf = (void*)do_kmalloc(sizeof(u16) * SCR_BUFSIZE);
|
||||||
vga->buf = (void*)pagebuf[_cnt ++];
|
vga->buf = (void *)pagebuf[_cnt++];
|
||||||
// kprintf("malloced %p %p %p\n", vga->buf, &vga->buf, &vga->scr_top_line);
|
// kprintf("malloced %p %p %p\n", vga->buf, &vga->buf, &vga->scr_top_line);
|
||||||
vga->cur_col = vga->cur_row = 0;
|
vga->cur_col = vga->cur_row = 0;
|
||||||
// buf->max_line = SCR_BUFSIZE / SCR_WIDTH;
|
// buf->max_line = SCR_BUFSIZE / SCR_WIDTH;
|
||||||
@ -144,6 +145,37 @@ void vga_tty_init(NTTY* tty) {
|
|||||||
#define INDEX(row, col) ((row)*SCR_WIDTH + (col))
|
#define INDEX(row, col) ((row)*SCR_WIDTH + (col))
|
||||||
#define NEXTLINE(row) (((row) + 1) % SCR_MAXLINE)
|
#define NEXTLINE(row) (((row) + 1) % SCR_MAXLINE)
|
||||||
#define LASTLINE(row) (((row)-1) >= 0 ? ((row)-1) % SCR_MAXLINE : SCR_MAXLINE)
|
#define LASTLINE(row) (((row)-1) >= 0 ? ((row)-1) % SCR_MAXLINE : SCR_MAXLINE)
|
||||||
|
#define ADDLINE(row, add_num) (((row) + add_num) % SCR_MAXLINE)
|
||||||
|
|
||||||
|
// called by csi
|
||||||
|
void vga_tty_scroll(vga_buf *vgabuf, i16 scroll_num)
|
||||||
|
{
|
||||||
|
u16 *buf = vgabuf->buf;
|
||||||
|
while (scroll_num > 0)
|
||||||
|
{
|
||||||
|
// down
|
||||||
|
scroll_num--;
|
||||||
|
if (vgabuf->scr_top_line == vgabuf->scr_cur_line)
|
||||||
|
return;
|
||||||
|
vgabuf->scr_top_line = NEXTLINE(vgabuf->scr_top_line);
|
||||||
|
}
|
||||||
|
while (scroll_num < 0)
|
||||||
|
{
|
||||||
|
scroll_num++;
|
||||||
|
if (vgabuf->scr_top_line == vgabuf->head_line)
|
||||||
|
return;
|
||||||
|
vgabuf->scr_top_line = LASTLINE(vgabuf->scr_top_line);
|
||||||
|
}
|
||||||
|
vgabuf->cur_row = abs(vgabuf->scr_cur_line - vgabuf->scr_top_line);
|
||||||
|
if (vgabuf->cur_row >= SCR_HEIGHT)
|
||||||
|
{
|
||||||
|
vga_disable_cursor();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vga_enable_cursor(0, 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void newline(vga_buf *vgabuf)
|
static void newline(vga_buf *vgabuf)
|
||||||
{
|
{
|
||||||
@ -180,12 +212,40 @@ static void nextcol(vga_buf *vgabuf)
|
|||||||
|
|
||||||
static void cursor_move(i16 move_row, i16 move_col, vga_buf *vgabuf)
|
static void cursor_move(i16 move_row, i16 move_col, vga_buf *vgabuf)
|
||||||
{
|
{
|
||||||
vgabuf->scr_cur_line += move_row;
|
while (move_row > 0) // down
|
||||||
if (vgabuf->scr_cur_line < 0)
|
{
|
||||||
vgabuf->scr_cur_line = 0;
|
move_col--;
|
||||||
else if (vgabuf->scr_cur_line >= SCR_MAXLINE)
|
vgabuf->scr_cur_line = NEXTLINE(vgabuf->scr_cur_line);
|
||||||
vgabuf->scr_cur_line = SCR_MAXLINE - 1;
|
vgabuf->cur_row = abs(vgabuf->scr_cur_line - vgabuf->scr_top_line);
|
||||||
|
if (vgabuf->cur_row == SCR_HEIGHT)
|
||||||
|
{
|
||||||
|
// auto scroll
|
||||||
|
vgabuf->scr_top_line = NEXTLINE(vgabuf->scr_top_line);
|
||||||
|
if (vgabuf->scr_cur_line == vgabuf->head_line)
|
||||||
|
{
|
||||||
|
vgabuf->head_line = NEXTLINE(vgabuf->head_line);
|
||||||
|
// remember to fill blank the old line
|
||||||
|
u32 *ptr_buf = (u32 *)(vgabuf->buf + sizeof(u16) * vgabuf->head_line * SCR_WIDTH);
|
||||||
|
for (int i = 0; i < SCR_WIDTH * sizeof(u16) / sizeof(u32); ++i)
|
||||||
|
{
|
||||||
|
*ptr_buf++ = (BLANK << 16) | BLANK; // bg-black, fg-white, ascii-space
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (move_row < 0) // up
|
||||||
|
{
|
||||||
|
move_col++;
|
||||||
|
// vgabuf->scr_cur_line = LASTLINE(vgabuf->scr_cur_line);
|
||||||
|
if (vgabuf->scr_cur_line == vgabuf->scr_top_line)
|
||||||
|
{
|
||||||
|
if (vgabuf->scr_top_line == vgabuf->head_line)
|
||||||
|
break;
|
||||||
|
vgabuf->scr_cur_line = LASTLINE(vgabuf->scr_cur_line);
|
||||||
|
vgabuf->scr_top_line = LASTLINE(vgabuf->scr_top_line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vgabuf->cur_row = CYCLE_SUB(vgabuf->scr_top_line, vgabuf->scr_cur_line, SCR_MAXLINE);
|
||||||
vgabuf->cur_col += move_col;
|
vgabuf->cur_col += move_col;
|
||||||
if (vgabuf->cur_col < 0)
|
if (vgabuf->cur_col < 0)
|
||||||
vgabuf->cur_col = 0;
|
vgabuf->cur_col = 0;
|
||||||
@ -203,6 +263,25 @@ param12vga_color(i16 *param)
|
|||||||
*param |= tmp << 2;
|
*param |= tmp << 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void clear_screen(vga_buf *vgabuf, i16 src_row, i16 src_col, i16 dst_row, i16 dst_col)
|
||||||
|
{
|
||||||
|
u16 *buf = vgabuf->buf;
|
||||||
|
int src_index = INDEX(src_row, src_col);
|
||||||
|
int dst_index = INDEX(dst_row, dst_col);
|
||||||
|
if (src_index <= dst_index)
|
||||||
|
for (int i = src_index; i <= dst_index; i++)
|
||||||
|
{
|
||||||
|
buf[i] = BLANK;
|
||||||
|
}
|
||||||
|
else // scr>dst
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= dst_index; i++)
|
||||||
|
buf[i] = BLANK;
|
||||||
|
int index_end = INDEX(SCR_MAXLINE - 1, SCR_WIDTH - 1);
|
||||||
|
for (int i = 0; i <= index_end; i++)
|
||||||
|
buf[i] = BLANK;
|
||||||
|
}
|
||||||
|
}
|
||||||
static void set_color(vga_buf *vgabuf)
|
static void set_color(vga_buf *vgabuf)
|
||||||
{
|
{
|
||||||
if (vgabuf->param1 == 0)
|
if (vgabuf->param1 == 0)
|
||||||
@ -334,12 +413,41 @@ static void CSI_handler(u8 terminator, vga_buf *vgabuf)
|
|||||||
cursor_move(vgabuf->param1 - vgabuf->scr_cur_line, vgabuf->param1 - vgabuf->cur_col, vgabuf);
|
cursor_move(vgabuf->param1 - vgabuf->scr_cur_line, vgabuf->param1 - vgabuf->cur_col, vgabuf);
|
||||||
break;
|
break;
|
||||||
case 'J':
|
case 'J':
|
||||||
|
if (vgabuf->param1 == 0)
|
||||||
|
clear_screen(vgabuf, vgabuf->scr_cur_line, vgabuf->cur_col, ADDLINE(vgabuf->scr_top_line, SCR_HEIGHT - 1), SCR_WIDTH - 1);
|
||||||
|
else if (vgabuf->param1 == 1)
|
||||||
|
clear_screen(vgabuf, vgabuf->scr_top_line, 0, vgabuf->scr_cur_line, vgabuf->cur_col);
|
||||||
|
else if (vgabuf->param1 == 2)
|
||||||
|
{
|
||||||
|
clear_screen(vgabuf, vgabuf->scr_top_line, 0, ADDLINE(vgabuf->scr_top_line, SCR_HEIGHT - 1), SCR_WIDTH - 1);
|
||||||
|
vgabuf->cur_col = 0;
|
||||||
|
vgabuf->scr_cur_line = vgabuf->scr_top_line;
|
||||||
|
}
|
||||||
|
else if (vgabuf->param1 == 3)
|
||||||
|
{
|
||||||
|
clear_screen(vgabuf, 0, 0, SCR_MAXLINE - 1, SCR_WIDTH - 1);
|
||||||
|
vgabuf->cur_col = vgabuf->cur_row = 0;
|
||||||
|
vgabuf->scr_top_line = vgabuf->scr_cur_line = 0;
|
||||||
|
vgabuf->head_line = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'K':
|
case 'K':
|
||||||
|
if (vgabuf->param1 == 0)
|
||||||
|
clear_screen(vgabuf, vgabuf->scr_cur_line, vgabuf->cur_col, vgabuf->scr_cur_line, SCR_WIDTH - 1);
|
||||||
|
else if (vgabuf->param1 == 1)
|
||||||
|
clear_screen(vgabuf, vgabuf->scr_cur_line, 0, vgabuf->scr_cur_line, vgabuf->cur_col);
|
||||||
|
else if (vgabuf->param1 == 2)
|
||||||
|
clear_screen(vgabuf, vgabuf->scr_cur_line, 0, vgabuf->scr_cur_line, SCR_WIDTH - 1);
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S': // Scroll Up
|
||||||
|
if (vgabuf->param1 == 0)
|
||||||
|
vgabuf->param1 = 1;
|
||||||
|
vga_tty_scroll(vgabuf, -vgabuf->param1);
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T': // Scroll Down
|
||||||
|
if (vgabuf->param1 == 0)
|
||||||
|
vgabuf->param1 = 1;
|
||||||
|
vga_tty_scroll(vgabuf, +vgabuf->param1);
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
set_color(vgabuf);
|
set_color(vgabuf);
|
||||||
@ -446,25 +554,30 @@ void vga_tty_write(NTTY *tty, char ch)
|
|||||||
// kprintf("row: %d; ", vga->cur_row);
|
// kprintf("row: %d; ", vga->cur_row);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vga_tty_backspace(NTTY* tty) {
|
void vga_tty_backspace(NTTY *tty)
|
||||||
vga_buf* vga = tty->output_buf;
|
{
|
||||||
u16* buf = vga->buf;
|
vga_buf *vga = tty->output_buf;
|
||||||
if (vga->cur_col == 0) {
|
u16 *buf = vga->buf;
|
||||||
|
if (vga->cur_col == 0)
|
||||||
|
{
|
||||||
vga->cur_col = SCR_WIDTH - 1;
|
vga->cur_col = SCR_WIDTH - 1;
|
||||||
vga->scr_cur_line = LASTLINE(vga->scr_cur_line);
|
vga->scr_cur_line = LASTLINE(vga->scr_cur_line);
|
||||||
} else {
|
}
|
||||||
vga->cur_col --;
|
else
|
||||||
|
{
|
||||||
|
vga->cur_col--;
|
||||||
}
|
}
|
||||||
buf[INDEX(vga->scr_cur_line, vga->cur_col)] = BLANK;
|
buf[INDEX(vga->scr_cur_line, vga->cur_col)] = BLANK;
|
||||||
vga->cur_row = CYCLE_SUB(vga->scr_top_line, vga->scr_cur_line, SCR_MAXLINE);
|
vga->cur_row = CYCLE_SUB(vga->scr_top_line, vga->scr_cur_line, SCR_MAXLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vga_tty_flush(NTTY* tty) {
|
void vga_tty_flush(NTTY *tty)
|
||||||
vga_buf* vga = tty->output_buf;
|
{
|
||||||
u16* buf = vga->buf;
|
vga_buf *vga = tty->output_buf;
|
||||||
|
u16 *buf = vga->buf;
|
||||||
int i, cur_line;
|
int i, cur_line;
|
||||||
vga_set_cursor(INDEX(vga->cur_row, vga->cur_col));
|
vga_set_cursor(INDEX(vga->cur_row, vga->cur_col));
|
||||||
if (vga->cur_row == SCR_WIDTH - 1)
|
if (vga->cur_row == SCR_HEIGHT - 1) ///////////????????????????
|
||||||
{
|
{
|
||||||
vga_flush_screen(&buf[INDEX(vga->scr_top_line, 0)]);
|
vga_flush_screen(&buf[INDEX(vga->scr_top_line, 0)]);
|
||||||
}
|
}
|
||||||
@ -476,7 +589,7 @@ void vga_tty_flush(NTTY* tty) {
|
|||||||
vga_flush_line(&buf[INDEX(cur_line, 0)], i);
|
vga_flush_line(&buf[INDEX(cur_line, 0)], i);
|
||||||
cur_line = NEXTLINE(cur_line);
|
cur_line = NEXTLINE(cur_line);
|
||||||
}
|
}
|
||||||
for (; i < SCR_WIDTH; ++i)
|
for (; i < SCR_HEIGHT; ++i)
|
||||||
{
|
{
|
||||||
vga_flush_blankline(i);
|
vga_flush_blankline(i);
|
||||||
}
|
}
|
||||||
@ -484,33 +597,33 @@ void vga_tty_flush(NTTY* tty) {
|
|||||||
// kprintf("flush: row=%d, top=%d, cur=%d\n", vga->cur_row, vga->scr_top_line, vga->scr_cur_line);
|
// kprintf("flush: row=%d, top=%d, cur=%d\n", vga->cur_row, vga->scr_top_line, vga->scr_cur_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vga_tty_scroll(NTTY *tty, int direction)
|
// void vga_tty_scroll(NTTY *tty, int direction)
|
||||||
{
|
// {
|
||||||
vga_buf *vga = tty->output_buf;
|
// vga_buf *vga = tty->output_buf;
|
||||||
u16 *buf = vga->buf;
|
// u16 *buf = vga->buf;
|
||||||
if (direction > 0)
|
// if (direction > 0)
|
||||||
{
|
// {
|
||||||
// down
|
// // down
|
||||||
if (vga->scr_top_line == vga->scr_cur_line)
|
// if (vga->scr_top_line == vga->scr_cur_line)
|
||||||
return;
|
// return;
|
||||||
vga->scr_top_line = NEXTLINE(vga->scr_top_line);
|
// vga->scr_top_line = NEXTLINE(vga->scr_top_line);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
if (vga->scr_top_line == vga->head_line)
|
// if (vga->scr_top_line == vga->head_line)
|
||||||
return;
|
// return;
|
||||||
vga->scr_top_line = LASTLINE(vga->scr_top_line);
|
// vga->scr_top_line = LASTLINE(vga->scr_top_line);
|
||||||
}
|
// }
|
||||||
vga->cur_row = abs(vga->scr_cur_line - vga->scr_top_line);
|
// vga->cur_row = abs(vga->scr_cur_line - vga->scr_top_line);
|
||||||
if (vga->cur_row >= SCR_HEIGHT)
|
// if (vga->cur_row >= SCR_HEIGHT)
|
||||||
{
|
// {
|
||||||
vga_disable_cursor();
|
// vga_disable_cursor();
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
vga_enable_cursor(0, 15);
|
// vga_enable_cursor(0, 15);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
void vga_scroll_to_cur(NTTY *tty)
|
void vga_scroll_to_cur(NTTY *tty)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -30,8 +30,9 @@ int main(int arg, char *argv[])
|
|||||||
printf("5555555555");
|
printf("5555555555");
|
||||||
printf("6666666666");
|
printf("6666666666");
|
||||||
printf("7777777777");
|
printf("7777777777");
|
||||||
printf("8888888888");
|
printf("\x1b[5F");
|
||||||
printf("9999999999\r\b\b\n");
|
// printf("8888888888");
|
||||||
|
// printf("9999999999\r\b\b\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user