Guest User

code for testing A20

a guest
Feb 8th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %macro change_es 1
  2.     push ax
  3.     mov ax, %1
  4.     mov es, ax
  5.     pop ax
  6. %endmacro  
  7.  
  8.  
  9. TestA20:
  10.     push es
  11.  
  12.     change_es 0
  13.     mov ax, word [es:0x7DFE]
  14.     change_es 0xFFFF
  15.     mov bx, word [es:0x7E0E]
  16.     cmp ax, bx
  17.     jne .not_enabled
  18.  
  19.     change_es 0
  20.     ror byte [es:0x7DFE], 8
  21.     mov ax, word [es:0x7DFE]
  22.     change_es 0xFFFF
  23.     mov bx, word [es:0x7E0E]
  24.  
  25.     ; restore boot signature
  26.     change_es 0
  27.     rol word [es:0x7DFE], 8
  28.  
  29.     cmp ax, bx
  30.     jne .not_enabled
  31.  
  32.     .enabled:
  33.     mov ax, 0
  34.     jmp .done
  35.  
  36.  
  37.     .not_enabled:
  38.     mov ax, 1    
  39.  
  40.     .done:
  41.     pop es
  42.     ret
Add Comment
Please, Sign In to add comment