Skip to content

Commit

Permalink
Step harib17c: Add put char app
Browse files Browse the repository at this point in the history
page 402 ~ 406
  • Loading branch information
M366 committed Aug 15, 2020
1 parent 51f67fd commit 8bb4eeb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions harib/bootpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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
Expand Down
1 change: 1 addition & 0 deletions harib/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; // store the address of cons

fifo32_init(&task->fifo, 128, fifobuf, task);
timer = timer_alloc();
Expand Down
6 changes: 4 additions & 2 deletions harib/hlt.nas
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[BITS 32]
MOV AL, 'A'
CALL 2*8:0xbe3
fin:
HLT
JMP fin
HLT
JMP fin
12 changes: 12 additions & 0 deletions harib/naskfunc.nas
Original file line number Diff line number Diff line change
Expand Up @@ -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] ; begin .text section

Expand Down Expand Up @@ -211,3 +213,13 @@ mts_fin:
_farjmp: ; void farjmp(int eip, int cs);
JMP FAR [ESP+4] ; eip, cs
RET

_asm_cons_putchar:
PUSH 1
AND EAX,0xff ; AHやEAXの上位を0にして、EAXに文字コードが入った状態にする。
PUSH EAX
PUSH DWORD [0x0fec] ; メモリの内容を読み込んでその値をPUSHする 0x0fec: an address of cons
CALL _cons_putchar
ADD ESP,12 ; スタックに積んだデータを捨てる
RETF

0 comments on commit 8bb4eeb

Please sign in to comment.