4.10 Floating Point (Optional/Extra Credit) |
segment .data flt_fmt db " %#16.8g",0 segment .bss print_st0: ; Print top of fp stack pusha pushf push ebp ; Save old bp mov ebp,esp ; New frame pointer sub esp,12 ; Space for call prams fst qword [esp+4]; Get 64 st(0) -> stack jmp common print_fp: ; Print EAX pusha pushf push ebp ; Save old bp mov ebp,esp ; New frame pointer sub esp,12 ; Space for call prams mov [esp+4], eax ; Put arg on stack/temp fld dword [esp+4]; Put 32bit fp -> st(0) fstp qword [esp+4]; Get 64 st(0) -> stack common: mov dword [esp],flt_fmt ; Format string call printf ; call c with coerced value leave ; pop frame popf popa ret
Write a program in assembly language that:
Turn in a printed error free listing and the output of your program. Include a copy of any testing that you did to verify the program was correct. If you don't do this I won't grade it!
4.10 Floating Point (Optional/Extra Credit) |