z88dk forums

z80 Development Kit

You are not logged in.

#1 2018-03-02 19:50:30

jacotton
Member
Registered: 2017-11-24
Posts: 26

open RDR: seems to have a problem.

Phys_in = open("RDR:",O_RDONLY,'r');
    if(Phys_in < 0){
        printf("Can't open phys_in %d\n",Phys_in);
        return 1;
    }

My test code always returns -1.
Reading the open code in libsrc, it looks like it can fail at setfcb
and from there cascade.  This is another issue (maybe), in setfcb the
fc->use flag is set to I+U_CON in the read code we are checking for
U_RDR.  Does that get changed somewhere behind the curtains.

N0% stat dev:
CON: is CRT:
RDR: is TTY:
PUN: is TTY:
LST: is TTY:

and pip con:=rdr: 
seems to working fine.

Offline

 

#2 2018-03-02 20:03:51

jacotton
Member
Registered: 2017-11-24
Posts: 26

Re: open RDR: seems to have a problem.

Additional note:  I see that #DEVICES needs to defined for any of this to work.  Is that a standard flag for the library build ?

Offline

 

#3 2018-03-02 21:16:57

jacotton
Member
Registered: 2017-11-24
Posts: 26

Re: open RDR: seems to have a problem.

Solved the open problem by -DDEVICES in Makefile in z88dk/libsrc/fcntl/cpm

Have not figured out the read yet.

Offline

 

#4 2018-03-02 21:29:31

jacotton
Member
Registered: 2017-11-24
Posts: 26

Re: open RDR: seems to have a problem.

adding this snip of code to my program, got the read working.
I think there is a bug in the fc->use flag management.

        fc = &_fcb[Phys_in];
        fc->use = U_RDR;

Offline

 

#5 2018-03-04 14:53:00

dom
Administrator
Registered: 2007-07-15
Posts: 1446
Website

Re: open RDR: seems to have a problem.

Thanks for the investigation. DEVICES was disabled because it caused all sorts of problems with zxcc.

Having poked around in the CPM fcntl a few weeks ago I'm not happy with it at all and can feel a rewrite coming on.

Offline

 

#6 2018-03-04 19:15:15

dom
Administrator
Registered: 2007-07-15
Posts: 1446
Website

Re: open RDR: seems to have a problem.

jacotton wrote:

This is another issue (maybe), in setfcb the
fc->use flag is set to I+U_CON in the read code we are checking for
U_RDR.  Does that get changed somewhere behind the curtains.

This looks okay, i = 1 for RDR:, so that should be 1 + 4 = 5 = U_RDR

Offline

 

#7 2018-03-04 22:47:50

dom
Administrator
Registered: 2007-07-15
Posts: 1446
Website

Re: open RDR: seems to have a problem.

To make things easier, I've created a separate library for fileio with devices - just link with -lcpmdevice and that version of fileio will be used in preference to the simple version. I'm can't remember what the issue with zxcc was, but it seems to have disappeared now.

I'll test RDR etc with yaze in the next few days.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson