]>
wirehaze git hosting - MS-DOS.git/blob - v4.0/src/MAPPER/ALLOCSEG.ASM
4 title CP
/DOS DosAllocSeg mapper
6 dosxxx
segment byte public 'dos'
7 assume
cs:dosxxx
,ds:nothing
,es:nothing
,ss:nothing
9 ; ************************************************************************* *
11 ; * MODULE: DosAllocSeg
13 ; * FUNCTION: This module allocates a segment of memory to the
14 ; * requesting process
18 ; * push size ; number of bytes requested
19 ; * push@ selector ; selector allocated (returned)
20 ; * push shareind ; whether segment will be shared
25 ; * AX = error , 0 = no error
27 ; * MODULES CALLED: DOS int 21h
29 ; *************************************************************************
40 ShareIndicator dw ?
; whether segment will be shared
41 SelectorPtr dd ?
; selector allocated
42 SegmentSize dw ?
; number of bytes requested
46 Enter dosallocseg
; push registers
48 mov bx,[bp].SegmentSize
; Get segment size
50 test bx,0000fh ; check segment size
57 cmp bx,0 ; check for 0 (full seg)
58 je AllocateMax
; jmp to full seg
60 shr bx,1 ; convert segment in bytes to
67 mov bx,4096 ; setup default paragraph size
70 mov ah,48h
; set up for dos allocate call
71 int 21h
; allocate segment
72 jc ErrorExit
; jump if error
74 lds si,[bp].SelectorPtr
; get selector address
75 mov ds:[si],ax ; save allocated memory block
78 sub ax,ax ; set good return code
81 ret size
str - 6 ; return