From: John Tsiombikas Date: Sun, 20 Nov 2022 03:28:52 +0000 (+0200) Subject: foobar X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=75c807bc860a914f910b1fc99bd4c26d37e931e0;p=eightysix foobar --- diff --git a/kern/Makefile b/kern/Makefile index 717025f..d097da2 100644 --- a/kern/Makefile +++ b/kern/Makefile @@ -1,6 +1,6 @@ -csrc = $(wildcard src/*.c) -ssrc = $(wildcard src/*.asm) -obj = $(csrc:.c=.o) $(ssrc:.asm=.o) +csrc = $(wildcard src/*.c) $(wildcard src/libc/*.c) +ssrc = $(wildcard src/*.asm) $(wildcard src/libc/*.asm) +obj = $(csrc:.c=.o) $(ssrc:.asm=-asm.o) dep = $(csrc:.c=.d) disk_numsec = 720 @@ -27,7 +27,7 @@ $(bin): $(obj) -include $(dep) -%.o: %.asm +%-asm.o: %.asm nasm -o $@ -f elf $< .PHONY: clean diff --git a/kern/src/libc/string.asm b/kern/src/libc/string.asm new file mode 100644 index 0000000..b3f0f98 --- /dev/null +++ b/kern/src/libc/string.asm @@ -0,0 +1,65 @@ + cpu 8086 + bits 16 + section .text + +global memset +memset: + push bp + mov bp, sp + push di + mov di, [bp + 4] + mov ax, [bp + 6] + mov ah, al + mov cx, [bp + 8] + test di, 1 + jz .skip_odd_addr + stosb + dec cx +.skip_odd_addr: + test cx, 1 + jz .skip_odd_cx + push bx + mov bx, cx + mov [bx + di], al + inc di + pop bx +.skip_odd_cx: + shr cx, 1 ; count words + rep stosw + pop di + pop bp + ret + +global fmemset +fmemset: + push bp + mov bp, sp + push di + push es + mov di, [bp + 4] + mov ax, [bp + 6] + mov es, ax + mov ax, [bp + 8] + mov ah, al + mov cx, [bp + 10] + test di, 1 + jz .skip_odd_addr + stosb + dec cx +.skip_odd_addr: + test cx, 1 + jz .skip_odd_cx + push bx + mov bx, cx + mov [es:bx + di], al + inc di + pop bx +.skip_odd_cx: + shr cx, 1 ; count words + rep stosw + pop es + pop di + pop bp + ret + +; vi:ts=8 sts=8 sw=8 ft=nasm: diff --git a/kern/src/main.c b/kern/src/main.c index 71a613f..ea4ffac 100644 --- a/kern/src/main.c +++ b/kern/src/main.c @@ -1,4 +1,5 @@ #include "intr.h" +#include "vid.h" void kmain(void) { @@ -8,7 +9,8 @@ void kmain(void) unsigned short c; */ - init_disp(); + vid_init(); + vid_text(0, 0, "hello!", VID_ATTR(LTRED, BLACK)); init_intr(); /*