程序变量在内存地址自动变了,TSR
title TSR(COM)
.386
option casemap:none
codeseg segment use16
assume cs:codeseg,ds:codeseg,ss:codeseg,es:codeseg
org 100h
start: jmp init
Msg db 'System funtion invocation',0ah,0dh,'$'
TSR proc near
push ax
push dx
mov ah,09h
lea dx,Msg;在装入user.com 时 Msg下移了16个字节,结果输出字符串中有一部分乱码?????
int 21h
pop dx
pop ax
iret
TSR endp
init: cli
mov ax,25F2h
lea dx,TSR
int 21h
mov ax,3100h
lea dx,init+15
shr dx,4
sti
int 21h
codeseg ends
end start
这个部分是我写的驻留程序,用空闲号0F2H 新增一个中断,其实这个程序只是在屏幕上显示一个字符串,下面的程序调用这个驻留的中断:
title user TO call syscall(TSR)
option casemap:none
codeseg segment
assume cs:codeseg,ds:codeseg,ss:codeseg,es:codeseg
org 100h
start: mov ah,09h
lea dx,Msg
int 21h
mov ah,07h
int 21h
int 0F2h
mov ax,4c00h
int 21h
Msg db "To invoke the syscall.com",0dh,0ah,'$'
codeseg ends
end start
主要问题是:先运行syscall.COM 时没问题,但是运行user.com时原来的在SYSCALL.COM中的Msg变量在内存中地址下移了16个字节不知为何?这时调用驻留程序输出的字符串中有一部分是乱码,高手指点