8.2.9 Startup of the RL78-S1 core

In the startup of the RL78-S1 core with a small ROM/RAM area, the entire RAM is initialized instead of initializing the stack area or bss attribute areas, from the point of code efficiency. The start address (__RAM_ADDR_START) and end address (RAM_ADDR_END) of RAM are determined by the linker. For __RAM_ADDR_START and __RAM_ADDR_END, see "6.2.2 Symbols generated by option specifications".

        ;--------------------------------------------------
        ; initializing RAM
        ;--------------------------------------------------
        MOVW    HL,#LOWW(__RAM_ADDR_START)
        MOVW    AX,#LOWW(__RAM_ADDR_END)
        BR      $.L2_RAM
.L1_RAM:
        MOV     [HL+0],#0
        INCW    HL
.L2_RAM:
        CMPW    AX,HL
        BNZ     $.L1_RAM