Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;lab3.asm
  2. ;demonstration for lab 3 - copying a chunk of memory
  3. .MODEL SMALL
  4. .STACK  64
  5. .DATA
  6. string db "Hello from procedure","$"
  7. .CODE
  8. start:
  9.     mov ax, @data
  10.     mov ds, ax
  11.     ;start
  12.    
  13.     push offset string
  14.     call puts
  15.    
  16.     call print_new_line
  17.        
  18.     ;end the program
  19.     mov ah, 4ch
  20.     mov al, 0
  21.     int 21h
  22.    
  23.     ;procedure with params
  24.     puts proc
  25.         push bp ; must have
  26.         mov bp,sp ; must have
  27.         add bp,2 ;must have
  28.         push dx
  29.         push ax
  30.        
  31.         mov dx,[bp+2]
  32.         mov ah,09
  33.         int 21h
  34.        
  35.         pop ax
  36.         pop dx
  37.         pop bp
  38.         ret 2 ; 2 because 1 param
  39.     endp
  40.     ;procedure without params
  41.     print_new_line proc
  42.         push ax
  43.         push dx
  44.    
  45.         mov dl, 0ah
  46.         mov ah,02
  47.         int 21h
  48.         mov dl, 0dh
  49.         mov ah, 02
  50.         int 21h
  51.         pop dx
  52.         pop ax
  53.         ret
  54.     endp
  55. END start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement