Advertisement
Guest User

lab4

a guest
Nov 7th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. assume cs: code, ds: data
  2.  
  3. data segment
  4. newline db 0Ah, '$'
  5. msg db 100, 99 dup (0)
  6. sum db 00h
  7. string db 100, 99 dup (0)
  8. string1 db 100, 99 dup (0)
  9. data ends
  10.  
  11. code segment
  12.  
  13. donewline proc
  14.     mov dx, offset newline
  15.     mov ah, 09h
  16.     int 21h
  17.     ret
  18. donewline endp
  19.  
  20. addbig proc
  21.     push bp
  22.     mov bp, sp
  23.     mov di, offset msg
  24.     metka2:
  25.         inc di
  26.         loop metka2
  27.     mov cx, ax
  28.     std
  29.     mov al, 24h
  30.     stosb
  31.     mov si, [bp+4]
  32.     mov bx, [bp+6]
  33.     sum:
  34.         mov al, byte ptr[si]
  35.         sub al, 30h
  36.         mov dl, byte ptr[bx]
  37.         sub dl, 30h
  38.         add al, dl
  39.         add al, 30h
  40.        
  41.         stosb
  42.         dec si
  43.         dec bx
  44.         loop sum
  45.    
  46.     mov ah, 09h
  47.     mov dx, offset msg
  48.     int 21h
  49.     mov ah, 4ch
  50.     int 21h
  51.    
  52. addbig endp
  53.  
  54.  
  55. start:  mov ax, data
  56.         mov ds, ax
  57.         mov es, ax
  58.         mov dx, offset string
  59.         mov bx, offset string1
  60.        
  61.         mov ah, 0Ah
  62.         int 21h
  63.        
  64.         call donewline
  65.         mov dx, bx
  66.         mov ah, 0Ah
  67.         int 21h
  68.         call donewline
  69.        
  70.         mov si, offset string
  71.         mov bx, offset string1
  72.         mov ah, 00h
  73.         mov al, byte ptr[si+1]; сколько элементов в первой строке
  74.         mov cx, ax
  75.         metka:
  76.             inc si
  77.             loop metka
  78.         mov al, byte ptr[bx+1]
  79.         mov cx, ax
  80.         metka1:
  81.             inc bx
  82.             loop metka1
  83.         cmp byte ptr[si+1], al
  84.         jl greater
  85.         jmp L1
  86.        
  87.         greater:
  88.             mov al, byte ptr[si+1]
  89.             jmp L1
  90.        
  91.         L1:
  92.             mov cx, ax
  93.             dec cx
  94.             push si
  95.             push bx
  96.         call addbig
  97.  
  98.         mov ah, 4ch
  99.         int 21h
  100.         code ends
  101.         end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement