nya
This commit is contained in:
		
							parent
							
								
									bcf24631d4
								
							
						
					
					
						commit
						89cd73673d
					
				
					 4 changed files with 213 additions and 0 deletions
				
			
		
							
								
								
									
										88
									
								
								nasm/P.asm
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								nasm/P.asm
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,88 @@ | |||
| extern scanf | ||||
| extern printf  | ||||
| global main | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| section .text | ||||
| meow:	 | ||||
| 	fld qword [x + 8 * ebx] | ||||
| 	fld qword [n] | ||||
| 	fcomp  | ||||
| 	fstsw ax | ||||
| 	sahf | ||||
| 	jnbe end | ||||
| 	fld qword [n] | ||||
| 	fxch | ||||
| 	fsubr  | ||||
| 
 | ||||
| 	fld qword [s] | ||||
| 	fadd  | ||||
| 	fstp qword [s] | ||||
| 
 | ||||
| 	fld qword [x + 8 * ebx] | ||||
| 
 | ||||
| 	fld qword [q] | ||||
| 	fxch | ||||
| 	fdivr | ||||
| 
 | ||||
| 	inc ebx | ||||
| 
 | ||||
| 	fstp qword [x + 8 * ebx] | ||||
| 
 | ||||
| 	call meow | ||||
| 	dec ebx | ||||
| 
 | ||||
| 	fld qword [x + 8 * ebx] | ||||
| 
 | ||||
| 	fld qword [w] | ||||
| 	fxch | ||||
| 	fdivr | ||||
| 	inc ebx | ||||
| 
 | ||||
| 	fstp qword [x + 8 * ebx] | ||||
| 
 | ||||
| 	call meow | ||||
| 
 | ||||
| 	dec ebx | ||||
| 
 | ||||
| 	ret | ||||
| 
 | ||||
| end: | ||||
| 	sub esp, 4 | ||||
| 	fstp dword [esp] | ||||
| 	add esp, 4 | ||||
| 
 | ||||
| 	ret | ||||
| 
 | ||||
| main: | ||||
| 
 | ||||
| 	xor ebx, ebx | ||||
| 	push x | ||||
| 	push i | ||||
| 	call scanf | ||||
| 	add esp, 8 | ||||
| 	 | ||||
| 	call meow | ||||
| 
 | ||||
| 	fld qword [s] | ||||
| 	sub esp, 8 | ||||
| 	fstp qword [esp] | ||||
| 	push o | ||||
| 	call printf | ||||
| 	add esp, 12 | ||||
| 
 | ||||
| 	xor eax, eax | ||||
| 	ret | ||||
| 
 | ||||
| section .data | ||||
| i db "%lf", 0 | ||||
| o db "%.10lf", 10, 13, 0 | ||||
| 
 | ||||
| s dq 0.0 | ||||
| n dq 1.0 | ||||
| q dq 2.0 | ||||
| w dq 3.0 | ||||
| 
 | ||||
| section .bss | ||||
| x resq 100000 | ||||
		Reference in a new issue