很抱歉,如果这是一个非常新手的问题,我一直在尝试制作一个比较两个数字的简单汇编程序。但是,当我尝试使用NASM编译程序时,我收到此错误:
increment.asm:21: error: comma, colon, decorator or end of line expected after operand
increment.asm:21: error: comma, colon, decorator or end of line expected after operand
increment.asm:22: error: comma, colon, decorator or end of line expected after operand
increment.asm:22: error: comma, colon, decorator or end of line expected after operand
increment.asm:23: error: comma, colon, decorator or end of line expected after operand
increment.asm:23: error: comma, colon, decorator or end of line expected after operand
increment.asm:24: error: comma, colon, decorator or end of line expected after operand
increment.asm:24: error: comma, colon, decorator or end of line expected after operand
increment.asm:31: error: comma, colon, decorator or end of line expected after operand
increment.asm:31: error: comma, colon, decorator or end of line expected after operand
increment.asm:35: error: comma, colon, decorator or end of line expected after operand
increment.asm:35: error: comma, colon, decorator or end of line expected after operan
我完全不知道发生了什么! 这是我的代码(使用NASM和ld编译):
1 %macro writesys 2
2 mov eax, 4
3 mov ebx, 1
4 mov ecx %1
5 mov edx %2
6 int 0x80
7 %endmacro
8
9 %macro readsys 2
10 mov eax, 3
11 mov ebx, 0
12 mov ecx %1
13 mov edx %2
14 int 0x80
15 %endmacro
16
17 section .text
18 global _start
19
20 _start:
21 writesys enternum, 17
22 readsys num1, 5
23 writesys enternum, 17
24 readsys num2, 5
25
26 cmp num1, num2
27 je equal
28 jne notequal
29
30 equal:
31 writesys equalnum, 26
32 jmp exit
33
34 notequal:
35 writesys notequalnum, 29
36 jmp exit
37
38 exit:
39 mov eax, 1
40 int 0x80
41
42 section .data
43 enternum db "Enter a number: "
44 equalnum db "The two numbers are equal"
45 notequalnum db "The two numbers arent equal"
46
47 section .bss
48 num1 resb 1
49 num2 resb 2
50
感谢任何帮助。 谢谢!