Cleanup a20 code.

Fix two apparent bugs - set_a20() returned new status instead of old
    status and handle_152402() checked wrong bit.
Add bit definition for the a20 enable bit: A20_ENABLE_BIT
Allow ioport.h #defines to be used in romlayout.S.
diff --git a/Makefile b/Makefile
index d5804f3..7bfb345 100644
--- a/Makefile
+++ b/Makefile
@@ -84,7 +84,7 @@
 
 $(OUT)%.lds: %.lds.S
 	@echo "  Precompiling $<"
-	$(Q)$(CPP) -P $< -o $@
+	$(Q)$(CPP) -P -D__ASSEMBLY__ $< -o $@
 
 
 $(OUT)blob.16.s: ; $(call whole-compile, $(CFLAGS16) -S, $(addprefix src/, $(SRC16)),$@)
@@ -92,7 +92,7 @@
 TABLEASM=$(addprefix $(OUT), $(patsubst %.c,%.proc.16.s,$(TABLESRC)))
 $(OUT)romlayout16.o: romlayout.S $(OUT)blob.16.s $(TABLEASM)
 	@echo "  Generating 16bit layout of $@"
-	$(Q)$(CC) $(CFLAGS16) -c $< -o $@
+	$(Q)$(CC) $(CFLAGS16) -c -D__ASSEMBLY__ $< -o $@
 
 $(OUT)romlayout32.o: ; $(call whole-compile, $(CFLAGS), $(addprefix src/, $(SRC32)),$@)
 
diff --git a/src/ioport.h b/src/ioport.h
index 196fe53..633ed0e 100644
--- a/src/ioport.h
+++ b/src/ioport.h
@@ -6,8 +6,6 @@
 #ifndef __IOPORT_H
 #define __IOPORT_H
 
-#include "types.h" // u8
-
 #define PORT_DMA_ADDR_2        0x0004
 #define PORT_DMA_CNT_2         0x0005
 #define PORT_DMA1_MASK_REG     0x000a
@@ -46,9 +44,12 @@
 #define PORT_QEMU_CFG_DATA     0x0511
 #define PORT_BIOS_APM          0x8900
 
-// PORT_KBD_CTRLB bitdefs
-#define KBD_REFRESH (1<<4)
+// PORT_A20 bitdefs
+#define A20_ENABLE_BIT 0x02
 
+#ifndef __ASSEMBLY__
+
+#include "types.h" // u8
 
 static inline void outb(u8 value, u16 port) {
     __asm__ __volatile__("outb %b0, %w1" : : "a"(value), "Nd"(port));
@@ -101,4 +102,6 @@
                  : "+c"(count), "+S"(data) : "d"(port) : "memory");
 }
 
+#endif // !__ASSEMBLY__
+
 #endif // ioport.h
diff --git a/src/romlayout.S b/src/romlayout.S
index f7c2b02..e7c08bc 100644
--- a/src/romlayout.S
+++ b/src/romlayout.S
@@ -5,7 +5,8 @@
 //
 // This file may be distributed under the terms of the GNU GPLv3 license.
 
-#include "config.h"
+#include "config.h" // CONFIG_*
+#include "ioport.h" // PORT_A20
 
 
 /****************************************************************
@@ -145,9 +146,9 @@
         cli
 
         // enable a20
-        inb $0x92, %al
-        orb $0x02, %al
-        outb %al, $0x92
+        inb $PORT_A20, %al
+        orb $A20_ENABLE_BIT, %al
+        outb %al, $PORT_A20
 
         // Set segment descriptors
         lidt %cs:pmode_IDT_info
@@ -190,9 +191,9 @@
         movw %ax, %gs
 
         // disable a20
-        inb $0x92, %al
-        andb $~0x02, %al
-        outb %al, $0x92
+        inb $PORT_A20, %al
+        andb $~A20_ENABLE_BIT, %al
+        outb %al, $PORT_A20
 
         // Jump to 16bit mode
         ljmpw $SEG32_MODE16_CS, $1f
diff --git a/src/system.c b/src/system.c
index f4e4263..11b1cc8 100644
--- a/src/system.c
+++ b/src/system.c
@@ -19,12 +19,12 @@
     // get current setting first
     u8 newval, oldval = inb(PORT_A20);
     if (cond)
-        newval = oldval | 0x02;
+        newval = oldval | A20_ENABLE_BIT;
     else
-        newval = oldval & ~0x02;
+        newval = oldval & ~A20_ENABLE_BIT;
     outb(newval, PORT_A20);
 
-    return (newval & 0x02) != 0;
+    return (oldval & A20_ENABLE_BIT) != 0;
 }
 
 static void
@@ -44,7 +44,7 @@
 static void
 handle_152402(struct bregs *regs)
 {
-    regs->al = !!(inb(PORT_A20) & 0x20);
+    regs->al = (inb(PORT_A20) & A20_ENABLE_BIT) != 0;
     set_code_success(regs);
 }