Размер файла на диске Assembler. DOS
Формулировка задачи:
Не знаю как реализовать данную программу( Прошу помощи экспертов. Нужно что бы программа выводила на экран размер файла на диске. Предполагаю что нужно создать файл с помощью функции 21 прерывания создать файл после реализовать подсчет символов и вывести на экран, но как это реализовать понятия не имею( Сдать необходимо завтра, прошу помощи! Заранее спасибо)
Решение задачи: «Размер файла на диске Assembler. DOS»
textual
Листинг программы
- --------D-214E-------------------------------
- INT 21 - DOS 2+ - "FINDFIRST" - FIND FIRST MATCHING FILE
- AH = 4Eh
- AL = special flag for use by APPEND (refer to note below)
- CX = file attribute mask (see #01420 at AX=4301h) (bits 0 and 5 ignored)
- 0088h (Novell DOS 7) find first deleted file
- DS:DX -> ASCIZ file specification (may include path and wildcards)
- Return: CF clear if successful
- Disk Transfer Area filled with FindFirst data block (see #01626)
- CF set on error
- AX = error code (02h,03h,12h) (see #01680 at AH=59h/BX=0000h)
- Notes: for search attributes other than 08h, all files with at MOST the
- specified combination of hidden, system, and directory attributes
- will be returned. Under DOS 2.x, searching for attribute 08h
- (volume label) will also return normal files, while under DOS 3.0+
- only the volume label (if any) will be returned.
- this call also returns successfully if given the name of a character
- device without wildcards. DOS 2.x returns attribute 00h, size 0,
- and the current date and time. DOS 3.0+ returns attribute 40h and
- the current date and time.
- immediately after an INT 2F/AX=B711h (APPEND return found name), the
- name at DS:DX will be overwritten; if AL=00h on entry, the actual
- found pathname will be stored, otherwise, the actual found path
- will be prepended to the original filespec without a path.
- under LANtastic, this call may be used to obtain a list of a server's
- shared resources by searching for "\\SERVER\*.*"; a list of printer
- resources may be obtained by searching for "\\SERVER\@*.*"
- under the FlashTek X-32 DOS extender, the filespec pointer is in DS:EDX
- BUGS: under DOS 3.x and 4.x, the second and subsequent calls to this function
- with a character device name (no wildcards) and search attributes
- which include the volume-label bit (08h) will fail unless there is
- an intervening DOS call which implicitly or explicity performs a
- directory search without the volume-label bit. Such implicit
- searches are performed by CREATE (AH=3Ch), OPEN (AH=3Dh), UNLINK
- (AH=41h), and RENAME (AH=56h)
- DR DOS 3.41 and 5.0 return the Directory attribute for the volume label
- SeeAlso: AH=11h,AH=4Fh,AX=4301h,AX=714Eh,AX=71A1h,AX=F257h/SF=02h
- SeeAlso: INT 2F/AX=111Bh,INT 2F/AX=B711h
- Format of FindFirst data block:
- Offset Size Description (Table 01626)
- ---PC-DOS 3.10, PC-DOS 4.01, MS-DOS 3.2/3.3/5.0---
- 00h BYTE drive letter (bits 0-6), remote if bit 7 set
- 01h 11 BYTEs search template
- 0Ch BYTE search attributes
- ---DOS 2.x (and some DOS 3.x???)---
- 00h BYTE search attributes
- 01h BYTE drive letter
- 02h 11 BYTEs search template
- ---WILDUNIX.COM---
- 00h 12 BYTEs 15-character wildcard search pattern and drive letter (packed)
- 0Ch BYTE search attributes
- ---DOS 2.x and most 3.x---
- 0Dh WORD entry count within directory
- 0Fh DWORD pointer to DTA???
- 13h WORD cluster number of start of parent directory
- ---PC-DOS 4.01, MS-DOS 3.2/3.3/5.0---
- 0Dh WORD entry count within directory
- 0Fh WORD cluster number of start of parent directory
- 11h 4 BYTEs reserved
- ---OS/2 MVDM---
- 00h WORD "OS2_BMP_handle"
- 02h WORD "OS2_LastEnt"
- 04h DWORD "OS2_Checksum"
- 08h BYTE "OS2_usi_flag"
- 09h DWORD used by DOS emulator for second pass for volume-label searches
- 0Dh WORD (ret) "DOS_LastEnt" entry count within directory
- 0Fh BYTE OS/2 Processed-FindFirst flag
- 00h FindFirst processed by DOS
- 42h FindFirst processed by OS/2
- 10h 5 BYTEs reserved for future use
- ---all versions, documented fields---
- 15h BYTE attribute of file found
- 16h WORD file time (see #01665 at AX=5700h)
- 18h WORD file date (see #01666 at AX=5700h)
- 1Ah DWORD file size
- 1Eh 13 BYTEs ASCIZ filename+extension
Объяснение кода листинга программы
- Вызывается прерывание INT 21h DOS 2+ с функцией
FINDFIRST
(найти первый соответствующий файл). - В регистре AH передается значение 4Eh.
- В регистре AL передается специальный флаг для использования APPEND (примечание относится к этому).
- В регистре CX указывается маска атрибутов файла (смотрите #01420 at AX=4301h) (игнорируются биты 0 и 5).
- DS:DX указывает на ASCIZ файловой спецификации (может включать путь и маски).
- После выполнения данной функции CF (флаг переноса) будет сброшен, если операция была успешной, и заполнен Disk Transfer Area блоками данных поиска (см. #01626).
- Если произойдет ошибка, то CF будет установлен, а в регистре AX будет содержаться код ошибки (02h, 03h, 12h) (см. #01680 at AH=59h/BX=0000h).
- Также приводятся различные заметки, о том как выполнить успешный поиск с использованием этой функции, например для получения списка ресурсов сервера под управлением LANtastic или FlashTek X-32 DOS extender.
- В документации указан формат блока данных поиска, в зависимости от версии DOS и других факторов, осуществляющих поиск.
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д