ZX Interface 1 ROM edition hassles

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
Posts: 23
Joined: Fri Jan 04, 2019 11:06 am

ZX Interface 1 ROM edition hassles

Post by cha05e90 »

Here's another one: :-)

I try to program some ZX Microdrive specific stuff and learned that my z88dk generated machine code only works with ZX Interface 1 ROM edition 2 hardware and crashes with an edition 1 model. This occurs comprehensibly with my real hardware and with emulators. So it seems that the idea form the "ZX Interface 1 functions (zxinterface1.h)" page...
"This group of functions mainly work by calling directly the low level portion of the ROM routines (which are automatically localized for the three existing firmware versions) to overcome some limitations and bugs."
...doesn't work properly. While examinig the effects I also tried to use the (not documented?) if1_edition() call, which indeed identifies the IF1 ROM edition (emulated and with real hardware) but does not return properly (and "hangs" the Speccy).

Is there any chance (at least at build time?!?) to generate edition 1 compatible code?

Thanks and Regards,
Well known member
Posts: 1637
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Hello, there could be different reasons for the problem you are facing, including bugs: those functions are used rarely and some important functionality is totally missing (due to the lack of working equivalents in the first rom releases.
Nevertheless it worked (a read only file driver is available).
All the provided functions (e.g. if1_load_record) rely onto a dynamic jump table, which is configured at a first function occurrence:

https://github.com/z88dk/z88dk/blob/mas ... rommap.asm

Please share the code portion crashing or an equivalent example.
Posts: 23
Joined: Fri Jan 04, 2019 11:06 am

Post by cha05e90 »

Very strange. While composing the source file for pasting here in the forum I did some house-keeping and deleted *one* line in the source ("#include <math.h>"), because I don't need any special math functions atm. After a quick re-compile the code now works with both editions of the ZX Interface 1 (?!?!). Maybe I did indeed trigger a bug somewhere, but not where I thought... Whatever, now everything's fine and works as expected.

If you're interested, I could send you the "original" binary and the older source file which behave differently with edition 1 and 2 ROMS for further investigation (ca. 5 kb - via e-mail?).

On behalf of the if1_edition() function:

Code: Select all

Just a quick test for the if1_edition() call.
zcc +zx -lm -lndos XXXXXX.c -oXXXXXX.bin -zorg60000

#include <spectrum.h>
#include <zxinterface1.h>
#include <stdio.h>

int edition;

int main(void)
        edition = if1_edition();
        printf("Edition: %u\n", edition);
        return (0);        
It does what it should but does not return to Sinclair BASIC.
Post Reply