Category : Miscellaneous Language Source Code
Archive   : MTD.ZIP
Filename : ZEROMEM.ASM

 
Output of file : ZEROMEM.ASM contained in archive : MTD.ZIP
%TITLE "Zero available memory. TASM 2.0 Ideal mode."

;** File: zeromem.asm (WITH BUGS!)
;** Author: (c) 1990 by Tom Swan.

IDEAL
MODEL small

STKSIZE EQU 256 ; Stack size in bytes

STACK STKSIZE

DATASEG

lowAddr dd far ptr 0 ; First address filled
highAddr dd far ptr 0 ; Last address filled

UDATASEG

msgHello db 'ZEROMEM: Filling memory...', '$'

CODESEG

; ---- From FILLMEM.OBJ:

EXTRN FillMemory:proc

Start:
mov ax, @data ; Initialize DS to
mov ds, ax ; address of data seg
mov dx, offset msgHello ; Display welcome message
mov ah, 9 ; DOS function: print
int 21h ; Call DOS
call GetAddresses ; Find fill begin, end
les di, [lowAddr] ; Initialize es:di
lds si, [highAddr] ; Initialize ds:si
xor dl, dl ; Assign fill byte (0) to dl
call FillMemory ; Fill memory with dl
mov ax, 04C00h ; DOS function: Exit
int 21h ; Call DOS

;---------------------------------------------------------------
; GetAddresses Calculate high and low fill addresses
;---------------------------------------------------------------
; Input:
; es = PSP segment address (offset assumed to be 0000)
; Output:
; lowAddr = address one byte beyond stack
; highAddr = highest address allocated to program
; Note: assumes that highest possible stack address
; is < 0fffeh.
; Registers:
; ax
;---------------------------------------------------------------
PROC GetAddresses
mov [word lowAddr+2], ss ; Set lowAddr to byte
mov [word lowAddr], STKSIZE ; after end of stack
mov ax, [es:2] ; Get address from PSP
dec ax ; Correct value in ax
mov [word highAddr+2], ax ; Copy to variable
mov [word highAddr], 0fh ; Assign offset
ret ; Return to caller
ENDP GetAddresses

END Start ; End of program / entry point


  3 Responses to “Category : Miscellaneous Language Source Code
Archive   : MTD.ZIP
Filename : ZEROMEM.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/