title: assembly multiply two 16 bit program using 68hc11
body: <p>I need to Write a program that will </p>
  
  <ul>
  <li>multiply a pair of 16-bit numbers stored at {M, M+1} and {N, N+1} and store the resulting 32-bit product at {P, P+1,P+2, P+3}. </li>
  <li>multiply a pair of 16-bit numbers stored at {M, M+1} and {N, N+1} and
  store the resulting 32-bit product at {P, P+1,P+2, P+3}.</li>
  <li><p>Everything is stored in “MSB at lowest address” order, i.e. (P) would
  be the highest byte of the product and (P+3) would be the lowest
  byte.</p></li>
  <li><p>Arrange for M to live at $200-$201, N at $202-$203, and P at
  $210-$213.</p></li>
  <li><p>Hint: because the HC11’s MUL instruction is 8-bit only, use the
  partial products method.</p></li>
  <li><p>Test your solution with each of the following cases and give your
  resulting 32-bit answer:</p></li>
  <li><p>Case 1: M=$4B18 and N=$71C9</p></li>
  <li><p>Case 2: M= N=$8FED</p></li>
  </ul>
  
  <p>Ok so I found the below example code for multiplying two 32 bit numbers together.</p>
  
  <p>I need to convert the code to the HC11's version of assembly and then correct it to multiply a 16 bit instead of a 32 bit number...</p>
  
  <p>The mov should be changed to LD for the 68hc11 I believe and then ? </p>
  
  <pre><code>.model small
  
  .data
          mult1 dw 2521H
                dw 3206H
          mult2 dw 0A26H
                dw 6400H
          ans   dw 0,0,0,0
  
  .code
          mov ax,@data
          mov ds,ax
  
  ;       LEA SI,ans
  
          mov ax,mult1
          mul mult2
          mov ans,ax
          mov ans+2,dx
  
          mov ax,mult1+2
          mul mult2
          add ans+2,ax
          adc ans+4,dx
          adc ans+6,0
  
          mov ax,mult1
          mul mult2+2
          add ans+2,ax
          adc ans+4,dx
          adc ans+6,0
  
          mov ax,mult1+2
          mul mult2+2
          add ans+4,ax
          adc ans+6,dx
  
          mov ax,4C00h
          int 21h
  end
  </code></pre>