HEY CAN SOMEONE HELP ME WITH THIS I CAN'T FIGURE OUT WHY THIS IS CAUSING A TRIPLE FAULT CAN SOMEBODY HELP ME! THIS IS MY BOOTSECTOR:
THANKS
;
;
;
;
[BITS 16]
;----------------------------
jmp start ; Jump to start
;-----------------------------
STACKSEG EQU 0x8000
INITSEG EQU 0x07c0
VIDEOSEG EQU 0xb800
NEWSEG EQU 0x9000
CODESEL EQU 0x08
DATASEL EQU 0x10
VIDEOSEL EQU 0x18
;------------------------------
gdtr
dw 0x1000
dd 0
idtr
dw 0
dd 0x1000
gdt
dd 0
dd 0
dw 0xffff
dw 0x0
db 0x0
db 0x9a
db 0xcf
db 0
dw 0xffff
dw 0x0
db 0x0
db 0x92
db 0xcf
db 0
gdt_end
bootdrv db 0
bootmsg db 'Loading...',13,10,0
a20msg db 'Turning A20 Address line on!',13,10,0
pmodemsg db 'Entering 32-bit Protected Mode!',13,10,0
pmodeinmsg db 'Starting Up!', 0
;----------------------------
message: ; Dump ds:si to screen.
lodsb ; load byte at ds:si into al
or al,al ; test if character is 0 (end)
jz done
mov ah,0eh ; put character
mov bx,0007 ; attribute
int 0x10 ; call BIOS
jmp message
done:
ret
; --------------------
getkey:
mov ah, 0
int 016h
ret
; --------------------
start:
mov [bootdrv], dl
cld
mov ax,0x7c0
mov ds,ax
mov ax,0x9000
mov es,ax
xor di,di
xor si,si
mov cx,0x200
cli
rep movsb
jmp 0x9000:there
there:
sti
mov ax, STACKSEG
mov ss, ax
mov ax, 0xff
mov sp, ax
mov ax, NEWSEG
mov ds, ax
xor si, si
mov es, ax
xor bp, bp
mov ax, VIDEOSEG
mov gs, ax
mov si,bootmsg ; display our startup message
call message
mov si, a20msg
call message
;--Activating A20 line
clear_buf:
in al, 64h
test al, 02h
loopnz clear_buf
mov al, 0D1h
out 64h, al
clear_buf2:
in al, 64h
test al, 02h
loopnz clear_buf2
mov al, 0dfh
out 60h, al
mov cx, 14h
wait_kbc:
out 0edh, ax
loop wait_kbc
push dword 0
popfd
in al,0x70
or al,0x80
out 0x70,al
call getkey
;--------------------------
mov si, pmodemsg
call message
;--------------------------
push es
xor ax,ax
mov es,ax
xor di,di
mov si,gdtr
mov cx,gdt_end-gdt
rep movsb
pop es
; Switch to pmode
lidt[idtr]
lgdt[gdtr]
mov eax, cr0
inc eax
mov cr0, eax
jmp short flush
flush:
mov bx, 0x10
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
mov ss, bx
jmp dword 0x08:0x90000 + pmode ; far jump
[bits 32]
pmode:
mov ebx, 0x9000 + pmodeinmsg
mov ecx, 0xb8002
call putmsg32
repeat: jmp repeat
;------------PUTMSG32-------------------
putmsg32:
push eax
.continue:
mov byte al, [ebx]
cmp al, 0
jz .end
mov byte al, [ebx]
mov byte [ecx], al
inc ebx
mov byte al, [ebx]
cmp al, 0
jz .end
add ecx, 2
jmp .continue
.end
pop eax
ret
times 510-($-$$) db 0
dw 0AA55h
CAN SOMEONE HELP ME WITH PMODE
Re: CAN SOMEONE HELP ME WITH PMODE
I'm not really good at ASM as of yet but i was wondering at what point it is triple faulting what point does it get to ... also i would suggest trying out BOCHS (at sourceforge) write it to a floppy and have bochs load that boot disk and see where the debugger finds the error. If i was home i would try it but im not right now...
Re: CAN SOMEONE HELP ME WITH PMODE
I also noted both 16 and 32 bit code... i recall reading that certain formats (bin's i believe COFF but im not sure) can not handle both formats. Might want to check that out... Also did you make sure that the code in your file is not over the required size? It may fool u remember that last line is resizing the file to the correct file if it's over the size it will rip some of your code out of there.