diff --git a/mfm/inc/mfm_decoder.h b/mfm/inc/mfm_decoder.h index 64796a6..6395567 100644 --- a/mfm/inc/mfm_decoder.h +++ b/mfm/inc/mfm_decoder.h @@ -1,6 +1,7 @@ #ifndef MFM_DECODER_H_ #define MFM_DECODER_H_ // +// 10/18/23 SWE Added David Junior II 210 and 301 // 10/13/23 DJG Added CONTROLLER_ND100_3041 // 09/01/23 DJG Added WD_MICROENGINE support // 08/31/23 DJG Added DIMENSION_68000 support @@ -240,6 +241,8 @@ typedef struct { CONTROLLER_ADAPTEC, CONTROLLER_MVME320, CONTROLLER_SYMBOLICS_3620, + CONTROLLER_DJ_II_210, + CONTROLLER_DJ_II_301, CONTROLLER_DJ_II, CONTROLLER_SM1040, CONTROLLER_SYMBOLICS_3640, @@ -399,6 +402,7 @@ DEF_EXTERN struct { {0x00105187, 32, 6}, // David Junior II DJ_II {0x5140c101, 32, 6}, + // Nixdorf {0x8222f0804bda23ll, 56, 22} // DQ604 Not added to search since more likely to cause false @@ -3176,6 +3180,24 @@ DEF_EXTERN CONTROLLER mfm_controller_info[] {0,0,0,0},{0,0,0,0}, CONT_ANALYZE, 0, 0, 0 }, + {"DJ_II_210", 256, 10000000, 0, + 0, 0, 4, ARRAYSIZE(mfm_all_poly), + 0, 0, CINFO_CHS, + 6, 2, 0, 2, CHECK_NONE, CHECK_CRC, + 0, 1, NULL, 256, 32, 0, 5209, + 0, 0, + {0,0,0,0},{0,0x5140c101,32,6}, CONT_MODEL, + 0, 0, 0 + }, + {"DJ_II_301", 256, 10000000, 0, + 0, 0, 4, ARRAYSIZE(mfm_all_poly), + 0, 0, CINFO_CHS, + 6, 2, 0, 2, CHECK_NONE, CHECK_CRC, + 0, 1, NULL, 256, 32, 0, 5209, + 0, 0, + {0,0,0,0},{0,0x5140c101,32,6}, CONT_MODEL, + 0, 0, 0 + }, // Header is either 6 or 10 bytes {"DJ_II", 256, 10000000, 0, 0, 0, 4, ARRAYSIZE(mfm_all_poly), diff --git a/mfm/mfm_decoder.c b/mfm/mfm_decoder.c index f032fd5..d56bf1c 100644 --- a/mfm/mfm_decoder.c +++ b/mfm/mfm_decoder.c @@ -603,6 +603,8 @@ SECTOR_DECODE_STATUS mfm_decode_track(DRIVE_PARAMS * drive_params, int cyl, drive_params->controller == CONTROLLER_SHUGART_SA1400 || drive_params->controller == CONTROLLER_DEC_RQDX3 || drive_params->controller == CONTROLLER_DJ_II || + drive_params->controller == CONTROLLER_DJ_II_210 || + drive_params->controller == CONTROLLER_DJ_II_301 || drive_params->controller == CONTROLLER_MYARC_HFDC || drive_params->controller == CONTROLLER_SHUGART_1610 || drive_params->controller == CONTROLLER_MVME320 || @@ -1422,6 +1424,8 @@ SECTOR_DECODE_STATUS mfm_process_bytes(DRIVE_PARAMS *drive_params, drive_params->controller == CONTROLLER_SHUGART_SA1400 || drive_params->controller == CONTROLLER_DEC_RQDX3 || drive_params->controller == CONTROLLER_DJ_II || + drive_params->controller == CONTROLLER_DJ_II_210 || + drive_params->controller == CONTROLLER_DJ_II_301 || drive_params->controller == CONTROLLER_MYARC_HFDC || drive_params->controller == CONTROLLER_SHUGART_1610 || drive_params->controller == CONTROLLER_MVME320 || diff --git a/mfm/wd_mfm_decoder.c b/mfm/wd_mfm_decoder.c index 821d801..05ff1bc 100644 --- a/mfm/wd_mfm_decoder.c +++ b/mfm/wd_mfm_decoder.c @@ -1228,10 +1228,10 @@ SECTOR_DECODE_STATUS wd_process_data(STATE_TYPE *state, uint8_t bytes[], sector_size = drive_params->sector_size; // Sectore size need from user bad_block = 0; - cyl_high = ((~bytes[5] ) >> 7) & 0x01; // Get ~T8 from byte 5 and invert it + cyl_high = ((~bytes[5] ) >> 7) & 0x01; // Get ~T8 from byte 5 and invert it //Format change after cylinder d512. Can detect if T4 bit is not inverted in second copy. if (!((bytes[2] ^ bytes[4]) & 0x10)) { - cyl_high |= (((~bytes[4] ) >> 5) & 0x07) << 1; //Get ~TB,~TA,~T9 from byte 4 and invert it + cyl_high |= (((~bytes[4] ) >> 5) & 0x07) << 1; //Get ~TB,~TA,~T9 from byte 4 and invert it } sector_status.cyl = cyl_high << 8; @@ -1285,7 +1285,74 @@ SECTOR_DECODE_STATUS wd_process_data(STATE_TYPE *state, uint8_t bytes[], bytes[1], sector_status.cyl, sector_status.head, sector_status.sector); sector_status.status |= SECT_BAD_HEADER; } - } else if (drive_params->controller == CONTROLLER_MYARC_HFDC) { + } else if (drive_params->controller == CONTROLLER_DJ_II_210 || drive_params->controller == CONTROLLER_DJ_II_301 ) { + // Controller David Junior II DJ 210 and maybe DJ 301 + // Data format of a header is 4 bytes not including 0xa1, 0xfd + // ------------------------------------------------------------------------- + // | H4 | H3 | H2 | H1 | H0 | T10 | T9 | T8 | + // | T7 | T6 | T5 | T4 | T3 | T2 | T1 | S0 | + // | X1 | X0 | S5 | S4 | S3 | S2 | S1 | S0 | + // | Check Code | + // ------------------------------------------------------------------------- + // + // X1 X0 + // 0 0 Normal user track + // 0 1 Alternativ track + // 1 0 Bad track + // 1 1 mapped track + + //When a drive is f l:rst formatted, all tracks are + //normal user tracks. A track can be formatted as a + //"bad track•, disallowing any further access to it. + //When a track is mapped, it becomes a "mapped track" + //which contains pointers to an "alternate track•. An + //alternate track is accessed through a request to a + //mapped track. + + + int cyl_high; + + sector_size = drive_params->sector_size; // Sectore size need from user + bad_block = 0; + + cyl_high = (bytes[2] & 0x07); // Get high from byte 2 + sector_status.cyl = cyl_high << 8; + sector_status.cyl |= bytes[3]; // Adding low cyl + + if (bytes[4] >> 6 == 0x01){ //alternativ track + int new_cyl = sector_status.cyl; + int new_head = (bytes[7] & 0xe0) >> 5; + + bad_block=0; + sector_status.cyl = cyl_high << 8; + sector_status.cyl |= bytes[6]; + sector_status.head = mfm_fix_head(drive_params, exp_head, (bytes[7] & 0xe0) >> 5 ); + sector_status.sector = (bytes[7] & 0x1f); + + mfm_handle_alt_track_ch(drive_params, sector_status.cyl, + sector_status.head, new_cyl, new_head); + }else if(bytes[4] >> 6 == 0x02) { + // Handle bad + msg(MSG_INFO, "Header mismatch %x %x %x %x on cyl %d head %d sector %d\n", + bytes[2], bytes[3], bytes[4], bytes[5], + sector_status.cyl, sector_status.head, sector_status.sector); + msg(MSG_INFO, "Marked bad\n"); + }else{ + + sector_status.head = mfm_fix_head(drive_params, exp_head, (bytes[2] & 0xF8) >> 3 ); + sector_status.sector = (bytes[4] & 0x3f) ; // Get sectors from byte 4 + + } + + + if (bytes[1] != 0xfd) { + msg(MSG_INFO, "Invalid header id byte %02x on cyl %d head %d sector %d\n", + bytes[1], sector_status.cyl, sector_status.head, sector_status.sector); + sector_status.status |= SECT_BAD_HEADER; + } + + + } else if (drive_params->controller == CONTROLLER_MYARC_HFDC) { int ecc_size[] = { 4, -1, -1, -1, -1, -1, -1 ,-1 , -1, -1, -1, -1, -1, 7, 6, 5}; sector_status.cyl = (bytes[3] & 0xf0) << 4; @@ -2061,7 +2128,6 @@ SECTOR_DECODE_STATUS wd_process_data(STATE_TYPE *state, uint8_t bytes[], int id_byte_mask = 0xff; sector_status.status |= init_status; - if (drive_params->controller == CONTROLLER_MYARC_HFDC) { if (bytes[1] == 0xf8) { id_byte_expected = 0xf8; @@ -2078,6 +2144,11 @@ SECTOR_DECODE_STATUS wd_process_data(STATE_TYPE *state, uint8_t bytes[], id_byte_expected = 0xfb; } else if (drive_params->controller == CONTROLLER_DJ_II) { id_byte_expected = 0xf8; + } else if (drive_params->controller == CONTROLLER_DJ_II_210) { + id_byte_expected = 0xf8; + } else if (drive_params->controller == CONTROLLER_DJ_II_301) { + + id_byte_expected = 0xf9; } else if (drive_params->controller == CONTROLLER_IBM_3174) { id_byte_expected = 0xfb; } else if (drive_params->controller == CONTROLLER_MVME320) {