2022-08-07 20:10:08 +00:00
|
|
|
#
|
|
|
|
! $Source$
|
|
|
|
! $State$
|
|
|
|
! $Revision$
|
|
|
|
|
2022-08-26 17:20:56 +00:00
|
|
|
#include "libsysasm.h"
|
2022-08-07 20:10:08 +00:00
|
|
|
|
2022-08-17 20:34:06 +00:00
|
|
|
! Read bytes from a file descriptor. These routines do not do any
|
2022-08-07 20:10:08 +00:00
|
|
|
! 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_rawread
|
|
|
|
__sys_rawread:
|
2022-08-26 17:20:56 +00:00
|
|
|
file_handle = 1*4
|
|
|
|
write_buffer = 2*4
|
|
|
|
amount_to_read = 3*4
|
2022-08-17 22:24:08 +00:00
|
|
|
|
2022-08-26 17:20:56 +00:00
|
|
|
mov eax, amount_to_read(esp)
|
|
|
|
mov ecx, TRANSFER_BUFFER_SIZE
|
2022-08-17 22:24:08 +00:00
|
|
|
cmp eax, ecx
|
|
|
|
jge 2f
|
|
|
|
mov ecx, eax
|
|
|
|
2:
|
|
|
|
|
|
|
|
! Read from DOS into the transfer buffer.
|
|
|
|
|
|
|
|
movb ah, 0x3f
|
|
|
|
o16 mov dx, (transfer_buffer_ptr)
|
2022-08-26 17:20:56 +00:00
|
|
|
o16 mov bx, file_handle(esp)
|
|
|
|
call .sys_dpmidos
|
|
|
|
jc 3f
|
|
|
|
|
|
|
|
! Copy eax bytes out of the transfer buffer.
|
|
|
|
|
|
|
|
movzx ecx, ax
|
|
|
|
mov eax, write_buffer(esp)
|
|
|
|
call .sys_cpyin
|
|
|
|
|
|
|
|
xchg eax, ecx
|
|
|
|
ret
|
2022-08-18 19:21:33 +00:00
|
|
|
|
2022-08-26 17:20:56 +00:00
|
|
|
3:
|
2022-08-18 19:21:33 +00:00
|
|
|
! Process errors.
|
|
|
|
|
|
|
|
push eax
|
|
|
|
call __sys_seterrno
|
2022-08-18 22:08:57 +00:00
|
|
|
pop ecx
|
2022-08-17 22:24:08 +00:00
|
|
|
ret
|