This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Any FDS programmers around?

Any FDS programmers around?
by on (#27841)
I'm trying to low level read the first few bytes from the disk. I've tried polling for a ready byte and waiting for IRQs but either I'm doing something wrong (probable), or FCEU and Nestopia don't work right.

I called the "wait until disk ready" subroutine in the BIOS which I interpret to mean "the head is at the top of the disk scanning down", so I poll until a byte is assembled, but that never happens.

Am I missing something?

Code:
   jsr $e64d   ; wait until disk ready
   ldx #00
-   lda $4030
   and #2              ; is byte ready?
   beq -
   lda $4031          ; get
   sta $6000, x      ; put
   inx
   cpx #32
   bne -


Thanks

Edit: silly typo in code

by on (#27842)
So you are unable to get it passed this line?

jsr $e64d ; wait until disk ready

by on (#27843)
Yup, it's the "beq" I can't get past.

by on (#27844)
$4030 byte 1 (#2):

FDS Technical Reference wrote:
1: Byte transfer flag. Set every time 8 bits have been transfered between
the RAM adaptor & disk drive (service $4024/$4031). Reset when $4024, $4031,
or $4030 has been serviced.


You sure you got the register &/or bit?

by on (#27845)
Of course, the problem is that the bit never tests true. The head must need something else to start reading the disk. Looking at Nestopia's source it's not too clear whether it even really emulates the disk or just parses the images into FDS blocks and works with them.

I really don't get why FDS images don't include the start/crc regions and are emulated in such a convoluted way.

by on (#27848)
I guess I gotta figure this stuff out on my own, it's clear that no emulator does FDS right. Time to make an all in one test ROM :)

by on (#27849)
I was having problems with this on real FDS hardware too. Its been too long so I cant remember the solution or if I found it, but you should be able to look at the FDS bios source to figure it out. Emulators should be doing enough of the disk to make at least the bios work correctly.

by on (#27850)
I've looked at BT's disassembly of the BIOS but from it I can't tell where I'm going wrong. I strongly think the logic hasn't been throughly checked, just assumed from the BIOS code, which is a problem since the BIOS/emulation hardly relies on real hardware events. I know that some unofficial disks such as the Tonkachi editor don't work in emulators, so this is probably the same issue.

by on (#27851)
Cycle accurate NES emulation, wave accurate video emulation, and now... magnetic and mechanicly accurate FDS emulation that simulates the magnetic substrate of an FDS disk?

by on (#27852)
I hope not, it's hard enough for me to understand others' emulator source as it is.
http://philip.greenspun.com/humor/eecs- ... -explained