Close

Reading sectors, FAT fs driver: error traceback

A project log for Z80 overpowered computer

I am building a computer with a 4MHz Z80, 32KiB EEPROM, 32KiB RAM, IDE interface and UART.

dylan-brophyDylan Brophy 10/08/2017 at 19:400 Comments

The CF card I had been using was 512MiB, which I have learned is incompatible with my hardware setup... thus the errors.  After getting a 128 MiB CF card, I tried an IDE/CF driver for Z80 I had downloaded a while back.  I read the first sector and got the os name at offset 3, then sent it via serial:

I used the 'dir' command because there is no fs yet, so we can't list files.  But as you can see, it clearly responds with 'MSDOS5.0', meaning reading sector zero actually worked.  Yay!  now lets make a FAT driver...

First tests of this FAT driver made the computer simply stop, endlessly waiting for the drive to be ready.  I knew the drive had errored, but why?  What piece of code caused the error?  Time to make a stack tracer.

I put strings before each function call which could lead to an error, then made a program trace any drive error. We can see that the problematic code is at 0x489, where the filesystem is loaded. More specifically, where the root directory is loaded into memory.

I got the drive error code: 0x10, like last time, that the sector wasn't found.  So I guess I tried to access a sector that isn't on the card...

That is the next thing to fix.

Discussions