News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Low-level Disk Access

Started by MichaelW, July 15, 2012, 08:01:12 AM

Previous topic - Next topic

ROBOSPOOK

Most of the time only one byte is changed.. .it is located at 1beh  and is 80h the sector is bootable. The other partitions are located 16h after that  or 1ceh  and that one is likewise only 80h if it is bootable and it will be 00h otherwise.

This program does exactly what I created in 16 bit C some 20 years ago. The new WIN7/8 information is somewhat different than the old win98/me etc. 

MichaelW, I admit to only being a novice at 32 bit ASM but there are way too many things that are a mystery in your program.  I need to do some more reading and learning first but when I am ready are you available for questions ?

Thanks

Robo

dedndave

disk drives don't read and write individual bytes
they read and write whole sectors
for the most part, that's 512 byte sectors

as for reliability...
probably more reliable to read and write a sector, now and then
than it is to write it one time and forget about it

ROBOSPOOK

that's correct it writes a whole sector at a time but only ONE or TWO bytes are changed to change the boot partition

MichaelW

Quote from: sinsi on June 04, 2014, 08:36:49 AM
I would imagine that changing bytes in the mbr once per boot would be less stressful than all the reading/writing that happens in a normal OS session.

I agree, but it could potentially be more than once per boot, and at least the older of two mechanisms for dealing with grown defects is not available for a MBR/boot sector. Can the drive's automatic defect management remap a MBR? And is the MBR more or less vulnerable to damage than the other sectors?
Well Microsoft, here's another nice mess you've gotten us into.

sinsi

Quote from: MichaelW on June 04, 2014, 02:22:38 PM
Can the drive's automatic defect management remap a MBR? And is the MBR more or less vulnerable to damage than the other sectors?
I don't see why the MBR is any different (apart from its location as the first sector) since sector remapping is internal to the drive, even Windows can't see remapped sectors. SMART has a count of remapped sectors but AFAIK no way of finding out which ones. Possibly WD/Seagate could query the controller but that would be secret information  :badgrin: like a lot of SMART info.

I have had faulty drives from WD, when I use WD Diagnostics to write empty sectors the drive seems to be good as new but I wouldn't trust the bad sector count to increase over time.
🍺🍺🍺

dedndave

the first 2 sectors must be functional - they cannot be remapped
otherwise, the drive is trash

ROBOSPOOK

MichaelW,
   Thank you for this fine example of low level code!  By the way I am still trying to  understand all of the sections of code and as you might imagine I have several questions if you are willing.
I am.. was by trade an electrical engineer that ended up doing geeky computer stuff so my background is in hardware and that is how I learned to write device drivers in assembly. What I have come to realize is that 2014 assembly language is less a low level language and more a high level language than ever. The structures of your program proves that.. it is also a very cryptic language to someone that is an old school assembly language programmer which is very problematic... at least to me. 

Again.. WELL DONE

ROBO