386以上計算機從實模式進入虛擬86模式
源碼:
.model small
.386p
.data
base_memory dd ?
new_base dd 0
new_base1 dd 0
.code
mov cs:psp_seg,ds
mov ax,seg base_memory
mov ds,ax
mov es,ax
mov ds,ax
int 12h
movzx eax,ax
shl eax,0ah
add eax,0fffh
and ax,0f000h
mov base_memory,eax ;eax
mov ah,88h
int 15h
add ax,400h
movzx eax,ax
shl eax,0ah
and ax,0f000h
mov bx,cs:psp_seg
mov es,bx
mov si,2ch
cmp bx,es:[si]
jb ignore
mov bx,es:[si]
ignore:
movzx ebx,bx
shl ebx,4
add ebx,0fffh
and bx,0f000h
mov ecx,base_memory ;ecx
sub ecx,ebx
sub eax,ecx
sub eax,010000h
mov new_base,eax
shr eax,4
mov new_base1,eax
call fill1_gdt
psp_seg dw ?
fill1_gdt proc near
movzx eax,ax
shl eax,4
mov ebx,eax
shr ebx,10h
add [si+2],ax
adc [si+4],bl
fill1_gdt endp
end