Advertisement
apl-mhd

Assembly Assignment

Sep 17th, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. org 100h
  2.  
  3.  
  4. .stack 100h
  5. .DATA
  6. W dw 1,2,3,4,5,6,7,8  
  7.  
  8. .CODE
  9.                  
  10.                  
  11.                
  12.     mov cx,8
  13.     mov dx,0
  14.     mov si,0
  15.    
  16.    push cx
  17.    
  18.     pushstack:    
  19.     push W[SI]
  20.     add si,2  
  21.     LOOP pushstack
  22.  
  23.   mov ax,1
  24.   mov cx,8
  25.   mov si,0
  26.    
  27.   copy:
  28.   pop W[si]
  29.   add si,2
  30.   Loop copy
  31.  
  32.  
  33.       mov si,0
  34.       mov cx,8
  35.       mov bx, 0  
  36.    
  37.    
  38.    lvl:
  39.       sub cx,1
  40.     cmp cx, 4
  41.     jge sumation
  42.    
  43.     jmp multiplication
  44.     hlt
  45.    
  46.    
  47.    
  48.    
  49.      
  50.     sumation:
  51.     add bx, w[si]
  52.     add si,2
  53.     jmp lvl
  54.     hlt
  55.          
  56.     multiplication:
  57.    
  58.     imul  w[si]
  59.     add si,2
  60.      
  61.     cmp cx,0
  62.     jz estate
  63.     jmp lvl
  64.    
  65.     estate:  
  66.     mov cx, ax
  67.     mov ax, bx
  68.     mov bx, cx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement