summaryrefslogtreecommitdiff
path: root/v4.0/src/MAPPER/REALLSEG.ASM
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/MAPPER/REALLSEG.ASM')
-rw-r--r--v4.0/src/MAPPER/REALLSEG.ASM81
1 files changed, 81 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/REALLSEG.ASM b/v4.0/src/MAPPER/REALLSEG.ASM
new file mode 100644
index 0000000..352a091
--- /dev/null
+++ b/v4.0/src/MAPPER/REALLSEG.ASM
@@ -0,0 +1,81 @@
1;
2page 60,132
3;
4title CP/DOS DosReallocSeg mapper
5;
6dosxxx segment byte public 'dos'
7 assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing
8;
9; ************************************************************************* *
10; *
11; * MODULE: DosReallocSeg
12; *
13; * FILE NAME: dos043.asm
14; *
15; * FUNCTION: This module changes the size of a segment already
16; * allocated
17; *
18; * CALLING SEQUENCE:
19; *
20; * push size ; new segment size requested in bytes
21; * push selector ; selector
22; * call dosreallocseg
23; *
24; * RETURN SEQUENCE:
25; *
26; *
27; *
28; * MODULES CALLED: DOS Int 21, AH=4A
29; *
30; *
31; *
32; *************************************************************************
33;
34 public dosreallocseg
35 .sall
36 .xlist
37 include macros.inc
38 .list
39
40str struc
41old_bp dw ?
42return dd ?
43Selector dw ? ; segment selector
44SegmentSize dw ? ; new segment size in bytes
45str ends
46
47dosreallocseg proc far
48 Enter dosreallocseg ; save registers
49
50 mov bx,[bp].SegmentSize ; Get new segment size
51 cmp bx,0 ; check for 0
52 je AllocateMax ; jmp to full seg
53
54 shr bx,1 ; else convert segment in bytes
55 shr bx,1 ; paragraph
56 shr bx,1
57 shr bx,1
58 jmp HaveSize
59
60AllocateMax:
61 mov bx,4096 ; default segment size in paragraph
62
63HaveSize:
64 mov es,[bp].Selector ; set up segment for new size
65
66 mov ah,4ah ; set up for DOS realloc call
67 int 21h ; realloc segment
68 jc ErrorExit ; jump if error
69
70 sub ax,ax ; else set good return code
71
72ErrorExit:
73 Mexit ; restore registers
74
75 ret size str - 6 ; return
76
77dosreallocseg endp
78
79dosxxx ends
80
81 end