Am I writing an assembly or NASM?

I'm tired of it. I tried to grab the assembly a bit for a while, but it seems to me that I am coding my compiler, not the language.

I used this tutorial , and so far it has been giving me hell. I use NASM and this may be a problem, but I thought it was the most popular. I'm just trying to learn the most general form of assembly, so I decided to study x86. I continue to encounter such stupid mistakes as the inability to increment a variable. Here's the last one: the inability to use the 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? Seems like separation should be standard. I need to read two tutorials (one on NASM and one on x86?). Any specific help on this issue?

+3
4

, , , . "div 5" , MASM, . , , , , "" , NASM Intel div.

, NASM, , NASM, "" Intel. Art of Assembly Intel.

+6

: x86 . , NASM, . , ( NASM).

, javac Eclipse. Java. , , .

, NASM Intel x86, , - .

, DIV, , :

80x86 64/32 (80386 ), 32/16 16/8 . :

            div     reg     For unsigned division
            div     mem

            idiv    reg     For signed division
            idiv    mem

            aad             ASCII adjust for division

, . div , .

+8

Intel div ( ), , , .

+5

Ummm, ... , A86, shareware (gee, !) , nasm , , , nasm..

x86 Assembler, no matter what you use, for example, GAS, NASM, A86, TASM, MASM, everything is the same, some may have additional syntactic sugar, others may not ...

+2
source

Source: https://habr.com/ru/post/1746398/


All Articles