Well, I finally came back to Windows 7 and I get Virtual Floppy Drive, Microsoft Virtual PC and PARTCOPY.
I made a bootloader that loads a second stage from floppy disks and the second stage is more like a "Hello world" program
I compiled:
nasm -f bin boot.asm -o boot.bin
nasm -f bin stage2.asm -o stage2.bin
Then I made virtual floppy drive A and I copy the stuff...
copy stage2.bin A:\stage2.bin
I make it bootable with
partcopy boot.bin 0 200 -f0
All works, but after that if I try to go to drive A, it says "unknown filesystem" and if I run the command format A:, it says the current filesystem is RAW and the new filesystem is FAT12
If I format, I lose the stage2 and the bootloader. When I put them back, the same thing happens again and again...
Any help please anyone? Thanks in advance!
I can't use PARTCOPY
Re: I can't use PARTCOPY
Hello,
partcopy boot.bin 0 200 -f0 is wrong. After formatting the disk you should merge your boot record with the existing file system structures like so,You can also easily write your own program (you will need to for the installer.)
partcopy boot.bin 0 200 -f0 is wrong. After formatting the disk you should merge your boot record with the existing file system structures like so,
Code: Select all
partcopy bootsect.bin 0 3 -f0 0
partcopy bootsect.bin 3E 1C2 -f0 3E
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: I can't use PARTCOPY
Sorry but instead of fixing the problem, this actually prevented my floppy from booting correctly at all. Now, all it just does is have that flashing underscore in text mode. It used to show a message before it loads.neon wrote:Hello,
partcopy boot.bin 0 200 -f0 is wrong. After formatting the disk you should merge your boot record with the existing file system structures like so,You can also easily write your own program (you will need to for the installer.)Code: Select all
partcopy bootsect.bin 0 3 -f0 0 partcopy bootsect.bin 3E 1C2 -f0 3E
But anyways, thanks for trying to help, I appreciate it
Re: I can't use PARTCOPY
DOS and Windows expect a few things in the boot sector, namely a short jump instruction that skips over the BPB.omar wrote: All works, but after that if I try to go to drive A, it says "unknown filesystem" and if I run the command format A:, it says the current filesystem is RAW and the new filesystem is FAT12
If I format, I lose the stage2 and the bootloader. When I put them back, the same thing happens again and again...
This is what I have at the beginning of my FAT12 boot sector (the BPB values are not initialized here because I take them as-is from a formatted floppy):
Code: Select all
[BITS 16]
[SECTION .text]
[ORG 0]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Boot sector starts here ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
jmp short start
nop
bsOemName DB "BootProg" ; 0x03
;;;;;;;;;;;;;;;;;;;;;
;; BPB starts here ;;
;;;;;;;;;;;;;;;;;;;;;
bpbBytesPerSector DW ? ; 0x0B
bpbSectorsPerCluster DB ? ; 0x0D
bpbReservedSectors DW ? ; 0x0E
bpbNumberOfFATs DB ? ; 0x10
bpbRootEntries DW ? ; 0x11
bpbTotalSectors DW ? ; 0x13
bpbMedia DB ? ; 0x15
bpbSectorsPerFAT DW ? ; 0x16
bpbSectorsPerTrack DW ? ; 0x18
bpbHeadsPerCylinder DW ? ; 0x1A
bpbHiddenSectors DD ? ; 0x1C
bpbTotalSectorsBig DD ? ; 0x20
;;;;;;;;;;;;;;;;;;;
;; BPB ends here ;;
;;;;;;;;;;;;;;;;;;;
bsDriveNumber DB ? ; 0x24
bsUnused DB ? ; 0x25
bsExtBootSignature DB ? ; 0x26
bsSerialNumber DD ? ; 0x27
bsVolumeLabel DB "NO NAME " ; 0x2B
bsFileSystem DB "FAT12 " ; 0x36
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Boot sector code starts here ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
start:
Re: I can't use PARTCOPY
Hello,
Format the disk image, then install the boot record correctly in a way as to not overwrite the file system structures (the Bios Parameter Block) that was installed by the formatting software. Make sure that you have reserved space in your boot record file for the BPB.
That is fine. What I provided is what you should be using in order to maintain proper formatting structure. It is the responsibility of the formatting software to determine proper configuration of the BPB structure not your installer. If it causes additional problems it indicates the problem is elsewhere.omar wrote:Sorry but instead of fixing the problem, this actually prevented my floppy from booting correctly at all. Now, all it just does is have that flashing underscore in text mode. It used to show a message before it loads.
Format the disk image, then install the boot record correctly in a way as to not overwrite the file system structures (the Bios Parameter Block) that was installed by the formatting software. Make sure that you have reserved space in your boot record file for the BPB.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: I can't use PARTCOPY
That only means that either your bootloader does not support FAT in the first place - in which case you'll be stuck with this behaviour, or your BPB layout isn't properly filled. You can "steal" it from a formatted image as Neon does, but since a floppy layout is known and fixed you can just as easily incorporate it in the bootloader code itself so you don't have to do any tricky cutting.omar wrote:All works, but after that if I try to go to drive A, it says "unknown filesystem" and if I run the command format A:, it says the current filesystem is RAW and the new filesystem is FAT12
The best way to check is to grab the bootsector from a floppy that is formatted, and check if every meaningful byte is set in your code as well - in the exact same position.
Re: I can't use PARTCOPY
Yeah thanks, it works!alexfru wrote:DOS and Windows expect a few things in the boot sector, namely a short jump instruction that skips over the BPB.omar wrote: All works, but after that if I try to go to drive A, it says "unknown filesystem" and if I run the command format A:, it says the current filesystem is RAW and the new filesystem is FAT12
If I format, I lose the stage2 and the bootloader. When I put them back, the same thing happens again and again...
This is what I have at the beginning of my FAT12 boot sector (the BPB values are not initialized here because I take them as-is from a formatted floppy):
Code: Select all
[BITS 16] [SECTION .text] [ORG 0] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Boot sector starts here ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; jmp short start nop bsOemName DB "BootProg" ; 0x03 ;;;;;;;;;;;;;;;;;;;;; ;; BPB starts here ;; ;;;;;;;;;;;;;;;;;;;;; bpbBytesPerSector DW ? ; 0x0B bpbSectorsPerCluster DB ? ; 0x0D bpbReservedSectors DW ? ; 0x0E bpbNumberOfFATs DB ? ; 0x10 bpbRootEntries DW ? ; 0x11 bpbTotalSectors DW ? ; 0x13 bpbMedia DB ? ; 0x15 bpbSectorsPerFAT DW ? ; 0x16 bpbSectorsPerTrack DW ? ; 0x18 bpbHeadsPerCylinder DW ? ; 0x1A bpbHiddenSectors DD ? ; 0x1C bpbTotalSectorsBig DD ? ; 0x20 ;;;;;;;;;;;;;;;;;;; ;; BPB ends here ;; ;;;;;;;;;;;;;;;;;;; bsDriveNumber DB ? ; 0x24 bsUnused DB ? ; 0x25 bsExtBootSignature DB ? ; 0x26 bsSerialNumber DD ? ; 0x27 bsVolumeLabel DB "NO NAME " ; 0x2B bsFileSystem DB "FAT12 " ; 0x36 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Boot sector code starts here ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; start: