News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

15000 Digits of PI

Started by mabdelouahab, September 16, 2018, 02:41:32 AM

Previous topic - Next topic

mabdelouahab


Calc__Pi proc
XOR RAX,RAX
MOV a,RAX
MOV R12,__N
loop1:
PUSH R12
;-----------------------------------------------------
MOV d,0
MOV i,r12
Loop2:
;-------------------------------------------------
XOR R11,R11
MOV R11 ,i
ADD R11 ,R11
ADD R11 ,R11
ADD R11 ,R11
LEA RAX,r
ADD R11,RAX
MOV RAX,QWORD PTR [R11]
IMUL RAX,RAX,10000
ADD d,RAX
MOV RAX,i
ADD RAX,RAX
DEC RAX
MOV b,RAX
MOV RAX, d
CDQ
IDIV b
MOV QWORD PTR [R11], RDX
MOV RAX, d
CDQ
IDIV b
MOV d, RAX
SUB R11,8
DEC i
CMP i,0
JE _next
MOV RAX, d
IMUL RAX, i
MOV d, RAX
;-------------------------------------------------
JMP loop2
_next:
MOV RCX,10000
MOV RAX, d
CDQ
IDIV RCX
ADD RAX,a
invoke printf,"%.4d",Rax
MOV RCX,10000
MOV RAX, d
CDQ
IDIV RCX
MOV a, RDX
;-----------------------------------------------------
POP R12
SUB R12,14
CMP R12,0
JG  loop1
ret
Calc__Pi endp

Source: Computing Pi in C

daydreamer

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

hutch--

mabdelouahab,

Would you stick big blocks of text like the pi results in a zip file instead, makes the forum hard to read otherwise.

mabdelouahab


hutch--