diff options
Diffstat (limited to 'v4.0/src/MAPPER/FREESEG.ASM')
| -rw-r--r-- | v4.0/src/MAPPER/FREESEG.ASM | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/FREESEG.ASM b/v4.0/src/MAPPER/FREESEG.ASM new file mode 100644 index 0000000..b3f2c1c --- /dev/null +++ b/v4.0/src/MAPPER/FREESEG.ASM | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosFreeSeg mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: DosFreeSeg | ||
| 12 | ; * | ||
| 13 | ; * FILE NAME: dos023.asm | ||
| 14 | ; * | ||
| 15 | ; * FUNCTION: This module deallocates a segment | ||
| 16 | ; * | ||
| 17 | ; * | ||
| 18 | ; * CALLING SEQUENCE: | ||
| 19 | ; * | ||
| 20 | ; * push selector ; selector of the segment | ||
| 21 | ; * call dosfreeseg | ||
| 22 | ; * | ||
| 23 | ; * RETURN SEQUENCE: | ||
| 24 | ; * | ||
| 25 | ; * MODULES CALLED: DOS int 21h, ah=49h | ||
| 26 | ; * | ||
| 27 | ; ************************************************************************* | ||
| 28 | |||
| 29 | public dosfreeseg | ||
| 30 | .sall | ||
| 31 | .xlist | ||
| 32 | include macros.inc | ||
| 33 | .list | ||
| 34 | |||
| 35 | invalid_selector equ 0006h | ||
| 36 | |||
| 37 | |||
| 38 | str struc | ||
| 39 | Old_bp dw ? | ||
| 40 | Return dd ? | ||
| 41 | Selector dw ? ; selector of the segment to be freed | ||
| 42 | str ends | ||
| 43 | |||
| 44 | dosfreeseg proc far | ||
| 45 | Enter dosfreeseg ; push registers | ||
| 46 | |||
| 47 | mov es,[bp].selector ; get selector in es | ||
| 48 | |||
| 49 | mov ah,49h | ||
| 50 | int 21h ; free memory segment | ||
| 51 | jc error ; jump if error | ||
| 52 | |||
| 53 | sub ax,ax ; zero return code | ||
| 54 | jmp exit ; go to exit | ||
| 55 | |||
| 56 | error: mov ax,invalid_selector ; put in error code | ||
| 57 | |||
| 58 | exit: Mexit ; pop registers | ||
| 59 | ret size str - 6 ; return | ||
| 60 | |||
| 61 | dosfreeseg endp | ||
| 62 | |||
| 63 | dosxxx ends | ||
| 64 | |||
| 65 | end | ||