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

 
Output of file : FILLTEST.ASM contained in archive : MTD.ZIP
%TITLE "Test fillmem module"

;** File: filltest.asm
;** Author: (c) 1990 by Tom Swan.

; Note: Run in TD. If exit code = 0, no errors detected, else
; exit code equals the failed test number.

JUMPS
IDEAL
MODEL small

STKSIZE EQU 4096 ; Stack size in bytes

STACK STKSIZE

cr EQU 13
lf EQU 10

SEGMENT DSeg Para Public 'DATA'

exitCode db 0

; ---- TEST1: 1-byte fill

t1s db 'TEST1',cr,lf,'$'
t1x db 0ffh
t1 db 0ffh ; Area to fill
t1y db 0ffh

test1 dw offset t1s ; Address of test name
dw offset t1x + 1 ; Address to start fill
dw offset t1y - 1 ; Address to end fill
dw offset t1y - offset t1

; ---- TEST2: 2-byte fill

t2s db 'TEST2',cr,lf,'$'
t2x db 0ffh
t2 dw 0ffffh ; Area to fill
t2y db 0ffh

test2 dw offset t2s
dw offset t2x + 1
dw offset t2y - 1
dw offset t2y - offset t2

; ---- TEST3: 4096-byte fill

t3s db 'TEST3',cr,lf,'$'
t3x db 0ffh
t3 db 4096 dup (0ffh) ; Area to fill
t3y db 0ffh

test3 dw offset t3s
dw offset t3x + 1
dw offset t3y - 1
dw offset t3y - offset t3

ENDS DSeg

CODESEG

; ---- From FILLMEM.OBJ:

EXTRN FillMemory:proc

ASSUME ds:DSeg

Start:
mov ax, DSeg ; Initialize DS and ES to
mov ds, ax ; address of data seg
mov es, ax

; ---- Run tests, which jump to Exit with exitCode = test #
; if any errors are detected.

mov bx, offset test1 ; Address test1's data
call PerformTest ; Perform test
mov bx, offset test2 ; Repeat for other tests
call PerformTest
mov bx, offset test3
call PerformTest

mov [exitCode], 0 ; No errors
Exit:
mov ah, 04Ch ; DOS terminate function
mov al, [exitCode] ; Load ERRORLEVEL code
int 21h ; End

; ---- Perform the fill test

PROC PerformTest
inc [exitCode] ; Identify test number
mov dx, [bx] ; Display test message
mov ah, 9 ; via DOS function 9
int 21h ; Call DOS function
mov di, [bx + 2] ; es:di = start address
mov si, [bx + 4] ; ds:si = end address
xor dl, dl ; dl = fill value (0)
call FillMemory ; Fill es:di to ds:si
cmp [byte es:di - 1], 0ffh ; Test byte before fill
jne Exit ; Jump if changed
cmp [byte ds:si + 1], 0ffh ; Test byte after fill
jne Exit ; Jump if changed
cmp [byte es:di], 0 ; Test first/single byte
jne Exit ; Jump if <> 0
mov cx, [bx + 6] ; cx = fill area size
xor al, al ; al = fill value (0)
repe scasb ; scan rest of fill area
jcxz @@10 ; Exit if cx = 0
jmp Exit ; Else jump to error
@@10:
ret ; Return to caller
ENDP PerformTest

END Start ; End of program / entry point



  3 Responses to “Category : Miscellaneous Language Source Code
Archive   : MTD.ZIP
Filename : FILLTEST.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/