Instead of trial and error, patching here and there to fix that issue,
bluemoon wrote:You should read more of different addressing methods and their transformation formula.
bluemoon wrote:You should read more of different addressing methods and their transformation formula.
Code: Select all
[BITS 16]
[ORG 0x7C00]
jmp start
start:
mov ax,0x1000
mov es,ax
mov bx,0x0000
xor ax,ax
mov ah,2
mov al,1
mov ch,0
mov cl,2
mov dh,0
mov dl,0
int 0x13
jmp 0x1000:0x0000
TIMES 510-($-$$) db 0
db 0x55
db 0xAA
Code: Select all
[ORG 0]
jmp main
gdt_t:
;----------------
dd 0
dd 0
;----------------
dw 0xFFFF
dw 0
db 0
db 10011010b
db 11001111b
db 0
;----------------
dw 0xFFFF
dw 0
db 0
dw 10010010b
db 11001111b
db 0
end:
gdt:
cli
mov ax,cs
shl eax,4
add eax,gdt_t
mov [base],eax
mov ax,0
mov ds,ax
lgdt [addr]
ret
addr:
dw end - gdt_t -1
base dd 0
main:
call gdt
mov eax,cr0
or eax,1
mov cr0,eax
jmp 0x08:begin
bits 32
begin:
cli
hlt
sumanx wrote:Code descriptor is at 0x08, it should work??
Welcome to kernel land: What you see isn't what the machine sees. If it crashes, your code has a bug. Stop looking for reasons why it "should" work and look for why it doesn't. This is through debugging. If you don't have a debugger, get one.it should work??