z88dk forums

z80 Development Kit

You are not logged in.

#1 2020-02-03 22:50:57

Bolador
New member
Registered: 2020-01-30
Posts: 9

another newbe struggling with compiler

roll
Hi i found this cross compiler as a great idea, while I'm not used to C, I thought it shouldn't be so difficult but I īm having serious problems to accomplish almost anything , Iī am following the ZX81-c course at https://forum.tlienhard.com/phpBB3/view … =8&f=8 and letting chrome to translate it as I canīt read german..
I īve instaled the latest nightly a few days ago, and followd succesfully the instalation and Verifyed the zsdcc install (mean ended with no errors as I canīt test sodoku for cpm by any means) acording https://github.com/z88dk/z88dk/wiki/installation..
I could compile/ makeapp and run the "Hello world" succesfully !! but I couldnīt compile almost anything else..hmm
particularlly and just to see how did it look I ītried the hires demo at https://forum.tlienhard.com/phpBB3/view … 68dde6aae9
its a 22 lines source

Code:

#include <graphics.h>
#include <stdio.h>
#include <zx81.h>

#define WIDTH 256
#define HEIGHT 192

int main(void) {
    int x;
    int y;

    printf("\n GRAFIK MIT %d X %d PIXELN\n", WIDTH, HEIGHT);
    clg();
    copytxt(txt_or);

    drawb(0, 0, WIDTH, HEIGHT);

    for (x = 0; x < WIDTH; x++) {
        y = (HEIGHT * x) / WIDTH;
        plot(x, y);
        plot(x, HEIGHT - 1 - y);
    }

    return 0;
}

but I get an error code in line 36! :

C:\...... ........>zcc +zx81 -startup=3 -o hrg192 -create-app hrg192b.c
Error at file 'hrg192b.c' line 36: symbol 'copytxt' not defined
Errors in source file C:\descargas\CZ1000\z88dk\lib\config\..\..\\lib\target\zx81\classic\zx81_crt0.asm:
Error at file 'hrg192b.c' line 36: symbol 'copytxt' not defined

I  know this should be a really newbe easy thing to solve but I see this sort of thing continuously and kinda disappointed for myself..

another thing Iīve noted is that when using 192.c (only numbers in source code file name) I got this other error message
"Error at file 'C:/Users/... ../AppData/Local/Temp/zccA3082.asm' line 1: syntax error"

any help will be welcome..

Offline

 

#2 2020-02-04 02:15:59

Bolador
New member
Registered: 2020-01-30
Posts: 9

Re: another newbe struggling with compiler

Well I found that apparently "clg();
    copytxt(txt_or);" are not declared..(?) Are they supposed to be functions? I just "//" them and could compile without errors but what were them supposed to do?
I couldn't  run in HRG on eighty one ( I have WRX on).  But did it well at 64x48..
Any thoughts?
Regards

Offline

 

#3 2020-02-04 03:04:04

Timmy
Member
Registered: 2012-03-10
Posts: 129

Re: another newbe struggling with compiler

Well, I'm going to bed now, but maybe you could try this: (not sure if it will work, i've never done zx81 before)

zcc +zx81 -subtype=wrx -clib=wrx -lm81 -o hrg192 -create-app hrg192b.c

the tutorial that you're using is very old, so it's very possible all those things are obsolete in the latest version.

Offline

 

#4 2020-02-04 16:12:29

RobertK
Well known member
From: Vienna
Registered: 2018-02-26
Posts: 198

Re: another newbe struggling with compiler

Timmy's compile command works fine. @Bolador: you were only missing the WRX Parameters, so the WRX-specific parts were not included, leading to compiler errors.

Always check the platform page, a few targets require some extra parameters.

I use to create a batch file like this that I run from the command prompt (there I only need to press "Up" and "Enter" for a rebuild):

Code:

setlocal
rem Set your z88dk root path here
set z88root=C:\Misc\z88dk\

set path=%PATH%;%z88root%bin\
set zcccfg=%z88root%lib\config\
set z80_ozfiles=%z88root%lib\

zcc +zx81 -subtype=wrx -clib=wrx -o hrg192 -create-app hrg192b.c

endlocal

rem pause

Note: the -lm81 math library parameter (on other targets just -lm) is not required here, you only need this when your program does e.g. floating point calculations. Adding it won't harm, but it will slightly increase the compiled program's size and therefore require more memory.

Offline

 

#5 2020-02-04 23:08:14

Bolador
New member
Registered: 2020-01-30
Posts: 9

Re: another newbe struggling with compiler

thank you Timmy !! I think that tutorial is good to get a headache..lol

RobertK Than you too!!
I am using the "up" and so on the CMD screen.. it is only that when errors do apear I don't know where to start.. documentation is not so easy and or complete as I would like.. but I think Yhaīs the way it is..hmm

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson