|
|
 |
 |
|
- According to the program “calc2.asm”, we execute two steps to load the first two data word in the data segment to the register AX and CX.
- The “r” command lists the state of the registers at this point. Note “AX=1271” and “CX=0170”, which are the default values in the memory before our program is ready to run.
- The next “t” command moves the content the data segment at location with offset “0000” to the register AX. The register “AX=00FF” now clearly contains the first data word.
- The next “t” command moves the contents of the data sement at location with offset “0002” to the register CX. The register “CX=0FFF” now clearly shows the second data word.
|
 |
 |
|
- We are now ready to add the contents of register CX to register AX.
|
 |
 |
|
- Executing the command “ADD AX, CX” adds the contents of register CX to AX. If you examine the contents of register “AX=10FE h”, this is what you would expect if you add “00FF h + 0FFF h”. Go ahead and do the addition to verify this answer. Note contents of register CX remain unaltered.
- We next move the sum in register AX to the data segment at offset “0004”. We may now dump the data segment memory to verif the number stored at this location as show below:
|
 |
 |
|
- Note at offset “0004”, the tow bytes stored are “FE 10”, which is equivalent to the data word “10FE h”, which is the sum from the last step.
- You have run your simplest assembly language program. You now know more about the how computers work than 99% of college educated science majors. You can give your self the “Captain Data” ward.
|
|