[FREELDR]
[reactos.git] / reactos / boot / freeldr / freeldr / arch / realmode / helpers.inc
index adf3abf..38fe40c 100644 (file)
@@ -1,10 +1,10 @@
 \r
 Empty8042:\r
-    .word 0x00eb,0x00eb                // jmp $+2, jmp $+2\r
-    in al, 0x64\r
-    cmp al, 0xff                               // legacy-free machine without keyboard\r
+    .word HEX(00eb), HEX(00eb)         // jmp $+2, jmp $+2\r
+    in al, HEX(64)\r
+    cmp al, HEX(0ff)                           // legacy-free machine without keyboard\r
     jz Empty8042_ret                   // controllers on Intel Macs read back 0xFF\r
-    test al, 0x02\r
+    test al, 2\r
     jnz Empty8042\r
 Empty8042_ret:\r
        ret\r
@@ -12,11 +12,11 @@ Empty8042_ret:
 EnableA20:\r
     pusha\r
     call Empty8042\r
-    mov al, 0xD1                               // command write\r
-    out 0x64, al\r
+    mov al, HEX(0D1)                           // command write\r
+    out HEX(064), al\r
     call Empty8042\r
-    mov al, 0xDF                               // A20 on\r
-    out 0x60, al\r
+    mov al, HEX(0DF)                           // A20 on\r
+    out HEX(060), al\r
     call Empty8042\r
     popa\r
     ret\r
@@ -46,9 +46,9 @@ writestr_end:
 writechr:\r
        pushf\r
        pusha\r
-       mov     ah, 0x0E\r
+       mov     ah, HEX(0E)\r
        xor     bx, bx\r
-       int     0x10\r
+       int     HEX(10)\r
        popa\r
        popf\r
        ret\r
@@ -92,13 +92,26 @@ writehex_common:
     popfd\r
     ret\r
 \r
-SoftReboot:\r
-       mov ax, HEX(40)\r
-       mov ds, ax\r
-       mov si, HEX(72)\r
+Reboot:\r
+       cli\r
 \r
-       /* Set the word at location 40:72 to 1234h */\r
-       mov word ptr [si], HEX(1234)\r
+       /* Set the word at location 40h:72h to 0 (cold reboot) */\r
+       mov word ptr ds:[HEX(0472)], HEX(0)\r
 \r
-       /* and jump to location FFFF:0 in ROM */\r
-       ljmp16  HEX(0FFFF), HEX(0000)\r
+       /* and jump to location F000h:FFF0h in ROM */\r
+       ljmp16 HEX(0F000), HEX(0FFF0)\r
+\r
+\r
+ChainLoadBiosBootSectorCode:\r
+    /* Load segment registers */\r
+    cli\r
+    xor ax, ax\r
+    mov ds, ax\r
+    mov es, ax\r
+    mov fs, ax\r
+    mov gs, ax\r
+    mov ss, ax\r
+    mov esp, HEX(7C00)\r
+\r
+    /* Jump to the bootsector code */\r
+    ljmp16 HEX(0000), HEX(7C00)\r