一个实用的内存测试程序
程序用宏汇编语言编写,取名为TESTMEMO.ASM,程序编译链接运行步骤如下:
C>MASM TESTMEMO;
C>LINK TESTMEMO;
C>EXE2BIN TESTMEMO.EXETE STMEMO.COM
C>TESTMEMO
源程序清单如下:
code segment
assume cs:code,ds:code
org 100h
memory proc far begin:
int12h
mov dx,40h
mul dx
mov dx,cs
sub ax,dx
push ax
mov dx,10h
mul dx
mov bx,offset mess+22
mov cx,6
mov si,0Ah
loopl:divsi
or dl,30h
mov [bx],dl
dec bx
xor dx,dx
loop loopl
xor ax,ax
mov es,ax
mov dx,offset mess
mov ah,9
int 21h
pop ax
cmp ax,es:[300h]
je stepl
mov es:[300h],ax
mov al,1
jmp short step2
stepl:
mov al,0
step2:
mov ah,4ch
int 21h
mess db'available memory
000000 bytes free',0Dh,
0Ah
db'$'
memory endp
code ends
end begin