[A86] Re: SDCC v2.3.0


[Prev][Next][Index][Thread]

[A86] Re: SDCC v2.3.0




> Van: Patrick Davidson <pad@OCF.Berkeley.EDU>
> 
> > > Do you really need libc when writing calc programs?  If you do, then
you
> > > probably need to rethink what you are doing.  Again, that's not the
> > > purpose here.
> >
> > Uhm, I didn't mean standard stuff (text I/O, string.h, etc.), but
graphics
> > (routines) and the such. At the moment you can make a tremendously
> > beautiful C compiled program that can't output anything (graphics text
> > whatever), not usefull I think...
> >
> > You could off coarse define some ROM routines as 'external' (like
_puts),
> > SDCC passes the first argument via HL.
> 
> Luckily, just passing things in HL seems sufficient to handle
> displaying text on just about every Z80 calculator.

I know...

And basic input needs only a little wrapper to put A into HL (return
register).

> Graphics could also be done with little difficulty just in C.  All you
> would need to for the TI-85/TI-86 is to draw them into the screen buffer
> at $FC00.  You don't need even one ROM routine for this.  On the lower
> calculators, you'd need to use use one buffer copy routine, but that is
> still just one simple ROM call.

Could off coarse be done, but I think the writing in assembly gives you a
bigger freedom in what you can do, which basicaly means that plain-asm
routines will be faster and smaller.

> The graphics routines included in the TIGCC library are themselves
written
> in C, and just directly access buffers like this.  Of course, if your
> compiler tends to produce bad code, that might not be such a good idea.

Not exactly bad code, it's just the 'things that you can't do efficiently
in C' that give the problems. Do note the idea of David Philips, to use the
higher language as 'glue' only.

> Then again, if you are writing hugely complex generic graphics routines,
> that might not be so efficient either as the code would need to handle
> every imaginable case, when it might be much better for a routine to be
> specifically adapted to the specific needs of the program.

A nice example for this is 'printf()'... Full version is 2-3kb in Z80.
(Yes, there will be lots off people who react to this with "wtf do we need
printf()?")

Most people will even share the z88dk's sprite routines to this, because
they can draw with variable width and heigth (most spriteroutines I've seen
are 8x8 or 16x16 only).

> Though on a more broad level, I might like to know exactly what is the
> intended purpose of this particular project; while I have been told what
> isn't the purpose, I'm less certain as to what is.

- Compiler means:
 + Faster creation of programs.
 + You can reuse code.
 + You can program for all of the (Z80) Ti's at one time.
 + 'Dummies' can use it too.
 + You have something to built routines for... (think about it...)

	Henk Poley <><




Follow-Ups: