-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
-include $(dep)
-%.o: %.asm
+%-asm.o: %.asm
nasm -o $@ -f elf $<
.PHONY: clean
--- /dev/null
+ 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:
#include "intr.h"
+#include "vid.h"
void kmain(void)
{
unsigned short c;
*/
- init_disp();
+ vid_init();
+ vid_text(0, 0, "hello!", VID_ATTR(LTRED, BLACK));
init_intr();
/*