Am I Writing Assembly Or NASM?

Posted by cam on Stack Overflow See other posts from Stack Overflow or by cam
Published on 2010-05-20T14:32:21Z Indexed on 2010/05/20 14:40 UTC
Read the original article Hit count: 355

Filed under:
|

I'm fed up with this. I've been trying to just get a grip on assembly for awhile, but I feel like I'm coding towards my compiler rather than a language.

I've been using this tutorial, and so far it's giving me hell. I'm using NASM, which may be the problem, but I figured it was the most popular one. I'm simply trying to learn the most general form of assembly, so I decided to learn x86. I keep running into stupid errors, like not being able to increment a variable. Here's the latest one: not being able to use div.

mov bx, 0;
mov cx, 0;
jmp start;
 start:
 inc cx;
 mov ax, cx;
 div 3; <-- invalid combination of opcode and operand
 cmp ah,0;
 jz totalvalue;
 mov ax, cx;
 div 5; <-- invalid combination of opcode and operand
 cmp ah, 0;
 jz totalvalue;
 cmp cx, 1000;
 jz end;

 totalvalue:
 add bx,cx;
 jmp start;

jmp end;
 end:
   mov ah,4ch;
   mov al,00;
   int 21h;

Should I change compilers? It seems like division should be standard. Do I need to read two tutorials (one on NASM, and one on x86?). Any specific help on this problem?

© Stack Overflow or respective owner

Related posts about nasm

Related posts about assembly