assembly - TASM Math coprocessor FSUB not substracting -


i encounter difficulties using math coprocessor. need calculate area of triangle using heron's formula (s=sqrt(p(p-a)(p-b)(p-c)), p semiperimeter , a, b , c triangle's sides). read a, b, c , calculate p have problems in substracting a, b , c p. code:

data segment para public 'data' dd 0 b dd 0 c dd 0 p dd 0 pa dd 0 ; p-a pb dd 0 ;p-b pc dd 0 ;p-c area dd 0 2 dd 2 aux dd 0 data ends  read macro x, aux ; reading macro a, b , c. goes fine local r, final push eax push ebx push edx mov x, 0 mov ebx, 10 r:    mov ah, 1h    int 21h    cmp al, 0dh    je final    cmp al,30h    jb r    cmp al, 39h    ja r    sub al, 48    xor ah,ah    mov aux,eax    mov eax, x    mul ebx    add eax, aux    mov x, eax    jmp r  final:  pop edx pop ebx pop eax endm  code segment para public 'code' .386 start proc far assume cs:code, ds:data push ds xor ax,ax push ax mov ax,data mov ds,ax  read a, aux read b, aux read c, aux  finit fld fadd b fadd c fdiv 2 fstp p ;p computed fld p fsub ; here problem. seems doesn't subtract fstp pa fld p fsub b ; also, same problem here fstp pb fld p fsub c ;also, same problem here fstp pc fld p fmul pa fmul pb fmul pc fsqrt fstp area fwait  ret start endp code ends end start 


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -