title: Why test port 0x64 in a bootloader before switching into protected mode?
body: <p>In my MIT OS course (686) I have found some code that I don't understand. I'm trying to understand the instruction <code>inb $0x64, %al</code> in <em>boot</em>/<em>boot.S</em>. 
  My understanding is that it's reading one byte from data port 0x64 into <em>AL</em>, What is port 0x64? Which device or mechanism is it testing for <em>busy</em>? I'm confused about the comment in the code <em>Busy?</em> What does the comment mean and what does it refer to?  </p>
  
  <pre><code># Enable A20:
  #   For fascinating historical reasons (related to the fact that
  #   the earliest 8086-based PCs could only address 1MB of physical memory
  #   and subsequent 80286-based PCs wanted to retain maximum compatibility),
  #   physical address line 20 is tied to low when the machine boots.
  #   Obviously this a bit of a drag for us, especially when trying to
  #   address memory above 1MB.  This code undoes this.
  
  seta20.1:       inb     $0x64,%al               # Get status
                  testb   $0x2,%al                # Busy?
                  jnz     seta20.1                # Yes
                  movb    $0xd1,%al               # Command: Write
                  outb    %al,$0x64               #  output port
  seta20.2:       inb     $0x64,%al               # Get status
                  testb   $0x2,%al                # Busy?
                  jnz     seta20.2                # Yes
                  movb    $0xdf,%al               # Enable
                  outb    %al,$0x60               #  A20
  </code></pre>