Protected mode from MS-DOS
Posted: Tue Oct 11, 2011 5:39 pm
I’m tired off making bootdisks for testing so I thought “I make a simple .ASM to start protected mode directly from MS-DOS”.
In the boot variant everything goes fine but when I made this version the computer started to reboot.
I stripped it till I got only the pmode switch.
But still rebooting and “no fun”
Someone can help me finding the problem?
First I thought the problem was the "JMP PMODE" could not work because MSDOS starts in a segment like [0F53:0100] (segment is always less then 0x1000)
I try solving this problem by adding the JUMPSTRING but still the same rebooting.
When I “debug.com” it with only the jumpcode it seems to work and the jump is to the right place.
But there is still something wrong.
In the boot variant everything goes fine but when I made this version the computer started to reboot.
I stripped it till I got only the pmode switch.
But still rebooting and “no fun”
Someone can help me finding the problem?
Code: Select all
[ORG 0x0100]
JMP BOOTLOADER
GDTINFO:
DW GDT_END - GDT - 1
DD GDT
GDT DD 0x0000,0x0000 ; entry 0 is always unused
GDT_CODE DB 0xFF, 0xFF, 0x00, 0x00, 0x00, 10011010b, 11001111b, 0x00
GDT_DATA DB 0xFF, 0xFF, 0x00, 0x00, 0x00, 10010010b, 11001111b, 0x00
GDT_END:
TMP_INFO TIMES 0xFF DB 0xFF
VESA_VER DW 0xFFFF
VESA_MEM DW 0xFFFF
BOOTLOADER:
MOV BX,CS
MOV DS,BX
SHL BX,4
ADD BX,PMODE ; PMODE = FUNCTION TO JUMP TO
MOV WORD [JMPSTRING+1],BX ; BX = CODE ADDRESS WHEN SEGMENT 0
; JMPSTRING DB 0xEA,0x00,0x00,0x08,0x00
XOR AX,AX
MOV ES,AX
MOV DS,AX
CLI
MOV AL,0xFF
OUT 0x21,AL
OUT 0xA1,AL
LGDT [GDTINFO]
MOV EAX,CR0
OR EAX, 1
MOV CR0, EAX
;JMP PMODE
JMPSTRING DB 0xEA,0x00,0x00,0x08,0x00
EXIT:
INT 0x20
JMP EXIT
BITS 32
PMODE:
MOV AX,0x10
MOV DS,AX
MOV ES,AX
MOV SS,AX
MOV EAX,0x0B8000
MOV EBX,0x000160
NEXT_PIXEL:
MOV [EAX+EBX],EBX
SUB EBX,4
JNZ NEXT_PIXEL
STOP:
JMP STOP
I try solving this problem by adding the JUMPSTRING but still the same rebooting.
When I “debug.com” it with only the jumpcode it seems to work and the jump is to the right place.
But there is still something wrong.