I was recently convinced in getting back to the zx microdrive fcntl driver.
It is a nightmare to debug, but luckily I could arrange a bit of scripting using FUSE as a target emulator and it greatly helped to save time.
I finally discovered that if1_write_sector(), which I considered in working order, wasn not.. I probably fixed it locally already years ago but I never saved my work.
Good, so far we have a quite crap write capability, only sequential, up to 510 bytes.
Reading should be complete already.
There is still a lot of things to be done, including probably some trick to make it work on v1 ROM version of the Interface 1..
..but if1_read_record(), if1_read_sector() and if1_write_sector() are now fully functional !
It means you can already write cool tools for low level access to the microdrive sectors, such as file mapping, file editing, etc..
ZX microdrive support improvements
Re: ZX microdrive support improvements
The new fcntl driver for the ZX Microdrive should now be usable in single drive configuration.
What's in:
- low level file record and Microdrive sector access, for both reading and writing, (works already on drives 1..8)
- low level file access permits to create parallel records (also slightly different) of the same file
- support for both IF1 v1 and v2 ROMs
- long file pointers, permitting to deal with files as big as the maximum available cartridge space
- full random file access in read mode with lseek()
- append/overwrite in write mode
- file rename (works on files of any length, no need of temporary space)
- file deletion
- simple access to text files created by BASIC streams (vice versa is possible using INKEY$#, or with clever writes).
- access to any file type (mind the header portion!) in both read and write mode
- minimal protection from the more common error conditions (e.g. microdrive not present)
What's missing:
- random file access in write mode
- working on Microdrives >1
- hardening (e.g. protection for the "microdrive full" condition)
- specialized functions to deal with BASIC headers
What's in:
- low level file record and Microdrive sector access, for both reading and writing, (works already on drives 1..8)
- low level file access permits to create parallel records (also slightly different) of the same file
- support for both IF1 v1 and v2 ROMs
- long file pointers, permitting to deal with files as big as the maximum available cartridge space
- full random file access in read mode with lseek()
- append/overwrite in write mode
- file rename (works on files of any length, no need of temporary space)
- file deletion
- simple access to text files created by BASIC streams (vice versa is possible using INKEY$#, or with clever writes).
- access to any file type (mind the header portion!) in both read and write mode
- minimal protection from the more common error conditions (e.g. microdrive not present)
What's missing:
- random file access in write mode
- working on Microdrives >1
- hardening (e.g. protection for the "microdrive full" condition)
- specialized functions to deal with BASIC headers
Re: ZX microdrive support improvements
Wow, that's nice. Indeed I'm (veeeery extensively) working on some ZX Microdrive related stuff using Z88dk. So everything that improves that part of the ZX support is welcome!
Re: ZX microdrive support improvements
to deal with random access writes I had to totally rewrite lseek()
The new environment seems to be working but we all know there are surely plenty of bugs.
willing to test anybody?
The new environment seems to be working but we all know there are surely plenty of bugs.
willing to test anybody?
Re: ZX microdrive support improvements
The driver is now stable enough to pass my tests: appending a text tail to a long file, using lseek to revert a character list.
I'm confident that the next nightly build will provide a good addition to the zx spectrum library !
.. the same test programs helped in spotting and solving a similar limit on CP/M, it is now possible again to use the '>>' redirection at command line on z88dk compiled programs.
I'm confident that the next nightly build will provide a good addition to the zx spectrum library !
.. the same test programs helped in spotting and solving a similar limit on CP/M, it is now possible again to use the '>>' redirection at command line on z88dk compiled programs.
Re: ZX microdrive support improvements
New low-level function to browse the Microdrive directory, if1_next_file():
zcc +zx -lzxmdv -create-app -DAMALLOC -clib=ansi -lm dir.c
Code: Select all
/*
ZX Microdrive catalog
*/
#include <zxinterface1.h>
#include <stdio.h>
#include <stdlib.h>
void main()
{
printf("%cCartridge name: ",12);
int if1_filestatus, first_found;
struct M_CHAN *if1_file;
if1_file = malloc(sizeof(struct M_CHAN));
first_found=if1_next_file(1, if1_file);
printf ("%s\n\n",if1_getname((if1_file)->hdname) );
if1_filestatus = -1;
while (first_found != if1_filestatus) {
if1_filestatus = if1_next_file(1, if1_file);
if (if1_filestatus == -1) {
printf ("error\n");
exit (0);
}
if (!(if1_file->recflg & 4))
printf ("* ");
else
printf (" ");
printf ("%10s ",if1_getname((if1_file)->recname) );
printf ("%lu\n", (long) if1_file->recnum * 512L + (long) if1_file->reclen);
}
}
You do not have the required permissions to view the files attached to this post.
Re: ZX microdrive support improvements
BEWARE: this technique was never tested on the real drives and must be considered experimental !