[comp.sys.apple] MSB confusion

rich@pro-exchange.cts.COM (Rich Sims) (11/24/88)

> Boy, you  know some strange facts.

So, one might add, do you!

> Say you have the command 
> LDA $11ff -> 300:opcode 11 ff
> In the apple.  Hence, the MSByte is stored first.  How did you say
> you have been programming?

I'll be charitable and assume you meant immediate mode, since the sequence
you used above won't load *either* the '11' or the 'ff', but the value stored
at $11ff (or 11ffh, since you appear to be a PC-type).  Usually, immediate
mode is expressed as...  LDA #$11 (or #$ff, depending on which one you want).

(Please, don't anyone confuse the issue with "assembler syntax" such as the
effect of #value, /value, <value, >value, etc., etc.!!)

Trying the same sequence, but using immediate mode, the result is going to be
strictly dependent on the assembler you use.  An intelligent one *ought* to
give you an error, since there's no possible way it can know what you really
want to do.  I'd suspect (without trying it!!) that most, however, will load
the 'ff' into the accumulator, since most assemblers seem to default to low
byte if you don't specify that you want the high byte.

The built-in mini-assembler will do something entirely different.  It's going
to load the 'ff' ok, but it will then use the '11' as the opcode for the next
instruction, yielding an "ORA <something>", which is probably *not* what you
had in mind!!  No errors, no nuthin' -- just keeps on goin!  (For a while!)

Better stick to PC's and Macs, which can handle that type of instruction (but
do it differently from each other, I believe)!  The 6502 (which is the
processor that was being discussed) will go belly up on it!

'tis exceedingly difficult to load a 16-bit value into an 8-bit register! :-)

-Rich Sims-

UUCP: { sdcsvax nosc } !crash!pro-exchange!rich
ARPA: crash!pro-exchange!rich@nosc.mil
INET: rich@pro-exchange.cts.com