X-Git-Url: https://git.wirehaze.ovh/BOS.git/blobdiff_plain/cad3370c4c7b9dc7ae521851f7462802e6d88ba1..HEAD:/kernel/kernel.asm diff --git a/kernel/kernel.asm b/kernel/kernel.asm old mode 100755 new mode 100644 index 40c2225..2f5603e --- a/kernel/kernel.asm +++ b/kernel/kernel.asm @@ -1,31 +1,31 @@ ;-------------------------------------------------------; -; BOS kernel ; +; BOS kernel ; ;-------------------------------------------------------; -; BOS 32-bit kernel, expects to be loaded at 64kb ; +; BOS 32-bit kernel, expects to be loaded at 32kb ; ; in mem. Small amount of 16-bit code included. ; ; ; -; For any comments on this code, mail me. ; -; http://bos.asmhackers.net/ asmhacker@gmail.com ; +; Homepage: http://bos.asmhackers.net/ ; +; Repository: http://github.com/bubach/BOS ; ; ; -; by: Christoffer Bubach, 2003-2005 ; +; by: Christoffer Bubach, 2003-2015 ; ;-------------------------------------------------------; use16 -org 0x10000 +org 0x8000 ;---------------------------; ; jump to starting point ; ;---------------------------; - jmp start + jmp start ;----------------------------------------; ; 16-bit include files ; ;----------------------------------------; - include 'realmode/a20.inc' ; Function to set the a20-gate. - include 'realmode/gdt.inc' ; Global Description Table. - include 'realmode/idt.inc' ; The Interrupt Description Table. - include 'realmode/mem.inc' ; Get memory size. - include 'realmode/variables.inc' ; For/from realmode. - include 'realmode/do_all_16bit.inc' ; Save "go back to 16-bit"-info. + include '16bit/a20.asm' ; Function to set the a20-gate. + include '16bit/gdt.asm' ; Global Description Table. + include '16bit/idt.asm' ; The Interrupt Description Table. + include '16bit/mem.asm' ; Get memory size. + include '16bit/variables.asm' ; For/from realmode. + include '16bit/init16bit.asm' ; Save "go back to 16-bit"-info. @@ -33,31 +33,31 @@ org 0x10000 ; 16-bit entry point ; ;--------------------------; start: - cli - mov ax, cs - mov ds, ax - ; fasm is more strict about - xor eax, eax ; "org 0x10000" then nasm, so - mov es, ax ; i have to do -0x10000 from - mov fs, ax ; all variable addresses while - mov gs, ax ; in realmode. - sti + cli + mov ax, cs + mov ds, ax + ; fasm is more strict about + xor eax, eax ; "org 0x10000" then nasm, so + mov es, ax ; i have to do -0x10000 from + mov fs, ax ; all variable addresses while + mov gs, ax ; in realmode. + sti - call enable_a20 - call do_all_16bit ; ... :P + call enable_a20 + call init16bit ; ... :P - cli - mov ax, cs ; save cs - mov [realmode_cs - 0x10000], ax ; in variables.inc + cli + mov ax, cs ; save cs + mov [realmode_cs], ax ; in variables.inc - lgdt [gdtr - 0x10000] ; Load the GDT descriptor - lidt [idtr - 0x10000] ; Load the IDT descriptor + lgdt [gdtr] ; Load the GDT descriptor + lidt [idtr] ; Load the IDT descriptor - mov eax, cr0 - or al, 1 - mov cr0, eax + mov eax, cr0 + or al, 1 + mov cr0, eax - jmp pword 0x08:flush ; dword in nasm + jmp pword 0x08:flush ; dword in nasm @@ -66,55 +66,56 @@ start: ;--------------------------; use32 flush: - mov ax, 0x10 ; refresh all segment registers - mov ds, ax - mov es, ax - mov fs, ax - mov gs, ax - mov ss, ax - mov esp, 0xFFFC + mov ax, 0x10 ; refresh all segment registers + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + mov esp, 0xFFFC - call bos_init ; fix everything + call bos_init ; fix everything - mov bx, 0x04B1 ; start the shell - call setcursor - mov esi, bos_shell - mov bl, 0x07 - call print - call init_cmd - jmp shell + mov bx, 0x04B1 ; start the shell + call setcursor + mov esi, bos_shell + mov bl, 0x07 + call print + call init_cmd + jmp shell - ;int 0x32 + ;int 0x32 - .hang: - cli - hlt - jmp .hang ; hang, just in case.. + .hang: + cli + hlt + jmp .hang ; hang, just in case.. ;----------------------------------------; ; 32-bit include files ; ;----------------------------------------; - include 'krl_incs/idt.inc' ; The Interrupt Description Table. - include 'krl_incs/text.inc' ; The default textmode functions. - include 'krl_incs/bos_init.inc' ; Function that starts up BOS - include 'krl_incs/en_mess.inc' ; All strings in english (soon). - include 'krl_incs/rmode_int.inc' ; Get back to realmode and do an INT. - include 'krl_incs/pic.inc' ; PIC rutines. - include 'krl_incs/sys_ints.inc' ; System specific interrupts. - include 'krl_incs/keyboard.inc' ; Keyboard ISR. - include 'krl_incs/keymap.inc' ; Keymap(s). - include 'krl_incs/shell.inc' ; File with shell/kernel monitor functions. - include 'krl_incs/commands.inc' ; Command table, for valid shell commands. - include 'krl_incs/isr.inc' ; Interrupt Service Rutines. - include 'krl_incs/debug.inc' ; Print contents of all regs and hang. - include 'krl_incs/cmos.inc' ; To get CMOS data. - include 'krl_incs/time_date.inc' ; Print time and date. - include 'krl_incs/timer.inc' ; Timer IRQ. - include 'krl_incs/vga.inc' ; VGA functions. - ; include 'krl_incs/font8x16.inc' ; Standard font. - include 'krl_incs/dma.inc' ; DMA code. - include 'krl_incs/fdc.inc' ; Floppy code. - include 'krl_incs/mario.inc' ; Mario sprite. - include 'krl_incs/pc_speaker.inc' ; PC speaker. - include 'krl_incs/mem.inc' ; Memory allocation and freeing. \ No newline at end of file + include 'int/idt.asm' ; The Interrupt Description Table. + include 'vga/text.asm' ; The default textmode functions. + include 'init/init32b.asm' ; Function that starts up BOS + include 'vars/strings.asm' ; All strings in english (soon). + include 'init/bios.asm' ; Get back to realmode and do an INT. + include 'init/pic.asm' ; PIC rutines. + include 'system/services.asm' ; System service handler (int 0x32). + include 'kbd/keyboard.asm' ; Keyboard ISR. + include 'kbd/keymap.asm' ; Keymap(s). + include 'shell/shell.asm' ; File with shell/kernel monitor functions. + include 'shell/commands.asm' ; Command table, for valid shell commands. + include 'int/isr.asm' ; Interrupt Service Rutines. + include 'int/debug.asm' ; Print contents of all regs and hang. + include 'init/cmos.asm' ; To get CMOS data. + include 'shell/clock.asm' ; Print time and date. + include 'init/timer.asm' ; Timer IRQ. + include 'vga/vga.asm' ; VGA functions. +; include 'vga/font8x16.asm' ; Standard font. + include 'fdc/dma.asm' ; DMA code. + include 'fdc/fdc.asm' ; Floppy code. + include 'vga/mario.asm' ; Mario sprite. + include 'sound/speaker.asm' ; PC speaker. + include 'ram/mem.asm' ; Memory allocation and freeing. + include 'vfs/parse.asm' ; Path parser for VFS functions. \ No newline at end of file