help compile c128 example

Discussion about other targets
Post Reply
oflor
Member
Posts: 19
Joined: Fri Nov 09, 2018 9:43 pm

help compile c128 example

Post by oflor »

HI:

Mr. Stefano, Pals!

I want to use z88dk to do some programs on a Commodore 128 NTSC / WinVice 3.1.

I try to compile the example sgdemo.c from the examples\c128 folder using the two ways writed into the .c file comments

For native mode:

zcc +c128 -lndos -lmalloc sgdemo.c

And for cp/m mode:

zcc +cpm -lc128cpm -lndos -lmalloc sgdemo.c

But on the two cases raises this error:

sccz80:"sgdemo.c" L:55 Error:Illegal Argument Name:

I see the line 55 of sgdemo.c and this appears:

/* 64k vdc locations */

That I assume is not the problem but the previous line:

extern long heap(60000);

Please, can help me to compile this example!

I'm using the z88dk-win32-2.0 on Window 10 Pro

Thanks in advance for Your time!
oflor
Member
Posts: 19
Joined: Fri Nov 09, 2018 9:43 pm

Post by oflor »

I resolve this by Myself.

Change to using the static form of heap variable:

long heap;

Compile without using -lmalloc, because now is part of the system library itself.

Here a helpfull batch file to help pals:

zcc +c128 -subtype=disk -create-app -lm sgdemo.c -o sgdemo.bin
c1541 -format "sgdemo,sg" d64 sgdemo.d64
c1541 -attach sgdemo.d64 -write sgdemo.ldr sgdemo.ldr
c1541 -attach sgdemo.d64 -write sgdemo sgdemo
rem c1541 -attach sgdemo.d64 -write demo1.pcx demo1.pcx
rem c1541 -attach sgdemo.d64 -write demo2.pcx demo2.pcx
rem x128 -autostart "sgdemo.d64:sgdemo.ldr"
x128 "sgdemo.d64:sgdemo.ldr"

Enjoy
User avatar
dom
Well known member
Posts: 2072
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Sorry, I applied a fix for this yesterday but I was too tried to comment here.

Probably for the best since your fix is much more portable!

Thanks for the little script - I've not enjoyed running c128 programs through Mame so I'll try it out and see if it's quicker!
oflor
Member
Posts: 19
Joined: Fri Nov 09, 2018 9:43 pm

Post by oflor »

HI:

*** Missing Files ***

Where I can obtain the missing files to test full this program? sgdemo.c -> c128
DEMO.RAW
DEMO1.PCX
DEMO2.PCX

How I need to add it into the d64 image file? As PRG? As SEQ?

Thanks Pals
User avatar
dom
Well known member
Posts: 2072
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

It looks like the PCX files can be obtained from here: http://www.z80.eu/gsx.html
oflor
Member
Posts: 19
Joined: Fri Nov 09, 2018 9:43 pm

Post by oflor »

I try to test this program on a "normal" c128 NTSC without 64K VDC expansion and I can't.

Appears a "windows" that says "saving character sets to buffer" and then hang.

I think this demo doesn't work on a c128 with 16k VDC ram.
oflor
Member
Posts: 19
Joined: Fri Nov 09, 2018 9:43 pm

Post by oflor »

To make it work on a c128 ntsc without vdc 64k expansion it need the line 694 to be commented and uncomment the next line, like this.

//if(savechrsets()) /* check if vdc in 16k mode */
if(1) /* check if vdc in 16k mode */

That's because the routine savechrsets doesn't work as spected.

uchar savechrsets(void)
{
if(is64kvdc())
return(1);
else
{
appChSetBufPtr = memtobufvdc(vdcCharMem,vdcCharMemSize); <== this line doesn't do its job
if (appChSetBufPtr != NULL)
return(1);
else
return(0);
}
}

As collateral damage, the character memory is not restored when return from graphic mode and show garbage on screen instead of characters, even if a call to savechrsets is maded by hand.
oflor
Member
Posts: 19
Joined: Fri Nov 09, 2018 9:43 pm

Post by oflor »

dom wrote:It looks like the PCX files can be obtained from here: http://www.z80.eu/gsx.html
I find the files here, Thank You, but the demo doesb't load the images.

Maybe other problem happend.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Hello, the file support is only available in cp/m, I think you are using the native c128 format.
The cool thing in this is that you are running a cassette loadable program which was originally for cp/m only.
Post Reply