mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-22 22:56:53 +03:00
812bae4a84
git-svn-id: svn://kolibrios.org@2783 a494cfbc-eb01-0410-851d-a64ba20cac60
74 lines
1.1 KiB
NASM
74 lines
1.1 KiB
NASM
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 - ëèíåéíûé àäðåñ gdt
|
|
|
|
mov word [gdtPtr], 2 * 8 -1 ; ïðåäåë gdt 2 äåñêðèïòîðà = 0x000f
|
|
mov dword [gdtPtr + 2], ebx
|
|
|
|
lgdt pword [gdtPtr]
|
|
|
|
in al, 0x70 ;çàïðåùàåì NMI
|
|
mov bl, al
|
|
or al, 0x80
|
|
out 70h , al
|
|
in al, 0x71 ;íåêîòîðûå RTC ïîñëå çàïèñè áàéòà â ïîðò 0õ70
|
|
;îæèäàþò îáðàùåíèÿ ê ïîðòó 0x71
|
|
|
|
cli
|
|
|
|
mov eax, cr0
|
|
or al, 01b
|
|
mov cr0, eax
|
|
|
|
mov dx, 0x08
|
|
mov gs, dx ;gs - ãëîáàëüíûé ñåãìåíò ñ áàçîé 0 è ïðåäåëîì 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
|
|
|
|
;òåïåðü ìîæíî ïîëó÷èòü äîñòóï êî âñåé ïàìÿòè
|
|
;íàïðèìåð
|
|
;mov eax, [gs:0xFFFFFFF0] ;
|
|
|
|
mov ah,4ch ;çàâåðøåíèå ÄÎÑ ïðîãðàììû
|
|
int 21h
|
|
|
|
segment _data use16
|
|
|
|
align 16
|
|
|
|
gdt dw 0, 0, 0, 0 ;0
|
|
_flat dw 0ffffh,0,0F200h,008fh ;08 ñåãìåíò äàííûõ DPL = 3
|
|
;áàçà 0, ïðåäåë 0xFFFFFFFF
|
|
|
|
gdtPtr dq ? |