luminance 0 Newbie Poster

another thing also with pmode is that when switching back to real mode any 16 bit segments that are used should have their limits set to full 64k for the segment limit, i.e. 0FFFFh, otherwise the pc will hang or reboot
and also disable any interrupts during pmode switching , etc, hope this helps

luminance 0 Newbie Poster

heya why is it that wen i switch back to real mode i cant access real mode interrupts even when i never modified anythang like for instance this code
mov EAX,CR0
OR AL,0H
MOV CR0,EAX;THEN SWITCH BACK TO REAL MODE
MOV EAX,CR0
AND AL,10B
MOV CR0,EAX
;THEN INT 10H
MOV AX,3H
INT 10H
;THEN MY PROGRAM DOESNT RESPOND PLS HEL-P

Here is some code to do the actual switching of pmode but you
need the GDT and IDT set up prior. It also loads the Task register and LDT registers as well for use with TSS's - but just follow the flow of the code loading all the the segments to initialise them

EnterPmode1 PROC NEAR
PUSHFD
CLI
PUSHAD
; SAVE THE REALMODE GDT AND IDT
SGDT DS:[Pm1Data1].RMGDTR1
SIDT DS:[Pm1Data1].RMIDTR1
; SET THE PROTECTED MODE GDT AND IDT
LGDT DS:[Pm1Data1].PMGDTR1
LIDT DS:[Pm1Data1].PMIDTR1
; DO THE SWITCH TO PMODE
MOV EAX, CR0
AND EAX, 07FFFFFFFh
OR EAX, 000000001h
MOV CR0, EAX
; FAR JUMP TO LOAD CS SELECTOR VALUE AND FLUSH INSTRUCTIONS
DB 0EAh
DW OFFSET CS:LxJmp1
DW CURRENTCODESEGMENTSELECTOR
LxJmp1: MOV AX, CURRENTDATASEGMENTSELECTOR
MOV DS, AX
MOV ES, AX
MOV FS, AX
MOV AX, CURRENTSTACKSEGMENTSELECTOR
MOV SS, AX
MOVZX ESP, SP
MOV AX, FLAT32SELECTOR
MOV GS, AX
; LOAD TASK REGISTER …

luminance 0 Newbie Poster

for the GDT , decide what selector to use, e.g. 00098h , whatever. then
create the descriptor in the GDT for that selector , as follows
dw limit1 0ffffh
dw base1 08000h
db base2 00bh
db type1 09ah
db limit2 000h
db base3 000h
now 0b800h is a segment value for text video and should be interpreted as 0b8000h as a 32-bit linear address and video is a data segment
try this and see how you go