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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/23/05 06:27
Read: times


 
#95675 - improvement
Responding to: ???'s previous message
hi,

Erik Malund said:
so your case would be M_DELAY MACRO
mov r0,#00h ;
mov r1,#00h ;
djnz r1,$ ;
djnz r0,$-4 ;


Lookiing on many sources I see that people still like to calculate relative displacements theyself; here is the $-4. Who knows, maybe this is okay if you may calculate all these numbers quickly even through huge long macro. This indicates your good knowledge of assembly, sizes of all instructions etc.
I had been writting the same way before somehow learned the magic word: "Label". Now I do:
DELAYCYCLE MACRO CYCLES
        LOCAL LOOP
        MOV   R0,#CYCLES
	MOV   R1,#00h
LOOP:	DJNZ  R1,LOOP
	DJNZ  R0,LOOP
	ENDM
Erik, sorry for a bit sarcasm; I do understand that you just shown an example and provide the link to be read. Me, like others, just suggests an improvement.

Regards,
Oleg

List of 13 messages in thread
TopicAuthorDate
How to use marco in assembly?            01/01/70 00:00      
   first you must spell it macro :)            01/01/70 00:00      
      first you must spell it macro :)            01/01/70 00:00      
      Not So Fast!            01/01/70 00:00      
      Macro Correction            01/01/70 00:00      
      improvement            01/01/70 00:00      
         to be more precise            01/01/70 00:00      
            Delay            01/01/70 00:00      
               I did not say...            01/01/70 00:00      
   Macros Defined            01/01/70 00:00      
      Macro vs Call            01/01/70 00:00      
         Macro Correction            01/01/70 00:00      
   Polo!            01/01/70 00:00      

Back to Subject List