Beebem save state and load state

want to talk about MESS/model b/beebem/b-em/electrem/elkulator? do it here!
User avatar
hoglet
Posts: 6631
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Beebem save state and load state

Postby hoglet » Wed Mar 08, 2017 2:31 pm

lurkio wrote:Thanks, Dave! Don't suppose you can check DFS 0.9 at all?

I had to burn an actual EPROM to test this. It's been a while since I've had to do that!

But it's the same behaviour as 1.21, i.e. there is no caching of the catalogue.

It would be worth a few other people trying this, just it case it somehow depends on the drive itself in some subtle way. I'm using a 5 1/4 in drive.

Dave

User avatar
hoglet
Posts: 6631
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Beebem save state and load state

Postby hoglet » Wed Mar 08, 2017 2:52 pm

Looking at the DFS 0.9 disassembly, there does seem to be a path where reading the catalog off the physical disk (LoadCurDrvCatalog) can skipped:
https://swhs.home.xs4all.nl/bbc/mmbeeb/ ... sembly.pdf

Code: Select all

CheckCurDrvCatalog2 8AD8 20 4D 83 JSR setCECF_driveno
                    8ADB 20 58 83 JSR GetDriveNo_withInit
CheckCurDrvCatalog  8ADE 20 BD 8B JSR FDC_DriveReady           ;; Z=1=ready
                    8AE1 F0 08    BEQ LoadCurDrvCatalog
                    8AE3 AD 82 10 LDA CurrentCrvCatalog
                    8AE6 C5 CF    CMP CurrentDrv
                    8AE8 D0 01    BNE LoadCurDrvCatalog
ResetFDC_SeekOK     8AEA 60       RTS                          ;; Ok, no need to read?
LoadCurDrvCatalog   8AEB 20 9E 8B JSR FDC_DriveReady/Reset
                    8AEE 20 04 8B JSR ResetFDCNMI
                    8AF1 20 16 8C JSR LoadNMI1Read@0E00
                    ...

If you do ?&1082=-1 immediately after *SAVE (to invalidate the catalog) then it does indeed force it to be re-read.

So it seems possible JSR FDC_DriveReady is returning a different value in the emulation at this point.

This subroutine uses 8271 command &2C (read drive status), which in the B-Em emulation is simply returning the value of drive select:

Code: Select all

                                if (i8271.drivesel & 1) i8271.result |= 0x04;
                                if (i8271.drivesel & 2) i8271.result |= 0x40;

Which I suspect at this point is deselected, which might be the problem.

I wonder what the real hardware does at this point?

Dave

User avatar
hoglet
Posts: 6631
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Beebem save state and load state

Postby hoglet » Wed Mar 08, 2017 3:18 pm

There does seem to is a bug in B-Em's 8271 emulation of the drive status command (&2C):
https://github.com/stardot/b-em/blob/master/src/i8271.c

In the emuluation, the drive status command &2C simply returns the value in "drivesel " in the READY0 and READY1 bits.

If you search for "drivesel" in the source code code, this is the only place it is set:
https://github.com/stardot/b-em/blob/ma ... 271.c#L156

So what's happening is the drive status command itself immediately nobbles drivesel, and then returns the nobbled value.

If you look at the data sheet, it's more complicated than this:
8271DriveStatus.PNG


Dave

User avatar
hoglet
Posts: 6631
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Beebem save state and load state

Postby hoglet » Wed Mar 08, 2017 3:40 pm

Does anyone understand this part of the Beeb's 8271 disk interface:
BeebDFS.PNG

I'm trying to understand the logic of the RDY0 and RDY1 signals going into the 8271, generated by IC's 83, 84 and 85.

Index pulses from the disk drive are at 300 RPM = 5Hz = every 200ms

The counter output on pin 3 of IC85 has a period of 524ms (8MHz / 16 / 16 / 16384), so will go high quite soon (62ms) after an index pulse is missed.

All the service manual says is:
ICs 83, 84 and 85 are then used to detect index pulses coming in from the
drive which show that the drive is ready for a read or write operation.


Dave

User avatar
lurkio
Posts: 1292
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Beebem save state and load state

Postby lurkio » Wed Mar 08, 2017 5:19 pm

hoglet wrote:I'm trying to understand the logic of the RDY0 and RDY1 signals going into the 8271, generated by IC's 83, 84 and 85.

I haven't a clue because I know almost nothing about electronics. However, those ICs seem to be discussed at the end of the "Reasons it doesn't work" section on Sprow's webpage here:

Sprow wrote:The index pulse comes in via a set of option links (to select whether the index pulse is on pin 4 for 8" drives or pin 8 normally), and an inverter. The yellow components [ICs 85 and 86] divide the 8MHz clock down by 256 then by 16384 to 1.9Hz. The red [IC 84] and blue [IC 83] components are latches, one each for drive 0 and drive 1, which produce the "drive ready" signals for the 8271.

What this means is that there are is a timeout on the ready signals of 1.9Hz (about 520ms). As a 3.5" drive spins at 300 revolutions per minute (200ms per revolution) a missing index pulse causes the latches to time out and tell the 8271 that the [3.5-inch] drive is not ready.


:idea:

User avatar
hoglet
Posts: 6631
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Beebem save state and load state

Postby hoglet » Wed Mar 08, 2017 7:09 pm

lurkio wrote:[
However, those ICs seem to be discussed at the end of the "Reasons it doesn't work" section on Sprow's webpage here:

Thanks for that. I'm starting to understand things a bit better now. The problem was the 8271 emulation always reporting the drive as ready, even when the motor had stopped running. This is what's causing the DFS to skip re-reading the catalogue in the case you have found.

I've had a go at fixing this in B-Em:
b-em.zip
(378.48 KiB) Downloaded 11 times

Would you like to give this a go and see if it fixes your original issue?

Sorry, but someone else will have to fix this in BeebEm. I've decided to focus my time on just one emulator!

Steve/Thomas, this fix is currently here:
https://github.com/hoglet67/b-em/commit ... 783565bb08

I'll create a pull request when we get some more verification of this.

Dave

User avatar
CMcDougall
Posts: 5623
Joined: Wed Feb 02, 2005 3:13 pm
Location: Shadow in a Valley of Scotland

Re: Beebem save state and load state

Postby CMcDougall » Wed Mar 08, 2017 9:24 pm

Think DFS1.2+ will be same as 1.20, as all that's happened is the Mod has increased the 'drive ready' thingy for 31/2" drives. So code should be same else where.
I have a setup with 1.22 & 31/2" drive so will try that, time allowing...soon.. Got an original 0.90, but it's 40 miles away :roll: but could burn & take out 1.22, also a few 51/4" drives under beds, but doubt will make no diff to this conclusion.

Dave, your head must be spinning like a disc drive with all this bouncing about in all these super fixes lately! =D> =D> =D>
ImageImageImage

User avatar
hoglet
Posts: 6631
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Beebem save state and load state

Postby hoglet » Wed Mar 08, 2017 9:27 pm

CMcDougall wrote:Dave, your head must be spinning like a disc drive with all this bouncing about in all these super fixes lately! =D> =D> =D>

It's either that, or do some more decorating.....I know which I prefer :lol:

User avatar
lurkio
Posts: 1292
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Beebem save state and load state

Postby lurkio » Thu Mar 09, 2017 11:45 am

hoglet wrote:I've had a go at fixing this in B-Em:
b-em.zip
Would you like to give this a go and see if it fixes your original issue?

I would, but I can't! When I try to run the .exe in Windows 7 (in a VM), it says alut.dll is missing.

How do I fix this?

:?:

User avatar
hoglet
Posts: 6631
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Beebem save state and load state

Postby hoglet » Thu Mar 09, 2017 12:36 pm

lurkio wrote:I would, but I can't! When I try to run the .exe in Windows 7 (in a VM), it says alut.dll is missing.

How do I fix this?

Sorry about that.

You need to drop it into a working recent(ish) B-Em installation, such as the one here:
https://www.dropbox.com/s/eukub3y8kloq8 ... e.zip?dl=0

Dave
Last edited by hoglet on Thu Mar 09, 2017 2:42 pm, edited 1 time in total.

User avatar
lurkio
Posts: 1292
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Beebem save state and load state

Postby lurkio » Thu Mar 09, 2017 2:11 pm

hoglet wrote:
lurkio wrote:I would, but I can't! When I try to run the .exe in Windows 7 (in a VM), it says alut.dll is missing. How do I fix this?

Sorry about that. You need to drop it into a working recent(ish) B-Em installation, such as the one here:
https://www.dropbox.com/s/eukub3y8kloq8 ... e.zip?dl=0

Could you correct that URL please?

:?:

User avatar
hoglet
Posts: 6631
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Beebem save state and load state

Postby hoglet » Thu Mar 09, 2017 2:42 pm

lurkio wrote:Could you correct that URL please?

Sorry, that somehow got mangled. Try this: linky.

Dave

User avatar
CMcDougall
Posts: 5623
Joined: Wed Feb 02, 2005 3:13 pm
Location: Shadow in a Valley of Scotland

Re: Beebem save state and load state

Postby CMcDougall » Thu Mar 09, 2017 7:12 pm

hoglet wrote:same behaviour as 1.21, i.e. there is no caching of the catalogue.
It would be worth a few other people trying this.....

can confirm I get same (as I thought above), with DFS1.20 & DFS0.90 with a 51/4" drive,
& same with 1.22 & a 31/2" drive
ImageImageImage

User avatar
lurkio
Posts: 1292
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Beebem save state and load state

Postby lurkio » Thu Mar 09, 2017 8:45 pm

hoglet wrote:
lurkio wrote:Try this: linky.

Thanks! I've tried your fixed .exe with the Dropbox install, and you do indeed seem to have made B-em read the .SSD on *CAT straight after *SAVE.

=D> =D> =D>

How exactly did you fix it?

Curiously, btw, the unfixed version of B-em in that Dropbox install behaves slightly differently from BeebEm (which is obviously still without an 8271 fix): although the unfixed B-em fails to access the disc on *CAT straight after *SAVE, I'm unable to "lose" or overwrite files in unfixed B-em in the way that I was able to in BeebEm (see my post above). This probably isn't a very significant observation, but I just thought I'd mention it anyway.

:?:

User avatar
ThomasAdam
Posts: 91
Joined: Tue Feb 07, 2017 9:35 am
Location: Southampton, England
Contact:

Re: Beebem save state and load state

Postby ThomasAdam » Thu Mar 09, 2017 11:06 pm

hoglet wrote:Steve/Thomas, this fix is currently here:
https://github.com/hoglet67/b-em/commit ... 783565bb08

I'll create a pull request when we get some more verification of this.

Dave


Thanks -- I'll keep an eye out.

Kindly,
Thomas


Return to “emulators”

Who is online

Users browsing this forum: No registered users and 4 guests