I downloaded the latest z88dk Windows snapshot from 2017-08-03 but I still can't get esxdos calls to work.
I start ZEsarUX in the following way:
zesarux.exe --machine tbblue --enable-mmc --enable-divmmc-ports --mmc-file extras\media\disk_images\tbblue.mmc --enable-esxdos-handler --esxdos-root-dir D:\Spectrum\ZEsarUX_win-5.1\extras\media\spectrum\esxdos_handler\0.8.6_TBBLUE
I must confess that I'm a bit confused by all the MMC options and the ZEsarUX GUI in general. However, if I start ZEsarUX in this way I can type .ls in the BASIC prompt and see the contents of the D:\Spectrum\ZEsarUX_win-5.1\extras\media\spectrum\esxdos_handler\0.8.6_TBBLUE directory where I have also created a test file called test.txt.
Is this how you start ZEsarUX? Should some of the MMC options be removed when using the esxdos-handler?
My test program is the following:
Code: Select all
int main(void)
{
unsigned char handle;
errno = 0;
esxdos_ram_m_setdrv(ESXDOS_DRIVE_CURRENT);
if (errno)
{
printf("Errno in esxdos_ram_m_setdrv(): %d\n", errno);
return 1;
}
errno = 0;
handle = esxdos_ram_f_open("test.txt", ESXDOS_MODE_R | ESXDOS_MODE_OE);
if (errno)
{
printf("Errno in esxdos_ram_f_open(): %d\n", errno);
return 1;
}
...
}
I compile this test program with the following command line:
Code: Select all
zcc +zx -vn -O3 -startup=30 -clib=new test.c -o test -create-app
This program fails with errno ESXDOS_ENOENT (no such file) after the call to esxdos_ram_f_open("test.txt", ESXDOS_MODE_R | ESXDOS_MODE_OE). I use the same flags in esxdos_ram_f_open() as you do in the bmp2next.c program. I can see the test.txt file when doing .ls in the BASIC prompt. Am I doing something wrong or have I missed something? Have you only tested using esxdos from a dot command or have you also used the ram variants of the esxdos calls from a program?
I see that you don't call esxdos_m_setdrv() or esxdos_m_getdrv() in bmp2next.c. When are those calls needed? I have tried to skip them but I still get the same error.
I have also tried to run my test program in CSpect but then it fails with errno ESXDOS_ENODRV (no such drive) after the call to esxdos_ram_f_open("test.txt", ESXDOS_MODE_R | ESXDOS_MODE_OE).