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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/04/03 17:30
Read: times


 
#47531 - RE: same old war
Responding to: ???'s previous message
My state machine style looks like:

vect			macro	statename,statehandler
statename		equ	enum
			ajmp	statehandler
enum			set	enum+1
			endm
.
.

statemachine:		mov	a,state
			rl	a
			jmp	@a+dptr
enum			set	0
			vect	st_state0,sh_state0
			vect	st_state1,sh_state1
			vect	st_state2,sh_state2

sh_state0:		;do stuff
			ajmp	break

sh_state1:		;do stuff
			ajmp	break

sh_state2:		;do stuff
			ajmp	break

break:


This limits the number of possible states to 128, but so far that has always proved enough for me. The vect macro makes it easy to shuffle about with the states.


List of 26 messages in thread
TopicAuthorDate
removing from check list            01/01/70 00:00      
   RE: removing from check list            01/01/70 00:00      
      RE: removing from check list            01/01/70 00:00      
      RE: removing from check list            01/01/70 00:00      
      RE: removing from check list            01/01/70 00:00      
         RE: removing from check list            01/01/70 00:00      
   RE: removing from check list            01/01/70 00:00      
   RE: removing from check list            01/01/70 00:00      
      RE: removing from check list            01/01/70 00:00      
         RE: removing from check list            01/01/70 00:00      
            mahmood Elnasser            01/01/70 00:00      
         RE: removing from check list            01/01/70 00:00      
   same old war            01/01/70 00:00      
      RE: same old waqar            01/01/70 00:00      
      RE: same old war            01/01/70 00:00      
         Tutorials addition            01/01/70 00:00      
         RE: same old war            01/01/70 00:00      
            RE: same old war            01/01/70 00:00      
         RE: same old war            01/01/70 00:00      
         Stepper Motor Control            01/01/70 00:00      
            RE: Stepper Motor Control            01/01/70 00:00      
               RE: Stepper Motor Control            01/01/70 00:00      
                  RE: Stepper Motor Control            01/01/70 00:00      
   i will make the circuit            01/01/70 00:00      
      Congratulations - Mike            01/01/70 00:00      
         RE: Congratulations - Mike            01/01/70 00:00      

Back to Subject List