RE: [bascom] Lookalike


From "Mark Alberts" <mark@mcselec.com>
Date Sun, 7 Apr 2002 12:43:47 +0200

Hi,

Here is how you can save code.
Use $NORAMCLEAR so the sram will not be cleared (set to 0).
Do not use the SINGLE or LONG, they use more code.
Use only bytes when possible. When using byte conversion like
input,print,str,val,hex etc.
use the mcsbyte.lib like:
$lib "mcsbyte.lbx"
This will replace the default library with a light version that only
supports bytes.
When you also need integers and words, use :
$lib "mcsbyteint.lbx" this will work for byte,int and word
When using an LCD display, the default library works for a worst case
scenario whenre you have routed all pins random. THis is great for a simple
PCB design but it needs more code. Use one of the available LCD replacement
routines like lcd4. I just finished a lcd replacement lib that will   check
the busy pin. Will post that later.
When you use delays, use waitms and not wait together. Instead a waitms 1000
will also wait for a second.

When you need an interrupt, use the NOSAVE option and save/restore the
registers yourself. Do not write complete applications within an interrupt
handler.

Do not construct all the separate i2c statements yourself when there is a
statement that can do it at once. for example i2csend will write to a slave
address and can send data. Do use it when possible and do not use i2cstart,
send slave,send data,i2cstop.
Also look at i2creceive which is very flexible. it can send data and receive
data.

Use gosub and global memory only and do not use user functions/subs that
pass parameters.

Well these are a couple of things I could think of. And of course check the
'optimise' option.
The 'optimise' function is not completely ready however. Will continue that
after 'M128 mode' support is finished.

mark

> -----Original Message-----
> From: owner-bascom@grote.net [mailto:owner-bascom@grote.net]On Behalf Of
> David White
> Sent: zaterdag 6 april 2002 22:55
> To: bascom@grote.net
> Subject: RE: [bascom] Lookalike
>
>
> I would like to use 2313s as "intelligent peripherals" communicating with
> other AVRs such as the 8515 via SPI or I2C, depending on the
> function being
> performed. It looks as though I will need to write SPI and/or I2C slave
> routines for the 2313, but that is O.K. My main concern is
> whether I can fit
> enough code into the 2313 using Bascom. I have found it hard to fit much
> into the 2k of a 2313. The e-mail thread on bascom code size seems to be
> saying that this is primarily a function of the comprehensive capabilities
> of the standard Bascom library. If that is so, is it possible to create a
> special cut down library with only the capability I need and use that to
> save space in this application? I really don't want the hassle of
> having to
> write all my 2313 code in assembler if I can avoid it. If this
> can be done,
> any pointers on how to do it, such as what functions are required and what
> are optional, would be much appreciated.
>
> Dave White
>
> -----Original Message-----
> From: owner-bascom@grote.net [mailto:owner-bascom@grote.net]On Behalf Of
> Joaquim Boavida
> Sent: Wednesday, April 03, 2002 12:22 AM
> To: bascom@grote.net
> Subject: RE: [bascom] Lookalike
>
>
> I completly agree with Mark.
>
> Is not easy to build a compiler with floating point math for instance.
>
> FastAvr doesn't support it. Hard to implement isn'it ?
>
> Joaquim
>
>
> -----Mensagem original-----
> De: owner-bascom@grote.net [mailto:owner-bascom@grote.net] Em nome de
> Mark Alberts
> Enviada: terça-feira, 2 de Abril de 2002 22:06
> Para: bascom@grote.net
> Assunto: RE: [bascom] Lookalike
>
>
> Hi,
>
> BASCOM by default supports printing/input of a LONG variable. This means
> that when you print bytes, you have overhead for int/word and longs.
> That is why there are mcsbyte.lib and mcsbyteint.lib libraries. They can
> only print a byte for example with less code. The 1 wire routines work
> for a great range. There are also features you will not find in other
> compilers. When you use 4 sensors or 100, there are special 1wirecount
> etc. routines in BASCOM. Do not use the syntax from fastavr since that
> would not make sense. In bascom it would be overhead because of the
> special 1wire routines.
>
> All routines like timing are written for a huge range from 100 Khz- 16
> MHz, this means also that uses more code. Essential, the flexibility and
> all options BASCOM offers have the disadvantage that it takes more code
> to implement these options. When you start a program, using print x
> will give a relatively big program because of the mentioned overhead. On
> the other hand when you add more code, you will see that the size is
> only increasing in small steps because the library code is already
> there. But all these options are there because users wanted these
> options. In fact BASCOM-AVR is only there because BASCOM-8051 users
> wanted an AVR version. The goal was to have an AVR version, not a
> version with limitations like Fastavr. Every time a wanted to squeeze
> some code there were other more important things like M163, M323 and now
> M128. Because every chip has a big replacement brother, I wend for the
> new features instead of squeezing some code. I figure that when size is
> real important, you can use asm.
>
> Now I do not mind if you use this list to compare BASCOM with other
> available compilers. On avrfreaks you can find a lot of compilers, but
> since the author of fastavr copied and modifed my samples,helpfiles and
> syntax without permission, I do not want to do anything to do with mr.
> fastcopy or 'his' products.
>
> Mark Alberts
>
>
> > -----Original Message-----
> > From: owner-bascom@grote.net [mailto:owner-bascom@grote.net]On Behalf
> > Of Albert Noah
> > Sent: dinsdag 2 april 2002 16:14
> > To: bascom@grote.net
> > Subject: Re: [bascom] Lookalike
> >
> >
> > Please explain why it's "not that good". I compiled a program using 1
> > DS1820 using Bascom and it barley fit in a 2313. I did the same
> > program with 4 DS1820's in FastAVR and it compiled under 1K.
> >
> > Albert
> > ----- Original Message -----
> > From: "Aaron Jacquet" <alj1108@yahoo.com>
> > To: <bascom@grote.net>
> > Sent: Tuesday, April 02, 2002 8:40 AM
> > Subject: Re: [bascom] Lookalike
> >
> >
> > > If you are talking about FastAVR it isn't all that good..Doesn't
> > > have the protocol that Bascom-AVR has...
> > >
> > > Aaron
> > >
> > > --- Mike Nash <mikenash@mindspring.com> wrote:
> > > > My apologies for accidentally posting this to the
> > > > group, it was meant to
> > > > be sent privately.
> > > >
> > > > Mike Nash
> > > >
> > > > Mike Nash wrote:
> > > > >
> > > > > I have tried with no success to access your site
> > > > with both IE5.5 and
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Tax Center - online filing with TurboTax
> > > http://http://taxes.yahoo.com/
> > >
> >
> >
>
>