]> wirehaze git hosting - BOS.git/commitdiff

wirehaze git hosting

Some more source cleaning
authorChristoffer Bubach <christoffer@ridestore.com>
Sun, 11 Jan 2015 00:09:08 +0000 (01:09 +0100)
committerChristoffer Bubach <christoffer@ridestore.com>
Sun, 11 Jan 2015 00:09:08 +0000 (01:09 +0100)
boot/BOS_boot.asm
kernel/16bit/gdt.asm
kernel/16bit/idt.asm
kernel/16bit/init16bit.asm
kernel/16bit/variables.asm
kernel/fdc/fdc.asm
kernel/init/init32b.asm

index a7a5c1259eafdc5a1ef0287f1d25926fe71e2ff7..432465c5248129042e6d1574e0b73969575c8a99 100755 (executable)
 ;  - FAT12 compatible.                                       ;\r
 ;  - Loads a binary file from the floppy.                    ;\r
 ;                                                            ;\r
+;     16-bit mem map  (seg:off)                              ;\r
+;------------------------------------------------------------;\r
+;  0x0000:0x0000 -> 0x0000:0x0500  BIOS stuff                ;\r
+;  0x0000:0x0500 -> 0x0000:0x2100  FAT12 rootdir             ;\r
+;  0x0000:0x2100 -> 0x0000:0x3300  FAT for FAT12             ;\r
+;  0x0000:0x3300 -> 0x0000:0x6c00  14,25kb free space        ;\r
+;  0x0000:0x6c00 -> 0x0000:0x7400  IDT, 256 descriptors      ;\r
+;  0x0000:0x7400 -> 0x0000:0x7c00  GDT, 256 descriptors      ;\r
+;  0x0000:0x7c00 -> 0x0000:0x7e00  bootsector                ;\r
+;  0x0000:0x7e00 <- 0x0000:0x8000  512b stack for boot       ;\r
+;  0x0000:0x8000 -> 0x9000:0xffff  608kb kernel/free space   ;\r
+;  0xA000:0x0000 -> .............  VGA mem etc.              ;\r
 ;------------------------------------------------------------;\r
-\r
-; TODO:\r
-;  as i moved some 16-bit stuff to the kernel, i now got\r
-;  space to do proper testing (for data-area etc),\r
-;  fix that...\r
-;\r
-; TODO2:\r
-;  find out why this crap takes ages to load the kernel.. :S\r
-\r
-\r
-;\r
-;     16-bit mem map  (seg:off)\r
-;  0x0000:0x0000 -> 0x0000:0x0500  BIOS stuff\r
-;  0x0000:0x0500 -> 0x0000:0x2100  FAT12 rootdir\r
-;  0x0000:0x2100 -> 0x0000:0x3300  FAT for FAT12\r
-;  0x0000:0x3300 -> 0x0000:0x6c00  14,25kb free space\r
-;  0x0000:0x6c00 -> 0x0000:0x7400  IDT, 256 descriptors\r
-;  0x0000:0x7400 -> 0x0000:0x7c00  GDT, 256 descriptors\r
-;  0x0000:0x7c00 -> 0x0000:0x7e00  bootsector\r
-;  0x0000:0x7e00 <- 0x0000:0x8000  512b stack for boot\r
-;  0x0000:0x8000 -> 0x9000:0xffff  608kb kernel/free space\r
-;;;;  0x0000:0x7e00 <- 0x0000:0xffff  ~32,5kb stack for boot\r
-;;;;  0x1000:0x0000 -> 0x9000:0xffff  576kb kernel/free space\r
-;  0xA000:0x0000 -> .............  VGA mem etc.\r
 \r
 use16\r
 org 0x7C00\r
 \r
 boot:\r
-         jmp     short start\r
-         nop\r
+        jmp    short start\r
+        nop\r
 \r
 ;------------------------------------------;\r
 ;  Standard BIOS Parameter Block, "BPB".   ;\r
 ;------------------------------------------;\r
-      bpbOEM          db  'BOS 0.04'\r
-         bpbSectSize     dw  512\r
-         bpbClustSize    db  1\r
-         bpbReservedSec  dw  1\r
-         bpbFats             db  2\r
-         bpbRootSize     dw  224\r
-         bpbTotalSect    dw  2880\r
-         bpbMedia            db  240\r
-         bpbFatSize      dw  9\r
-         bpbTrackSect    dw  18\r
-         bpbHeads            dw  2\r
-         bpbHiddenSect   dd  0\r
-         bpbLargeSect    dd  0\r
-     ;---------------------------------;\r
-     ;  extended BPB for FAT12/FAT16   ;\r
-     ;---------------------------------;\r
-         bpbDriveNo      db  0\r
-         bpbReserved     db  0\r
-         bpbSignature    db  41                      ; 0 = nothing more. 41 = three more (below)..\r
-         bpbID               dd  1\r
-         bpbVolumeLabel  db  'BOOT FLOPPY'\r
-         bpbFileSystem   db  'FAT12   '\r
+    bpbOEM          db  'BOS 0.04'\r
+    bpbSectSize     dw  512\r
+    bpbClustSize    db  1\r
+    bpbReservedSec  dw  1\r
+    bpbFats         db  2\r
+    bpbRootSize     dw  224\r
+    bpbTotalSect    dw  2880\r
+    bpbMedia        db  240\r
+    bpbFatSize      dw  9\r
+    bpbTrackSect    dw  18\r
+    bpbHeads        dw  2\r
+    bpbHiddenSect   dd  0\r
+    bpbLargeSect    dd  0\r
+    ;---------------------------------;\r
+    ;  extended BPB for FAT12/FAT16   ;\r
+    ;---------------------------------;\r
+    bpbDriveNo      db  0\r
+    bpbReserved     db  0\r
+    bpbSignature    db  41                            ; 0 = end. 41 = three more.\r
+    bpbID           dd  1\r
+    bpbVolumeLabel  db  'BOOT FLOPPY'\r
+    bpbFileSystem   db  'FAT12   '\r
 \r
 \r
 ;----------------------------------------;\r
 ;   starting point of bootsector code    ;\r
 ;----------------------------------------;\r
 start:\r
-         cli\r
-\r
-         xor     ax, ax                              ; initialize all the necessary\r
-         mov     ds, ax                              ; registers.\r
-         mov     es, ax\r
-         mov     ss, ax\r
-         mov     sp, 0x8000                          ; Stack..\r
-\r
-         mov     [bpbDriveNo], dl\r
-\r
-         sti\r
-\r
-\r
-;----------------------------------;\r
-;   clear screen and print some    ;\r
-;----------------------------------;\r
-         mov     ax, 3                               ; Set mode 0x03\r
-         int     0x10\r
-\r
-         mov     bp, loading                         ; Print loading message.\r
-         mov     ax, 0x1301\r
-         mov     bx, 7\r
-         mov     cx, 12\r
-         mov     dx, 0x0102\r
-         int     0x10\r
-\r
-         mov     bl, 2                               ; Set cursor.\r
-         mov     ah, 2\r
-         mov     dx, 0x0201\r
-         int     0x10\r
-\r
-         mov     ah, 9                               ; Print 14 green dots.\r
-         mov     al, '.'\r
-         mov     cx, 14\r
-         int     0x10\r
-\r
-\r
-;---------------------------;\r
-;    load FAT and root      ;\r
-;---------------------------;\r
-         mov     di, 0x0050                          ; Load the root to\r
-         mov     ax, 19                              ; 0x0000:0x0500 (0x500/0x10)\r
-         mov     cx, 14\r
-         call    read_sectors\r
-\r
-         mov     di, 0x0210                          ; Load the fat to\r
-         mov     ax, 1                               ; 0x0000:0x2100\r
-         mov     cx, 9\r
-         call    read_sectors\r
-\r
-\r
-     ;------------------------;\r
-     ;  search for the file   ;\r
-     ;------------------------;\r
-         mov     dx, [bpbRootSize]\r
-         mov     bx, 0x0500\r
-     filesearch:\r
-         cld\r
-         mov     si, filename\r
-         mov     cx, 11\r
-         mov     di, bx\r
-         repe    cmpsb\r
-         je      found\r
-         add     bx, 32\r
-         dec     dx\r
-         jz      error\r
-         jmp     filesearch\r
+        cli\r
+\r
+        xor    ax, ax                                 ; initialize all the necessary\r
+        mov    ds, ax                                 ; registers.\r
+        mov    es, ax\r
+        mov    ss, ax\r
+        mov    sp, 0x8000                             ; Stack..\r
+\r
+        mov    [bpbDriveNo], dl\r
+\r
+        sti\r
+\r
+\r
+    ;----------------------------------;\r
+    ;   clear screen and print some    ;\r
+    ;----------------------------------;\r
+        mov    ax, 3                                  ; Set mode 0x03\r
+        int    0x10\r
+\r
+        mov    bp, loading                            ; Print loading message.\r
+        mov    ax, 0x1301\r
+        mov    bx, 7\r
+        mov    cx, 12\r
+        mov    dx, 0x0102\r
+        int    0x10\r
+\r
+        mov    bl, 2                                  ; Set cursor.\r
+        mov    ah, 2\r
+        mov    dx, 0x0201\r
+        int    0x10\r
+\r
+        mov    ah, 9                                  ; Print 14 green dots.\r
+        mov    al, '.'\r
+        mov    cx, 14\r
+        int    0x10\r
+\r
+\r
+    ;---------------------------;\r
+    ;    load FAT and root      ;\r
+    ;---------------------------;\r
+        mov    di, 0x0050                             ; Load the root to\r
+        mov    ax, 19                                 ; 0x0000:0x0500 (0x500/0x10)\r
+        mov    cx, 14\r
+        call   read_sectors\r
+\r
+        mov    di, 0x0210                             ; Load the fat to\r
+        mov    ax, 1                                  ; 0x0000:0x2100\r
+        mov    cx, 9\r
+        call   read_sectors\r
+\r
+\r
+    ;------------------------;\r
+    ;  search for the file   ;\r
+    ;------------------------;\r
+        mov    dx, [bpbRootSize]\r
+        mov    bx, 0x0500\r
+    .filesearch:\r
+        cld\r
+        mov    si, filename\r
+        mov    cx, 11\r
+        mov    di, bx\r
+        repe   cmpsb\r
+        je     found\r
+        add    bx, 32\r
+        dec    dx\r
+        jz     error\r
+        jmp    .filesearch\r
 \r
 \r
 ;-----------------------------------;\r
 ;      variables & functions        ;\r
 ;-----------------------------------;\r
-         loading         db  'Starting BOS'\r
-         filename        db  'KERNEL  SYS'\r
-         failure         db  'Read error!'\r
-\r
-\r
-     ;-----------------------------------------------;\r
-     ;   read a number of sectors (one at a time)    ;\r
-     ;-----------------------------------------------;\r
-     ;  in:                                          ;\r
-     ;    di = segment to save at                    ;\r
-     ;    ax = sector to read                        ;\r
-     ;    cx = number of sectors                     ;\r
-     ;  out:                                         ;\r
-     ;    di = updated (added for next read)         ;\r
-     ;    ax = updated (added for next read)         ;\r
-     ;-----------------------------------------------;\r
-     read_sectors:\r
-         pusha\r
-         mov     bl, byte [bpbTrackSect]             ; bl = number of sectors per track\r
-         div     bl                                  ; al = ax / bl\r
-         mov     cl, ah                              ; cl = real sector number\r
-         add     cl, 1\r
-\r
-         xor     ah, ah                              ; del the rest of the div before\r
-         mov     bl, byte [bpbHeads]                 ; bl = number of heads\r
-         div     bl                                  ; ah = rest of ( ax / bx ), al = ax / bx\r
-         mov     ch, al                              ; ch = number of track\r
-         mov     dh, ah                              ; dh = the head number\r
-\r
-         mov     ax, cx                              ; save cx in ax\r
-         mov     cx, 6                               ; try it 6 times\r
-     .next_try:\r
-         push    es\r
-         push    cx\r
-         mov     cx, ax                              ; restore cx\r
-         push    cx\r
-\r
-         xor     ax, ax\r
-         mov     dl, [bpbDriveNo]                    ; reset drive\r
-         push    dx\r
-         int     0x13\r
-         jc      .failed\r
-\r
-         pop     dx\r
-         pop     cx\r
-         xor     bx, bx\r
-         mov     es, di\r
-         mov     ax, 0x0201                          ; function 2, 1 sector\r
-         int     0x13\r
-         jnc     .ok                                 ; if it was ok, check next..\r
-\r
-     .failed:\r
-         pop     dx\r
-         pop     ax\r
-\r
-         pop     cx\r
-         pop     es\r
-         loop    .next_try                           ; else try once again if there is an error\r
-         jmp     error                               ; if cx = 0 and the read operation failed, halt\r
-     .ok:\r
-         pop     cx                                  ; from the next_try loop\r
-         pop     es\r
-         popa\r
-         add     di, 32                              ; add 32 (512/16) to segment\r
-         inc     ax                                  ; add sector counter\r
-         loop    read_sectors\r
-         ret\r
-\r
-\r
-     ;----------------------------------------------------;\r
-     ;  show a message and wait for a key before reboot   ;\r
-     ;----------------------------------------------------;\r
-     error:\r
-         mov     bp, failure\r
-         mov     ax, 0x1301\r
-         mov     bx, 4\r
-         mov     cx, 11\r
-         mov     dx, 0x0401\r
-         int     0x10\r
-\r
-         mov     ah, 0\r
-         int     0x16\r
-         int     0x19\r
+    loading    db  'Starting BOS'\r
+    filename   db  'KERNEL  SYS'\r
+    failure    db  'Read error!'\r
+\r
+\r
+;-----------------------------------------------;\r
+;   read a number of sectors (one at a time)    ;\r
+;-----------------------------------------------;\r
+;  in:                                          ;\r
+;    di = segment to save at                    ;\r
+;    ax = sector to read                        ;\r
+;    cx = number of sectors                     ;\r
+;  out:                                         ;\r
+;    di = updated (added for next read)         ;\r
+;    ax = updated (added for next read)         ;\r
+;-----------------------------------------------;\r
+read_sectors:\r
+        pusha\r
+        mov    bl, byte [bpbTrackSect]                ; bl = number of sectors per track\r
+        div    bl                                     ; al = ax / bl\r
+        mov    cl, ah                                 ; cl = real sector number\r
+        add    cl, 1\r
+\r
+        xor    ah, ah                                 ; del the rest of the div before\r
+        mov    bl, byte [bpbHeads]                    ; bl = number of heads\r
+        div    bl                                     ; ah = rest of ( ax / bx ), al = ax / bx\r
+        mov    ch, al                                 ; ch = number of track\r
+        mov    dh, ah                                 ; dh = the head number\r
+\r
+        mov    ax, cx                                 ; save cx in ax\r
+        mov    cx, 6                                  ; try it 6 times\r
+    .next_try:\r
+        push   es\r
+        push   cx\r
+        mov    cx, ax                                 ; restore cx\r
+        push   cx\r
+\r
+        xor    ax, ax\r
+        mov    dl, [bpbDriveNo]                       ; reset drive\r
+        push   dx\r
+        int    0x13\r
+        jc     .failed\r
+\r
+        pop    dx\r
+        pop    cx\r
+        xor    bx, bx\r
+        mov    es, di\r
+        mov    ax, 0x0201                             ; function 2, 1 sector\r
+        int    0x13\r
+        jnc    .ok                                    ; if it was ok, check next..\r
+\r
+    .failed:\r
+        pop    dx\r
+        pop    ax\r
+\r
+        pop    cx\r
+        pop    es\r
+        loop   .next_try                              ; else try once again if there is an error\r
+        jmp    error                                  ; if cx = 0 and the read operation failed, halt\r
+    .ok:\r
+        pop    cx                                     ; from the next_try loop\r
+        pop    es\r
+        popa\r
+        add    di, 32                                 ; add 32 (512/16) to segment\r
+        inc    ax                                     ; add sector counter\r
+        loop   read_sectors\r
+        ret\r
+\r
+\r
+;----------------------------------------------------;\r
+;  show a message and wait for a key before reboot   ;\r
+;----------------------------------------------------;\r
+error:\r
+        mov    bp, failure\r
+        mov    ax, 0x1301\r
+        mov    bx, 4\r
+        mov    cx, 11\r
+        mov    dx, 0x0401\r
+        int    0x10\r
+\r
+        mov    ah, 0\r
+        int    0x16\r
+        int    0x19\r
 \r
 \r
 ;-----------------------------------;\r
 ;   the file is found, load it.     ;\r
 ;-----------------------------------;\r
 found:\r
-         mov     bp, [bx+26]                         ; bp=cluster number from directory entry\r
-         mov     di, 0x800                           ; 1000 (segment)\r
-\r
-     .next_block:\r
-         xor     cx, cx\r
-         mov     cl, [bpbClustSize]                  ; reset sector count to 1 cluster\r
-         mov     si, bp                              ; si=next should-be cluster for\r
-                                                     ; contiguous reads\r
-     .next_contiguous:\r
-         mov     ax, 3                               ; 3\r
-         mul     si                                  ; multiply cluster number by 3\r
-         shr     ax, 1                               ; divide by two\r
-         mov     bx, ax\r
-         mov     ax, word [(0x2100+bx)]              ; ax=FAT element with junk\r
-         jc      .odd_cluster                        ; jump if the value was odd\r
-         and     ax, 0x0FFF                          ; leave only lower 12 bits\r
-         jmp     .got_cluster                        ; got it\r
-     .odd_cluster:\r
-         shr     ax, 4                               ; (leave only bits 4-15)\r
-\r
-     .got_cluster:\r
-         inc     si                                  ; si=current cluster+1\r
-         cmp     ax, si                              ; next cluster=current cluster+1?\r
-         jne     .force_read                         ; is it still contiguous?\r
-\r
-         add     cl, [bpbClustSize]                  ; increase sector count by 1 cluster\r
-         adc     ch, 0                               ; add cf+0 to ch\r
-         jmp     .next_contiguous\r
-\r
-     .force_read:\r
-         xchg    bp, ax                              ; ax=bp (base cluster), bp=new cluster\r
-         dec     ax                                  ; decrease by 2 to get the actual...\r
-         dec     ax                                  ; ...cluster number\r
-\r
-         movzx   dx, byte [bpbClustSize]\r
-         mul     dx                                  ; multiply by sectors per cluster\r
-         add     ax, 33                              ; add data-area location (33)\r
-         call    read_sectors\r
-\r
-         cmp     bp, 0x0FF8                          ; is the new cluster EOF (FF8-FFF)?\r
-         jb      .next_block                         ; if not, read next block\r
+        mov    bp, [bx+26]                            ; bp = cluster from dir entry\r
+        mov    di, 0x0800                             ; 800 (segment)\r
+\r
+    .next_block:\r
+        xor    cx, cx\r
+        mov    cl, [bpbClustSize]                     ; reset sector count to 1 cluster\r
+        mov    si, bp                                 ; si = next should-be cluster for\r
+                                                      ; contiguous reads\r
+    .next_contiguous:\r
+        mov    ax, 3\r
+        mul    si                                     ; multiply cluster number by 3\r
+        shr    ax, 1                                  ; divide by two\r
+        mov    bx, ax\r
+        mov    ax, word [(0x2100+bx)]                 ; ax = FAT element with junk\r
+        jc     .odd_cluster                           ; jump if the value was odd\r
+        and    ax, 0x0FFF                             ; leave only lower 12 bits\r
+        jmp    .got_cluster                           ; got it\r
+    .odd_cluster:\r
+        shr    ax, 4                                  ; (leave only bits 4-15)\r
+\r
+    .got_cluster:\r
+        inc    si                                     ; si = current cluster+1\r
+        cmp    ax, si                                 ; next cluster = current cluster+1?\r
+        jne    .force_read                            ; is it still contiguous?\r
+\r
+        add    cl, [bpbClustSize]                     ; increase sector count by 1 cluster\r
+        adc    ch, 0                                  ; add cf + 0 to ch\r
+        jmp    .next_contiguous\r
+\r
+    .force_read:\r
+        xchg   bp, ax                                 ; ax = bp (base cluster), bp = new cluster\r
+        dec    ax                                     ; decrease by 2 to get the actual...\r
+        dec    ax                                     ; ...cluster number\r
+\r
+        movzx  dx, byte [bpbClustSize]\r
+        mul    dx                                     ; multiply by sectors per cluster\r
+        add    ax, 33                                 ; add data-area location (33)\r
+        call   read_sectors\r
+\r
+        cmp    bp, 0x0FF8                             ; is the new cluster EOF (FF8-FFF)?\r
+        jb     .next_block                            ; if not, read next block\r
 \r
 ;-----------------------;\r
 ;  the file is loaded   ;\r
 ;-----------------------;\r
 quit:\r
-         jmp     0x0000:0x8000                       ; jump to loaded file (64kb in mem)\r
+        jmp    0x0000:0x8000               ; jump to loaded file (64kb in mem)\r
 \r
 \r
 ;-------------------------------------;\r
 ; set the BOOT-signature at byte 510. ;\r
 ;-------------------------------------;\r
-         rb boot+512-2-$\r
-         dw 0xAA55
\ No newline at end of file
+        rb boot+512-2-$\r
+        dw 0xAA55
\ No newline at end of file
index 43b144fb9b3d5c96925b689b5357acdd3cdc27e3..36453766a46001a4d726baf03bca267a35fb56ef 100755 (executable)
 ;  pointer to GDT   ;\r
 ;-------------------;\r
 gdtr:\r
-     .size          dw   gdt_end - gdt - 1\r
-     .address       dd   0x7400                      ; this is where we move\r
-                                                     ; the gdt\r
+    .size        dw   gdt_end - gdt - 1\r
+    .address     dd   0x7400                          ; here we move the gdt\r
+\r
 ;-----------------------------------;\r
 ;  Global Descriptor Table (GDT).   ;\r
 ;-----------------------------------;\r
 gdt:\r
-     .null          dw   0x0000,0x0000,0x0000,0x0000 ; null desc.\r
-     .BOS_code:      dw   0xFFFF,0x0000,0x9A00,0x00CF ; 0x08 , was 9800 before.\r
-     .BOS_data:      dw   0xFFFF,0x0000,0x9200,0x00CF ; 0x10\r
-     .BOS_16code:    dw   0xFFFF,0x0000,0x9A00,0x0000 ; 0x18\r
-     .BOS_16data:    dw   0xFFFF,0x0000,0x9200,0x0000 ; 0x20\r
-\r
+    .null        dw   0x0000, 0x0000, 0x0000, 0x0000  ; null desc.\r
+    .BOS_code:   dw   0xFFFF, 0x0000, 0x9A00, 0x00CF  ; 0x08 , was 9800 before.\r
+    .BOS_data:   dw   0xFFFF, 0x0000, 0x9200, 0x00CF  ; 0x10\r
+    .BOS_16code: dw   0xFFFF, 0x0000, 0x9A00, 0x0000  ; 0x18\r
+    .BOS_16data: dw   0xFFFF, 0x0000, 0x9200, 0x0000  ; 0x20\r
 gdt_end:
\ No newline at end of file
index 6335776f180c42dc0e0aa4bbfa845310fc02a643..b677ae5466ffcf805d77548e82b05d0e0eb7550b 100755 (executable)
@@ -12,5 +12,5 @@
 ;  IDT pointer    ;\r
 ;-----------------;\r
 idtr:\r
-     .size          dw   0x800\r
-     .address       dd   0x6C00\r
+    .size        dw   0x800\r
+    .address     dd   0x6C00
\ No newline at end of file
index 652cfb1c92346240df69ad2261f6bb38a7aff9ba..4815455af1b8a265ecd71388ffd901aaa79dc654 100755 (executable)
 ;    save info        ;\r
 ;---------------------;\r
 init16bit:\r
-        call   getmem                                                ; realmode/mem.inc\r
+        call   getmem                                 ; realmode/mem.inc\r
         mov    [ram_amount], eax\r
 \r
         xor    eax, eax                               ; clear mem for IDT and GDT\r
-        mov    edi, 0x6c00                            ; IDT address\r
-        mov    ecx, (0x800 + 0x800)/4\r
+        mov    edi, [idtr.address]                    ; IDT address\r
+        mov    ecx, ([idtr.size] + [idtr.size])/4\r
         rep    stosd\r
 \r
         mov    eax, cs\r
@@ -29,7 +29,7 @@ init16bit:
         mov    [gdt.BOS_16data + 7], ah\r
 \r
         lea    esi, [gdt]\r
-        mov    edi, 0x7400                            ; GDT address\r
+        mov    edi, [gdtr.address]                    ; GDT address\r
         mov    ecx, (gdt_end - gdt)/4\r
         rep    movsd                                  ; Move it to final pos.\r
 \r
index 2ab67075d02a70b971f3c66d9a178469d5417de0..0d739b0ddd981c014cf8728a024a8c5bd6aae430 100755 (executable)
@@ -9,21 +9,21 @@
 ;---------------------------------------;\r
 ;  needed to get back to 16-bit mode    ;\r
 ;---------------------------------------;\r
-     realmode_cs     dw   0\r
-     ridtr:         dw   0x3FF\r
-                    dd   0\r
+    realmode_cs     dw   0\r
+    ridtr:          dw   0x3FF\r
+                    dd   0\r
 \r
 ;----------------;\r
 ;  other stuff   ;\r
 ;----------------;\r
-     int_number      db   0\r
-     realmode_error  db   0\r
-     realmode_ax     dw   0\r
-     realmode_bx     dw   0\r
-     realmode_cx     dw   0\r
-     realmode_dx     dw   0\r
+    int_number      db   0\r
+    realmode_error  db   0\r
+    realmode_ax     dw   0\r
+    realmode_bx     dw   0\r
+    realmode_cx     dw   0\r
+    realmode_dx     dw   0\r
 \r
 ;-------------------;\r
 ;    saved info     ;\r
 ;-------------------;\r
-     ram_amount      dd   0
\ No newline at end of file
+    ram_amount      dd   0
\ No newline at end of file
index d90218d8990b7709c29850b3470682bfe8aa7ec7..81b4997ae62a850c91c88de5418b71e7e00edad2 100755 (executable)
@@ -2,15 +2,10 @@
 ; BOS kernel                Christoffer Bubach, 2004-2005. ;\r
 ;----------------------------------------------------------;\r
 ;                                                          ;\r
-;  floppy disk driver originally by Craig Bamford, Dex4u.  ;\r
-;          adjustments and for BOS by bubach.              ;\r
+;  floppy disk driver.                                     ;\r
 ;                                                          ;\r
 ;----------------------------------------------------------;\r
 \r
-;  NOTE: I'm almost finished with a much improved version of\r
-;        this code, that supports 2 drives of multiple types.\r
-;        I'll wait with that until next version, so you won't\r
-;        have to see a half finished mess here.\r
 \r
 ;---------------------------;\r
 ;  variables and contants   ;\r
index 73e1354510ae12e80ca9c1ef0baddb1e77338e91..01bb35805d8c7cf9c3d92582db931888f21e732b 100755 (executable)
 \r
 bos_init:\r
 \r
-     ;----------------------;\r
-     ;  we are in pmode..   ;\r
-     ;----------------------;\r
-         mov     bx, 0x0193\r
-         call    setcursor\r
-         mov     esi, pmode_load\r
-         mov     bl, 0x07\r
-         call    print\r
-\r
-         mov     bx, 0x01C5\r
-         call    setcursor\r
-         mov     esi, pmode_load_ok\r
-         mov     bl, 0x02\r
-         call    print\r
-\r
-     ;----------------------;\r
-     ;   kernel loaded..    ;\r
-     ;----------------------;\r
-         mov     bx, 0x01E3\r
-         call    setcursor\r
-         mov     esi, kernel_load\r
-         mov     bl, 0x07\r
-         call    print\r
-\r
-         mov     bx, 0x0215\r
-         call    setcursor\r
-         mov     esi, kernel_load_ok\r
-         mov     bl, 0x02\r
-         call    print\r
-\r
-     ;----------------;\r
-     ;  remap PICs    ;\r
-     ;----------------;\r
-         mov     cl, 0x20                            ; PIC 1, irq0-irq7 -> int 0x20-27.\r
-         mov     ch, 0x28                            ; PIC 2, irq8-irq15 -> int 0x28-30.\r
-         call    remap_pics\r
-         call    disable_irqs\r
-\r
-         mov     bx, 0x0233\r
-         call    setcursor\r
-         mov     esi, pic_irq\r
-         mov     bl, 0x07\r
-         call    print\r
-\r
-         mov     bx, 0x0265\r
-         call    setcursor\r
-         mov     esi, pic_irq_ok\r
-         mov     bl, 0x02\r
-         call    print\r
-\r
-     ;--------------;\r
-     ;  setup IDT   ;\r
-     ;--------------;\r
-         mov     edi, u_isr                          ; isr.inc\r
-         call    init_idt                            ; idt.inc\r
-         mov     esi, idt_list                       ; idt.inc\r
-         call    set_idt_list                        ; idt.inc\r
-\r
-         sti                                         ; Interrupts back..\r
-\r
-         mov     bx, 0x0283\r
-         call    setcursor\r
-         mov     esi, idt_mess\r
-         mov     bl, 0x07\r
-         call    print\r
-\r
-         mov     bx, 0x02B5\r
-         call    setcursor\r
-         mov     esi, idt_ok\r
-         mov     bl, 0x02\r
-         call    print\r
-\r
-\r
-     ;---------------------------------------------;\r
-     ;  enable IRQs (one after one as i code it)   ;\r
-     ;---------------------------------------------;\r
-         mov     cl, 1\r
-         call    enable_irq                          ; Enable IRQ 1.\r
-\r
-         mov     bx, 0x02D3\r
-         call    setcursor\r
-         mov     esi, kbd_load\r
-         mov     bl, 0x07\r
-         call    print\r
-\r
-         mov     bx, 0x0305\r
-         call    setcursor\r
-         mov     esi, kbd_ok\r
-         mov     bl, 0x02\r
-         call    print\r
-\r
-     ;------------------------------------;\r
-     ;  get CMOS data, set PIT to 100Hz   ;\r
-     ;                 and start timer.   ;\r
-     ;------------------------------------;\r
-         call    get_cmos_data                       ; cmos.inc\r
-         call    set_pit_freq                        ; timer.inc\r
-         mov     cl, 0\r
-         call    enable_irq                          ; Enable IRQ 0.\r
-\r
-     ;-------------------;\r
-     ;  init simple MM   ;\r
-     ;-------------------;\r
-         mov     ebx, 0x100000                       ; address of first free\r
-         mov     ecx, [ram_amount]                   ; RAM. everything before\r
-         call    init_mem                            ; that is reserved.\r
-\r
-     ;--------------------;\r
-     ;  init fdc driver   ;\r
-     ;--------------------;\r
-         call    fdc_init                            ; fdc.inc\r
-\r
-\r
-     ;-------------------------;\r
-     ;  return to kernel.asm   ;\r
-     ;-------------------------;\r
-         ret
\ No newline at end of file
+    ;----------------------;\r
+    ;  we are in pmode..   ;\r
+    ;----------------------;\r
+        mov    bx, 0x0193\r
+        call   setcursor\r
+        mov    esi, pmode_load\r
+        mov    bl, 0x07\r
+        call   print\r
+\r
+        mov    bx, 0x01C5\r
+        call   setcursor\r
+        mov    esi, pmode_load_ok\r
+        mov    bl, 0x02\r
+        call   print\r
+\r
+    ;----------------------;\r
+    ;   kernel loaded..    ;\r
+    ;----------------------;\r
+        mov    bx, 0x01E3\r
+        call   setcursor\r
+        mov    esi, kernel_load\r
+        mov    bl, 0x07\r
+        call   print\r
+\r
+        mov    bx, 0x0215\r
+        call   setcursor\r
+        mov    esi, kernel_load_ok\r
+        mov    bl, 0x02\r
+        call   print\r
+\r
+    ;----------------;\r
+    ;  remap PICs    ;\r
+    ;----------------;\r
+        mov    cl, 0x20                               ; PIC 1, irq0-irq7 -> int 0x20-27.\r
+        mov    ch, 0x28                               ; PIC 2, irq8-irq15 -> int 0x28-30.\r
+        call   remap_pics\r
+        call   disable_irqs\r
+\r
+        mov    bx, 0x0233\r
+        call   setcursor\r
+        mov    esi, pic_irq\r
+        mov    bl, 0x07\r
+        call   print\r
+\r
+        mov    bx, 0x0265\r
+        call   setcursor\r
+        mov    esi, pic_irq_ok\r
+        mov    bl, 0x02\r
+        call   print\r
+\r
+    ;--------------;\r
+    ;  setup IDT   ;\r
+    ;--------------;\r
+        mov    edi, u_isr                             ; isr.inc\r
+        call   init_idt                               ; idt.inc\r
+        mov    esi, idt_list                          ; idt.inc\r
+        call   set_idt_list                           ; idt.inc\r
+\r
+        sti                                           ; Interrupts back.\r
+\r
+        mov    bx, 0x0283\r
+        call   setcursor\r
+        mov    esi, idt_mess\r
+        mov    bl, 0x07\r
+        call   print\r
+\r
+        mov    bx, 0x02B5\r
+        call   setcursor\r
+        mov    esi, idt_ok\r
+        mov    bl, 0x02\r
+        call   print\r
+\r
+\r
+    ;---------------------------------------------;\r
+    ;  enable IRQs (one after one as i code it)   ;\r
+    ;---------------------------------------------;\r
+        mov    cl, 1\r
+        call   enable_irq                             ; Enable IRQ 1.\r
+\r
+        mov    bx, 0x02D3\r
+        call   setcursor\r
+        mov    esi, kbd_load\r
+        mov    bl, 0x07\r
+        call   print\r
+\r
+        mov    bx, 0x0305\r
+        call   setcursor\r
+        mov    esi, kbd_ok\r
+        mov    bl, 0x02\r
+        call   print\r
+\r
+    ;------------------------------------;\r
+    ;  get CMOS data, set PIT to 100Hz   ;\r
+    ;                 and start timer.   ;\r
+    ;------------------------------------;\r
+        call   get_cmos_data                          ; cmos.inc\r
+        call   set_pit_freq                           ; timer.inc\r
+        mov    cl, 0\r
+        call   enable_irq                             ; Enable IRQ 0.\r
+\r
+    ;-------------------;\r
+    ;  init simple MM   ;\r
+    ;-------------------;\r
+        mov    ebx, 0x100000                          ; address of first free\r
+        mov    ecx, [ram_amount]                      ; RAM. everything before\r
+        call   init_mem                               ; that is reserved.\r
+\r
+    ;--------------------;\r
+    ;  init fdc driver   ;\r
+    ;--------------------;\r
+        call   fdc_init                               ; fdc.inc\r
+\r
+\r
+    ;-------------------------;\r
+    ;  return to kernel.asm   ;\r
+    ;-------------------------;\r
+        ret
\ No newline at end of file