This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

what is equal instruction for asm -msp430g2533

Other Parts Discussed in Thread: MSP430G2533

Hi,

What is  an equal instruction in msp430g2533?

my code is:

.global _Encrypt

 .section .text
 
 .equ INDF, W4
 .equ MASK, W5
 .equ CNT1, W6
 .equ CNT2, W7

_Encrypt:
 mov.b  #0x0C, CNT1
 
_ENCRYPT_OUTER:
 mov.b  #0x30, CNT2
 
_ENCRYPT_INNER:
 xor.b  CNT1,#0x01,W0
 bra   Z,_RRF_KEY
 
 ; CLRC
 bclr  0x0042, #0
 
 mov.b  #0x01,MASK
 btsc.b  _CSR+2,#4
 mov.b  #0x10,MASK
 
 btss.b  _CSR+1,#1
 bra   _ENCRYPT_INNER_2
 rlc.b  MASK,MASK
 rlc.b  MASK,MASK

_ENCRYPT_INNER_2: 
 btsc.b  _CSR,#1
 rlc.b  MASK,MASK

_NLF_TABLE:
 btsc.b  _CSR+3,#7
 bra   _TABLE2
 mov.b  #0x2E, W0
 btsc.b  _CSR+3, #2
 mov.b  #0x74, W0
 bra   _TABLE_END

_TABLE2:
 mov.b  #0x5C, W0
 btsc.b  _CSR+3, #2
 mov.b  #0x3A, W0

_TABLE_END:
 and.b  MASK,W0,MASK
 clr.b  WREG
 bra   Z, _TABLE_END_2
 mov.b  #0x80, W0

_TABLE_END_2:
 rlc.b  W0,W0
 rlc.b  W0,W0
 
 xor.b  _CSR,WREG
 xor.b  _CSR+2,WREG
 xor.b  _DKEY,WREG
 
 rrc.b  W0,W0
 
 rrc.b  _CSR+3
 rrc.b  _CSR+2
 rrc.b  _CSR+1
 rrc.b  _CSR

_RRF_KEY:
 mov   #_DKEY,W0
 btst.c  [W0],#0
 
 rrc.b  _DKEY+7
 rrc.b  _DKEY+6
 rrc.b  _DKEY+5
 rrc.b  _DKEY+4
 rrc.b  _DKEY+3
 rrc.b  _DKEY+2
 rrc.b  _DKEY+1
 rrc.b  _DKEY+0
 
 dec.b  CNT2,CNT2
 bra   NZ, _ENCRYPT_INNER
 
 dec.b  CNT1,CNT1
 bra   NZ, _ENCRYPT_OUTER

 return
 
 .END

 

Thanks,

Akila.

 

  • The usual convention is, the name of an assembler directive starts with a period. .equ is one of them. This assembler directive consists of that name followed by 2 tokens.It is used to instruct the assembler that from this point on, whenever that first token is encountered, it should be substituted by that second token.

     .equ MASK, W5 means whenever I say  MASK, you substitute that with W5

    Hence, later on for example, mov.b  #0x01,MASK means mov.b  #0x01,W5

    There may exist another assembler directive .set that has similar but slightly different meaning. Check the manual of the assembler you are using.

  • old_cow_yellow said:
    the name of an assembler directive starts with a period. .equ

    I am afraid that question is ambiguous. It could be about compare and conditional jump instructions

**Attention** This is a public forum