first 64k instead, should be enough for the kernel.
warn = -pedantic -Wall
inc = -nostdinc -Isrc -Isrc/libc
+arch = -march=i8088 -mtune=i8088
-CFLAGS = -march=i8088 -mtune=i8088 $(warn) $(inc) -MMD
+CFLAGS = $(arch) -ffreestanding -mcmodel=small $(warn) $(inc) -MMD
LDFLAGS = -T kern.ld -Map kern.map
$(img): $(bin)
void kmain(void)
{
- int i, j;
- unsigned short __far *vmem = (void __far*)0xb8000000ul;
- unsigned short c;
-
vid_init();
vid_text(0, 0, "hello!", VID_ATTR(LTRED, BLACK));
init_intr();
-
- vmem += 80;
- for(i=1; i<25; i++) {
- c = ((i & 0xf) << 8) | '@';
- for(j=0; j<80; j++) {
- *vmem++ = c;
- }
- }
}
bits 16
section .startup
-; memory reserved at the top of RAM for the kernel stack
+; memory reserved at the top of the kernel segment for the stack
STACKSZ equ 4096
extern kmain
_start:
; TODO floppy off if necessary
- ; move stack to the top of RAM (TODO: detect and avoid Ext. BIOS data area)
- mov ax, (0xa0000 - STACKSZ) >> 4
- mov ss, ax
- mov sp, STACKSZ
+ ; move stack to the top of the kernel segment
+ xor ax, ax
+ mov sp, ax
; zero .bss
mov di, _bss_start_off