برنامه نویسی
DSEG    SEGMENT 'DATA'
      ; add your data here!
      filename   db  'mha.txt',00h
      ohandle    dw  ?
       e_creat  db  "error1","$"
       mesg1    db  "enter number","$"
      
       str  label   byte
       max  db  255
       len  db  ?
       st_name   db  35dup(20h),"$";,0dh,0ah
      
      
      
      
      
      
     
      
DSEG    ENDS

SSEG    SEGMENT STACK   'STACK'
      db   256  DUP(0)
SSEG    ENDS

CSEG    SEGMENT 'CODE'
   START   PROC    FAR
      ; set segment registers:
      MOV AX, DSEG
      MOV DS, AX
      MOV ES, AX
     
     call   create_file                     ;1
     mov    ohandle,ax 
     call   close_file                    ;2
     LEA  DX,mesg1;address massage    ;3   
  MOV  AH,9H;number function
  INT  21H;number interrupt       
  call   get_name                        ;4
  cmp    len,00
  jz fin
 

  mov    bx,ohandle
  call   w_file 
                          ;5
  call   get_name
 
     
 
    
    
fin:
end1:
      MOV AX, 4C00h ; exit to operating system.
      INT 21h   
   START   ENDP
;*********************************************************
;*********************************************************
create_file     proc
        lea dx,filename
        mov ah,3ch
        mov cx,00;file mamoli
        int 21h
        jc  error1
        ret
        error1:
       
         LEA  DX,e_creat;address massage
      MOV  AH,9H;number function
      INT  21H;number interrupt

 

create_file endp
;*********************************************************
;*********************************************************
get_name    proc
        mov ah,0ah
        lea dx,str
        int 21h

ret
get_name    endp
;*********************************************************
;*********************************************************
w_file  proc
        mov ah,40h
        lea dx,st_name
        mov cx,37
        int 21h
       
ret
w_file  endp
;*********************************************************
;*********************************************************
;*******************************************************
;*******************************************************
close_file  proc
    mov ah,3eh
    int 21h
ret
close_file   endp 


CSEG    ENDS
END    START    ; set entry point.

+ نوشته شده در  شنبه بیست و سوم آذر ۱۳۸۷ساعت 22:22  توسط ابراری |