Troubleshooting booting custom OS to hardware

Viewed 41

I have been writing a 32 bit operating system (because why not) to run on an old PC. However, whilst the OS(?) is working when run on an emulator, it doesn't run as expected on the aforementioned PC :(

CPU is an Intel Core 2 Quad Q8200 and is 64 bit. The PC i am trying to run it on is a Dell Studio Desktop D540.

When run the screen displays: VGA Display

[ORG 0x7C00]
KERNEL_OFFSET equ 0x1000


mov [BOOT_DRIVE], dl
call clear_screen
call start


head: db "Operating System", 13, 10, 0
loadingkernel: db "Loading Kernel...", 13, 10, 0
BOOT_DRIVE: db 0


start:
mov bp, 0x9000
mov sp, bp
mov si, head
call print

call load_kernel
; call clear_screen
call switch_to_pm   ; Set CPU to 32-bit Protected Mode


print:
mov al, [si]
mov ah, 0x0E
mov bh, 0X00
mov bl, 0x07
cmp al, 0
je print_exit
int 0x10
inc si
jmp print
print_exit:
ret


clear_screen:
mov ah, 0
int 0x10
ret


load_kernel:
mov si, loadingkernel
call print
mov bx, KERNEL_OFFSET
mov dh, 15
mov dl, [BOOT_DRIVE]
call disk_load
ret


%include "disk_load.asm"
%include "gdt.asm"
%include "print_string_pm.asm"
%include "switch_to_pm.asm"



[BITS 32]
BEGIN_PM:   ; Protected mode is now activated and initialised
mov ebx, protmode
call print_string_pm

call KERNEL_OFFSET

jmp $


protmode: db "CPU Has Been Set To 32-Bit Protected Mode", 0


TIMES 510-($-$$) db 0
DW 0xAA55```

Print String PM asm:

```[bits 32]
; Define some constants
VIDEO_MEMORY equ 0xb8000
WHITE_ON_BLACK equ 0x0f
; prints a null - terminated string pointed to by EDX
print_string_pm:
pusha
mov edx, VIDEO_MEMORY ; Set edx to the start of vid mem.
print_string_pm_loop:
mov al, [ebx] ; Store the char at EBX in AL
mov ah, WHITE_ON_BLACK ; Store the attributes in AH
cmp al, 0 ; if (al == 0) , at end of string , so
je print_string_pm_done ; jump to done
mov [edx], ax ; Store char and attributes at current
; character cell.
add ebx, 1 ; Increment EBX to the next char in string.
add edx, 2 ; Move to next character cell in vid mem.
jmp print_string_pm_loop ; loop around to print the next char.
print_string_pm_done:
popa
ret ; Return from the function```
0 Answers
Related