On Tuesday 03 January 2006 01:43 pm, Chuck Guzis wrote:
On 1/3/2006 at 12:42 PM Roy J. Tellason wrote:
Any of you guys have advice on how to get a grip
on the weirdnesses of
these chips, when what I'm used to is 8080/8085/z80 assembler?
With the 6502, the big lmitation to me was the very small fixed stack (with
no overlow-underflow traps) and the heavy reliance on "direct" low memory
cells.
Yeah, those are the two things that jump out at me all right...
I used to think that a bigger stack was a good idea. After playing around
some with some monitor code, I'm not so sure any more, and for a simple
embedded application that might not be as much of a problem as I'd thought.
As for that "low page" stuff? I guess that could work out fairly well if you
thought of it as a whole lot of registers or something. :-)
No 16 bit operations per se
That could make things a bit more complicated.
and almost everything you do affects the condition
codes.
And that as well.
You tend to think about everything in terms of 8 bits,
even computing
addresses. Things that involve more than byte quantities tend to get very
wordy--for example, try writing a subroutine to move an arbitrary number (up
to 65K) bytes and compare it with the same in Z80 or even 8080 code. To me,
the 6502 has more of a microcontroller instruction set than the 8080/Z80.
One of my favorite approaches to using a monitor type setup was to use a
dispatch table, which was trivially easy in the z80 environment, just take
the "op" code you're passed, and index into the table (and I don't even
mean
using an index register per se, I never had much use for those). The other
thing I did nontrivially often was to take a parameter off the stack as
passed, that whole cp/m convention of sticking things in registers always
struck me as rather silly by comparison. You wanna pass a parameter to
something, stick it on the stack, have the called code remove it, and
adjust as necessary. I haven't looked yet at how easy it would be to do that
on a 65xx chip.
More of a microcontroller? Yeah, maybe. I have some of those I haven't
played with much either, 80xx parts mostly, some with rom but that's easy
enough to disable and use an external eprom if you don't mind losing a bunch
of pins. I just haven't gotten around to them yet. But ever scrapped
keyboard has one of those in there. :-)
--
Member of the toughest, meanest, deadliest, most unrelenting -- and
ablest -- form of life in this section of space, a critter that can
be killed but can't be tamed. --Robert A. Heinlein, "The Puppet Masters"
-
Information is more dangerous than cannon to a society ruled by lies. --James
M Dakin