* adfWriteBootBlock * * * write bootcode ? */
| 218 | * write bootcode ? |
| 219 | */ |
| 220 | RETCODE |
| 221 | adfWriteBootBlock(struct Volume* vol, struct bBootBlock* boot) |
| 222 | { |
| 223 | uint8_t buf[LOGICAL_BLOCK_SIZE*2]; |
| 224 | uint32_t newSum; |
| 225 | |
| 226 | boot->dosType[0] = 'D'; |
| 227 | boot->dosType[1] = 'O'; |
| 228 | boot->dosType[2] = 'S'; |
| 229 | memcpy(buf, boot, LOGICAL_BLOCK_SIZE*2); |
| 230 | #ifdef LITT_ENDIAN |
| 231 | swapEndian(buf, SWBL_BOOT); |
| 232 | #endif |
| 233 | |
| 234 | if (boot->rootBlock==880 || boot->data[0]!=0) { |
| 235 | newSum = adfBootSum(buf); |
| 236 | /*fprintf(stderr,"sum %x %x\n",newSum,adfBootSum2(buf));*/ |
| 237 | swLong(buf+4,newSum); |
| 238 | /* *(uint32_t*)(buf+4) = swapLong((uint8_t*)&newSum);*/ |
| 239 | } |
| 240 | |
| 241 | /* dumpBlock(buf); |
| 242 | dumpBlock(buf+512); |
| 243 | */ |
| 244 | if (adfWriteBlock(vol, 0, buf)!=RC_OK) |
| 245 | return RC_ERROR; |
| 246 | if (adfWriteBlock(vol, 1, buf+512)!=RC_OK) |
| 247 | return RC_ERROR; |
| 248 | /*puts("adfWriteBootBlock");*/ |
| 249 | return RC_OK; |
| 250 | } |
| 251 | |
| 252 | |
| 253 | /* |
no test coverage detected