鱼C论坛

 找回密码
 立即注册
查看: 4209|回复: 4

at&t 汇编

[复制链接]
发表于 2019-10-9 19:48:37 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
.code32
# functest3.s - An example of using C style functions
.section .data
output:
   .asciz "This area is %f\n"
precision:
   .byte 0x7f, 0x00
.section .text
.globl _start
_start:
   nop
   finit
pushl $10
   call area
   addl $4, %esp
    pushl %eax
    pushl $output
    call printf
    movl $120, %ebx
movl $1, %eax
   int $0x80

.type area, @function
area:
   pushl %ebp
   movl %esp, %ebp
   subl $4, %esp
   fldpi
   filds 8(%ebp)
   fmul %st(0), %st(0)
   fmulp %st(0), %st(1)
    fstps -4(%ebp)
    movl -4(%ebp), %eax
   movl %ebp, %esp
   popl %ebp
   ret

求问这个为什么输出不对?目标是输出314.1597, 但是实际输出0.0000
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2019-10-9 20:48:24 | 显示全部楼层
kikiatw 发表于 2019-10-9 20:43
你試用dev c++編譯的嗎?
把c原始碼po上來看看說不定你的c原始碼就錯了

我是在linux 64位机器下直接写的at&t汇编。
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-11-4 14:55

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表