Skip to content

Commit

Permalink
Step harib15d: enable scroll
Browse files Browse the repository at this point in the history
page 363
  • Loading branch information
M366 committed Aug 5, 2020
1 parent a3fe6bc commit b2e67da
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions harib/bootpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ void console_task(struct SHEET *sheet)
struct TASK *task = task_now();
int i, fifobuf[128], cursor_x = 16, cursor_y = 28, cursor_c = -1;
char s[2];
int x, y;

fifo32_init(&task->fifo, 128, fifobuf, task);
timer = timer_alloc();
Expand Down Expand Up @@ -442,15 +443,28 @@ void console_task(struct SHEET *sheet)
}
} else if (i == 10 + 256) {
/* Enter */
/* カーソルをスペースで消す */
putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF, COL8_000000, " ", 1);
if (cursor_y < 28 + 112) {
/* カーソルをスペースで消す */
putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF, COL8_000000, " ", 1);
cursor_y += 16;
/* プロンプト表示 */
putfonts8_asc_sht(sheet, 8, cursor_y, COL8_FFFFFF, COL8_000000, ">", 1);
cursor_x = 16;
cursor_y += 16; /* 次の行へ */
} else {
/* スクロール */
for (y = 28; y < 28 + 112; y++) {
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = sheet->buf[x + (y + 16) * sheet->bxsize];
}
}
for (y = 28 + 112; y < 28 + 128; y++) {
for (x = 8; x < 8 + 240; x++) {
sheet->buf[x + y * sheet->bxsize] = COL8_000000;
}
}
sheet_refresh(sheet, 8, 28, 8 + 240, 28 + 128);
}
} else {
/* プロンプト表示 */
putfonts8_asc_sht(sheet, 8, cursor_y, COL8_FFFFFF, COL8_000000, ">", 1);
cursor_x = 16;
} else {
/* 一般文字 */
if (cursor_x < 240) {
/* 一文字表示してから、カーソルを1つ進める */
Expand All @@ -463,7 +477,7 @@ void console_task(struct SHEET *sheet)
}
/* カーソル再表示 */
if (cursor_c >= 0) {
boxfill8(sheet->buf, sheet->bxsize, cursor_c, cursor_x, cursor_y, cursor_x + 7, 43);
boxfill8(sheet->buf, sheet->bxsize, cursor_c, cursor_x, cursor_y, cursor_x + 7, cursor_y + 15);
}
sheet_refresh(sheet, cursor_x, cursor_y, cursor_x + 8, cursor_y + 16);
}
Expand Down

0 comments on commit b2e67da

Please sign in to comment.