Page 1 of 1

"How to" for first program

Posted: Wed Sep 12, 2007 4:13 pm
by AntonioCS

I know a bit how to program in C. What I don't know is how to run z88 to convert my .c file to a program for my calculator.

Can anyone make a simple "how to" for this please! Like the first steps and such! please please!!!

Posted: Wed Sep 12, 2007 7:58 pm
by dom
Alvin's ongoing tutorial thread on WoS is targetted for the spectrum but the concepts are applicable to all platforms: ... hp?t=16690

As for calculator support, I'm really not sure of the state of play, there's probably a few comments on about how to make things work.

Posted: Wed Sep 12, 2007 8:12 pm
by AntonioCS
Gee thanks alot for the support

Posted: Thu Sep 13, 2007 8:08 pm
by dom
Maybe a newsgroup would've been a better idea....

I'm baffled as to what you want to do, for example I don't have the following information:

1. What platform you're running z88dk on
2. What target you want to produce a program for
3. What your program does that you want to port to whatever target you want it to run on
4. What you've changed in the source code in an attempt to get it to run on whatever your target is

Without any clue as to what you're hoping to achieve, I can't really give you any help other than to point you in some general directions.

Posted: Mon Sep 24, 2007 9:19 pm
by alvin
Yes it's hard to help out without more information :)

The basic compile command is something like this:

zcc +zx -vn prog.c -o prog.bin -lndos -create-app

The "+zx" selects the z80 target. In this case "zx" is the Sinclair ZX Spectrum and this tells the compiler to use library code written for the Spectrum. You mentioned the intended target is one of the calculators for which there are several possibile targets "+ti8x", "+ti82", "+ti82ansi", "+ti83", "+ti83ansi", "+ti85", "+ti85ansi", "+ti86", "+ti86ansi" depending on which model calculator you are compiling for. I imagine the main difference between them is the graphics code. The ansi libraries include some terminal emulation for stdout.

"-vn" indicates a silent compile (verbose no). "-lndos" links to the stdio library stubs. Many targets do not have disk drives, etc, so cannot have a full stdio implementation. This stdio stub is for such targets. "-create-app" does not work for all z80 targets; this option invokes "appmake" which uses the output machine code to generate a standalone file appropriate for emulators (or whatever) on the intended target. For example, on the ZX Spectrum this option creates a "tap" file which is an electronic image of a tape containing the output binary. "appmake" only supports a finite number of z80 targets and may not be able to do anything for the ti calcs (I don't know but if it doesn't you are welcome to add support!). Regardless of whether or not you can use appmake, zcc will always output the raw binary result.

You would also need to link to more libraries on the compile command if you use them, just like modern C compilers. Eg, if your program uses floating point math you'd need to link to the math library "-lm", etc. Many functions are automatically linked when you specify the target "+zx".

As you can tell I don't have any particular knowledge of the ti ports :) Stef did the ports and I don't know what the state of them is. However he has written a brief ti-intro in the wiki which you should check out before doing anything: