fb_write:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
stmfd sp!, {r4, r5, r6, r7, r8, lr} @store registers
ldr lr, .L245 @lr = 0x0004AFF8 original array start adress (local)
ldr ip, .L245+4 @ip = 38399 init of the counter
add lr, r0, lr @lr += r0 calculation of the full adress
mov r0, r1 @r0 = r1 change of base adress
mov r4, #248
mov r6, #252
.L240:
ldmia lr, {r7-r8} @r7 = LSW r8 = MSW example 0x008f8f8f and 0x001133ff (grey and red-orange)
and r2, r8, r4, asl #16 @r2 = r8 & (0xF8<<16) r2 = MSW & 0x00F80000 = 0x00100000 //MSW red
and r3, r8, r6, asl #8 @r3 = r8 & (0xFC<<8) r3 = MSW & 0x0000FC00 = 0x00003000 //MSW green
mov r1, r2, lsr #3 @r1 = r2 >> 3 r1 = 0x00100000 >> 3 = 0x00020000
orr r1, r1, r3, asl #11 @r1 = r1 | (r3 << 11) r1 = 0x00020000 | 0x01800000 = 0x01820000
and r3, r8, r4 @r3 = r8 & 0xF8 r3 = MSW & 0x000000F8 = 0x000000F8 //MSW blue
orr r1, r1, r3, asl #24 @r1 = r1 | (r3 << 24) r1 = 0x01820000 | 0xF8000000 = 0xF9820000
and r3, r7, r4, asl #16 @r3 = r7 & (0xF8<<16) r3 = LSW & 0x00F80000 = 0x00880000 //LSW red
orr r1, r1, r3, lsr #19 @r1 = r1 | (r3 >> 19) r1 = r1 | r3 = 0xF9820000 | 0x00000011 = 0xF9820011
and r3, r7, r6, asl #8 @r3 = r7 & (0xFC<<8) r3 = LSW & 0x0000FC00 = 0x0000F800 //LSW green
orr r1, r1, r3, lsr #5 @r1 = r1 | (r3>>5) r1 = r1 | r3 = 0xF9820011 | 0x000007C0 = 0xF98207D1
and r7, r7, r4 @r7 = r7 & 0x000000F8 r7 = LSW & 0x000000F8 = 0x00000088
orr r1, r1, r7, asl #8 @r1 = r1 | (r7 << 8) r1 = r1 | (r7 << 8) = 0xF98207D1 | 0x00008800 = 0xF9828FD1
str r1, [r0, ip, asl #2] @[r0 + (ip * 4)] = r1 write of r1 into the array
subs ip, ip, #1 @ip-- decrementation of ip
sub lr, lr, #8 @lr -= 8 decrementation of the original array pointer
bne .L240 @if (ip!=0) go back to .L240 loop condition
ldmfd sp!, {r4, r5, r6, r7, r8, pc} @restore registers
.L246:
.align 2
.L245:
.word 307192
.word 38399
.size fb_write, .-fb_write
.section .rodata.str1.4
.align 2