| ??? 09/23/04 14:11 Read: times |
#78012 - RE: Modifying the program counter Responding to: ???'s previous message |
JMPTAB:
AJMP OPTION0
AJMP OPTION1
AJMP OPTION2
...
AJMP OPTIONN
I hate AJMPS, they tend to make havoc just as you are in the middle of chasing some pesky little bug and insert 5 lines of code to do so. Multiply by 3 and LJMP as Slobodan suggest is the right solution when most "case processors" are lenghty, but when most "case procesors" are fairly short it is not the most effective. In such cases my preferred way is:
JMPTAB: sjmp opt1
sjmp opt2
....
sjmp opt10
sjmp opt11_crutch
opt11 crutch: ljmp opt11
opt1:
...
...
opt2:
...
...
opt10:
...
...
opt11:
...
...
Of course, the few cases that need crutches are not very effective, but if most can be reached with a SJMP, the above is still better than the lenghty multiply by 3 and the LJMP table. SJMP + LJMP still is faster than MOV b,#3 + MUL Erik |
| Topic | Author | Date |
| Modifying the program counter | 01/01/70 00:00 | |
| RE: Modifying the program counter | 01/01/70 00:00 | |
| RE: Modifying the program counter | 01/01/70 00:00 | |
| RE: Modifying the program counter | 01/01/70 00:00 | |
RE: Modifying the program counter | 01/01/70 00:00 | |
| RE: Modifying the program counter | 01/01/70 00:00 | |
| RE: Modifying the program counter | 01/01/70 00:00 | |
| RE: Modifying the program counter | 01/01/70 00:00 | |
| RE: Modifying the program counter | 01/01/70 00:00 | |
| RE: Modifying the program counter | 01/01/70 00:00 | |
| RE: Modifying the program counter | 01/01/70 00:00 | |
| RE: Modifying the program counter | 01/01/70 00:00 | |
| RE: Modifying the program counter | 01/01/70 00:00 | |
| RE: Modifying the program counter | 01/01/70 00:00 |



