Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/29/01 02:08
Read: times


 
#18172 - RE: Part 2:To code a jmp table properly
I'll post this again and see if it gets deleted again.

A very fast way to do cases with about 4 or so branches is to use the DJNZ like this:
- - - - - - - -
cases_by_acc:
case1: djnz a,case2
(case 1 code and exit/return)
case2: djnz a,case3
(case 2 code and exit/return)
case3: djnz a,case_else
(case 3 code and exit/return)
case_else:
(exception handling, out of range case)
- - - - - - - -
This is a ripple-case structure by my termonology. Its a very efficient way to jump to a case subroutine without affecting the DPTR or any other registers. The example determines cases {1,2,3} and vectors all others to the exception handling routine "case_else".

It takes only two bytes per ripple-case and it great for small case jumps.

aka j (Half of the messages I post are gone within a couple of hours - strange...)

List of 9 messages in thread
TopicAuthorDate
Part 2:To code a jmp table properly            01/01/70 00:00      
RE: Part 2:To code a jmp table properly            01/01/70 00:00      
RE: Part 2:To code a jmp table properly            01/01/70 00:00      
RE: Part 2:To code a jmp table properly            01/01/70 00:00      
RE: Part 2:To code a jmp table properly            01/01/70 00:00      
RE: Part 2:To code a jmp table properly            01/01/70 00:00      
RE: aka - j            01/01/70 00:00      
RE: aka - j            01/01/70 00:00      
RE: Part 2:To code a jmp table properly            01/01/70 00:00      

Back to Subject List