title: Produce a .com instead of a .exe
body: <p>It was required to change the program from ".exe" in".com". </p>
  
  <ul>
  <li>I removed the stack and data segments because i received errors about their existence. </li>
  <li>I renamed the file in ".com". </li>
  </ul>
  
  <p>But the program doesn't work now (it is displaying nothing). I think it may be due to <code>movsw</code>, but I do not understand how it works.</p>
  
  <pre><code>.MODEL small
  .code
  .386
  
  org 100h
  
  Start:
  
  dta         db 128 DUP(?)
  dta_hold    db 128 DUP(?)
  path        db "*.*",0
  LF          db 13,10,'$'
  root        db "/",0
  line        db "The file with the oldest date of creation: ",'$'
  
  mov es, ax                  ; for movsw
  mov ah,3bh
  mov dx,offset root          ; Change directory to the root
  int 21h
  
  lea dx, dta                 ; dta: disk transfer area
  mov ah, 1AH                 ; SET DISK TRANSFER AREA ADDRESS
  int 21h                     ; DOS INTERRUPT
  
  mov ah, 4EH                 ; FIND FIRST MATCHING FILE
  lea dx, path                ; DS:DX -&gt; ASCIZ file specification (may include path and wildcards)
  mov cx, 0                   ; file attribute mask
  int 21h                     ; DOS INTERRUPT
  
  call store_dta
  
  FindNext:
  
  mov ah, 4FH                 ; FIND NEXT MATCHING FILE
  int 21h                     ; DOS INTERRUPT
  jc Finish
  
  ; compare filedates &amp; filetimes
  lea si, dta_hold            ; DTA of the oldest file
  lea di, dta                 ; DTA of the just found file
  mov ax, [si+18h]            ; filedate
  mov bx, [di+18h]            ; filedate
  cmp ax, bx
  jc FindNext                 ; just found file is newer
  jne Older
  ; filedates are identical
  mov ax, [si+16h]            ; filetime
  mov bx, [di+16h]            ; filetime
  cmp ax, bx
  jc FindNext
  
  Older:                      ; just found file is older
  call store_dta              ; copy dta to dta_hold
  jmp FindNext
  
  Finish:
  call print_filename         ; print the last filename
  mov ax,4c00h
  int 21h
  
  main ENDP
  
  store_dta PROC
  mov cx, (128/2)             ; size of DTA in WORDs (half of BYTEs)
  lea si, dta
  lea di, dta_hold
  rep movsw                   ; copy CX times DS:SI =&gt; ES:DI
  ret
  store_dta ENDP
  
  print_filename PROC
  
  lea dx, line                ; new line
  mov ah, 09h                 ; WRITE STRING TO STANDARD OUTPUT
  int 21h                     ; DOS INTERRUPT
  
  lea di, dta_hold + 1Eh
  mov dx, di                  ; start of filename
  _B:                         ; look for NULL (ASCIZ-termination)
  cmp BYTE PTR [di], 0
  je _F
  inc di
  jmp _B
  _F:                         ; replace NULL by '$'
  mov [di], BYTE PTR '$'      ; end-of-string delimiter for INT 21h/09h
  mov ah, 09h                 ; WRITE STRING TO STANDARD OUTPUT
  int 21h                     ; DOS INTERRUPT
  
  lea dx, LF                  ; new line
  mov ah, 09h                 ; WRITE STRING TO STANDARD OUTPUT
  int 21h                     ; DOS INTERRUPT
  
  ret
  print_filename ENDP
  
  END Start
  </code></pre>