]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/MAPPER/WRITE.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / MAPPER / WRITE.ASM
1 page 80,132
2
3 title CP/DOS DosWrite mapper
4
5 dosxxx segment byte public 'dos'
6 assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing
7
8 ;**********************************************************************
9 ;*
10 ;* MODULE: doswrite
11 ;*
12 ;* FUNCTION: Write a specified number of bytes to a 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 written
20 ;* call doswrite
21 ;*
22 ;* MODULES CALLED: PC-DOS Int 21h, ah=40h, write
23 ;*
24 ;*********************************************************************
25
26 public doswrite
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 written
36 Bufflng dw ? ; number of bytes to be written
37 Buffer dd ? ; write buffer address
38 Handle dw ? ; file handle
39 str ends
40
41 doswrite proc far
42
43 Enter doswrite ; push registers
44
45 mov bx,[bp].handle ; get handle
46 lds dx,[bp].buffer ; set write buffer
47 mov cx,[bp].bufflng ; number of bytes to be written
48
49 mov ah,40h ; load opcode
50 int 21h ; write bytes to the file
51 jc exit ; jump if error
52
53 lds si,[bp].written ; pointer to return data
54 mov word ptr [si],ax ; save actual number of bytes written
55 sub ax,ax ; set good return code
56
57 exit: mexit ; pop registers
58 ret size str - 6 ; return
59
60 doswrite endp
61
62 dosxxx ends
63
64 end