Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. model small
  2. .386
  3. .stack 100h
  4. .data
  5.    
  6.  
  7.     descr dw 0
  8.     temp db 18 dup(0)
  9.     elems dw 18
  10.     color db 04Eh
  11.     fname db 't.txt'
  12.     workErrMsg db 'Error while reading file$'
  13.     string db 'Test'
  14. .code
  15.  
  16. work proc
  17.     mov ah, 3dh
  18.     mov al, 0
  19.     mov dx, offset fname
  20.     int 21h
  21.     jc errwork
  22.  
  23.     mov descr, ax
  24.     mov ah, 3Fh
  25.     mov bx, descr
  26.     mov cx, elems
  27.     lea dx, temp
  28.     int 21h
  29.    
  30.     jc errwork
  31.    
  32.     mov ah, 3eh
  33.     mov bx, descr
  34.     int 21h
  35.     jnc endRd
  36.  
  37.     errwork:
  38.         mov ah, 09h
  39.         mov dx, offset workErrMsg
  40.         int 21h
  41.     endRd:
  42.         ret
  43. work endp
  44.  
  45. start:
  46.     mov ax,@data
  47.     mov ds, ax
  48.     call work
  49.     mov ax, 3h
  50.     int 10h
  51.  
  52.     mov cx, elems
  53.     mov si, 0
  54.     mov di, 0
  55.     mov ax, 0B800h
  56.     mov es, ax
  57.     cycle:
  58.         mov al, temp[si]
  59.         mov es:[di], al
  60.         add di, 1
  61.         mov al, color
  62.         mov es:[di], al
  63.         add di, 1
  64.         add si, 1
  65.         loop cycle
  66.  
  67.     mov ax, 4C00h
  68.     int 21h
  69. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement