(classic lib) sdcc support and change roundup

New features and project activity between releases
Post Reply
User avatar
Well known member
Posts: 1892
Joined: Sun Jul 15, 2007 10:01 pm

(classic lib) sdcc support and change roundup

Post by dom »

Over the past few months the classic library has undergone a large amount of development to allow programs to work with sdcc and permit ROMable code to be easily developed. At the present the bulk of the classic library has been converted to work with both sdcc and sccz80. This includes both the printf and scanf family of functions as well as many target specific libraries.

Compiling with sdcc rather than sccz80 is a simple case of adding the appropriate options to the compile line. For example if you have the following command line to compile with sccz80:

zcc +zx test.c -lndos -create-app

Then you can switch over to compiling with sdcc as follows:

zcc +zx -SO3 --max-allocs-per-node200000 --reserve-regs-iy -compiler=sdcc test.c -lndos -create-app

The following classic library features are not (yet) available with sdcc:

* some graphics.h routines
* sp1
* Xircom Rex routines
* OSCA SDcard
* qsort, bsearch, memopi, memopd
* Floating point

printf and scanf

The printf family has been completely rewritten for the classic library. It should now be broadly standards compliant and snprintf has been added.

Likewise, the scanf family has been completely rewritten and is likewise heading towards standards compliance.

ANSI library variants and console display

The library variants that support the ANSI terminal have been dropped and their code integrated into the main platform library. There should be no difference in compilation for programs that use the ANSI library - the -clib=ansi compiler option is still supported.

On the ZX Spectrum port, the font width can be selected at compile time using the option:


Where valid values for "columns" are: 85,80,64,51,42,40,36,32,28,24.

For low column counts the ZX ROM font can be used to save space, the following options
can be used:

-pragma-define:ansifont=15616 -pragma-define:ansifont_is_packed=0

Additionally it is possible to redirect screen output for any port to your own function:


(note the underscore). This will cause all screen output to be diverted to your function xyz(int char)

ROM code support

The classic library has switched over to using sections and as a result ROM binaries can be generated more easily. In particular, the -make-app flag has been removed.
Post Reply