码迷,mamicode.com
首页 > 其他好文 > 详细

FloatTest32 Example

时间:2016-11-02 18:13:25      阅读:349      评论:0      收藏:0      [点我收藏+]

标签:asm   push   sam   please   ini   img   enter   user   macros   

Example Program The following example program pushes two floating-point values on
the FPU stack, displays it, inputs two values from the user, multiplies them, and displays their
product:

TITLE 32-bit Floating-Point I/O Test (floatTest32.asm)
INCLUDE Irvine32.inc
INCLUDE macros.inc
.data
first REAL8 123.456
second REAL8 10.0
third REAL8 ?
.code
main PROC
finit ; initialize FPU
; Push two floats and display the FPU stack.
fld first
fld second
call ShowFPUStack
; Input two floats and display their product.
mWrite "Please enter a real number: "
call ReadFloat
mWrite "Please enter a real number: "
call ReadFloat
fmul ST(0),ST(1) ; multiply
mWrite "Their product is: "
call WriteFloat
call Crlf
exit
main ENDP
END main

Sample input/output (user input shown in bold type):

技术分享

 

FloatTest32 Example

标签:asm   push   sam   please   ini   img   enter   user   macros   

原文地址:http://www.cnblogs.com/dreamafar/p/6023492.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!