|
From: David G. <dga...@gm...> - 2018-08-02 08:20:45
|
2018-08-01 22:25 GMT+02:00 Roger Burrows <an...@xp...>: > Indeed, when the length is odd, the last bytes are handle incorrectly, but I > wasn't able to figure out a simple way of forcing an odd length to a device for > testing. But that's a separate bug, and wouldn't cause any problems with > memory sticks AFAICS. The bug is that the entire sector is byte-swapped. > > To prove it, first I wrote a simple program that uses Rwabs() to read the boot > sector of a FAT16 file system into both an unaligned & a word-aligned buffer. > The results are different: all of the data in the unaligned buffer is > byte-swapped. > > Having done that, I wrote another program using Rwabs() to write to a sector > using both aligned and unaligned buffers, and to read back the contents into a > word-aligned buffer. Again, the bytes are swapped when the sector is written > from the unaligned buffer. > > It's probably faster for you to write the programs yourself, but if you need > them, I can dig them out. Be warned, they are hacks of other programs so the > source is a bit ugly, and they are written for LatticeC. > Thanks for the explanation! I'll fix this. |