<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,58 +1,60 @@
 #===============================================================================
 # 32-bit boot-agnostic kernel startup code / interrupt handlers
 #===============================================================================
-# 'ld -T cleese.ld' to generate a grub-bootable executable, then
-# 'objcopy -O binary' that executable to get a bootp-bootable file.
-#===============================================================================
+
 
 #-------------------------------------------------------------------------------
 # 'entry' should be the entry point for a grub kernel, and
 # placed at the start of the text section for a bootp kernel
 #-------------------------------------------------------------------------------
 
+
 def entry():
     &quot;&quot;&quot; takes control from the bootloader &quot;&quot;&quot;
-    db(0x0f,0x01,0x15)      # use our descriptor table (lgdt [gdt])
+    
+    db(0x0f,0x01,0x15)                 # use our descriptor table (lgdt [gdt])
     dd(gdt)
-
-    ax = 0x18       # load ds
+    
+    ax = 0x18                          # load ds
     ds = ax; es = ax; ss = ax
     xor(ax,ax)
     fs = ax; gs = ax
-
-    db(0xea)
+    
+    db(0xea)                           # load cs (jmp 10h:startC)
     dd(startC); dw(0x10)
 
+
 def startC():
     &quot;&quot;&quot; builds C environment and calls main() &quot;&quot;&quot;
-
+    
     # set320x200x256
-
+    
     # esi = bootscreen
     # edi = 0xA0000
     # ecx = 0x0FA00
     # rep; movsb
-
-    edi = bss               # zero out BSS
+    
+    edi = bss                          # zero out BSS
     ecx = end
     ecx -= edi
-    ecx &gt;&gt;= 2               # (assume sections are word aligned)
+    ecx &gt;&gt;= 2                          # (assume sections are word aligned)
     eax = 0
     rep; stosl
-
-    esp = resb(0x1000)      # set up a stack
-    esp +=     0x0ffc
-
+    
+    esp = resb(0x1000)                 # set up a stack
+    esp += 0x0ffc
+    
     #----------------------------------------------
     # TEMPORARY: busy wait to pause for boot screen 
     # ecx = 0x80000000
     # while dec(ecx) is nz: pass
     #----------------------------------------------
-
+    
     set80x25
+    
+    main(ebx)                          # and call C code
+    dw(0xfeeb)                         # infinite loop (jmp $-2)
 
-    main(ebx)               # and call C code
-    dw(0xfeeb)              # infinite loop (jmp $-2)
 
 #-------------------------------------------------------------------------------
 # Multiboot header for GRUB bootloader. This must be in the first 8K
@@ -60,97 +62,124 @@ def startC():
 #-------------------------------------------------------------------------------
 
     align(4)
-    dd(0x1BADB002,          # magic
-           0x00010003,          # AOUT_KLUDGE(16)|MEMORY_INFO(1)|PAGE_ALIGN(0)
-           0xe4514ffb,          # checksum: -(magic + flags)
-           entry, bss, end,
-           entry)
+    dd( 0x1BADB002,          # magic
+        0x00010003,          # AOUT_KLUDGE(16)|MEMORY_INFO(1)|PAGE_ALIGN(0)
+        0xe4514ffb,          # checksum: -(magic + flags)
+        entry, bss, end,
+        entry )
 
-gdt = dw(0x20);  dd(gdt);  dw(0,        # overlay: len + address
+gdt = dw(0x20);  dd(gdt);  dw(0,       # overlay: len + address
          0,     0,     0,     0,
-         0xffff,0,0x9a00,  0xcf,        # flat code descriptor
-         0xffff,0,0x9200,  0xcf)        # flat data descriptor
+         0xffff,0,0x9a00,  0xcf,       # flat code descriptor
+         0xffff,0,0x9200,  0xcf)       # flat data descriptor
+
 
 #===============================================================================
 # spartan interrupt support
 #===============================================================================
 
+
 def initirqs():
     &quot;&quot;&quot; initialize interrupts &quot;&quot;&quot;
-    db(0x0f,0x01,0x1d)  # set up vectors (lidt [idt_desc])
+    
+    db(0x0f,0x01,0x1d)       # set up vectors (lidt [idt_desc])
     dd(idt_desc)
-    sti         # enable interrupts
+    sti                      # enable interrupts
+
 
 #-------------------------------------------------------------------------------
 
 def ign():
     &quot;&quot;&quot; ignored processor trap &quot;&quot;&quot;
-    db(0xcf)        # (iret)
+    
+    db(0xcf)                 # (iret)
+
 
 def bpt():
-    cli; pusha
+    cli
+    pusha
     &quot;&quot;&quot; breakpoint &quot;&quot;&quot;
     ebx = [esp + 0x24]
-    printf(&quot;[%x: eax=%x]\n&quot;,ebx,eax)
-    popa; db(0xcf)
+    printf(&quot;[%x: eax=%x]\n&quot;, ebx, eax)
+    popa
+    db(0xcf)
+
 
 #-------------------------------------------------------------------------------
 
+
 def icoda():
     &quot;&quot;&quot; common interrupt exit code &quot;&quot;&quot;
+    
     # clear the interrupt
-    al = 0x20   # EO1
-    outb(0x20,al)   # PIC1
-
+    al = 0x20                # EO1
+    outb(0x20,al)            # PIC1
+    
     # restore the state
     esp += 4
     popa
-    db(0xcf)    # iret
+    db(0xcf)                 # iret
+
 
 #-------------------------------------------------------------------------------
 
+
 def igp():
     &quot;&quot;&quot; ignored PIC interrupt &quot;&quot;&quot;
-    cli; pusha
+    
+    cli
+    pusha
     icoda
 
+
 def clk():
     &quot;&quot;&quot; clock tick &quot;&quot;&quot;
-    cli; pusha
+    
+    cli
+    pusha
     clickticker
     [isr_mask] |= 1
     Py_AddPendingCall(python_isr, 0)
     icoda
 
+
 def key():
     &quot;&quot;&quot; keyboard &quot;&quot;&quot;
-    cli; pusha
+    
+    cli
+    pusha
     [isr_mask] |= 2
     Py_AddPendingCall(python_isr, 0)
     icoda
 
+
 def isrs_pending():
     &quot;&quot;&quot; returns (and resets) the pending isr flag vector &quot;&quot;&quot;
+    
     cli
     eax = [isr_mask]
     xor(edx,edx)
     [isr_mask] = edx
     sti
 
+
 #-------------------------------------------------------------------------------
 # due to the split offsets in the Intel interrupt table,
 # interrupt vectors must reside at 0x10:0x0010XXXX
 #-------------------------------------------------------------------------------
 
+
 idt_desc = dw(0x7f); dd(
   dd(ign, 0x00108f00, ign, 0x00108f00, ign, 0x00108f00, bpt, 0x00108f00,
-    ign, 0x00108f00, ign, 0x00108f00, ign, 0x00108f00, ign, 0x00108f00,
+     ign, 0x00108f00, ign, 0x00108f00, ign, 0x00108f00, ign, 0x00108f00,
+     
+     clk, 0x00108f00, key, 0x00108f00, igp, 0x00108f00, igp, 0x00108f00,
+     igp, 0x00108f00, igp, 0x00108f00, igp, 0x00108f00, igp, 0x00108f00))
 
-    clk, 0x00108f00, key, 0x00108f00, igp, 0x00108f00, igp, 0x00108f00,
-    igp, 0x00108f00, igp, 0x00108f00, igp, 0x00108f00, igp, 0x00108f00))
 
 #===============================================================================
 
+
 def clickticker():
     edx = [ticker]
     if test(edx,edx) is nz:
@@ -158,10 +187,12 @@ def clickticker():
         inc(eax)
         [edx] = eax
 
+
 #===============================================================================
 # experimental: VGA graphics
 #===============================================================================
 
+
 def outn():
     ebx = [esp + 16]
     xor(ecx,ecx)
@@ -174,6 +205,7 @@ def outn():
         outb(dx,al)
         inc(ecx)
 
+
 def palette():
     eax = [esp + 4]
     if test(eax,eax) is z:
@@ -182,17 +214,19 @@ def palette():
     else:
         eax = 0x20; edx = 0x3C0; outb(dx,al)
 
+
 def sequenceron():
     edx = 0x3C2; outb(dx, al)
     outn(0x3C4,0x3C5,1,db(3))
-    
+
+
 def set640x480x16():
     palette(0)
-
+    
     outn(0x3C4,0x3C5,5,db(1,1,0x04,0,6))
-
+    
     eax = 0xe3; sequenceron
-
+    
     eax = 0x11; edx =0x3D4; outb(dx,al)
     eax =    0; edx =0x3D5; outb(dx,al)
     outn(0x3D4,0x3D5,25,db(
@@ -200,29 +234,29 @@ def set640x480x16():
         0x00, 0x40, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
         0xea, 0x8c, 0xdf, 0x28,  0x00, 0xe7, 0x04, 0xe3,
         0xff))
-
+    
     outn(0x3CC,0x3CA,1,db(1))
     outn(0x3CE,0x3CF,9,db(
         0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x05, 0x0f,
         0xff))
-
+    
     edx = 0x3DA; inb(al, dx)
-
+    
     outn(0x3C0,0x3C0,20,db(
         0x00, 0x01, 0x02, 0x03,  0x04, 0x05, 0x06, 0x07,
         0x08, 0x09, 0x0A, 0x0B,  0x0C, 0x0D, 0x0E, 0x0F,
         0x01, 0x00, 0x0F, 0x00))
-
+    
     palette(1)
 
 
 def set80x25():
     palette(0)
-
+    
     outn(0x3C4,0x3C5,5,db(1,0,0x03,0,2))
-
+    
     eax = 0x67; sequenceron
-
+    
     eax = 0x11; edx =0x3D4; outb(dx,al)
     eax =    0; edx =0x3D5; outb(dx,al)
     outn(0x3D4,0x3D5,25,db(
@@ -230,27 +264,28 @@ def set80x25():
         0x00, 0x4f, 0x0d, 0x0e,  0x00, 0x00, 0x00, 0x00,
         0x9c, 0x8e, 0x8f, 0x28,  0x1f, 0x96, 0xb9, 0xa3,
         0xff))
-
+    
     outn(0x3CC,0x3CA,1,db(1))
     outn(0x3CE,0x3CF,9,db(
         0x00, 0x00, 0x00, 0x00,  0x00, 0x10, 0x0e, 0x00,
         0xff))
-
+    
     edx = 0x3DA; inb(al, dx)
     outn(0x3C0,0x3C0,20,db(
         0x00, 0x01, 0x02, 0x03,  0x04, 0x05, 0x06, 0x07,
         0x08, 0x09, 0x0A, 0x0B,  0x0C, 0x0D, 0x0E, 0x0F,
         0x0C, 0x00, 0x0F, 0x08))
-
+    
     palette(1)
 
+
 def set320x200x256():
     palette(0)
-
+    
     outn(0x3C4,0x3C5,5,db(3,1,0xf,0,0xe)) # .., 0x6) for mode X
     
     eax = 0x63; sequenceron
-
+    
     eax = 0x11; edx =0x3D4; outb(dx,al)
     eax =    0; edx =0x3D5; outb(dx,al)
     outn(0x3D4,0x3D5,25,db(
@@ -259,18 +294,18 @@ def set320x200x256():
         0x9c, 0x0e, 0x8f, 0x28,  0x40, 0x96, 0xb9, 0xa3,
                     # 0x00, ..., 0xe3 for mode X
         0xff))
-
+    
     outn(0x3CC,0x3CA,1,db(1))
     outn(0x3CE,0x3CF,9,db(
         0x00, 0x00, 0x00, 0x00,  0x00, 0x40, 0x05, 0x0f,
         0xff))
-
+    
     edx = 0x3DA; inb(al, dx)
     outn(0x3C0,0x3C0,20,db(
         0x00, 0x01, 0x02, 0x03,  0x04, 0x05, 0x06, 0x07,
         0x08, 0x09, 0x0A, 0x0B,  0x0C, 0x0D, 0x0E, 0x0F,
         0x41, 0x00, 0x0F, 0x00))
-
+    
     esi = paldata
     xor(ecx,ecx)
     while ecx &lt; 256:
@@ -279,15 +314,17 @@ def set320x200x256():
         lodsb;     edx = 0x3C9; outb(dx,al)
         lodsb;     edx = 0x3C9; outb(dx,al)
         inc(ecx)
-
+    
     palette(1)
 
+
 def setrplane():
     eax = 4
     edx = 0x3CE; outb(dx,al) # VGA_GC_INDEX
     eax = [esp + 4]
     inc(edx); outb(dx,al)
 
+
 def setwplane():
     eax = 2
     edx = 0x3C4; outb(dx,al) # VGA_SEQ_INDEX</diff>
      <filename>echo/kernel/kstart.boa</filename>
    </modified>
    <modified>
      <diff>@@ -1,43 +1,45 @@
 #===============================================================================
 # 32-bit boot-agnostic kernel startup code / interrupt handlers
 #===============================================================================
-# 'ld -T cleese.ld' to generate a grub-bootable executable, then
-# 'objcopy -O binary' that executable to get a bootp-bootable file.
-#===============================================================================
+
 
 #-------------------------------------------------------------------------------
 # 'entry' should be the entry point for a grub kernel, and
 # placed at the start of the text section for a bootp kernel
 #-------------------------------------------------------------------------------
 
+
 def entry():
     &quot;&quot;&quot; takes control from the bootloader &quot;&quot;&quot;
-        db(0x0f,0x01,0x15)      # use our descriptor table (lgdt [gdt])
-        dd(gdt)
-
-        ax = 0x18       # load ds
-        ds = ax; es = ax; ss = ax           
+    
+    db(0x0f,0x01,0x15)                 # use our descriptor table (lgdt [gdt])
+    dd(gdt)
+    
+    ax = 0x18                          # load ds
+    ds = ax; es = ax; ss = ax
     xor(ax,ax)
     fs = ax; gs = ax
-
-    db(0xea)        # load cs (jmp 10h:startC)
+    
+    db(0xea)                           # load cs (jmp 10h:startC)
     dd(startC); dw(0x10)
 
+
 def startC():
     &quot;&quot;&quot; builds C environment and calls main() &quot;&quot;&quot;
+    
+    edi = bss                          # zero out BSS
+    ecx = end
+    ecx -= edi
+    ecx &gt;&gt;= 2                          # (assume sections are word aligned)
+    eax = 0
+    rep; stosl
+    
+    esp = resb(0x1000)                 # set up a stack
+    esp += 0x0ffc
+    
+    Py_FrozenMain(ebx)                 # and call C code
+    dw(0xfeeb)                         # infinite loop (jmp $-2)
 
-        edi = bss               # zero out BSS
-        ecx = end
-        ecx -= edi
-        ecx &gt;&gt;= 2               # (assume sections are word aligned)
-        eax = 0
-        rep; stosl
-
-        esp = resb(0x1000)      # set up a stack
-        esp +=     0x0ffc
-
-        Py_FrozenMain(ebx)      # and call C code
-        dw(0xfeeb)              # infinite loop (jmp $-2)
 
 #-------------------------------------------------------------------------------
 # Multiboot header for GRUB bootloader. This must be in the first 8K
@@ -45,16 +47,16 @@ def startC():
 #-------------------------------------------------------------------------------
 
     align(4)
-    dd(0x1BADB002,          # magic
-           0x00010003,          # AOUT_KLUDGE(16)|MEMORY_INFO(1)|PAGE_ALIGN(0)
-           0xe4514ffb,          # checksum: -(magic + flags)
-       offset(0xfffffff4),  # address of bootblock start
-           entry, bss, end,
-           entry)
-
-gdt = dw(0x20);  dd(gdt);  dw(0,        # overlay: len + address
+    dd( 0x1BADB002,          # magic
+        0x00010003,          # AOUT_KLUDGE(16)|MEMORY_INFO(1)|PAGE_ALIGN(0)
+        0xe4514ffb,          # checksum: -(magic + flags)
+        offset(0xfffffff4),  # address of bootblock start
+        entry, bss, end,
+        entry )
+
+gdt = dw(0x20);  dd(gdt);  dw(0,       # overlay: len + address
          0,     0,     0,     0,
-         0xffff,0,0x9a00,  0xcf,        # flat code descriptor
-         0xffff,0,0x9200,  0xcf)        # flat data descriptor
+         0xffff,0,0x9a00,  0xcf,       # flat code descriptor
+         0xffff,0,0x9200,  0xcf)       # flat data descriptor
 
 #===============================================================================</diff>
      <filename>necco/lib/bochs/crt0.boa</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>de8ae5d9b59dbb57eb54463d481abf068641e34c</id>
    </parent>
  </parents>
  <author>
    <name>James Tauber</name>
    <email>jtauber@jtauber.com</email>
  </author>
  <url>http://github.com/jtauber/cleese/commit/e5f9e60701bc511667d241ee928367648a979ab7</url>
  <id>e5f9e60701bc511667d241ee928367648a979ab7</id>
  <committed-date>2009-10-11T11:48:10-07:00</committed-date>
  <authored-date>2009-10-11T11:48:10-07:00</authored-date>
  <message>more cleanup of code formatting</message>
  <tree>d6807b9d40756c700410095be2b3b25f1dc806ec</tree>
  <committer>
    <name>James Tauber</name>
    <email>jtauber@jtauber.com</email>
  </committer>
</commit>
