-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.s
75 lines (57 loc) · 1.12 KB
/
app.s
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
.equ SCREEN_WIDTH, 640
.equ SCREEN_HEIGH, 480
.equ BITS_PER_PIXEL, 32
.globl main
main:
mov x20, x0
mov x19, #0
animation:
bl clear_screen
movz x0, 100
movz x1, 100
movz x2, 200
movz x3, 300
mov x4, 0xFF0000
bl draw_rect
mov x0, x19
movz x1, 150
movz x2, 100
movz x3, 50
mov x4, 0x00FF00
bl draw_rect
//------------- --------------------------------------------------
// Infinite Loop
add x19, x19, #1
mov x0, 0xFFFFF
bl delay
b animation
InfLoop:
b InfLoop
clear_screen:
mov x0, x20
mov x2, 0xFFFFFF // 0x0000FF = BLUE
movz x1, 0xB000
movk x1, 0x4, LSL #16
super_loop0:
stur x2,[x0] // Set color of pixel N
add x0,x0,4 // Next pixel
sub x1,x1,1 // decrement X counter
cbnz x1,super_loop0 // If not end row jump
ret
draw_rect: // x0: X, x1: Y, x2: W, x3: H, x4: Color
_draw_rect_loop_fila:
mov x5, SCREEN_WIDTH
mul x5, x1, x5
add x5, x5, x0
lsl x5, x5, #2
add x5, x5, x20
mov x6, x2
_draw_rect_loop_col:
str x4, [x5]
add x5, x5, #4
sub x6, x6, #1
cbnz x6, _draw_rect_loop_col
add x1, x1, #1
sub x3, x3, #1
cbnz x3, _draw_rect_loop_fila
ret