Re: Learning to use PICS
From: CBarn24050 (cbarn24050_at_aol.com)
Date: 11/28/04
- Next message: CBarn24050: "Re: snubber resistor power rating?"
- Previous message: The Phantom: "Re: AC sine wave: What does increasing the frequency do?"
- In reply to: Sergio Masci: "Re: Learning to use PICS"
- Next in thread: Sergio Masci: "Re: Learning to use PICS"
- Reply: Sergio Masci: "Re: Learning to use PICS"
- Messages sorted by: [ date ] [ thread ]
Date: 28 Nov 2004 09:05:54 GMT
>Subject: Re: Learning to use PICS
>From: "Sergio Masci" sergio@NO.SPAM.xcprod.com
>Date: 28/11/2004 03:06 GMT Standard Time
>Message-id: <41a93fe9$0$1063$db0fefd9@news.zen.co.uk>
>
>
>john jardine <john@jjdesigns.fsnet.co.uk> wrote in message
>news:coac45$hvg$1@newsg3.svr.pol.co.uk...
>>
>> "Sergio Masci" <sergio@NO.SPAM.xcprod.com> wrote in message
>> news:41a89667$0$1067$db0fefd9@news.zen.co.uk...
>>
>> >[clip]
>> > The XCSB compiler will convert the following to just 6 machine code
>> > instructions:
>> >
>> > proc inline set_bit(ubyte *addr, ubyte id)
>> > *addr = *addr | (1 << id)
>> > endproc
>> >
>> > proc inline clear_bit(ubyte *addr, ubyte id)
>> > *addr = *addr & ~(1 << id)
>> > endproc
>> >
>> > proc inline ubyte test_bit(ubyte *addr, ubyte id)
>> > return (*addr & (1 << id) != 0)
>> > endproc
>> >
>> > proc main()
>> >
>> > ubyte a, b
>> >
>> > if (test_bit(&a, 1) then
>> > set_bit(&b, 2)
>> > else
>> > clear_bit(&b, 2)
>> > endif
>> > endproc
>>
>> Looks like "C" to me.
>> I know this must be so, as I can't understand it :-).
>> Yet I can easily read the 'Proton','CH-flash', 'iL_Bas16' etc Basics.
>> regards
>> john
>
>It supports pointers like "C" but unlike many C compilers for the PIC it
>doesn't generate a ton of code to build and pass the pointers and then
>dereference them if it can determine the address at compile time. PEEK and
>POKE would be more in keeping with other BASIC dialects but pointers allow
>the programmer to give the compiler more information which in turn helps the
>compiler trap silly errors and generate better code.
>
>The reason I chose the above example is because it shows how the compiler
>converts some very complex functionality into very tight code
>
Assembly language programmers do that in 3 instructions.
- Next message: CBarn24050: "Re: snubber resistor power rating?"
- Previous message: The Phantom: "Re: AC sine wave: What does increasing the frequency do?"
- In reply to: Sergio Masci: "Re: Learning to use PICS"
- Next in thread: Sergio Masci: "Re: Learning to use PICS"
- Reply: Sergio Masci: "Re: Learning to use PICS"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|