PhotoShaman

ASM.Лаба1

Mar 1st, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //--------------------------------------Задание 1
  2.  
  3. ; multi-segment executable file template.
  4.  
  5. data segment
  6.     ; add your data here!
  7.     pkey db "press any key...$"
  8. ends
  9.  
  10. stack segment
  11.     dw   128  dup(0)
  12. ends
  13.  
  14. code segment
  15. start:
  16. ; set segment registers:
  17.     mov ax, data
  18.     mov ds, ax
  19.     mov es, ax
  20.  
  21.     ; add your code here
  22.    
  23.     mov ax, 0
  24.     mov bx, 0
  25.     mov cx, 0
  26.    
  27.     mov ah, 140
  28.     mov al, 10
  29.    
  30.     mov bx, ax
  31.     mov cx, ax
  32.    
  33.     add ax, bx
  34.  
  35.              
  36.     lea dx, pkey
  37.     mov ah, 9
  38.     int 21h        ; output string at ds:dx
  39.    
  40.     ; wait for any key....    
  41.     mov ah, 1
  42.     int 21h
  43.    
  44.     mov ax, 4c00h ; exit to operating system.
  45.     int 21h    
  46. ends
  47.  
  48. end start ; set entry point and stop the assembler.
  49.  
  50. //--------------------------------------Задание 2
  51.  
  52. ; multi-segment executable file template.
  53.  
  54. data segment
  55.     ; add your data here!
  56.     tabl1 db 10, 20, 30, 40
  57.     tabl2 db 0, 0, 0, 0
  58.    
  59.     pkey db "press any key...$"
  60. ends
  61.  
  62. stack segment
  63.     dw   128  dup(0)
  64. ends
  65.  
  66. code segment
  67. start:
  68. ; set segment registers:
  69.     mov ax, data
  70.     mov ds, ax
  71.     mov es, ax
  72.  
  73.     ; add your code here
  74.    
  75.     mov al, tabl1
  76.     mov tabl2 + 3, al
  77.     mov al, tabl1 + 1
  78.     mov tabl2 + 2, al
  79.     mov al, tabl1 + 2
  80.     mov tabl2 + 1, al
  81.     mov al, tabl1 + 3
  82.     mov tabl2, al
  83.              
  84.     lea dx, pkey
  85.     mov ah, 9
  86.     int 21h        ; output string at ds:dx
  87.    
  88.     ; wait for any key....    
  89.     mov ah, 1
  90.     int 21h
  91.    
  92.     mov ax, 4c00h ; exit to operating system.
  93.     int 21h    
  94. ends
  95.  
  96. end start ; set entry point and stop the assembler.
Add Comment
Please, Sign In to add comment