home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hall of Fame
/
HallofFameCDROM.cdr
/
dos
/
envfree.lzh
/
ENVFREE.ASM
next >
Wrap
Assembly Source File
|
1986-08-10
|
1KB
|
68 lines
;History:17
include /include/macros.inc
include /include/printf.inc
mcb segment at 0h
mcb_flag db ? ;'M' for normal, 'Z' for final block
mcb_owner dw ? ;segment of owner's psp
mcb_size dw ? ;block size in paragraphs
mcb ends
code segment public
assume cs:code, ds:code
include /include/phd.inc
start:
jmp start_1
start_1:
mov ah,52h ;get in vars (whatever that means)
int 21h
assume es:nothing
mov es,es:[bx - 2] ;load segment of first memory block
assume es:mcb
push ds ;interrupt 2eh belongs to command.com
xor dx,dx
mov ds,dx
mov dx,ds:[2eh*4+2]
pop ds
.dowhl dx ne mcb_owner
mov ax,es ;get segment of current block
inc ax ;advance to contents of block
add ax,mcb_size ;add length of current block
mov es,ax ;segment number of next block
.enddo
mov ax,es ;get segment of current block
inc ax ;advance to contents of block
add ax,mcb_size ;add length of current block
mov es,ax ;segment number of next block
mov di,16 ;make di->memory block contents.
mov cx,mcb_size ;make cx=size of enviornment block.
shl cx,1 ;convert from paragraphs to bytes.
shl cx,1
shl cx,1
shl cx,1
push cx
.dowhl <byte ptr es:[di]> ne 0
xor al,al ;search for a null.
repne scasb
.enddo
pop bx
mov ax,bx
sub ax,cx
printf "Enviornment space: %d free, %d used, %d max",cx,ax,bx
mov ax,4c00h
int 21h
code ends
end start