Enhancement in proc_print_time arguments

This commit is contained in:
Yann Weber 2018-09-08 17:59:05 +02:00
commit 22bc403872

View file

@ -189,8 +189,8 @@ mov [ts_sleep.tv_nsec], rax
std ; set DF for string operations
main_loop:
mov rax, 2 ; stderr
mov rdi, 0xD ; \r
push 2
push 0xD
call proc_print_time
; Attempt to read from stdin
@ -262,14 +262,10 @@ newline_exit:
;
; Print current time on FD and add a leading char CHR
; push FD & push CHR to set arguments
; rax the FS & rdi the leading CHR
; Warning : DF must be set
;
proc_print_time:
push rax
push rdi
; updating ts_cur time
mov rax, 228 ; clock_gettime
mov rdi, 0 ; CLOCK_REALTIME
@ -366,17 +362,17 @@ proc_print_time:
cmp rcx, r9
cmovnle rcx, r9
pop r10 ; pop leading char argument
mov r10, [rsp + 8]
mov byte [timestr+timestrlen-1], r10b
mov rax, 1 ; write
pop rdi ; pop fd argument
mov rdi, [rsp + 16]
mov rdx, timestrlen + 9
sub rdx, rcx ; timestr + hours len
lea rsi, [hours + rcx] ; hours start pointer
syscall
ret
ret 16
;
; sig handler for SIGINT displaying lap count and time on stdout
@ -428,9 +424,9 @@ proc_lap_handler:
mov rdx, 3 ; " : "
syscall
mov rax, 1 ; stdout
mov rdi, 0xA ; \n
std ; set DF for string operations
push 1
push 0xA
call proc_print_time
ret