I have a [hopefully] useful piece of code I’d like to convert into a dot command. The code is written in C and compiled with z88dk toolchain. But there is problem: the code essentially loads stuff from the real tape (yes, the physical tape, MIC port). No fancy tricks, LD_BYTES ROM routine will do. And I could not find much information about that. Is it possible at all? I guess it should be, because when compiled as “regular” code, it can access both tape and disk at the same time. And no, simply recompiling my code with -subtype=dot results in a crash when tape loading is about to begin.
The case can be reduced to something like this:
Code: Select all
#include <arch/zx.h>
#include <arch/zx/esxdos.h>
// compile:
// zcc +zx -vn -subtype=dot -startup=30 -clib=new -SO3 --opt-code-size test.c -o test -create-app
int main() {
unsigned char file;
struct zxtapehdr hdr;
zx_tape_load_block(&hdr, sizeof(hdr), ZXT_TYPE_HEADER);
if (16384 == hdr.hdadd && 6912 == hdr.hdlen) {
file = esxdos_f_open("TEST.SCR", ESXDOS_MODE_CREAT_TRUNC|ESXDOS_MODE_W);
if (file) {
zx_tape_load_block((void *)hdr.hdadd, hdr.hdlen, ZXT_TYPE_DATA);
esxdos_f_write(file, (void *)hdr.hdadd, hdr.hdlen);
esxdos_f_close(file);
}
}
return 0;
}