4 ;       mov al, 0x01            ; Say where we are.
 
   7         mov ds, ax              ; Take us out of flat unreal mode, and
 
   8         mov es, ax              ; put us in true real mode.
 
  12         jmp 0xA800:entry2               ; Long jump to a correct cs.
 
  16         lgdt [gdtr]                     ; Set up a new GDT.
 
  18         mov cr0, eax                    ; ... and enter pmode!
 
  19         mov al, 0x03                    ; Say we got here.
 
  21         jmp long 0x10:(continue+0xA8000)        ; Now longjmp into the new code.
 
  24 ;       mov al, 0x04                    ; Now we're in protected mode.
 
  27         mov ax, 0x08                    ; Set up segment selectors.
 
  38         mov al, [(cstat + 0xA8000)]
 
  41         mov [(cstat + 0xA8000)], al
 
  44         mov dword [(status + 0xA8000)], eax
 
  46         mov dx, 0xCF8                   ; save off the old config value
 
  50         mov eax, 0x80000070             ; load in smramc
 
  55         and al, 0xF3                    ; Allow graphics access
 
  62         mov [esp-6], al                 ; save off the old VGA command
 
  74         add eax, 0xB8000                ; yay
 
  76         mov byte [eax+1], 0xA0
 
  78         mov byte [eax+3], 0xA0
 
  80         mov byte [eax+5], 0xA0
 
  82         mov byte [eax+7], 0xA0
 
  84         mov byte [eax+9], 0xA0
 
  85         mov byte [eax+10], '2'
 
  86         mov byte [eax+11], 0xA0
 
  93         mov dx, 0xCFC                   ; restore smramc
 
  97         mov dx, 0xCF8                   ; restore the old config value
 
 101         mov al, 0x40                    ; ack the periodic IRQ
 
 107         or al, 0x02                     ; now ack the SMI itself
 
 121         db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 
 122         db 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x93, 0xCF, 0x00       ; data segment
 
 123         db 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x9B, 0xCF, 0x00       ; code segment
 
 124         db 0xFF, 0xFF, 0x00, 0x80, 0x0A, 0x9B, 0xCF, 0x00       ; code segment for trampoline
 
 126 TIMES   512-($-$$) DB 0