Browse Source

Enhancement in proc_print_time arguments

Yann Weber 5 years ago
parent
commit
22bc403872
1 changed files with 7 additions and 11 deletions
  1. 7
    11
      wtfstopw.asm

+ 7
- 11
wtfstopw.asm View File

@@ -189,8 +189,8 @@ mov [ts_sleep.tv_nsec], rax
189 189
 
190 190
 std ; set DF for string operations
191 191
 main_loop:
192
-	mov rax, 2 ; stderr
193
-	mov rdi, 0xD ; \r
192
+	push 2
193
+	push 0xD
194 194
 	call proc_print_time
195 195
 
196 196
 	; Attempt to read from stdin
@@ -262,14 +262,10 @@ newline_exit:
262 262
 ;
263 263
 ; Print current time on FD and add a leading char CHR
264 264
 ; push FD & push CHR to set arguments
265
-; rax the FS & rdi the leading CHR
266 265
 ; 	Warning : DF must be set
267 266
 ;
268 267
 proc_print_time:
269 268
 	
270
-	push rax
271
-	push rdi
272
-
273 269
 	; updating ts_cur time
274 270
 	mov rax, 228 ; clock_gettime
275 271
 	mov rdi, 0 ; CLOCK_REALTIME
@@ -366,17 +362,17 @@ proc_print_time:
366 362
 	cmp rcx, r9
367 363
 	cmovnle rcx, r9
368 364
 
369
-	pop r10 ; pop leading char argument
365
+	mov r10, [rsp + 8]
370 366
 	mov byte [timestr+timestrlen-1], r10b
371 367
 
372 368
 	mov rax, 1 ; write
373
-	pop rdi ; pop fd argument
369
+	mov rdi, [rsp + 16]
374 370
 	mov rdx, timestrlen + 9
375 371
 	sub rdx, rcx ; timestr + hours len
376 372
 	lea rsi, [hours + rcx] ; hours start pointer
377 373
 	syscall
378 374
 
379
-	ret
375
+	ret 16
380 376
 
381 377
 ;
382 378
 ;	sig handler for SIGINT displaying lap count and time on stdout
@@ -428,9 +424,9 @@ proc_lap_handler:
428 424
 	mov rdx, 3 ; " : "
429 425
 	syscall
430 426
 
431
-	mov rax, 1 ; stdout
432
-	mov rdi, 0xA ; \n
433 427
 	std ; set DF for string operations
428
+	push 1
429
+	push 0xA
434 430
 	call proc_print_time
435 431
 
436 432
 	ret

Loading…
Cancel
Save