PhotoShaman

ASM.Лаба2

Mar 5th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; multi-segment executable file template.
  2.  
  3. data segment
  4.     ; add your data here!
  5.     A db 60
  6.     B db 16
  7.     C db 5
  8.     D db 18    
  9.     H dw 0
  10.     J dw 0
  11.    
  12.     pkey db "press any key...$"
  13. ends
  14.  
  15. stack segment
  16.     dw   128  dup(0)
  17. ends
  18.  
  19. code segment
  20. start:
  21. ; set segment registers:
  22.     mov ax, data
  23.     mov ds, ax
  24.     mov es, ax
  25.  
  26.     ; add your code here
  27.    
  28.     mov al, A
  29.     mov cl, 2
  30.     mul cl
  31.     mov H, ax
  32.    
  33.     mov al, B
  34.     mov cl, C
  35.     mul cl
  36.     mov J, ax
  37.    
  38.     mov ax, H
  39.     mov bx, J
  40.     add ax, bx
  41.     mov H, ax
  42.    
  43.     mov al, D
  44.     mov ah, 0
  45.     sub al, 3  
  46.     mov J, ax
  47.    
  48.     mov ax, H
  49.     mov cx, J
  50.     div cx
  51.    
  52.    
  53.    
  54.     lea dx, pkey
  55.     mov ah, 9
  56.     int 21h        ; output string at ds:dx
  57.    
  58.     ; wait for any key....    
  59.     mov ah, 1
  60.     int 21h
  61.    
  62.     mov ax, 4c00h ; exit to operating system.
  63.     int 21h    
  64. ends
  65.  
  66. end start ; set entry point and stop the assembler.
Advertisement
Add Comment
Please, Sign In to add comment