diff_mfm_konan_dj_ii_301 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. diff --git a/mfm/inc/mfm_decoder.h b/mfm/inc/mfm_decoder.h
  2. index 64796a6..6395567 100644
  3. --- a/mfm/inc/mfm_decoder.h
  4. +++ b/mfm/inc/mfm_decoder.h
  5. @@ -1,6 +1,7 @@
  6. #ifndef MFM_DECODER_H_
  7. #define MFM_DECODER_H_
  8. //
  9. +// 10/18/23 SWE Added David Junior II 210 and 301
  10. // 10/13/23 DJG Added CONTROLLER_ND100_3041
  11. // 09/01/23 DJG Added WD_MICROENGINE support
  12. // 08/31/23 DJG Added DIMENSION_68000 support
  13. @@ -240,6 +241,8 @@ typedef struct {
  14. CONTROLLER_ADAPTEC,
  15. CONTROLLER_MVME320,
  16. CONTROLLER_SYMBOLICS_3620,
  17. + CONTROLLER_DJ_II_210,
  18. + CONTROLLER_DJ_II_301,
  19. CONTROLLER_DJ_II,
  20. CONTROLLER_SM1040,
  21. CONTROLLER_SYMBOLICS_3640,
  22. @@ -399,6 +402,7 @@ DEF_EXTERN struct {
  23. {0x00105187, 32, 6},
  24. // David Junior II DJ_II
  25. {0x5140c101, 32, 6},
  26. +
  27. // Nixdorf
  28. {0x8222f0804bda23ll, 56, 22}
  29. // DQ604 Not added to search since more likely to cause false
  30. @@ -3176,6 +3180,24 @@ DEF_EXTERN CONTROLLER mfm_controller_info[]
  31. {0,0,0,0},{0,0,0,0}, CONT_ANALYZE,
  32. 0, 0, 0
  33. },
  34. + {"DJ_II_210", 256, 10000000, 0,
  35. + 0, 0, 4, ARRAYSIZE(mfm_all_poly),
  36. + 0, 0, CINFO_CHS,
  37. + 6, 2, 0, 2, CHECK_NONE, CHECK_CRC,
  38. + 0, 1, NULL, 256, 32, 0, 5209,
  39. + 0, 0,
  40. + {0,0,0,0},{0,0x5140c101,32,6}, CONT_MODEL,
  41. + 0, 0, 0
  42. + },
  43. + {"DJ_II_301", 256, 10000000, 0,
  44. + 0, 0, 4, ARRAYSIZE(mfm_all_poly),
  45. + 0, 0, CINFO_CHS,
  46. + 6, 2, 0, 2, CHECK_NONE, CHECK_CRC,
  47. + 0, 1, NULL, 256, 32, 0, 5209,
  48. + 0, 0,
  49. + {0,0,0,0},{0,0x5140c101,32,6}, CONT_MODEL,
  50. + 0, 0, 0
  51. + },
  52. // Header is either 6 or 10 bytes
  53. {"DJ_II", 256, 10000000, 0,
  54. 0, 0, 4, ARRAYSIZE(mfm_all_poly),
  55. diff --git a/mfm/mfm_decoder.c b/mfm/mfm_decoder.c
  56. index f032fd5..d56bf1c 100644
  57. --- a/mfm/mfm_decoder.c
  58. +++ b/mfm/mfm_decoder.c
  59. @@ -603,6 +603,8 @@ SECTOR_DECODE_STATUS mfm_decode_track(DRIVE_PARAMS * drive_params, int cyl,
  60. drive_params->controller == CONTROLLER_SHUGART_SA1400 ||
  61. drive_params->controller == CONTROLLER_DEC_RQDX3 ||
  62. drive_params->controller == CONTROLLER_DJ_II ||
  63. + drive_params->controller == CONTROLLER_DJ_II_210 ||
  64. + drive_params->controller == CONTROLLER_DJ_II_301 ||
  65. drive_params->controller == CONTROLLER_MYARC_HFDC ||
  66. drive_params->controller == CONTROLLER_SHUGART_1610 ||
  67. drive_params->controller == CONTROLLER_MVME320 ||
  68. @@ -1422,6 +1424,8 @@ SECTOR_DECODE_STATUS mfm_process_bytes(DRIVE_PARAMS *drive_params,
  69. drive_params->controller == CONTROLLER_SHUGART_SA1400 ||
  70. drive_params->controller == CONTROLLER_DEC_RQDX3 ||
  71. drive_params->controller == CONTROLLER_DJ_II ||
  72. + drive_params->controller == CONTROLLER_DJ_II_210 ||
  73. + drive_params->controller == CONTROLLER_DJ_II_301 ||
  74. drive_params->controller == CONTROLLER_MYARC_HFDC ||
  75. drive_params->controller == CONTROLLER_SHUGART_1610 ||
  76. drive_params->controller == CONTROLLER_MVME320 ||
  77. diff --git a/mfm/wd_mfm_decoder.c b/mfm/wd_mfm_decoder.c
  78. index 821d801..05ff1bc 100644
  79. --- a/mfm/wd_mfm_decoder.c
  80. +++ b/mfm/wd_mfm_decoder.c
  81. @@ -1228,10 +1228,10 @@ SECTOR_DECODE_STATUS wd_process_data(STATE_TYPE *state, uint8_t bytes[],
  82. sector_size = drive_params->sector_size; // Sectore size need from user
  83. bad_block = 0;
  84. - cyl_high = ((~bytes[5] ) >> 7) & 0x01; // Get ~T8 from byte 5 and invert it
  85. + cyl_high = ((~bytes[5] ) >> 7) & 0x01; // Get ~T8 from byte 5 and invert it
  86. //Format change after cylinder d512. Can detect if T4 bit is not inverted in second copy.
  87. if (!((bytes[2] ^ bytes[4]) & 0x10)) {
  88. - cyl_high |= (((~bytes[4] ) >> 5) & 0x07) << 1; //Get ~TB,~TA,~T9 from byte 4 and invert it
  89. + cyl_high |= (((~bytes[4] ) >> 5) & 0x07) << 1; //Get ~TB,~TA,~T9 from byte 4 and invert it
  90. }
  91. sector_status.cyl = cyl_high << 8;
  92. @@ -1285,7 +1285,74 @@ SECTOR_DECODE_STATUS wd_process_data(STATE_TYPE *state, uint8_t bytes[],
  93. bytes[1], sector_status.cyl, sector_status.head, sector_status.sector);
  94. sector_status.status |= SECT_BAD_HEADER;
  95. }
  96. - } else if (drive_params->controller == CONTROLLER_MYARC_HFDC) {
  97. + } else if (drive_params->controller == CONTROLLER_DJ_II_210 || drive_params->controller == CONTROLLER_DJ_II_301 ) {
  98. + // Controller David Junior II DJ 210 and maybe DJ 301
  99. + // Data format of a header is 4 bytes not including 0xa1, 0xfd
  100. + // -------------------------------------------------------------------------
  101. + // | H4 | H3 | H2 | H1 | H0 | T10 | T9 | T8 |
  102. + // | T7 | T6 | T5 | T4 | T3 | T2 | T1 | S0 |
  103. + // | X1 | X0 | S5 | S4 | S3 | S2 | S1 | S0 |
  104. + // | Check Code |
  105. + // -------------------------------------------------------------------------
  106. + //
  107. + // X1 X0
  108. + // 0 0 Normal user track
  109. + // 0 1 Alternativ track
  110. + // 1 0 Bad track
  111. + // 1 1 mapped track
  112. +
  113. + //When a drive is f l:rst formatted, all tracks are
  114. + //normal user tracks. A track can be formatted as a
  115. + //"bad track•, disallowing any further access to it.
  116. + //When a track is mapped, it becomes a "mapped track"
  117. + //which contains pointers to an "alternate track•. An
  118. + //alternate track is accessed through a request to a
  119. + //mapped track.
  120. +
  121. +
  122. + int cyl_high;
  123. +
  124. + sector_size = drive_params->sector_size; // Sectore size need from user
  125. + bad_block = 0;
  126. +
  127. + cyl_high = (bytes[2] & 0x07); // Get high from byte 2
  128. + sector_status.cyl = cyl_high << 8;
  129. + sector_status.cyl |= bytes[3]; // Adding low cyl
  130. +
  131. + if (bytes[4] >> 6 == 0x01){ //alternativ track
  132. + int new_cyl = sector_status.cyl;
  133. + int new_head = (bytes[7] & 0xe0) >> 5;
  134. +
  135. + bad_block=0;
  136. + sector_status.cyl = cyl_high << 8;
  137. + sector_status.cyl |= bytes[6];
  138. + sector_status.head = mfm_fix_head(drive_params, exp_head, (bytes[7] & 0xe0) >> 5 );
  139. + sector_status.sector = (bytes[7] & 0x1f);
  140. +
  141. + mfm_handle_alt_track_ch(drive_params, sector_status.cyl,
  142. + sector_status.head, new_cyl, new_head);
  143. + }else if(bytes[4] >> 6 == 0x02) {
  144. + // Handle bad
  145. + msg(MSG_INFO, "Header mismatch %x %x %x %x on cyl %d head %d sector %d\n",
  146. + bytes[2], bytes[3], bytes[4], bytes[5],
  147. + sector_status.cyl, sector_status.head, sector_status.sector);
  148. + msg(MSG_INFO, "Marked bad\n");
  149. + }else{
  150. +
  151. + sector_status.head = mfm_fix_head(drive_params, exp_head, (bytes[2] & 0xF8) >> 3 );
  152. + sector_status.sector = (bytes[4] & 0x3f) ; // Get sectors from byte 4
  153. +
  154. + }
  155. +
  156. +
  157. + if (bytes[1] != 0xfd) {
  158. + msg(MSG_INFO, "Invalid header id byte %02x on cyl %d head %d sector %d\n",
  159. + bytes[1], sector_status.cyl, sector_status.head, sector_status.sector);
  160. + sector_status.status |= SECT_BAD_HEADER;
  161. + }
  162. +
  163. +
  164. + } else if (drive_params->controller == CONTROLLER_MYARC_HFDC) {
  165. int ecc_size[] = { 4, -1, -1, -1, -1, -1, -1 ,-1 ,
  166. -1, -1, -1, -1, -1, 7, 6, 5};
  167. sector_status.cyl = (bytes[3] & 0xf0) << 4;
  168. @@ -2061,7 +2128,6 @@ SECTOR_DECODE_STATUS wd_process_data(STATE_TYPE *state, uint8_t bytes[],
  169. int id_byte_mask = 0xff;
  170. sector_status.status |= init_status;
  171. -
  172. if (drive_params->controller == CONTROLLER_MYARC_HFDC) {
  173. if (bytes[1] == 0xf8) {
  174. id_byte_expected = 0xf8;
  175. @@ -2078,6 +2144,11 @@ SECTOR_DECODE_STATUS wd_process_data(STATE_TYPE *state, uint8_t bytes[],
  176. id_byte_expected = 0xfb;
  177. } else if (drive_params->controller == CONTROLLER_DJ_II) {
  178. id_byte_expected = 0xf8;
  179. + } else if (drive_params->controller == CONTROLLER_DJ_II_210) {
  180. + id_byte_expected = 0xf8;
  181. + } else if (drive_params->controller == CONTROLLER_DJ_II_301) {
  182. +
  183. + id_byte_expected = 0xf9;
  184. } else if (drive_params->controller == CONTROLLER_IBM_3174) {
  185. id_byte_expected = 0xfb;
  186. } else if (drive_params->controller == CONTROLLER_MVME320) {