Index: trunk/bootcode/regular/debug.asm
===================================================================
--- trunk/bootcode/regular/debug.asm	(revision 106)
+++ trunk/bootcode/regular/debug.asm	(revision 107)
@@ -435,92 +435,63 @@
 
 DEBUG_DumpRegisters     Proc
-        pushf
-        pusha
-
-        ; Safe flags so they can be printed later
-        pushf
-
-        ; Save value in SI so it can be printed later
+
+        ; Save state of caller
+        pushf
+        pusha
+
+        ; Save flags so they can be printed later
+        pushf
+
+        ; Push the registers to print on the stack (SP is bogus)
+.386
+        push    gs
+        push    fs
+.286
+        push    bp
+        push    sp
+        push    ss
+        push    es
+        push    ds
+        push    cs
+        push    di
         push    si
+        push    dx
+        push    cx
+        push    bx
+        push    ax
 
         ; Base of registers string
         mov     si, offset [regAX]
 
-        ; AX
+        ; Print AX BX CX DX SI DI
+        mov     cx, 6
+    @@:
+        pop     ax
         call    AuxIO_Print
         call    AuxIO_TeletypeHexWord
-
-        ; BX
-        call    AuxIO_Print
-        mov     ax,bx
+        loop    @B
+
+        ; 1st row printed
+        call    AuxIO_TeletypeNL
+
+        ; Print CS DS ES SS SP BP
+        mov     cx, 6
+    @@:
+        pop     ax
+        call    AuxIO_Print
         call    AuxIO_TeletypeHexWord
-
-        ; CX
-        call    AuxIO_Print
-        mov     ax,cx
+        loop    @B
+
+        ; 2nd row printed
+        call    AuxIO_TeletypeNL
+
+        ; Print FS GS
+        mov     cx, 2
+    @@:
+        pop     ax
+        call    AuxIO_Print
         call    AuxIO_TeletypeHexWord
-
-        ; DX
-        call    AuxIO_Print
-        mov     ax,dx
-        call    AuxIO_TeletypeHexWord
-
-        ; SI
-        call    AuxIO_Print
-        pop     ax
-        call    AuxIO_TeletypeHexWord
-
-        ; DI
-        call    AuxIO_Print
-        mov     ax,di
-        call    AuxIO_TeletypeHexWord
-
-        ; 1st row printed
-        call    AuxIO_TeletypeNL
-
-        ; CS
-        call    AuxIO_Print
-        mov     ax,cs
-        call    AuxIO_TeletypeHexWord
-
-        ; DS
-        call    AuxIO_Print
-        mov     ax,ds
-        call    AuxIO_TeletypeHexWord
-
-        ; ES
-        call    AuxIO_Print
-        mov     ax,es
-        call    AuxIO_TeletypeHexWord
-
-        ; SS
-        call    AuxIO_Print
-        mov     ax,ss
-        call    AuxIO_TeletypeHexWord
-
-        ; SP
-        call    AuxIO_Print
-        mov     ax,sp
-        call    AuxIO_TeletypeHexWord
-
-        ; BP
-        call    AuxIO_Print
-        mov     ax,bp
-        call    AuxIO_TeletypeHexWord
-
-        ; 2nd row printed
-        call    AuxIO_TeletypeNL
-.386
-        ; FS
-        call    AuxIO_Print
-        mov     ax,fs
-        call    AuxIO_TeletypeHexWord
-
-        ; GS
-        call    AuxIO_Print
-        mov     ax,gs
-        call    AuxIO_TeletypeHexWord
-        ;~ call    AuxIO_TeletypeNL
-.286
+        loop    @B
+
         ; Restore the flags
         popf
@@ -532,5 +503,5 @@
         ;~ mov     si, offset [flagsSF]
 
-        ; SF
+        ; Print SF
         call    AuxIO_Print
         mov     al, ah
@@ -540,5 +511,5 @@
         call    AuxIO_Teletype
 
-        ; ZF
+        ; Print ZF
         call    AuxIO_Print
         mov     al, ah
@@ -548,5 +519,5 @@
         call    AuxIO_Teletype
 
-        ; AF
+        ; Print AF
         call    AuxIO_Print
         mov     al, ah
@@ -556,5 +527,5 @@
         call    AuxIO_Teletype
 
-        ; PF
+        ; Print PF
         call    AuxIO_Print
         mov     al, ah
@@ -564,5 +535,5 @@
         call    AuxIO_Teletype
 
-        ; CF
+        ; Print CF
         call    AuxIO_Print
         mov     al, ah
@@ -574,6 +545,8 @@
         call    AuxIO_TeletypeNL
 
-        popa
-        popf
+        ; Restore caller state
+        popa
+        popf
+
         ret
 DEBUG_DumpRegisters     EndP
