Article View: alt.lang.asm
Article #366protected mode problem
From: PR Schmitz
Date: Wed, 18 Mar 1998 00:00
Date: Wed, 18 Mar 1998 00:00
75 lines
2563 bytes
2563 bytes
After downloading some info from intel (24319201.PDF, manual for system
management) I tried to program using protected mode instead of real mode
(because I need to). But here is my problem...
When I 'switch' to protected mode using MOV CR0,EAX, The system reboots or
crashes. What am I doing wrong? Can somebody please tell me?
I'm using TASM/TLINK version 3.1 and/or 4.1
The assembling and linking process doesn't generate errors, except for 'No
stack warning'. But that shouldn't mind, because I don't use any.
command line: tasm /zi pmode
tlink /z /3 pmode
Here's my ASM file:
-----
.386p
data SEGMENT
gdt DD 0
DD 0
DD 0000FFFFh
DD 00CF9200h
gdtr LABEL FWORD
DD ?
DW 15
data ENDS
code SEGMENT USE16
ASSUME cs:code,ds:data
Start: cli
xor eax,eax
xor ebx,ebx
mov ax,data
mov ds,ax
lea ebx,gdt
shl eax,4
add eax,ebx
lea ebx,gdtr
mov DWORD PTR [ebx],eax
DB 66h
lgdt gdtr
mov eax,cr0
or eax,1
mov cr0,eax
jmp prot
prot: mov ax,08h
mov ds,ax
mov es,ax
mov ax,2001h
mov ebx,0b8000h
mov ecx,126-32
lusje: mov [ebx],ax
inc ah
add ebx,2
loop lusje
mov eax,cr0
xor eax,1
mov cr0,eax
jmp real
real: sti
mov ax,4c00h
int 21h
code ENDS
END Start
-----
Technical Details
Message-ID:
<6eonor$bb7$7@winter.news.erols.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: feaef,2226f239c4d199fa,start X-Google-Attributes: gidfeaef,public X-Google-Thread: f7d8d,2226f239c4d199fa,start X-Google-Attributes: gidf7d8d,public X-Google-Thread: 114917,2226f239c4d199fa,start X-Google-Attributes: gid114917,public From: "PR Schmitz" <pschmitz@kabelfoon.nl> Subject: protected mode problem Date: 1998/03/18 Message-ID: <6eonor$bb7$7@winter.news.erols.com> X-Deja-AN: 335257902 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 X-Complaints-To: abuse@erols.com X-UIDL: 8a42afe95a X-Trace: winter.news.erols.com 890233435 11623 207.172.240.51 (18 Mar 1998 15:03:55 GMT) Organization: CAI Westland/Kabelfoon Newsgroups: alt.lang.asm,borland.public.tasm,comp.lang.asm.x86