Размер файла на диске Assembler. DOS

Узнай цену своей работы

Формулировка задачи:

Не знаю как реализовать данную программу( Прошу помощи экспертов. Нужно что бы программа выводила на экран размер файла на диске. Предполагаю что нужно создать файл с помощью функции 21 прерывания создать файл после реализовать подсчет символов и вывести на экран, но как это реализовать понятия не имею( Сдать необходимо завтра, прошу помощи! Заранее спасибо)

Решение задачи: «Размер файла на диске Assembler. DOS»

textual
Листинг программы
  1. --------D-214E-------------------------------
  2. INT 21 - DOS 2+ - "FINDFIRST" - FIND FIRST MATCHING FILE
  3. AH = 4Eh
  4. AL = special flag for use by APPEND (refer to note below)
  5. CX = file attribute mask (see #01420 at AX=4301h) (bits 0 and 5 ignored)
  6. 0088h (Novell DOS 7) find first deleted file
  7. DS:DX -> ASCIZ file specification (may include path and wildcards)
  8. Return: CF clear if successful
  9. Disk Transfer Area filled with FindFirst data block (see #01626)
  10. CF set on error
  11. AX = error code (02h,03h,12h) (see #01680 at AH=59h/BX=0000h)
  12. Notes: for search attributes other than 08h, all files with at MOST the
  13. specified combination of hidden, system, and directory attributes
  14. will be returned. Under DOS 2.x, searching for attribute 08h
  15. (volume label) will also return normal files, while under DOS 3.0+
  16. only the volume label (if any) will be returned.
  17. this call also returns successfully if given the name of a character
  18. device without wildcards. DOS 2.x returns attribute 00h, size 0,
  19. and the current date and time. DOS 3.0+ returns attribute 40h and
  20. the current date and time.
  21. immediately after an INT 2F/AX=B711h (APPEND return found name), the
  22. name at DS:DX will be overwritten; if AL=00h on entry, the actual
  23. found pathname will be stored, otherwise, the actual found path
  24. will be prepended to the original filespec without a path.
  25. under LANtastic, this call may be used to obtain a list of a server's
  26. shared resources by searching for "\\SERVER\*.*"; a list of printer
  27. resources may be obtained by searching for "\\SERVER\@*.*"
  28. under the FlashTek X-32 DOS extender, the filespec pointer is in DS:EDX
  29. BUGS: under DOS 3.x and 4.x, the second and subsequent calls to this function
  30. with a character device name (no wildcards) and search attributes
  31. which include the volume-label bit (08h) will fail unless there is
  32. an intervening DOS call which implicitly or explicity performs a
  33. directory search without the volume-label bit. Such implicit
  34. searches are performed by CREATE (AH=3Ch), OPEN (AH=3Dh), UNLINK
  35. (AH=41h), and RENAME (AH=56h)
  36. DR DOS 3.41 and 5.0 return the Directory attribute for the volume label
  37. SeeAlso: AH=11h,AH=4Fh,AX=4301h,AX=714Eh,AX=71A1h,AX=F257h/SF=02h
  38. SeeAlso: INT 2F/AX=111Bh,INT 2F/AX=B711h
  39.  
  40. Format of FindFirst data block:
  41. Offset Size Description (Table 01626)
  42. ---PC-DOS 3.10, PC-DOS 4.01, MS-DOS 3.2/3.3/5.0---
  43. 00h BYTE drive letter (bits 0-6), remote if bit 7 set
  44. 01h 11 BYTEs search template
  45. 0Ch BYTE search attributes
  46. ---DOS 2.x (and some DOS 3.x???)---
  47. 00h BYTE search attributes
  48. 01h BYTE drive letter
  49. 02h 11 BYTEs search template
  50. ---WILDUNIX.COM---
  51. 00h 12 BYTEs 15-character wildcard search pattern and drive letter (packed)
  52. 0Ch BYTE search attributes
  53. ---DOS 2.x and most 3.x---
  54. 0Dh WORD entry count within directory
  55. 0Fh DWORD pointer to DTA???
  56. 13h WORD cluster number of start of parent directory
  57. ---PC-DOS 4.01, MS-DOS 3.2/3.3/5.0---
  58. 0Dh WORD entry count within directory
  59. 0Fh WORD cluster number of start of parent directory
  60. 11h 4 BYTEs reserved
  61. ---OS/2 MVDM---
  62. 00h WORD "OS2_BMP_handle"
  63. 02h WORD "OS2_LastEnt"
  64. 04h DWORD "OS2_Checksum"
  65. 08h BYTE "OS2_usi_flag"
  66. 09h DWORD used by DOS emulator for second pass for volume-label searches
  67. 0Dh WORD (ret) "DOS_LastEnt" entry count within directory
  68. 0Fh BYTE OS/2 Processed-FindFirst flag
  69. 00h FindFirst processed by DOS
  70. 42h FindFirst processed by OS/2
  71. 10h 5 BYTEs reserved for future use
  72. ---all versions, documented fields---
  73. 15h BYTE attribute of file found
  74. 16h WORD file time (see #01665 at AX=5700h)
  75. 18h WORD file date (see #01666 at AX=5700h)
  76. 1Ah DWORD file size
  77. 1Eh 13 BYTEs ASCIZ filename+extension

Объяснение кода листинга программы

  1. Вызывается прерывание INT 21h DOS 2+ с функцией FINDFIRST (найти первый соответствующий файл).
  2. В регистре AH передается значение 4Eh.
  3. В регистре AL передается специальный флаг для использования APPEND (примечание относится к этому).
  4. В регистре CX указывается маска атрибутов файла (смотрите #01420 at AX=4301h) (игнорируются биты 0 и 5).
  5. DS:DX указывает на ASCIZ файловой спецификации (может включать путь и маски).
  6. После выполнения данной функции CF (флаг переноса) будет сброшен, если операция была успешной, и заполнен Disk Transfer Area блоками данных поиска (см. #01626).
  7. Если произойдет ошибка, то CF будет установлен, а в регистре AX будет содержаться код ошибки (02h, 03h, 12h) (см. #01680 at AH=59h/BX=0000h).
  8. Также приводятся различные заметки, о том как выполнить успешный поиск с использованием этой функции, например для получения списка ресурсов сервера под управлением LANtastic или FlashTek X-32 DOS extender.
  9. В документации указан формат блока данных поиска, в зависимости от версии DOS и других факторов, осуществляющих поиск.

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

11   голосов , оценка 3.545 из 5

Нужна аналогичная работа?

Оформи быстрый заказ и узнай стоимость

Бесплатно
Оформите заказ и авторы начнут откликаться уже через 10 минут