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

Re: Help with confirmation on a small bit of assembly?



Tristan Mumford wrote:

> >> I was just after a little help. It's not 100% apple2 related, but it is
> >> 6502 related.
> >> It's for my uC based USB card. I finally nailed hopefully all the
> >> hardware problems. But now I'm back at the problem of it getting stuck
> >> during initialisation.

Hey, it's 6502, and you're developing an Apple II card! It's hard to
get more related than that!

> ...What's wrong with me.
> You've pointed out yet another idiotic mistake I've made of late but
> couldn't see. Somehow during my breakdown of it 0xF = 16. Last time I
> checked 16 != 15.

Relax Tristan, this is *the* most common mistake made by programmers,
of all levels of experience. It's some kind of brain failure mode than
causes humans to equate the number of digits in a number system with
highest value digit. And it's not just in assembly, C programmers do it
all the time, by reading one past the end of an array, or printing the
NULL on the end of string. Eventually they made up a word - 'zeroth'
which apparently helps you out by stopping you from referring to
element zero as the 'first' element.

The really nasty part is, as your tendency to make this mistake goes
down, the difficulty in finding it goes up, so in a way you're
fortunate :-)

And remember, just because nobody else around here piped up and
admitted to it, it's not so much that they're dishonest. It's just
that, like other social taboos, it's not the kind of thing people will
admit to, let alone discuss freely 

;-)