]> wirehaze git hosting - BOS.git/blobdiff - kernel/kernel.asm

wirehaze git hosting

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