[PD-dev] [once] default closed...
Martin Peach
martin.peach at sympatico.ca
Fri Sep 29 15:54:11 CEST 2006
Mathieu Bouchard wrote:
> On Fri, 29 Sep 2006, Chris McCormick wrote:
>> On Fri, Sep 29, 2006 at 12:28:57AM -0400, Mathieu Bouchard wrote:
>>> BRA, or branch always, means if(1) goto ...;
>>> BRN, or branch never, means if(0) goto ...;
>>> Note that 6809 already has another goto statement, called JMP.
>> Weird. Does the BRN have the same side effects, number of cycles etc. as
>> a NOP? Likewise for BRA vs JMP?
>
> The main reason for BRA and LBRA is that if you want
> position-independent code, you need relative jumps, but JMP was
> absolute-only. Also, BRA was 2 bytes, while both LBRA and JMP were 3
> bytes. (L stood for "Long", and a 16-bit offset was kind of long back
> then)
>
> BRN was really completely useless, but that's because the 16 branch
> opcodes had a "not" bit, so for example "branch if less than" and
> "branch if greater or equal" were the same opcode except for that bit;
> and thus BRN existed only because it was the complement of BRA.
>
One thing that could be done with 6809s and their ilk was self-modifying
code, so that for example, a program could replace the opcode at a
certain position before executing it, so that a single piece of code
could do perform different functions. This was important when you had
less than 64k of RAM. I remember disassembling an assembler written in
6502 which would use the same code to do AND, OR, XOR just by replacing
that single opcode in a subroutine. It could be more efficient to switch
between BRN and BRA than writing two separate subroutines.
Martin
> That's only what I figured out; a real 6809 assembly coder could tell
> you more.
>
> _ _ __ ___ _____ ________ _____________ _____________________ ...
> | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
> | Freelance Digital Arts Engineer, Montréal QC Canada
> ------------------------------------------------------------------------
>
> _______________________________________________
> PD-dev mailing list
> PD-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev
>
More information about the Pd-dev
mailing list