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