flat assembler
Message board for the users of flat assembler.

Index > OS Construction > HDD image

Author
Thread Post new topic Reply to topic
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER
Hi everyone!
Is there any code to create hard disk images?
Post 07 Apr 2011, 13:16
View user's profile Send private message Reply with quote
b1528932



Joined: 21 May 2010
Posts: 287
b1528932
what?
Post 07 Apr 2011, 16:54
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
cod3b453
This is a basic example of how it might look:
Code:
SECTOR_SIZE equ 512

; Sector 0
include 'boot.asm'

align SECTOR_SIZE
; Sector 1
fs_table:

;...

db 'file.name'
dd fs_loader.size ; byte size
dd (fs_loader / SECTOR_SIZE) ; lba

;...

align SECTOR_SIZE
; Sector X
fs_loader:

include 'loader.asm'

fs_loader.size equ $ - fs_loader
; Sector X+1
align SECTOR_SIZE

; ...    
For my own disk images I have a LOT of macros that handle sector size checking, file entry generation and any other data tables I need for a valid image (cd/hd/fd/...).

Note that by including the code (.asm) you can use the labels defined here directly in your code so that at compile-time so you don't have to manually edit values or do things at run time.

Alternatively, you can use "file 'boot.bin'" to include only the assembled binary data; this may be useful as it prevent name clashing in your sources.
Post 07 Apr 2011, 17:01
View user's profile Send private message Reply with quote
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER
I mean like I used code from cod3... on this page http://board.flatassembler.net/topic.php?t=12160
to create .ISO file with FASM, Is there anythink like this for hard disk drives??
Post 07 Apr 2011, 17:02
View user's profile Send private message Reply with quote
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER
cod3b453 wrote:
This is a basic example of how it might look:
Code:
SECTOR_SIZE equ 512

; Sector 0
include 'boot.asm'

align SECTOR_SIZE
; Sector 1
fs_table:

;...

db 'file.name'
dd fs_loader.size ; byte size
dd (fs_loader / SECTOR_SIZE) ; lba

;...

align SECTOR_SIZE
; Sector X
fs_loader:

include 'loader.asm'

fs_loader.size equ $ - fs_loader
; Sector X+1
align SECTOR_SIZE

; ...    
For my own disk images I have a LOT of macros that handle sector size checking, file entry generation and any other data tables I need for a valid image (cd/hd/fd/...).

Note that by including the code (.asm) you can use the labels defined here directly in your code so that at compile-time so you don't have to manually edit values or do things at run time.

Alternatively, you can use "file 'boot.bin'" to include only the assembled binary data; this may be useful as it prevent name clashing in your sources.

oes this code works?
what is th output format?
Post 08 Apr 2011, 11:43
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
cod3b453
That code would work if the contents of boot.asm are correct. BUT it will NOT work for any other OS because it's a format I just made up.

----

You usually need to define a partition table in your boot sector with the boot signature. The sectors after that then depend on the file system (if any) you want to use. Again, you need to define these in the right place. See MBR and optionally GPT documentation for how this works and then any docs for the file system you want.
Post 08 Apr 2011, 17:19
View user's profile Send private message Reply with quote
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER
all right guys, for now I'll try to play with heximal editor and find out the structyure of this image
Post 09 Apr 2011, 04:32
View user's profile Send private message Reply with quote
codelab



Joined: 03 Apr 2006
Posts: 16
Location: Denmark
codelab
Hi BOTO

I by chance posted this here:

http://board.flatassembler.net/topic.php?t=12743

just to see your topic later.
Post 14 Apr 2011, 23:02
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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.