can u help me? i have work on it for several days.... : (
thx.
Code: Select all
.code16
.global _start
_start:
#; clear screen
mov $0x0600, %ax
mov $0x0000, %cx
mov $0x174f, %dx
mov $0x00, %bh
int $0x10
xorw %ax, %ax #; ax <- zero
movw %ax, %ds #; DS <- zero
movw %ax, %ss #; stack starts at 0x00
movw $0x9c00, %sp #; 200h past code start
movw $0xb800, %ax #; text video memory
movw %ax, %es
push $sx_os_logo
push $0x000A
call _vprint_str
push $sx_os_boot_msg
push $0x000E
call _vprint_str
enable_a20:
inb $0x64, %al
testb $0x2, %al
jnz enable_a20
movb $0xbf, %al
outb %al, $0x64
#;load GDT
lgdt gdt_seg #; load gdt with whatever is appropriate
#;set cr0 = 1,
movl %cr0, %eax
orl $0x1, %eax
movl %eax, %cr0
#;move to protect mode
ljmp $8,$0
.code32:
protc_seg:
#;write a char to memory
mov $0x0f01, %bx #; attrib/char of smiley
mov $0x0b800, %eax #; note 32 bit offset
movw %bx, %ds:(%eax)
#; loop forever
jmp .
#;-------------------------------------
.p2align 2 /* force 4-byte alignment */
gdt:
.word 0x0000, 0x0000 #;NULL
.byte 0x00, 0x00, 0x00, 0x00
code_segment:
.word 0xFFFF #;4Gb - (0x100000 * 0x1000 = 4Gb)
.word 0x0000 #;base address
.byte 0x00, 0x9A #;code read/exec
.byte 0xCF, 0x00 #;granularity
data_segment:
.word 0xFFFF #;4Gb - (0x100000 * 0x1000 = 4Gb)
.word 0x0000 #;base address
.byte 0x00, 0x92 #;data read/write
.byte 0xCF, 0x00 #;granularity
videoseg:
.word 0x3999, 0x8000
.byte 0x0b, 0x92, 0x00, 0x00
bootrealseg:
.word 0xffff, 0
.byte 0, 0x9e, 0x00, 0
bootrealdata:
.word 0xffff, 0
.byte 0, 0x92, 0x00, 0
gdt_len = . - gdt
gdt_seg:
.word gdt_len - 1 #; gdt limit
.word 0x7c00 + gdt, 0 #; gdt base
#;-------------------------------------
sx_os_logo:
.asciz " --== ShellEx OS [version 0.0.0.1]==-- "
sx_os_logo_length = . - sx_os_logo
sx_os_boot_msg:
.asciz " [i]Loading ...."
sx_os_boot_msg_length = . - sx_os_boot_msg
.org 510, 0x90
.word 0xaa55