z88dk forums

z80 Development Kit

You are not logged in.

#1 2016-11-10 20:06:47

Registered: 2007-07-16
Posts: 1581

[z88dk-dev] Workaround for CP/M (legacy lib)

The Legacy library (or "classic", if you prefer this latter term) makes the "gets()" function fail; the EOL is not managed correctly by the tiny implementation in ASM.
I vaguely recall we already discussed this topic but I couldn't find it in the forum archives.

This workaround seems to work fine:


/* You shouldn't use gets. z88 gets() is limited to 255 characters */
#ifdef __STDIO_CRLF
#define gets(x) fgets_cons(x,255)
extern char __LIB__ *gets(char *s);

__STDIO_CRLF is defined only in the MSX, CP/M or OSCA variants, presumably capable of a complete stdio/fcntl support.
In all the other cases the asm implementation of gets() works well.
The new versions of stdio won't be impacted because they're based on different "stdio.h" variants.

Opinions ?

I noticed also another problem with CP/M: the old file and directory related example programs are all failing..  I'm investigating.   I suspect drive number definition connected to the filename specification is connected to the problem.

Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi



Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson