flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Adding Kernel file to Floppy

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
if you don't what to use the real floppy under DOS, try this
int13v.inc

if you want to write files on drive sectors, you can try that:
bootwriter.com
Post 05 May 2011, 13:38
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
typedef wrote:
well, iam trying to avoid emulators right now.

@DEX4U yes, i'd like to have the fasm version.

You can get the fasm ver, from dexos source code zip 'DexSource.zip'

From my down load page http://www.dex-os.com/downloadpage.htm

In the zip is a folder called bootprog and in there, is a file called boot12.asm that will assemble with fasm.

You can also test your OS by get a dexos floppy image and removing all the dexos programs and putting your kernel32.exe file on the floppy/image and rebooting.
Post 05 May 2011, 15:19
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
i was really wondering as to how M$ writes it's M$-DOS startup disk that they write 15 files to it with a bootable sector still intact.
Post 05 May 2011, 17:44
View user's profile Send private message Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
typedef wrote:
i was really wondering as to how M$ writes it's M$-DOS startup disk that they write 15 files to it with a bootable sector still intact.

As i get it, once you write the bootsector, and do not format the drive, the bootsector will be still there. As common programs dont acces the bootsector.
Post 05 May 2011, 17:52
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
egos wrote:
Save BPB structure (or rewrite it with same values).

Does that mean I can just visibly copy and paste the files to the floppy if I add the BPB structure to the start of my bootloader. ?
And also, that program I was referred to does not help. Although I cracked it so I don't have to register.
Post 05 May 2011, 22:46
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
Enko wrote:
typedef wrote:
i was really wondering as to how M$ writes it's M$-DOS startup disk that they write 15 files to it with a bootable sector still intact.

As i get it, once you write the bootsector, and do not format the drive, the bootsector will be still there. As common programs dont acces the bootsector.


Which if you don't format it, you can no longer access it. Confused
Post 05 May 2011, 22:50
View user's profile Send private message Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
typedef wrote:
egos wrote:
Save BPB structure (or rewrite it with same values).

Does that mean I can just visibly copy and paste the files to the floppy if I add the BPB structure to the start of my bootloader. ?
And also, that program I was referred to does not help. Although I cracked it so I don't have to register.

,
the bpb should be inside the bootloader, so this way windows can recognize the format of the drive.


that is why
the first three bytes 6B 3C and 90 disassemble to JMP SHORT 3C NOP. (The 3C value may be different.) The reason for this is to jump over the disk format information (the BPB and EBPB). Since the first sector of the disk is loaded into ram at location 0x0000:0x7c00 and executed, without this jump, the processor would attempt to execute data that isn't code.

http://wiki.osdev.org/FAT12
Post 06 May 2011, 00:21
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
Enko wrote:

the bpb should be inside the bootloader, so this way windows can recognize the format of the drive.


Why windows, I thought when I boot from my Loader there won't be windows anywhere ? Shocked

Or Do you mean after I.....

can you explain it again, sorry Sad
Post 06 May 2011, 00:41
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
Thank you all for helping out.
It seems like I have to go with VirtualPC now. I used an old Software I had in my PC long time ago. MagicISO, is the name. I am now able to make ISOs and boot from VPC....

I'll also crack this MagicISO because it is bugging me about registration.


So, thanks to you all


Last edited by typedef on 06 May 2011, 04:31; edited 1 time in total
Post 06 May 2011, 02:27
View user's profile Send private message Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
typedef wrote:
Enko wrote:

the bpb should be inside the bootloader, so this way windows can recognize the format of the drive.


Why windows, I thought when I boot from my Loader there won't be windows anywhere ? Shocked

Or Do you mean after I.....

can you explain it again, sorry Sad


when I sad windows, I meant any operative sistem.
The bootloader is writen in the first sector of the disk, but in the same sector, is writen the FAT format. So, if you write a bootloader without the fat headers, the disk wont be recognized, but it doesnt meen it will not boot your os.

The flopy should be somthing like this:

JUMP ADRESS
FAT HEADER
FAT DIRECTORIES
FILES

If you have a boot with fat12 format, than you can add files using any operativ sistem, like windows to the disk. But then, it doesnt mean anything for your os util you develope a filesistem.
And to have a runing filesistem, i guess first you will need some kind of basic memory manager.


So, just for starting, i think you dont need to burn your brain with the fat12/16 thing.

you can just do this:


Main flopy image:



Code:
format binary
include  "boot.asm"
include  "kernel.asm"
db     (1440*1024) - $  dup 0
    

this will ensamble the file boot.asm and kernel.asm and generate a single file with both of them merged. then writes 0 till the size is 1.44mb. (at least it should, but thears some bug, its actually 1.34... xd)


the boot.asm
Code:
use16
        org     0
   jmp     0x07C0:start
;read from flopy the kernel and load it to memory
;init the things you need to init
;jump protected mode perhaps?
;protected mode switch          
     cli     
    lgdt    [gdtr]
      mov     eax, cr0
    or      al, 1
       mov     cr0, eax        
    jmp     pword 0x00008:0x10000       ;jump to kernel 
    



and the kernel file is:
Code:
use32                             
    org     0x10000
     include "kernel.inc"
kernel:
        here is the kernel in protected mode
    




if you wirte the image on a flopy, no program would recognize it becouse it doesnt have any format. lets say its RAW. But the os will work fine, it doesnt metter for your os until you have to build a FileSistem.



and one other thing.
In microsoft VirtualPC the flopy size should be exact 1.44mb or it will not acept the binary image.
wmware will acept any flopy image, it doesn-t care the size.
virtualbox is the worth, it will not acept a flopy image without a valid format... obviosly its not designed for lame os developers xD



I couldn-t explain my self better, becouse it was 2 years ago I tried to write an os.
I started reading first the Intel Manuals.
Then about protected mode.

Then maked a bootloader that loads the kernel, switchs to protected mode and then jumps to the kernel.
The kernel was composed by In out routins, keyboard input, screen output. nothing else.
The next step shoulded be memory manager, ther filesistem and then executable format. but I hadn-t time to continue.
bye the way, stop cracking abandonware software. Laughing
Post 06 May 2011, 03:53
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
actually i just included my small kernel at the end of my bootloader and copy it to 08000h byte by byte and then jump there.
from there it will init other more things.
my kernel takes up more of the 512 than the bootloader does. Very Happy
Post 07 May 2011, 05:07
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.