user1784297
user1784297

Reputation: 105

parser: instruction expected on move instruction

I'm trying to make a simple assembly program that is to add two numbers and display them, and then subtract two numbers and display them. But I'm getting there errors :

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

This is what I'm trying to do: I have two subroutines, one for addition and one for substraction.

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

Upvotes: 0

Views: 1552

Answers (2)

MrJomp
MrJomp

Reputation: 135

You wrote "move" instead of "mov"

A token not recognized as an instruction mnemonic is instead considered as a label. Like move nop is equivalent to move: nop. That's why you get "symbol 'move' redefined on some of the later uses.

There are various other syntax errors, like sub eax and ebx instead of sub eax, ebx, and a missing comma in sub ebx '0'

Upvotes: 3

Sayu Sekhar
Sayu Sekhar

Reputation: 169

I think you have a typo. You have a "move" instruction whereas my guess is that it should be "mov" without the extra e at the end. I am no assembly expert, so I might be wrong here.

Upvotes: 0

Related Questions