-
Notifications
You must be signed in to change notification settings - Fork 0
/
border.kernel
87 lines (64 loc) · 1.63 KB
/
border.kernel
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
76
77
78
79
80
81
82
83
84
85
86
87
addi $15, $0, 0b111111 ; 63 bitmask
addi $14, $0, 64 ; width & height
and $7, $15, $id_lo ; x value
srl $8, $id_lo, 6 ; y value
; Load rendered color
add $address_lo, $0, $id_lo
lw
add $15, $0, $lsu_data ; Cache for later - might not needed
addi $lsu_data, $0, 0b0000011111111111 ; Default to red
ldc $13, 10 ; Offset from edges
sub $14, $14, $13 ; offset from opposite edges
add $mask, $0, $0 ; init mask
add $12, $0, $0 ; shadow mask - mask is write only
; Draw left line of box
sub $9, $7, $13 ; equal
slt $10, $9, $0 ; diff less than zero
slt $11, $0, $9 ; diff greater than zero
or $10, $10, $11
addi $11, $0, 1
sub $10, $11, $10
slt $11, $13, $8
and $10, $10, $11
slt $11, $8, $14
and $10, $10, $11
or $12, $12, $10
; Draw right line of box
sub $9, $7, $14 ; equal
slt $10, $9, $0 ; diff less than zero
slt $11, $0, $9 ; diff greater than zero
or $10, $10, $11
addi $11, $0, 1
sub $10, $11, $10
slt $11, $13, $8
and $10, $10, $11
slt $11, $8, $14
and $10, $10, $11
or $12, $12, $10
; Draw upper line of box
sub $9, $8, $13 ; equal
slt $10, $9, $0 ; diff less than zero
slt $11, $0, $9 ; diff greater than zero
or $10, $10, $11
addi $11, $0, 1
sub $10, $11, $10
slt $11, $13, $7 ; Check x-offset
and $10, $10, $11
slt $11, $7, $14 ; Check x-offset
and $10, $10, $11
or $12, $12, $10
; Draw lower line of box
sub $9, $8, $14 ; equal
slt $10, $9, $0 ; diff less than zero
slt $11, $0, $9 ; diff greater than zero
or $10, $10, $11
addi $11, $0, 1
sub $10, $11, $10
slt $11, $13, $7 ; Check x-offset
and $10, $10, $11
slt $11, $7, $14 ; Check x-offset
and $10, $10, $11
or $12, $12, $10
add $mask, $0, $12
? add $lsu_data, $0, $15 ; alpha
sw