두 개의 숫자를 더하고 표시 한 다음 두 숫자를 빼서 표시하는 간단한 어셈블리 프로그램을 만들려고합니다. 그러나 나는이 오류를 받고 있어요 :단순한 어셈블리 코드가 더하기/빼기를 시도하지 않음
oppgave3.asm:28: error: parser: instruction expected
oppgave3.asm:29: error: comma, colon, decorator or end of line expected after operand
oppgave3.asm:30: error: symbol `move' redefined
oppgave3.asm:30: error: parser: instruction expected
oppgave3.asm:31: error: comma, colon, decorator or end of line expected after operand
oppgave3.asm:32: error: comma, colon, decorator or end of line expected after operand
oppgave3.asm:33: error: comma, colon, decorator or end of line expected after operand
oppgave3.asm:37: error: symbol `move' redefined
oppgave3.asm:37: error: parser: instruction expected
oppgave3.asm:38: error: comma, colon, decorator or end of line expected after operand
oppgave3.asm:39: error: symbol `move' redefined
oppgave3.asm:39: error: parser: instruction expected
oppgave3.asm:40: error: comma, colon, decorator or end of line expected after operand
oppgave3.asm:41: error: comma, colon, decorator or end of line expected after operand
oppgave3.asm:42: error: comma, colon, decorator or end of line expected after operand
이 내가 할 노력하고있어입니다 : 나는 두 개의 서브 루틴을 추가하기위한 하나 빼기 하나 있습니다. 대신 "MOV"
첨가 "이동"쓴
section .data
a dw 4
b dw 2
section .bss
c resb 1
section .text
global_start:
_start:
call addition
mov eax,4
mov ebx,1
mov ecx,c
mov edx,1
int 0x80
call subtraction
mov eax,4
mov ebx,1
mov ecx,c
mov edx,1
int 0x80
addition:
move eax,[a]
sub eax '0'
move ebx,[b]
sub ebx '0'
add eax and ebx
add eax '0'
mov [c],eax
ret
subtraction:
move eax,[a]
sub eax '0'
move ebx,[b]
sub ebx '0'
sub eax and ebx
add eax '0'
mov [c],eax
ret
'add eax and ebx'가 무엇을 기대합니까? 아마도'add eax, ebx'를 의미할까요? 쉼표가 누락 된 다른 많은 지침이 있습니다 (예 : 'sub eax '0 ''은'sub eax,'0'이어야합니다. 또한 오류 메시지는 매우 도움이됩니다 - 문제가 무엇인지 정확하게 알려주는 것처럼 보입니다 - 더 자세히 연구 해보십시오. –
sub ebx '0'은 'sub ebx', '0'은 아니어야합니까? – Brandon