1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
page 80,132
title CP/DOS DosRead mapper * * *
dosxxx segment byte public 'dos'
assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing
;**********************************************************************
;*
;* MODULE: dosreade
;*
;* FUNCTION: Read a specified number of bytes from the file
;*
;* CALLING SEQUENCE:
;*
;* push word file handle
;* push@ other buffer area
;* push word buffer length
;* push@ word bytes read
;* call dosread
;*
;* MODULES CALLED: PC-DOS Int 21h, ah=3fh,
;*
;*********************************************************************
public dosread
.sall
.xlist
include macros.inc
.list
str struc
old_bp dw ?
return dd ?
Written dd ? ; number of bytes actually read
Bufflng dw ? ; number of bytes to be read
Buffer dd ? ; read buffer
Handle dw ? ; handle
str ends
dosread proc far
Enter Dosread ; save registers
mov bx,[bp].handle ; fill registers for
lds dx,[bp].buffer ; function call
mov cx,[bp].bufflng ; number of bytes to read
mov ah,3fh ; load opcode
int 21h ; read from file
jc exit ; jump if error
lds si,[bp].written ; else, set return data area
mov word ptr [si],ax ; save number of bytes read
sub ax,ax ; set good return code
exit: mexit ; pop registers
ret size str - 6 ; rturn
dosread endp
dosxxx ends
end
|