title: Substracting Three Integers in Assembly (MASM)
body: <p>Using the <strong>AddSub</strong> program, write a program that subtracts three integers using only 16-bit registers. Insert a <strong>call DumpRegs</strong> statement to display the register values.</p>
  
  <p>AddSub Example Program:</p>
  
  <pre><code>TITLE Add and Subtract, Version 2 (AddSub2.asm)
  ; This program adds and subtracts 32-bit unsigned
  ; integers and stores the sum in a variable.
  INCLUDE Irvine32.inc
  .data
  val1 DWORD 10000h
  val2 DWORD 40000h
  val3 DWORD 20000h
  finalVal DWORD ?
  .code
  main PROC
  mov eax,val1 ; start with 10000h
  add eax,val2 ; add 40000h
  sub eax,val3 ; subtract 20000h
  mov finalVal,eax ; store the result (30000h)
  call DumpRegs ; display the registers
  exit
  main ENDP
  END main
  How does it work? First,
  </code></pre>