OSdev
Posted: Thu Dec 09, 2004 7:25 am
I want create my OS. I do a bootloader byt i dont known how enter protected mode?
Can help me?
Can help me?
But it doesn't work[BITS 16]
[ORG 0x7C00]
jmp 0x8000
times 510-($-$$) db 0
dw 0xAA55
Code: Select all
jmp 0000:0x8000
Can you be more specific ? (e.g. post the error code/msg you get in the "working on the FAQ" thread ...)Solar_worm wrote: MegaTokyo FAQ doesn't work.
?debug stage2
-w 100 0 0 2
-q
Code: Select all
;************************************
; \\|//
; (@ @)
; ASHLEY4.
; Put test.bin on boot sector
; with rawrite.
; Assemble with fasm
; c:\fasm test.asm test.bin
;************************************
org 0x7C00
use16
;****************************
; Realmode startup code.
;****************************
start:
xor ax,ax
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0x7C00
;*****************************
; Setting up, to enter pmode.
;*****************************
cli
lgdt [gdtr]
mov eax, cr0
or al,0x1
mov cr0,eax
jmp 0x10: protected
;*****************************
; Pmode. ;-)
;*****************************
use32
protected:
mov ax,0x8
mov ds,ax
mov es,ax
mov ss,ax
mov esp,0x7C00
;*****************************
; Turn floppy off (if space).
;*****************************
mov dx,3F2h
mov al,0
out dx,al
lea esi,[msg0]
mov edi,0xB8000 + (80 * 3 + 4) * 2
mov ecx,28
cld
rep movsb
jmp $
;*************************************
; GDT.
;*************************************
gdt: dw 0x0000, 0x0000, 0x0000, 0x0000
sys_data: dw 0xFFFF, 0x0000, 0x9200, 0x00CF
sys_code: dw 0xFFFF, 0x0000, 0x9800, 0x00CF
gdt_end:
gdtr: dw gdt_end - gdt - 1
dd gdt
;*************************************
; Data.
;*************************************
msg0 db " H E L L O W O R L D ! "
;*************************************
; Make program 510 byte's + 0xaa55
;*************************************
times 510- ($-start) db 0
dw 0xaa55
times 510- ($-start) db 0
dw 0xaa55
???times 510- ($-$$) db 0
dw 0xAA55
correct.Solar_worm wrote: And I must changetimes 510- ($-start) db 0
dw 0xaa55
to:???times 510- ($-$$) db 0
dw 0xAA55
Not neccesarily needed, you can use "use16" and still it should work.change "use16" to "[bits 16]" and it should work in nasm aswell.
You can also use:Code: Select all
lea esi,[msg0]
Code: Select all
mov esi,msg0