This is more of a question of how the GDT works, than if anything else... I recall in one of my earlier threads I was having trouble with the GDT, and I think it was Artlav that told me I needed to go up two bytes(I think it was two bites) from the GDT_Descriptor, and add 600 to the value of it, which didn't make much sense to me.
Also, he told me to put in a second org into my code that was at memory address 600. I'm sorry if I'm making myself seem stupid to y'all with all these questions, I just still don't understand how all of this is fitting together.
Here's the old code in case anyone wants to take a gander at it:
Rhynload.asm
;BOOTSTART
org 7C00h
jmp start
message db 'Loading RhynOS...',13,10,0
start:
xor ax, ax
mov ds, ax
mov si, message
call bios_print
load_os:
mov ax, 0060h
mov es, ax
mov bx, 0000h
mov ah, 02h
mov al, 5
mov ch, 0
mov cl, 2
mov dh, 0
;mov dl, 0 ; Not sure if needed, been told that dl already contains the drive that was booted on
int 13h
jmp 0060h:0000h
bios_print:
lodsb
or al, al
jz done
mov ah, 0x0E
int 0x10
jmp bios_print
done:
call load_os
;BOOTEND
times 510-($-$$) db 0
dw 0xAA55
RhynOS.asm
org 0000h
use16
cli
mov ax, 0060h
mov ds, ax
add dword [gdt_descriptor+2], 600h
lgdt [gdt_descriptor]
mov eax, cr0
or eax, 1
mov cr0, eax
jmp 08h:clear_pipe
gdt:
dd 0, 0
gdt_code:
db 0FFh, 0FFh, 0, 0, 0, 10011010b, 11001111b, 0
gdt_data:
db 0FFh, 0FFh, 0, 0, 0, 10010010b, 11001111b, 0
gdt_end:
gdt_descriptor:
dw gdt_end - gdt - 1
dd gdt
org 0600h+$
use32
clear_pipe:
mov ax, 10h
mov ds, ax
mov ss, ax
mov esp, 090000h
;ACTUAL KERNEL CODE STARTS HERE
mov si, WelMsg
call PrintFunc
call Reroute_PICs
lidt [idtp]
sti
GetInput:
int 0x21
cmp al, 02
je DoClrScrn
jmp GetInput
DoClrScrn:
call ClrScrn
mov si, CmdStart
call PrintFunc
;KERNEL CODE ENDS HERE
infinite_loop:
jmp infinite_loop
times 668-($-$$) db 0
include 'interrupts.inc'
WelMsg db "Welcome to RhynOS! Press 1 To Continue.", 0
Thank you all again for your time.