zoukankan      html  css  js  c++  java
  • 浮点指令

    .386
    .model flat, stdcall
    option casemap :none

    include windows.inc
    include kernel32.inc
    include msvcrt.inc
    includelib kernel32.lib
    includelib msvcrt.lib

    .data?

    dwRadius dd ? ;半径
    .data
    dwCenterX dd 10 ;圆心X
    .const
    szFmtp db 'Degree=30,Radius=4 x=%d',0dh,0ah,0
    szFmtp2 db 'Degree=45,Radius=4 x=%d',0dh,0ah,0
    szFmtp3 db 'Degree=60,Radius=4 x=%d',0dh,0ah,0
    szFmtp4 db 'Degree=90,Radius=4 x=%d',0dh,0ah,0
    szFmts db '%*d',0dh,0ah,0
    .code

    _dwPara180 dw 180
    _CalcX proc _dwDegree,_dwRadius
    local @dwReturn

    fild dwCenterX
    fild _dwDegree
    fldpi
    fmul ;角度*Pi
    fild _dwPara180 ;角度转换弧度
    fdivp st(1),st ;角度*Pi/180
    fsin ;Sin(角度*Pi/180)
    fild _dwRadius
    fmul ;半径*Sin(角度*Pi/180)
    fadd ;X+半径*Sin(角度*Pi/180)
    fistp @dwReturn
    mov eax,@dwReturn
    ret

    _CalcX endp

    start:
    ;12
    push 4
    push 30
    call _CalcX
    invoke crt_printf,addr szFmtp,eax
    ;10+2√2
    push 4
    push 45
    call _CalcX
    invoke crt_printf,addr szFmtp2,eax
    ;10+2√3
    push 4
    push 60
    call _CalcX
    invoke crt_printf,addr szFmtp3,eax

    push 4
    push 90
    call _CalcX
    invoke crt_printf,addr szFmtp4,eax
    push 8
    push 90
    call _CalcX
    invoke crt_scanf,addr szFmts ;暂停
    invoke ExitProcess,NULL
    end start

  • 相关阅读:
    [转] Web前端优化之 Server篇
    [转] Web前端优化之 内容篇
    [学习笔记] Web设计过程中该做和不该做的
    web前端性能优化
    jQuery代码片段
    socket.io
    ajax阻塞UI线程
    前端面试题整理
    nodejs之async异步编程
    jquery源码笔记
  • 原文地址:https://www.cnblogs.com/qiangua/p/3464832.html
Copyright © 2011-2022 走看看