Gettign started with Z88DK

If you like transforming your statements into code, this is the place for you

Moderator: Programming Moderators

Post Reply
Bagpuss
Posts: 27
Joined: Tue Jun 06, 2017 9:13 pm

Gettign started with Z88DK

Post by Bagpuss » Tue Apr 17, 2018 7:27 pm

Hi,
Any recommendations for using Z88DK under windows? I'm looking to move from Z80 assembler to Z88DK but in 30 years of development with many compilers, z88dk is proving to be the most akward for me to use.
I'm using windows 10 pro with z88 on h:\z88dk
I've set up Z88DKm Z80_OZFILES, ZCCCFG and PATH accordingly

I've also installed GNU utils and make. Each time I try to build the libsrc I just get errors, the Next libraries won't compile either.

Anyone else using z88dk can give me recommendations on their setup they are using.

My latest fiasco is :

H:\z88dk\libsrc>make
''
'--- Building Z80 crt0 Library ---'
''
rm: cannot remove `crt0/*.o*': Invalid argument
rm: cannot remove `crt0/*.sym': Invalid argument
rm: cannot remove `crt0/*.map': Invalid argument
make[2]: *** [clean] Error 1
make[1]: *** [H:/z88dk/libsrc//z80_crt0.lib] Error 2
make: *** [z80_crt0.lib] Error 2

User avatar
varmfskii
Posts: 186
Joined: Fri Jun 23, 2017 1:13 pm
Location: Albuquerque, NM USA

Re: Gettign started with Z88DK

Post by varmfskii » Tue Apr 17, 2018 11:43 pm

I use it under Linux, not windows, but you generally have to have the binaries built and installed in your path before you can compile the libraries.
Backer #2741 - TS2068, Byte, ZX Evolution

Alcoholics Anonymous
Posts: 513
Joined: Mon May 29, 2017 7:00 pm

Re: Gettign started with Z88DK

Post by Alcoholics Anonymous » Wed Apr 18, 2018 1:57 am

I just answered on FB but this place is more permanent.

A portion of z88dk cannot be built in windows so every night a windows package is produced at http://nightly.z88dk.org/ .

Just download the latest z88dk build for windows and unzip where you want it.

Then add the ZCCCFG system variable and add z88dk/bin to your PATH. Some instructions https://www.z88dk.org/wiki/doku.php?id= ... nt#windows .

That's it.

z88dk is an active project (daily commits) and the zx next target is being actively developed too so you may want to grab a new build occasionally to keep up. You can also monitor commits on github ( https://github.com/z88dk/z88dk/commits/master ) to see if anything interesting pops up. Just rename or delete your existing z88dk directory tree and unzip to the same location; the environment variables will still be valid.

There is a lot to z88dk :- assembler, linker, librarian, two c compilers, two c libraries. The zx next target has all the new opcodes defined, special opcodes for programming the dma that are error checked and also special opcodes for the copper unit. It can also target all of the zx next's memory and it can generate a variety of output types including tap, sna, dot and raw binaries.

A gentle introduction by someone also learning can be found here:
https://github.com/z88dk/z88dk/blob/mas ... edGuide.md

It's for the zx spectrum. The zx next target is a superset of the zx spectrum so the tutorial can still be used as an introduction. To compile for the zx next instead of the zx spectrum, change the target to "+zxn" from "+zx" on the compile line. To change the output type to sna instead of tap, add "-subtype=sna" to the compile line.

Examples for the zx spectrum and the zx next can be found in the newlib's example directory that you will have a local copy of in z88dk/libsrc/_DEVELOPMENT/EXAMPLES:
https://github.com/z88dk/z88dk/tree/mas ... T/EXAMPLES

It's important to note that the zx next target is in the newlib which has its source code rooted in z88dk/libsrc/_DEVELOPMENT and its header files rooted in z88dk/include/_DEVELOPMENT/*compiler* (the headers for different compilers are equivalent; the zsdcc compiler's headers are in sdcc and the sccz80 compiler's headers are in sccz80).

Questions can be asked here, at the forum, or (for bugs) on github.

SamusDrake
Posts: 252
Joined: Mon Jun 26, 2017 10:11 pm
Contact:

Re: Gettign started with Z88DK

Post by SamusDrake » Wed Apr 18, 2018 10:49 am

I'm in the process of getting Z88DK to work in Codeblocks( Windows 10 ) and once I'm successful in a test build I'll be sure to share the instructions.

Bagpuss
Posts: 27
Joined: Tue Jun 06, 2017 9:13 pm

Re: Gettign started with Z88DK

Post by Bagpuss » Sun Apr 22, 2018 9:14 am

Cool.
Got the build installed. Just trying to resolve an issue that it can't find indents
C:\z88dk\libsrc\_DEVELOPMENT\EXAMPLES\zxn\copper\layer_priority>zcc +zxn -vn -startup=31 -SO3 -clib=sdcc_iy --max-allocs-per-node200000 @zproject.lst -o terms -pragma-include:zpragma.inc -subtype=sna -create-app
terms.c:145: error 20: Undefined identifier 'REG_COPPER_CONTROL_LO'
terms.c:145: error 20: Undefined identifier 'REG_COPPER_CONTROL_LO'
terms.c:146: error 20: Undefined identifier 'REG_COPPER_CONTROL_HI'
terms.c:146: error 20: Undefined identifier 'REG_COPPER_CONTROL_HI'
terms.c:155: error 20: Undefined identifier 'REG_COPPER_CONTROL_HI'
terms.c:155: error 20: Undefined identifier 'REG_COPPER_CONTROL_HI'
terms.c:155: error 20: Undefined identifier 'RCCH_COPPER_RUN_ON_INTERRUPT'
terms.c:155: error 20: Undefined identifier 'RCCH_COPPER_RUN_ON_INTERRUPT'
I suspect it may be a path thing but not sure.

Alcoholics Anonymous
Posts: 513
Joined: Mon May 29, 2017 7:00 pm

Re: Gettign started with Z88DK

Post by Alcoholics Anonymous » Sun Apr 22, 2018 6:12 pm

It looks like you forgot to:

#include <arch/zxn.h>
https://github.com/z88dk/z88dk/blob/mas ... arch/zxn.h

That's where most of the defines are.

The actual numerical values are in this machine generated file:
https://github.com/z88dk/z88dk/blob/mas ... rivate.inc

And the values themselves are defined in one place for asm and c, the m4 files in:
https://github.com/z88dk/z88dk/tree/mas ... zxn/config

Some of these files have documentation in them, some are still waiting for docs.

If that's the incomplete copper example in the zxn examples dir (?) then it could be the constants were changed too. Compare to:
https://github.com/z88dk/z88dk/blob/mas ... per.m4#L68

I was using that example to test changes to nextreg in the horizontal scanline on real hw at a time where some stuff in the copper was broken and I haven't returned to it. cspect cannot emulate this but zesarux may be able to with its recent implementation.

Bagpuss
Posts: 27
Joined: Tue Jun 06, 2017 9:13 pm

Re: Gettign started with Z88DK

Post by Bagpuss » Sun Apr 22, 2018 6:28 pm

HI, Had a moment of slight achievement :)
Edited the code, changed 'REG_COPPER_CONTROL_LO' to 'REG_COPPER_CONTROL_L',
'REG_COPPER_CONTROL_HI' to 'REG_COPPER_CONTROL_H'
and 'RCCH_COPPER_RUN_ON_INTERRUPT' to 'RCCH_COPPER_RUN_VBI
and it all compiles fine and runs under cspect, I assume that its a code issue in the example code?

I downloaded the nightly build from 17th, so wonder if it was an issue in that build.

Now to start porting my stuff to Z88DK :)

Alcoholics Anonymous
Posts: 513
Joined: Mon May 29, 2017 7:00 pm

Re: Gettign started with Z88DK

Post by Alcoholics Anonymous » Mon Apr 23, 2018 2:05 am

Bagpuss wrote:
Sun Apr 22, 2018 6:28 pm
HI, Had a moment of slight achievement :)
Edited the code, changed 'REG_COPPER_CONTROL_LO' to 'REG_COPPER_CONTROL_L',
'REG_COPPER_CONTROL_HI' to 'REG_COPPER_CONTROL_H'
and 'RCCH_COPPER_RUN_ON_INTERRUPT' to 'RCCH_COPPER_RUN_VBI
and it all compiles fine and runs under cspect, I assume that its a code issue in the example code?

I downloaded the nightly build from 17th, so wonder if it was an issue in that build.
Good job, that's exactly what needs fixing.

It's an ongoing issue with that example as it's not complete yet. The constant names were changed when the copper was fixed.

cspect cannot emulate it because the copper is being programmed to change layer priority in four places in one scan line but cspect prepares an entire scan line at a time and does not see changes made during the scan line. zesarux has just implemented the copper so I'm not sure what it is doing yet.

The example is not complete because it's supposed to have two timex hi-res windows scrolling text that are brought above the scrolling layer 2 so that it looks like layer 2 is scrolling around the timex windows. The copper only has enough space to do some of the rows so the complete example will be streaming copper instructions in with the dma to do the full size text windows. It's intended to be a somewhat more complicated than normal application but done with an example that's small enough to understand easily.
Now to start porting my stuff to Z88DK :)
Have fun :)

Post Reply