z88dk forums

z80 Development Kit

You are not logged in.

#1 2016-05-15 21:18:13

dom
Administrator
Registered: 2007-07-15
Posts: 1444
Website

[z88dk-dev] ANSI libraries removed

Hi,

I've managed to merge the ANSI library into the standard library so
there's only one main library per target.

Things should compile as before - I've kept the "CLIB" targets in the
config files. If they don't then I've broken something so let me know.

The brief changes are:

stdio/{machine}/fputc_cons now exports fputc_cons_native
stdio/{machine}/puts_cons now exports puts_cons_native
stdio/ansi/fputc_cons now exports fputc_cons_ansi
stdio/ansi/puts_cons now exports puts_cons_ansi

Each crt0 file now includes crt0_runtime_selection.asm which performs a
redirect to the appropriate library routine - using the same logic as
asm_vfprintf and as Alvin uses within the new library to select between
size/speed.

To select the ANSI terminal you can use: -pragma-need=ansiterminal to the
command line to set up the appropriate redirection. The default is to the
"native" terminal driver.

If you want to redirect fputc_cons to a different function then use the
following pragma:

#pragma redirect fputc_cons=xyz123

(or -pragma-redirect=fputc_cons=xyz123 from the command line)

Which will cause all calls to fputc_cons() to be pushed through to your
function xyz123


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/3045 … 31938128;j

Offline

 

#2 2016-06-13 23:23:56

dom
Administrator
Registered: 2007-07-15
Posts: 1444
Website

Re: [z88dk-dev] ANSI libraries removed

Amongst the seemingly never-ending task of making the classic library both
SECTIONed and sdcc safe I've come back to the ANSI terminal and allowing
runtime configuration of the columns.

For the Spectrum (and hopefully MC1000) you can now change the number of
columns on screen with the following zcc option:

-pragma-define:ansicolumns=64

The valid values are 85,80,64,51,42,40,36,32,28,24.

To save space and use the ROM font (or indeed any other font) there's a
couple more options that can be used:

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

(wiki has been updated with this info as well)

Regarding section support, all ports apart from OSCA, OZ and ZX81 have had
work done to them. Some of these are a bit tangled (especially ZX81) so if
you're around Stefano, then help would be appreciated.

Regarding library support, most of the cross-platform routines have been
made sdcc, the exceptions are: memopi, memopd, qsort and bsearch, itox,
itod, ltoa, ultoa.

I'm working through platform specific libraries when I get a chance, but
at this point I think there's a really good chance that quite a lot of
compilations should work with sdcc as well as sccz80.

Having said that, there's still something like 1500 .asm files still to
check, section and protect ix as necessary.



On Sun, 15 May 2016, Dom Morris wrote:

Hi,

I've managed to merge the ANSI library into the standard library so
there's only one main library per target.

Things should compile as before - I've kept the "CLIB" targets in the
config files. If they don't then I've broken something so let me know.

The brief changes are:

stdio/{machine}/fputc_cons now exports fputc_cons_native
stdio/{machine}/puts_cons now exports puts_cons_native
stdio/ansi/fputc_cons now exports fputc_cons_ansi
stdio/ansi/puts_cons now exports puts_cons_ansi

Each crt0 file now includes crt0_runtime_selection.asm which performs a
redirect to the appropriate library routine - using the same logic as
asm_vfprintf and as Alvin uses within the new library to select between
size/speed.

To select the ANSI terminal you can use: -pragma-need=ansiterminal to the
command line to set up the appropriate redirection. The default is to the
"native" terminal driver.

If you want to redirect fputc_cons to a different function then use the
following pragma:

#pragma redirect fputc_cons=xyz123

(or -pragma-redirect=fputc_cons=xyz123 from the command line)

Which will cause all calls to fputc_cons() to be pushed through to your
function xyz123


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/3045 … 31938128;j

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/3052 … 32659582;e

Offline

 

#3 2016-07-06 21:25:48

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: [z88dk-dev] ANSI libraries removed

Amongst the seemingly never-ending task of making the classic library both
SECTIONed and sdcc safe I've come back to the ANSI terminal and allowing
runtime configuration of the columns.

For the Spectrum (and hopefully MC1000) you can now change the number of
columns on screen with the following zcc option:

-pragma-define:ansicolumns=64

The valid values are 85,80,64,51,42,40,36,32,28,24.

(..)

The facts are showing how much we liked it.
After Alvin adding the extra modularity I'm proposing to compute the ANSI VT column sizes basing on the target's preset number of pixels (i.e. it will be 236 on the Sharp VZ).
I'm not fully sure I did it right, so I'd like to have your opinion on my just submitted variant.
of crt0_runtime_selection.asm



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

Offline

 

#4 2016-07-07 19:33:38

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: [z88dk-dev] ANSI libraries removed

Sharp OZ-700 now in the loop and partially tested (default is always 64 columns text which on the OZ700 means a 3 bit font size).
I had to fix also a header file and a, OZ-700 specific library file with conflicting types.



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

Offline

 

#5 2016-07-07 22:36:36

dom
Administrator
Registered: 2007-07-15
Posts: 1444
Website

Re: [z88dk-dev] ANSI libraries removed

On 7 Jul 2016, at 19:33, Stefano Bodrato (stefano_bodrato@...) <lists@...> wrote:

Sharp OZ-700 now in the loop and partially tested (default is always 64 columns text which on the OZ700 means a 3 bit font size).
I had to fix also a header file and a, OZ-700 specific library file with conflicting types

It's great to have you back. I was a bit worried about adding sections to the OZ port but it looks like I didn't break anything too badly!





------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

Offline

 

#6 2016-07-08 16:13:40

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: [z88dk-dev] ANSI libraries removed

It's great to have you back. I was a bit worried about adding sections to the OZ port but it looks like I didn't break anything too badly!

Eeerm.. actually I discovered I tested the wrong lib version. there is surely still something to fix on the OZ stuff.     Working on it should be a good introduction before the bigger work on the ZX81 lib  smile



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

Offline

 

#7 2016-07-09 22:37:00

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: [z88dk-dev] ANSI libraries removed

. there is surely still something to fix on the OZ stuff.

Ok, new default for the oz-7xx is now 59 columns and size variations work correctly.

We lost years ago the buffered input drivers (I couldn't get in touch to Benjamin Green anymore so we respected his original copyright message and removed his code) and the original Hitech C version by A. Pruss permitted a better memory management but now SDCC can potentially surpass it  wink

Perhaps I'll get into this later, but I'd first attempt to improve similarly the TI Calculators.
Then, sooner or later, I'll have to face the ZX81 thing :S



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

Offline

 

#8 2016-07-11 07:18:23

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: [z88dk-dev] ANSI libraries removed

Ok, by setting the right columns number and and dealing with defaults it seems to be working perfectly, so the OZ is confirmed to be running (as originally only within the 8K memoy boundary) with the extra capability to choose the number of text columns.

I just published the same adjustments for the TI calculators, but there is still a couple of things probably needing a fix..
trying to build the libraries myself I get the following error:

Error at file '\Temp\sep4_.opt' line 320: symbol 'vfprintf' already declared local

Where's my mistake ?



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

Offline

 

#9 2016-07-16 18:02:59

alvin
Administrator
Registered: 2007-07-16
Posts: 1932

Re: [z88dk-dev] ANSI libraries removed

Error at file '\Temp\sep4_.opt' line 320: symbol 'vfprintf' already declared local
Where's my mistake ?

The label is declared twice somehow.   I noticed this error generated once by z80asm but I can't quite remember the circumstance.  It had something to do with the wrong order of label use and EXTERN/PUBLIC declaration.  Perhaps you've defined the label and then done an EXTERN aftwerward?



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

Offline

 

#10 2016-07-17 16:28:57

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: [z88dk-dev] ANSI libraries removed

>The label is declared twice somehow.   I noticed this error generated once by z80asm but I can't quite remember the >circumstance.  It had something to do with the wrong order of label use and EXTERN/PUBLIC declaration.  Perhaps >you've defined the label and then done an EXTERN aftwerward?

I still couldn't spot the problem, but I can try to base my search on yout hint.
I can reproduce it rebuilding any target library if I first fully clean the libsrc tree.



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

Offline

 

#11 2016-07-18 07:29:14

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: [z88dk-dev] ANSI libraries removed

>I still couldn't spot the problem, but I can try to base my search on yout hint.
>I can reproduce it rebuilding any target library if I first fully clean the libsrc tree.

I have a workaround, but I'm not sure on its impact:

Code:

int vfprintf_mini(FILE *fp, unsigned char *fmt,void *ap)
{

#asm

;EXTERN    fputc
EXTERN _miniprintn
EXTERN    l_glong
EXTERN    l_int2long_s

;.vfprintf                              <--------   COMMENTED OUT !!


pop af
pop de    ; arg_ptr
pop hl    ; format string

This solves the conflict, but I am now afraid that some printf() variant could miss this entry.



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

Offline

 

#12 2016-07-18 07:58:34

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: [z88dk-dev] ANSI libraries removed

This solves the conflict, but I am now afraid that some printf() variant could miss this entry.

Answering to myself.. vfprintf_mini() seems not to exist anymore in the current z88dk tree.
.. time to do some local housekeeping <blush>.



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

Offline

 

#13 2016-07-18 15:21:33

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: [z88dk-dev] ANSI libraries removed

This solves the conflict, but I am now afraid that some printf() variant could miss this entry.

It seems I never posted the last message:   it was easy, I just had to take vfprintf_mini.c off the way  <blush>

Stefano



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

Offline

 

#14 2016-07-20 08:18:22

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: [z88dk-dev] ANSI libraries removed

Sharp X1 ANSI columns default value corrected and Epson PX4 support lib renewed (see wiki pages).
Now the X1 works in both 40 and 80 column mode, the PX4 now works in native CP/M text mode or 30, 34, 40, 48, 60 and 80 columns ANSI VT emulation mode.
A similar option is already in place for the Sharp OZ and the TI calculators.



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

Offline

 

#15 2016-08-01 19:43:44

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: [z88dk-dev] ANSI libraries removed

ZX81 ANSI support fixed.
The option to use the ROM font is still in but due to the way it works it is normally inactive and a lib rebuiltion is necessary.
All the other options are now much easier !



------------------------------------------------------------------------------

Offline

 

#16 2016-07-17 20:34:34

pscust
Well known member
Registered: 2011-06-23
Posts: 194

Re: [z88dk-dev] ANSI libraries removed

Can you give the command line and source file that causes the error?

On Sat, Jul 16, 2016 at 6:02 PM, alvin (alvin_albrecht@...) <
lists@...> wrote:

Error at file '\Temp\sep4_.opt' line 320: symbol 'vfprintf' already

declared local

Where's my mistake ?

The label is declared twice somehow.   I noticed this error generated once
by z80asm but I can't quite remember the circumstance.  It had something to
do with the wrong order of label use and EXTERN/PUBLIC declaration.
Perhaps you've defined the label and then done an EXTERN aftwerward?




------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and
traffic
patterns at an interface-level. Reveals which users, apps, and protocols
are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning
reports.http://sdm.link/zohodev2dev

Offline

 

#17 2016-08-05 01:59:52

alvin
Administrator
Registered: 2007-07-16
Posts: 1932

Re: [z88dk-dev] ANSI libraries removed

ZX81 ANSI support fixed.
The option to use the ROM font is still in but due to the way it works it is normally inactive and a lib rebuiltion is necessary.
All the other options are now much easier !

Maybe you can have a look at the forum?  Someone is saying it doesn't work.



------------------------------------------------------------------------------

Offline

 

#18 2016-11-28 15:34:38

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: [z88dk-dev] ANSI libraries removed

If you want to redirect fputc_cons to a different function then use the
following pragma:

#pragma redirect fputc_cons=xyz123
(...)

I succesfully tested it with the fonts grabbed from the NewsMaster / PrintMaster tools, picking a module I already created for the XLIB emulation  ("font.h" is the font generated via "sprite editor").   A bit of extra hack might be needed for the control codes, but it works:


Code:

#include <stdio.h>
#include <graphics.h>
#include <X11/Xz88dk.h>
#include "font.h"

extern char __LIB__ xputc (char c);

extern char xputc (char c) {
_xfputc (c, font, 0);  // char, font, bold flag
return (c);
}

#pragma redirect fputc_cons=xputc

main()
{
clg();
printf("Hello   Microbee   users !!!");
while (getk()!=13){};
}

I thought to suggest to add a protection against recurrencies for this possible misuse:
#pragma redirect xyz123=xyz123



------------------------------------------------------------------------------

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson