Write an assembly program that first initializes two 16bit s
Write an assembly program that first initializes two 16-bit signed integers, “Items” and “Cost”.
Solution
 The easiest expressions to convert to assembly language are the simple assignments.
 Simple assignments copy a single value into a variable and take one of two forms:
 variable := constant
 or
 variable := variable
 If variable appears in the current data segment (e.g., DSEG), converting the first form
 to assembly language is easy, just use the assembly language statement:
 mov variable, constant
 This move immediate instruction copies the constant into the variable.
 The second assignment above is somewhat complicated since the 80x86 doesn’t provide
 a memory–to-memory mov instruction. Therefore, to copy one memory variable into
 another, you must move the data through a register. If you’ll look at the encoding for the
 mov instruction in the appendix, you’ll notice that the mov ax, memory and mov memory, ax
 instructions are shorter than moves involving other registers. Therefore, if the ax register
 is available, you should use it for this operation. For example,
 var1 := var2;
 becomes
 mov ax, var2
 mov var1, ax
 Of course, if you’re using the ax register for something else, one of the other registers will
 suffice. Regardless, you must use a register to transfer one memory location to another.
 This discussion, of course, assumes that both variables are in memory. If possible, you
 should try to use a register to hold the value of a variable.

