mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-03 01:53:24 +08:00
显示单个字符的API(1)
This commit is contained in:
@@ -30,6 +30,7 @@ void asm_inthandler27(void);
|
||||
void asm_inthandler2c(void);
|
||||
unsigned int memtest_sub(unsigned int start, unsigned int end);
|
||||
void farjmp(int eip, int cs);
|
||||
void asm_cons_putchar(void);
|
||||
|
||||
/* fifo.c */
|
||||
struct FIFO32 {
|
||||
|
||||
@@ -16,6 +16,7 @@ void console_task(struct SHEET *sheet, unsigned int memtotal)
|
||||
cons.cur_x = 8;
|
||||
cons.cur_y = 28;
|
||||
cons.cur_c = -1;
|
||||
*((int *) 0x0fec) = (int) &cons;
|
||||
|
||||
fifo32_init(&task->fifo, 128, fifobuf, task);
|
||||
timer = timer_alloc();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
[BITS 32]
|
||||
CLI
|
||||
MOV AL,'A'
|
||||
CALL 0xbe3
|
||||
fin:
|
||||
HLT
|
||||
JMP fin
|
||||
@@ -17,8 +17,10 @@
|
||||
GLOBAL _asm_inthandler27, _asm_inthandler2c
|
||||
GLOBAL _memtest_sub
|
||||
GLOBAL _farjmp
|
||||
GLOBAL _asm_cons_putchar
|
||||
EXTERN _inthandler20, _inthandler21
|
||||
EXTERN _inthandler27, _inthandler2c
|
||||
EXTERN _cons_putchar
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
@@ -209,4 +211,13 @@ mts_fin:
|
||||
|
||||
_farjmp: ; void farjmp(int eip, int cs);
|
||||
JMP FAR [ESP+4] ; eip, cs
|
||||
RET
|
||||
RET
|
||||
|
||||
_asm_cons_putchar:
|
||||
PUSH 1
|
||||
AND EAX,0xff ; 将AH和EAX的高位置0,将EAX置为已存入字符编码的状态
|
||||
PUSH EAX
|
||||
PUSH DWORD [0x0fec] ; 读取内存并PUSH该值
|
||||
CALL _cons_putchar
|
||||
ADD ESP,12 ; 将栈中的数据丢弃
|
||||
RET
|
||||
|
||||
Reference in New Issue
Block a user