 |
��������� � �������� - ����� ����������� ��������� ������ � ����
- ������:
- �������� ����������� ��������� ��������� ��������� � ���� ���������� ��������� ������ MS DOS ��� ������� ���������.
����� ����������- ��� ��� ������� ��������� ��������� ������.
- �����:
-
.model small ; ���-����
.stack 100h
.data
f_handle dw 1
fileName db '169029.txt',0
buf db ?
count dw 0
Press_key db 13,10,'Press any key ...$'
msg_no_args db 13,10,'� ��������� ������ ��� ����������$'
msg_success db 13,10,'����� � ���� ��������$'
msg_no_file db 13,10,'�� ���� ������� ���� ��� ������ ����������$'
.code
start:
mov ax, @data
mov ds, ax
mov ax,3
int 10h
mov cl, es:80h
or cl, cl
jnz @@_get
jmp @@_no_args
@@_get:
xor ch, ch
mov count, cx
mov ah, 3Ch
lea dx, fileName
mov cx, 20h
int 21h
jnc @@_get_params
jmp @@_no_file
@@_get_params:
mov f_handle, ax
mov cx, count
dec cx
mov bx, 80h
cld
@@_next:
inc bx
mov al, es:[bx]
CALL WriteChar_to_file
LOOP @@_next
lea dx, msg_success
mov ah, 9
int 21h
mov ah, 3Eh ; ������� ����
mov bx, f_handle
int 21h
jmp @@_exit
@@_no_file:
lea dx, msg_no_file
mov ah, 9
int 21h
jmp @@_exit
@@_no_args:
lea dx, msg_no_args
mov ah, 9
int 21h
@@_exit:
lea dx, Press_key
mov ah, 9
int 21h
xor ax, ax
int 16h
mov ax, 4C00h
int 21h
; ��������� ��� ������ ������� � ���� ��� �� �����, � ����������� �� ����������� f_handle
; ��������� ������ ������ ���� � AL
; f_handle ������ ���� ���������� �������
WriteChar_to_file proc
push ax
push bx
push cx
push dx
mov buf, al
mov ah, 40h
mov bx, f_handle
lea dx, buf
mov cx, 1
int 21h
pop dx
pop cx
pop bx
pop ax
ret
WriteChar_to_file endp
end start
|  |