这段演示实模式和保护模式之间的转换的代码,我改来改去就是不能让它乖乖地运行,每次运行后只有一个结果:机器冷重起~~郁闷,不知道问题在哪里,请帮我看看我错在哪里啦
.386p
Descriptor struc
limitl dw 0
baselw dw 0
basehwlb db 0
attri db 0
limith db 0
basehwhb db 0
Descriptor ends
;***************************************************
JUMP16 MACRO Selector,Offset
db 0eah
dw Offset
dw Selector
ENDM
;-------------------------------
EnableA20 MACRO
IN AL,92H
OR AL,2
OUT 92H,AL
ENDM
;--------------------------------
DisableA20 MACRO
IN AL,92H
AND AL,0FDH
OUT 92H,AL
ENDM
;***************************************************
Data Segment use16
gdt0 LABEL BYTE
DUMMY Descriptor <>
CodeSel equ $-gdt0
CodeDes Descriptor <0ffffh,0,0,9ah,0,0>
DataSel equ $-gdt0
DataDes Descriptor <0ffffh,0,0,92h,0cf,0>
VideoSel equ $-gdt0
VideoDes Descriptor <0ffffh,8000h,0Bh,92h,0,0>
StkSel equ $-gdt0
StkDes Descriptor <0ffffh,0,0,96h,0,0>
;----------------------------------------------
GdtLen equ $-gdt0
GdtPtr dw GdtLen-1
dd 0
Buff db 256 dup (?)
Mesg db 'Now Is In Protect Mode. ',0
Data ends
;*************************************************
stk Segment STACK use16
db 1024 dup (0)
stk ends
;*************************************************
Code Segment use16
assume cs:Code,ds:Data,ss:stk
start:
xor ax,ax
mov ax,Data
mov ds,ax
mov bx,16
mul bx
add ax,offset gdt0 ;设置全局描述符表的基地址
adc dx,0
mov word ptr [GdtPtr+2],ax
mov word ptr [GdtPtr+4],dx
mov ax,Code ;设置代码段