I made a simple Operating System and I have problem with running kernel, Actually Kernel Prints Nothing.
BootSector :
bits 16
org 0x7c00 ; 0x7c00 > Boot & 0x7c00 + 512 (0x7e00) > Kernel
%ifdef WITH_BPB
%include "BIOSParameterBlock.inc"
%endif
boot_continue:
mov ax, 0x1000
mov ss, ax ;SS:SP > 0x1000:0xfffe (0x1fffe)
mov ax, 0xfffe
mov sp, ax
cld
xor ax, ax
mov ds, ax ;DS:SI > 0x0000:0x0001 (0x00001)
mov bx, ax
mov ax, 0x0001 ;ES:BX > 0x07e0:0x0000 (0x07e00)
mov si, ax
mov ax, 0x07e0
mov es,ax
Kernel2Memory:
mov al, 0x01 ; Load 1 sectors
mov ah, 0x02 ; Load disk data to ES:BX
mov cl, 0x01 ; Sector = 1
mov ch, 0x00 ; Cylinder = 0
mov dh, 0x00 ; Head = 0
int 13h ; Read
jc Kernel2Memory
jmp 0x07e0:0x0000
TIMES 510-($-$$) db 0
dw 0xaa55
incbin "Kernel.bin"
TIMES 1024*1440-($-$$) db 0x00
The BIOS Parameter Block which will add to the first of the boot sector (BIOSParameter.inc):
global bpb_disk_info
jmp short boot_continue
nop
bpb_disk_info:
; Dos 4.0 EBPB 1.44MB floppy
OEMname: db "mkfs.fat" ; mkfs.fat is what OEMname mkdosfs uses
bytesPerSector: dw 512
sectPerCluster: db 1
reservedSectors: dw 1
numFAT: db 2
numRootDirEntries: dw 224
numSectors: dw 2880
mediaType: db 0xf0
numFATsectors: dw 9
sectorsPerTrack: dw 18
numHeads: dw 2
numHiddenSectors: dd 0
numSectorsHuge: dd 0
driveNum: db 0
reserved: db 0
signature: db 0x29
volumeID: dd 0x2d7e5a1a
volumeLabel: db "NO NAME "
fileSysType: db "FAT12 "
And the kernel code let's say it print a simple 'A' character (Kernel.bin):
org 0x7e00
mov al,0x41
mov ah,0x0e
mov bl,0x07
mov bh,0x00
int 0x10
times 512-($-$$) db 0
it's prints nothing. I read lots of problems and solutions in StackOverflow and debugged it as much I could (I'm new to this field). I'll be thankful if someone helps me with the problem.
the command which I use:
nasm -fbin Kernel.asm -o Kernel.bin
nasm -DWITH_BPB -f bin Boot.asm -o OS.img
then run it as a floppy disk in VirtualBox
Thanks In Advance