C128 CP/M program hangs with submit

Post Reply
sgjava
Member
Posts: 25
Joined: Thu Feb 22, 2024 9:25 pm

C128 CP/M program hangs with submit

Post by sgjava »

I'm porting over a code base from HTC 3.09 and so far, so good. One thing I'm running into is submit hanging running the same program multiple times with different args.

The program is https://github.com/sgjava/c3lz/blob/mai ... /convpcm.c and compiled with this https://github.com/sgjava/c3lz/blob/5f0 ... ild.sh#L29.

I'll work on a simple sample to see where the hang is. It may be because of -DAMALLOC?
stefano
Well known member
Posts: 2328
Joined: Mon Jul 16, 2007 7:39 pm

Re: C128 CP/M program hangs with submit

Post by stefano »

You could try skipping the whole malloc() part and try running it with a fixed 8192 buffer/array to see if something changes.
A frequent problem when porting old K&R C program is the fcntl implementation, I think it is worth too check it as well.
Also trying to run a GCC build helps, because of its accurate warnings.

PS
The playzb4() function is now ported to few more target, including the the early Bondwell models and the ZX Spectrum.
That converter would greatly help.
sgjava
Member
Posts: 25
Joined: Thu Feb 22, 2024 9:25 pm

Re: C128 CP/M program hangs with submit

Post by sgjava »

I built a malloc hello world and it works fine using submit. I probably need to do the warning check like you said. Actually all the code should be ANSI (C89), not K&R. I've put in various return points to see where it hangs, but it's hard to narrow down.

I have 1, 2 and 4 bit players now...
stefano
Well known member
Posts: 2328
Joined: Mon Jul 16, 2007 7:39 pm

Re: C128 CP/M program hangs with submit

Post by stefano »

I remember very well the Covox stuff, they had even a very interesting 3 bit format, in their MSDOS software.
I think the Sound master II stuff is reachable online in some DosBox related forum.
4 bit look like a good compromise for the 8bit systems. Not too lossy on 8bit DACs, perfect for the SID or some PGS (I think), not impossible to support with the bit banging.
sgjava
Member
Posts: 25
Joined: Thu Feb 22, 2024 9:25 pm

Re: C128 CP/M program hangs with submit

Post by sgjava »

OK,so it looks like stat is the problem. It doesn't play well with submit. Reproduce case:

Submit file https://github.com/sgjava/c3lz/blob/mai ... s/test.sub
C source https://github.com/sgjava/c3lz/blob/mai ... baseline.c

Output on screen:

82.GG.I.I.BKILKIIH.I<GSUBMIT COM*"#$B.G654321C
B>

If you run without submit it works. I used HTC and submit works. It's something in z88dk implementation.
Post Reply