From what I can gather from some initial debugging, the "bootsector" variable on the SDEmu struct is getting either overwritten or changed. The init_with_directory() function has:
Code: Select all
memcpy(&bootsector.bootjmp, bootjmp, 3);
memcpy(&bootsector.oem_name, oem_name, 8);
bootsector.bytes_per_sector = 512;
bootsector.sectors_per_cluster =64; //32K cluster size
bootsector.reserved_sector_count = 1;
bootsector.table_count = 2;
The typedef reads:
Code: Select all
typedef struct fat_BS
{
uint8_t bootjmp[3];
uint8_t oem_name[8];
uint16_t bytes_per_sector;
uint8_t sectors_per_cluster;
uint16_t reserved_sector_count;
uint8_t table_count; //number of copies of FAT
But when I run the emulator, and it reads the bootrecord via SPI, in the byte output from SPI_READ_SINGLE_BLOCK in update_spi() looks like:
Code: Select all
0000: EB 3C 90 75 7A 65 6D 53 44 65 00 00 00 02 40 00 | .<.uzemSDe....@.
from my understanding, that should read:
Code: Select all
0000: EB 3C 90 75 7A 65 6D 53 44 65 02 00 40 00 01 02 | .<.uzemSDe..@...
Which is very odd, especially if I am reading the code right and doing my math right.
Thoughts? Am I completely off base on that?
By the way, this was all on the code checked out via svn from the google site.