kolibrios-fun/programs/hd_load/usb_boot_old/enable.asm

74 lines
1.1 KiB
NASM
Raw Normal View History

format MZ
heap 0
stack 800h
entry main:start
segment main use16
use16
start:
mov ax,_data
mov ds, ax
mov es, ax
xor eax, eax
mov ax,ds
shl eax, 4
mov bx, gdt
add ebx, eax ; ebx - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> gdt
mov word [gdtPtr], 2 * 8 -1 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> gdt 2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = 0x000f
mov dword [gdtPtr + 2], ebx
lgdt pword [gdtPtr]
in al, 0x70 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NMI
mov bl, al
or al, 0x80
out 70h , al
in al, 0x71 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RTC <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> 0<>70
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> 0x71
cli
mov eax, cr0
or al, 01b
mov cr0, eax
mov dx, 0x08
mov gs, dx ;gs - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> 0 <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0xFFFFFFFF
mov fs, dx
and al, 0xFE
mov cr0, eax
sti
mov al, bl
out 70h , al
in al, 71h
mov dx,92h
in al,dx
or al,2
out dx,al
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
;mov eax, [gs:0xFFFFFFF0] ;
mov ah,4ch ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int 21h
segment _data use16
align 16
gdt dw 0, 0, 0, 0 ;0
_flat dw 0ffffh,0,0F200h,008fh ;08 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DPL = 3
;<3B><><EFBFBD><EFBFBD> 0, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0xFFFFFFFF
gdtPtr dq ?