CODE :! Boot. s
!
! It then loads the system at 0x10000, using BIOS interrupts. Thereafter
! It disables all interrupts, changes to protected mode, and callthe
BOOTSEG = 0x07c0
SYSSEG = 0x1000! System loaded at 0x10000 (65536 ).
SYSLEN = 17! Sectors occupied.
Entry start
Start:
Jmpigo, # BOOTSEG
Go: movax, cs
Movds, ax
Movss, ax
Movsp, #0x400! Arbitrary value> & gt; 512
! OK, we 've written the message, now
Load_system:
Movdx, #0x0000
Movcx, #0x0002
Movax, # SYSSEG
Moves, ax
Xorbx, bx
Movax, #0x200 + SYSLEN
Int 0x13
Jncok_load
Die: jmpdie
! Now we want to move to protected mode...
OK _load:
Cli! No interrupts allowed!
Movax, # SYSSEG
Movds, ax
Xorax, ax
Moves, ax
Movcx, #0x2000
Subsi, si
Subdi, di
Rep
Movw
Movax, # BOOTSEG
Movds, ax
Required tidt_48! Load idt with 0, 0
Lgdtgdt_48! Load gdt with whatever appropriate
! Absolute address 0x00000, in 32-bit protected mode.
Movax, #0x0001! Protected mode (PE) bit
Lmswax! This is it!
Jmpi0, 8! Jmp offset 0 of segment 8 (cs)
Gdt:. word0, 0, 0! Dummy
. Word0x07FF! 8 Mb-limit = 2047 (2048*4096 = 8 Mb)
. Word0x0000! Base address = 0x00000
. Word0x9A00! Code read/exec
. Word0x00C0! Granularity = 4096,386
. Word0x07FF! 8 Mb-limit = 2047 (2048*4096 = 8 Mb)
. Word0x0000! Base address = 0x00000
. Word0x9200! Data read/write
. Word0x00C0! Granularity = 4096,386
Idt_48:. word0! Idt limit = 0
. Word0, 0! Idt base = 0L
Gdt_48:. word0x7ff! Gdt limit = 2048,256 GDT entries
. Word0x7c00 + gdt, 0! Gdt base = 07xxx
. Org 510
. Word 0xAA55 |