<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 11 Jun 1993 08:36:13 +1200
From   : David Andrew Sainty <David.Sainty@...>
Subject: m/c optimisations

   From: ajcd@...
   Date: Thu, 10 Jun 93 13:34:08 BST

   JSR (table,X) is indeed a non-existant instruction. On the 65C02 there is a
   JMP (abs,X) instruction, so you could write

          ...
          JSR dispatch
          ...
   .dispatch       JMP (table,X)

   On the 6502, you have to do something like:

   .dispatch LDA low,X
          STA addr
          LDA high,X
          STA addr
          JMP (addr)

Or directly modify a JMP abs, which saves you 2 bytes of vector and is
faster anyway. Slower, but more compact, is:

LDA low,X:PHA
LDA high,X:PHA
RTS

where the low high address is the actual address -1.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>