Macro Expansion

The MCore Macro Assembler supports several macro expansions as specified in the MCore Applications Binary Interface. These macros are described below.

clrc Clears the condition code bit. Equivalent to:

cmpne r0,r0

cmplei rd,n Compare if the signed value in rd is less than or equal to the constant n. n is allowed to have the values 0 through 31. Equivalent to:

cmplti rd,n+1

cmpls rd,rs Compare if the unsigned value in rd is lower or the same as the unsigned value in rs. Equivalent to:

cmphs rs,rd

cmpgt rd,rs Compare if the signed value in rd is greater than the signed value in rs. Equivalent to:

cmplt rs,rd

jbsr label If the address of the label is between -2048 and +2046 bytes away, this expands to:

bsr label

Otherwise:

jsri label

jbr label If the address of the label is between -2048 and +2046 bytes away, this expands to:

br label

Otherwise:

jmpi label

jbf label If the address of the label is between -2048 and +2046 bytes away, this expands to:

bf label

Otherwise:

bt 1f
jmpi label
1:

jbt label If the address of the label is between -2048 and +2046 bytes away, this expands to:

bt label

Otherwise:

bf 1f
jmpi label
1:

neg rd Negates the value in rd. Equivalent to:

rsubi rd,0

rotlc rd,1 Rotates the value in rd left by one bit. The carry bit is rotated into the least significant bit while the most significant bit that was rotated out is saved in the carry bit. Equivalent to

addc rd,rd

rotri rd,imm Rotates the value in rd right by the number of bits specified in imm. Equivalent to:

rotli rd,32-imm

rts Returns from subroutine. Equivalent to:

jmp r15

setc Sets the condition code bit. Equivalent to:

cmphs r0,r0

tstle rd Test for a negative or zero value in the register rd. Equivalent to:

cmplti rd,1

tstlt rd Test for a negative value in the register rd. Equivalent to:

btsti rd,31

tstne rd Test for a non-zero value in the register rd. Equivalent to:

cmpnei rd,0

Previous

Next



Copyright © 1999, Green Hills Software. All rights reserved.