flat assembler
Message board for the users of flat assembler.

Index > OS Construction > bootloader to disk:

Author
Thread Post new topic Reply to topic
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 30 Aug 2007, 01:17
I am trying to load my bootloader to a disk and keep the disk intact to load files on with windows..

I have read that I can with debug-

debug boot.bin
-w 0000 0 0 1 ;write to sector 0 drive a:
-q

then format:

c:\format a: /U

I am not sure if it is the debug or version of format I am using?

or is there a utility out there that would do this?

I am trying to save time from having to write one..

Thanks in advance for everyones help!
Post 30 Aug 2007, 01:17
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 30 Aug 2007, 05:23
after adding bootsector with this way (boot.bin should be correct!) other content of the floppy stay intact.

next usage of format not neccessary - it will remove files from disk.
Post 30 Aug 2007, 05:23
View user's profile Send private message Visit poster's website Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 30 Aug 2007, 05:55
I have tried it both ways and its not working...
the boot loader is 512 bytes..

Any suggestions?
Post 30 Aug 2007, 05:55
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 30 Aug 2007, 06:09
show your boot.bin: binary or source (both even better)
---------
the matter is:
bootsector contain boot code and disk geometry table. usually templates contain geometry for standart 1.44 floppy. in case this table is damaged or not match to disk parameters then disk may be not recognized.
Post 30 Aug 2007, 06:09
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 30 Aug 2007, 06:13
dosin wrote:
debug boot.bin
-w 0000 0 0 1 ;write to sector 0 drive a:
-q

wait! it's wrong! should be:
-w 100 0 0 1

with "debug boot.bin" boot.bin is loaded at 100h offset (as dos com file)!

_________________
UNICODE forever!
Post 30 Aug 2007, 06:13
View user's profile Send private message Visit poster's website Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 30 Aug 2007, 06:49
C:\>debug boot.bin
-w 100 0 0 1
-q

C:\>a:
The volume does not contain a recognized file system.
Please make sure that all required file system drivers are loaded and that the volume is not corrupted.

C:\>

This is what I get when I use 100

I did this along time ago and used w 100 0 0 1
Then formated the floppy with format a: /U
The /U kept it from writing over the boot sector..

I think its this version of format..
Am I missing anything or maybe the order is wrong?
This has to be in to top of the file right?

VolumeLabel DB "NO NAME " ; 0x2B
BytesPerSector DW ? ; 0x0B
SectorsPerCluster DB ? ; 0x0D
ReservedSectors DW ? ; 0x0E
NumberOfFATs DB ? ; 0x10
RootEntries DW ? ; 0x11
TotalSectors DW ? ; 0x13
Media DB ? ; 0x15
SectorsPerFAT DW ? ; 0x16
SectorsPerTrack DW ? ; 0x18
HeadsPerCylinder DW ? ; 0x1A
HiddenSectors DD ? ; 0x1C
TotalSectorsBig DD ? ; 0x20
Post 30 Aug 2007, 06:49
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 30 Aug 2007, 07:19
disk has to contain valid filesystem (or be formatted) before writing bootsector, otherwise it will have (if yes at all) new bootsector, but bad other structure.

do this:

1. format a:
2.copy some files to a:
3. debug
- l 100 0 0 1
- w 100 0 0 1
- q
4.check files at a:

this operation reads existing boot sector to ds:100 offset, and then writes it back to floppy. if it's work ok, then problem is with boot.bin .

also you may check boot sector contents after reading in the range 100 - 2ff and compare with your own:
- d 100

system needs only that table in boot sector (bpb?) to recognize disk, all other (FATs, root directory and file area) situated in other sectors.
Post 30 Aug 2007, 07:19
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 30 Aug 2007, 07:33
dosin wrote:

Am I missing anything or maybe the order is wrong?
This has to be in to top of the file right?

VolumeLabel DB "NO NAME " ; 0x2B
BytesPerSector DW ? ; 0x0B
SectorsPerCluster DB ? ; 0x0D
ReservedSectors DW ? ; 0x0E
NumberOfFATs DB ? ; 0x10
RootEntries DW ? ; 0x11
TotalSectors DW ? ; 0x13
Media DB ? ; 0x15
SectorsPerFAT DW ? ; 0x16
SectorsPerTrack DW ? ; 0x18
HeadsPerCylinder DW ? ; 0x1A
HiddenSectors DD ? ; 0x1C
TotalSectorsBig DD ? ; 0x20

ABSOLUTELY! all your bpb fields are "?", in other words are filled with zero.
should be:
VolumeLabel DB "NO NAME " ; 0x2B
BytesPerSector DW 512 ; 0x0B
SectorsPerCluster DB 1 ; 0x0D
etc...

this is an example for 1.44 (constants are separate for easy modify to another floppy format, eg. 2.88, 720 or so)

Code:
_bs = 512   ; bytes per sector
_st = 18    ; sectors per track
_hd = 2     ; heads
_tr = 80    ; tracks
_rd = 224   ; root directory entries
_ft = 2     ; fats
_sf = 9     ; sectors per fat
_sc = 1     ; sectors per claster

    org 7C00h
    jmp start
    nop

    db  "HE-HE OS";     ; 8                        BPB
    dw  _bs             ; b/s
    db  _sc             ; s/c  
    dw  _rs             ; rs
    db  _ft             ; fats
    dw  _rd             ; rde
    dw  _tr * _hd * _st ; as 
    db  0F0h            ; media
    dw  _sf             ; s/fat
    dw  _st             ; s/t
    dw  _hd             ; h
    dd  0               ; hs
    dd  0               ; --
    db  0               ; drv
    db  0               ; --
    db  29h             ; ebr
    dd  0               ; sn
    db  "NO NAME    ";  ; 11
    db  "FAT12   ";     ; 8

start:
    

_________________
UNICODE forever!
Post 30 Aug 2007, 07:33
View user's profile Send private message Visit poster's website Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 30 Aug 2007, 22:09
Ty - I have it working now!
Post 30 Aug 2007, 22:09
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.