2022-08-17 20:34:06 +00:00
|
|
|
#
|
|
|
|
! $Source$
|
|
|
|
! $State$
|
|
|
|
! $Revision$
|
|
|
|
|
2022-08-26 17:20:56 +00:00
|
|
|
#include "libsysasm.h"
|
2022-08-17 20:34:06 +00:00
|
|
|
|
|
|
|
! Write bytes to/to a file descriptor. These routines do not do any
|
|
|
|
! translation between CRLF and LF line endings.
|
|
|
|
!
|
|
|
|
! Note that, for MS-DOS, a raw "write" request of zero bytes will truncate
|
|
|
|
! (or extend) the file to the current file position.
|
|
|
|
|
|
|
|
.define __sys_rawwrite
|
|
|
|
__sys_rawwrite:
|
2022-08-26 17:20:56 +00:00
|
|
|
file_handle = 1*4
|
|
|
|
read_buffer = 2*4
|
|
|
|
amount_to_write = 3*4
|
2022-08-17 20:34:06 +00:00
|
|
|
|
2022-08-26 17:20:56 +00:00
|
|
|
mov eax, amount_to_write(esp)
|
|
|
|
mov ecx, TRANSFER_BUFFER_SIZE
|
2022-08-18 19:21:33 +00:00
|
|
|
cmp eax, ecx
|
|
|
|
jge 2f
|
|
|
|
mov ecx, eax
|
2022-08-17 20:34:06 +00:00
|
|
|
2:
|
2022-08-17 22:24:08 +00:00
|
|
|
|
2022-08-18 19:21:33 +00:00
|
|
|
! Copy ecx bytes into the transfer buffer.
|
2022-08-17 20:34:06 +00:00
|
|
|
|
2022-08-26 17:20:56 +00:00
|
|
|
mov eax, read_buffer(esp)
|
|
|
|
call .sys_cpyout
|
2022-08-17 22:24:08 +00:00
|
|
|
|
2022-08-18 19:21:33 +00:00
|
|
|
! Write from the transfer buffer to DOS.
|
2022-08-17 22:24:08 +00:00
|
|
|
|
2022-08-26 17:20:56 +00:00
|
|
|
xchg edx, eax
|
2022-08-18 19:21:33 +00:00
|
|
|
movb ah, 0x40
|
2022-08-26 17:20:56 +00:00
|
|
|
o16 mov bx, file_handle(esp)
|
|
|
|
call .sys_dpmidos
|
|
|
|
movzx eax, ax
|
2022-08-18 19:21:33 +00:00
|
|
|
jnc exit
|
2022-08-17 20:34:06 +00:00
|
|
|
|
2022-08-18 19:21:33 +00:00
|
|
|
push eax
|
|
|
|
call __sys_seterrno
|
2022-08-18 22:08:57 +00:00
|
|
|
pop ecx
|
2022-08-17 20:34:06 +00:00
|
|
|
exit:
|
2022-08-18 19:21:33 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
! vim: sw=4 ts=4 et
|
2022-08-17 20:34:06 +00:00
|
|
|
|