??? 09/20/07 04:54 Read: times Msg Score: -1 -1 Answer is Wrong |
#144805 - reduce a task to its basic elements Responding to: ???'s previous message |
When performing a control function, isn't the most general way of describing it simply,
"1. examine inputs 2. take appropriate action" ? Now, consider that you have seven inputs, hypothetically, of course, and they're left-justifed on P1. You have a table, called JTBL, containing 128 addresses, each corresponding to a value that can occur on P1. Many of these input "states" might require the same action. Nonetheless, a specific response is provided in this table, for each possible input state. STP1: Load DPTR with JTBL. Now load A with P1, then LJMP @A+DPTR Of course, it's really using a dispatch table, isn't it? It's a really simple state machine, too, though. If each routine to which the table contents point ends in LJMP STP1, then you have a simple state machine using a table lookup. What could be simpler, or more efficient ... or more powerful. It's not "rocket science" but it works well and is trivial to debug. RE |