SECTION .text:CODE

        EXPORT LCD_Fill_Rectangle_4

SSD2119_RAM_DATA_REG      EQU 0x22
SSD2119_V_RAM_POS_REG     EQU 0x44
SSD2119_H_RAM_START_REG   EQU 0x45
SSD2119_H_RAM_END_REG     EQU 0x46
SSD2119_X_RAM_ADDR_REG    EQU 0x4E
SSD2119_Y_RAM_ADDR_REG    EQU 0x4F

REG_CMD                   EQU 0x130 ; 0xC4000000	/* RS = 0 */
REG_DAT                   EQU 0x134 ; 0xC4000004 	/* RS = 1 */

LCD_Fill_Rectangle_4
    PUSH    {R4-R12, LR}

    ; R0 - x
    ; R1 - y
    ; R2 - w
    ; R3 - h
    ; R4 - color
    ; R5 - end_aX
    ; R6 - end_start_aY
    ; R7 - REG_CMD
    ; R8 - REG_DAT
    ; R9 - SSD2119_..._REG
    ; R10 - w*h
    ; R11 - num_blocks (R10/4)
    ; R12 - remainder (R10%4)

    ; end_aX = x + w - 1
    ADD     R5, R0, R2
    SUB     R5, R5, #1

    ; end_start_aY = ((y + h - 1) << 8) | y
    ADD     R6, R1, R3
    SUB     R6, R6, #1
    LSL     R6, R6, #8
    ORR     R6, R6, R1

    LDR     R7, =REG_CMD
    LDR     R8, =REG_DAT

    ; SSD2119_WRITE_CMD(SSD2119_V_RAM_POS_REG)
    LDR     R9, =SSD2119_V_RAM_POS_REG
    STRH    R9, [R7]

    ; SSD2119_WRITE_DAT(end_start_aY)
    STRH    R6, [R8]

    ; SSD2119_WRITE_CMD(SSD2119_H_RAM_START_REG)
    LDR     R9, =SSD2119_H_RAM_START_REG
    STRH    R9, [R7]

    ; SSD2119_WRITE_DAT(x)
    STRH    R0, [R8]

    ; SSD2119_WRITE_CMD(SSD2119_H_RAM_END_REG)
    LDR     R9, =SSD2119_H_RAM_END_REG
    STRH    R9, [R7]

    ; SSD2119_WRITE_DAT(end_aX)
    STRH    R5, [R8]

    ; SSD2119_WRITE_CMD(SSD2119_X_RAM_ADDR_REG)
    LDR     R9, =SSD2119_X_RAM_ADDR_REG
    STRH    R9, [R7]

    ; SSD2119_WRITE_DAT(x)
    STRH    R0, [R8]

    ; SSD2119_WRITE_CMD(SSD2119_Y_RAM_ADDR_REG)
    LDR     R9, =SSD2119_Y_RAM_ADDR_REG
    STRH    R9, [R7]

    ; SSD2119_WRITE_DAT(y)
    STRH    R1, [R8]

    ; SSD2119_WRITE_CMD(SSD2119_RAM_DATA_REG)
    LDR     R9, =SSD2119_RAM_DATA_REG
    STRH    R9, [R7]

    ; R10 = w * h (number of pixels)
    MUL     R10, R2, R3

    MOV     R11, R10
    LSR     R11, R11, #2  ; R11 = R10 >> 2 (R11 = R10 / 4) (number of blocks of 4 pixels)
    AND     R12, R10, #3  ; R12 = R10 & 3  (R12 = R10 % 4) (remaining pixels)
    
    ; Determine loop based on R11 and R12

; R10 / 4 | R10 % 4 |
;    0    |   >0    | loop_1
;   >0    |    0    | loop_2
;   >0    |   >0    | loop_3

    CMP     R11, #0
    BEQ     check_remainder  ; If R11 == 0, check R12

    ; R11 != 0
    CMP     R12, #0
    BEQ     loop_2           ; If R12 == 0, go to loop_2
    B       loop_3           ; Else go to loop_3

check_remainder
    ; R11 == 0, check R12
    CMP     R12, #0
    BEQ     end_fill         ; If R12 == 0, skip (no pixels to write)
    B       loop_1           ; Else go to loop_1

loop_1
    ; Loop to write R12 pixels, one at a time
write_1_pixel:
    STRH    R4, [R8]         ; Write pixel
    SUBS    R12, R12, #1
    BNE     write_1_pixel
    B       end_fill         ; Go to the end after writing R12 pixels

loop_2
    ; Loop to write R11 blocks of 4 pixels
write_4_pixels:
    STRH    R4, [R8]         ; Write pixel 1
    STRH    R4, [R8]         ; Write pixel 2
    STRH    R4, [R8]         ; Write pixel 3
    STRH    R4, [R8]         ; Write pixel 4
    SUBS    R11, R11, #1
    BNE     write_4_pixels
    B       end_fill         ; Go to the end after writing R11 * 4 pixels

loop_3
    ; loop to write R11 blocks of 4 pixels
write_4_pixels_loop3:
    STRH    R4, [R8]         ; Write pixel 1
    STRH    R4, [R8]         ; Write pixel 2
    STRH    R4, [R8]         ; Write pixel 3
    STRH    R4, [R8]         ; Write pixel 4
    SUBS    R11, R11, #1
    BNE     write_4_pixels_loop3

    ; loop to write R12 remaining pixels
write_remaining_pixels:
    STRH    R4, [R8]         ; Write pixel
    SUBS    R12, R12, #1
    BNE     write_remaining_pixels

end_fill
    POP     {R4-R12, PC}

    END


#include <stdint.h>

extern void LCD_Fill_Rectangle_4(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color);

int main(void) {
    
    uint16_t x = 0;
    uint16_t y = 0;
    uint16_t w = 20;
    uint16_t h = 20;
    uint16_t color = 0x101F;

    LCD_Fill_Rectangle_4(x, y, w, h, color);


    while(1){
    }
    
    return 0;
}


как ты думаешь в какой из регистров записывается цвет, при вызове функции LCD_Fill_Rectangle_4?