新手报道帖:请教这个代码的语法错误在哪里?

mcmay 2016-01-16 05:14:20
各位达人,俺刚开始接触汇编,用书本中说的NASM(我用的版本是2.11.08编译例子代码时,编译器报错说第15行有语法问题,麻烦指点一下是怎么回事。谢谢!
; Executable name : EATSYSCALL
; Version : 1.0
; Created date : 1/7/2009
; Last update : 1/7/2009
; Author : Jeff Duntemann
; Description : A simple assembly app for Linux, using NASM 2.05,
; demonstrating the use of Linux INT 80H syscalls
; to display text.
;
; Build using these commands:
; nasm -f elf -g -F stabs eatsyscall.asm
; ld -o eatsyscall eatsyscall.o
;
SECTION .data ; Section containing initialized data
EatMsg: db “Eat at Joe’s!“,10 ;报错说这一行有问题
EatLen: equ $-EatMsg
SECTION .bss ; Section containing uninitialized data
SECTION .text ; Section containing code
global _start ; Linker needs this to find the entry point!
_start:
nop ; This no-op keeps gdb happy (see text)
mov eax,4 ; Specify sys_write syscall
mov ebx,1 ; Specify File Descriptor 1: Standard Output
mov ecx,EatMsg ; Pass offset of the message
mov edx,EatLen ; Pass the length of the message
int 80H ; Make syscall to output the text to stdout
mov eax,1 ; Specify Exit syscall
mov ebx,0 ; Return a code of zero
int 80H ; Make syscall to terminate the program


编译结果:
listing5_1.asm:15: error: expression syntax error

谢谢!
...全文
190 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hoei 2016-01-24
  • 打赏
  • 举报
回复
引用 2 楼 hoei 的回复:
把 : 去掉
EatMsg db “Eat at Joe’s!“,10
hoei 2016-01-24
  • 打赏
  • 举报
回复
把 : 去掉
baidu_23107797 2016-01-16
  • 打赏
  • 举报
回复
不可以用全形 “ 用半形 "

21,497

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧