assembly - ASM - 8086 - Using Registers and variables -
am starting grips asm programming feel missing regarding use of registers store variables. issue have instructions modify other registers internal reasons. in cases have used these registers store application logic. there golden rules how use registers? for example: following code changes dx register , wipes out current variable. mov ax, 04h mov bx, 02h mul bx i did not want nor state want dx register wiped out. what's going on here? welcome assembly language programming. short answer pick values manipulated often. rule compilers use register allocation. score usages numerically heuristic values, put best scores in registers until there no more. in 8086 assembler, have small number of registers, , many of them have special purposes. you've discovered one: mul , div implicitly use ax , dx. think of mul instruction mul dx:ax, operand , , you'll see what's going on. makes life harder, the assembly level, architecture designer doesn't care. he...