forked from ErrorNoInternet/asmfetch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuptime.S
More file actions
139 lines (108 loc) · 1.96 KB
/
Copy pathuptime.S
File metadata and controls
139 lines (108 loc) · 1.96 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
uptime_label: .ascii "Uptime "
days_label: .ascii " days"
day_label: .ascii " day"
hours_label: .ascii " hours"
hour_label: .ascii " hour"
minutes_label: .ascii " minutes"
minute_label: .ascii " minute"
comma_label: .ascii ", "
.lcomm days_str, 10
.lcomm hours_str, 10
.lcomm minutes_str, 10
print_uptime:
mov rsi, offset uptime_symbol
mov rcx, 5
call print
mov rsi, offset blue
mov rcx, 5
call print
mov rsi, offset uptime_label
mov rcx, 10
call print
mov rsi, offset separator_symbol
mov rcx, 8
call print
xor r9, r9
mov rax, days
test rax, rax
jne print_days
uptime_hours:
mov rax, hours
test rax, rax
jne print_hours
uptime_minutes:
mov rax, minutes
test rax, rax
jne print_minutes
uptime_done:
mov bl, '\n'
call printc
ret
print_day_label:
mov rsi, offset day_label
mov rcx, 4
call print
jmp uptime_hours
print_days:
inc r9
mov rdi, offset days_str
mov rbx, 10
mov r8, rax
call itoa
add rsi, offset days_str
call print
cmp r8, 1
je print_day_label
mov rsi, offset days_label
mov rcx, 5
call print
jmp uptime_hours
print_hour_label:
mov rsi, offset hour_label
mov rcx, 5
call print
jmp uptime_minutes
print_hours:
test r9, r9
je print_hours_
mov rsi, offset comma_label
mov rcx, 2
call print
print_hours_:
inc r9
mov rdi, offset hours_str
mov rbx, 10
mov r8, rax
call itoa
add rsi, offset hours_str
call print
cmp r8, 1
je print_hour_label
mov rsi, offset hours_label
mov rcx, 6
call print
jmp uptime_minutes
print_minute_label:
mov rsi, offset minute_label
mov rcx, 7
call print
jmp uptime_done
print_minutes:
test r9, r9
je print_minutes_
mov rsi, offset comma_label
mov rcx, 2
call print
print_minutes_:
mov rdi, offset minutes_str
mov rbx, 10
mov r8, rax
call itoa
add rsi, offset minutes_str
call print
cmp r8, 1
je print_minute_label
mov rsi, offset minutes_label
mov rcx, 8
call print
jmp uptime_done