EmbeddedRelated.com
Forums
The 2026 Embedded Online Conference

filling remaining array elements with fixed value

Started by blisca June 12, 2014
On 2014-06-26, upsidedown@downunder.com <upsidedown@downunder.com> wrote:
> > Today, a C-compiler for PICs is useful, so you do not have to write > everything in the awkward assembler. >
8-bit PICs: the only architecture I know which is in common use today which makes the x86 look like a well designed architecture by comparison. Among my annoyances is the total lack of a peripheral specific interrupt vector or _any_ interrupt index which lets you know directly which interrupt fired. Instead you have to examine each status register in turn until you find the one which caused the interrupt.
> The nice thing about any high/intermediate level languages compared to > most assemblers is that you can create easily readable control blocks > (if/then/else and for/while/loop). >
Of all the assembly languages I've used, I find ARM to be the most readable. You don't have high level structures, but you do have a very expressive syntax (for an assembly language) and things like conditional execution of opcodes. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world
On 26/06/14 19:31, Simon Clubley wrote:
> On 2014-06-26, upsidedown@downunder.com <upsidedown@downunder.com> wrote: >> >> Today, a C-compiler for PICs is useful, so you do not have to write >> everything in the awkward assembler. >> > > 8-bit PICs: the only architecture I know which is in common use today > which makes the x86 look like a well designed architecture by comparison.
I am not particularly fond of the 8051 either, and that's another one that refuses to die. I also disliked the COP8 architecture, for which I wrote quite a lot of assembly. It was immensely inefficient - each "processor cycle" was 10 oscillator clock cycles - and most instructions took 4 processor cycles.
> > Among my annoyances is the total lack of a peripheral specific interrupt > vector or _any_ interrupt index which lets you know directly which > interrupt fired. Instead you have to examine each status register in turn > until you find the one which caused the interrupt. >
The COP8 was like that. When combined with the tiny number of registers and a slow interrupt vector, with a 10 MHz clock it took about 80 us for the overhead of saving registers, identifying the interrupt source, and jumping to the relevant code. Restoring the context took another 60-70 us.
>> The nice thing about any high/intermediate level languages compared to >> most assemblers is that you can create easily readable control blocks >> (if/then/else and for/while/loop). >> > > Of all the assembly languages I've used, I find ARM to be the most > readable. You don't have high level structures, but you do have a > very expressive syntax (for an assembly language) and things like > conditional execution of opcodes. >
ARM is not bad, but I think the nicest assembly I have used is m68k. The msp430 is good too. PIC assembly needs macros to replace the silliest opcodes with clearer named ones - then it was unexpectedly reasonable. (It's a long time since I wrote PIC assembly, but I remember replacing the "BTFSC" instruction with "IfBit", and making flag bits macros that included the address and the bit number.)
On 2014-06-26, David Brown <david.brown@hesbynett.no> wrote:
> On 26/06/14 19:31, Simon Clubley wrote: >> On 2014-06-26, upsidedown@downunder.com <upsidedown@downunder.com> wrote: >>> >>> Today, a C-compiler for PICs is useful, so you do not have to write >>> everything in the awkward assembler. >>> >> >> 8-bit PICs: the only architecture I know which is in common use today >> which makes the x86 look like a well designed architecture by comparison. > > I am not particularly fond of the 8051 either, and that's another one > that refuses to die.
I'm pretty sure that the Intel 8048 family existed solely to make everybody think the 8051 was a brilliant design when it came out a couple years later. From what I remember, it worked... -- Grant Edwards grant.b.edwards Yow! The Korean War must at have been fun. gmail.com
Hi Simon,

On 6/26/2014 10:21 AM, Simon Clubley wrote:
> On 2014-06-26, Don Y<this@is.not.me.com> wrote:
>>>> E.g., nowadays, a "kid" (new grad) might be startled to encounter >>>> 16b int's. And, at a complete *loss* to understand why his code >>>> is compiling yet *crashing* -- until this is made evident to him. >>> >>> Twenty years from now, will new people be startled to encounter 32 bit >>> integers ? >> >> I suspect not. 32b is a rather impressive size for an integer datum. >> Instead, I think the surprise may be NOT finding hardware floating >> point support, etc. > > I've just mentioned in another post what I meant was 32 bit _default_ > integer sizes.
Yes, understood. That's why I deliberately referenced "int" and not "short int", "long int", etc.
>> And, some made very bad predictions as to where technology would >> be headed (e.g., the 99000's WSP). > > That's still true today, ie: IA-64. (Yes, VMS is a part of my day job.)
But, I suspect the processor *has* internal registers to "cache" the workspace internally. IIRC, the 99K actually used memory IN PLACE OF internal registers. E.g., you could snoop on those memory locations to peek "inside" the CPU's state.
>>>> The 6502, OTOH, is a tiny, relatively clean architecture (if you're >>>> discussing "programmable calculators" :> ) >>>> >>>>> What is the 6502 still used in ? >>>> >>>> The folks that have inquired most in recent memory have been >>>> split between military and (very) high-volume consumer goods. >>>> E.g., put the processor on a tiny die with whatever other >>>> mixed mode stuff you need and have a true "single chip" >>>> solution to<whatever> problem. >>> >>> Interesting. I looked on Farnell's website, and could see the Z80 was >>> still available, but I could find no trace of the 6502. >> >> I think it exists as a core, nowadays. Or, as bastardized variants >> (e.g., isn't the 2A03 a 6502?). > > According to Wikipedia, that MCU (which I didn't know about until now) > was discontinued in 1994, but yes, it was a 6502. There's also a > number of other 6502 variants listed:
From the military contacts I've encountered, I suspect the 6502 is used to "create explosions at a distance" :> But, I can't speak to that for sure as I've never pursued any of those inquiries. I *do* recall the 8080 (or was it 8085?) was offered for a long time in a military grade, etc. It might actually be fun to build something like a 6502 out of discretes (no, not tonka toy logic). I suspect it would be (marginally) more useful than a PDP8! :> Think of all the blinkenlites you could outfit it with!! ;)
On 26.6.2014 &#1075;. 21:38, David Brown wrote:
> On 26/06/14 19:31, Simon Clubley wrote: >> >> >> Of all the assembly languages I've used, I find ARM to be the most >> readable. You don't have high level structures, but you do have a >> very expressive syntax (for an assembly language) and things like >> conditional execution of opcodes. >> > > ARM is not bad, but I think the nicest assembly I have used is m68k.
I would add "by quite a margin" so. The person who has created it has been very good. Decouple the language from the processor, add some later language developments - e.g. operations "source1,source2,destination", "update (or not) the CCR", and of course add to move.b and move.w movez and movex (zero extend/sign extend), make the macro argument passing/parsing really powerful - well, and some more stuff, and you have my VPA :-). Dimiter ------------------------------------------------------ Dimiter Popoff, TGI http://www.tgi-sci.com ------------------------------------------------------ http://www.flickr.com/photos/didi_tgi/sets/72157600228621276/
Hi Simon,

On 6/26/2014 10:31 AM, Simon Clubley wrote:
> On 2014-06-26, upsidedown@downunder.com<upsidedown@downunder.com> wrote: >> >> Today, a C-compiler for PICs is useful, so you do not have to write >> everything in the awkward assembler. > > 8-bit PICs: the only architecture I know which is in common use today > which makes the x86 look like a well designed architecture by comparison.
To be fair, look at its ancestry: e.g., I can recall looking at the 1650 some 30 years ago and (literally) saying: WTF? When you contrasted *it* with other contemporary offerings (even things long gone by -- SC/MP, PACE, 2650, etc.) it looked like a sequencer more than a *processor*!
> Among my annoyances is the total lack of a peripheral specific interrupt > vector or _any_ interrupt index which lets you know directly which > interrupt fired. Instead you have to examine each status register in turn > until you find the one which caused the interrupt. > >> The nice thing about any high/intermediate level languages compared to >> most assemblers is that you can create easily readable control blocks >> (if/then/else and for/while/loop). > > Of all the assembly languages I've used, I find ARM to be the most > readable. You don't have high level structures, but you do have a > very expressive syntax (for an assembly language) and things like > conditional execution of opcodes.
If you're talking exclusively about *syntax*, I'd have to think on that for a while. For its *day*, I found the 16032 to be one of the *cleanest* (programmer models) for a "heavy-weight CPU". [Poor NS... couldn't market an MCU if their life depended on it!]
On Thu, 26 Jun 2014 13:53:07 -0700, Don Y <this@is.not.me.com> wrote:

>It might actually be fun to build something like a 6502 out of >discretes (no, not tonka toy logic). I suspect it would be >(marginally) more useful than a PDP8! :> Think of all the >blinkenlites you could outfit it with!! ;)
There are half a dozen 6502s over on opencores.org. Some 8080s and Z-80s too, not to mention other ISAs.
Hi Robert,

On 6/26/2014 4:45 PM, Robert Wessel wrote:
> On Thu, 26 Jun 2014 13:53:07 -0700, Don Y<this@is.not.me.com> wrote: > >> It might actually be fun to build something like a 6502 out of >> discretes (no, not tonka toy logic). I suspect it would be >> (marginally) more useful than a PDP8! :> Think of all the >> blinkenlites you could outfit it with!! ;) > > There are half a dozen 6502s over on opencores.org. Some 8080s and > Z-80s too, not to mention other ISAs.
No, I said *discretes*. Sort of like DEC's 60's era "flip chips" but without the structured nature of that sort of a design. (imagine just a field of transistors deliberately interconnected to mimic the processor's internal logic). You'd be able to attach a blinkenlight to any point in the innards of the "processor" (conceivably, display *each* Q!) Of course, you could rely on more "integrated" technology for the memory, etc.
Grant Edwards <invalid@invalid.invalid> wrote:

> everybody think the 8051 was a brilliant design when it came out a > couple years later. From what I remember, it worked...
Problem is: they are still using it... Ciao Jack -- Yoda of Borg am I! Assimilated shall you be! Futile resistance is, hmm?
On 2014-06-27, Jack <pippo2@disney.com> wrote:
> Grant Edwards <invalid@invalid.invalid> wrote: > >> everybody think the 8051 was a brilliant design when it came out a >> couple years later. From what I remember, it worked... > > Problem is: they are still using it...
And without the comparitive relieve from still-bleeding wounds caused by the 8048, I don't really understand why people find the 8051 acceptable unless they're locked in to it because of some weird peripheral. Compared to something like an MSP430, AVR, or small Cortex M-someting, an 8051 is torture. -- Grant Edwards grant.b.edwards Yow! ... I don't like FRANK at SINATRA or his CHILDREN. gmail.com
The 2026 Embedded Online Conference