Everything
6.2 Assembly Program Sections

In assembly programs, the .SECTION control directive is used to begin sections and declare their attributes, and the .ORG control directive is used to declare the format types of sections.

For details on the control directives, refer to section 5.2, Directives.

Example

An example of an assembly program section declaration is shown below.

    .SECTION A,CODE,ALIGN=4  ;(1)
 
START:
    MOV.L  #CONST,R4
    MOV.L  [R4],R5
    ADD    #10,R5,R3
    MOV.L  #100,R4
    MOV.L  #ARRAY,R5
LOOP:
    MOV.L  R3,[R5+]
    SUB    #1,R4
    CMP    #0,R4
    BNE    LOOP
EXIT:
    RTS
 
;
    .SECTION B,ROMDATA  ;(2)
    .ORG   02000H
    .glb   CONST
CONST:
    .LWORD 05H
;
    .SECTION C,DATA,ALIGN=4  ;(3)
    .glb   BASE
BASE:
    .blkl  100
    .END

(1) Declares a code section with section name A, boundary alignment 4, and relative address format.

(2) Declares a romdata section with section name B, allocated address 2000H, and absolute address format.

(3) Declares a data section with section name C, boundary alignment 4, and relative address format.