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

Re: BRA & new vs old Apples & other irrelevant stuff (was Appl //c Basic)



Mark Cummings <NOTfigjams@primus.com.au> wrote:

> > > To get it to work on earlier Apple II's as well, do something like:
> > >
> > >     CLC
> > >     BCC #$FE
> >
> > And of course, few if any assemblers will accept this as valid source
> > code.  :-)
> 
> now this is where you lost me. what's wrong with that ? or are we picking on
> no .ORG or .END statement or something ?

The "BCC" instruction, along with all branches, does not support the
immediate addressing mode.  You must branch to a label or address.

The instruction is actually encoded using a signed 8-bit offset, but you
can't write it that way in an assembler, unless you use notation like:

         BCC *             ; Infinite loop, assuming C=0
         BCC *+offset      ; Forward branch
         BCC *-offset      ; Backward branch

replacing '*' with whatever special symbol the particular assembler uses
to mean "the address of the current instruction" - I think the asterisk
is the convention for 6502 family assemblers.  In all these cases, the
assembler will automatically adjust the offset by -2 (or -3 for a BRL on
the 65816) to allow for the fact that the branch is relative to the next
instruction.