Showing posts with label z88dk. Show all posts
Showing posts with label z88dk. Show all posts

Thursday, March 10, 2011

z88dk or sdcc ?

Not sure that z88dk is going to work for me. Concern about how well the linker output can be controlled and how well it works for rommable code:

Z80 will need special consideration for placing startup code and interrupt vectors. Not seeing anything in z88dk akin to an ld script where sections and memory placement can be specified.

Noted that z88dk supports an asxxx assembler output mode, so it could work better to assemble select modules in C and integrate them with my existing asxxx project.

sdcc looks promising based on based on ASXXXX and targets many micros including Z80. Some useful Z80 specific info on the wiki and good documentation. Article on ColecoVision development.

Wednesday, March 9, 2011

z88dk Compile and Link Example

Today I want to link a C file, with an assembly module which is fixed in place, while also allowing the linker to link the CRT0 into the configuration.

Makefile:

all: test.bin

junk.o: junk.asm
zcc -o junk.o -c junk.asm

test.o: test.c
zcc -o test.o -c test.c

test.bin: test.o junk.o
zcc +rex -o test.bin test.o junk.o



$ cat junk.asm

org $8100
junk:
xor a
jp junk


However, the z88 linker has simply added my assembly module to the end of the binary image and not at $8100(excerpt...)

l8031h:
xor a
jp l8031h

Tuesday, March 8, 2011

z88dk Target

Looking at the instructions for porting the z88dk to a new machine target.. if "system is ROM based, base the startup file on lib/rex_crt0.asm"

So lets see what the rex configuration will do.. (wasn't that a pocket organizer Jerry Seinfeld gave to his father?)

The relevant example is in "z88dk\examples\rex". I created a C file test.c with only an empty main() block ... and compiled thusly:

zcc +rex -o test.bin test.c

I downloaded and compiled (under Cygwin gcc) the disassembler "z80dasm-1.1.2.tar.gz".

Ran the disassembler against test.bin and got exactly just the codes from lib/rex_crt0.asm

The custom crt0 is created in "lib" and the configuration .cfg file should be created in the lib/config directory for the target. (According to "z88dk/doc/zcc.html#config" we can create that configuration file anywhere.)

Z88DK

I started fooling around with Z88DK

Building the kit from the source distro - z88dk-src-1.9.tgz - in Cygwin on Win XP. Compiler is "gcc version 4.3.4 20090804" (Target: i686-pc-cygwin).

Following the instructions in z88dk/README.1st ... I created the following config file for my shell environment:

Z88DK=~/z88dk
export Z80_OZFILES=$Z88DK/lib/
export ZCCCFG=$Z88DK/lib/config/
export PATH=$Z88DK/bin:$PATH

In ./z88dk/src/z80asm/z80pass.c I had to change 3 references to "getline" to "mygetline" to avoid a naming conflict with getline declared in . Should change z80pass.c to make this a static instead.

Once the build completed, run make in "/z88dk/examples/embedded" to build one of the sample app.