• 浮点指令


    .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

  • 相关阅读:
    Word 语法高亮
    AsyncFileUpload+Editor
    Silverlight QQ
    网页变黑白…
    Accelerator in Internet Explorer 8
    VS2010中文版安装Silverlight4 Tools…
    Win7下要求以管理员权限运行程序
    AjaxControlToolkitSeaDragon
    WebSlices in Internet Explorer 8
    <当和尚遇到钻石>读书笔记
  • 原文地址:https://www.cnblogs.com/qiangua/p/3464832.html
Copyright © 2020-2023  润新知