Page 1 of 1

FDC "not ready"

Posted: Sat Jul 27, 2013 8:28 am
by Symoon
Hi there.
If I understand correctly, there's a status bit sent by the FDC (once it executed a command I guess), one of them being "not ready".
Does anyone know when this bit is set? Especially, would it be set if the drive is not plugged, or does require it being there (ie being asked its status, and not replying, or replying busy).
Tried to read the FDC reference but I'm really not used to this, and the definition of this status bit seems unclear to me:
"b7 - Not ready - This bit when set indicates the drive is not ready. When reset it indicates the drive is ready. This bit is an inverted copy of the Ready input and logically ORed with MR."

I'm just trying to find a way to know if a drive (A, B, C or D) is plugged or not without crashing the system - hoping this could be a way to do so!

Re: FDC "not ready"

Posted: Sat Jul 27, 2013 1:38 pm
by Symoon
Like a barbarian, I patched the Sedoric kernel of a disk to check.
This code is supposed to display the status line in green when the FDC performed a command without saying he's busy, and in red when the busy status is read.

Code: Select all

D0BA A8        TAY
D0BB 20 E5 E6  JSR E6E5

E6E5 A2 11     LDX #11 default value: no drive
E6E7 29 80     AND #80 test if "not ready" status is set
E6E9 30 01     BMI +1 goes in E6EC if bit 7 = 1 (negative sign), so no drive?
E6EB E8        INX X=X+1 (color goes from red to green)
E6EC 8E 80 BB  STX #BB80 displays color
E6EF 98        TYA
E6F0 60        RTS
When I perform a read track command, I got a green line when a disk is present. When it's not, or when I ask reading a drive which doesn't exist, the Oric goes in an endless loop, and no color is displayed. The status byte seems set to 0.

So I guess the system really doesn't work with this status. That doesn't explain for sure if/how/when the "not ready" status bit is set, so we could (maybe) use it... Maybe the Microdisc ROM manages it? It detects when a system disk is inserted...

Re: FDC "not ready"

Posted: Sat Jul 27, 2013 4:15 pm
by Godzil
Maybe the problem come from INTs, did you desactivate them?

Re: FDC "not ready"

Posted: Sat Jul 27, 2013 4:54 pm
by Symoon
Hi Godzil, INT is for Interrupts? I didn't deactivate them, the code I changed is in a routine called "IRQ handler" so I supppose they are useful - although each time I hear of interrupts, I have to spend 2 hours understanding again how it works ;)
Actually the Oric loops endlessly waiting for a byte to be read. I'm not sure this IRQ Handler is called in such a loop, and I even have no idea if anybody (Microdisc ROM, FDC...) sets this "not ready" status byte...
I suppose that if the FDC said "not ready", it would produce a interrupt, then the IRQ handler I changed would analyse it and display red. Would that mean for sure the FDC never says "not ready" when reading an empty drive, or reading without even a drive?

Re: FDC "not ready"

Posted: Sun Jul 28, 2013 9:37 am
by Symoon
Ok, I must be blind: Euphoric displays the FDC status right in the middle of the monitor screen!
So, when trying to read a track on an unplugged drive, the status is "busy", and that's it. It doesn't say "not ready".
So it can't be used (unless Euphoric didn't emulate perfectly this apparently useless part).

Re: FDC "not ready"

Posted: Sun Jul 28, 2013 7:42 pm
by Godzil
In fact, the Microdisk board is not connected to the "READY" signal from the floppy drive. That's why I was searching for how the MD ROM can tell "no drive in" with a HxC with a loaded floppy at boot time.