1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// ================================================================================================
// Code
// ================================================================================================
SECTION_TEXT
// draw solid color rect
// w0: x (top-left)
// w1: y (top-left)
// w2: width
// w3: height
// w4: color
SYM(draw_rect):
stp x29, x30, [sp, #-16]!
mov x29, sp
LOADADDR x9, g_fbufmap
ldr x9, [x9]
LOADADDR x10, g_fstride
ldr w10, [x10]
// x offset
mov w11, #4
mul w11, w11, w0
add x9, x9, w11, uxtw
// y offset
mul w11, w10, w1
add x9, x9, w11, uxtw
mov w12, #0 // y cursor
LBL(draw_rect_y):
mov w11, #0 // x cursor
mov x13, x9 // row
LBL(draw_rect_x):
str w4, [x13]
add x13, x13, #4
add w11, w11, #1
cmp w11, w2
b.lt LBL(draw_rect_x)
add x9, x9, w10, uxtw
add w12, w12, #1
cmp w12, w3
b.lt LBL(draw_rect_y)
ldp x29, x30, [sp], #16
ret
|