Jun 15, 2003 15:21 from Scalar

I believe one of the new opcodes offered by the 65C02 is known as "BRA", or
"branch always".

Normally a branch operates as a test of something else, "branch to this
location if this condition is met".

Branch Always will branch without any tests.

The main use for it is the memory portability I mentioned, allowing a program
to be relocated in memory and still work properly without remapping the JMP's.


A sufficiently clever programmer can jump long distances through a program by
using multiples BRA's to skip like a rock through the code. The downside is
that this is slow, and it consumes memory space.

2000: (want to get back here from end)
....
207C: BRA 2080 (hop over next command and continue forward)
207E: BRA 2000 (go back 126 bytes)
2080: (program continues forward)
....
20FA: BRA 20FE (hop over next command and continue forward)
20FC: BRA 207E (go back 126 bytes)
20FE: (program continues forward)
....
2179: BRA 217C (hop over next command and continue forward)
217A: BRA 20FC (go back 126 bytes)
217C: (program continues forward)
....
(etc)

Using the BRA's like this, the program is fully portable in memory, and will
run fine from any memory location, whether $0900 or at $6000.. :)

[Antique And Older Computers> msg #24010

Steve Conrad
810 Main
Henrietta, MO 64036
816-494-5692                                     http://sasha91.0pi.com
www.fortunecity.com/rivendell/stonekeep/600

   It is no secret (nor should it come as any surprise) that humankind's
most noble impulses often surface during the most trying of times, that
human spirit rises to the challenge when faced with adversity, that human
strength is born from human failings...Is it any wonder, then, that the
SDF-1 crew became a tighter family after the fortress had been exiled than
it had before?

     From the log of Captain (later Admiral) Henry Gloval



-- 
Apple2list is sponsored by <http://lowendmac.com/> and...

    /      Buy books, CDs, videos, and more from Amazon.com     \
   / <http://www.amazon.com/exec/obidos/redirect-home/lowendmac> \

      Support Low End Mac <http://lowendmac.com/lists/support.html>

Apple2list info:        <http://lowendmac.com/lists/apple2.html>
  --> AOL users, remove "mailto:";
Send list messages to:  <mailto:[EMAIL PROTECTED]>
To unsubscribe, email:  <mailto:[EMAIL PROTECTED]>
For digest mode, email: <mailto:[EMAIL PROTECTED]>
Subscription questions: <mailto:[EMAIL PROTECTED]>
Archive: <http://www.mail-archive.com/apple2list%40mail.maclaunch.com/>

Using a Mac? Free email & more at Applelinks! http://www.applelinks.com

Reply via email to