Hi!
have somebody a sample code for a bootloader that loads any sectors, and exicute it? i have written such a bootloader but it didnt work :
[BITS 16]
[ORG 0x7C00]
KERNEL_SIZE equ 76
KERNEL_SEGMENT equ 0x1000
KERNEL_START equ 1
%define LOOPS_1 bp-2
%define CYLINDER bp-4
%define offs bp-6
%define SECTORZ bp-8
%define LOGICAL bp-10
%define seg bp-12
CLI
MOV ax, 0x9000
MOV ss, ax
XOR ax, ax
MOV sp, ax
MOV ds, ax
MOV bp, ax
STI
MOV ax, KERNEL_SEGMENT
MOV es, ax
MOV [seg], ax
MOV bx, 0
MOV [offs], bx
MOV cx, KERNEL_SIZE
MOV [LOOPS_1], cx
MOV ax, 2 ;start at sector2
MOV [LOGICAL], ax
MOV [SECTORZ], ax
MOV ax, 0
MOV [CYLINDER], ax
main_loop:
MOV [LOOPS_1], cx ;take the loopvar to the logical sector number
;MOV ax, [LOGICAL] ;Cylinder
;MOV bx, 36
;MOV dx, 0
;DIV bx
;MOV [CYLINDER], ax
MOV dx, 18 ;set TRACK 0 if TRACK is 18
CMP dx, [SECTORZ]
JE set_null
fail:
;read the sector
MOV ax, [seg]
MOV bx, [offs]
MOV ah, 2
MOV al, 1
MOV ch, [CYLINDER]
MOV cl, [SECTORZ]
MOV dx, 0
INT 0x13
JC fail
MOV cx, [LOOPS_1]
MOV al, 1
ADD [LOGICAL], al
ADD [SECTORZ], al
MOV al, 32
ADD [seg], al
MOV ax, 512
ADD [offs], al
LOOP main_loop;
JMP KERNEL_SEGMENT:0x0000
set_null
MOV ah, 0x0e
MOV al, '.'
MOV bx, 0x0004
INT 0x10
MOV dx, 1
MOV [SECTORZ], dx
ADD [CYLINDER], dx
JMP fail
i have compiled it with nasm boot.asm -o boot -f bin
i have also written a C programm that copies the bootloader on the floppy this programm adds the boot signature...
a bootloader...
Re: a bootloader...
Hello,
if you already have to post the same problem in multiple fora you should at least include a link to the other threads. Otherwise people here just waste their time explaining stuff that you were already told in some other board. Also note that a lot of users - like me for example - actually frequent several of the os development boards..
osdcom
mega-toyo
regards,
gaf
if you already have to post the same problem in multiple fora you should at least include a link to the other threads. Otherwise people here just waste their time explaining stuff that you were already told in some other board. Also note that a lot of users - like me for example - actually frequent several of the os development boards..
osdcom
mega-toyo
regards,
gaf