SPNU118Z September 1995 – March 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
Assemble 32-Bit Instructions
.state32
.arm
By default, the assembler begins assembling all instructions in a file as 32-bit instructions. When you use the -mt assembler option or the .state16 directive to assemble 16-bit instructions, you can use the .state32 or .arm directive to tell the assembler to begin assembling all instructions after the .state32/.arm directive as 32-bit instructions.
When you are writing assembly code, the .arg directive is used to specify ARM UAL syntax. The .state32 and .arm directives are equivalent since UAL syntax is backward compatible.
These directives perform an implicit word alignment before any instructions are written to the section to ensure that all 32-bit instructions are word-aligned. These directives also reset any local labels defined.
In this example, the assembler assembles 32-bit instructions, begins assembling 16-bit instructions, and returns to assembling 32-bit instructions.
1 .global globs, filter
2 ****************************************************
3 ** Begin assembling 32-bit instructions. **
4 ****************************************************
5 00000000 .state32
6 00000000 E28F4001 ADD r4, pc, #1
7 00000004 E12FFF14 BX r4
8 ****************************************************
9 ** Switch to 16-bit instructions to use **
10 ** less code space. **
11 ****************************************************
12 00000008 .state16
13 00000008 2200 MOV r2, #0
14 0000000a 2300 MOV r3, #0
15 0000000c 4C0B LDR r4, globs_a
16 0000000e 2500 MOV r5, #0
17 00000010 2600 MOV r6, #0
18 00000012 2700 MOV r7, #0
19 00000014 4690 MOV r8, r2
20 00000016 4691 MOV r9, r2
21 00000018 4692 MOV r10, r2
22 0000001a 4693 MOV r11, r2
23 0000001c 4694 MOV r12, r2
24 0000001e 4695 MOV r13, r2
25 00000020 4778 BX pc
26 00000022 46C0 NOP
27 ****************************************************
28 ** Continue assembling 32-bit instructions. **
29 ****************************************************
30 00000024 .state32
31 00000024 E4940004 LDR r0, [r4], #4
32 00000028 E5941000 LDR r1, [r4]
33 0000002c EBFFFFF3! BL filter
34 00000030 E1500001 CMP r0, r1
35 00000034 30804005 ADDCC r4, r0, r5
36 00000038 20464001 SUBCS r4, r6, r1
37 0000003c 00000000! globs_a .word globs