Re:Help with code
Posted: Wed Nov 13, 2002 4:29 pm
Here's the modified code that I'm having problems with. Could someone look over my code and tell me whats wrong with it. Thanks in advance.
Code: Select all
[BITS 16]
[ORG 0x7C00]
; Initialize Segment Regs
xor ax, ax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov [bootdrv],dl
; Setup a Real Mode Stack
cli
mov ax, 0x9000
mov ss, ax
mov sp, 0xFFFE
sti
cli
lgdt [gdtr_ptr]
mov eax,cr0
or eax,1
mov cr0,eax
jmp 0x08:enter_pmode
[bits 32]
enter_pmode:
mov ax,0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp $
;----------------------------------------------------------------------
; Global Descriptor Table (GDT)
;----------------------------------------------------------------------
; The GDTR Limit and Base
gdtr_ptr:
dw 0xFFFF
dd 0
; The GDT Setup Entries
gdt_start:
; Null Segment Descriptor, 0x00
dd 0
dd 0
; Code Segment Descriptor, 0x08
db 11111111b ; 4GB Limit
db 11111111b ; 4GB limit
db 00000000b ; Base 0
db 00000000b ; Base 0
db 00000000b ; Base 0
db 10011010b ; Present : Ring 0 : Code\Exec : Non-Conforming : Readable
db 11001111b ; 4KB Granularity : 32Bit : 4GB Limit
db 00000000b ; Base 0
; Data Segment Descriptor, 0x10
db 11111111b ; 4GB Limit
db 11111111b ; 4GB limit
db 00000000b ; Base 0
db 00000000b ; Base 0
db 00000000b ; Base 0
db 10010010b ; Present : Ring 0 : Data : Expand Up : Writable
db 11001111b ; 4KB Granularity : 32Bit : 4GB Limit
db 00000000b ; Base 0
gdt_end:
;----------------------------------------------------------------------
; DATA
;----------------------------------------------------------------------
bootdrv db 0
times 510-($-$$) db 0
dw 0xAA55