[windows] Readable boot disk

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
KyleL

[windows] Readable boot disk

Post by KyleL »

Programs such as partcopy and copyboot often overwrite all data on the disk, thus making windows and other operating systems not be able to read it seeing as its not stored in a valid FAT12 format. Anyway, I've seen some tricks out there to help fix this up for you:

--make.bat

Code: Select all

nasm -f bin -o boot.bin boot.asm
partcopy boot.bin 0 3 -f0
partcopy boot.bin 3e 1c2 -f0 3e
pause
Along with that you need to make your boot sector skip some bytes, its recommended by http://osdev.neopages.net/tutorials/usingpcopy.php to do that in this way:

--Example 1

Code: Select all

start:
jmp short begin
nop
times 0x3B db 0
The problem I've noticed with this is it doesn't work, on Windows XP at least. I'm not sure as to what may have changed in XP over other versions but this method just doesn't work.

So anyway, I thought it might be to the benifit of many if I post this information here and possibly put a post up if I find the right way to do it, or one of you post if you happen to know.

Thanks,
Kyle LaDuke
KyleL

Re:[windows] Readable boot disk

Post by KyleL »

The visop os seems to be really good, well documented as well. Anyway, I grabbed a copy of that and it seemed to be the only OS I found that actually did this correctly. What it did was the following:

Code: Select all

org 0x7C00

%define FATSECTORS      9
%define BYTESPERSECTOR      512
%define SECTORSPERCLUSTER   1

start:
  jmp begin

OEMName      db 'Visopsys'      ; 03 - 0A OEM Name
BytesPerSect   dw BYTESPERSECTOR   ; 0B - 0C Bytes per sector
SecPerClust   db SECTORSPERCLUSTER   ; 0D - 0D Sectors per cluster
ResSectors   dw 0001h      ; 0E - 0F Reserved sectors
FATs      db 02h          ; 10 - 10 Copies of FAT
RootDirEnts   dw 00E0h      ; 11 - 12 Max. rootdir entries
Sectors      dw 0B40h      ; 13 - 14 Sectors in logical image
Media      db 0F0h              ; 15 - 15 Media descriptor byte
FATSecs      dw FATSECTORS      ; 16 - 17 Sectors in FAT
SecPerTrack   dw 0012h      ; 18 - 19 Sectors per track
Heads      dw 0002h      ; 1A - 1B Number of heads
Hidden      dd 00000000h      ; 1C - 1D Number of hidden sectors
HugeSecs   dd 00000B40h       ; 1D - 20 Real number of sectors
DriveNumber   db 00h         ; 21 - 21 BIOS dr. #
Reserved1   db 00h          ; 22 - 22 ?
BootSignature   db 29h             ; 23 - 23 Signature
VolumeID   dd 00000001h       ; 24 - 27 Volume ID
VolumeName   db 'Visopsys   '   ; 28 - 42 Volume name
FSType      db 'FAT12   '      ; 43 - 4A Filesystem type

begin:
  cli ; disable interrupts
  jmp $

  times 510-($-$$) db 0
  dw 0AA55h
With that code in place it allows the drive to be read and written to by windows using standard FAT12 FS.

-Kyle LaDuke (I hope this possibly helps one of you)
KyleL

Re:[windows] Readable boot disk

Post by KyleL »

Post Reply