Skip to content

Commit

Permalink
攻克难题——字符串显示API
Browse files Browse the repository at this point in the history
  • Loading branch information
yourtion committed May 4, 2016
1 parent d07ff5d commit ae67519
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions 21_day/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
if (finfo != 0) {
/*找到文件的情况*/
p = (char *) memman_alloc_4k(memman, finfo->size);
*((int *) 0xfe8) = (int) p;
file_loadfile(finfo->clustno, finfo->size, p, fat, (char *) (ADR_DISKIMG + 0x003e00));
set_segmdesc(gdt + 1003, finfo->size - 1, (int) p, AR_CODE32_ER);
farcall(0, 1003 * 8);
Expand All @@ -297,13 +298,14 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)

void hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int eax)
{
int cs_base = *((int *) 0xfe8);
struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec);
if (edx == 1) {
cons_putchar(cons, eax & 0xff, 1);
} else if (edx == 2) {
cons_putstr0(cons, (char *) ebx);
cons_putstr0(cons, (char *) ebx + cs_base);
} else if (edx == 3) {
cons_putstr1(cons, (char *) ebx, ecx);
cons_putstr1(cons, (char *) ebx + cs_base, ecx);
}
return;
}

0 comments on commit ae67519

Please sign in to comment.