From cbd32487d68792064cdba85eb5f1b4a105e9de1d Mon Sep 17 00:00:00 2001 From: ld Date: Mon, 27 Dec 2010 05:00:25 +0500 Subject: [PATCH] Add stdio.asm --- stage2/include/stdio.asm | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 stage2/include/stdio.asm diff --git a/stage2/include/stdio.asm b/stage2/include/stdio.asm new file mode 100644 index 0000000..a768151 --- /dev/null +++ b/stage2/include/stdio.asm @@ -0,0 +1,42 @@ +puts: + push si + mov si,ax +.loop: + mov al,[si] + test al,al + jz .end + call putc + inc si + jmp .loop +.end: + pop si + xor ax,ax + ret + +gets: + push di + mov di,ax +.loop: + call getc + cmp al,13 + je .end + call putc + mov [di],al + inc di + jmp .loop +.end: + mov byte [di],0 + mov ax,di + pop di + ret + +putc: + mov ah,0x0e + int 0x10 + xor ax,ax + ret + +getc: + xor ax,ax + int 0x16 + ret -- 2.11.4.GIT