本文整理汇总了C++中putfonts8_asc_sht函数的典型用法代码示例。如果您正苦于以下问题:C++ putfonts8_asc_sht函数的具体用法?C++ putfonts8_asc_sht怎么用?C++ putfonts8_asc_sht使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了putfonts8_asc_sht函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cons_putchar
void cons_putchar(struct CONSOLE *cons, int chr, char move)
{
char s[2];
s[0] = chr;
s[1] = 0;
if (s[0] == 0x09) { /* タブ */
for (;;) {
putfonts8_asc_sht(cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, " ", 1);
cons->cur_x += 8;
if (cons->cur_x == 8 + 240) {
cons_newline(cons);
}
if (((cons->cur_x - 8) & 0x1f) == 0) {
break; /* 32で割り切れたらbreak */
}
}
} else if (s[0] == 0x0a) { /* 改行 */
cons_newline(cons);
} else if (s[0] == 0x0d) { /* 復帰 */
/* とりあえずなにもしない */
} else { /* 普通の文字 */
putfonts8_asc_sht(cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, s, 1);
if (move != 0) {
/* moveが0のときはカーソルを進めない */
cons->cur_x += 8;
if (cons->cur_x == 8 + 240) {
cons_newline(cons);
}
}
}
return;
}
开发者ID:FuDesign2008,项目名称:mess,代码行数:32,代码来源:console.c
示例2: cons_putchar
void cons_putchar (struct CONSOLE *cons, int chr, char move)
{
char s[2];
s[0] = chr;
s[1] = 0;
if (s[0] == 0x09) { // tab
for (;;) {
putfonts8_asc_sht (cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, " ", 1);
cons->cur_x += 8;
if (cons->cur_x == 8 + 240) {
cons_newline(cons);
}
if (((cons->cur_x - 8) & 0x1f) == 0) {
break;
}
}
} else if (s[0] == 0x0a) { // enter
cons_newline(cons);
} else if (s[0] == 0x0d) { // enter
// Do nothing
} else {
putfonts8_asc_sht (cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, s, 1);
if (move != 0) {
cons->cur_x += 8;
if (cons->cur_x == 8 + 240) {
cons_newline (cons);
}
}
}
return;
}
开发者ID:msyksphinz,项目名称:sicp_exercise,代码行数:31,代码来源:console.c
示例3: cons_putchar
void cons_putchar(struct CONSOLE *cons, char chr, int move)
{
/* 逐字输出 */
char s[2];
s[0] = chr;
s[1] = 0;
if (s[0] == 0x09) { /* 制表符 */
for (;;) {
putfonts8_asc_sht(cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, " ", 1);
cons->cur_x += 8;
if (cons->cur_x == 8 + 240) {
cons_newline(cons);
}
if (((cons->cur_x - 8) & 0x1f) == 0) {
break; /* 被32整除则break */
}
}
} else if (s[0] == 0x0a) { /* 换行 */
cons_newline(cons);
} else if (s[0] == 0x0d) { /* 回车 */
/* 这里暂且不进行任何操作 */
} else { /* 一般字符 */
putfonts8_asc_sht(cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, s, 1);
if (move != 0) {
/* move为0时光标不后移 */
cons->cur_x += 8; // 后移一位
if (cons->cur_x == 8 + 240) { // 到达最右端后换行
cons_newline(cons);
}
}
}
return;
}
开发者ID:NeilJudson,项目名称:HomemadeOS,代码行数:33,代码来源:console.c
示例4: console_task
void console_task(struct SHEET *sheet)
{
struct TIMER *timer;
struct TASK *task = task_now();
int i, fifobuf[128], cursor_x = 16, cursor_c = COL8_000000;
char s[2];
fifo32_init(&task->fifo, 128, fifobuf, task);
timer = timer_alloc();
timer_init(timer, &task->fifo, 1);
timer_settime(timer, 50);
/* 显示提示符 */
putfonts8_asc_sht(sheet, 8, 28, COL8_FFFFFF, COL8_000000, ">", 1);
for (;;) {
io_cli();
if (fifo32_status(&task->fifo) == 0) {
task_sleep(task);
io_sti();
} else {
i = fifo32_get(&task->fifo);
io_sti();
if (i <= 1) { /* 光标用定时器 */
if (i != 0) {
timer_init(timer, &task->fifo, 0); /* 下次置0 */
cursor_c = COL8_FFFFFF;
} else {
timer_init(timer, &task->fifo, 1); /* 下次置1 */
cursor_c = COL8_000000;
}
timer_settime(timer, 50);
}
if (256 <= i && i <= 511) { /* 键盘数据(通过任务A) */
if (i == 8 + 256) {
/* 退格键 */
if (cursor_x > 16) {
/* 用空白擦除光标后将光标前移一位 */
putfonts8_asc_sht(sheet, cursor_x, 28, COL8_FFFFFF, COL8_000000, " ", 1);
cursor_x -= 8;
}
} else {
/* 一般字符 */
if (cursor_x < 240) {
/* 显示一个字符之后将光标后移一位 */
s[0] = i - 256;
s[1] = 0;
putfonts8_asc_sht(sheet, cursor_x, 28, COL8_FFFFFF, COL8_000000, s, 1);
cursor_x += 8;
}
}
}
/* 重新显示光标 */
boxfill8(sheet->buf, sheet->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43);
sheet_refresh(sheet, cursor_x, 28, cursor_x + 8, 44);
}
}
}
开发者ID:NeilJudson,项目名称:HomemadeOS,代码行数:59,代码来源:bootpack.c
示例5: console_task
void console_task(struct SHEET *sheet)
{
struct TIMER *timer;
struct TASK *task = task_now();
int i, fifobuf[128], cursor_x = 16, cursor_c = COL8_000000;
char s[2];
fifo32_init(&task->fifo, 128, fifobuf, task);
timer = timer_alloc();
timer_init(timer, &task->fifo, 1);
timer_settime(timer, 50);
/* プロンプト表示 */
putfonts8_asc_sht(sheet, 8, 28, COL8_FFFFFF, COL8_000000, ">", 1);
for (;;) {
io_cli();
if (fifo32_status(&task->fifo) == 0) {
task_sleep(task);
io_sti();
} else {
i = fifo32_get(&task->fifo);
io_sti();
if (i <= 1) { /* カーソル用タイマ */
if (i != 0) {
timer_init(timer, &task->fifo, 0); /* 次は0を */
cursor_c = COL8_FFFFFF;
} else {
timer_init(timer, &task->fifo, 1); /* 次は1を */
cursor_c = COL8_000000;
}
timer_settime(timer, 50);
}
if (256 <= i && i <= 511) { /* キーボードデータ(タスクA経由) */
if (i == 8 + 256) {
/* バックスペース */
if (cursor_x > 16) {
/* カーソルをスペースで消してから、カーソルを1つ戻す */
putfonts8_asc_sht(sheet, cursor_x, 28, COL8_FFFFFF, COL8_000000, " ", 1);
cursor_x -= 8;
}
} else {
/* 一般文字 */
if (cursor_x < 240) {
/* 一文字表示してから、カーソルを1つ進める */
s[0] = i - 256;
s[1] = 0;
putfonts8_asc_sht(sheet, cursor_x, 28, COL8_FFFFFF, COL8_000000, s, 1);
cursor_x += 8;
}
}
}
/* カーソル再表示 */
boxfill8(sheet->buf, sheet->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43);
sheet_refresh(sheet, cursor_x, 28, cursor_x + 8, 44);
}
}
}
开发者ID:bigpussy,项目名称:harib_os_src,代码行数:58,代码来源:bootpack.c
示例6: cmd_mem
void cmd_mem(struct CONSOLE *cons, unsigned int memtotal)
{
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
char s[30];
sprintf(s, "total %dMB", memtotal / (1024 * 1024));
putfonts8_asc_sht(cons->sht, 8, cons->cur_y, COL8_FFFFFF, COL8_000000, s, 30);
cons_newline(cons);
sprintf(s, "free %dKB", memman_total(memman) / 1024);
putfonts8_asc_sht(cons->sht, 8, cons->cur_y, COL8_FFFFFF, COL8_000000, s, 30);
cons_newline(cons);
cons_newline(cons);
return;
}
开发者ID:FuDesign2008,项目名称:mess,代码行数:13,代码来源:console.c
示例7: cmd_dir
void cmd_dir(struct CONSOLE *cons)
{
struct FILEINFO *finfo = (struct FILEINFO *) (ADR_DISKIMG + 0x002600);
int i, j;
char s[30];
for (i = 0; i < 224; i++) {
if (finfo[i].name[0] == 0x00) {
break;
}
if (finfo[i].name[0] != 0xe5) {
if ((finfo[i].type & 0x18) == 0) {
sprintf(s, "filename.ext %7d", finfo[i].size);
for (j = 0; j < 8; j++) {
s[j] = finfo[i].name[j];
}
s[ 9] = finfo[i].ext[0];
s[10] = finfo[i].ext[1];
s[11] = finfo[i].ext[2];
putfonts8_asc_sht(cons->sht, 8, cons->cur_y, COL8_FFFFFF, COL8_000000, s, 30);
cons_newline(cons);
}
}
}
cons_newline(cons);
return;
}
开发者ID:FuDesign2008,项目名称:mess,代码行数:26,代码来源:console.c
示例8: task_b_main
void task_b_main(struct SHEET *sht_win_b)
{
struct FIFO32 fifo;
struct TIMER *timer_1s;
int i, fifobuf[128], count = 0, count0 = 0;
char s[12];
fifo32_init(&fifo, 128, fifobuf,0);
timer_1s = timer_alloc();
timer_init(timer_1s, &fifo, 100);
timer_settime(timer_1s, 100);
for (;;) {
count++;
io_cli();
if (fifo32_status(&fifo) == 0) {
io_sti();
} else {
i = fifo32_get(&fifo);
io_sti();
if (i == 100) {
sprintf(s, "%11d", count - count0);
putfonts8_asc_sht(sht_win_b, 24, 28, COL8_000000, COL8_C6C6C6, s, 11);
count0 = count;
timer_settime(timer_1s, 100);
}
}
}
}
开发者ID:BpLife,项目名称:myos,代码行数:29,代码来源:bootpack.c
示例9: task_b_main
void task_b_main (struct SHEET *sht_back)
{
struct FIFO32 fifo;
struct TIMER *timer_ts, *timer_put;
int i, fifobuf[128], count = 0;
fifo32_init(&fifo, 128, fifobuf);
timer_ts = timer_alloc();
timer_init(timer_ts, &fifo, 2);
timer_settime(timer_ts, 2);
timer_put = timer_alloc();
timer_init(timer_put, &fifo, 1);
timer_settime(timer_put, 1);
for (;;) {
count++;
io_cli();
if (fifo32_status(&fifo) == 0) {
io_stihlt();
} else {
i = fifo32_get(&fifo);
io_sti();
if (i == 1) {
char s[11];
sprintf (s, "%d", count);
putfonts8_asc_sht (sht_back, 0, 144, COL8_FFFFFF, COL8_008484, s, 11);
timer_settime (timer_put, 1);
} else if (i == 2) { // timeout 5 sec
farjmp(0, 3 * 8);
timer_settime(timer_ts, 2);
}
}
}
}
开发者ID:msyksphinz,项目名称:sicp_exercise,代码行数:34,代码来源:bootpack.c
示例10: task_b_main
void task_b_main(struct SHEET *sht_back)
{
struct FIFO32 fifo;
struct TIMER *timer_put, *timer_1s;
int i, fifobuf[128], count = 0, count0 = 0;
char s[128];
fifo32_init(&fifo, 128, fifobuf);
timer_put = timer_alloc();
timer_init(timer_put, &fifo, 1);
timer_settime(timer_put, 1);
timer_1s = timer_alloc();
timer_init(timer_1s, &fifo, 100);
timer_settime(timer_1s, 100);
for (;;) {
count++;
io_cli();
if (fifo32_status(&fifo) == 0) {
io_sti();
} else {
i = fifo32_get(&fifo);
io_sti();
if (i == 1) {
sprintf(s, "+%11d, times=%d", count, task_switch_times);
putfonts8_asc_sht(sht_back, 0, 144, COL8_FFFFFF, COL8_008484, s, 31);
timer_settime(timer_put, 1);
} else if (i == 100) {
sprintf(s, "-%11d", count - count0);
putfonts8_asc_sht(sht_back, 0, 128, COL8_FFFFFF, COL8_008484, s, 31);
count0 = count;
timer_settime(timer_1s, 100);
}
}
}
}
开发者ID:rogershiwl,项目名称:os30,代码行数:37,代码来源:task.c
示例11: task_b_main
void task_b_main(struct SHEET *sht_back)
{
struct FIFO32 fifo;
struct TIMER *timer_ls, *timer_put;
int i, fifobuf[128], count = 0, count0 = 0;
char s[11];
fifo32_init(&fifo, 128, fifobuf);
timer_ls = timer_alloc();
timer_init(timer_ls, &fifo, 100);
timer_settime(timer_ls, 100);
timer_put = timer_alloc();
timer_init(timer_put, &fifo, 1);
// timer_settime(timer_put, 1);
for (;;) {
count++;
io_cli();
if (0 == fifo32_status(&fifo)) {
io_sti();
} else {
i = fifo32_get(&fifo);
io_sti();
if (1 == i) {
sprintf(s, "%x", count);
putfonts8_asc_sht(sht_back, 0, 144, COL8_FFFFFF, COL8_008484, s, 10);
timer_settime(timer_put, 1);
} else if (100 == i) {
sprintf(s, "%x", count - count0);
putfonts8_asc_sht(sht_back, 0, 128, COL8_FFFFFF, COL8_008484, s, 11);
count0 = count;
timer_settime(timer_ls, 100);
}
}
}
}
开发者ID:passengerxlt,项目名称:30OS_Ubuntu,代码行数:36,代码来源:bootpack.c
示例12: cons_putchar
void cons_putchar(struct CONSOLE *cons, int chr, char move)
{
char s[2];
s[0] = chr;
s[1] = 0;
if (s[0] == 0x09) { /* �� */
for (;;) {
if (cons->sht != 0) {
putfonts8_asc_sht(cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, " ", 1);
}
cons->cur_x += 8;
if (cons->cur_x == 8 + 240) {
cons_newline(cons);
}
if (((cons->cur_x - 8) & 0x1f) == 0) {
break; /* 32�� ������ �������� break */
}
}
} else if (s[0] == 0x0a) { /* ���� */
cons_newline(cons);
} else if (s[0] == 0x0d) { /* ���� */
/* �켱 �ƹ��͵� ���� �ʴ´� */
} else { /* ���� ���� */
if (cons->sht != 0) {
putfonts8_asc_sht(cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, s, 1);
}
if (move != 0) {
/* move�� 0�� ���� Ŀ���� �����Ű�� �ʴ´� */
cons->cur_x += 8;
if (cons->cur_x == 8 + 240) {
cons_newline(cons);
}
}
}
return;
}
开发者ID:barmi,项目名称:bxos,代码行数:36,代码来源:console.c
示例13: cons_runcmd
void cons_runcmd (char *cmdline, struct CONSOLE *cons, int *fat, unsigned int memtotal)
{
if (strcmp(cmdline, "mem") == 0) {
cmd_mem (cons, memtotal);
} else if (strcmp(cmdline, "cls") == 0) {
cmd_cls (cons);
} else if (strcmp (cmdline, "dir") == 0) {
cmd_dir (cons);
} else if (cmdline[0]=='t' && cmdline[1]=='y' && cmdline[2]=='p' && cmdline[3]=='e' && cmdline[4]==' ') {
cmd_type (cons, fat, cmdline);
} else if (strcmp (cmdline, "hlt") == 0) {
cmd_hlt (cons, fat);
} else if (cmdline[0] != 0) {
// Not Command Line and Empty
putfonts8_asc_sht (cons->sht, 8, cons->cur_y, COL8_FFFFFF, COL8_000000, "Bad command.", 12);
cons_newline (cons);
cons_newline (cons);
}
}
开发者ID:msyksphinz,项目名称:sicp_exercise,代码行数:19,代码来源:console.c
示例14: cons_runcmd
void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, unsigned int memtotal)
{
if (strcmp(cmdline, "mem") == 0) {
cmd_mem(cons, memtotal);
} else if (strcmp(cmdline, "cls") == 0) {
cmd_cls(cons);
} else if (strcmp(cmdline, "dir") == 0) {
cmd_dir(cons);
} else if (strncmp(cmdline, "type ", 5) == 0) {
cmd_type(cons, fat, cmdline);
} else if (strcmp(cmdline, "hlt") == 0) {
cmd_hlt(cons, fat);
} else if (cmdline[0] != 0) {
/* コマンドではなく、さらに空行でもない */
putfonts8_asc_sht(cons->sht, 8, cons->cur_y, COL8_FFFFFF, COL8_000000, "Bad command.", 12);
cons_newline(cons);
cons_newline(cons);
}
return;
}
开发者ID:FuDesign2008,项目名称:mess,代码行数:20,代码来源:console.c
示例15: cmd_hlt
void cmd_hlt(struct CONSOLE *cons, int *fat)
{
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
struct FILEINFO *finfo = file_search("HLT.HRB", (struct FILEINFO *) (ADR_DISKIMG + 0x002600), 224);
struct SEGMENT_DESCRIPTOR *gdt = (struct SEGMENT_DESCRIPTOR *) ADR_GDT;
char *p;
if (finfo != 0) {
/* ファイルが見つかった場合 */
p = (char *) memman_alloc_4k(memman, finfo->size);
file_loadfile(finfo->clustno, finfo->size, p, fat, (char *) (ADR_DISKIMG + 0x003e00));
set_segmdesc(gdt + 1003, finfo->size - 1, (int) p, AR_CODE32_ER);
farjmp(0, 1003 * 8);
memman_free_4k(memman, (int) p, finfo->size);
} else {
/* ファイルが見つからなかった場合 */
putfonts8_asc_sht(cons->sht, 8, cons->cur_y, COL8_FFFFFF, COL8_000000, "File not found.", 15);
cons_newline(cons);
}
cons_newline(cons);
return;
}
开发者ID:FuDesign2008,项目名称:mess,代码行数:21,代码来源:console.c
示例16: cmd_type
void cmd_type(struct CONSOLE *cons, int *fat, char *cmdline)
{
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
struct FILEINFO *finfo = file_search(cmdline + 5, (struct FILEINFO *) (ADR_DISKIMG + 0x002600), 224);
char *p;
int i;
if (finfo != 0) {
/* ファイルが見つかった場合 */
p = (char *) memman_alloc_4k(memman, finfo->size);
file_loadfile(finfo->clustno, finfo->size, p, fat, (char *) (ADR_DISKIMG + 0x003e00));
for (i = 0; i < finfo->size; i++) {
cons_putchar(cons, p[i], 1);
}
memman_free_4k(memman, (int) p, finfo->size);
} else {
/* ファイルが見つからなかった場合 */
putfonts8_asc_sht(cons->sht, 8, cons->cur_y, COL8_FFFFFF, COL8_000000, "File not found.", 15);
cons_newline(cons);
}
cons_newline(cons);
return;
}
开发者ID:FuDesign2008,项目名称:mess,代码行数:22,代码来源:console.c
示例17: te2fs_lookup_dirent
/**
* @brief lookup directory-entry
* @param filename entry name looking up
* @param dirent_blk directory-entry block
* @param sz_block block size
* @return directory-entry. 0 if filename coundn't be found.
*/
struct ext2_dir_entry*
te2fs_lookup_dirent(char* filename, unsigned char* dirent_block,
unsigned int sz_block) {
struct ext2_dir_entry* p_entry;
int file_name_len;
int i = 570;
p_entry = (struct ext2_dir_entry*)dirent_block;
file_name_len = strlen(filename);
while(p_entry) {
sprintf(s, "NAME_LEN:%d, FILE_NAME_LEN:%d", (int)p_entry->name_len, file_name_len);
putfonts8_asc_sht(sht_back, 0, i+20, COL8_FFFFFF, COL8_008484, s, 200);
// not go to if statement... why???
if (file_name_len == p_entry->name_len) {
if (!strncmp(p_entry->name, filename, p_entry->name_len))
return p_entry;
}
p_entry = te2fs_next_dirent(p_entry, dirent_block, sz_block);
i += 20;
}
return 0;
}
开发者ID:huu12,项目名称:testOS,代码行数:30,代码来源:fs_origin.c
示例18: HariMain
//.........这里部分代码省略.........
/* キーボードコントローラに送るデータがあれば、送る */
keycmd_wait = fifo32_get(&keycmd);
wait_KBC_sendready();
io_out8(PORT_KEYDAT, keycmd_wait);
}
io_cli();
if (fifo32_status(&fifo) == 0) {
task_sleep(task_a);
io_sti();
} else {
i = fifo32_get(&fifo);
io_sti();
if (256 <= i && i <= 511) { /* キーボードデータ */
if (i < 0x80 + 256) { /* キーコードを文字コードに変換 */
if (key_shift == 0) {
s[0] = keytable0[i - 256];
} else {
s[0] = keytable1[i - 256];
}
} else {
s[0] = 0;
}
if ('A' <= s[0] && s[0] <= 'Z') { /* 入力文字がアルファベット */
if (((key_leds & 4) == 0 && key_shift == 0) ||
((key_leds & 4) != 0 && key_shift != 0)) {
s[0] += 0x20; /* 大文字を小文字に変換 */
}
}
if (s[0] != 0) { /* 通常文字 */
if (key_to == 0) { /* タスクAへ */
if (cursor_x < 128) {
/* 一文字表示してから、カーソルを1つ進める */
s[1] = 0;
putfonts8_asc_sht(sht_win, cursor_x, 28, COL8_000000, COL8_FFFFFF, s, 1);
cursor_x += 8;
}
} else { /* コンソールへ */
fifo32_put(&task_cons->fifo, s[0] + 256);
}
}
if (i == 256 + 0x0e) { /* バックスペース */
if (key_to == 0) { /* タスクAへ */
if (cursor_x > 8) {
/* カーソルをスペースで消してから、カーソルを1つ戻す */
putfonts8_asc_sht(sht_win, cursor_x, 28, COL8_000000, COL8_FFFFFF, " ", 1);
cursor_x -= 8;
}
} else { /* コンソールへ */
fifo32_put(&task_cons->fifo, 8 + 256);
}
}
if (i == 256 + 0x1c) { /* Enter */
if (key_to != 0) { /* コンソールへ */
fifo32_put(&task_cons->fifo, 10 + 256);
}
}
if (i == 256 + 0x0f) { /* Tab */
if (key_to == 0) {
key_to = 1;
make_wtitle8(buf_win, sht_win->bxsize, "task_a", 0);
make_wtitle8(buf_cons, sht_cons->bxsize, "console", 1);
cursor_c = -1; /* カーソルを消す */
boxfill8(sht_win->buf, sht_win->bxsize, COL8_FFFFFF, cursor_x, 28, cursor_x + 7, 43);
fifo32_put(&task_cons->fifo, 2); /* コンソールのカーソルON */
} else {
key_to = 0;
开发者ID:bigpussy,项目名称:harib_os_src,代码行数:67,代码来源:bootpack.c
示例19: HariMain
void HariMain(void)
{
struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO;
struct FIFO32 fifo;
char s[40];
int fifobuf[128];
struct TIMER *timer, *timer2, *timer3;
int mx, my, i, cursor_x, cursor_c; // cursor_x: 记录光标显示位置
unsigned int memtotal;
struct MOUSE_DEC mdec;
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
struct SHTCTL *shtctl;
struct SHEET *sht_back, *sht_mouse, *sht_win;
unsigned char *buf_back, buf_mouse[256], *buf_win;
static char keytable[0x54] = {
0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 0,
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '[', ']', 0, 0, 'A', 'S',
'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', ':', 0, 0, '\\', 'Z', 'X', 'C', 'V',
'B', 'N', 'M', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1',
'2', '3', '0', '.'
};
init_gdtidt();
init_pic();
io_sti(); /* IDT/PIC的初始化结束,开启CPU中断 */
fifo32_init(&fifo, 128, fifobuf);
init_pit();
init_keyboard(&fifo, 256);
enable_mouse(&fifo, 512, &mdec);
io_out8(PIC0_IMR, 0xf8); /* 许可PIC1和键盘(11111000) */
io_out8(PIC1_IMR, 0xef); /* 许可鼠标(11101111) */
timer = timer_alloc();
timer_init(timer, &fifo, 10);
timer_settime(timer, 1000);
timer2 = timer_alloc();
timer_init(timer2, &fifo, 3);
timer_settime(timer2, 300);
timer3 = timer_alloc();
timer_init(timer3, &fifo, 1);
timer_settime(timer3, 50);
memtotal = memtest(0x00400000, 0xbfffffff); // 使用的内存空间,包含了0x00400000前已用的内存
memman_init(memman);
memman_free(memman, 0x00001000, 0x0009e000); /* 0x00001000 - 0x0009efff */
memman_free(memman, 0x00400000, memtotal - 0x00400000);
init_palette();
shtctl = shtctl_init(memman, binfo->vram, binfo->scrnx, binfo->scrny);
sht_back = sheet_alloc(shtctl);
sht_mouse = sheet_alloc(shtctl);
sht_win = sheet_alloc(shtctl);
buf_back = (unsigned char *) memman_alloc_4k(memman, binfo->scrnx * binfo->scrny);
buf_win = (unsigned char *) memman_alloc_4k(memman, 160 * 52);
sheet_setbuf(sht_back, buf_back, binfo->scrnx, binfo->scrny, -1); /* 没有透明色 */
sheet_setbuf(sht_mouse, buf_mouse, 16, 16, 99); // 透明色号99
sheet_setbuf(sht_win, buf_win, 160, 52, -1); /* 没有透明色 */
init_screen8(buf_back, binfo->scrnx, binfo->scrny);
init_mouse_cursor8(buf_mouse, 99);
make_window8(buf_win, 160, 52, "window");
make_textbox8(sht_win, 8, 28, 144, 16, COL8_FFFFFF);
cursor_x = 8;
cursor_c = COL8_FFFFFF;
sheet_slide(sht_back, 0, 0);
mx = (binfo->scrnx - 16) / 2;
my = (binfo->scrny - 28 - 16) / 2;
sheet_slide(sht_mouse, mx, my);
sheet_slide(sht_win, 80, 72);
sheet_updown(sht_back, 0);
sheet_updown(sht_win, 1);
sheet_updown(sht_mouse, 2);
sprintf(s, "(%3d, %3d)", mx, my);
putfonts8_asc_sht(sht_back, 0, 0, COL8_FFFFFF, COL8_008484, s, 10);
sprintf(s, "memory %dMB free : %dKB", memtotal / (1024 * 1024), memman_total(memman) / 1024);
putfonts8_asc_sht(sht_back, 0, 32, COL8_FFFFFF, COL8_008484, s, 40);
for (;;) {
io_cli();
if (fifo32_status(&fifo) == 0) {
/* J
char ss[10];
sprintf(ss, "%c", "J");
putfonts8_asc(binfo->vram, binfo->scrnx, 100, 100, COL8_FFFFFF, ss);
*/
io_stihlt();
} else {
i = fifo32_get(&fifo);
io_sti();
if (256 <= i && i <= 511) { /* 键盘数据 */
sprintf(s, "%02X", i - 256);
putfonts8_asc_sht(sht_back, 0, 16, COL8_FFFFFF, COL8_008484, s, 2);
if (i < 256 + 0x54) {
if (keytable[i - 256] != 0 && cursor_x < 144) { /* 通常文字 */
/* 显示1个字符就前移1次光标 */
s[0] = keytable[i - 256];
s[1] = 0;
//.........这里部分代码省略.........
开发者ID:NeilJudson,项目名称:HomemadeOS,代码行数:101,代码来源:bootpack.c
示例20: HariMain
//.........这里部分代码省略.........
keycmd_wait = fifo32_get(&keycmd);
wait_KBC_sendready ();
io_out8(PORT_KEYDAT, keycmd_wait);
}
io_cli();
if (fifo32_status(&fifo) == 0) {
task_sleep(task_a);
io_sti();
} else {
i = fifo32_get(&fifo);
io_sti();
if (256 <= i && i <= 511) { // Keyboard Data
// sprintf (s, "%x", i - 256);
// putfonts8_asc_sht (sht_back, 0, 16, COL8_FFFFFF, COL8_008484, s, 2);
if (i < 0x80 + 256) {
if (key_shift == 0) {
s[0] = keytable0[i - 256];
} else {
s[0] = keytable1[i - 256];
}
} else {
s[0] = 0;
}
if ('A' <= s[0] && s[0] <= 'Z') {
if (((key_leds & 4) == 0 && key_shift == 0) ||
((key_leds & 4) != 0 && key_shift != 0)) {
s[0] += 0x20;
}
}
if (s[0] != 0) {
if (key_to == 0) {
if (cursor_x < 128) {
s[1] = 0;
putfonts8_asc_sht (sht_win, cursor_x, 28, COL8_000000, COL8_FFFFFF, s, 1);
cursor_x += 8;
}
} else { // To Console
fifo32_put (&task_cons->fifo, s[0] + 256);
}
}
if (i == 256 + 0x0e) { // Backspace
if (key_to == 0) { // To Task-A
if (cursor_x > 8) {
putfonts8_asc_sht(sht_win, cursor_x, 28, COL8_000000, COL8_FFFFFF, " ", 1);
cursor_x -= 8;
}
} else {
fifo32_put(&task_cons->fifo, 8 + 256);
}
}
if (i == 256 + 0x0f) { // Tab
if (key_to == 0) {
key_to = 1;
make_wtitle8 (buf_win, sht_win->bxsize, "task_a", 0);
make_wtitle8 (buf_cons, sht_cons->bxsize, "console", 1);
cursor_c = -1; // Delete cursor
boxfill8 (sht_win->buf, sht_win->bxsize, COL8_FFFFFF, cursor_x, 28, cursor_x + 7, 43);
fifo32_put (&task_cons->fifo, 2); // cursor ON console
} else {
key_to = 0;
make_wtitle8 (buf_win, sht_win->bxsize, "task_a", 1);
make_wtitle8 (buf_cons, sht_cons->bxsize, "console", 0);
cursor_c = COL8_000000; // Delete cursor
fifo32_put (&task_cons->fifo, 3); // cursor OFF console
}
sheet_refresh (sht_win, 0, 0, sht_win->bxsize, 21);
开发者ID:msyksphinz,项目名称:sicp_exercise,代码行数:67,代码来源:bootpack.c
注:本文中的putfonts8_asc_sht函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论