Archived from groups: rec.games.vectrex (
More info?)
I wrote:
>> Why on earth should the assembler *ever* assume that a hex literal like
>> $A0 is a negative value?
Christopher wrote:
> That's not what he mean't. Specifically, he said "signed or unsigned"
> - as in two's compliment. You must have missed it somehow in your vast
> experience... It's SOP on the 6809, you might want to read up on it.
I fully understand two's complement.
In 16-bit two's complement notation, the constant $A000 is negative.
The constants $A00, $A0, and $A are positive. There is no reason
for the assembler to assume otherwise.
>>Should this hypothetical assembler give a warning about a possible
>>conversion error for "LDX #$F00"?
>
> Yes, it should give a warning.
Should there be a warning for LDX #$30? If so, the two's complement
argument is a red herring, because $30 would NEVER sign extend as a
negative value.
What about LDAA #$3? Should there be a warning for that? If not, why?
> This kind of thinking leads to assemblers which assemble:
>
> "lda $A0" and "lda $00A0" the same (ie: assuming that they are both
> intended to be Direct instead of Extended for the later.)
All 6809 assemblers I've ever used do assemble both of those to the
same object code, using direct addressing, provided that you've indicated
to the assembler that the run-time value of the direct page register
will be zero. (Many assemblers assume that as a default unless otherwise
directed.) If you tell the assembler that DP will be $37 at run time,
both get assembled as extended.
I don't consider that a bug. There is assembler syntax to force the use
of extended addressing when the assembler otherwise has reason to
believe that direct would be sufficient.
> Hey, whatever, you do it however you want. Just one question though,
> "Mr. 29 years" - If you're such an expert, howcome you never actually
> helped Robert debug his code and only chimed in to pick nits and start
> a fight?
1. I don't think it's a nit. It's important for people to know how
tools work.
2. I thought it would be useful for people to know how real assemblers
work, as opposed to how people think they'd like hypothetical
assemblers to work.
3. I thought it would be possible to explain that quickly, and didn't
think it would be controversial. While debugging someone else's
code is something tedious that I usually only do if they're paying
me, or if they're a friend. That said, if I'd looked over the code
and noticed an obvious problem, I would have pointed it out. But
I didn't even see that part of the thread.
If someone can cite an example of an existing assembler that works as
you propose, then I'll be willing to concede that maybe it's not a
fringe concept after all, though I still probably won't want to switch
to that assembler.
Looking back at the original request, I see no reason why Robert's
use of LDX #$A0 should cause any problem if his data is at $00A0,
unless the DP register has nonzero contents.
Eric