views:

53

answers:

1

I have the following ASM file generated by a compiler I'm writing:

; This code has been generated by the 7Basic
; compiler <http://launchpad.net/7basic&gt;

; Uninitialized data

      SECTION .bss
v_0 resb 4
v_4 resb 4
v_8 resb 4

; Code

      SECTION .text
push 1
pop eax
mov v_0, eax
push 2
pop eax
mov v_4, eax
mov eax, v_0
push eax
mov eax, v_4
push eax
pop ebx
pop eax
imul eax,ebx
push eax
pop eax
mov v_8, eax

When I try to compile it, I get the following errors:

test.asm:16: error: invalid combination of opcode and operands
test.asm:19: error: invalid combination of opcode and operands
test.asm:29: error: invalid combination of opcode and operands

This really doesn't make sense because according to the NASM docs, I'm allowed to:

MOV    mem_offs, reg_eax    386

Why can't I perform this operation?

+2  A: 

You need square brackets to dereference the pointers:

mov  [v_0], eax
Carl Norum
Thanks! That was the problem, all right.
George Edison