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

Loading…
Cancel
Save