|
@@ -212,17 +212,17 @@ main_loop:
|
212
|
212
|
|
213
|
213
|
; Attempt to read from stdin
|
214
|
214
|
; if something read, enter has been pressed
|
215
|
|
- mov rax, 0
|
216
|
|
- mov rdi, 0
|
|
215
|
+ xor rax, rax
|
|
216
|
+ xor rdi, rdi
|
217
|
217
|
mov rsi, buf
|
218
|
218
|
mov rdx, 1
|
219
|
219
|
syscall
|
220
|
|
- cmp rax, 0
|
221
|
|
- jge flush_stdin ; flush stdin and exit
|
|
220
|
+ test rax, rax
|
|
221
|
+ jns flush_stdin ; flush & exit
|
222
|
222
|
|
223
|
223
|
mov rax, 35 ; nanosleep
|
224
|
224
|
mov rdi, ts_sleep
|
225
|
|
- mov rsi, 0
|
|
225
|
+ xor rsi, rsi
|
226
|
226
|
syscall
|
227
|
227
|
|
228
|
228
|
jmp main_loop ; main_loop
|
|
@@ -289,14 +289,15 @@ proc_print_time:
|
289
|
289
|
mov rsi, ts_cur
|
290
|
290
|
syscall ; updating ts_cur time
|
291
|
291
|
|
|
292
|
+
|
292
|
293
|
mov rsi, ts_start.tv_sec
|
293
|
294
|
%define RSIPTR(x) rsi + x - ts_start.tv_sec
|
294
|
295
|
|
295
|
|
- mov rax, [RSIPTR(ts_cur.tv_nsec)] ;mov rax, [ts_cur.tv_nsec]
|
296
|
|
- sub rax, [RSIPTR(ts_start.tv_nsec)] ;sub rax, [ts_start.tv_nsec]
|
|
296
|
+ mov rax, [ts_cur.tv_nsec] ; allign procpt_loopns
|
|
297
|
+ sub rax, [ts_start.tv_nsec] ; allign procpt_loopns
|
297
|
298
|
jge print_time_us_cont
|
298
|
299
|
add rax, 1000000000 ; negativ result
|
299
|
|
- sub qword [RSIPTR(ts_cur.tv_sec)], 1 ;sub qword [ts_cur.tv_sec], 1
|
|
300
|
+ sub qword [RSIPTR(ts_cur.tv_sec)], 1
|
300
|
301
|
print_time_us_cont:
|
301
|
302
|
|
302
|
303
|
xor rdx, rdx
|
|
@@ -310,12 +311,12 @@ proc_print_time:
|
310
|
311
|
mov rcx, [RSIPTR(time_res)]
|
311
|
312
|
mov rdi, 10
|
312
|
313
|
xor rdx, rdx
|
|
314
|
+ align 16 ; should be allready alligned
|
313
|
315
|
procpt_loopns:
|
314
|
|
- xor dl, dl
|
315
|
316
|
div rdi
|
316
|
317
|
or dl, 0x30 ; '0'
|
317
|
318
|
shl rbx, 8
|
318
|
|
- mov bl, dl
|
|
319
|
+ xchg bl, dl
|
319
|
320
|
loop procpt_loopns
|
320
|
321
|
mov [timestr+7], rbx
|
321
|
322
|
|
|
@@ -348,11 +349,12 @@ proc_print_time:
|
348
|
349
|
xor rbx, rbx
|
349
|
350
|
mov rcx, HOURSLEN
|
350
|
351
|
mov rdi, 10
|
|
352
|
+ xor dl, dl
|
|
353
|
+ align 16
|
351
|
354
|
procpt_looph:
|
352
|
|
- xor dl, dl
|
353
|
355
|
div rdi
|
354
|
356
|
shl rbx, 8
|
355
|
|
- mov bl, dl
|
|
357
|
+ xchg bl, dl
|
356
|
358
|
cmp rax, 0
|
357
|
359
|
loopne procpt_looph
|
358
|
360
|
procpt_looph_end:
|