(SRCTools Version 3.1.1)
 HexLoc     DecLoc    MachWord   Label        Instruction                Comment
                                                                         ;
                                                                         ;	CPE 221 Assembly Example
                                                                         ;	11/1/2012
                                                                         ;	This program multiplies two numbers by shifting and addition.
                                                                         ;	First, take absolute values of both numbers, do multiplication,
                                                                         ; 	then adjust result as necessary.
                                                                         
                                data:         .org 200                   
                                num1:         .equ 66524                 
                                num2:         .equ 1258                  
000000c8  0000000200            result:       .dw 1                      
000000cc  0000000204  00000001  mask:         .dc 1                      
000000d0  0000000208  00007fff  max:          .dc 32767                  
                                                                         
                                code:         .org 1000                  
000003e8  0000001000  37800060                lar r30, ready             
000003ec  0000001004  37400088                lar r29, done              
000003f0  0000001008  3700007c                lar r28, one_pos           
000003f4  0000001012  36c00070                lar r27, adjust            
000003f8  0000001016  36800038                lar r26, next              
000003fc  0000001020  36400058                lar r25, skip              
00000400  0000001024  36000038                lar r24, check_max         
                                                                         
00000404  0000001028  08400000                ld r1, num1                ; Put num1 in r1.
ERROR on line above: Constant num1 out of range.
00000408  0000001032  088004ea                ld r2, num2                ; Put num2 in r2.
0000040c  0000001036  098000cc                ld r6, mask                ; Put mask in r6
00000410  0000001040  0a8000d0                ld r10, max                ; Put maximum value in r10
                                                                         
00000414  0000001044  70c63000                sub r3, r3, r3             ; Set r3 to 0, it will hold the result.
00000418  0000001048  403a1002                brzr r29, r1               ; If num1 = 0, we are done, result = 0.
0000041c  0000001052  403a2002                brzr r29, r2               ; If num2 = 0, we are done, result = 0.
                                                                         
00000420  0000001056  29c00010                la r7, 16                  ; r4 used for loop control.
00000424  0000001060  69020000                addi r4, r1, 0             ; Copy num1 to r4, it will be added.
00000428  0000001064  69440000                addi r5, r2, 0             ; Copy num2 to r5, used to decide whether to add.
0000042c  0000001068  40344004                brpl r26, r4               ; Take absolute value of num1.
00000430  0000001072  79004000                neg r4, r4                 
00000434  0000001076  40305004  next:         brpl r24, r5               ; Take absolute value of num2.
00000438  0000001080  79405000                neg r5, r5                 
                                                                         
0000043c  0000001084  72544000  check_max:    sub r9, r10, r4            
00000440  0000001088  403a9005                brmi r29, r9               
00000444  0000001092  72545000                sub r9, r10, r5            
00000448  0000001096  403a9005                brmi r29, r9               
0000044c  0000001100  a20c5000  ready:        and r8, r6, r5             ; And mask to r5 to examine bit.
00000450  0000001104  40328002                brzr r25, r8               ; Skip adding if bit = 0.
00000454  0000001108  60c64000                add r3, r3, r4             ; Add.
00000458  0000001112  e1080001  skip:         shl r4, r4, 1              ; Shift multiplicand left by 1.
0000045c  0000001116  d14a0001                shr r5, r5, 1              ; Look at next bit of multiplier.
00000460  0000001120  69cfffff                addi r7, r7, -1            ; Decrement loop count.
00000464  0000001124  403c7003                brnz r30, r7               ; Need to execute loop again.
00000468  0000001128  40381004  adjust:       brpl r28, r1               ; Done adding, now adjust sign of result.
0000046c  0000001132  78c03000                neg r3, r3                 ; If num1 negative, negate result.
00000470  0000001136  403a2004  one_pos:      brpl r29, r2               
00000474  0000001140  78c03000                neg r3, r3                 ; If num2 negative, negate result.
00000478  0000001144  18c000c8  done:         st r3, result              
0000047c  0000001148  f8000000                stop                       
                                                                         
                                                                         
                                                                         

--- Symbol Table ---
check_max: 1084
code: 1000
one_pos: 1136
done: 1144
data: 200
next: 1076
num2: 1258
num1: 66524
max: 208
ready: 1100
adjust: 1128
skip: 1112
mask: 204
result: 200
