- pos = (((uint16_t)(msg[TRK+1] << 8) + msg[TRK]) * 8
- + ((uint32_t)(msg[SEC+1] << 8) + msg[SEC])) * CONFIG_CPM_BLOCK_SIZE;
+ pos = (track * 8UL + sec) * CONFIG_CPM_BLOCK_SIZE;
+
+ drv_debug(MIDDLE, PSTR(" T:%4d, S:%2d, cnt:%2d, lba: %.8lx, addr: %.5lx"),
+ track, sec, secs, pos, addr);
+
+ if (addr == 0) {
+ return msg_cpm_result(subf, 0x07, res);
+ }
+
+ if (dowrite && dp->opt & DRV_OPT_RO) {
+ return msg_cpm_result(subf, 0x05, res);
+ }