I understand that. What I don't understand is how the host does that, and how the device know what has been done. My guess is that the host uses the SCSI command write 10, but as far as I can debug here, I cannot see this happening.
This is my root directory table:
// FAT12 Root directory entry constants
const unsigned char RootDirEntry[DIR_ENTRY] = {
'S', '9', '7', '0', '0', '-', 'D', 'E', 'V', ' ', ' ',
0x28,
0x00,
0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,0x00,0x00,
//Files
//'D', 'I', 'R', '1', ' ', ' ', ' ', ' ', ' ', ' ', ' ',0x10,0x00,0x00,0x00,0x00,
//0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
'E', 'X', 'E', 'C', '-', 'D', 'E', 'V', // (8 bytes) DOS file name
'T', 'S', 'X', // (3 bytes) DOS file extension
0x20, // (1 byte) File Attributes
0x18, // (1 byte) Reserved
0xBC, // (1 byte) Create time, fine resolution: 10ms units, values from 0 to 199.
0x60,0x34, // (2 bytes) Create time. The hour, minute and second
0xD8,0x04, // (2 bytes) Create date
0xD8,0x3C, // (2 bytes) Last access date
0x00,0x00, // (2 bytes) EA-Index
0x60,0x34, // (2 bytes) Last modified time;
0xD8,0x3C, // (2 bytes) Last modified date;
FIRST_CLUSTER_FILE1,0x00, // (2 bytes) Start of file in clusters in FAT12 and FAT16.
0x00,0x80,0x03,0x00, // (4 bytes) File size in bytes.
'E', 'P', 'R', 'O', 'M', ' ', ' ', ' ', // (8 bytes) DOS file name
'B', 'I', 'N', // (3 bytes) DOS file extension
0x20, // (1 byte) File Attributes
0x18, // (1 byte) Reserved
0xBC, // (1 byte) Create time, fine resolution: 10ms units, values from 0 to 199.
0x60,0x34, // (2 bytes) Create time. The hour, minute and second
0xD8,0x04, // (2 bytes) Create date
0xD8,0x3C, // (2 bytes) Last access date
0x00,0x00, // (2 bytes) EA-Index
0x60,0x34, // (2 bytes) Last modified time;
0xD8,0x3C, // (2 bytes) Last modified date;
FIRST_CLUSTER_FILE2,0x00, // (2 bytes) Start of file in clusters in FAT12 and FAT16.
0x00,0x00,0x04,0x00, // (4 bytes) File size in bytes.
// 'T', 'A', 'B', 'L', 'E', ' ', ' ', ' ', 'D', 'A', 'T',0x20,0x18,0xbc,0x41,0x97, //16 bytes 0 - 15
//0x37,0x38,0x37,0x38,0x00,0x00,0x60,0x44,0xce,0x3c,0x02,0x00,0x00,0xD0,0x07,0x00, //16 bytes 16 - 31
};
FIRST_CLUSTER_FILE1 = 2 and FIRST_CLUSTER_FILE2 = 226
When I delete EPROM.bin this is what I get:
pbBuf[0]= 53
pbBuf[1]= 39
pbBuf[2]= 37
pbBuf[3]= 30
pbBuf[4]= 30
pbBuf[5]= 2d
pbBuf[6]= 44
pbBuf[7]= 45
pbBuf[8]= 56
pbBuf[9]= 20
pbBuf[10]= 20
pbBuf[11]= 28
pbBuf[12]= 0
pbBuf[13]= 0
pbBuf[14]= 0
pbBuf[15]= 0
pbBuf[16]= 0
pbBuf[17]= 0
pbBuf[18]= 0
pbBuf[19]= 0
pbBuf[20]= 0
pbBuf[21]= 0
pbBuf[22]= 0
pbBuf[23]= 0
pbBuf[24]= 0
pbBuf[25]= 0
pbBuf[26]= 0
pbBuf[27]= 0
pbBuf[28]= 0
pbBuf[29]= 0
pbBuf[30]= 0
pbBuf[31]= 0
-------------------pbBuf[32]= e5
pbBuf[33]= 58
pbBuf[34]= 45
pbBuf[35]= 43
pbBuf[36]= 2d
pbBuf[37]= 44
pbBuf[38]= 45
pbBuf[39]= 56
pbBuf[40]= 54
pbBuf[41]= 53
pbBuf[42]= 58
pbBuf[43]= 20
pbBuf[44]= 18
pbBuf[45]= bc
pbBuf[46]= 60
pbBuf[47]= 34
pbBuf[48]= d8
pbBuf[49]= 4
pbBuf[50]= d8
pbBuf[51]= 3c
pbBuf[52]= 0
pbBuf[53]= 0
pbBuf[54]= 60
pbBuf[55]= 34
pbBuf[56]= d8
pbBuf[57]= 3c
pbBuf[58]= 2
pbBuf[59]= 0
pbBuf[60]= 0
pbBuf[61]= 80
pbBuf[62]= 3
pbBuf[63]= 0
----------------pbBuf[64]= 45
pbBuf[65]= 50
pbBuf[66]= 52
pbBuf[67]= 4f
pbBuf[68]= 4d
pbBuf[69]= 20
pbBuf[70]= 20
pbBuf[71]= 20
pbBuf[72]= 42
pbBuf[73]= 49
pbBuf[74]= 4e
pbBuf[75]= 20
pbBuf[76]= 18
pbBuf[77]= bc
pbBuf[78]= 60
pbBuf[79]= 34
pbBuf[80]= d8
pbBuf[81]= 4
pbBuf[82]= d8
pbBuf[83]= 3c
pbBuf[84]= 0
pbBuf[85]= 0
pbBuf[86]= 60
pbBuf[87]= 34
pbBuf[88]= d8
pbBuf[89]= 3c
pbBuf[90]= e2
pbBuf[91]= 0
pbBuf[92]= 0
pbBuf[93]= 0
pbBuf[94]= 4
pbBuf[95]= 0
pbBuf[96]= 0
pbBuf[97]= 0
pbBuf[98]= 0
pbBuf[99]= 0
Position 32 is telling me that I have deleted EXEC-DEV.TSX, which is true. Position 64 should be 0xE5 as well, because I have deleted EPROM.BIN.