Just you you know, you should never do something like
Way to complicated, that gets transformed into this:Code:a = a + 1;
5 lines of assembly is way too much.Code:mov [a], ax
addi ax, 1
push ax ;put it into temp storage
pop ax ;get it out of temp storage
mov ax, [a]
The C++ way of adding a value to itself is
Which gets assembled toCode:a += 1;
Bypassing the temporary storage you get down to three processor commands.Code:mov [a], ax
addi ax, 1
mov ax, [a]
The processor has specialized functions for adding and subtracting 1 though so to add one to a variable.
will be assembled into thisCode:++a;
Code:mov [a], ax
inc ax ;much faster than addi
mov ax, [a]
Realistically, the optimizer will do that for you, but it's better to do it explicitly.