home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Equalizer BBS
/
equalizer-bbs-collection_2004.zip
/
equalizer-bbs-collection
/
DEMOSCENE-STUFF
/
IMPHOB10.ZIP
/
IMP10_EX.ZIP
/
W_GEMMIS.ZIP
/
EXAMPLE.ASM
next >
Wrap
Assembly Source File
|
1995-05-15
|
4KB
|
159 lines
;║ A FLAT REAL MODE INITIALIZER EXAMPLE
;║ ────────────────────────────────────
;║
;║ Compliant with RAW, XMS or EMS environments
;║
;║ Documentation used :
;║ microsoft eXtended Memory Specification (XMS) ver 3.0
;║ lotus/intel/microsoft Expanded Memory Specification (EMS) ver 4.0
;║ microsoft undocumented Global EMM Import Specification (GEMMIS) ver 1.11
;║
;║ Documentation needed :
;║ standard method for detecting drivers which use the VDISK allocation scheme
;║ (this is an official publication by microsoft but I don't have it)
;║
;║ (c) Walken / IMPACT Studios in 1995 - for publication in Imphobia #10
;╚════════════════════════════════════════════════════════════════════════════
;│ Legal stuff :
;│ This document can be copyed only when unmodified and in its entirety.
;│ Commercial use - including commercial distribution or use in commercial
;│ software - is strictly prohibited without the written permission
;│ of the author.
;│ The author excludes any and all implied warranties, including warranties
;│ of merchantability and fitness for a particular purpose. The author
;│ should have no liability for special, incidental, or consequential
;│ damages arising out or resulting from the use or modification of this
;│ source code.
;└────────────────────────────────────────────────────────────────────────────
;║ You can contact the author at the following address :
;║ Walken / IMPACT Studios
;║ Michel LESPINASSE - 18 rue Jean Giono - 80090 Amiens - FRANCE
;╚════════════════════════════════════════════════════════════════════════════
.model tiny
.stack 200h
locals
o equ offset ;hello ervin ! greetings....
b equ byte ptr
w equ word ptr
d equ dword ptr
f equ fword ptr
include load_m32.inc
include mem32imp.inc
.data
okay db "all right$"
show_nb_mem db "number of allocated blocks : $"
show_total_mem db " total allocated bytes : $"
.code
.486p
debut:
;*********************;
;* main example code *;
;*********************;
call mem32_init ;INIT MEM32 MANAGER
cmp native_V86,0
jz no_gemmis
include gemmis.inc ;dump GEMMIS information (just for the example)
no_gemmis:
call mem32_native ;SWITCH TO NATIVE MODE (faster interrupts)
;DISPLAY MEMORY ALLOCATION INFORMATION
mov dx,o show_nb_mem
call dump_msg
mov ax,nb_available_memory
xor ecx,ecx
mov cx,ax
call dump_word ;display number of separate allocated memory blocks
mov dx,o show_total_mem
call dump_msg
xor eax,eax
jcxz total_free_memory_done
total_free_memory:
add eax,available_memory_table[ecx*8-4]
sub eax,available_memory_table[ecx*8-8]
loop total_free_memory
total_free_memory_done:
call dump_dword ;display total amount of allocated memory
call dump_line
;DISPLAY MEMORY MANAGER NAME
mov dx,o memory_manager_name
mov ah,9
int 21h ;display memory manager name
call dump_line
call mem32_flatreal ;SWITCH BACK TO FLAT REAL MODE (but slow interrupts)
mov dx,o okay
jmp exit ;EXIT WITH MESSAGE
;*****************************;
;* example display functions *;
;*****************************;
hexa db '0123456789ABCDEF'
dump_dword:
ror eax,16
call dump_word
rol eax,16
dump_word:
ror ax,8
call dump_byte
rol ax,8
dump_byte:
ror al,4
call dump_digit
rol al,4
dump_digit:
push eax
push dx
movzx eax,al
and al,0fh
mov dl,hexa[eax]
mov ah,2
int 21h
pop dx
pop eax
ret
dump_space:
push ax
push dx
mov ah,2
mov dl,32
int 21h
pop dx
pop ax
ret
dump_msg:
push ax
mov ah,9
int 21h
pop ax
ret
dump_line:
push ax
push dx
mov ah,2
mov dl,13
int 21h
mov dl,10
int 21h
pop dx
pop ax
ret
dump_msg_line:
call dump_msg
call dump_line
ret
end debut