another newbe struggling with compiler

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
Bolador
New member
Posts: 9
Joined: Thu Jan 30, 2020 4:56 am

another newbe struggling with compiler

Post by Bolador »

:rolleyes:
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 ... hp?f=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..:/
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: Select all

#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..
Bolador
New member
Posts: 9
Joined: Thu Jan 30, 2020 4:56 am

Post by Bolador »

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
Timmy
Well known member
Posts: 393
Joined: Sat Mar 10, 2012 4:18 pm

Post by Timmy »

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.
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

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: Select all

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.
Bolador
New member
Posts: 9
Joined: Thu Jan 30, 2020 4:56 am

Post by Bolador »

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..:/
Post Reply