]> wirehaze git hosting - BOS.git/commitdiff

wirehaze git hosting

made it assemble under os x, moved loading position of kernel + install script for osx
authorChristoffer Bubach <christoffer@ridestore.com>
Fri, 9 Jan 2015 03:53:14 +0000 (04:53 +0100)
committerChristoffer Bubach <christoffer@ridestore.com>
Fri, 9 Jan 2015 03:53:14 +0000 (04:53 +0100)
boot/BOS_boot.asm
boot/BOS_boot.bin
doc/bochsrc-osx.txt [new file with mode: 0644]
kernel/kernel.asm [changed mode: 0755->0644]
kernel/kernel.sys
kernel/krl_incs/idt.inc [changed mode: 0755->0644]
kernel/krl_incs/rmode_int.inc
kernel/realmode/a20.inc [changed mode: 0755->0644]
kernel/realmode/do_all_16bit.inc
mac-install.sh [new file with mode: 0755]
utils/osxfasm [new file with mode: 0755]

index c77b7e377b7f3a6bd2e15d2a93cf8ba91553a492..a7a5c1259eafdc5a1ef0287f1d25926fe71e2ff7 100755 (executable)
 ;  0x0000:0x6c00 -> 0x0000:0x7400  IDT, 256 descriptors\r
 ;  0x0000:0x7400 -> 0x0000:0x7c00  GDT, 256 descriptors\r
 ;  0x0000:0x7c00 -> 0x0000:0x7e00  bootsector\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:0xffff  ~32,5kb stack for boot\r
-;  0x1000:0x0000 -> 0x9000:0xffff  576kb kernel/free space\r
-;  0xa000:0x0000 -> .............  VGA mem etc.\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
 \r
 use16\r
 org 0x7C00\r
 \r
-boot:    jmp     near start\r
+boot:\r
+         jmp     short start\r
          nop\r
 \r
 ;------------------------------------------;\r
 ;  Standard BIOS Parameter Block, "BPB".   ;\r
 ;------------------------------------------;\r
          nop\r
 \r
 ;------------------------------------------;\r
 ;  Standard BIOS Parameter Block, "BPB".   ;\r
 ;------------------------------------------;\r
-         bpbOEM          db  'BOS 0.04'\r
+      bpbOEM          db  'BOS 0.04'\r
          bpbSectSize     dw  512\r
          bpbClustSize    db  1\r
          bpbReservedSec  dw  1\r
          bpbSectSize     dw  512\r
          bpbClustSize    db  1\r
          bpbReservedSec  dw  1\r
-         bpbFats         db  2\r
+         bpbFats             db  2\r
          bpbRootSize     dw  224\r
          bpbTotalSect    dw  2880\r
          bpbRootSize     dw  224\r
          bpbTotalSect    dw  2880\r
-         bpbMedia        db  240\r
+         bpbMedia            db  240\r
          bpbFatSize      dw  9\r
          bpbTrackSect    dw  18\r
          bpbFatSize      dw  9\r
          bpbTrackSect    dw  18\r
-         bpbHeads        dw  2\r
+         bpbHeads            dw  2\r
          bpbHiddenSect   dd  0\r
          bpbLargeSect    dd  0\r
      ;---------------------------------;\r
          bpbHiddenSect   dd  0\r
          bpbLargeSect    dd  0\r
      ;---------------------------------;\r
@@ -56,7 +59,7 @@ boot:   jmp     near start
          bpbDriveNo      db  0\r
          bpbReserved     db  0\r
          bpbSignature    db  41                      ; 0 = nothing more. 41 = three more (below)..\r
          bpbDriveNo      db  0\r
          bpbReserved     db  0\r
          bpbSignature    db  41                      ; 0 = nothing more. 41 = three more (below)..\r
-         bpbID           dd  1\r
+         bpbID               dd  1\r
          bpbVolumeLabel  db  'BOOT FLOPPY'\r
          bpbFileSystem   db  'FAT12   '\r
 \r
          bpbVolumeLabel  db  'BOOT FLOPPY'\r
          bpbFileSystem   db  'FAT12   '\r
 \r
@@ -71,7 +74,7 @@ start:
          mov     ds, ax                              ; registers.\r
          mov     es, ax\r
          mov     ss, ax\r
          mov     ds, ax                              ; registers.\r
          mov     es, ax\r
          mov     ss, ax\r
-         mov     sp, 0xFFFF                          ; Stack..\r
+         mov     sp, 0x8000                          ; Stack..\r
 \r
          mov     [bpbDriveNo], dl\r
 \r
 \r
          mov     [bpbDriveNo], dl\r
 \r
@@ -227,7 +230,7 @@ start:
 ;-----------------------------------;\r
 found:\r
          mov     bp, [bx+26]                         ; bp=cluster number from directory entry\r
 ;-----------------------------------;\r
 found:\r
          mov     bp, [bx+26]                         ; bp=cluster number from directory entry\r
-         mov     di, 0x1000                          ; 1000 (segment)\r
+         mov     di, 0x800                           ; 1000 (segment)\r
 \r
      .next_block:\r
          xor     cx, cx\r
 \r
      .next_block:\r
          xor     cx, cx\r
@@ -272,7 +275,7 @@ found:
 ;  the file is loaded   ;\r
 ;-----------------------;\r
 quit:\r
 ;  the file is loaded   ;\r
 ;-----------------------;\r
 quit:\r
-         jmp     0x1000:0x0000                       ; jump to loaded file (64kb in mem)\r
+         jmp     0x0000:0x8000                       ; jump to loaded file (64kb in mem)\r
 \r
 \r
 ;-------------------------------------;\r
 \r
 \r
 ;-------------------------------------;\r
index b196cc4773e0d8db1d115c2bde722045644ac8b5..48d8b8321418eceb814bd9883c6ff45b792680cc 100755 (executable)
Binary files a/boot/BOS_boot.bin and b/boot/BOS_boot.bin differ
diff --git a/doc/bochsrc-osx.txt b/doc/bochsrc-osx.txt
new file mode 100644 (file)
index 0000000..9fbb925
--- /dev/null
@@ -0,0 +1,24 @@
+#######################################
+#                                     #
+#      BOCHS config file for BOS      #
+#                                     #
+#######################################
+
+#display_library: term
+romimage: file=/usr/local/Cellar/bochs/2.6.2/share/bochs/BIOS-bochs-latest
+megs: 32
+vgaromimage: file=/usr/local/Cellar/bochs/2.6.2/share/bochs/VGABIOS-elpin-2.40
+floppya: 1_44=/Volumes/BOS, status=inserted
+boot: a
+floppy_bootsig_check: disabled=0
+log: bochsout.txt
+panic: action=ask
+error: action=report
+info: action=report
+debug: action=ignore
+debugger_log: debugger.out
+keyboard_serial_delay: 250
+keyboard_paste_delay: 100000
+mouse: enabled=0
+keyboard_mapping: enabled=0, map=
+user_shortcut: keys=ctrlaltdel
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 40c2225..df6d48f
@@ -1,24 +1,24 @@
 ;-------------------------------------------------------;\r
 ;-------------------------------------------------------;\r
-;                     BOS kernel                        ;\r
+;                    BOS kernel                        ;\r
 ;-------------------------------------------------------;\r
 ;-------------------------------------------------------;\r
-;    BOS 32-bit kernel, expects to be loaded at 64kb    ;\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
+;    BOS 32-bit kernel, expects to be loaded at 64kb   ;\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
 ;-------------------------------------------------------;\r
 use16\r
 ;-------------------------------------------------------;\r
 use16\r
-org 0x10000\r
+org 0x8000\r
 \r
 ;---------------------------;\r
 ;  jump to starting point   ;\r
 ;---------------------------;\r
 \r
 ;---------------------------;\r
 ;  jump to starting point   ;\r
 ;---------------------------;\r
-         jmp     start\r
+         jmp     start\r
 \r
 ;----------------------------------------;\r
 \r
 ;----------------------------------------;\r
-;     16-bit include files               ;\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
 ;----------------------------------------;\r
          include  'realmode/a20.inc'                 ; Function to set the a20-gate.\r
          include  'realmode/gdt.inc'                 ; Global Description Table.\r
@@ -30,7 +30,7 @@ org 0x10000
 \r
 \r
 ;--------------------------;\r
 \r
 \r
 ;--------------------------;\r
-;   16-bit entry point     ;\r
+;   16-bit entry point    ;\r
 ;--------------------------;\r
 start:\r
          cli\r
 ;--------------------------;\r
 start:\r
          cli\r
@@ -48,10 +48,10 @@ start:
 \r
          cli\r
          mov     ax, cs                              ; save cs\r
 \r
          cli\r
          mov     ax, cs                              ; save cs\r
-         mov     [realmode_cs - 0x10000], ax         ; in variables.inc\r
+         mov     [realmode_cs], ax           ; in variables.inc\r
 \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
 \r
          mov     eax, cr0\r
          or      al, 1\r
@@ -62,7 +62,7 @@ start:
 \r
 \r
 ;--------------------------;\r
 \r
 \r
 ;--------------------------;\r
-;   32-bit entry point     ;\r
+;   32-bit entry point    ;\r
 ;--------------------------;\r
 use32\r
 flush:\r
 ;--------------------------;\r
 use32\r
 flush:\r
@@ -84,7 +84,7 @@ flush:
          call    init_cmd\r
          jmp     shell\r
 \r
          call    init_cmd\r
          jmp     shell\r
 \r
-         ;int     0x32\r
+         ;int     0x32\r
 \r
      .hang:\r
          cli\r
 \r
      .hang:\r
          cli\r
@@ -93,7 +93,7 @@ flush:
 \r
 \r
 ;----------------------------------------;\r
 \r
 \r
 ;----------------------------------------;\r
-;     32-bit include files               ;\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
 ;----------------------------------------;\r
          include  'krl_incs/idt.inc'                 ; The Interrupt Description Table.\r
          include  'krl_incs/text.inc'                ; The default textmode functions.\r
@@ -112,7 +112,7 @@ flush:
          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/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/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/dma.inc'                 ; DMA code.\r
          include  'krl_incs/fdc.inc'                 ; Floppy code.\r
          include  'krl_incs/mario.inc'               ; Mario sprite.\r
index d553f80a31cce04d9cdae7f45d0cb53b4593eee2..b0c3de35bb1a90adc0c18747e4b961b8fe69ca0d 100755 (executable)
Binary files a/kernel/kernel.sys and b/kernel/kernel.sys differ
old mode 100755 (executable)
new mode 100644 (file)
index a899cbc..cafbc63
@@ -1,15 +1,15 @@
 ;----------------------------------------------------------;\r
 ;----------------------------------------------------------;\r
-; BOS kernel                Christoffer Bubach, 2003-2005. ;\r
+; BOS kernel               Christoffer Bubach, 2003-2005. ;\r
 ;----------------------------------------------------------;\r
 ;----------------------------------------------------------;\r
-;                                                          ;\r
-;       set/modify IDT entries                             ;\r
-;                                                          ;\r
+;                                                         ;\r
+;      set/modify IDT entries                             ;\r
+;                                                         ;\r
 ;----------------------------------------------------------;\r
 \r
 \r
 \r
 ;--------------------------------------------------;\r
 ;----------------------------------------------------------;\r
 \r
 \r
 \r
 ;--------------------------------------------------;\r
-;     set up IDT                                   ;\r
+;     set up IDT                                  ;\r
 ; in:  edi = pointer to "unhandled int"-function.  ;\r
 ;--------------------------------------------------;\r
 init_idt:\r
 ; in:  edi = pointer to "unhandled int"-function.  ;\r
 ;--------------------------------------------------;\r
 init_idt:\r
@@ -40,9 +40,9 @@ init_idt:
 \r
 \r
 ;--------------------------------------;\r
 \r
 \r
 ;--------------------------------------;\r
-;  modify IDT, set any int             ;\r
-;     in: cl  = int number             ;\r
-;         edi = int function pointer   ;\r
+;  modify IDT, set any int            ;\r
+;     in: cl  = int number            ;\r
+;        edi = int function pointer   ;\r
 ;--------------------------------------;\r
 set_int:\r
          push    eax\r
 ;--------------------------------------;\r
 set_int:\r
          push    eax\r
@@ -51,7 +51,8 @@ set_int:
          mov     al, 8                               ; 8 bytes for each int\r
          mul     cl                                  ; cl * al = ax\r
          movzx   ecx, ax                             ; ecx = offset in IDT (1/2 for dword list)\r
          mov     al, 8                               ; 8 bytes for each int\r
          mul     cl                                  ; cl * al = ax\r
          movzx   ecx, ax                             ; ecx = offset in IDT (1/2 for dword list)\r
-         mov     [(idt_list+ecx/2)], edi             ; add new int to idt entry list\r
+         ;;mov   [(idt_list+ecx/2)], edi             ; add new int to idt entry list\r
+         mov     dword [(idt_list+ecx)], edi         ; add new int to idt entry list\r
 \r
          mov     eax, edi\r
          mov     [(0x6c00+ecx)], ax\r
 \r
          mov     eax, edi\r
          mov     [(0x6c00+ecx)], ax\r
@@ -71,9 +72,9 @@ set_int:
 \r
 \r
 ;------------------------------------------------;\r
 \r
 \r
 ;------------------------------------------------;\r
-;   get int address                              ;\r
-;      in:  cl  = int number                     ;\r
-;      out: esi = address or 0 if none present   ;\r
+;   get int address                             ;\r
+;      in:  cl = int number                     ;\r
+;      out: esi = address or 0 if none present  ;\r
 ;------------------------------------------------;\r
 get_int:\r
          push    eax\r
 ;------------------------------------------------;\r
 get_int:\r
          push    eax\r
@@ -90,8 +91,8 @@ get_int:
 \r
 \r
 ;----------------------------------------;\r
 \r
 \r
 ;----------------------------------------;\r
-;   sets ints from list                  ;\r
-;      in:  esi = pointer to int list    ;\r
+;   sets ints from list                 ;\r
+;      in:  esi = pointer to int list   ;\r
 ;----------------------------------------;\r
 set_idt_list:\r
          push    eax\r
 ;----------------------------------------;\r
 set_idt_list:\r
          push    eax\r
@@ -117,7 +118,7 @@ set_idt_list:
 \r
 ;------------------------------;\r
 ;   list of idt entries.       ;\r
 \r
 ;------------------------------;\r
 ;   list of idt entries.       ;\r
-;           0 = not handled    ;\r
+;          0 = not handled    ;\r
 ;------------------------------;\r
 idt_list:           dd   isr00\r
                     dd   isr01\r
 ;------------------------------;\r
 idt_list:           dd   isr00\r
                     dd   isr01\r
index bd2dbe23aba651cdca2058ab1d2b2d59dd46aa0b..ed5716d9a04144a6699f04384afb9d315fee5019 100755 (executable)
@@ -24,7 +24,7 @@ rmode_int:
          mov     word [realmode_cx], cx\r
          mov     word [realmode_dx], dx\r
          call    disable_irqs\r
          mov     word [realmode_cx], cx\r
          mov     word [realmode_dx], dx\r
          call    disable_irqs\r
-         jmp     pword 0x18:do_16pmode-0x10000       ; must substract 0x10000 from\r
+         jmp     pword 0x18:do_16pmode       ; must substract 0x10000 from\r
                                                      ; data addresses becasue of\r
                                                      ; fasm strict "org" behavior\r
 use16\r
                                                      ; data addresses becasue of\r
                                                      ; fasm strict "org" behavior\r
 use16\r
@@ -41,7 +41,7 @@ do_16pmode:
          and     al, 0xFE\r
          mov     cr0, eax\r
 \r
          and     al, 0xFE\r
          mov     cr0, eax\r
 \r
-         jmp     0x1000:(do_realm-0x10000)\r
+         jmp     0x1000:(do_realm)\r
 \r
 do_realm:\r
          mov     ax, cs\r
 \r
 do_realm:\r
          mov     ax, cs\r
@@ -53,34 +53,34 @@ do_realm:
          mov     gs, ax\r
          mov     ss, ax\r
 \r
          mov     gs, ax\r
          mov     ss, ax\r
 \r
-         lidt    [ridtr - 0x10000]                   ; realmode/variables.inc\r
+         lidt    [ridtr]                     ; realmode/variables.inc\r
          sti\r
 \r
          sti\r
 \r
-         mov     ax, word [realmode_ax - 0x10000]\r
-         mov     bx, word [realmode_bx - 0x10000]\r
-         mov     cx, word [realmode_cx - 0x10000]\r
-         mov     dx, word [realmode_dx - 0x10000]\r
+         mov     ax, word [realmode_ax]\r
+         mov     bx, word [realmode_bx]\r
+         mov     cx, word [realmode_cx]\r
+         mov     dx, word [realmode_dx]\r
 \r
          push    ax                                  ; this is some cool shit.. ;)\r
 \r
          push    ax                                  ; this is some cool shit.. ;)\r
-         mov     al, [int_number - 0x10000]          ; interrupt to preform\r
-         mov     [$+5 - 0x10000], al                 ; move it to right pos.\r
+         mov     al, [int_number]            ; interrupt to preform\r
+         mov     [$+5], al                   ; move it to right pos.\r
          pop     ax\r
          db      0xCD                                ; opcode for int.\r
          db      0x00                                ; move int_number here\r
 \r
          jnc     .no_error\r
          pop     ax\r
          db      0xCD                                ; opcode for int.\r
          db      0x00                                ; move int_number here\r
 \r
          jnc     .no_error\r
-         mov     byte [realmode_error - 0x10000], 1\r
+         mov     byte [realmode_error], 1\r
 \r
      .no_error:\r
 \r
      .no_error:\r
-         mov     word [realmode_ax - 0x10000], ax\r
-         mov     word [realmode_bx - 0x10000], bx\r
-         mov     word [realmode_cx - 0x10000], cx\r
-         mov     word [realmode_dx - 0x10000], dx\r
+         mov     word [realmode_ax], ax\r
+         mov     word [realmode_bx], bx\r
+         mov     word [realmode_cx], cx\r
+         mov     word [realmode_dx], dx\r
 \r
          cli\r
 \r
 \r
          cli\r
 \r
-         lgdt    [gdtr - 0x10000]\r
-         lidt    [idtr - 0x10000]\r
+         lgdt    [gdtr]\r
+         lidt    [idtr]\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
old mode 100755 (executable)
new mode 100644 (file)
index f0ab1c8..f9a561c
@@ -1,9 +1,9 @@
 ;----------------------------------------------------------;\r
 ;----------------------------------------------------------;\r
-; BOS 0.04                       Christoffer Bubach, 2005. ;\r
+; BOS 0.04                      Christoffer Bubach, 2005. ;\r
 ;----------------------------------------------------------;\r
 ;----------------------------------------------------------;\r
-;                                                          ;\r
-;      Realmode functions to set a20-gate.                 ;\r
-;                                                          ;\r
+;                                                         ;\r
+;      Realmode functions to set a20-gate.                ;\r
+;                                                         ;\r
 ;----------------------------------------------------------;\r
 \r
 ;----------------------;\r
 ;----------------------------------------------------------;\r
 \r
 ;----------------------;\r
@@ -39,7 +39,7 @@ enable_a20:
          ret\r
 \r
 ;------------------------;\r
          ret\r
 \r
 ;------------------------;\r
-;  test if A20 is set    ;\r
+;  test if A20 is set   ;\r
 ;------------------------;\r
 a20_test:\r
          mov     al, byte [fs:0]\r
 ;------------------------;\r
 a20_test:\r
          mov     al, byte [fs:0]\r
index f0fb4c3cd57fcd926d97b44c1ec585693d230a8c..86f779912f6065b7dee817d55ac0a0ae0cddfef1 100755 (executable)
@@ -11,7 +11,7 @@
 ;---------------------;\r
 do_all_16bit:\r
          call    getmem                              ; realmode/mem.inc\r
 ;---------------------;\r
 do_all_16bit:\r
          call    getmem                              ; realmode/mem.inc\r
-         mov     [ram_amount - 0x10000], eax\r
+         mov     [ram_amount], eax\r
 \r
          xor     eax, eax                            ; clear mem for IDT and GDT\r
          mov     edi, 0x6c00                         ; IDT address\r
 \r
          xor     eax, eax                            ; clear mem for IDT and GDT\r
          mov     edi, 0x6c00                         ; IDT address\r
@@ -20,15 +20,15 @@ do_all_16bit:
 \r
          mov     eax, cs\r
          shl     eax, 4\r
 \r
          mov     eax, cs\r
          shl     eax, 4\r
-         mov     [gdt.BOS_16code - 0x10000 + 2], ax  ; Prepare GDT by\r
-         mov     [gdt.BOS_16data - 0x10000 + 2], ax  ; setting 16-bit base.\r
+         mov     [gdt.BOS_16code + 2], ax  ; Prepare GDT by\r
+         mov     [gdt.BOS_16data + 2], ax  ; setting 16-bit base.\r
          shr     eax, 16\r
          shr     eax, 16\r
-         mov     [gdt.BOS_16code - 0x10000 + 4], al\r
-         mov     [gdt.BOS_16data - 0x10000 + 4], al\r
-         mov     [gdt.BOS_16code - 0x10000 + 7], ah\r
-         mov     [gdt.BOS_16data - 0x10000 + 7], ah\r
+         mov     [gdt.BOS_16code + 4], al\r
+         mov     [gdt.BOS_16data + 4], al\r
+         mov     [gdt.BOS_16code + 7], ah\r
+         mov     [gdt.BOS_16data + 7], ah\r
 \r
 \r
-         lea     esi, [gdt - 0x10000]\r
+         lea     esi, [gdt]\r
          mov     edi, 0x7400                         ; GDT address\r
          mov     ecx, (gdt_end - gdt)/4\r
          rep     movsd                               ; Move it to final pos.\r
          mov     edi, 0x7400                         ; GDT address\r
          mov     ecx, (gdt_end - gdt)/4\r
          rep     movsd                               ; Move it to final pos.\r
diff --git a/mac-install.sh b/mac-install.sh
new file mode 100755 (executable)
index 0000000..18b1cc6
--- /dev/null
@@ -0,0 +1,70 @@
+#! /bin/sh
+
+# BOS MacOS X Installer version 0.2
+# You must be root to run this script because of the floppy/loopback device
+
+echo
+echo " BOS - MacOS X installer"
+echo "-------------------------"
+echo "Requires: Homebrew mtools"
+echo
+
+if [ `id -u` != "0" ]; then
+    echo "You must be root to use this installer!"
+    echo
+fi
+
+if [ -z "$1" ]; then
+    echo "Usage is:"
+    echo "$0 image  - Creates a floppy image called bos.img"
+    echo "$0 floppy - Install BOS into a floppy ( must be inserted )"
+    echo
+    echo "Note: this installer will create a bootable image/floppy."
+    echo "Floppy creation is not tested ( I don't have a floppy reader ) and it should be already formatted"
+    exit
+fi
+
+echo "Compiling BOS..."
+./utils/osxfasm kernel/kernel.asm kernel/kernel.sys
+./utils/osxfasm boot/BOS_boot.asm boot/BOS_boot.bin
+
+if [ "$1" = "floppy" ]; then
+    echo "Starting floppy installation..."
+
+    #Install BOS_boot.bin as bootsector into bos.img
+    dd if=boot/BOS_boot.bin of=/dev/fd0 bs=1 count=512
+    mount /mnt/floppy
+
+    #Insert kernel.sys into image
+    cp kernel/kernel.sys /mnt/floppy
+
+    #Umount & cleanup
+    umount /mnt/floppy
+
+    echo "BOS installed."
+
+else
+    echo "Starting image creation..."
+
+    #Create image
+    rm -rf ./bos.img
+    mformat -C -f 1440 -v BOS -i bos.img ::
+
+    #Erhm, it isn't pretty....
+    DISKNAME=`hdiutil attach -nomount bos.img`
+    diskutil mount $DISKNAME
+    MOUNTNAME=`diskutil info $DISKNAME | grep 'Mount Point' | cut -d : -f 2 | sed 's/^ *//g' | sed 's/ *$//g';`
+
+    #Mounted, copy kernel.sys
+    cp kernel/kernel.sys $MOUNTNAME
+
+    #Install BOS_boot.bin as bootsector into bos.img
+    umount $DISKNAME
+    dd if=boot/BOS_boot.bin of=$DISKNAME bs=1 count=512
+
+    #Detach
+    hdiutil detach $DISKNAME
+    chmod 0777 bos.img
+
+    echo "BOS image created!"
+fi
\ No newline at end of file
diff --git a/utils/osxfasm b/utils/osxfasm
new file mode 100755 (executable)
index 0000000..408cf0e
Binary files /dev/null and b/utils/osxfasm differ