3B2 MFM Emulation

58 views
Skip to first unread message

John Orwin

unread,
Sep 18, 2024, 1:31:56 PM9/18/24
to MFM Discuss
I have a 3B2/400 with 80MB HD: CDC94155-86, Wren II,  925C, 9H, 17S

It is working perfectly in the system, after weeks of installing SW from floppy disk images.

I have used the emulator in the past for a lot of different disks with no problems (PC, PDP11)

mfm_read -analyze gives this error:
# ./mfm_read --analyze --emulation_file  ../emufile_a --extracted_data_file CDC94155-86
Board revision C detected
Found drive at select 1
Returning to track 0
Drive RPM 3595.3
Matches count 36 for controller ATT_3B2
Header CRC: Polynomial 0x1021 length 16 initial value 0xffff
Sector length 512
Data CRC: Polynomial 0x1021 length 16 initial value 0xffff
Number of heads 9 number of sectors 18 first sector 0
Interleave (not checked): 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Drive didn't reach track 0 testing fast ST412 seek
Drive didn't reach track 0 testing slow ST506 seek
Drive is not seeking properly

Versions:
# uname -a
 Linux bbb3 5.10.168-ti-r74-djg #9 SMP PREEMPT Sat Dec 23 21:13:14 EST 2023 armv7l GNU/Linux

# ./mfm_read -v                                                                          
Board revision C detected
Version 4.19

I recall several years ago having trouble getting 3B2 emulation to work, but never stopped at the mfm_read step.

Any suggestions?
Thanks
John

David Gesswein

unread,
Sep 18, 2024, 5:30:50 PM9/18/24
to mfm-d...@googlegroups.com
Somewhat old code but didn't see any obvious fixes in this area in
new code. I did add ext2emu support for 3b2 in newer code.

I have had a couple reports of similar but nobody wanted to look into it
and I can't reproduce with my drives. The code in analyze.c analyze_disk
calls analyze_seek to move the head 30 tracks and then moves it back
using slow seeks expecting track 0 to go high. If you comment out that code
suspect the read will work. If you could investigate why the test doesn't
work with the one drive that would be helpful.
> --
> You received this message because you are subscribed to the Google Groups "MFM Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to mfm-discuss...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/mfm-discuss/67e54075-19cd-45d3-8cd1-e485137f8c39n%40googlegroups.com.

Message has been deleted
Message has been deleted

John Orwin

unread,
Sep 23, 2024, 2:14:59 PM9/23/24
to MFM Discuss
Hello Dave,

It took a while to investigate this.  I made the code changes to analyze.c

# diff analyze.c.bak analyze.c
1184,1190c1184,1190
<       if (analyze_seek(drive_params) != 0) {
<          drive_params->step_speed = DRIVE_STEP_SLOW;
<          if (analyze_seek(drive_params) != 0) {
<             msg(MSG_FATAL, "Drive is not seeking properly\n");
<             exit(1);
<          }
<       }
---
> //if (analyze_seek(drive_params) != 0) {
> //         drive_params->step_speed = DRIVE_STEP_SLOW;
> //         if (analyze_seek(drive_params) != 0) {
> //            msg(MSG_FATAL, "Drive is not seeking properly\n");
> //            exit(1);
> //         }
> //      }

Now it can analyze and successfully emulate the
problematic drive (CDC94155-86).  

However, another drive type from a 3B2/300 (CDC94205-51) worked
perfectly without the code changes.

So I do have a solution for now, but if any more testing would be
useful, a have everything out on my bench now (4 boards rev B - D),
several 3B2s and multiple HDs of differt types.

Thanks,
John

David Gesswein

unread,
Sep 23, 2024, 7:02:31 PM9/23/24
to mfm-d...@googlegroups.com
If you got some time to poke at it to see if you can make the test work
with that drive it would be helpful.
In analyze_seek I would start with increasing this sleep to see if it helps.

// Give time for track0 to change before we check
usleep(1000);
if (!drive_at_track0()) {
msg(MSG_INFO, "Drive didn't reach track 0 testing %s seek\n",

The interesting thing is at the end of the routine it calls
drive_seek_track0 which doesn't print this error so that routine did see
track 0. Its in the PRU assembly code so harder to debug.
msg(MSG_FATAL,"Failed to reach track 0\n");
> --
> You received this message because you are subscribed to the Google Groups "MFM Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to mfm-discuss...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/mfm-discuss/c1d64fcb-1ee9-41d6-bdb5-75af41eff65an%40googlegroups.com.

John Orwin

unread,
Sep 24, 2024, 8:48:06 AM9/24/24
to MFM Discuss
OK Dave we have some mixed results:
TESTING: PART 1 (SUCCESS)
--- I first upgraded from 4.19 to 4.29
---- Then edited analyze.c :
# diff analyze.c.bak analyze.c
1184,1190c1184,1190
<       if (analyze_seek(drive_params) != 0) {
<          drive_params->step_speed = DRIVE_STEP_SLOW;
<          if (analyze_seek(drive_params) != 0) {
<             msg(MSG_FATAL, "Drive is not seeking properly\n");
<             exit(1);
<          }
<       }
---
> //if (analyze_seek(drive_params) != 0) {
> //         drive_params->step_speed = DRIVE_STEP_SLOW;
> //         if (analyze_seek(drive_params) != 0) {
> //            msg(MSG_FATAL, "Drive is not seeking properly\n");
> //            exit(1);
> //         }
> //      }

---- Make was OK:
----Successfully did mfm_read --analyze :
# ./mfm_read --analyze --emulation_file  ../emufile_a --extracted_data_file CDC94155-86
Board revision C detected
Found drive at select 1
Drive RPM 3595.4
Found matching format ATT_3B2: good count difference 0

Number of heads 9 number of sectors 18 first sector 0
Interleave (not checked): 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Drive supports buffered seeks (ST412)
Found cylinder 924 expected 925                                                
Found cylinder 924 expected 926
Stopping end of disk search due to mismatching cylinder count
Number of cylinders 925, 76.7 MB

Command line to read disk:
--format ATT_3B2 --sectors 18,0 --heads 9 --cylinders 925 --header_crc 0xffff,0x1021,16,0 --data_crc  0xffff,0x1021,16,0 --sector_length 512 --retries 50,4 --drive 1
Found cyl 0 to 924, head 0 to 8, sector 0 to 17                                
Expected 149850 sectors got 149850 good sectors, 0 bad header, 0 bad data
0 sectors marked bad or spare
0 sectors corrected with ECC. Max bits in burst corrected 0
Track read time in ms min 22.326500 max 356.282584 avg 33.515101

--- Note message " Stopping end of disk search due to mismatching cylinder count"
--- However it did create the files:
-rw-r--r--  1 root   root   173559828 Sep 18 22:37 emufile_a
-rw-r--r--  1 root   root   76723200 Sep 18 22:37 CDC94155-86

--- Attached to the 3B2/400 and started emulator
./mfm_emu  --drive 1 --file ../emufile_a
Board revision C detected
Drive 0 num cyl 925 num head 9 track len 20836 begin_time 0
PRU clock 200000000
  Waiting, seek time 0.0 ms max 0.0 min free buffers 200
bad pattern count 0
Read queue underrun 0
Write queue overrun 0
Ecapture overrun 0
glitch count 0
glitch value 0
0:test 0 0
0:test 1 0
0:test 2 0
0:test 3 0
0:test 4 0
1:test 0 0
1:test 1 0
1:test 2 0
1:test 3 0
1:test 4 0
select 2 head 0
select 2 head 15
  Waiting, seek time 0.3 ms max 0.3 min free buffers 200 ...

--- Started the 3B2.  Had to do a "filledt" to populate the NVRAM device table, but after
that, it came up OK to UNIX.

--- I have been running it for a day now with many reboots and power cycles.  It is working
100%

TESTING: PART 2 (FAILURE)
--- I tried the same process with a disk from another system 3B2/310.  The 310 has the
same CPU and HD controller as the 400 afik.  This disk was a Fujitsu M2243AS 86MB 754,11,16

--- Version 4.19 (original analyze.c)
--- mfm_read -analyze completed and created the expected files:
# ./mfm_read --analyze --emulation_file  ../emufile_a --extracted_data_file M2243AS

Board revision C detected
Found drive at select 1
Returning to track 0
Drive RPM 3614.4
Matches count 32 for controller ATT_3B2

Header CRC: Polynomial 0x1021 length 16 initial value 0xffff
Sector length 512
Data CRC: Polynomial 0x1021 length 16 initial value 0xffff
Number of heads 11 number of sectors 16 first sector 0

Interleave (not checked): 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Drive supports buffered seeks (ST412)
Disk has recalibrated to track 0                                              
Stopping end of disk search due to recalibration
Number of cylinders 754, 67.9 MB

Command line to read disk:
--format ATT_3B2 --sectors 16,0 --heads 11 --cylinders 754 --header_crc 0xffff,0x1021,16,0 --data_crc  0xffff,0x1021,16,0 --sector_length 512 --retries 50,4 --drive 1
Found cyl 0 to 753, head 0 to 10, sector 0 to 15                              
Expected 132704 sectors got 132704 good sectors, 0 bad header, 0 bad data
0 sectors marked bad or spare
0 sectors corrected with ECC. Max bits in burst corrected 0
Track read time in ms min 23.099875 max 144.676750 avg 33.848509

--- The system would not boot this image

TESTING: PART 3 (FAILURE)
-- Upgraded to 4.29
- Recompiled with revised analyze.c
- Tried mfm_read --analyze and this time it failed totally:
# ./mfm_read --analyze --emulation_file  ../emufile_a --extracted_data_file M2243AS

Board revision C detected
Found drive at select 1
Returning to track 0
Drive RPM 3611.6
Retrying on cylinder 0 head 1
Unable to determine drive format

TESTING: PART 4 (FAILURE)
- I put the image from CDC drive (3b2/400) into the 3b2/310
- It would not boot there
- AT&T diskette utility "IDTOOLS" sees the drive, but attempting to access it suggests the
directory structure is scrambled.

I have a couple more 3B2 systems with different drives.  I'm willing to do more testing,
but perhaps you can suggest a more structure approach, or gather some debug info.

Thanks,
John

John Orwin

unread,
Sep 24, 2024, 8:48:11 AM9/24/24
to MFM Discuss
Hello Dave,

It has taken me a while to investigate this in detail.  To summarize:
1. I Revised analyze.c

# diff analyze.c.bak analyze.c
1184,1190c1184,1190
<       if (analyze_seek(drive_params) != 0) {
<          drive_params->step_speed = DRIVE_STEP_SLOW;
<          if (analyze_seek(drive_params) != 0) {
<             msg(MSG_FATAL, "Drive is not seeking properly\n");
<             exit(1);
<          }
<       }
---
> //if (analyze_seek(drive_params) != 0) {
> //         drive_params->step_speed = DRIVE_STEP_SLOW;
> //         if (analyze_seek(drive_params) != 0) {
> //            msg(MSG_FATAL, "Drive is not seeking properly\n");
> //            exit(1);
> //         }
> //      }

2.  Now it can analyze and emulate the specific CDC94205-5 (80MB) in the 3B2/400.
3.  Tried same experiment on a Rev D board with V 4.20 software:  Same result, 
it fails unless the code in analyze.c is commented out
4.  Tried other disks from 3B2 systems.  However, a CDC94205-51 (40B) works fine on 
multiple versions of the SW *without* the code changes.
5.  Emulation works perfectly in both 3B2/300 and 3B2/400 systems.

I have 4 boards Rev B through Rev D, and quite a few drives of various types.  I can do
more testing while everything is still on my bench.  I do have a working solution for 
now, though.

Thanks, John
On Wednesday, September 18, 2024 at 4:30:50 PM UTC-5 d...@pdp8online.com wrote:

d...@pdp8online.com

unread,
Sep 24, 2024, 8:58:34 AM9/24/24
to MFM Discuss
Annoying google has either put in a new spam filter or made the existing have way too high false positive. Some of your mails got caught by it. Havent found any way to turn it off or have it immediately send notification. Normally sends once a day but didn't get one for the first message held a couple days ago.

--- Note message " Stopping end of disk search due to mismatching cylinder count"

My code gives too much information at time. Its referring to these messages
Found cylinder 924 expected 925                                                
Found cylinder 924 expected 926
Stopping end of disk search due to mismatching cylinder count
It was trying to step down the disk but kept getting the same cylinder. Normally this indicates you have reached the last cylinder so code says 925 cylinders total.. Probably good to check how many cylinders the drive is supposed to have  to make sure it did pick the correct number.

John Orwin

unread,
Sep 24, 2024, 1:47:17 PM9/24/24
to MFM Discuss
Hi Dave,
I wondered what happened to my earlier messages.  Maybe they were too wordy.
Sorry, Ignore them for now.  In any case, picking up from your recent suggestions:
Testing with the 80M CDC94155-86.  The actual disk specs are:  925, 9, 17

1. analyze.c (original)
FAILS
# ./mfm_read -analyze

Board revision C detected
Found drive at select 1
Returning to track 0
Drive RPM 3595.5

Matches count 36 for controller ATT_3B2
Header CRC: Polynomial 0x1021 length 16 initial value 0xffff
Sector length 512
Data CRC: Polynomial 0x1021 length 16 initial value 0xffff
Number of heads 9 number of sectors 18 first sector 0_mfm_

Interleave (not checked): 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Drive didn't reach track 0 testing fast ST412 seek
Drive didn't reach track 0 testing slow ST506 seek
Drive is not seeking properly

2.  (change sleep time to 3000)
FAILS - identical results

3. (analyze_seek code commented out)
SUCCESS

# ./mfm_read -v
Board revision C detected
Version 4.20
Drive must be between 1 and 4
root@bbb4:/opt/mfm/mfm# ./setup_mfm_read
Rev C or D Board
root@bbb4:/opt/mfm/mfm# ./mfm_read -analyze

Board revision C detected
Found drive at select 1
Returning to track 0
Drive RPM 3595.5

Matches count 36 for controller ATT_3B2
Header CRC: Polynomial 0x1021 length 16 initial value 0xffff
Sector length 512
Data CRC: Polynomial 0x1021 length 16 initial value 0xffff
Number of heads 9 number of sectors 18 first sector 0
Interleave (not checked): 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Drive supports buffered seeks (ST412)

Found cylinder 924 expected 925                                                
Found cylinder 924 expected 926
Stopping end of disk search due to mismatching cylinder count
Number of cylinders 925, 76.7 MB

Command line to read disk:
--format ATT_3B2 --sectors 18,0 --heads 9 --cylinders 925 --header_crc 0xffff,0x1021,16,0 --data_crc  0xffff,0x1021,16,0 --sector_length 512 --retries 50,4 --drive 1

I'm not sure why it complains about cyl count, but in any case, that code produces a good emufile.

Other disks tested:
Fujitsu M2243-AS 754,11,16 From a 386PC w/WD1006 controller
FAILS w/Original code, works with analyze_seek commented out

Seagate ST4038 733,5,17 from a 3B2, works 100% with original code
SUCCEEDS w/Original code

Thanks, John

David Gesswein

unread,
Sep 24, 2024, 6:49:24 PM9/24/24
to mfm-d...@googlegroups.com
On Tue, Sep 24, 2024 at 10:47:16AM -0700, John Orwin wrote:
> I'm not sure why it complains about cyl count, but in any case, that code
> produces a good emufile.
>
I answered that in the reply to your delayed postings.


> Other disks tested:
> Fujitsu M2243-AS 754,11,16 From a 386PC w/WD1006 controller
> FAILS w/Original code, works with analyze_seek commented out
>

So more than one causing problems.


> 2. (change sleep time to 3000)
>FAILS - identical results
>

Looking at assembly code the main difference it is seek until it sees the
track 0 signal.

Can you try changing analyze_seek from
for (i = 1; i <= seek && rc == 0; i++) {
to
for (i = 1; i <= (seek+5) && rc == 0; i++) {



If we now get this error then the drive requires more steps to output
track 0 than expected. It doesn't outupt it when it actually is on track 0.
Drive prematurely at track 0

John Orwin

unread,
Sep 25, 2024, 12:41:38 PM9/25/24
to MFM Discuss
Latest code change:

# diff analyze.c.original analyze.c.mod2
802c802

<       for (i = 1; i <= seek && rc == 0; i++) {
---

>       for (i = 1; i <= (seek+5) && rc == 0; i++) {

Same error:
...
Drive didn't reach track 0 testing fast ST412 seek
Drive didn't reach track 0 testing slow ST506 seek
Drive is not seeking properly

Reply all
Reply to author
Forward
0 new messages